aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/menus/gal-view-collection.c
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/menus/gal-view-collection.c')
-rw-r--r--widgets/menus/gal-view-collection.c134
1 files changed, 54 insertions, 80 deletions
diff --git a/widgets/menus/gal-view-collection.c b/widgets/menus/gal-view-collection.c
index acc96ccb1b..e53b5660f7 100644
--- a/widgets/menus/gal-view-collection.c
+++ b/widgets/menus/gal-view-collection.c
@@ -26,7 +26,6 @@
#include <util/e-i18n.h>
#include <ctype.h>
#include <string.h>
-#include <gtk/gtksignal.h>
#include <libxml/parser.h>
#include <libgnome/gnome-util.h>
#include <gal/util/e-util.h>
@@ -34,11 +33,9 @@
#include <gal/widgets/e-unicode.h>
#include "gal-view-collection.h"
-#define GVC_CLASS(e) ((GalViewCollectionClass *)((GtkObject *)e)->klass)
+#define PARENT_TYPE G_TYPE_OBJECT
-#define PARENT_TYPE gtk_object_get_type ()
-
-static GtkObjectClass *gal_view_collection_parent_class;
+static GObjectClass *gal_view_collection_parent_class;
#define d(x) x
@@ -65,9 +62,9 @@ gal_view_collection_display_view (GalViewCollection *collection,
g_return_if_fail (view != NULL);
g_return_if_fail (GAL_IS_VIEW (view));
- gtk_signal_emit (GTK_OBJECT (collection),
- gal_view_collection_signals [DISPLAY_VIEW],
- view);
+ g_signal_emit (collection,
+ gal_view_collection_signals [DISPLAY_VIEW], 0,
+ view);
}
static void
@@ -76,8 +73,8 @@ gal_view_collection_changed (GalViewCollection *collection)
g_return_if_fail (collection != NULL);
g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection));
- gtk_signal_emit (GTK_OBJECT (collection),
- gal_view_collection_signals [CHANGED]);
+ g_signal_emit (collection,
+ gal_view_collection_signals [CHANGED], 0);
}
static void
@@ -86,9 +83,9 @@ gal_view_collection_item_free (GalViewCollectionItem *item)
g_free(item->id);
if (item->view) {
if (item->view_changed_id)
- gtk_signal_disconnect (GTK_OBJECT (item->view),
- item->view_changed_id);
- gtk_object_unref(GTK_OBJECT(item->view));
+ g_signal_handler_disconnect (item->view,
+ item->view_changed_id);
+ g_object_unref(item->view);
}
g_free(item);
}
@@ -149,7 +146,7 @@ gal_view_generate_id (GalViewCollection *collection,
}
static void
-gal_view_collection_destroy (GtkObject *object)
+gal_view_collection_dispose (GObject *object)
{
GalViewCollection *collection = GAL_VIEW_COLLECTION(object);
int i;
@@ -184,35 +181,35 @@ gal_view_collection_destroy (GtkObject *object)
g_free (collection->title);
collection->title = NULL;
- if (gal_view_collection_parent_class->destroy)
- (*gal_view_collection_parent_class->destroy)(object);
+ if (gal_view_collection_parent_class->dispose)
+ (*gal_view_collection_parent_class->dispose)(object);
}
static void
-gal_view_collection_class_init (GtkObjectClass *object_class)
+gal_view_collection_class_init (GObjectClass *object_class)
{
GalViewCollectionClass *klass = GAL_VIEW_COLLECTION_CLASS(object_class);
- gal_view_collection_parent_class = gtk_type_class (PARENT_TYPE);
+ gal_view_collection_parent_class = g_type_class_ref (PARENT_TYPE);
- object_class->destroy = gal_view_collection_destroy;
+ object_class->dispose = gal_view_collection_dispose;
gal_view_collection_signals [DISPLAY_VIEW] =
- gtk_signal_new ("display_view",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GalViewCollectionClass, display_view),
- e_marshal_NONE__OBJECT,
- GTK_TYPE_NONE, 1, GAL_VIEW_TYPE);
+ g_signal_new ("display_view",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GalViewCollectionClass, display_view),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, GAL_VIEW_TYPE);
gal_view_collection_signals [CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GalViewCollectionClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, gal_view_collection_signals, LAST_SIGNAL);
+ g_signal_new ("changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GalViewCollectionClass, changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
klass->display_view = NULL;
klass->changed = NULL;
@@ -238,34 +235,7 @@ gal_view_collection_init (GalViewCollection *collection)
collection->title = NULL;
}
-/**
- * gal_view_collection_get_type:
- *
- */
-GtkType
-gal_view_collection_get_type (void)
-{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "GalViewCollection",
- sizeof (GalViewCollection),
- sizeof (GalViewCollectionClass),
- (GtkClassInitFunc) gal_view_collection_class_init,
- (GtkObjectInitFunc) gal_view_collection_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
+E_MAKE_TYPE(gal_view_collection, "GalViewCollection", GalViewCollection, gal_view_collection_class_init, gal_view_collection_init, PARENT_TYPE)
/**
* gal_view_collection_new:
@@ -275,7 +245,7 @@ gal_view_collection_get_type (void)
GalViewCollection *
gal_view_collection_new (void)
{
- return gtk_type_new(gal_view_collection_get_type());
+ return g_object_new (GAL_VIEW_COLLECTION_TYPE, NULL);
}
void
@@ -331,7 +301,7 @@ gal_view_collection_add_factory (GalViewCollection *collection,
g_return_if_fail (factory != NULL);
g_return_if_fail (GAL_IS_VIEW_FACTORY (factory));
- gtk_object_ref (GTK_OBJECT (factory));
+ g_object_ref (factory);
collection->factory_list = g_list_prepend (collection->factory_list, factory);
}
@@ -401,8 +371,8 @@ load_single_file (GalViewCollection *collection,
g_free(fullpath);
if (item->view) {
item->view_changed_id =
- gtk_signal_connect(GTK_OBJECT(item->view), "changed",
- GTK_SIGNAL_FUNC(view_changed), item);
+ g_signal_connect(item->view, "changed",
+ G_CALLBACK(view_changed), item);
}
}
return item;
@@ -426,10 +396,14 @@ load_single_dir (GalViewCollection *collection,
}
root = xmlDocGetRootElement(doc);
for (child = root->xmlChildrenNode; child; child = child->next) {
- gchar *id = e_xml_get_string_prop_by_name(child, "id");
+ gchar *id;
gboolean found = FALSE;
int i;
+ if (!strcmp (child->name, "text"))
+ continue;
+
+ id = e_xml_get_string_prop_by_name(child, "id");
for (i = 0; i < collection->view_count; i++) {
if (!strcmp(id, collection->view_data[i]->id)) {
if (!local)
@@ -667,11 +641,11 @@ gal_view_collection_append (GalViewCollection *collection,
item->filename = g_strdup_printf("%s.galview", item->id);
item->view = view;
item->collection = collection;
- gtk_object_ref(GTK_OBJECT(view));
+ g_object_ref(view);
item->view_changed_id =
- gtk_signal_connect(GTK_OBJECT(item->view), "changed",
- GTK_SIGNAL_FUNC(view_changed), item);
+ g_signal_connect(item->view, "changed",
+ G_CALLBACK (view_changed), item);
collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1);
collection->view_data[collection->view_count] = item;
@@ -732,8 +706,8 @@ gal_view_collection_copy_view (GalViewCollection *collection,
item->collection = collection;
item->view_changed_id =
- gtk_signal_connect(GTK_OBJECT(item->view), "changed",
- GTK_SIGNAL_FUNC(view_changed), item);
+ g_signal_connect(item->view, "changed",
+ G_CALLBACK (view_changed), item);
collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1);
collection->view_data[collection->view_count] = item;
@@ -772,11 +746,11 @@ gal_view_collection_append_with_title (GalViewCollection *collection, const char
item->filename = g_strdup_printf("%s.galview", item->id);
item->view = view;
item->collection = collection;
- gtk_object_ref(GTK_OBJECT(view));
+ g_object_ref(view);
item->view_changed_id =
- gtk_signal_connect(GTK_OBJECT(item->view), "changed",
- GTK_SIGNAL_FUNC(view_changed), item);
+ g_signal_connect(item->view, "changed",
+ G_CALLBACK (view_changed), item);
collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1);
collection->view_data[collection->view_count] = item;
@@ -803,11 +777,11 @@ gal_view_collection_set_nth_view (GalViewCollection *collection, int i, GalView
item = collection->view_data[i];
gal_view_set_title (view, item->title);
- gtk_object_ref (GTK_OBJECT (view));
+ g_object_ref (view);
if (item->view) {
- gtk_signal_disconnect (GTK_OBJECT (item->view),
- item->view_changed_id);
- gtk_object_unref (GTK_OBJECT (item->view));
+ g_signal_handler_disconnect (item->view,
+ item->view_changed_id);
+ g_object_unref (item->view);
}
item->view = view;
@@ -816,8 +790,8 @@ gal_view_collection_set_nth_view (GalViewCollection *collection, int i, GalView
item->type = g_strdup(gal_view_get_type_code(view));
item->view_changed_id =
- gtk_signal_connect(GTK_OBJECT(item->view), "changed",
- GTK_SIGNAL_FUNC(view_changed), item);
+ g_signal_connect(item->view, "changed",
+ G_CALLBACK (view_changed), item);
gal_view_collection_changed (collection);
return item->id;