aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/menus/gal-view-collection.c134
-rw-r--r--widgets/menus/gal-view-collection.h15
-rw-r--r--widgets/menus/gal-view-etable.c94
-rw-r--r--widgets/menus/gal-view-etable.h10
-rw-r--r--widgets/menus/gal-view-factory-etable.c46
-rw-r--r--widgets/menus/gal-view-factory-etable.h11
-rw-r--r--widgets/menus/gal-view-factory.c49
-rw-r--r--widgets/menus/gal-view-factory.h15
-rw-r--r--widgets/menus/gal-view-instance.c123
-rw-r--r--widgets/menus/gal-view-instance.h14
-rw-r--r--widgets/menus/gal-view.c84
-rw-r--r--widgets/menus/gal-view.h15
12 files changed, 235 insertions, 375 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;
diff --git a/widgets/menus/gal-view-collection.h b/widgets/menus/gal-view-collection.h
index 8ce6d1be82..9ba5eab71f 100644
--- a/widgets/menus/gal-view-collection.h
+++ b/widgets/menus/gal-view-collection.h
@@ -30,15 +30,16 @@
G_BEGIN_DECLS
#define GAL_VIEW_COLLECTION_TYPE (gal_view_collection_get_type ())
-#define GAL_VIEW_COLLECTION(o) (GTK_CHECK_CAST ((o), GAL_VIEW_COLLECTION_TYPE, GalViewCollection))
-#define GAL_VIEW_COLLECTION_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_COLLECTION_TYPE, GalViewCollectionClass))
-#define GAL_IS_VIEW_COLLECTION(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_COLLECTION_TYPE))
-#define GAL_IS_VIEW_COLLECTION_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_COLLECTION_TYPE))
+#define GAL_VIEW_COLLECTION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_VIEW_COLLECTION_TYPE, GalViewCollection))
+#define GAL_VIEW_COLLECTION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_VIEW_COLLECTION_TYPE, GalViewCollectionClass))
+#define GAL_IS_VIEW_COLLECTION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_VIEW_COLLECTION_TYPE))
+#define GAL_IS_VIEW_COLLECTION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_VIEW_COLLECTION_TYPE))
+#define GAL_VIEW_COLLECTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GAL_VIEW_COLLECTION_TYPE, GalViewCollectionClass))
typedef struct GalViewCollectionItem GalViewCollectionItem;
typedef struct {
- GtkObject base;
+ GObject base;
GalViewCollectionItem **view_data;
int view_count;
@@ -60,7 +61,7 @@ typedef struct {
} GalViewCollection;
typedef struct {
- GtkObjectClass parent_class;
+ GObjectClass parent_class;
/*
* Signals
@@ -84,7 +85,7 @@ struct GalViewCollectionItem {
};
/* Standard functions */
-GtkType gal_view_collection_get_type (void);
+GType gal_view_collection_get_type (void);
GalViewCollection *gal_view_collection_new (void);
void gal_view_collection_set_title (GalViewCollection *collection,
diff --git a/widgets/menus/gal-view-etable.c b/widgets/menus/gal-view-etable.c
index 20b58cfb4a..f12f6d7d66 100644
--- a/widgets/menus/gal-view-etable.c
+++ b/widgets/menus/gal-view-etable.c
@@ -22,7 +22,6 @@
*/
#include <config.h>
-#include <gtk/gtksignal.h>
#include "gal-view-etable.h"
#include <gal/e-table/e-table-config.h>
@@ -36,11 +35,11 @@ detach_table (GalViewEtable *view)
if (view->table == NULL)
return;
if (view->table_state_changed_id) {
- gtk_signal_disconnect (GTK_OBJECT (view->table),
- view->table_state_changed_id);
+ g_signal_handler_disconnect (view->table,
+ view->table_state_changed_id);
view->table_state_changed_id = 0;
}
- gtk_object_unref (GTK_OBJECT (view->table));
+ g_object_unref (view->table);
view->table = NULL;
}
@@ -50,11 +49,11 @@ detach_tree (GalViewEtable *view)
if (view->tree == NULL)
return;
if (view->tree_state_changed_id) {
- gtk_signal_disconnect (GTK_OBJECT (view->tree),
- view->tree_state_changed_id);
+ g_signal_handler_disconnect (view->tree,
+ view->tree_state_changed_id);
view->tree_state_changed_id = 0;
}
- gtk_object_unref (GTK_OBJECT (view->tree));
+ g_object_unref (view->tree);
view->tree = NULL;
}
@@ -63,10 +62,10 @@ config_changed (ETableConfig *config, GalViewEtable *view)
{
ETableState *state;
if (view->state)
- gtk_object_unref(GTK_OBJECT(view->state));
- gtk_object_get (GTK_OBJECT (config),
- "state", &state,
- NULL);
+ g_object_unref(view->state);
+ g_object_get (config,
+ "state", &state,
+ NULL);
view->state = e_table_state_duplicate(state);
gal_view_changed(GAL_VIEW(view));
}
@@ -81,8 +80,8 @@ gal_view_etable_edit (GalView *view)
etable_view->spec,
etable_view->state);
- gtk_signal_connect(GTK_OBJECT(config), "changed",
- GTK_SIGNAL_FUNC(config_changed), view);
+ g_signal_connect(config, "changed",
+ G_CALLBACK(config_changed), view);
}
static void
@@ -126,18 +125,18 @@ gal_view_etable_clone (GalView *view)
gve = GAL_VIEW_ETABLE(view);
- new = gtk_type_new (gal_view_etable_get_type ());
+ new = g_object_new (GAL_VIEW_ETABLE_TYPE, NULL);
new->spec = gve->spec;
new->title = g_strdup (gve->title);
new->state = e_table_state_duplicate(gve->state);
- gtk_object_ref(GTK_OBJECT(new->spec));
+ g_object_ref(new->spec);
return GAL_VIEW(new);
}
static void
-gal_view_etable_destroy (GtkObject *object)
+gal_view_etable_dispose (GObject *object)
{
GalViewEtable *view = GAL_VIEW_ETABLE(object);
@@ -147,22 +146,22 @@ gal_view_etable_destroy (GtkObject *object)
view->title = NULL;
if (view->spec)
- gtk_object_unref(GTK_OBJECT(view->spec));
+ g_object_unref(view->spec);
view->spec = NULL;
if (view->state)
- gtk_object_unref(GTK_OBJECT(view->state));
+ g_object_unref(view->state);
view->state = NULL;
- if (GTK_OBJECT_CLASS (gal_view_etable_parent_class)->destroy)
- (* GTK_OBJECT_CLASS (gal_view_etable_parent_class)->destroy) (object);
+ if (G_OBJECT_CLASS (gal_view_etable_parent_class)->dispose)
+ (* G_OBJECT_CLASS (gal_view_etable_parent_class)->dispose) (object);
}
static void
-gal_view_etable_class_init (GtkObjectClass *object_class)
+gal_view_etable_class_init (GObjectClass *object_class)
{
GalViewClass *gal_view_class = GAL_VIEW_CLASS(object_class);
- gal_view_etable_parent_class = gtk_type_class (PARENT_TYPE);
+ gal_view_etable_parent_class = g_type_class_ref (PARENT_TYPE);
gal_view_class->edit = gal_view_etable_edit ;
gal_view_class->load = gal_view_etable_load ;
@@ -172,7 +171,7 @@ gal_view_etable_class_init (GtkObjectClass *object_class)
gal_view_class->get_type_code = gal_view_etable_get_type_code;
gal_view_class->clone = gal_view_etable_clone ;
- object_class->destroy = gal_view_etable_destroy ;
+ object_class->dispose = gal_view_etable_dispose ;
}
static void
@@ -183,30 +182,7 @@ gal_view_etable_init (GalViewEtable *gve)
gve->title = NULL;
}
-GtkType
-gal_view_etable_get_type (void)
-{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "GalViewEtable",
- sizeof (GalViewEtable),
- sizeof (GalViewEtableClass),
- (GtkClassInitFunc) gal_view_etable_class_init,
- (GtkObjectInitFunc) gal_view_etable_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
+E_MAKE_TYPE(gal_view_etable, "GalViewEtable", GalViewEtable, gal_view_etable_class_init, gal_view_etable_init, PARENT_TYPE)
/**
* gal_view_etable_new
@@ -222,7 +198,7 @@ GalView *
gal_view_etable_new (ETableSpecification *spec,
const gchar *title)
{
- return gal_view_etable_construct (gtk_type_new (gal_view_etable_get_type ()), spec, title);
+ return gal_view_etable_construct (g_object_new (GAL_VIEW_ETABLE_TYPE, NULL), spec, title);
}
/**
@@ -242,11 +218,11 @@ gal_view_etable_construct (GalViewEtable *view,
const gchar *title)
{
if (spec)
- gtk_object_ref(GTK_OBJECT(spec));
+ g_object_ref(spec);
view->spec = spec;
if (view->state)
- gtk_object_unref(GTK_OBJECT(view->state));
+ g_object_unref(view->state);
view->state = e_table_state_duplicate(spec->state);
view->title = g_strdup(title);
@@ -258,7 +234,7 @@ void
gal_view_etable_set_state (GalViewEtable *view, ETableState *state)
{
if (view->state)
- gtk_object_unref(GTK_OBJECT(view->state));
+ g_object_unref(view->state);
view->state = e_table_state_duplicate(state);
gal_view_changed(GAL_VIEW(view));
@@ -270,7 +246,7 @@ table_state_changed (ETable *table, GalViewEtable *view)
ETableState *state;
state = e_table_get_state_object (table);
- gtk_object_unref (GTK_OBJECT (view->state));
+ g_object_unref (view->state);
view->state = state;
gal_view_changed(GAL_VIEW(view));
@@ -282,7 +258,7 @@ tree_state_changed (ETree *tree, GalViewEtable *view)
ETableState *state;
state = e_tree_get_state_object (tree);
- gtk_object_unref (GTK_OBJECT (view->state));
+ g_object_unref (view->state);
view->state = state;
gal_view_changed(GAL_VIEW(view));
@@ -296,10 +272,10 @@ gal_view_etable_attach_table (GalViewEtable *view, ETable *table)
view->table = table;
e_table_set_state_object(view->table, view->state);
- gtk_object_ref (GTK_OBJECT (view->table));
+ g_object_ref (view->table);
view->table_state_changed_id =
- gtk_signal_connect(GTK_OBJECT(view->table), "state_change",
- GTK_SIGNAL_FUNC (table_state_changed), view);
+ g_signal_connect(view->table, "state_change",
+ G_CALLBACK (table_state_changed), view);
}
void
@@ -310,10 +286,10 @@ gal_view_etable_attach_tree (GalViewEtable *view, ETree *tree)
view->tree = tree;
e_tree_set_state_object(view->tree, view->state);
- gtk_object_ref (GTK_OBJECT (view->tree));
+ g_object_ref (view->tree);
view->tree_state_changed_id =
- gtk_signal_connect(GTK_OBJECT(view->tree), "state_change",
- GTK_SIGNAL_FUNC (tree_state_changed), view);
+ g_signal_connect(view->tree, "state_change",
+ G_CALLBACK (tree_state_changed), view);
}
void
diff --git a/widgets/menus/gal-view-etable.h b/widgets/menus/gal-view-etable.h
index 0768d3ee93..65879663fa 100644
--- a/widgets/menus/gal-view-etable.h
+++ b/widgets/menus/gal-view-etable.h
@@ -34,10 +34,10 @@
G_BEGIN_DECLS
#define GAL_VIEW_ETABLE_TYPE (gal_view_etable_get_type ())
-#define GAL_VIEW_ETABLE(o) (GTK_CHECK_CAST ((o), GAL_VIEW_ETABLE_TYPE, GalViewEtable))
-#define GAL_VIEW_ETABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_ETABLE_TYPE, GalViewEtableClass))
-#define GAL_IS_VIEW_ETABLE(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_ETABLE_TYPE))
-#define GAL_IS_VIEW_ETABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_ETABLE_TYPE))
+#define GAL_VIEW_ETABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_VIEW_ETABLE_TYPE, GalViewEtable))
+#define GAL_VIEW_ETABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_VIEW_ETABLE_TYPE, GalViewEtableClass))
+#define GAL_IS_VIEW_ETABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_VIEW_ETABLE_TYPE))
+#define GAL_IS_VIEW_ETABLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_VIEW_ETABLE_TYPE))
typedef struct {
GalView base;
@@ -58,7 +58,7 @@ typedef struct {
} GalViewEtableClass;
/* Standard functions */
-GtkType gal_view_etable_get_type (void);
+GType gal_view_etable_get_type (void);
GalView *gal_view_etable_new (ETableSpecification *spec,
const gchar *title);
GalView *gal_view_etable_construct (GalViewEtable *view,
diff --git a/widgets/menus/gal-view-factory-etable.c b/widgets/menus/gal-view-factory-etable.c
index 1e68c1b4ae..46a7eb2e79 100644
--- a/widgets/menus/gal-view-factory-etable.c
+++ b/widgets/menus/gal-view-factory-etable.c
@@ -23,11 +23,10 @@
#include <config.h>
#include "gal/util/e-i18n.h"
+#include "gal/util/e-util.h"
#include "gal-view-factory-etable.h"
#include "gal-view-etable.h"
-#define GVFE_CLASS(e) ((GalViewFactoryEtableClass *)((GtkObject *)e)->klass)
-
#define PARENT_TYPE gal_view_factory_get_type ()
static GalViewFactoryClass *gal_view_factory_etable_parent_class;
@@ -52,29 +51,29 @@ gal_view_factory_etable_get_type_code (GalViewFactory *factory)
}
static void
-gal_view_factory_etable_destroy (GtkObject *object)
+gal_view_factory_etable_dispose (GObject *object)
{
GalViewFactoryEtable *factory = GAL_VIEW_FACTORY_ETABLE(object);
if (factory->spec)
- gtk_object_unref(GTK_OBJECT(factory->spec));
+ g_object_unref(factory->spec);
factory->spec = NULL;
- if (GTK_OBJECT_CLASS (gal_view_factory_etable_parent_class)->destroy)
- (* GTK_OBJECT_CLASS (gal_view_factory_etable_parent_class)->destroy) (object);
+ if (G_OBJECT_CLASS (gal_view_factory_etable_parent_class)->dispose)
+ (* G_OBJECT_CLASS (gal_view_factory_etable_parent_class)->dispose) (object);
}
static void
-gal_view_factory_etable_class_init (GtkObjectClass *object_class)
+gal_view_factory_etable_class_init (GObjectClass *object_class)
{
GalViewFactoryClass *view_factory_class = GAL_VIEW_FACTORY_CLASS(object_class);
- gal_view_factory_etable_parent_class = gtk_type_class (PARENT_TYPE);
+ gal_view_factory_etable_parent_class = g_type_class_ref (PARENT_TYPE);
view_factory_class->get_title = gal_view_factory_etable_get_title;
view_factory_class->new_view = gal_view_factory_etable_new_view;
view_factory_class->get_type_code = gal_view_factory_etable_get_type_code;
- object_class->destroy = gal_view_factory_etable_destroy;
+ object_class->dispose = gal_view_factory_etable_dispose;
}
static void
@@ -95,7 +94,7 @@ gal_view_factory_etable_init (GalViewFactoryEtable *factory)
GalViewFactory *
gal_view_factory_etable_new (ETableSpecification *spec)
{
- return gal_view_factory_etable_construct (gtk_type_new (gal_view_factory_etable_get_type ()), spec);
+ return gal_view_factory_etable_construct (g_object_new (GAL_VIEW_FACTORY_ETABLE_TYPE, NULL), spec);
}
/**
@@ -113,32 +112,9 @@ gal_view_factory_etable_construct (GalViewFactoryEtable *factory,
ETableSpecification *spec)
{
if (spec)
- gtk_object_ref(GTK_OBJECT(spec));
+ g_object_ref(spec);
factory->spec = spec;
return GAL_VIEW_FACTORY(factory);
}
-GtkType
-gal_view_factory_etable_get_type (void)
-{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "GalViewFactoryEtable",
- sizeof (GalViewFactoryEtable),
- sizeof (GalViewFactoryEtableClass),
- (GtkClassInitFunc) gal_view_factory_etable_class_init,
- (GtkObjectInitFunc) gal_view_factory_etable_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
+E_MAKE_TYPE(gal_view_factory_etable, "GalViewFactoryEtable", GalViewFactoryEtable, gal_view_factory_etable_class_init, gal_view_factory_etable_init, PARENT_TYPE)
diff --git a/widgets/menus/gal-view-factory-etable.h b/widgets/menus/gal-view-factory-etable.h
index 502f39b5f6..542aa255fc 100644
--- a/widgets/menus/gal-view-factory-etable.h
+++ b/widgets/menus/gal-view-factory-etable.h
@@ -33,10 +33,11 @@ extern "C" {
#endif /* __cplusplus */
#define GAL_VIEW_FACTORY_ETABLE_TYPE (gal_view_factory_etable_get_type ())
-#define GAL_VIEW_FACTORY_ETABLE(o) (GTK_CHECK_CAST ((o), GAL_VIEW_FACTORY_ETABLE_TYPE, GalViewFactoryEtable))
-#define GAL_VIEW_FACTORY_ETABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_FACTORY_ETABLE_TYPE, GalViewFactoryEtableClass))
-#define GAL_IS_VIEW_FACTORY_ETABLE(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_FACTORY_ETABLE_TYPE))
-#define GAL_IS_VIEW_FACTORY_ETABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_FACTORY_ETABLE_TYPE))
+#define GAL_VIEW_FACTORY_ETABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_VIEW_FACTORY_ETABLE_TYPE, GalViewFactoryEtable))
+#define GAL_VIEW_FACTORY_ETABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_VIEW_FACTORY_ETABLE_TYPE, GalViewFactoryEtableClass))
+#define GAL_IS_VIEW_FACTORY_ETABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_VIEW_FACTORY_ETABLE_TYPE))
+#define GAL_IS_VIEW_FACTORY_ETABLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_VIEW_FACTORY_ETABLE_TYPE))
+#define GAL_VIEW_FACTORY_ETABLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GAL_VIEW_FACTORY_ETABLE_TYPE, GalViewFactoryEtableClass))
typedef struct {
GalViewFactory base;
@@ -49,7 +50,7 @@ typedef struct {
} GalViewFactoryEtableClass;
/* Standard functions */
-GtkType gal_view_factory_etable_get_type (void);
+GType gal_view_factory_etable_get_type (void);
GalViewFactory *gal_view_factory_etable_new (ETableSpecification *spec);
GalViewFactory *gal_view_factory_etable_construct (GalViewFactoryEtable *factory,
ETableSpecification *spec);
diff --git a/widgets/menus/gal-view-factory.c b/widgets/menus/gal-view-factory.c
index 7655fd8e90..5bc2c9f11d 100644
--- a/widgets/menus/gal-view-factory.c
+++ b/widgets/menus/gal-view-factory.c
@@ -23,16 +23,15 @@
#include <config.h>
#include "gal-view-factory.h"
+#include "gal/util/e-util.h"
-#define GVF_CLASS(e) ((GalViewFactoryClass *)(GTK_OBJECT_GET_CLASS (e)))
-
-#define PARENT_TYPE gtk_object_get_type ()
+#define PARENT_TYPE G_TYPE_OBJECT
#define d(x)
d(static gint depth = 0;)
-static GtkObjectClass *gal_view_factory_parent_class;
+static GObjectClass *gal_view_factory_parent_class;
/**
* gal_view_factory_get_title:
@@ -46,8 +45,8 @@ gal_view_factory_get_title (GalViewFactory *factory)
g_return_val_if_fail (factory != NULL, 0);
g_return_val_if_fail (GAL_IS_VIEW_FACTORY (factory), 0);
- if (GVF_CLASS (factory)->get_title)
- return GVF_CLASS (factory)->get_title (factory);
+ if (GAL_VIEW_FACTORY_GET_CLASS (factory)->get_title)
+ return GAL_VIEW_FACTORY_GET_CLASS (factory)->get_title (factory);
else
return NULL;
}
@@ -66,8 +65,8 @@ gal_view_factory_new_view (GalViewFactory *factory,
g_return_val_if_fail (factory != NULL, NULL);
g_return_val_if_fail (GAL_IS_VIEW_FACTORY (factory), NULL);
- if (GVF_CLASS (factory)->new_view)
- return GVF_CLASS (factory)->new_view (factory, name);
+ if (GAL_VIEW_FACTORY_GET_CLASS (factory)->new_view)
+ return GAL_VIEW_FACTORY_GET_CLASS (factory)->new_view (factory, name);
else
return NULL;
}
@@ -84,43 +83,25 @@ gal_view_factory_get_type_code (GalViewFactory *factory)
g_return_val_if_fail (factory != NULL, NULL);
g_return_val_if_fail (GAL_IS_VIEW_FACTORY (factory), NULL);
- if (GVF_CLASS (factory)->get_type_code)
- return GVF_CLASS (factory)->get_type_code (factory);
+ if (GAL_VIEW_FACTORY_GET_CLASS (factory)->get_type_code)
+ return GAL_VIEW_FACTORY_GET_CLASS (factory)->get_type_code (factory);
else
return NULL;
}
static void
-gal_view_factory_class_init (GtkObjectClass *object_class)
+gal_view_factory_class_init (GObjectClass *object_class)
{
GalViewFactoryClass *klass = GAL_VIEW_FACTORY_CLASS(object_class);
- gal_view_factory_parent_class = gtk_type_class (PARENT_TYPE);
+ gal_view_factory_parent_class = g_type_class_ref (PARENT_TYPE);
klass->get_title = NULL;
klass->new_view = NULL;
}
-GtkType
-gal_view_factory_get_type (void)
+static void
+gal_view_factory_init (GalViewFactory *factory)
{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "GalViewFactory",
- sizeof (GalViewFactory),
- sizeof (GalViewFactoryClass),
- (GtkClassInitFunc) gal_view_factory_class_init,
- NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
}
+
+E_MAKE_TYPE(gal_view_factory, "GalViewFactory", GalViewFactory, gal_view_factory_class_init, gal_view_factory_init, PARENT_TYPE)
diff --git a/widgets/menus/gal-view-factory.h b/widgets/menus/gal-view-factory.h
index b02c728517..5fff83e048 100644
--- a/widgets/menus/gal-view-factory.h
+++ b/widgets/menus/gal-view-factory.h
@@ -32,17 +32,18 @@ extern "C" {
#endif /* __cplusplus */
#define GAL_VIEW_FACTORY_TYPE (gal_view_factory_get_type ())
-#define GAL_VIEW_FACTORY(o) (GTK_CHECK_CAST ((o), GAL_VIEW_FACTORY_TYPE, GalViewFactory))
-#define GAL_VIEW_FACTORY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_FACTORY_TYPE, GalViewFactoryClass))
-#define GAL_IS_VIEW_FACTORY(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_FACTORY_TYPE))
-#define GAL_IS_VIEW_FACTORY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_FACTORY_TYPE))
+#define GAL_VIEW_FACTORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_VIEW_FACTORY_TYPE, GalViewFactory))
+#define GAL_VIEW_FACTORY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_VIEW_FACTORY_TYPE, GalViewFactoryClass))
+#define GAL_IS_VIEW_FACTORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_VIEW_FACTORY_TYPE))
+#define GAL_IS_VIEW_FACTORY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_VIEW_FACTORY_TYPE))
+#define GAL_VIEW_FACTORY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GAL_VIEW_FACTORY_TYPE, GalViewFactoryClass))
typedef struct {
- GtkObject base;
+ GObject base;
} GalViewFactory;
typedef struct {
- GtkObjectClass parent_class;
+ GObjectClass parent_class;
/*
* Virtual methods
@@ -54,7 +55,7 @@ typedef struct {
} GalViewFactoryClass;
/* Standard functions */
-GtkType gal_view_factory_get_type (void);
+GType gal_view_factory_get_type (void);
/* Query functions */
/* Returns already translated title. */
diff --git a/widgets/menus/gal-view-instance.c b/widgets/menus/gal-view-instance.c
index ebe823357f..87747931f4 100644
--- a/widgets/menus/gal-view-instance.c
+++ b/widgets/menus/gal-view-instance.c
@@ -40,11 +40,9 @@
#include <unistd.h>
#include <gtk/gtkcheckmenuitem.h>
-#define GVI_CLASS(e) ((GalViewInstanceClass *)((GtkObject *)e)->klass)
+#define PARENT_TYPE G_TYPE_OBJECT
-#define PARENT_TYPE gtk_object_get_type ()
-
-static GtkObjectClass *gal_view_instance_parent_class;
+static GObjectClass *gal_view_instance_parent_class;
static const EPopupMenu separator = E_POPUP_SEPARATOR;
static const EPopupMenu terminator = E_POPUP_TERMINATOR;
@@ -66,8 +64,8 @@ gal_view_instance_changed (GalViewInstance *instance)
g_return_if_fail (instance != NULL);
g_return_if_fail (GAL_IS_VIEW_INSTANCE (instance));
- gtk_signal_emit (GTK_OBJECT (instance),
- gal_view_instance_signals [CHANGED]);
+ g_signal_emit (instance,
+ gal_view_instance_signals [CHANGED], 0);
}
static void
@@ -76,9 +74,9 @@ gal_view_instance_display_view (GalViewInstance *instance, GalView *view)
g_return_if_fail (instance != NULL);
g_return_if_fail (GAL_IS_VIEW_INSTANCE (instance));
- gtk_signal_emit (GTK_OBJECT (instance),
- gal_view_instance_signals [DISPLAY_VIEW],
- view);
+ g_signal_emit (instance,
+ gal_view_instance_signals [DISPLAY_VIEW], 0,
+ view);
}
static void
@@ -118,11 +116,11 @@ disconnect_view (GalViewInstance *instance)
{
if (instance->current_view) {
if (instance->view_changed_id) {
- gtk_signal_disconnect (GTK_OBJECT (instance->current_view),
- instance->view_changed_id);
+ g_signal_handler_disconnect (instance->current_view,
+ instance->view_changed_id);
}
- gtk_object_unref (GTK_OBJECT (instance->current_view));
+ g_object_unref (instance->current_view);
}
g_free (instance->current_type);
g_free (instance->current_title);
@@ -142,23 +140,23 @@ connect_view (GalViewInstance *instance, GalView *view)
instance->current_title = g_strdup (gal_view_get_title(view));
instance->current_type = g_strdup (gal_view_get_type_code(view));
instance->view_changed_id =
- gtk_signal_connect(GTK_OBJECT(instance->current_view), "changed",
- GTK_SIGNAL_FUNC(view_changed), instance);
+ g_signal_connect(instance->current_view, "changed",
+ G_CALLBACK (view_changed), instance);
gal_view_instance_display_view (instance, instance->current_view);
}
static void
-gal_view_instance_destroy (GtkObject *object)
+gal_view_instance_dispose (GObject *object)
{
GalViewInstance *instance = GAL_VIEW_INSTANCE(object);
if (instance->collection) {
if (instance->collection_changed_id) {
- gtk_signal_disconnect (GTK_OBJECT (instance->collection),
- instance->collection_changed_id);
+ g_signal_handler_disconnect (instance->collection,
+ instance->collection_changed_id);
}
- gtk_object_unref (GTK_OBJECT (instance->collection));
+ g_object_unref (instance->collection);
}
g_free (instance->instance_id);
@@ -170,35 +168,35 @@ gal_view_instance_destroy (GtkObject *object)
g_free (instance->default_view);
- if (gal_view_instance_parent_class->destroy)
- (*gal_view_instance_parent_class->destroy)(object);
+ if (gal_view_instance_parent_class->dispose)
+ (*gal_view_instance_parent_class->dispose)(object);
}
static void
-gal_view_instance_class_init (GtkObjectClass *object_class)
+gal_view_instance_class_init (GObjectClass *object_class)
{
GalViewInstanceClass *klass = GAL_VIEW_INSTANCE_CLASS(object_class);
- gal_view_instance_parent_class = gtk_type_class (PARENT_TYPE);
+ gal_view_instance_parent_class = g_type_class_ref (PARENT_TYPE);
- object_class->destroy = gal_view_instance_destroy;
+ object_class->dispose = gal_view_instance_dispose;
gal_view_instance_signals [DISPLAY_VIEW] =
- gtk_signal_new ("display_view",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GalViewInstanceClass, display_view),
- gtk_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 (GalViewInstanceClass, display_view),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, GAL_VIEW_TYPE);
gal_view_instance_signals [CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GalViewInstanceClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, gal_view_instance_signals, LAST_SIGNAL);
+ g_signal_new ("changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GalViewInstanceClass, changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
klass->display_view = NULL;
klass->changed = NULL;
@@ -225,34 +223,7 @@ gal_view_instance_init (GalViewInstance *instance)
instance->default_view = NULL;
}
-/**
- * gal_view_instance_get_type:
- *
- */
-GtkType
-gal_view_instance_get_type (void)
-{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "GalViewInstance",
- sizeof (GalViewInstance),
- sizeof (GalViewInstanceClass),
- (GtkClassInitFunc) gal_view_instance_class_init,
- (GtkObjectInitFunc) gal_view_instance_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
+E_MAKE_TYPE(gal_view_instance, "GalViewInstance", GalViewInstance, gal_view_instance_class_init, gal_view_instance_init, PARENT_TYPE)
static void
collection_changed (GalView *view, GalViewInstance *instance)
@@ -330,11 +301,11 @@ load_current_view (GalViewInstance *instance)
GalViewInstance *
gal_view_instance_new (GalViewCollection *collection, const char *instance_id)
{
- GalViewInstance *instance = gtk_type_new(gal_view_instance_get_type());
+ GalViewInstance *instance = g_object_new (GAL_VIEW_INSTANCE_TYPE, NULL);
if (gal_view_instance_construct (instance, collection, instance_id))
return instance;
else {
- gtk_object_unref (GTK_OBJECT (instance));
+ g_object_unref (instance);
return NULL;
}
}
@@ -349,10 +320,10 @@ gal_view_instance_construct (GalViewInstance *instance, GalViewCollection *colle
instance->collection = collection;
if (collection)
- gtk_object_ref (GTK_OBJECT (collection));
+ g_object_ref (collection);
instance->collection_changed_id =
- gtk_signal_connect (GTK_OBJECT (collection), "changed",
- GTK_SIGNAL_FUNC (collection_changed), instance);
+ g_signal_connect (collection, "changed",
+ G_CALLBACK (collection_changed), instance);
instance->instance_id = g_strdup (instance_id);
safe_id = g_strdup (instance->instance_id);
@@ -441,8 +412,8 @@ void
gal_view_instance_save_as (GalViewInstance *instance)
{
GtkWidget *dialog = gal_view_instance_save_as_dialog_new(instance);
- gtk_signal_connect(GTK_OBJECT(dialog), "clicked",
- GTK_SIGNAL_FUNC(dialog_clicked), instance);
+ g_signal_connect(dialog, "clicked",
+ G_CALLBACK(dialog_clicked), instance);
gtk_widget_show(dialog);
}
@@ -547,8 +518,8 @@ define_views_cb(GtkWidget *widget,
GalViewInstance *instance)
{
GtkWidget *dialog = gal_define_views_dialog_new(instance->collection);
- gtk_signal_connect(GTK_OBJECT(dialog), "clicked",
- GTK_SIGNAL_FUNC(define_views_dialog_clicked), instance);
+ g_signal_connect(dialog, "clicked",
+ G_CALLBACK(define_views_dialog_clicked), instance);
gtk_widget_show(dialog);
}
@@ -581,7 +552,7 @@ gal_view_instance_get_popup_menu (GalViewInstance *instance)
closure = g_new (ListenerClosure, 1);
closure->instance = instance;
closure->id = item->id;
- gtk_object_ref (GTK_OBJECT(closure->instance));
+ g_object_ref (closure->instance);
if (!found && id && !strcmp (id, item->id)) {
found = TRUE;
@@ -611,7 +582,7 @@ gal_view_instance_free_popup_menu (GalViewInstance *instance, EPopupMenu *menu)
int i;
/* This depends on the first non-custom closure to be a separator or a terminator. */
for (i = 0; menu[i].name && *(menu[i].name); i++) {
- gtk_object_unref (GTK_OBJECT ( ((ListenerClosure *)(menu[i].closure))->instance));
+ g_object_unref (((ListenerClosure *)(menu[i].closure))->instance);
g_free (menu[i].closure);
}
diff --git a/widgets/menus/gal-view-instance.h b/widgets/menus/gal-view-instance.h
index bc396af231..05723a2ea6 100644
--- a/widgets/menus/gal-view-instance.h
+++ b/widgets/menus/gal-view-instance.h
@@ -31,13 +31,13 @@
G_BEGIN_DECLS
#define GAL_VIEW_INSTANCE_TYPE (gal_view_instance_get_type ())
-#define GAL_VIEW_INSTANCE(o) (GTK_CHECK_CAST ((o), GAL_VIEW_INSTANCE_TYPE, GalViewInstance))
-#define GAL_VIEW_INSTANCE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_INSTANCE_TYPE, GalViewInstanceClass))
-#define GAL_IS_VIEW_INSTANCE(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_INSTANCE_TYPE))
-#define GAL_IS_VIEW_INSTANCE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_INSTANCE_TYPE))
+#define GAL_VIEW_INSTANCE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_VIEW_INSTANCE_TYPE, GalViewInstance))
+#define GAL_VIEW_INSTANCE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_VIEW_INSTANCE_TYPE, GalViewInstanceClass))
+#define GAL_IS_VIEW_INSTANCE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_VIEW_INSTANCE_TYPE))
+#define GAL_IS_VIEW_INSTANCE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_VIEW_INSTANCE_TYPE))
typedef struct {
- GtkObject base;
+ GObject base;
GalViewCollection *collection;
@@ -59,7 +59,7 @@ typedef struct {
} GalViewInstance;
typedef struct {
- GtkObjectClass parent_class;
+ GObjectClass parent_class;
/*
* Signals
@@ -70,7 +70,7 @@ typedef struct {
} GalViewInstanceClass;
/* Standard functions */
-GtkType gal_view_instance_get_type (void);
+GType gal_view_instance_get_type (void);
/* */
/*collection should be loaded when you call this.
diff --git a/widgets/menus/gal-view.c b/widgets/menus/gal-view.c
index 0645367fb9..8554c4c5de 100644
--- a/widgets/menus/gal-view.c
+++ b/widgets/menus/gal-view.c
@@ -22,20 +22,17 @@
*/
#include <config.h>
-#include <gtk/gtksignal.h>
#include "gal-view.h"
#include "gal/util/e-util.h"
-#define GV_CLASS(e) ((GalViewClass *)(GTK_OBJECT_GET_CLASS (e)))
-
-#define PARENT_TYPE gtk_object_get_type ()
+#define PARENT_TYPE G_TYPE_OBJECT
#define d(x)
d(static gint depth = 0;)
-static GtkObjectClass *gal_view_parent_class;
+static GObjectClass *gal_view_parent_class;
enum {
CHANGED,
@@ -54,8 +51,8 @@ gal_view_edit (GalView *view)
g_return_if_fail (view != NULL);
g_return_if_fail (GAL_IS_VIEW (view));
- if (GV_CLASS (view)->edit)
- GV_CLASS (view)->edit (view);
+ if (GAL_VIEW_GET_CLASS (view)->edit)
+ GAL_VIEW_GET_CLASS (view)->edit (view);
}
/**
@@ -70,8 +67,8 @@ gal_view_load (GalView *view,
g_return_if_fail (view != NULL);
g_return_if_fail (GAL_IS_VIEW (view));
- if (GV_CLASS (view)->load)
- GV_CLASS (view)->load (view, filename);
+ if (GAL_VIEW_GET_CLASS (view)->load)
+ GAL_VIEW_GET_CLASS (view)->load (view, filename);
}
/**
@@ -86,8 +83,8 @@ gal_view_save (GalView *view,
g_return_if_fail (view != NULL);
g_return_if_fail (GAL_IS_VIEW (view));
- if (GV_CLASS (view)->save)
- GV_CLASS (view)->save (view, filename);
+ if (GAL_VIEW_GET_CLASS (view)->save)
+ GAL_VIEW_GET_CLASS (view)->save (view, filename);
}
/**
@@ -102,8 +99,8 @@ gal_view_get_title (GalView *view)
g_return_val_if_fail (view != NULL, NULL);
g_return_val_if_fail (GAL_IS_VIEW (view), NULL);
- if (GV_CLASS (view)->get_title)
- return GV_CLASS (view)->get_title (view);
+ if (GAL_VIEW_GET_CLASS (view)->get_title)
+ return GAL_VIEW_GET_CLASS (view)->get_title (view);
else
return NULL;
}
@@ -120,8 +117,8 @@ gal_view_set_title (GalView *view,
g_return_if_fail (view != NULL);
g_return_if_fail (GAL_IS_VIEW (view));
- if (GV_CLASS (view)->set_title)
- GV_CLASS (view)->set_title (view, title);
+ if (GAL_VIEW_GET_CLASS (view)->set_title)
+ GAL_VIEW_GET_CLASS (view)->set_title (view, title);
}
/**
@@ -136,8 +133,8 @@ gal_view_get_type_code (GalView *view)
g_return_val_if_fail (view != NULL, NULL);
g_return_val_if_fail (GAL_IS_VIEW (view), NULL);
- if (GV_CLASS (view)->get_type_code)
- return GV_CLASS (view)->get_type_code (view);
+ if (GAL_VIEW_GET_CLASS (view)->get_type_code)
+ return GAL_VIEW_GET_CLASS (view)->get_type_code (view);
else
return NULL;
}
@@ -154,8 +151,8 @@ gal_view_clone (GalView *view)
g_return_val_if_fail (view != NULL, NULL);
g_return_val_if_fail (GAL_IS_VIEW (view), NULL);
- if (GV_CLASS (view)->clone)
- return GV_CLASS (view)->clone (view);
+ if (GAL_VIEW_GET_CLASS (view)->clone)
+ return GAL_VIEW_GET_CLASS (view)->clone (view);
else
return NULL;
}
@@ -170,15 +167,15 @@ gal_view_changed (GalView *view)
g_return_if_fail (view != NULL);
g_return_if_fail (GAL_IS_VIEW (view));
- gtk_signal_emit(GTK_OBJECT(view),
- gal_view_signals [CHANGED]);
+ g_signal_emit(view,
+ gal_view_signals [CHANGED], 0);
}
static void
-gal_view_class_init (GtkObjectClass *object_class)
+gal_view_class_init (GObjectClass *object_class)
{
GalViewClass *klass = GAL_VIEW_CLASS(object_class);
- gal_view_parent_class = gtk_type_class (PARENT_TYPE);
+ gal_view_parent_class = g_type_class_ref (PARENT_TYPE);
klass->edit = NULL;
klass->load = NULL;
@@ -189,37 +186,18 @@ gal_view_class_init (GtkObjectClass *object_class)
klass->changed = NULL;
gal_view_signals [CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GalViewClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, gal_view_signals, LAST_SIGNAL);
+ g_signal_new ("changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GalViewClass, changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
-GtkType
-gal_view_get_type (void)
+static void
+gal_view_init (GalView *view)
{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "GalView",
- sizeof (GalView),
- sizeof (GalViewClass),
- (GtkClassInitFunc) gal_view_class_init,
- NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
}
+
+E_MAKE_TYPE(gal_view, "GalView", GalView, gal_view_class_init, gal_view_init, PARENT_TYPE)
diff --git a/widgets/menus/gal-view.h b/widgets/menus/gal-view.h
index e47a4fb6e1..5ae99b8535 100644
--- a/widgets/menus/gal-view.h
+++ b/widgets/menus/gal-view.h
@@ -32,17 +32,18 @@ extern "C" {
#endif /* __cplusplus */
#define GAL_VIEW_TYPE (gal_view_get_type ())
-#define GAL_VIEW(o) (GTK_CHECK_CAST ((o), GAL_VIEW_TYPE, GalView))
-#define GAL_VIEW_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_TYPE, GalViewClass))
-#define GAL_IS_VIEW(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_TYPE))
-#define GAL_IS_VIEW_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_TYPE))
+#define GAL_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_VIEW_TYPE, GalView))
+#define GAL_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_VIEW_TYPE, GalViewClass))
+#define GAL_IS_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_VIEW_TYPE))
+#define GAL_IS_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_VIEW_TYPE))
+#define GAL_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GAL_VIEW_TYPE, GalViewClass))
typedef struct {
- GtkObject base;
+ GObject base;
} GalView;
typedef struct {
- GtkObjectClass parent_class;
+ GObjectClass parent_class;
/*
* Virtual methods
@@ -63,7 +64,7 @@ typedef struct {
} GalViewClass;
/* Standard functions */
-GtkType gal_view_get_type (void);
+GType gal_view_get_type (void);
/* Open an editor dialog for this view. */
void gal_view_edit (GalView *view);