diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-08-24 23:21:41 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-08-25 02:37:02 +0800 |
commit | ecf3434da05b1f39f793c24b38bfd278e10b5786 (patch) | |
tree | 485ed2399920ecb10dbee2b4db4c437c22574a20 | |
parent | f1d2541c487fbf7433a1b9aad8e8982ef08b85f5 (diff) | |
download | gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.gz gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.bz2 gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.lz gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.xz gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.zst gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.zip |
GObject boilerplate cleanup.
Prefer thread-safe G_DEFINE_TYPE and G_DEFINE_INTERFACE macros over
manual GType registration.
This is just a start... lots more to do.
127 files changed, 1302 insertions, 3307 deletions
diff --git a/calendar/gui/dialogs/e-send-options-utils.c b/calendar/gui/dialogs/e-send-options-utils.c index c4ed13f2cb..c56caab8bf 100644 --- a/calendar/gui/dialogs/e-send-options-utils.c +++ b/calendar/gui/dialogs/e-send-options-utils.c @@ -28,7 +28,7 @@ #include <string.h> void -e_sendoptions_utils_set_default_data (ESendOptionsDialog *sod, ESource *source, const gchar *type) +e_send_options_utils_set_default_data (ESendOptionsDialog *sod, ESource *source, const gchar *type) { ESendOptionsGeneral *gopts = NULL; ESendOptionsStatusTracking *sopts; @@ -151,7 +151,7 @@ e_sendoptions_utils_set_default_data (ESendOptionsDialog *sod, ESource *source, } void -e_sendoptions_utils_fill_component (ESendOptionsDialog *sod, ECalComponent *comp) +e_send_options_utils_fill_component (ESendOptionsDialog *sod, ECalComponent *comp) { gint i = 1; icalproperty *prop; @@ -165,7 +165,7 @@ e_sendoptions_utils_fill_component (ESendOptionsDialog *sod, ECalComponent *comp e_cal_component_set_sequence (comp, &i); icalcomp = e_cal_component_get_icalcomponent (comp); - if (e_sendoptions_get_need_general_options (sod)) { + if (e_send_options_get_need_general_options (sod)) { prop = icalproperty_new_x ((const gchar *) g_strdup_printf ("%d", gopts->priority)); icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-PRIORITY"); icalcomponent_add_property (icalcomp, prop); diff --git a/calendar/gui/dialogs/e-send-options-utils.h b/calendar/gui/dialogs/e-send-options-utils.h index 01cf3ed2e9..d6852b8f5a 100644 --- a/calendar/gui/dialogs/e-send-options-utils.h +++ b/calendar/gui/dialogs/e-send-options-utils.h @@ -29,6 +29,6 @@ #include <libecal/e-cal-component.h> #include <libedataserver/e-source-list.h> -void e_sendoptions_utils_set_default_data (ESendOptionsDialog *sod, ESource *source, const gchar *type); -void e_sendoptions_utils_fill_component (ESendOptionsDialog *sod, ECalComponent *comp); +void e_send_options_utils_set_default_data (ESendOptionsDialog *sod, ESource *source, const gchar *type); +void e_send_options_utils_fill_component (ESendOptionsDialog *sod, ECalComponent *comp); #endif diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 177482f808..396b9b8d08 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -197,7 +197,7 @@ static void action_send_options_cb (GtkAction *action, EventEditor *editor) { - event_page_sendoptions_clicked_cb (editor->priv->event_page); + event_page_send_options_clicked_cb (editor->priv->event_page); } static void diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index fd42d93a81..b221368f94 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -1401,7 +1401,7 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) /* send options */ if (priv->sendoptions_shown && priv->sod) - e_sendoptions_utils_fill_component (priv->sod, comp); + e_send_options_utils_fill_component (priv->sod, comp); /* Alarm */ e_cal_component_remove_all_alarms (comp); @@ -2581,7 +2581,7 @@ categories_clicked_cb (GtkWidget *button, } void -event_page_sendoptions_clicked_cb (EventPage *epage) +event_page_send_options_clicked_cb (EventPage *epage) { EventPagePrivate *priv; CompEditor *editor; @@ -2594,19 +2594,19 @@ event_page_sendoptions_clicked_cb (EventPage *epage) client = comp_editor_get_client (editor); if (!priv->sod) { - priv->sod = e_sendoptions_dialog_new (); + priv->sod = e_send_options_dialog_new (); source = e_source_combo_box_get_active ( E_SOURCE_COMBO_BOX (priv->source_selector)); - e_sendoptions_utils_set_default_data (priv->sod, source, "calendar"); + e_send_options_utils_set_default_data (priv->sod, source, "calendar"); priv->sod->data->initialized = TRUE; } if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_GEN_OPTIONS)) { - e_sendoptions_set_need_general_options (priv->sod, FALSE); + e_send_options_set_need_general_options (priv->sod, FALSE); } toplevel = gtk_widget_get_toplevel (priv->main); - e_sendoptions_dialog_run (priv->sod, toplevel, E_ITEM_CALENDAR); + e_send_options_dialog_run (priv->sod, toplevel, E_ITEM_CALENDAR); } static void diff --git a/calendar/gui/dialogs/event-page.h b/calendar/gui/dialogs/event-page.h index afa191e9c1..3cfff34b89 100644 --- a/calendar/gui/dialogs/event-page.h +++ b/calendar/gui/dialogs/event-page.h @@ -76,7 +76,7 @@ EventPage * event_page_new (EMeetingStore *model, ECalComponent * event_page_get_cancel_comp (EventPage *page); void event_page_show_options (EventPage *page); void event_page_hide_options (EventPage *page); -void event_page_sendoptions_clicked_cb +void event_page_send_options_clicked_cb (EventPage *epage); void event_page_set_meeting (EventPage *page, gboolean set); diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 01f65aa8fd..5a9849db8e 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -107,7 +107,7 @@ static void action_send_options_cb (GtkAction *action, TaskEditor *editor) { - task_page_sendoptions_clicked_cb (editor->priv->task_page); + task_page_send_options_clicked_cb (editor->priv->task_page); } static GtkActionEntry task_entries[] = { diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 96ac4e2133..85c6bb15b8 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -936,7 +936,7 @@ task_page_fill_component (CompEditorPage *page, ECalComponent *comp) /* send options */ if (priv->sendoptions_shown && priv->sod) - e_sendoptions_utils_fill_component (priv->sod, comp); + e_send_options_utils_fill_component (priv->sod, comp); /* Categories */ cat = e_dialog_editable_get (priv->categories); @@ -1795,7 +1795,7 @@ set_subscriber_info_string (TaskPage *tpage, const gchar *backend_address) } void -task_page_sendoptions_clicked_cb (TaskPage *tpage) +task_page_send_options_clicked_cb (TaskPage *tpage) { TaskPagePrivate *priv = tpage->priv; CompEditor *editor; @@ -1807,19 +1807,19 @@ task_page_sendoptions_clicked_cb (TaskPage *tpage) client = comp_editor_get_client (editor); if (!priv->sod) { - priv->sod = e_sendoptions_dialog_new (); + priv->sod = e_send_options_dialog_new (); priv->sod->data->initialized = TRUE; source = e_source_combo_box_get_active ( E_SOURCE_COMBO_BOX (priv->source_selector)); - e_sendoptions_utils_set_default_data (priv->sod, source, "task"); + e_send_options_utils_set_default_data (priv->sod, source, "task"); } if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_GEN_OPTIONS)) { - e_sendoptions_set_need_general_options (priv->sod, FALSE); + e_send_options_set_need_general_options (priv->sod, FALSE); } toplevel = gtk_widget_get_toplevel (priv->main); - e_sendoptions_dialog_run (priv->sod, toplevel, E_ITEM_TASK); + e_send_options_dialog_run (priv->sod, toplevel, E_ITEM_TASK); } /* Hooks the widget signals */ diff --git a/calendar/gui/dialogs/task-page.h b/calendar/gui/dialogs/task-page.h index b8a49f8286..273c316879 100644 --- a/calendar/gui/dialogs/task-page.h +++ b/calendar/gui/dialogs/task-page.h @@ -80,7 +80,7 @@ void task_page_show_options (TaskPage *page); void task_page_hide_options (TaskPage *page); void task_page_set_assignment (TaskPage *page, gboolean set); -void task_page_sendoptions_clicked_cb(TaskPage *tpage); +void task_page_send_options_clicked_cb(TaskPage *tpage); void task_page_set_view_role (TaskPage *page, gboolean state); void task_page_set_view_status (TaskPage *page, diff --git a/composer/e-composer-from-header.c b/composer/e-composer-from-header.c index 4dadfa7ac7..856d36a1e8 100644 --- a/composer/e-composer-from-header.c +++ b/composer/e-composer-from-header.c @@ -29,9 +29,13 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static guint signal_ids[LAST_SIGNAL]; +G_DEFINE_TYPE ( + EComposerFromHeader, + e_composer_from_header, + E_TYPE_COMPOSER_HEADER) + static void composer_from_header_changed_cb (EAccountComboBox *combo_box, EComposerFromHeader *header) @@ -47,10 +51,8 @@ composer_from_header_refreshed_cb (EAccountComboBox *combo_box, } static void -composer_from_header_class_init (EComposerFromHeaderClass *class) +e_composer_from_header_class_init (EComposerFromHeaderClass *class) { - parent_class = g_type_class_peek_parent (class); - signal_ids[REFRESHED] = g_signal_new ( "refreshed", G_TYPE_FROM_CLASS (class), @@ -61,7 +63,7 @@ composer_from_header_class_init (EComposerFromHeaderClass *class) } static void -composer_from_header_init (EComposerFromHeader *header) +e_composer_from_header_init (EComposerFromHeader *header) { GtkWidget *widget; @@ -75,33 +77,6 @@ composer_from_header_init (EComposerFromHeader *header) E_COMPOSER_HEADER (header)->input_widget = widget; } -GType -e_composer_from_header_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EComposerFromHeaderClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) composer_from_header_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EComposerFromHeader), - 0, /* n_preallocs */ - (GInstanceInitFunc) composer_from_header_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_COMPOSER_HEADER, "EComposerFromHeader", - &type_info, 0); - } - - return type; -} - EComposerHeader * e_composer_from_header_new (const gchar *label) { diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c index 927408222b..d94201d129 100644 --- a/composer/e-composer-header-table.c +++ b/composer/e-composer-header-table.c @@ -72,7 +72,10 @@ struct _EComposerHeaderTablePrivate { EShell *shell; }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EComposerHeaderTable, + e_composer_header_table, + GTK_TYPE_TABLE) static void g_value_set_destinations (GValue *value, @@ -532,7 +535,8 @@ composer_header_table_constructor (GType type, gboolean small_screen_mode; /* Chain up to parent's constructor() method. */ - object = G_OBJECT_CLASS (parent_class)->constructor ( + object = G_OBJECT_CLASS ( + e_composer_header_table_parent_class)->constructor ( type, n_construct_properties, construct_properties); priv = E_COMPOSER_HEADER_TABLE_GET_PRIVATE (object); @@ -830,16 +834,15 @@ composer_header_table_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_composer_header_table_parent_class)->dispose (object); } static void -composer_header_table_class_init (EComposerHeaderTableClass *class) +e_composer_header_table_class_init (EComposerHeaderTableClass *class) { GObjectClass *object_class; GParamSpec *element_spec; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EComposerHeaderTablePrivate)); object_class = G_OBJECT_CLASS (class); @@ -987,7 +990,7 @@ composer_header_table_class_init (EComposerHeaderTableClass *class) } static void -composer_header_table_init (EComposerHeaderTable *table) +e_composer_header_table_init (EComposerHeaderTable *table) { EComposerHeader *header; ENameSelector *name_selector; @@ -1058,32 +1061,6 @@ composer_header_table_init (EComposerHeaderTable *table) } } -GType -e_composer_header_table_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EComposerHeaderTableClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) composer_header_table_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EComposerHeaderTable), - 0, /* n_preallocs */ - (GInstanceInitFunc) composer_header_table_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_TABLE, "EComposerHeaderTable", &type_info, 0); - } - - return type; -} - GtkWidget * e_composer_header_table_new (EShell *shell) { diff --git a/composer/e-composer-header.c b/composer/e-composer-header.c index 0c634175de..76c5d89b14 100644 --- a/composer/e-composer-header.c +++ b/composer/e-composer-header.c @@ -56,9 +56,13 @@ struct _EComposerHeaderPrivate { guint visible : 1; }; -static gpointer parent_class; static guint signal_ids[LAST_SIGNAL]; +G_DEFINE_ABSTRACT_TYPE ( + EComposerHeader, + e_composer_header, + G_TYPE_OBJECT) + static void composer_header_button_clicked_cb (GtkButton *button, EComposerHeader *header) @@ -78,7 +82,8 @@ composer_header_constructor (GType type, GtkWidget *label; /* Chain up to parent's constructor() method. */ - object = G_OBJECT_CLASS (parent_class)->constructor ( + object = G_OBJECT_CLASS ( + e_composer_header_parent_class)->constructor ( type, n_construct_properties, construct_properties); header = E_COMPOSER_HEADER (object); @@ -197,15 +202,14 @@ composer_header_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_composer_header_parent_class)->dispose (object); } static void -composer_header_class_init (EComposerHeaderClass *class) +e_composer_header_class_init (EComposerHeaderClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EComposerHeaderPrivate)); object_class = G_OBJECT_CLASS (class); @@ -276,38 +280,11 @@ composer_header_class_init (EComposerHeaderClass *class) } static void -composer_header_init (EComposerHeader *header) +e_composer_header_init (EComposerHeader *header) { header->priv = E_COMPOSER_HEADER_GET_PRIVATE (header); } -GType -e_composer_header_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EComposerHeaderClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) composer_header_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EComposerHeader), - 0, /* n_preallocs */ - (GInstanceInitFunc) composer_header_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "EComposerHeader", - &type_info, G_TYPE_FLAG_ABSTRACT); - } - - return type; -} - gchar * e_composer_header_get_label (EComposerHeader *header) { diff --git a/composer/e-composer-name-header.c b/composer/e-composer-name-header.c index 3544ff0f21..919e946152 100644 --- a/composer/e-composer-name-header.c +++ b/composer/e-composer-name-header.c @@ -45,7 +45,10 @@ struct _EComposerNameHeaderPrivate { guint destination_index; }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EComposerNameHeader, + e_composer_name_header, + E_TYPE_COMPOSER_HEADER) static gpointer contact_editor_fudge_new (EBook *book, @@ -116,7 +119,8 @@ composer_name_header_constructor (GType type, gchar *label; /* Chain up to parent's constructor() method. */ - object = G_OBJECT_CLASS (parent_class)->constructor ( + object = G_OBJECT_CLASS ( + e_composer_name_header_parent_class)->constructor ( type, n_construct_properties, construct_properties); priv = E_COMPOSER_NAME_HEADER_GET_PRIVATE (object); @@ -210,7 +214,7 @@ composer_name_header_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_composer_name_header_parent_class)->dispose (object); } static void @@ -230,12 +234,11 @@ composer_name_header_clicked (EComposerHeader *header) } static void -composer_name_header_class_init (EComposerNameHeaderClass *class) +e_composer_name_header_class_init (EComposerNameHeaderClass *class) { GObjectClass *object_class; EComposerHeaderClass *header_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EComposerNameHeaderPrivate)); object_class = G_OBJECT_CLASS (class); @@ -260,38 +263,11 @@ composer_name_header_class_init (EComposerNameHeaderClass *class) } static void -composer_name_header_init (EComposerNameHeader *header) +e_composer_name_header_init (EComposerNameHeader *header) { header->priv = E_COMPOSER_NAME_HEADER_GET_PRIVATE (header); } -GType -e_composer_name_header_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EComposerNameHeaderClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) composer_name_header_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EComposerNameHeader), - 0, /* n_preallocs */ - (GInstanceInitFunc) composer_name_header_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_COMPOSER_HEADER, "EComposerNameHeader", - &type_info, 0); - } - - return type; -} - EComposerHeader * e_composer_name_header_new (const gchar *label, ENameSelector *name_selector) diff --git a/composer/e-composer-post-header.c b/composer/e-composer-post-header.c index 43b2a9d37d..3d79c9ca2c 100644 --- a/composer/e-composer-post-header.c +++ b/composer/e-composer-post-header.c @@ -39,7 +39,10 @@ struct _EComposerPostHeaderPrivate { gboolean custom; }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EComposerPostHeader, + e_composer_post_header, + E_TYPE_COMPOSER_TEXT_HEADER) static gchar * composer_post_header_folder_name_to_string (EComposerPostHeader *header, @@ -118,7 +121,8 @@ composer_post_header_constructor (GType type, GObject *object; /* Chain up to parent's constructor() method. */ - object = G_OBJECT_CLASS (parent_class)->constructor ( + object = G_OBJECT_CLASS ( + e_composer_post_header_parent_class)->constructor ( type, n_construct_properties, construct_properties); e_composer_header_set_title_tooltip ( @@ -175,7 +179,7 @@ composer_post_header_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_composer_post_header_parent_class)->dispose (object); } static void @@ -188,7 +192,7 @@ composer_post_header_finalize (GObject *object) g_free (priv->base_url); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_composer_post_header_parent_class)->finalize (object); } static void @@ -212,12 +216,11 @@ composer_post_header_clicked (EComposerHeader *header) } static void -composer_post_header_class_init (EComposerPostHeaderClass *class) +e_composer_post_header_class_init (EComposerPostHeaderClass *class) { GObjectClass *object_class; EComposerHeaderClass *header_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EComposerPostHeaderPrivate)); object_class = G_OBJECT_CLASS (class); @@ -243,38 +246,11 @@ composer_post_header_class_init (EComposerPostHeaderClass *class) } static void -composer_post_header_init (EComposerPostHeader *header) +e_composer_post_header_init (EComposerPostHeader *header) { header->priv = E_COMPOSER_POST_HEADER_GET_PRIVATE (header); } -GType -e_composer_post_header_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EComposerPostHeaderClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) composer_post_header_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EComposerPostHeader), - 0, /* n_preallocs */ - (GInstanceInitFunc) composer_post_header_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_COMPOSER_TEXT_HEADER, - "EComposerPostHeader", &type_info, 0); - } - - return type; -} - EComposerHeader * e_composer_post_header_new (const gchar *label) { diff --git a/composer/e-composer-text-header.c b/composer/e-composer-text-header.c index efbf141cea..d92901d55e 100644 --- a/composer/e-composer-text-header.c +++ b/composer/e-composer-text-header.c @@ -30,7 +30,10 @@ struct _EComposerTextHeaderPrivate { guint destination_index; }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EComposerTextHeader, + e_composer_text_header, + E_TYPE_COMPOSER_HEADER) static void composer_text_header_changed_cb (GtkEntry *entry, @@ -59,13 +62,12 @@ composer_text_header_query_tooltip_cb (GtkEntry *entry, } static void -composer_text_header_class_init (EComposerTextHeaderClass *class) +e_composer_text_header_class_init (EComposerTextHeaderClass *class) { - parent_class = g_type_class_peek_parent (class); } static void -composer_text_header_init (EComposerTextHeader *header) +e_composer_text_header_init (EComposerTextHeader *header) { GtkWidget *widget; @@ -80,33 +82,6 @@ composer_text_header_init (EComposerTextHeader *header) E_COMPOSER_HEADER (header)->input_widget = widget; } -GType -e_composer_text_header_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EComposerTextHeaderClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) composer_text_header_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EComposerTextHeader), - 0, /* n_preallocs */ - (GInstanceInitFunc) composer_text_header_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_COMPOSER_HEADER, "EComposerTextHeader", - &type_info, 0); - } - - return type; -} - EComposerHeader * e_composer_text_header_new_label (const gchar *label) { diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 4a6c6b267f..821b063e62 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -86,7 +86,6 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static guint signals[LAST_SIGNAL]; /* local prototypes */ @@ -114,6 +113,11 @@ static void handle_multipart_signed (EMsgComposer *composer, CamelMultipart *multipart, gint depth); +G_DEFINE_TYPE ( + EMsgComposer, + e_msg_composer, + GTKHTML_TYPE_EDITOR) + /** * emcu_part_to_html: * @part: @@ -1823,7 +1827,7 @@ msg_composer_dispose (GObject *object) e_composer_private_dispose (composer); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_msg_composer_parent_class)->dispose (object); } static void @@ -1835,7 +1839,7 @@ msg_composer_finalize (GObject *object) e_composer_private_finalize (composer); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_msg_composer_parent_class)->finalize (object); } static void @@ -2011,7 +2015,7 @@ msg_composer_destroy (GtkObject *object) shell, msg_composer_prepare_for_quit_cb, composer); /* Chain up to parent's destroy() method. */ - GTK_OBJECT_CLASS (parent_class)->destroy (object); + GTK_OBJECT_CLASS (e_msg_composer_parent_class)->destroy (object); } static void @@ -2022,7 +2026,7 @@ msg_composer_map (GtkWidget *widget) const gchar *text; /* Chain up to parent's map() method. */ - GTK_WIDGET_CLASS (parent_class)->map (widget); + GTK_WIDGET_CLASS (e_msg_composer_parent_class)->map (widget); table = e_msg_composer_get_header_table (E_MSG_COMPOSER (widget)); @@ -2091,7 +2095,8 @@ msg_composer_key_press_event (GtkWidget *widget, } /* Chain up to parent's key_press_event() method. */ - return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event); + return GTK_WIDGET_CLASS (e_msg_composer_parent_class)-> + key_press_event (widget, event); } static void @@ -2268,14 +2273,13 @@ msg_composer_object_deleted (GtkhtmlEditor *editor) } static void -msg_composer_class_init (EMsgComposerClass *class) +e_msg_composer_class_init (EMsgComposerClass *class) { GObjectClass *object_class; GtkObjectClass *gtk_object_class; GtkWidgetClass *widget_class; GtkhtmlEditorClass *editor_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EMsgComposerPrivate)); object_class = G_OBJECT_CLASS (class); @@ -2351,37 +2355,11 @@ msg_composer_class_init (EMsgComposerClass *class) } static void -msg_composer_init (EMsgComposer *composer) +e_msg_composer_init (EMsgComposer *composer) { composer->priv = E_MSG_COMPOSER_GET_PRIVATE (composer); } -GType -e_msg_composer_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EMsgComposerClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) msg_composer_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMsgComposer), - 0, /* n_preallocs */ - (GInstanceInitFunc) msg_composer_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTKHTML_TYPE_EDITOR, "EMsgComposer", &type_info, 0); - } - - return type; -} - /* Callbacks. */ /** diff --git a/e-util/e-activity.c b/e-util/e-activity.c index f8a3510049..631915db89 100644 --- a/e-util/e-activity.c +++ b/e-util/e-activity.c @@ -60,9 +60,13 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static gulong signals[LAST_SIGNAL]; +G_DEFINE_TYPE ( + EActivity, + e_activity, + G_TYPE_OBJECT) + static gboolean activity_describe_accumulator (GSignalInvocationHint *ihint, GValue *return_accu, @@ -183,7 +187,7 @@ activity_finalize (GObject *object) g_free (priv->secondary_text); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_activity_parent_class)->finalize (object); } static void @@ -241,11 +245,10 @@ activity_describe (EActivity *activity) } static void -activity_class_init (EActivityClass *class) +e_activity_class_init (EActivityClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EActivityPrivate)); object_class = G_OBJECT_CLASS (class); @@ -364,37 +367,11 @@ activity_class_init (EActivityClass *class) } static void -activity_init (EActivity *activity) +e_activity_init (EActivity *activity) { activity->priv = E_ACTIVITY_GET_PRIVATE (activity); } -GType -e_activity_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EActivityClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) activity_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EActivity), - 0, /* n_preallocs */ - (GInstanceInitFunc) activity_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "EActivity", &type_info, 0); - } - - return type; -} - EActivity * e_activity_new (const gchar *primary_text) { diff --git a/e-util/e-alert-activity.c b/e-util/e-alert-activity.c index d27a400206..8e6a6f78e5 100644 --- a/e-util/e-alert-activity.c +++ b/e-util/e-alert-activity.c @@ -38,7 +38,10 @@ enum { PROP_MESSAGE_DIALOG }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EAlertActivity, + e_alert_activity, + E_TYPE_TIMEOUT_ACTIVITY) static void alert_activity_set_message_dialog (EAlertActivity *alert_activity, @@ -96,7 +99,7 @@ alert_activity_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_alert_activity_parent_class)->dispose (object); } static void @@ -144,7 +147,7 @@ alert_activity_clicked (EActivity *activity) gtk_widget_hide (message_dialog); /* Chain up to parent's clicked() method. */ - E_ACTIVITY_CLASS (parent_class)->clicked (activity); + E_ACTIVITY_CLASS (e_alert_activity_parent_class)->clicked (activity); } static void @@ -153,17 +156,16 @@ alert_activity_timeout (ETimeoutActivity *activity) e_activity_complete (E_ACTIVITY (activity)); /* Chain up to parent's timeout() method. */ - E_TIMEOUT_ACTIVITY_CLASS (parent_class)->timeout (activity); + E_TIMEOUT_ACTIVITY_CLASS (e_alert_activity_parent_class)->timeout (activity); } static void -alert_activity_class_init (EAlertActivityClass *class) +e_alert_activity_class_init (EAlertActivityClass *class) { GObjectClass *object_class; EActivityClass *activity_class; ETimeoutActivityClass *timeout_activity_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EAlertActivityPrivate)); object_class = G_OBJECT_CLASS (class); @@ -191,40 +193,13 @@ alert_activity_class_init (EAlertActivityClass *class) } static void -alert_activity_init (EAlertActivity *alert_activity) +e_alert_activity_init (EAlertActivity *alert_activity) { alert_activity->priv = E_ALERT_ACTIVITY_GET_PRIVATE (alert_activity); e_timeout_activity_set_timeout (E_TIMEOUT_ACTIVITY (alert_activity), 60); } -GType -e_alert_activity_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EAlertActivityClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) alert_activity_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EAlertActivity), - 0, /* n_preallocs */ - (GInstanceInitFunc) alert_activity_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_TIMEOUT_ACTIVITY, "EAlertActivity", - &type_info, 0); - } - - return type; -} - EActivity * e_alert_activity_new_info (GtkWidget *message_dialog) { diff --git a/e-util/e-alert-dialog.c b/e-util/e-alert-dialog.c index 6f96116c61..cb2dabf74e 100644 --- a/e-util/e-alert-dialog.c +++ b/e-util/e-alert-dialog.c @@ -24,7 +24,10 @@ #include "e-alert-dialog.h" #include "e-util.h" -G_DEFINE_TYPE (EAlertDialog, e_alert_dialog, GTK_TYPE_DIALOG) +G_DEFINE_TYPE ( + EAlertDialog, + e_alert_dialog, + GTK_TYPE_DIALOG) #define ALERT_DIALOG_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), E_TYPE_ALERT_DIALOG, EAlertDialogPrivate)) diff --git a/e-util/e-alert.c b/e-util/e-alert.c index c6b5357923..9ca0c02df3 100644 --- a/e-util/e-alert.c +++ b/e-util/e-alert.c @@ -136,7 +136,10 @@ map_type(const gchar *name) return 3; } -G_DEFINE_TYPE (EAlert, e_alert, G_TYPE_OBJECT) +G_DEFINE_TYPE ( + EAlert, + e_alert, + G_TYPE_OBJECT) #define ALERT_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), E_TYPE_ALERT, EAlertPrivate)) diff --git a/e-util/e-bit-array.c b/e-util/e-bit-array.c index 1e2635a9e3..785ee45273 100644 --- a/e-util/e-bit-array.c +++ b/e-util/e-bit-array.c @@ -36,7 +36,10 @@ #define BITMASK_LEFT(n) ((((n) % 32) == 0) ? 0 : (ONES << (32 - ((n) % 32)))) #define BITMASK_RIGHT(n) ((guint32)(((guint32) ONES) >> ((n) % 32))) -G_DEFINE_TYPE (EBitArray, e_bit_array, G_TYPE_OBJECT) +G_DEFINE_TYPE ( + EBitArray, + e_bit_array, + G_TYPE_OBJECT) static void e_bit_array_insert_real(EBitArray *eba, gint row) diff --git a/e-util/e-config.c b/e-util/e-config.c index 44e55a182f..2b8d948fe5 100644 --- a/e-util/e-config.c +++ b/e-util/e-config.c @@ -88,10 +88,13 @@ struct _EConfigPrivate { GList *finish_pages; }; -static gpointer parent_class; - static GtkWidget *ech_config_section_factory (EConfig *config, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data, GtkWidget **real_frame); +G_DEFINE_TYPE ( + EConfig, + e_config, + G_TYPE_OBJECT) + static void config_finalize (GObject *object) { @@ -151,7 +154,7 @@ config_finalize (GObject *object) } /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_config_parent_class)->finalize (object); } static void @@ -173,11 +176,10 @@ config_set_target (EConfig *config, } static void -config_class_init (EConfigClass *class) +e_config_class_init (EConfigClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EConfigPrivate)); object_class = G_OBJECT_CLASS (class); @@ -188,46 +190,12 @@ config_class_init (EConfigClass *class) } static void -config_init (EConfig *config) +e_config_init (EConfig *config) { config->priv = E_CONFIG_GET_PRIVATE (config); } /** - * e_config_get_type: - * - * Standard GObject method. Used to subclass for the concrete - * implementations. - * - * Return value: EConfig type. - **/ -GType -e_config_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EConfigClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) config_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EConfig), - 0, /* n_preallocs */ - (GInstanceInitFunc) config_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "EConfig", &type_info, 0); - } - - return type; -} - -/** * e_config_construct: * @ep: The instance to initialise. * @type: The type of configuration manager, @E_CONFIG_BOOK or @@ -1585,7 +1553,6 @@ e_config_target_free(EConfig *ep, gpointer o) */ -static gpointer emph_parent_class; #define emph ((EConfigHook *)eph) static const EPluginHookTargetKey ech_item_types[] = { @@ -1602,6 +1569,11 @@ static const EPluginHookTargetKey ech_item_types[] = { { NULL }, }; +G_DEFINE_TYPE ( + EConfigHook, + e_config_hook, + E_TYPE_PLUGIN_HOOK) + static void ech_commit(EConfig *ec, GSList *items, gpointer data) { @@ -1854,7 +1826,7 @@ emph_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root) d(printf("loading config hook\n")); - if (((EPluginHookClass *)emph_parent_class)->construct(eph, ep, root) == -1) + if (((EPluginHookClass *)e_config_hook_parent_class)->construct(eph, ep, root) == -1) return -1; class = ((EConfigHookClass *)G_OBJECT_GET_CLASS(eph))->config_class; @@ -1886,47 +1858,31 @@ emph_finalize(GObject *o) g_slist_foreach(emph->groups, (GFunc)emph_free_group, NULL); g_slist_free(emph->groups); - ((GObjectClass *)emph_parent_class)->finalize(o); + ((GObjectClass *)e_config_hook_parent_class)->finalize(o); } static void -emph_class_init(EPluginHookClass *class) +e_config_hook_class_init (EConfigHookClass *class) { - ((GObjectClass *)class)->finalize = emph_finalize; - class->construct = emph_construct; + GObjectClass *object_class; + EPluginHookClass *plugin_hook_class; - /* this is actually an abstract implementation but list it anyway */ - class->id = "org.gnome.evolution.config:1.0"; + object_class = G_OBJECT_CLASS (class); + object_class->finalize = emph_finalize; - d(printf("EConfigHook: init class %p '%s'\n", class, g_type_name(((GObjectClass *)class)->g_type_class.g_type))); + plugin_hook_class = E_PLUGIN_HOOK_CLASS (class); + plugin_hook_class->construct = emph_construct; + + /* this is actually an abstract implementation but list it anyway */ + plugin_hook_class->id = "org.gnome.evolution.config:1.0"; - ((EConfigHookClass *)class)->target_map = g_hash_table_new(g_str_hash, g_str_equal); - ((EConfigHookClass *)class)->config_class = g_type_class_ref(e_config_get_type()); + class->target_map = g_hash_table_new (g_str_hash, g_str_equal); + class->config_class = g_type_class_ref (e_config_get_type()); } -/** - * e_config_hook_get_type: - * - * Standard GObject function to get the object type. - * - * Return value: The EConfigHook class type. - **/ -GType -e_config_hook_get_type(void) +static void +e_config_hook_init (EConfigHook *hook) { - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof(EConfigHookClass), NULL, NULL, (GClassInitFunc) emph_class_init, NULL, NULL, - sizeof(EConfigHook), 0, (GInstanceInitFunc) NULL, - }; - - emph_parent_class = g_type_class_ref(e_plugin_hook_get_type()); - type = g_type_register_static(e_plugin_hook_get_type(), "EConfigHook", &info, 0); - } - - return type; } /** diff --git a/e-util/e-event.c b/e-util/e-event.c index 81b58e8a04..9edde9c196 100644 --- a/e-util/e-event.c +++ b/e-util/e-event.c @@ -55,7 +55,10 @@ struct _EEventPrivate { GSList *sorted; /* sorted list of struct _event_info's */ }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EEvent, + e_event, + G_TYPE_OBJECT) static void event_finalize (GObject *object) @@ -83,7 +86,7 @@ event_finalize (GObject *object) g_slist_free(p->sorted); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_event_parent_class)->finalize (object); } static void @@ -95,11 +98,10 @@ event_target_free (EEvent *event, } static void -event_class_init (EEventClass *class) +e_event_class_init (EEventClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EEventPrivate)); object_class = G_OBJECT_CLASS (class); @@ -109,39 +111,13 @@ event_class_init (EEventClass *class) } static void -event_init (EEvent *event) +e_event_init (EEvent *event) { event->priv = E_EVENT_GET_PRIVATE (event); g_queue_init (&event->priv->events); } -GType -e_event_get_type(void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EEventClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) event_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EEvent), - 0, /* n_preallocs */ - (GInstanceInitFunc) event_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "EEvent", &type_info, 0); - } - - return type; -} - /** * e_event_construct: * @ep: An instantiated but uninitialised EEvent. @@ -389,7 +365,6 @@ e_event_target_free (EEvent *event, */ -static gpointer emph_parent_class; #define emph ((EEventHook *)eph) /* must have 1:1 correspondence with e-event types in order */ @@ -399,6 +374,11 @@ static const EPluginHookTargetKey emph_item_types[] = { { NULL } }; +G_DEFINE_TYPE ( + EEventHook, + e_event_hook, + E_TYPE_PLUGIN_HOOK) + static void emph_event_handle(EEvent *ee, EEventItem *item, gpointer data) { @@ -475,7 +455,7 @@ emph_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root) d(printf("loading event hook\n")); - if (((EPluginHookClass *)emph_parent_class)->construct(eph, ep, root) == -1) + if (((EPluginHookClass *)e_event_hook_parent_class)->construct(eph, ep, root) == -1) return -1; class = (EEventHookClass *)G_OBJECT_GET_CLASS(eph); @@ -501,12 +481,10 @@ emph_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root) } static void -emph_class_init (EEventHookClass *class) +e_event_hook_class_init (EEventHookClass *class) { EPluginHookClass *plugin_hook_class; - emph_parent_class = g_type_class_peek_parent (class); - plugin_hook_class = E_PLUGIN_HOOK_CLASS (class); plugin_hook_class->id = "org.gnome.evolution.event:1.0"; plugin_hook_class->construct = emph_construct; @@ -514,38 +492,9 @@ emph_class_init (EEventHookClass *class) class->target_map = g_hash_table_new (g_str_hash, g_str_equal); } -/** - * e_event_hook_get_type: - * - * Standard GObject function to get the EEvent object type. Used to - * subclass EEventHook. - * - * Return value: The type of the event hook class. - **/ -GType -e_event_hook_get_type(void) +static void +e_event_hook_init (EEventHook *hook) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EEventHookClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) emph_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EEventHook), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_PLUGIN_HOOK, "EEventHook", &type_info, 0); - } - - return type; } /** diff --git a/e-util/e-extensible.c b/e-util/e-extensible.c index b718fc59bf..909003f580 100644 --- a/e-util/e-extensible.c +++ b/e-util/e-extensible.c @@ -66,6 +66,11 @@ static GQuark extensible_quark; +G_DEFINE_INTERFACE ( + EExtensible, + e_extensible, + G_TYPE_OBJECT) + static GPtrArray * extensible_get_extensions (EExtensible *extensible) { @@ -99,39 +104,11 @@ exit: } static void -extensible_interface_init (EExtensibleInterface *interface) +e_extensible_default_init (EExtensibleInterface *interface) { extensible_quark = g_quark_from_static_string ("e-extensible-quark"); } -GType -e_extensible_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EExtensibleInterface), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) extensible_interface_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - 0, /* instance_size */ - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_INTERFACE, "EExtensible", &type_info, 0); - - g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); - } - - return type; -} - /** * e_extensible_load_extensions: * @extensible: an #EExtensible diff --git a/e-util/e-extension.c b/e-util/e-extension.c index 59eab840c9..75caf5adf4 100644 --- a/e-util/e-extension.c +++ b/e-util/e-extension.c @@ -54,7 +54,10 @@ enum { PROP_EXTENSIBLE }; -G_DEFINE_ABSTRACT_TYPE (EExtension, e_extension, G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE ( + EExtension, + e_extension, + G_TYPE_OBJECT) static void extension_set_extensible (EExtension *extension, diff --git a/e-util/e-import.c b/e-util/e-import.c index 14485633c1..700d4b885c 100644 --- a/e-util/e-import.c +++ b/e-util/e-import.c @@ -43,7 +43,10 @@ struct _EImportImporters { gpointer data; }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EImport, + e_import, + G_TYPE_OBJECT) static void import_finalize (GObject *object) @@ -53,7 +56,7 @@ import_finalize (GObject *object) g_free (import->id); /* Chain up to parent's finalize () method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_import_parent_class)->finalize (object); } static void @@ -77,50 +80,19 @@ import_target_free (EImport *import, } static void -import_class_init (EImportClass *class) +e_import_class_init (EImportClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); - object_class = G_OBJECT_CLASS (class); object_class->finalize = import_finalize; class->target_free = import_target_free; } -/** - * e_import_get_type: - * - * Standard GObject method. Used to subclass for the concrete - * implementations. - * - * Return value: EImport type. - **/ -GType -e_import_get_type (void) +static void +e_import_init (EImport *import) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EImportClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) import_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EImport), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "EImport", &type_info, 0); - } - - return type; } /** @@ -434,7 +406,6 @@ e_import_target_new_home (EImport *import) */ -static gpointer emph_parent_class; #define emph ((EImportHook *)eph) static const EImportHookTargetMask eih_no_masks[] = { @@ -447,6 +418,11 @@ static const EImportHookTargetMap eih_targets[] = { { NULL } }; +G_DEFINE_TYPE ( + EImportHook, + e_import_hook, + E_TYPE_PLUGIN_HOOK) + static gboolean eih_supported (EImport *ei, EImportTarget *target, @@ -557,7 +533,7 @@ emph_construct (EPluginHook *eph, EPlugin *ep, xmlNodePtr root) d (printf ("loading import hook\n")); - if (E_PLUGIN_HOOK_CLASS (emph_parent_class)->construct (eph, ep, root) == -1) + if (E_PLUGIN_HOOK_CLASS (e_import_hook_parent_class)->construct (eph, ep, root) == -1) return -1; class = E_IMPORT_HOOK_GET_CLASS (eph)->import_class; @@ -585,7 +561,7 @@ emph_construct (EPluginHook *eph, EPlugin *ep, xmlNodePtr root) } static void -emph_class_init (EImportHookClass *class) +e_import_hook_class_init (EImportHookClass *class) { EPluginHookClass *plugin_hook_class; gint ii; @@ -608,31 +584,9 @@ emph_class_init (EImportHookClass *class) e_import_hook_class_add_target_map (class, &eih_targets[ii]); } -GType -e_import_hook_get_type (void) +static void +e_import_hook_init (EImportHook *hook) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EImportHookClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) emph_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EImportHook), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - NULL /* value_table */ - }; - - emph_parent_class = g_type_class_ref (e_plugin_hook_get_type ()); - type = g_type_register_static ( - E_TYPE_PLUGIN_HOOK, "EImportHook", &type_info, 0); - } - - return type; } /** diff --git a/e-util/e-io-activity.c b/e-util/e-io-activity.c index 9569e42914..c8eb761708 100644 --- a/e-util/e-io-activity.c +++ b/e-util/e-io-activity.c @@ -36,7 +36,10 @@ enum { PROP_CANCELLABLE }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EIOActivity, + e_io_activity, + E_TYPE_ACTIVITY) static void io_activity_set_property (GObject *object, @@ -102,7 +105,7 @@ io_activity_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_io_activity_parent_class)->dispose (object); } static void @@ -112,7 +115,7 @@ io_activity_cancelled (EActivity *activity) GCancellable *cancellable; /* Chain up to parent's cancelled() method. */ - E_ACTIVITY_CLASS (parent_class)->cancelled (activity); + E_ACTIVITY_CLASS (e_io_activity_parent_class)->cancelled (activity); io_activity = E_IO_ACTIVITY (activity); cancellable = e_io_activity_get_cancellable (io_activity); @@ -128,7 +131,7 @@ io_activity_completed (EActivity *activity) GAsyncResult *async_result; /* Chain up to parent's completed() method. */ - E_ACTIVITY_CLASS (parent_class)->completed (activity); + E_ACTIVITY_CLASS (e_io_activity_parent_class)->completed (activity); io_activity = E_IO_ACTIVITY (activity); async_result = e_io_activity_get_async_result (io_activity); @@ -142,12 +145,11 @@ io_activity_completed (EActivity *activity) } static void -io_activity_class_init (EIOActivityClass *class) +e_io_activity_class_init (EIOActivityClass *class) { GObjectClass *object_class; EActivityClass *activity_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EIOActivityPrivate)); object_class = G_OBJECT_CLASS (class); @@ -183,37 +185,11 @@ io_activity_class_init (EIOActivityClass *class) } static void -io_activity_init (EIOActivity *io_activity) +e_io_activity_init (EIOActivity *io_activity) { io_activity->priv = E_IO_ACTIVITY_GET_PRIVATE (io_activity); } -GType -e_io_activity_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EIOActivityClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) io_activity_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EIOActivity), - 0, /* n_preallocs */ - (GInstanceInitFunc) io_activity_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_ACTIVITY, "EIOActivity", &type_info, 0); - } - - return type; -} - EActivity * e_io_activity_new (const gchar *primary_text, GAsyncResult *async_result, diff --git a/e-util/e-logger.c b/e-util/e-logger.c index fa2d548b23..6dd08c722d 100644 --- a/e-util/e-logger.c +++ b/e-util/e-logger.c @@ -55,7 +55,10 @@ enum { PROP_NAME }; -static gpointer parent_class; +G_DEFINE_TYPE ( + ELogger, + e_logger, + G_TYPE_OBJECT) static gboolean logger_flush (ELogger *logger) @@ -150,15 +153,14 @@ logger_finalize (GObject *object) g_free (logger->priv->logfile); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_logger_parent_class)->finalize (object); } static void -logger_class_init (ELoggerClass *class) +e_logger_class_init (ELoggerClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ELoggerPrivate)); object_class = G_OBJECT_CLASS (class); @@ -179,37 +181,11 @@ logger_class_init (ELoggerClass *class) } static void -logger_init (ELogger *logger) +e_logger_init (ELogger *logger) { logger->priv = E_LOGGER_GET_PRIVATE (logger); } -GType -e_logger_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ELoggerClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) logger_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ELogger), - 0, /* n_preallocs */ - (GInstanceInitFunc) logger_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "ELogger", &type_info, 0); - } - - return type; -} - ELogger * e_logger_new (const gchar *name) { diff --git a/e-util/e-module.c b/e-util/e-module.c index 17c048e2d3..7b4801df47 100644 --- a/e-util/e-module.c +++ b/e-util/e-module.c @@ -52,7 +52,10 @@ enum { PROP_FILENAME }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EModule, + e_module, + G_TYPE_TYPE_MODULE) static void module_set_filename (EModule *module, @@ -107,7 +110,7 @@ module_finalize (GObject *object) g_free (priv->filename); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_module_parent_class)->finalize (object); } static gboolean @@ -164,12 +167,11 @@ module_unload (GTypeModule *type_module) } static void -module_class_init (EModuleClass *class) +e_module_class_init (EModuleClass *class) { GObjectClass *object_class; GTypeModuleClass *type_module_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EModulePrivate)); object_class = G_OBJECT_CLASS (class); @@ -199,37 +201,11 @@ module_class_init (EModuleClass *class) } static void -module_init (EModule *module) +e_module_init (EModule *module) { module->priv = E_MODULE_GET_PRIVATE (module); } -GType -e_module_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (EModuleClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) module_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EModule), - 0, /* n_preallocs */ - (GInstanceInitFunc) module_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_TYPE_MODULE, "EModule", &type_info, 0); - } - - return type; -} - /** * e_module_new: * @filename: filename of the shared library module diff --git a/e-util/e-plugin-ui.c b/e-util/e-plugin-ui.c index 999b1e82d2..a03c6193ef 100644 --- a/e-util/e-plugin-ui.c +++ b/e-util/e-plugin-ui.c @@ -163,7 +163,10 @@ struct _EPluginUIHookPrivate { GHashTable *registry; }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EPluginUIHook, + e_plugin_ui_hook, + E_TYPE_PLUGIN_HOOK) static void plugin_ui_hook_unregister_manager (EPluginUIHook *hook, @@ -408,7 +411,7 @@ plugin_ui_hook_finalize (GObject *object) g_hash_table_destroy (priv->registry); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_plugin_ui_hook_parent_class)->dispose (object); } static gint @@ -425,7 +428,8 @@ plugin_ui_hook_construct (EPluginHook *hook, * we wouldn't have to chain up here. */ /* Chain up to parent's construct() method. */ - E_PLUGIN_HOOK_CLASS (parent_class)->construct (hook, plugin, node); + E_PLUGIN_HOOK_CLASS (e_plugin_ui_hook_parent_class)-> + construct (hook, plugin, node); for (node = xmlFirstElementChild (node); node != NULL; node = xmlNextElementSibling (node)) { @@ -483,12 +487,11 @@ plugin_ui_hook_enable (EPluginHook *hook, } static void -plugin_ui_hook_class_init (EPluginUIHookClass *class) +e_plugin_ui_hook_class_init (EPluginUIHookClass *class) { GObjectClass *object_class; EPluginHookClass *plugin_hook_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EPluginUIHookPrivate)); object_class = G_OBJECT_CLASS (class); @@ -501,7 +504,7 @@ plugin_ui_hook_class_init (EPluginUIHookClass *class) } static void -plugin_ui_hook_init (EPluginUIHook *hook) +e_plugin_ui_hook_init (EPluginUIHook *hook) { GHashTable *ui_definitions; GHashTable *callbacks; @@ -525,32 +528,6 @@ plugin_ui_hook_init (EPluginUIHook *hook) hook->priv->registry = registry; } -GType -e_plugin_ui_hook_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EPluginUIHookClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) plugin_ui_hook_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EPluginUIHook), - 0, /* n_preallocs */ - (GInstanceInitFunc) plugin_ui_hook_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_PLUGIN_HOOK, "EPluginUIHook", &type_info, 0); - } - - return type; -} - void e_plugin_ui_register_manager (GtkUIManager *ui_manager, const gchar *id, diff --git a/e-util/e-plugin.c b/e-util/e-plugin.c index 2b85f61c84..a1906d7f3f 100644 --- a/e-util/e-plugin.c +++ b/e-util/e-plugin.c @@ -64,7 +64,6 @@ */ /* EPlugin stuff */ -static gpointer ep_parent_class; /* global table of plugin types by pluginclass.type */ static GHashTable *ep_types; @@ -94,6 +93,11 @@ enum { EP_PROP_ENABLED }; +G_DEFINE_TYPE ( + EPlugin, + e_plugin, + G_TYPE_OBJECT) + static gboolean ep_check_enabled (const gchar *id) { @@ -269,15 +273,14 @@ ep_finalize (GObject *object) g_slist_free (ep->hooks); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (ep_parent_class)->finalize (object); + G_OBJECT_CLASS (e_plugin_parent_class)->finalize (object); } static void -ep_class_init (EPluginClass *class) +e_plugin_class_init (EPluginClass *class) { GObjectClass *object_class; - - ep_parent_class = g_type_class_peek_parent (class); + gchar *path, *col, *p; object_class = G_OBJECT_CLASS (class); object_class->set_property = ep_set_property; @@ -296,67 +299,31 @@ ep_class_init (EPluginClass *class) "Whether the plugin is enabled", TRUE, G_PARAM_READWRITE)); -} -static void -ep_init (EPlugin *ep) -{ - ep->enabled = TRUE; -} + /* Add paths in the environment variable or default global + * and user specific paths */ + path = g_strdup(g_getenv("EVOLUTION_PLUGIN_PATH")); + if (path == NULL) { + /* Add the global path */ + e_plugin_add_load_path(EVOLUTION_PLUGINDIR); -/** - * e_plugin_get_type: - * - * Standard GObject type function. This is only an abstract class, so - * you can only use this to subclass EPlugin. - * - * Return value: The type. - **/ -GType -e_plugin_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - gchar *path, *col, *p; - - static const GTypeInfo type_info = { - sizeof (EPluginClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) ep_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EPlugin), - 0, /* n_preallocs */ - (GInstanceInitFunc) ep_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "EPlugin", &type_info, 0); - - /* Add paths in the environment variable or default global - * and user specific paths */ - path = g_strdup(g_getenv("EVOLUTION_PLUGIN_PATH")); - if (path == NULL) { - /* Add the global path */ - e_plugin_add_load_path(EVOLUTION_PLUGINDIR); - - path = g_build_filename(g_get_home_dir(), ".eplugins", NULL); - } + path = g_build_filename(g_get_home_dir(), ".eplugins", NULL); + } - p = path; - while ((col = strchr(p, G_SEARCHPATH_SEPARATOR))) { - *col++ = 0; - e_plugin_add_load_path(p); - p = col; - } + p = path; + while ((col = strchr(p, G_SEARCHPATH_SEPARATOR))) { + *col++ = 0; e_plugin_add_load_path(p); - g_free(path); + p = col; } + e_plugin_add_load_path(p); + g_free(path); +} - return type; +static void +e_plugin_init (EPlugin *ep) +{ + ep->enabled = TRUE; } static EPlugin * @@ -897,7 +864,10 @@ e_plugin_xml_content_domain(xmlNodePtr node, const gchar *domain) /* ********************************************************************** */ -static gpointer eph_parent_class; +G_DEFINE_TYPE ( + EPluginHook, + e_plugin_hook, + G_TYPE_OBJECT) static gint eph_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root) @@ -914,46 +884,15 @@ eph_enable(EPluginHook *eph, gint state) } static void -eph_class_init(EPluginHookClass *class) +e_plugin_hook_class_init (EPluginHookClass *class) { - eph_parent_class = g_type_class_peek_parent (class); - class->construct = eph_construct; class->enable = eph_enable; } -/** - * e_plugin_hook_get_type: - * - * Standard GObject function to retrieve the EPluginHook type. Since - * EPluginHook is an abstract class, this is only used to subclass it. - * - * Return value: The EPluginHook type. - **/ -GType -e_plugin_hook_get_type(void) +static void +e_plugin_hook_init (EPluginHook *hook) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EPluginHookClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) eph_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EPluginHook), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "EPluginHook", &type_info, 0); - } - - return type; } /** diff --git a/e-util/e-profile-event.c b/e-util/e-profile-event.c index 33d7dfbdf7..fc2a609b26 100644 --- a/e-util/e-profile-event.c +++ b/e-util/e-profile-event.c @@ -31,20 +31,12 @@ #include "e-profile-event.h" -static GObjectClass *eme_parent; static EProfileEvent *e_profile_event; -static void -eme_init(GObject *o) -{ - /*EProfileEvent *eme = (EProfileEvent *)o; */ -} - -static void -eme_finalise(GObject *o) -{ - ((GObjectClass *)eme_parent)->finalize(o); -} +G_DEFINE_TYPE ( + EProfileEvent, + e_profile_event, + E_TYPE_EVENT) static void eme_target_free(EEvent *ep, EEventTarget *t) @@ -58,35 +50,18 @@ eme_target_free(EEvent *ep, EEventTarget *t) break; } } - ((EEventClass *)eme_parent)->target_free(ep, t); + ((EEventClass *)e_profile_event_parent_class)->target_free(ep, t); } static void -eme_class_init(GObjectClass *klass) +e_profile_event_class_init (EProfileEventClass *class) { - klass->finalize = eme_finalise; - ((EEventClass *)klass)->target_free = eme_target_free; + ((EEventClass *)class)->target_free = eme_target_free; } -GType -e_profile_event_get_type(void) +static void +e_profile_event_init (EProfileEvent *event) { - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof(EProfileEventClass), - NULL, NULL, - (GClassInitFunc)eme_class_init, - NULL, NULL, - sizeof(EProfileEvent), 0, - (GInstanceInitFunc)eme_init - }; - eme_parent = g_type_class_ref(e_event_get_type()); - type = g_type_register_static(e_event_get_type(), "EProfileEvent", &info, 0); - } - - return type; } EProfileEvent * @@ -136,9 +111,6 @@ e_profile_event_emit(const gchar *id, const gchar *uid, guint32 flags) /* ********************************************************************** */ -static gpointer emeh_parent_class; -#define emeh ((EProfileEventHook *)eph) - static const EEventHookTargetMask emeh_profile_masks[] = { { "start", E_PROFILE_EVENT_START }, { "end", E_PROFILE_EVENT_END }, @@ -151,42 +123,25 @@ static const EEventHookTargetMap emeh_targets[] = { { NULL } }; -static void -emeh_finalise(GObject *o) -{ - /*EPluginHook *eph = (EPluginHook *)o;*/ - - ((GObjectClass *)emeh_parent_class)->finalize(o); -} +G_DEFINE_TYPE ( + EProfileEventHook, + e_profile_event_hook, + E_TYPE_EVENT_HOOK) static void -emeh_class_init(EPluginHookClass *klass) +e_profile_event_hook_class_init (EProfileEventHookClass *class) { gint i; - ((GObjectClass *)klass)->finalize = emeh_finalise; - ((EPluginHookClass *)klass)->id = "org.gnome.evolution.profile.events:1.0"; + ((EPluginHookClass *)class)->id = "org.gnome.evolution.profile.events:1.0"; for (i=0;emeh_targets[i].type;i++) - e_event_hook_class_add_target_map((EEventHookClass *)klass, &emeh_targets[i]); + e_event_hook_class_add_target_map((EEventHookClass *)class, &emeh_targets[i]); - ((EEventHookClass *)klass)->event = (EEvent *)e_profile_event_peek(); + ((EEventHookClass *)class)->event = (EEvent *)e_profile_event_peek(); } -GType -e_profile_event_hook_get_type(void) +static void +e_profile_event_hook_init (EProfileEventHook *hook) { - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof(EProfileEventHookClass), NULL, NULL, (GClassInitFunc) emeh_class_init, NULL, NULL, - sizeof(EProfileEventHook), 0, (GInstanceInitFunc) NULL, - }; - - emeh_parent_class = g_type_class_ref(e_event_hook_get_type()); - type = g_type_register_static(e_event_hook_get_type(), "EProfileEventHook", &info, 0); - } - - return type; } diff --git a/e-util/e-signature-list.c b/e-util/e-signature-list.c index 449d2bbd9d..2c8fb5160d 100644 --- a/e-util/e-signature-list.c +++ b/e-util/e-signature-list.c @@ -46,47 +46,22 @@ enum { static guint signals [LAST_SIGNAL] = { 0 }; -static void e_signature_list_class_init (ESignatureListClass *klass); -static void e_signature_list_init (ESignatureList *list, ESignatureListClass *klass); static void e_signature_list_finalize (GObject *object); static void e_signature_list_dispose (GObject *object); -static EListClass *parent_class = NULL; - -GType -e_signature_list_get_type (void) -{ - static GType type = 0; - - if (!type) { - GTypeInfo type_info = { - sizeof (ESignatureListClass), - NULL, NULL, - (GClassInitFunc) e_signature_list_class_init, - NULL, NULL, - sizeof (ESignatureList), - 0, - (GInstanceInitFunc) e_signature_list_init, - }; - - type = g_type_register_static (E_TYPE_LIST, "ESignatureList", &type_info, 0); - } - - return type; -} +G_DEFINE_TYPE ( + ESignatureList, + e_signature_list, + E_TYPE_LIST) static void e_signature_list_class_init (ESignatureListClass *klass) { GObjectClass *object_class = (GObjectClass *) klass; - parent_class = g_type_class_ref (E_TYPE_LIST); - - /* virtual method override */ object_class->dispose = e_signature_list_dispose; object_class->finalize = e_signature_list_finalize; - /* signals */ signals[SIGNATURE_ADDED] = g_signal_new ("signature-added", G_OBJECT_CLASS_TYPE (object_class), @@ -117,7 +92,7 @@ e_signature_list_class_init (ESignatureListClass *klass) } static void -e_signature_list_init (ESignatureList *list, ESignatureListClass *klass) +e_signature_list_init (ESignatureList *list) { list->priv = g_new0 (struct _ESignatureListPrivate, 1); } @@ -134,7 +109,7 @@ e_signature_list_dispose (GObject *object) list->priv->gconf = NULL; } - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_signature_list_parent_class)->dispose (object); } static void @@ -144,7 +119,7 @@ e_signature_list_finalize (GObject *object) g_free (list->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_signature_list_parent_class)->finalize (object); } static GSList * diff --git a/e-util/e-signature.c b/e-util/e-signature.c index 6b9c1abdbe..1ac5616eef 100644 --- a/e-util/e-signature.c +++ b/e-util/e-signature.c @@ -60,7 +60,10 @@ enum { PROP_UID }; -static gpointer parent_class; +G_DEFINE_TYPE ( + ESignature, + e_signature, + G_TYPE_OBJECT) static gboolean xml_set_bool (xmlNodePtr node, @@ -235,7 +238,7 @@ signature_finalize (GObject *object) g_free (priv->uid); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_signature_parent_class)->finalize (object); } static void @@ -243,7 +246,6 @@ e_signature_class_init (ESignatureClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ESignaturePrivate)); object_class = G_OBJECT_CLASS (class); @@ -324,32 +326,6 @@ e_signature_init (ESignature *signature) signature->priv = E_SIGNATURE_GET_PRIVATE (signature); } -GType -e_signature_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - GTypeInfo type_info = { - sizeof (ESignatureClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) e_signature_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ESignature), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_signature_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "ESignature", &type_info, 0); - } - - return type; -} - /** * e_signature_new: * diff --git a/e-util/e-sorter-array.c b/e-util/e-sorter-array.c index c427df65dd..16971ffbe8 100644 --- a/e-util/e-sorter-array.c +++ b/e-util/e-sorter-array.c @@ -32,7 +32,10 @@ #define INCREMENT_AMOUNT 100 -G_DEFINE_TYPE (ESorterArray, e_sorter_array, E_SORTER_TYPE) +G_DEFINE_TYPE ( + ESorterArray, + e_sorter_array, + E_SORTER_TYPE) static void esa_sort (ESorterArray *esa); static void esa_backsort (ESorterArray *esa); diff --git a/e-util/e-sorter.c b/e-util/e-sorter.c index 14b469b734..a2ff83f53d 100644 --- a/e-util/e-sorter.c +++ b/e-util/e-sorter.c @@ -32,7 +32,10 @@ #define PARENT_TYPE G_TYPE_OBJECT -G_DEFINE_TYPE (ESorter, e_sorter, G_TYPE_OBJECT) +G_DEFINE_TYPE ( + ESorter, + e_sorter, + G_TYPE_OBJECT) static gint es_model_to_sorted (ESorter *es, gint row); static gint es_sorted_to_model (ESorter *es, gint row); diff --git a/e-util/e-text-event-processor-emacs-like.c b/e-util/e-text-event-processor-emacs-like.c index c69b79c6a3..bb8f7b6630 100644 --- a/e-util/e-text-event-processor-emacs-like.c +++ b/e-util/e-text-event-processor-emacs-like.c @@ -35,7 +35,8 @@ static gint e_text_event_processor_emacs_like_event G_DEFINE_TYPE ( ETextEventProcessorEmacsLike, - e_text_event_processor_emacs_like, E_TEXT_EVENT_PROCESSOR_TYPE) + e_text_event_processor_emacs_like, + E_TEXT_EVENT_PROCESSOR_TYPE) /* The arguments we take */ enum { diff --git a/e-util/e-text-event-processor.c b/e-util/e-text-event-processor.c index 090b7e6b0e..c79033d702 100644 --- a/e-util/e-text-event-processor.c +++ b/e-util/e-text-event-processor.c @@ -49,7 +49,10 @@ enum { static guint e_tep_signals[E_TEP_LAST_SIGNAL] = { 0 }; -G_DEFINE_TYPE (ETextEventProcessor, e_text_event_processor, G_TYPE_OBJECT) +G_DEFINE_TYPE ( + ETextEventProcessor, + e_text_event_processor, + G_TYPE_OBJECT) static void e_text_event_processor_class_init (ETextEventProcessorClass *klass) diff --git a/e-util/e-timeout-activity.c b/e-util/e-timeout-activity.c index aa57960fe0..4ddf39f89c 100644 --- a/e-util/e-timeout-activity.c +++ b/e-util/e-timeout-activity.c @@ -36,9 +36,13 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static gulong signals[LAST_SIGNAL]; +G_DEFINE_TYPE ( + ETimeoutActivity, + e_timeout_activity, + E_TYPE_ACTIVITY) + static gboolean timeout_activity_cb (ETimeoutActivity *timeout_activity) { @@ -58,7 +62,7 @@ timeout_activity_finalize (GObject *object) g_source_remove (priv->timeout_id); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_timeout_activity_parent_class)->finalize (object); } static void @@ -74,7 +78,7 @@ timeout_activity_cancelled (EActivity *activity) } /* Chain up to parent's cancelled() method. */ - E_ACTIVITY_CLASS (parent_class)->cancelled (activity); + E_ACTIVITY_CLASS (e_timeout_activity_parent_class)->cancelled (activity); } static void @@ -90,7 +94,7 @@ timeout_activity_completed (EActivity *activity) } /* Chain up to parent's completed() method. */ - E_ACTIVITY_CLASS (parent_class)->completed (activity); + E_ACTIVITY_CLASS (e_timeout_activity_parent_class)->completed (activity); } static void @@ -100,12 +104,11 @@ timeout_activity_timeout (ETimeoutActivity *timeout_activity) } static void -timeout_activity_class_init (ETimeoutActivityClass *class) +e_timeout_activity_class_init (ETimeoutActivityClass *class) { GObjectClass *object_class; EActivityClass *activity_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ETimeoutActivityPrivate)); object_class = G_OBJECT_CLASS (class); @@ -128,38 +131,12 @@ timeout_activity_class_init (ETimeoutActivityClass *class) } static void -timeout_activity_init (ETimeoutActivity *timeout_activity) +e_timeout_activity_init (ETimeoutActivity *timeout_activity) { timeout_activity->priv = E_TIMEOUT_ACTIVITY_GET_PRIVATE (timeout_activity); } -GType -e_timeout_activity_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ETimeoutActivityClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) timeout_activity_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ETimeoutActivity), - 0, /* n_preallocs */ - (GInstanceInitFunc) timeout_activity_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_ACTIVITY, "ETimeoutActivity", &type_info, 0); - } - - return type; -} - EActivity * e_timeout_activity_new (const gchar *primary_text) { diff --git a/e-util/e-ui-manager.c b/e-util/e-ui-manager.c index f108cd37c5..ef004b4da6 100644 --- a/e-util/e-ui-manager.c +++ b/e-util/e-ui-manager.c @@ -56,7 +56,10 @@ enum { PROP_EXPRESS_MODE }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EUIManager, + e_ui_manager, + GTK_TYPE_UI_MANAGER) static void ui_manager_set_property (GObject *object, @@ -136,11 +139,10 @@ ui_manager_filter_ui (EUIManager *ui_manager, } static void -ui_manager_class_init (EUIManagerClass *class) +e_ui_manager_class_init (EUIManagerClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EUIManagerPrivate)); object_class = G_OBJECT_CLASS (class); @@ -162,37 +164,11 @@ ui_manager_class_init (EUIManagerClass *class) } static void -ui_manager_init (EUIManager *ui_manager) +e_ui_manager_init (EUIManager *ui_manager) { ui_manager->priv = E_UI_MANAGER_GET_PRIVATE (ui_manager); } -GType -e_ui_manager_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EUIManagerClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) ui_manager_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EUIManager), - 0, /* n_preallocs */ - (GInstanceInitFunc) ui_manager_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_UI_MANAGER, "EUIManager", &type_info, 0); - } - - return type; -} - /** * e_ui_manager_new: * diff --git a/filter/e-filter-code.c b/filter/e-filter-code.c index 7c00baf8d8..ab2e19223c 100644 --- a/filter/e-filter-code.c +++ b/filter/e-filter-code.c @@ -27,7 +27,10 @@ #include "e-filter-code.h" -static gpointer parent_class; +G_DEFINE_TYPE ( + EFilterCode, + e_filter_code, + E_TYPE_FILTER_INPUT) /* here, the string IS the code */ static void @@ -60,51 +63,23 @@ filter_code_format_sexp (EFilterElement *element, } static void -filter_code_class_init (EFilterCodeClass *class) +e_filter_code_class_init (EFilterCodeClass *class) { EFilterElementClass *filter_element_class; - parent_class = g_type_class_peek_parent (class); - filter_element_class = E_FILTER_ELEMENT_CLASS (class); filter_element_class->build_code = filter_code_build_code; filter_element_class->format_sexp = filter_code_format_sexp; } static void -filter_code_init (EFilterCode *code) +e_filter_code_init (EFilterCode *code) { EFilterInput *input = E_FILTER_INPUT (code); input->type = (gchar *) xmlStrdup ((xmlChar *) "code"); } -GType -e_filter_code_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EFilterCodeClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) filter_code_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EFilterCode), - 0, /* n_preallocs */ - (GInstanceInitFunc) filter_code_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_FILTER_INPUT, "EFilterCode", &type_info, 0); - } - - return type; -} - /** * filter_code_new: * diff --git a/filter/e-filter-color.c b/filter/e-filter-color.c index c4a36607cb..b181fe7c96 100644 --- a/filter/e-filter-color.c +++ b/filter/e-filter-color.c @@ -30,7 +30,10 @@ #include "e-filter-color.h" -static gpointer parent_class; +G_DEFINE_TYPE ( + EFilterColor, + e_filter_color, + E_TYPE_FILTER_ELEMENT) static void set_color (GtkColorButton *color_button, EFilterColor *fc) @@ -45,8 +48,9 @@ filter_color_eq (EFilterElement *element_a, EFilterColor *color_a = E_FILTER_COLOR (element_a); EFilterColor *color_b = E_FILTER_COLOR (element_b); - return E_FILTER_ELEMENT_CLASS (parent_class)->eq (element_a, element_b) - && gdk_color_equal (&color_a->color, &color_b->color); + return E_FILTER_ELEMENT_CLASS (e_filter_color_parent_class)-> + eq (element_a, element_b) && + gdk_color_equal (&color_a->color, &color_b->color); } static xmlNodePtr @@ -126,12 +130,10 @@ filter_color_format_sexp (EFilterElement *element, } static void -filter_color_class_init (EFilterColorClass *class) +e_filter_color_class_init (EFilterColorClass *class) { EFilterElementClass *filter_element_class; - parent_class = g_type_class_peek_parent (class); - filter_element_class = E_FILTER_ELEMENT_CLASS (class); filter_element_class->eq = filter_color_eq; filter_element_class->xml_encode = filter_color_xml_encode; @@ -140,30 +142,9 @@ filter_color_class_init (EFilterColorClass *class) filter_element_class->format_sexp = filter_color_format_sexp; } -GType -e_filter_color_get_type (void) +static void +e_filter_color_init (EFilterColor *filter) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EFilterColorClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) filter_color_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EFilterColor), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_FILTER_ELEMENT, "EFilterColor", &type_info, 0); - } - - return type; } /** diff --git a/filter/e-filter-datespec.c b/filter/e-filter-datespec.c index 6ceb09450f..aa94bf5c90 100644 --- a/filter/e-filter-datespec.c +++ b/filter/e-filter-datespec.c @@ -92,7 +92,10 @@ struct _EFilterDatespecPrivate { gint span; }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EFilterDatespec, + e_filter_datespec, + E_TYPE_FILTER_ELEMENT) static gint get_best_span (time_t val) @@ -326,7 +329,8 @@ filter_datespec_eq (EFilterElement *element_a, EFilterDatespec *datespec_b = E_FILTER_DATESPEC (element_b); /* Chain up to parent's eq() method. */ - if (!E_FILTER_ELEMENT_CLASS (parent_class)->eq (element_a, element_b)) + if (!E_FILTER_ELEMENT_CLASS (e_filter_datespec_parent_class)-> + eq (element_a, element_b)) return FALSE; return (datespec_a->type == datespec_b->type) && @@ -433,11 +437,10 @@ filter_datespec_format_sexp (EFilterElement *element, } static void -filter_datespec_class_init (EFilterDatespecClass *class) +e_filter_datespec_class_init (EFilterDatespecClass *class) { EFilterElementClass *filter_element_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EFilterDatespecPrivate)); filter_element_class = E_FILTER_ELEMENT_CLASS (class); @@ -450,38 +453,12 @@ filter_datespec_class_init (EFilterDatespecClass *class) } static void -filter_datespec_init (EFilterDatespec *datespec) +e_filter_datespec_init (EFilterDatespec *datespec) { datespec->priv = E_FILTER_DATESPEC_GET_PRIVATE (datespec); datespec->type = FDST_UNKNOWN; } -GType -e_filter_datespec_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EFilterDatespecClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) filter_datespec_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EFilterDatespec), - 0, /* n_preallocs */ - (GInstanceInitFunc) filter_datespec_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_FILTER_ELEMENT, "EFilterDatespec", &type_info, 0); - } - - return type; -} - /** * filter_datespec_new: * diff --git a/filter/e-filter-element.c b/filter/e-filter-element.c index 61ca68295c..8062500aad 100644 --- a/filter/e-filter-element.c +++ b/filter/e-filter-element.c @@ -38,7 +38,10 @@ struct _element_type { gpointer data; }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EFilterElement, + e_filter_element, + G_TYPE_OBJECT) static gboolean filter_element_validate (EFilterElement *element, @@ -188,16 +191,14 @@ filter_element_finalize (GObject *object) xmlFree (element->name); /* Chain up to parent's finalize () method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_filter_element_parent_class)->finalize (object); } static void -filter_element_class_init (EFilterElementClass *class) +e_filter_element_class_init (EFilterElementClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); - object_class = G_OBJECT_CLASS (class); object_class->finalize = filter_element_finalize; @@ -208,30 +209,9 @@ filter_element_class_init (EFilterElementClass *class) class->copy_value = filter_element_copy_value; } -GType -e_filter_element_get_type (void) +static void +e_filter_element_init (EFilterElement *element) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EFilterElementClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) filter_element_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EFilterElement), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "EFilterElement", &type_info, 0); - } - - return type; } /** diff --git a/filter/e-filter-file.c b/filter/e-filter-file.c index 2a622f8e93..91942ec6f6 100644 --- a/filter/e-filter-file.c +++ b/filter/e-filter-file.c @@ -36,7 +36,10 @@ #include "e-filter-file.h" #include "e-filter-part.h" -static gpointer parent_class; +G_DEFINE_TYPE ( + EFilterFile, + e_filter_file, + E_TYPE_FILTER_ELEMENT) static void filter_file_filename_changed (GtkFileChooser *file_chooser, @@ -60,7 +63,7 @@ filter_file_finalize (GObject *object) g_free (file->path); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_filter_file_parent_class)->finalize (object); } static gboolean @@ -103,7 +106,8 @@ filter_file_eq (EFilterElement *element_a, EFilterFile *file_b = E_FILTER_FILE (element_b); /* Chain up to parent's eq() method. */ - if (!E_FILTER_ELEMENT_CLASS (parent_class)->eq (element_a, element_b)) + if (!E_FILTER_ELEMENT_CLASS (e_filter_file_parent_class)-> + eq (element_a, element_b)) return FALSE; if (g_strcmp0 (file_a->path, file_b->path) != 0) @@ -201,13 +205,11 @@ filter_file_format_sexp (EFilterElement *element, } static void -filter_file_class_init (EFilterFileClass *class) +e_filter_file_class_init (EFilterFileClass *class) { GObjectClass *object_class; EFilterElementClass *filter_element_class; - parent_class = g_type_class_peek_parent (class); - object_class = G_OBJECT_CLASS (class); object_class->finalize = filter_file_finalize; @@ -220,30 +222,9 @@ filter_file_class_init (EFilterFileClass *class) filter_element_class->format_sexp = filter_file_format_sexp; } -GType -e_filter_file_get_type (void) +static void +e_filter_file_init (EFilterFile *filter) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EFilterFileClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) filter_file_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EFilterFile), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_FILTER_ELEMENT, "EFilterFile", &type_info, 0); - } - - return type; } /** diff --git a/filter/e-filter-input.c b/filter/e-filter-input.c index 79d9fffb73..ec92030333 100644 --- a/filter/e-filter-input.c +++ b/filter/e-filter-input.c @@ -38,7 +38,10 @@ #include "e-filter-input.h" -static gpointer parent_class; +G_DEFINE_TYPE ( + EFilterInput, + e_filter_input, + E_TYPE_FILTER_ELEMENT) static void filter_input_entry_changed (GtkEntry *entry, @@ -65,7 +68,7 @@ filter_input_finalize (GObject *object) g_list_free (input->values); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_filter_input_parent_class)->finalize (object); } static gboolean @@ -122,7 +125,8 @@ filter_input_eq (EFilterElement *element_a, GList *link_b; /* Chain up to parent's eq() method. */ - if (!E_FILTER_ELEMENT_CLASS (parent_class)->eq (element_a, element_b)) + if (!E_FILTER_ELEMENT_CLASS (e_filter_input_parent_class)-> + eq (element_a, element_b)) return FALSE; if (g_strcmp0 (input_a->type, input_b->type) != 0) @@ -242,13 +246,11 @@ filter_input_format_sexp (EFilterElement *element, } static void -filter_input_class_init (EFilterInputClass *class) +e_filter_input_class_init (EFilterInputClass *class) { GObjectClass *object_class; EFilterElementClass *filter_element_class; - parent_class = g_type_class_peek_parent (class); - object_class = G_OBJECT_CLASS (class); object_class->finalize = filter_input_finalize; @@ -262,37 +264,11 @@ filter_input_class_init (EFilterInputClass *class) } static void -filter_input_init (EFilterInput *input) +e_filter_input_init (EFilterInput *input) { input->values = g_list_prepend (NULL, g_strdup ("")); } -GType -e_filter_input_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EFilterInputClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) filter_input_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EFilterInput), - 0, /* n_preallocs */ - (GInstanceInitFunc) filter_input_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_FILTER_ELEMENT, "EFilterInput", &type_info, 0); - } - - return type; -} - /** * filter_input_new: * diff --git a/filter/e-filter-int.c b/filter/e-filter-int.c index d9d7b1f357..68f8417423 100644 --- a/filter/e-filter-int.c +++ b/filter/e-filter-int.c @@ -31,7 +31,10 @@ #include "e-filter-int.h" -static gpointer parent_class; +G_DEFINE_TYPE ( + EFilterInt, + e_filter_int, + E_TYPE_FILTER_ELEMENT) static void filter_int_spin_changed (GtkSpinButton *spin_button, @@ -50,7 +53,7 @@ filter_int_finalize (GObject *object) g_free (filter_int->type); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_filter_int_parent_class)->finalize (object); } static gint @@ -61,7 +64,8 @@ filter_int_eq (EFilterElement *element_a, EFilterInt *filter_int_b = E_FILTER_INT (element_b); /* Chain up to parent's eq() method. */ - if (!E_FILTER_ELEMENT_CLASS (parent_class)->eq (element_a, element_b)) + if (!E_FILTER_ELEMENT_CLASS (e_filter_int_parent_class)-> + eq (element_a, element_b)) return FALSE; return (filter_int_a->val == filter_int_b->val); @@ -172,13 +176,11 @@ filter_int_format_sexp (EFilterElement *element, } static void -filter_int_class_init (EFilterIntClass *class) +e_filter_int_class_init (EFilterIntClass *class) { GObjectClass *object_class; EFilterElementClass *filter_element_class; - parent_class = g_type_class_peek_parent (class); - object_class = G_OBJECT_CLASS (class); object_class->finalize = filter_int_finalize; @@ -192,38 +194,12 @@ filter_int_class_init (EFilterIntClass *class) } static void -filter_int_init (EFilterInt *filter_int) +e_filter_int_init (EFilterInt *filter_int) { filter_int->min = 0; filter_int->max = G_MAXINT; } -GType -e_filter_int_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EFilterIntClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) filter_int_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EFilterInt), - 0, /* n_preallocs */ - (GInstanceInitFunc) filter_int_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_FILTER_ELEMENT, "EFilterInt", &type_info, 0); - } - - return type; -} - /** * filter_int_new: * diff --git a/filter/e-filter-option.c b/filter/e-filter-option.c index a9e99e06ff..c0ce5b778f 100644 --- a/filter/e-filter-option.c +++ b/filter/e-filter-option.c @@ -36,7 +36,10 @@ #include "e-filter-option.h" #include "e-filter-part.h" -static gpointer parent_class; +G_DEFINE_TYPE ( + EFilterOption, + e_filter_option, + E_TYPE_FILTER_ELEMENT) static void free_option (struct _filter_option *opt) @@ -108,7 +111,7 @@ filter_option_finalize (GObject *object) g_free (option->dynamic_func); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_filter_option_parent_class)->finalize (object); } static gint @@ -119,7 +122,8 @@ filter_option_eq (EFilterElement *element_a, EFilterOption *option_b = E_FILTER_OPTION (element_b); /* Chain up to parent's eq() method. */ - if (!E_FILTER_ELEMENT_CLASS (parent_class)->eq (element_a, element_b)) + if (!E_FILTER_ELEMENT_CLASS (e_filter_option_parent_class)-> + eq (element_a, element_b)) return FALSE; if (option_a->current == NULL && option_b->current == NULL) @@ -139,7 +143,8 @@ filter_option_xml_create (EFilterElement *element, xmlNodePtr n, work; /* Chain up to parent's xml_create() method. */ - E_FILTER_ELEMENT_CLASS (parent_class)->xml_create (element, node); + E_FILTER_ELEMENT_CLASS (e_filter_option_parent_class)-> + xml_create (element, node); n = node->children; while (n) { @@ -269,7 +274,8 @@ filter_option_clone (EFilterElement *element) GList *link; /* Chain up to parent's clone() method. */ - clone = E_FILTER_ELEMENT_CLASS (parent_class)->clone (element); + clone = E_FILTER_ELEMENT_CLASS (e_filter_option_parent_class)-> + clone (element); clone_option = E_FILTER_OPTION (clone); @@ -393,13 +399,11 @@ filter_option_format_sexp (EFilterElement *element, } static void -filter_option_class_init (EFilterOptionClass *class) +e_filter_option_class_init (EFilterOptionClass *class) { GObjectClass *object_class; EFilterElementClass *filter_element_class; - parent_class = g_type_class_peek_parent (class); - object_class = G_OBJECT_CLASS (class); object_class->finalize = filter_option_finalize; @@ -415,38 +419,12 @@ filter_option_class_init (EFilterOptionClass *class) } static void -filter_option_init (EFilterOption *option) +e_filter_option_init (EFilterOption *option) { option->type = "option"; option->dynamic_func = NULL; } -GType -e_filter_option_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EFilterOptionClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) filter_option_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EFilterOption), - 0, /* n_preallocs */ - (GInstanceInitFunc) filter_option_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_FILTER_ELEMENT, "EFilterOption", &type_info, 0); - } - - return type; -} - /** * filter_option_new: * diff --git a/filter/e-filter-part.c b/filter/e-filter-part.c index 4e6b114c37..2b75b30235 100644 --- a/filter/e-filter-part.c +++ b/filter/e-filter-part.c @@ -35,7 +35,10 @@ #include "e-filter-part.h" #include "e-rule-context.h" -static gpointer parent_class; +G_DEFINE_TYPE ( + EFilterPart, + e_filter_part, + G_TYPE_OBJECT) static void filter_part_finalize (GObject *object) @@ -50,44 +53,21 @@ filter_part_finalize (GObject *object) g_free (part->code); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_filter_part_parent_class)->finalize (object); } static void -filter_part_class_init (EFilterPartClass *class) +e_filter_part_class_init (EFilterPartClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); - object_class = G_OBJECT_CLASS (class); object_class->finalize = filter_part_finalize; } -GType -e_filter_part_get_type (void) +static void +e_filter_part_init (EFilterPart *part) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EFilterPartClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) filter_part_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EFilterPart), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "EFilterPart", &type_info, 0); - } - - return type; } /** diff --git a/filter/e-filter-rule.c b/filter/e-filter-rule.c index 2692972b16..13c95d430e 100644 --- a/filter/e-filter-rule.c +++ b/filter/e-filter-rule.c @@ -65,9 +65,13 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static guint signals[LAST_SIGNAL]; +G_DEFINE_TYPE ( + EFilterRule, + e_filter_rule, + G_TYPE_OBJECT) + static void filter_rule_grouping_changed_cb (GtkComboBox *combo_box, EFilterRule *rule) @@ -353,7 +357,7 @@ filter_rule_finalize (GObject *object) g_list_free (rule->parts); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_filter_rule_parent_class)->finalize (object); } static gint @@ -814,11 +818,10 @@ filter_rule_get_widget (EFilterRule *rule, } static void -filter_rule_class_init (EFilterRuleClass *class) +e_filter_rule_class_init (EFilterRuleClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EFilterRulePrivate)); object_class = G_OBJECT_CLASS (class); @@ -844,38 +847,12 @@ filter_rule_class_init (EFilterRuleClass *class) } static void -filter_rule_init (EFilterRule *rule) +e_filter_rule_init (EFilterRule *rule) { rule->priv = E_FILTER_RULE_GET_PRIVATE (rule); rule->enabled = TRUE; } -GType -e_filter_rule_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EFilterRuleClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) filter_rule_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EFilterRule), - 0, /* n_preallocs */ - (GInstanceInitFunc) filter_rule_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "EFilterRule", &type_info, 0); - } - - return type; -} - /** * filter_rule_new: * diff --git a/filter/e-rule-context.c b/filter/e-rule-context.c index 9abe7599e6..727c546373 100644 --- a/filter/e-rule-context.c +++ b/filter/e-rule-context.c @@ -68,7 +68,6 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static guint signals[LAST_SIGNAL]; struct _revert_data { @@ -76,6 +75,11 @@ struct _revert_data { gint rank; }; +G_DEFINE_TYPE ( + ERuleContext, + e_rule_context, + G_TYPE_OBJECT) + static void rule_context_set_error (ERuleContext *context, gchar *error) @@ -184,7 +188,7 @@ rule_context_finalize (GObject *obj) g_list_foreach (context->rules, (GFunc)g_object_unref, NULL); g_list_free (context->rules); - G_OBJECT_CLASS (parent_class)->finalize (obj); + G_OBJECT_CLASS (e_rule_context_parent_class)->finalize (obj); } static gint @@ -463,11 +467,10 @@ rule_context_new_element (ERuleContext *context, } static void -rule_context_class_init (ERuleContextClass *class) +e_rule_context_class_init (ERuleContextClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ERuleContextPrivate)); object_class = G_OBJECT_CLASS (class); @@ -512,7 +515,7 @@ rule_context_class_init (ERuleContextClass *class) } static void -rule_context_init (ERuleContext *context) +e_rule_context_init (ERuleContext *context) { context->priv = E_RULE_CONTEXT_GET_PRIVATE (context); @@ -522,32 +525,6 @@ rule_context_init (ERuleContext *context) context->flags = E_RULE_CONTEXT_GROUPING; } -GType -e_rule_context_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ERuleContextClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) rule_context_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ERuleContext), - 0, /* n_preallocs */ - (GInstanceInitFunc) rule_context_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "ERuleContext", &type_info, 0); - } - - return type; -} - /** * e_rule_context_new: * diff --git a/filter/e-rule-editor.c b/filter/e-rule-editor.c index f1bf0e26a7..9becdf80e4 100644 --- a/filter/e-rule-editor.c +++ b/filter/e-rule-editor.c @@ -58,7 +58,10 @@ struct _ERuleEditorPrivate { GtkButton *buttons[BUTTON_LAST]; }; -static gpointer parent_class; +G_DEFINE_TYPE ( + ERuleEditor, + e_rule_editor, + GTK_TYPE_DIALOG) static void rule_editor_add_undo (ERuleEditor *editor, @@ -558,7 +561,7 @@ rule_editor_finalize (GObject *object) } /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_rule_editor_parent_class)->finalize (object); } static void @@ -572,7 +575,7 @@ rule_editor_destroy (GtkObject *gtk_object) } /* Chain up to parent's destroy() method. */ - GTK_OBJECT_CLASS (parent_class)->destroy (gtk_object); + GTK_OBJECT_CLASS (e_rule_editor_parent_class)->destroy (gtk_object); } static void @@ -634,12 +637,11 @@ rule_editor_create_rule (ERuleEditor *editor) } static void -rule_editor_class_init (ERuleEditorClass *class) +e_rule_editor_class_init (ERuleEditorClass *class) { GObjectClass *object_class; GtkObjectClass *gtk_object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ERuleEditorPrivate)); object_class = G_OBJECT_CLASS (class); @@ -657,37 +659,11 @@ rule_editor_class_init (ERuleEditorClass *class) } static void -rule_editor_init (ERuleEditor *editor) +e_rule_editor_init (ERuleEditor *editor) { editor->priv = E_RULE_EDITOR_GET_PRIVATE (editor); } -GType -e_rule_editor_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ERuleEditorClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) rule_editor_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ERuleEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) rule_editor_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_DIALOG, "ERuleEditor", &type_info, 0); - } - - return type; -} - /** * rule_editor_new: * diff --git a/mail/e-mail-attachment-bar.c b/mail/e-mail-attachment-bar.c index b5a82dbcc1..c5ce9cf7bf 100644 --- a/mail/e-mail-attachment-bar.c +++ b/mail/e-mail-attachment-bar.c @@ -489,18 +489,18 @@ mail_attachment_bar_class_init (EMailAttachmentBarClass *class) } static void -mail_attachment_bar_iface_init (EAttachmentViewIface *iface) +mail_attachment_bar_interface_init (EAttachmentViewInterface *interface) { - iface->get_private = mail_attachment_bar_get_private; - iface->get_store = mail_attachment_bar_get_store; - iface->get_path_at_pos = mail_attachment_bar_get_path_at_pos; - iface->get_selected_paths = mail_attachment_bar_get_selected_paths; - iface->path_is_selected = mail_attachment_bar_path_is_selected; - iface->select_path = mail_attachment_bar_select_path; - iface->unselect_path = mail_attachment_bar_unselect_path; - iface->select_all = mail_attachment_bar_select_all; - iface->unselect_all = mail_attachment_bar_unselect_all; - iface->update_actions = mail_attachment_bar_update_actions; + interface->get_private = mail_attachment_bar_get_private; + interface->get_store = mail_attachment_bar_get_store; + interface->get_path_at_pos = mail_attachment_bar_get_path_at_pos; + interface->get_selected_paths = mail_attachment_bar_get_selected_paths; + interface->path_is_selected = mail_attachment_bar_path_is_selected; + interface->select_path = mail_attachment_bar_select_path; + interface->unselect_path = mail_attachment_bar_unselect_path; + interface->select_all = mail_attachment_bar_select_all; + interface->unselect_all = mail_attachment_bar_unselect_all; + interface->update_actions = mail_attachment_bar_update_actions; } static void @@ -665,8 +665,8 @@ e_mail_attachment_bar_get_type (void) NULL /* value_table */ }; - static const GInterfaceInfo iface_info = { - (GInterfaceInitFunc) mail_attachment_bar_iface_init, + static const GInterfaceInfo interface_info = { + (GInterfaceInitFunc) mail_attachment_bar_interface_init, (GInterfaceFinalizeFunc) NULL, NULL /* interface_data */ }; @@ -675,7 +675,7 @@ e_mail_attachment_bar_get_type (void) GTK_TYPE_VBOX, "EMailAttachmentBar", &type_info, 0); g_type_add_interface_static ( - type, E_TYPE_ATTACHMENT_VIEW, &iface_info); + type, E_TYPE_ATTACHMENT_VIEW, &interface_info); } return type; diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index 9d4fdf95ba..2ace9e4dd6 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -723,13 +723,13 @@ static void mail_browser_set_message (EMailReader *reader, const gchar *uid) { - EMailReaderIface *iface; + EMailReaderInterface *interface; CamelMessageInfo *info; CamelFolder *folder; /* Chain up to parent's set_message() method. */ - iface = g_type_default_interface_peek (E_TYPE_MAIL_READER); - iface->set_message (reader, uid); + interface = g_type_default_interface_peek (E_TYPE_MAIL_READER); + interface->set_message (reader, uid); if (uid == NULL) { e_mail_browser_close (E_MAIL_BROWSER (reader)); @@ -814,17 +814,17 @@ mail_browser_class_init (EMailBrowserClass *class) } static void -mail_browser_iface_init (EMailReaderIface *iface) +mail_browser_interface_init (EMailReaderInterface *interface) { - iface->get_action_group = mail_browser_get_action_group; - iface->get_formatter = mail_browser_get_formatter; - iface->get_hide_deleted = mail_browser_get_hide_deleted; - iface->get_message_list = mail_browser_get_message_list; - iface->get_popup_menu = mail_browser_get_popup_menu; - iface->get_shell_backend = mail_browser_get_shell_backend; - iface->get_window = mail_browser_get_window; - iface->set_message = mail_browser_set_message; - iface->show_search_bar = mail_browser_show_search_bar; + interface->get_action_group = mail_browser_get_action_group; + interface->get_formatter = mail_browser_get_formatter; + interface->get_hide_deleted = mail_browser_get_hide_deleted; + interface->get_message_list = mail_browser_get_message_list; + interface->get_popup_menu = mail_browser_get_popup_menu; + interface->get_shell_backend = mail_browser_get_shell_backend; + interface->get_window = mail_browser_get_window; + interface->set_message = mail_browser_set_message; + interface->show_search_bar = mail_browser_show_search_bar; } static void @@ -864,8 +864,8 @@ e_mail_browser_get_type (void) NULL /* value_table */ }; - static const GInterfaceInfo iface_info = { - (GInterfaceInitFunc) mail_browser_iface_init, + static const GInterfaceInfo interface_info = { + (GInterfaceInitFunc) mail_browser_interface_init, (GInterfaceFinalizeFunc) NULL, NULL /* interface_data */ }; @@ -874,7 +874,7 @@ e_mail_browser_get_type (void) GTK_TYPE_WINDOW, "EMailBrowser", &type_info, 0); g_type_add_interface_static ( - type, E_TYPE_MAIL_READER, &iface_info); + type, E_TYPE_MAIL_READER, &interface_info); } return type; diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c index 0480ac281c..a10c37031c 100644 --- a/mail/e-mail-notebook-view.c +++ b/mail/e-mail-notebook-view.c @@ -71,7 +71,7 @@ enum { E_SHELL_WINDOW_ACTION_GROUP ((window), "mail") /* Forward Declarations */ -static void e_mail_notebook_view_reader_init (EMailReaderIface *iface); +static void e_mail_notebook_view_reader_init (EMailReaderInterface *interface); G_DEFINE_TYPE_WITH_CODE ( EMailNotebookView, e_mail_notebook_view, E_TYPE_MAIL_VIEW, @@ -1257,19 +1257,19 @@ e_mail_notebook_view_class_init (EMailNotebookViewClass *class) } static void -e_mail_notebook_view_reader_init (EMailReaderIface *iface) +e_mail_notebook_view_reader_init (EMailReaderInterface *interface) { - iface->get_action_group = mail_notebook_view_get_action_group; - iface->get_formatter = mail_notebook_view_get_formatter; - iface->get_hide_deleted = mail_notebook_view_get_hide_deleted; - iface->get_message_list = mail_notebook_view_get_message_list; - iface->get_popup_menu = mail_notebook_view_get_popup_menu; - iface->get_shell_backend = mail_notebook_view_get_shell_backend; - iface->get_window = mail_notebook_view_get_window; - iface->set_folder = mail_notebook_view_set_folder; - iface->show_search_bar = mail_notebook_view_show_search_bar; - iface->open_selected_mail = mail_notebook_view_open_selected_mail; - iface->enable_show_folder = mail_notebook_view_enable_show_folder; + interface->get_action_group = mail_notebook_view_get_action_group; + interface->get_formatter = mail_notebook_view_get_formatter; + interface->get_hide_deleted = mail_notebook_view_get_hide_deleted; + interface->get_message_list = mail_notebook_view_get_message_list; + interface->get_popup_menu = mail_notebook_view_get_popup_menu; + interface->get_shell_backend = mail_notebook_view_get_shell_backend; + interface->get_window = mail_notebook_view_get_window; + interface->set_folder = mail_notebook_view_set_folder; + interface->show_search_bar = mail_notebook_view_show_search_bar; + interface->open_selected_mail = mail_notebook_view_open_selected_mail; + interface->enable_show_folder = mail_notebook_view_enable_show_folder; } static void diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c index 2839c1f44e..e81a7bbbef 100644 --- a/mail/e-mail-paned-view.c +++ b/mail/e-mail-paned-view.c @@ -84,7 +84,7 @@ enum { #define STATE_KEY_PREVIEW_VISIBLE "PreviewVisible" /* Forward Declarations */ -static void e_mail_paned_view_reader_init (EMailReaderIface *iface); +static void e_mail_paned_view_reader_init (EMailReaderInterface *interface); G_DEFINE_TYPE_WITH_CODE ( EMailPanedView, e_mail_paned_view, E_TYPE_MAIL_VIEW, @@ -426,7 +426,7 @@ mail_paned_view_set_folder (EMailReader *reader, EShellView *shell_view; EShellWindow *shell_window; EShellSettings *shell_settings; - EMailReaderIface *default_iface; + EMailReaderInterface *default_interface; GtkWidget *message_list; GKeyFile *key_file; gchar *group_name; @@ -448,8 +448,8 @@ mail_paned_view_set_folder (EMailReader *reader, message_list_freeze (MESSAGE_LIST (message_list)); /* Chain up to interface's default set_folder() method. */ - default_iface = g_type_default_interface_peek (E_TYPE_MAIL_READER); - default_iface->set_folder (reader, folder, folder_uri); + default_interface = g_type_default_interface_peek (E_TYPE_MAIL_READER); + default_interface->set_folder (reader, folder, folder_uri); if (folder == NULL) goto exit; @@ -891,19 +891,19 @@ e_mail_paned_view_class_init (EMailPanedViewClass *class) } static void -e_mail_paned_view_reader_init (EMailReaderIface *iface) -{ - iface->get_action_group = mail_paned_view_get_action_group; - iface->get_formatter = mail_paned_view_get_formatter; - iface->get_hide_deleted = mail_paned_view_get_hide_deleted; - iface->get_message_list = mail_paned_view_get_message_list; - iface->get_popup_menu = mail_paned_view_get_popup_menu; - iface->get_shell_backend = mail_paned_view_get_shell_backend; - iface->get_window = mail_paned_view_get_window; - iface->set_folder = mail_paned_view_set_folder; - iface->show_search_bar = mail_paned_view_show_search_bar; - iface->open_selected_mail = mail_paned_view_reader_open_selected_mail; - iface->enable_show_folder = mail_paned_view_enable_show_folder; +e_mail_paned_view_reader_init (EMailReaderInterface *interface) +{ + interface->get_action_group = mail_paned_view_get_action_group; + interface->get_formatter = mail_paned_view_get_formatter; + interface->get_hide_deleted = mail_paned_view_get_hide_deleted; + interface->get_message_list = mail_paned_view_get_message_list; + interface->get_popup_menu = mail_paned_view_get_popup_menu; + interface->get_shell_backend = mail_paned_view_get_shell_backend; + interface->get_window = mail_paned_view_get_window; + interface->set_folder = mail_paned_view_set_folder; + interface->show_search_bar = mail_paned_view_show_search_bar; + interface->open_selected_mail = mail_paned_view_reader_open_selected_mail; + interface->enable_show_folder = mail_paned_view_enable_show_folder; } static void diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index e19c53d4d7..805ed615d8 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -106,6 +106,8 @@ static gchar *default_xfer_messages_uri; static GQuark quark_private; static guint signals[LAST_SIGNAL]; +G_DEFINE_INTERFACE (EMailReader, e_mail_reader, GTK_TYPE_OBJECT) + static void mail_reader_destroy (GObject *object) { @@ -2899,21 +2901,21 @@ mail_reader_init_charset_actions (EMailReader *reader) } static void -mail_reader_class_init (EMailReaderIface *iface) +e_mail_reader_default_init (EMailReaderInterface *interface) { quark_private = g_quark_from_static_string ("EMailReader-private"); - iface->get_selected_uids = mail_reader_get_selected_uids; - iface->get_folder = mail_reader_get_folder; - iface->get_folder_uri = mail_reader_get_folder_uri; - iface->enable_show_folder = mail_reader_get_enable_show_folder; - iface->set_folder = mail_reader_set_folder; - iface->set_message = mail_reader_set_message; - iface->open_selected_mail = e_mail_reader_open_selected; - iface->update_actions = mail_reader_update_actions; + interface->get_selected_uids = mail_reader_get_selected_uids; + interface->get_folder = mail_reader_get_folder; + interface->get_folder_uri = mail_reader_get_folder_uri; + interface->enable_show_folder = mail_reader_get_enable_show_folder; + interface->set_folder = mail_reader_set_folder; + interface->set_message = mail_reader_set_message; + interface->open_selected_mail = e_mail_reader_open_selected; + interface->update_actions = mail_reader_update_actions; g_object_interface_install_property ( - iface, + interface, g_param_spec_boolean ( "group-by-threads", "Group by Threads", @@ -2923,7 +2925,7 @@ mail_reader_class_init (EMailReaderIface *iface) signals[CHANGED] = g_signal_new ( "changed", - G_OBJECT_CLASS_TYPE (iface), + G_OBJECT_CLASS_TYPE (interface), G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, @@ -2931,7 +2933,7 @@ mail_reader_class_init (EMailReaderIface *iface) signals[FOLDER_LOADED] = g_signal_new ( "folder-loaded", - G_OBJECT_CLASS_TYPE (iface), + G_OBJECT_CLASS_TYPE (interface), G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, @@ -2939,16 +2941,16 @@ mail_reader_class_init (EMailReaderIface *iface) signals[SHOW_SEARCH_BAR] = g_signal_new ( "show-search-bar", - G_OBJECT_CLASS_TYPE (iface), + G_OBJECT_CLASS_TYPE (interface), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (EMailReaderIface, show_search_bar), + G_STRUCT_OFFSET (EMailReaderInterface, show_search_bar), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals[SHOW_FOLDER] = g_signal_new ( "show-folder", - G_OBJECT_CLASS_TYPE (iface), + G_OBJECT_CLASS_TYPE (interface), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, 0, NULL, NULL, @@ -2957,7 +2959,7 @@ mail_reader_class_init (EMailReaderIface *iface) signals[SHOW_NEXTTAB] = g_signal_new ( "show-next-tab", - G_OBJECT_CLASS_TYPE (iface), + G_OBJECT_CLASS_TYPE (interface), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, 0, NULL, NULL, @@ -2966,7 +2968,7 @@ mail_reader_class_init (EMailReaderIface *iface) signals[SHOW_PREVTAB] = g_signal_new ( "show-previous-tab", - G_OBJECT_CLASS_TYPE (iface), + G_OBJECT_CLASS_TYPE (interface), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, 0, NULL, NULL, @@ -2975,7 +2977,7 @@ mail_reader_class_init (EMailReaderIface *iface) signals[CLOSE_TAB] = g_signal_new ( "close-tab", - G_OBJECT_CLASS_TYPE (iface), + G_OBJECT_CLASS_TYPE (interface), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, 0, NULL, NULL, @@ -2984,43 +2986,15 @@ mail_reader_class_init (EMailReaderIface *iface) signals[UPDATE_ACTIONS] = g_signal_new ( "update-actions", - G_OBJECT_CLASS_TYPE (iface), + G_OBJECT_CLASS_TYPE (interface), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (EMailReaderIface, update_actions), + G_STRUCT_OFFSET (EMailReaderInterface, update_actions), NULL, NULL, g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT); } -GType -e_mail_reader_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EMailReaderIface), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) mail_reader_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - 0, /* instance_size */ - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_INTERFACE, "EMailReader", &type_info, 0); - - g_type_interface_add_prerequisite (type, GTK_TYPE_OBJECT); - } - - return type; -} - void e_mail_reader_init (EMailReader *reader) { @@ -3455,131 +3429,131 @@ e_mail_reader_get_action (EMailReader *reader, GtkActionGroup * e_mail_reader_get_action_group (EMailReader *reader) { - EMailReaderIface *iface; + EMailReaderInterface *interface; g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL); - iface = E_MAIL_READER_GET_IFACE (reader); - g_return_val_if_fail (iface->get_action_group != NULL, NULL); + interface = E_MAIL_READER_GET_INTERFACE (reader); + g_return_val_if_fail (interface->get_action_group != NULL, NULL); - return iface->get_action_group (reader); + return interface->get_action_group (reader); } EMFormatHTML * e_mail_reader_get_formatter (EMailReader *reader) { - EMailReaderIface *iface; + EMailReaderInterface *interface; g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL); - iface = E_MAIL_READER_GET_IFACE (reader); - g_return_val_if_fail (iface->get_formatter != NULL, NULL); + interface = E_MAIL_READER_GET_INTERFACE (reader); + g_return_val_if_fail (interface->get_formatter != NULL, NULL); - return iface->get_formatter (reader); + return interface->get_formatter (reader); } gboolean e_mail_reader_get_hide_deleted (EMailReader *reader) { - EMailReaderIface *iface; + EMailReaderInterface *interface; g_return_val_if_fail (E_IS_MAIL_READER (reader), FALSE); - iface = E_MAIL_READER_GET_IFACE (reader); - g_return_val_if_fail (iface->get_hide_deleted != NULL, FALSE); + interface = E_MAIL_READER_GET_INTERFACE (reader); + g_return_val_if_fail (interface->get_hide_deleted != NULL, FALSE); - return iface->get_hide_deleted (reader); + return interface->get_hide_deleted (reader); } GtkWidget * e_mail_reader_get_message_list (EMailReader *reader) { - EMailReaderIface *iface; + EMailReaderInterface *interface; g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL); - iface = E_MAIL_READER_GET_IFACE (reader); - g_return_val_if_fail (iface->get_message_list != NULL, NULL); + interface = E_MAIL_READER_GET_INTERFACE (reader); + g_return_val_if_fail (interface->get_message_list != NULL, NULL); - return iface->get_message_list (reader); + return interface->get_message_list (reader); } GtkMenu * e_mail_reader_get_popup_menu (EMailReader *reader) { - EMailReaderIface *iface; + EMailReaderInterface *interface; g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL); - iface = E_MAIL_READER_GET_IFACE (reader); - g_return_val_if_fail (iface->get_popup_menu != NULL, NULL); + interface = E_MAIL_READER_GET_INTERFACE (reader); + g_return_val_if_fail (interface->get_popup_menu != NULL, NULL); - return iface->get_popup_menu (reader); + return interface->get_popup_menu (reader); } GPtrArray * e_mail_reader_get_selected_uids (EMailReader *reader) { - EMailReaderIface *iface; + EMailReaderInterface *interface; g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL); - iface = E_MAIL_READER_GET_IFACE (reader); - g_return_val_if_fail (iface->get_selected_uids != NULL, NULL); + interface = E_MAIL_READER_GET_INTERFACE (reader); + g_return_val_if_fail (interface->get_selected_uids != NULL, NULL); - return iface->get_selected_uids (reader); + return interface->get_selected_uids (reader); } EShellBackend * e_mail_reader_get_shell_backend (EMailReader *reader) { - EMailReaderIface *iface; + EMailReaderInterface *interface; g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL); - iface = E_MAIL_READER_GET_IFACE (reader); - g_return_val_if_fail (iface->get_shell_backend != NULL, NULL); + interface = E_MAIL_READER_GET_INTERFACE (reader); + g_return_val_if_fail (interface->get_shell_backend != NULL, NULL); - return iface->get_shell_backend (reader); + return interface->get_shell_backend (reader); } GtkWindow * e_mail_reader_get_window (EMailReader *reader) { - EMailReaderIface *iface; + EMailReaderInterface *interface; g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL); - iface = E_MAIL_READER_GET_IFACE (reader); - g_return_val_if_fail (iface->get_window != NULL, NULL); + interface = E_MAIL_READER_GET_INTERFACE (reader); + g_return_val_if_fail (interface->get_window != NULL, NULL); - return iface->get_window (reader); + return interface->get_window (reader); } CamelFolder * e_mail_reader_get_folder (EMailReader *reader) { - EMailReaderIface *iface; + EMailReaderInterface *interface; g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL); - iface = E_MAIL_READER_GET_IFACE (reader); - g_return_val_if_fail (iface->get_folder != NULL, NULL); + interface = E_MAIL_READER_GET_INTERFACE (reader); + g_return_val_if_fail (interface->get_folder != NULL, NULL); - return iface->get_folder (reader); + return interface->get_folder (reader); } const gchar * e_mail_reader_get_folder_uri (EMailReader *reader) { - EMailReaderIface *iface; + EMailReaderInterface *interface; g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL); - iface = E_MAIL_READER_GET_IFACE (reader); - g_return_val_if_fail (iface->get_folder_uri != NULL, NULL); + interface = E_MAIL_READER_GET_INTERFACE (reader); + g_return_val_if_fail (interface->get_folder_uri != NULL, NULL); - return iface->get_folder_uri (reader); + return interface->get_folder_uri (reader); } void @@ -3587,14 +3561,14 @@ e_mail_reader_set_folder (EMailReader *reader, CamelFolder *folder, const gchar *folder_uri) { - EMailReaderIface *iface; + EMailReaderInterface *interface; g_return_if_fail (E_IS_MAIL_READER (reader)); - iface = E_MAIL_READER_GET_IFACE (reader); - g_return_if_fail (iface->set_folder != NULL); + interface = E_MAIL_READER_GET_INTERFACE (reader); + g_return_if_fail (interface->set_folder != NULL); - iface->set_folder (reader, folder, folder_uri); + interface->set_folder (reader, folder, folder_uri); } /* Helper for e_mail_reader_set_folder_uri () */ @@ -3625,27 +3599,27 @@ void e_mail_reader_set_message (EMailReader *reader, const gchar *uid) { - EMailReaderIface *iface; + EMailReaderInterface *interface; g_return_if_fail (E_IS_MAIL_READER (reader)); - iface = E_MAIL_READER_GET_IFACE (reader); - g_return_if_fail (iface->set_message != NULL); + interface = E_MAIL_READER_GET_INTERFACE (reader); + g_return_if_fail (interface->set_message != NULL); - iface->set_message (reader, uid); + interface->set_message (reader, uid); } guint e_mail_reader_open_selected_mail (EMailReader *reader) { - EMailReaderIface *iface; + EMailReaderInterface *interface; g_return_val_if_fail (E_IS_MAIL_READER (reader), 0); - iface = E_MAIL_READER_GET_IFACE (reader); - g_return_val_if_fail (iface->open_selected_mail != NULL, 0); + interface = E_MAIL_READER_GET_INTERFACE (reader); + g_return_val_if_fail (interface->open_selected_mail != NULL, 0); - return iface->open_selected_mail (reader); + return interface->open_selected_mail (reader); } gboolean @@ -3763,12 +3737,12 @@ e_mail_reader_enable_show_folder (EMailReader *reader) gboolean e_mail_reader_get_enable_show_folder (EMailReader *reader) { - EMailReaderIface *iface; + EMailReaderInterface *interface; g_return_val_if_fail (E_IS_MAIL_READER (reader), FALSE); - iface = E_MAIL_READER_GET_IFACE (reader); - g_return_val_if_fail (iface->enable_show_folder != NULL, FALSE); + interface = E_MAIL_READER_GET_INTERFACE (reader); + g_return_val_if_fail (interface->enable_show_folder != NULL, FALSE); - return iface->enable_show_folder (reader); + return interface->enable_show_folder (reader); } diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h index f1e609bbfa..b2247048be 100644 --- a/mail/e-mail-reader.h +++ b/mail/e-mail-reader.h @@ -38,18 +38,18 @@ #define E_MAIL_READER(obj) \ (G_TYPE_CHECK_INSTANCE_CAST \ ((obj), E_TYPE_MAIL_READER, EMailReader)) -#define E_MAIL_READER_IFACE(cls) \ +#define E_MAIL_READER_INTERFACE(cls) \ (G_TYPE_CHECK_CLASS_CAST \ - ((cls), E_TYPE_MAIL_READER, EMailReaderIface)) + ((cls), E_TYPE_MAIL_READER, EMailReaderInterface)) #define E_IS_MAIL_READER(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE \ ((obj), E_TYPE_MAIL_READER)) -#define E_IS_MAIL_READER_IFACE(cls) \ +#define E_IS_MAIL_READER_INTERFACE(cls) \ (G_TYPE_CHECK_CLASS_TYPE \ ((cls), E_TYPE_MAIL_READER)) -#define E_MAIL_READER_GET_IFACE(obj) \ +#define E_MAIL_READER_GET_INTERFACE(obj) \ (G_TYPE_INSTANCE_GET_INTERFACE \ - ((obj), E_TYPE_MAIL_READER, EMailReaderIface)) + ((obj), E_TYPE_MAIL_READER, EMailReaderInterface)) /* Basename of the UI definition file. */ #define E_MAIL_READER_UI_DEFINITION "evolution-mail-reader.ui" @@ -57,7 +57,7 @@ G_BEGIN_DECLS typedef struct _EMailReader EMailReader; -typedef struct _EMailReaderIface EMailReaderIface; +typedef struct _EMailReaderInterface EMailReaderInterface; enum { E_MAIL_READER_HAVE_ENABLED_ACCOUNT = 1 << 0, @@ -79,8 +79,8 @@ enum { E_MAIL_READER_FOLDER_IS_JUNK = 1 << 16 }; -struct _EMailReaderIface { - GTypeInterface parent_iface; +struct _EMailReaderInterface { + GTypeInterface parent_interface; GtkActionGroup * (*get_action_group) (EMailReader *reader); diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c index 7a410bac55..8dc2619bfa 100644 --- a/modules/mail/e-mail-shell-content.c +++ b/modules/mail/e-mail-shell-content.c @@ -377,18 +377,18 @@ e_mail_shell_content_get_type (void) } static void -mail_shell_content_reader_init (EMailReaderIface *iface) +mail_shell_content_reader_init (EMailReaderInterface *interface) { - iface->get_action_group = mail_shell_content_get_action_group; - iface->get_formatter = mail_shell_content_get_formatter; - iface->get_hide_deleted = mail_shell_content_get_hide_deleted; - iface->get_message_list = mail_shell_content_get_message_list; - iface->get_popup_menu = mail_shell_content_get_popup_menu; - iface->get_shell_backend = mail_shell_content_get_shell_backend; - iface->get_window = mail_shell_content_get_window; - iface->set_folder = mail_shell_content_set_folder; - iface->show_search_bar = mail_shell_content_show_search_bar; - iface->open_selected_mail = mail_shell_content_open_selected_mail; + interface->get_action_group = mail_shell_content_get_action_group; + interface->get_formatter = mail_shell_content_get_formatter; + interface->get_hide_deleted = mail_shell_content_get_hide_deleted; + interface->get_message_list = mail_shell_content_get_message_list; + interface->get_popup_menu = mail_shell_content_get_popup_menu; + interface->get_shell_backend = mail_shell_content_get_shell_backend; + interface->get_window = mail_shell_content_get_window; + interface->set_folder = mail_shell_content_set_folder; + interface->show_search_bar = mail_shell_content_show_search_bar; + interface->open_selected_mail = mail_shell_content_open_selected_mail; } void diff --git a/modules/mail/em-account-prefs.c b/modules/mail/em-account-prefs.c index 310f18ed7b..7b3b61fa9a 100644 --- a/modules/mail/em-account-prefs.c +++ b/modules/mail/em-account-prefs.c @@ -50,7 +50,10 @@ struct _EMAccountPrefsPrivate { gpointer editor; /* weak pointer */ }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EMAccountPrefs, + em_account_prefs, + E_TYPE_ACCOUNT_MANAGER) static void account_prefs_enable_account_cb (EAccountTreeView *tree_view) @@ -258,16 +261,15 @@ account_prefs_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (em_account_prefs_parent_class)->dispose (object); } static void -account_prefs_class_init (EMAccountPrefsClass *class) +em_account_prefs_class_init (EMAccountPrefsClass *class) { GObjectClass *object_class; EAccountManagerClass *account_manager_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EMAccountPrefsPrivate)); object_class = G_OBJECT_CLASS (class); @@ -280,7 +282,7 @@ account_prefs_class_init (EMAccountPrefsClass *class) } static void -account_prefs_init (EMAccountPrefs *prefs) +em_account_prefs_init (EMAccountPrefs *prefs) { EAccountManager *manager; EAccountTreeView *tree_view; @@ -299,33 +301,6 @@ account_prefs_init (EMAccountPrefs *prefs) G_CALLBACK (account_prefs_disable_account_cb), NULL); } -GType -em_account_prefs_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EMAccountPrefsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) account_prefs_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMAccountPrefs), - 0, /* n_preallocs */ - (GInstanceInitFunc) account_prefs_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_ACCOUNT_MANAGER, "EMAccountPrefs", - &type_info, 0); - } - - return type; -} - GtkWidget * em_account_prefs_new (EPreferencesWindow *window) { diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c index 5e0b3405c5..7db5238a62 100644 --- a/modules/mail/em-composer-prefs.c +++ b/modules/mail/em-composer-prefs.c @@ -55,7 +55,10 @@ #include "em-config.h" #include "em-folder-selection-button.h" -static gpointer parent_class; +G_DEFINE_TYPE ( + EMComposerPrefs, + em_composer_prefs, + GTK_TYPE_VBOX) static gboolean transform_color_to_string (const GValue *src_value, @@ -169,49 +172,21 @@ composer_prefs_finalize (GObject *object) g_object_unref (prefs->builder); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (em_composer_prefs_parent_class)->finalize (object); } static void -composer_prefs_class_init (EMComposerPrefsClass *class) +em_composer_prefs_class_init (EMComposerPrefsClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); - object_class = G_OBJECT_CLASS (class); object_class->finalize = composer_prefs_finalize; } static void -composer_prefs_init (EMComposerPrefs *prefs) -{ -} - -GType -em_composer_prefs_get_type (void) +em_composer_prefs_init (EMComposerPrefs *prefs) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EMComposerPrefsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) composer_prefs_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMComposerPrefs), - 0, /* n_allocs */ - (GInstanceInitFunc) composer_prefs_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_VBOX, "EMComposerPrefs", &type_info, 0); - } - - return type; } void diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c index 7a6b86da18..751c395223 100644 --- a/modules/mail/em-mailer-prefs.c +++ b/modules/mail/em-mailer-prefs.c @@ -52,12 +52,6 @@ #include "em-config.h" #include "mail-session.h" -static void em_mailer_prefs_class_init (EMMailerPrefsClass *class); -static void em_mailer_prefs_init (EMMailerPrefs *dialog); -static void em_mailer_prefs_finalize (GObject *object); - -static GtkVBoxClass *parent_class = NULL; - enum { HEADER_LIST_NAME_COLUMN, /* displayable name of the header (may be a translation) */ HEADER_LIST_ENABLED_COLUMN, /* is the header enabled? */ @@ -100,36 +94,34 @@ static const struct { { N_("Once per month"), 30 }, }; -GType -em_mailer_prefs_get_type (void) +G_DEFINE_TYPE ( + EMMailerPrefs, + em_mailer_prefs, + GTK_TYPE_VBOX) + +static void +em_mailer_prefs_finalize (GObject *object) { - static GType type = 0; - - if (!type) { - GTypeInfo type_info = { - sizeof (EMMailerPrefsClass), - NULL, NULL, - (GClassInitFunc) em_mailer_prefs_class_init, - NULL, NULL, - sizeof (EMMailerPrefs), - 0, - (GInstanceInitFunc) em_mailer_prefs_init, - }; - - type = g_type_register_static (gtk_vbox_get_type (), "EMMailerPrefs", &type_info, 0); + EMMailerPrefs *prefs = (EMMailerPrefs *) object; + + g_object_unref (prefs->builder); + + if (prefs->labels_change_notify_id) { + gconf_client_notify_remove (prefs->gconf, prefs->labels_change_notify_id); + + prefs->labels_change_notify_id = 0; } - return type; + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (em_mailer_prefs_parent_class)->finalize (object); } static void -em_mailer_prefs_class_init (EMMailerPrefsClass *klass) +em_mailer_prefs_class_init (EMMailerPrefsClass *class) { GObjectClass *object_class; - object_class = (GObjectClass *) klass; - parent_class = g_type_class_ref (gtk_vbox_get_type ()); - + object_class = G_OBJECT_CLASS (class); object_class->finalize = em_mailer_prefs_finalize; } @@ -139,22 +131,6 @@ em_mailer_prefs_init (EMMailerPrefs *preferences) preferences->gconf = mail_config_get_gconf_client (); } -static void -em_mailer_prefs_finalize (GObject *obj) -{ - EMMailerPrefs *prefs = (EMMailerPrefs *) obj; - - g_object_unref (prefs->builder); - - if (prefs->labels_change_notify_id) { - gconf_client_notify_remove (prefs->gconf, prefs->labels_change_notify_id); - - prefs->labels_change_notify_id = 0; - } - - ((GObjectClass *)(parent_class))->finalize (obj); -} - static gboolean mark_seen_timeout_transform (const GValue *src_value, GValue *dst_value, diff --git a/modules/mail/em-network-prefs.c b/modules/mail/em-network-prefs.c index efa9e0a090..247ab242e4 100644 --- a/modules/mail/em-network-prefs.c +++ b/modules/mail/em-network-prefs.c @@ -61,68 +61,19 @@ #define GCONF_E_USE_PROXY_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "use_http_proxy" #define GCONF_E_AUTOCONFIG_URL_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "autoconfig_url" -static void em_network_prefs_class_init (EMNetworkPrefsClass *class); -static void em_network_prefs_init (EMNetworkPrefs *dialog); -static void em_network_prefs_destroy (GtkObject *obj); -static void em_network_prefs_finalise (GObject *obj); - -static GtkVBoxClass *parent_class = NULL; - -GType -em_network_prefs_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (EMNetworkPrefsClass), - NULL, NULL, - (GClassInitFunc) em_network_prefs_class_init, - NULL, NULL, - sizeof (EMNetworkPrefs), - 0, - (GInstanceInitFunc) em_network_prefs_init, - }; - - type = g_type_register_static (gtk_vbox_get_type (), "EMNetworkPrefs", &info, 0); - } - - return type; -} +G_DEFINE_TYPE ( + EMNetworkPrefs, + em_network_prefs, + GTK_TYPE_VBOX) static void -em_network_prefs_class_init (EMNetworkPrefsClass *klass) +em_network_prefs_class_init (EMNetworkPrefsClass *class) { - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); - - parent_class = g_type_class_ref (gtk_vbox_get_type ()); - - object_class->destroy = em_network_prefs_destroy; - gobject_class->finalize = em_network_prefs_finalise; } static void em_network_prefs_init (EMNetworkPrefs *prefs) { - /* do something here */ -} - -static void -em_network_prefs_finalise (GObject *obj) -{ - d(g_print ("Network preferences finalize is called\n")); - - /* do something here */ - G_OBJECT_CLASS (parent_class)->finalize (obj); -} - -static void -em_network_prefs_destroy (GtkObject *obj) -{ - d(g_print ("Network preferences destroy is called\n")); - - GTK_OBJECT_CLASS (parent_class)->destroy (obj); } static void diff --git a/plugins/groupwise-features/mail-send-options.c b/plugins/groupwise-features/mail-send-options.c index d6c6f32095..fb0a3bda14 100644 --- a/plugins/groupwise-features/mail-send-options.c +++ b/plugins/groupwise-features/mail-send-options.c @@ -179,10 +179,10 @@ action_send_options_cb (GtkAction *action, EMsgComposer *composer) /* display the send options dialog */ if (!dialog) { - dialog = e_sendoptions_dialog_new (); + dialog = e_send_options_dialog_new (); } - e_sendoptions_dialog_run (dialog, GTK_WIDGET (composer), E_ITEM_MAIL); + e_send_options_dialog_run (dialog, GTK_WIDGET (composer), E_ITEM_MAIL); g_signal_connect (dialog, "sod_response", G_CALLBACK (feed_input_data), composer); diff --git a/plugins/groupwise-features/send-options.c b/plugins/groupwise-features/send-options.c index e20be7353b..8d9c102b63 100644 --- a/plugins/groupwise-features/send-options.c +++ b/plugins/groupwise-features/send-options.c @@ -160,13 +160,13 @@ e_send_options_load_default_data (EGwSendOptions *opts, ESendOptionsDialog *sod) } static void -e_sendoptions_clicked_cb (GtkWidget *button, gpointer data) +e_send_options_clicked_cb (GtkWidget *button, gpointer data) { EGwConnectionStatus status; account = (EAccount *) data; if (!sod) { - sod = e_sendoptions_dialog_new (); - e_sendoptions_set_global (sod, TRUE); + sod = e_send_options_dialog_new (); + e_send_options_set_global (sod, TRUE); if (!n_cnc) n_cnc = get_cnc (GTK_WINDOW (gtk_widget_get_toplevel (button))); @@ -186,7 +186,7 @@ e_sendoptions_clicked_cb (GtkWidget *button, gpointer data) } if (n_cnc) - e_sendoptions_dialog_run (sod, parent ? parent : NULL, E_ITEM_NONE); + e_send_options_dialog_run (sod, parent ? parent : NULL, E_ITEM_NONE); else return; } @@ -214,7 +214,7 @@ org_gnome_send_options (EPlugin *epl, EConfigHookItemFactoryData *data) g_free (markup); g_signal_connect(button, "clicked", - G_CALLBACK (e_sendoptions_clicked_cb), account); + G_CALLBACK (e_send_options_clicked_cb), account); parent = gtk_widget_get_toplevel (GTK_WIDGET (data->parent)); if (!gtk_widget_is_toplevel (parent)) diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c index 7b1fe4e5aa..5173ee8c83 100644 --- a/shell/e-shell-content.c +++ b/shell/e-shell-content.c @@ -62,8 +62,11 @@ enum { }; G_DEFINE_TYPE_WITH_CODE ( - EShellContent, e_shell_content, GTK_TYPE_BIN, - G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)); + EShellContent, + e_shell_content, + GTK_TYPE_BIN, + G_IMPLEMENT_INTERFACE ( + E_TYPE_EXTENSIBLE, NULL)); static void shell_content_dialog_rule_changed (GtkWidget *dialog, diff --git a/shell/e-shell-searchbar.c b/shell/e-shell-searchbar.c index a42fa18adc..cb525f8f85 100644 --- a/shell/e-shell-searchbar.c +++ b/shell/e-shell-searchbar.c @@ -92,8 +92,11 @@ enum { }; G_DEFINE_TYPE_WITH_CODE ( - EShellSearchbar, e_shell_searchbar, GTK_TYPE_BOX, - G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)) + EShellSearchbar, + e_shell_searchbar, + GTK_TYPE_BOX, + G_IMPLEMENT_INTERFACE ( + E_TYPE_EXTENSIBLE, NULL)) static void shell_searchbar_save_search_filter (EShellSearchbar *searchbar) diff --git a/shell/e-shell-sidebar.c b/shell/e-shell-sidebar.c index b5c3879c50..61a688360f 100644 --- a/shell/e-shell-sidebar.c +++ b/shell/e-shell-sidebar.c @@ -56,8 +56,11 @@ enum { }; G_DEFINE_TYPE_WITH_CODE ( - EShellSidebar, e_shell_sidebar, GTK_TYPE_BIN, - G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)) + EShellSidebar, + e_shell_sidebar, + GTK_TYPE_BIN, + G_IMPLEMENT_INTERFACE ( + E_TYPE_EXTENSIBLE, NULL)) static void shell_sidebar_set_shell_view (EShellSidebar *shell_sidebar, diff --git a/shell/e-shell-switcher.c b/shell/e-shell-switcher.c index 0568c85b18..9569a51a12 100644 --- a/shell/e-shell-switcher.c +++ b/shell/e-shell-switcher.c @@ -63,9 +63,13 @@ static guint signals[LAST_SIGNAL]; static void shell_switcher_tool_shell_iface_init (GtkToolShellIface *iface); G_DEFINE_TYPE_WITH_CODE ( - EShellSwitcher, e_shell_switcher, GTK_TYPE_BIN, - G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL) - G_IMPLEMENT_INTERFACE (GTK_TYPE_TOOL_SHELL, + EShellSwitcher, + e_shell_switcher, + GTK_TYPE_BIN, + G_IMPLEMENT_INTERFACE ( + E_TYPE_EXTENSIBLE, NULL) + G_IMPLEMENT_INTERFACE ( + GTK_TYPE_TOOL_SHELL, shell_switcher_tool_shell_iface_init)) static gint diff --git a/shell/e-shell-taskbar.c b/shell/e-shell-taskbar.c index 43865470de..a82d3d6246 100644 --- a/shell/e-shell-taskbar.c +++ b/shell/e-shell-taskbar.c @@ -57,8 +57,11 @@ enum { }; G_DEFINE_TYPE_WITH_CODE ( - EShellTaskbar, e_shell_taskbar, GTK_TYPE_HBOX, - G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)) + EShellTaskbar, + e_shell_taskbar, + GTK_TYPE_HBOX, + G_IMPLEMENT_INTERFACE ( + E_TYPE_EXTENSIBLE, NULL)) static void shell_taskbar_activity_remove (EShellTaskbar *shell_taskbar, diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c index de6cda0e76..5480903f6b 100644 --- a/shell/e-shell-window.c +++ b/shell/e-shell-window.c @@ -55,8 +55,11 @@ enum { static gulong signals[LAST_SIGNAL]; G_DEFINE_TYPE_WITH_CODE ( - EShellWindow, e_shell_window, GTK_TYPE_WINDOW, - G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)) + EShellWindow, + e_shell_window, + GTK_TYPE_WINDOW, + G_IMPLEMENT_INTERFACE ( + E_TYPE_EXTENSIBLE, NULL)) static void shell_window_menubar_update_new_menu (EShellWindow *shell_window) diff --git a/shell/e-shell.c b/shell/e-shell.c index 9ed43fc110..fcb3d9abf3 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -113,8 +113,11 @@ static gpointer default_shell; static guint signals[LAST_SIGNAL]; G_DEFINE_TYPE_WITH_CODE ( - EShell, e_shell, UNIQUE_TYPE_APP, - G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)) + EShell, + e_shell, + UNIQUE_TYPE_APP, + G_IMPLEMENT_INTERFACE ( + E_TYPE_EXTENSIBLE, NULL)) static void shell_parse_debug_string (EShell *shell) diff --git a/widgets/misc/e-account-combo-box.c b/widgets/misc/e-account-combo-box.c index e2306baae1..91a843cc8d 100644 --- a/widgets/misc/e-account-combo-box.c +++ b/widgets/misc/e-account-combo-box.c @@ -43,10 +43,14 @@ struct _EAccountComboBoxPrivate { gint num_displayed_accounts; }; -static gpointer parent_class; static CamelSession *camel_session; static guint signal_ids[LAST_SIGNAL]; +G_DEFINE_TYPE ( + EAccountComboBox, + e_account_combo_box, + GTK_TYPE_COMBO_BOX) + static gboolean account_combo_box_has_dupes (GList *list, const gchar *address) @@ -231,10 +235,12 @@ account_combo_box_constructor (GType type, GObjectConstructParam *construct_properties) { GObject *object; + GObjectClass *parent_class; GtkCellRenderer *renderer; /* Chain up to parent's constructor() method. */ - object = G_OBJECT_CLASS (parent_class)->constructor ( + parent_class = G_OBJECT_CLASS (e_account_combo_box_parent_class); + object = parent_class->constructor ( type, n_construct_properties, construct_properties); renderer = gtk_cell_renderer_text_new (); @@ -265,7 +271,7 @@ account_combo_box_dispose (GObject *object) g_hash_table_remove_all (priv->index); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_account_combo_box_parent_class)->dispose (object); } static void @@ -278,15 +284,14 @@ account_combo_box_finalize (GObject *object) g_hash_table_destroy (priv->index); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_account_combo_box_parent_class)->finalize (object); } static void -account_combo_box_class_init (EAccountComboBoxClass *class) +e_account_combo_box_class_init (EAccountComboBoxClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EAccountComboBoxPrivate)); object_class = G_OBJECT_CLASS (class); @@ -304,7 +309,7 @@ account_combo_box_class_init (EAccountComboBoxClass *class) } static void -account_combo_box_init (EAccountComboBox *combo_box) +e_account_combo_box_init (EAccountComboBox *combo_box) { GHashTable *index; @@ -318,32 +323,6 @@ account_combo_box_init (EAccountComboBox *combo_box) combo_box->priv->index = index; } -GType -e_account_combo_box_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EAccountComboBoxClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) account_combo_box_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EAccountComboBox), - 0, /* n_preallocs */ - (GInstanceInitFunc) account_combo_box_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_COMBO_BOX, "EAccountComboBox", &type_info, 0); - } - - return type; -} - GtkWidget * e_account_combo_box_new (void) { diff --git a/widgets/misc/e-account-manager.c b/widgets/misc/e-account-manager.c index 2e71400f53..3186e6ffbc 100644 --- a/widgets/misc/e-account-manager.c +++ b/widgets/misc/e-account-manager.c @@ -52,9 +52,13 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static guint signals[LAST_SIGNAL]; +G_DEFINE_TYPE ( + EAccountManager, + e_account_manager, + GTK_TYPE_TABLE) + static void account_manager_default_clicked_cb (EAccountManager *manager) { @@ -193,15 +197,14 @@ account_manager_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_account_manager_parent_class)->dispose (object); } static void -account_manager_class_init (EAccountManagerClass *class) +e_account_manager_class_init (EAccountManagerClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EAccountManagerPrivate)); object_class = G_OBJECT_CLASS (class); @@ -252,7 +255,7 @@ account_manager_class_init (EAccountManagerClass *class) } static void -account_manager_init (EAccountManager *manager) +e_account_manager_init (EAccountManager *manager) { GtkTreeSelection *selection; GtkWidget *container; @@ -358,32 +361,6 @@ account_manager_init (EAccountManager *manager) G_CALLBACK (account_manager_default_clicked_cb), manager); } -GType -e_account_manager_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EAccountManagerClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) account_manager_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_init */ - sizeof (EAccountManager), - 0, /* n_preallocs */ - (GInstanceInitFunc) account_manager_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_TABLE, "EAccountManager", &type_info, 0); - } - - return type; -} - GtkWidget * e_account_manager_new (EAccountList *account_list) { diff --git a/widgets/misc/e-account-tree-view.c b/widgets/misc/e-account-tree-view.c index 9b083a3f6e..c99a4b55fa 100644 --- a/widgets/misc/e-account-tree-view.c +++ b/widgets/misc/e-account-tree-view.c @@ -54,9 +54,13 @@ struct _EAccountTreeViewPrivate { GHashTable *index; }; -static gpointer parent_class; static guint signals[LAST_SIGNAL]; +G_DEFINE_TYPE ( + EAccountTreeView, + e_account_tree_view, + GTK_TYPE_TREE_VIEW) + static void account_tree_view_refresh_cb (EAccountList *account_list, EAccount *account, @@ -187,12 +191,14 @@ account_tree_view_constructor (GType type, GObjectConstructParam *construct_properties) { GObject *object; + GObjectClass *parent_class; GtkTreeView *tree_view; GtkTreeViewColumn *column; GtkCellRenderer *renderer; /* Chain up to parent's constructor() method. */ - object = G_OBJECT_CLASS (parent_class)->constructor ( + parent_class = G_OBJECT_CLASS (e_account_tree_view_parent_class); + object = parent_class->constructor ( type, n_construct_properties, construct_properties); tree_view = GTK_TREE_VIEW (object); @@ -331,7 +337,7 @@ account_tree_view_dispose (GObject *object) g_hash_table_remove_all (priv->index); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_account_tree_view_parent_class)->dispose (object); } static void @@ -344,7 +350,7 @@ account_tree_view_finalize (GObject *object) g_hash_table_destroy (priv->index); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_account_tree_view_parent_class)->finalize (object); } static void @@ -386,11 +392,10 @@ account_tree_view_disable_account (EAccountTreeView *tree_view) } static void -account_tree_view_class_init (EAccountTreeViewClass *class) +e_account_tree_view_class_init (EAccountTreeViewClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EAccountTreeViewPrivate)); object_class = G_OBJECT_CLASS (class); @@ -453,7 +458,7 @@ account_tree_view_class_init (EAccountTreeViewClass *class) } static void -account_tree_view_init (EAccountTreeView *tree_view) +e_account_tree_view_init (EAccountTreeView *tree_view) { GHashTable *index; GtkTreeSelection *selection; @@ -475,33 +480,6 @@ account_tree_view_init (EAccountTreeView *tree_view) tree_view); } -GType -e_account_tree_view_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EAccountTreeViewClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) account_tree_view_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EAccountTreeView), - 0, /* n_preallocs */ - (GInstanceInitFunc) account_tree_view_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_TREE_VIEW, "EAccountTreeView", - &type_info, 0); - } - - return type; -} - GtkWidget * e_account_tree_view_new (void) { diff --git a/widgets/misc/e-action-combo-box.c b/widgets/misc/e-action-combo-box.c index 0260c6e19a..2a3d419b93 100644 --- a/widgets/misc/e-action-combo-box.c +++ b/widgets/misc/e-action-combo-box.c @@ -46,7 +46,10 @@ struct _EActionComboBoxPrivate { gboolean group_has_icons : 1; }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EActionComboBox, + e_action_combo_box, + GTK_TYPE_COMBO_BOX) static void action_combo_box_action_changed_cb (GtkRadioAction *action, @@ -329,7 +332,7 @@ action_combo_box_dispose (GObject *object) g_hash_table_remove_all (priv->index); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_action_combo_box_parent_class)->dispose (object); } static void @@ -340,7 +343,7 @@ action_combo_box_finalize (GObject *object) g_hash_table_destroy (priv->index); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_action_combo_box_parent_class)->finalize (object); } static void @@ -363,12 +366,11 @@ action_combo_box_changed (GtkComboBox *combo_box) } static void -action_combo_box_class_init (EActionComboBoxClass *class) +e_action_combo_box_class_init (EActionComboBoxClass *class) { GObjectClass *object_class; GtkComboBoxClass *combo_box_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EActionComboBoxPrivate)); object_class = G_OBJECT_CLASS (class); @@ -392,7 +394,7 @@ action_combo_box_class_init (EActionComboBoxClass *class) } static void -action_combo_box_init (EActionComboBox *combo_box) +e_action_combo_box_init (EActionComboBox *combo_box) { GtkCellRenderer *renderer; @@ -424,33 +426,6 @@ action_combo_box_init (EActionComboBox *combo_box) (GDestroyNotify) gtk_tree_row_reference_free); } -GType -e_action_combo_box_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EActionComboBoxClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) action_combo_box_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EActionComboBox), - 0, /* n_preallocs */ - (GInstanceInitFunc) action_combo_box_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_COMBO_BOX, "EActionComboBox", - &type_info, 0); - } - - return type; -} - GtkWidget * e_action_combo_box_new (void) { diff --git a/widgets/misc/e-activity-proxy.c b/widgets/misc/e-activity-proxy.c index c503e5e26d..8e20e67d5d 100644 --- a/widgets/misc/e-activity-proxy.c +++ b/widgets/misc/e-activity-proxy.c @@ -41,7 +41,10 @@ enum { PROP_ACTIVITY }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EActivityProxy, + e_activity_proxy, + GTK_TYPE_EVENT_BOX) static void activity_proxy_update (EActivityProxy *proxy) @@ -183,7 +186,7 @@ activity_proxy_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_activity_proxy_parent_class)->dispose (object); } static void @@ -217,11 +220,10 @@ activity_proxy_constructed (GObject *object) } static void -activity_proxy_class_init (EActivityProxyClass *class) +e_activity_proxy_class_init (EActivityProxyClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EActivityProxyPrivate)); object_class = G_OBJECT_CLASS (class); @@ -243,7 +245,7 @@ activity_proxy_class_init (EActivityProxyClass *class) } static void -activity_proxy_init (EActivityProxy *proxy) +e_activity_proxy_init (EActivityProxy *proxy) { GtkWidget *container; GtkWidget *widget; @@ -300,32 +302,6 @@ activity_proxy_init (EActivityProxy *proxy) gtk_widget_show (widget); } -GType -e_activity_proxy_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EActivityProxyClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) activity_proxy_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EActivityProxy), - 0, /* n_preallocs */ - (GInstanceInitFunc) activity_proxy_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_EVENT_BOX, "EActivityProxy", &type_info, 0); - } - - return type; -} - GtkWidget * e_activity_proxy_new (EActivity *activity) { diff --git a/widgets/misc/e-attachment-button.c b/widgets/misc/e-attachment-button.c index a248cf6ca4..3878c1ee8d 100644 --- a/widgets/misc/e-attachment-button.c +++ b/widgets/misc/e-attachment-button.c @@ -55,7 +55,10 @@ enum { PROP_VIEW }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EAttachmentButton, + e_attachment_button, + GTK_TYPE_HBOX) static void attachment_button_menu_deactivate_cb (EAttachmentButton *button) @@ -435,7 +438,7 @@ attachment_button_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_attachment_button_parent_class)->dispose (object); } static void @@ -445,19 +448,19 @@ attachment_button_style_set (GtkWidget *widget, EAttachmentButton *button; /* Chain up to parent's style_set() method. */ - GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style); + GTK_WIDGET_CLASS (e_attachment_button_parent_class)-> + style_set (widget, previous_style); button = E_ATTACHMENT_BUTTON (widget); attachment_button_update_pixbufs (button); } static void -attachment_button_class_init (EAttachmentButtonClass *class) +e_attachment_button_class_init (EAttachmentButtonClass *class) { GObjectClass *object_class; GtkWidgetClass *widget_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EAttachmentButtonPrivate)); object_class = G_OBJECT_CLASS (class); @@ -513,7 +516,7 @@ attachment_button_class_init (EAttachmentButtonClass *class) } static void -attachment_button_init (EAttachmentButton *button) +e_attachment_button_init (EAttachmentButton *button) { GtkCellRenderer *renderer; GtkCellLayout *cell_layout; @@ -635,32 +638,6 @@ attachment_button_init (EAttachmentButton *button) button); } -GType -e_attachment_button_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EAttachmentButtonClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) attachment_button_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EAttachmentButton), - 0, /* n_preallocs */ - (GInstanceInitFunc) attachment_button_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_HBOX, "EAttachmentButton", &type_info, 0); - } - - return type; -} - GtkWidget * e_attachment_button_new (EAttachmentView *view) { diff --git a/widgets/misc/e-attachment-dialog.c b/widgets/misc/e-attachment-dialog.c index 45c2103e3d..c2a7149980 100644 --- a/widgets/misc/e-attachment-dialog.c +++ b/widgets/misc/e-attachment-dialog.c @@ -40,7 +40,10 @@ enum { PROP_ATTACHMENT }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EAttachmentDialog, + e_attachment_dialog, + GTK_TYPE_DIALOG) static void attachment_dialog_update (EAttachmentDialog *dialog) @@ -183,7 +186,7 @@ attachment_dialog_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_attachment_dialog_parent_class)->dispose (object); } static void @@ -193,7 +196,7 @@ attachment_dialog_map (GtkWidget *widget) GtkWidget *content_area; /* Chain up to parent's map() method. */ - GTK_WIDGET_CLASS (parent_class)->map (widget); + GTK_WIDGET_CLASS (e_attachment_dialog_parent_class)->map (widget); /* XXX Override GtkDialog's broken style property defaults. */ action_area = gtk_dialog_get_action_area (GTK_DIALOG (widget)); @@ -255,13 +258,12 @@ attachment_dialog_response (GtkDialog *dialog, } static void -attachment_dialog_class_init (EAttachmentDialogClass *class) +e_attachment_dialog_class_init (EAttachmentDialogClass *class) { GObjectClass *object_class; GtkWidgetClass *widget_class; GtkDialogClass *dialog_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EAttachmentDialogPrivate)); object_class = G_OBJECT_CLASS (class); @@ -288,7 +290,7 @@ attachment_dialog_class_init (EAttachmentDialogClass *class) } static void -attachment_dialog_init (EAttachmentDialog *dialog) +e_attachment_dialog_init (EAttachmentDialog *dialog) { GtkWidget *container; GtkWidget *widget; @@ -376,32 +378,6 @@ attachment_dialog_init (EAttachmentDialog *dialog) gtk_widget_show (widget); } -GType -e_attachment_dialog_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EAttachmentDialogClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) attachment_dialog_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_init */ - sizeof (EAttachmentDialog), - 0, /* n_preallocs */ - (GInstanceInitFunc) attachment_dialog_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_DIALOG, "EAttachmentDialog", &type_info, 0); - } - - return type; -} - GtkWidget * e_attachment_dialog_new (GtkWindow *parent, EAttachment *attachment) diff --git a/widgets/misc/e-attachment-handler-image.c b/widgets/misc/e-attachment-handler-image.c index 770b1c552b..2aedaa6023 100644 --- a/widgets/misc/e-attachment-handler-image.c +++ b/widgets/misc/e-attachment-handler-image.c @@ -34,8 +34,6 @@ struct _EAttachmentHandlerImagePrivate { gint placeholder; }; -static gpointer parent_class; - static const gchar *ui = "<ui>" " <popup name='context'>" @@ -45,6 +43,11 @@ static const gchar *ui = " </popup>" "</ui>"; +G_DEFINE_TYPE ( + EAttachmentHandlerImage, + e_attachment_handler_image, + E_TYPE_ATTACHMENT_HANDLER) + static void action_image_set_as_background_saved_cb (EAttachment *attachment, GAsyncResult *result, @@ -207,7 +210,8 @@ attachment_handler_image_constructed (GObject *object) handler = E_ATTACHMENT_HANDLER (object); /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_attachment_handler_image_parent_class)-> + constructed (object); view = e_attachment_handler_get_view (handler); @@ -231,11 +235,10 @@ attachment_handler_image_constructed (GObject *object) } static void -attachment_handler_image_class_init (EAttachmentHandlerImageClass *class) +e_attachment_handler_image_class_init (EAttachmentHandlerImageClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EAttachmentHandlerImagePrivate)); object_class = G_OBJECT_CLASS (class); @@ -243,35 +246,7 @@ attachment_handler_image_class_init (EAttachmentHandlerImageClass *class) } static void -attachment_handler_image_init (EAttachmentHandlerImage *handler) +e_attachment_handler_image_init (EAttachmentHandlerImage *handler) { handler->priv = E_ATTACHMENT_HANDLER_IMAGE_GET_PRIVATE (handler); } - -GType -e_attachment_handler_image_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EAttachmentHandlerImageClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) attachment_handler_image_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EAttachmentHandlerImage), - 0, /* n_preallocs */ - (GInstanceInitFunc) attachment_handler_image_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_ATTACHMENT_HANDLER, - "EAttachmentHandlerImage", - &type_info, 0); - } - - return type; -} diff --git a/widgets/misc/e-attachment-handler-sendto.c b/widgets/misc/e-attachment-handler-sendto.c index dda351bc8d..a508314705 100644 --- a/widgets/misc/e-attachment-handler-sendto.c +++ b/widgets/misc/e-attachment-handler-sendto.c @@ -25,8 +25,6 @@ #include <glib/gi18n-lib.h> -static gpointer parent_class; - static const gchar *ui = "<ui>" " <popup name='context'>" @@ -36,6 +34,11 @@ static const gchar *ui = " </popup>" "</ui>"; +G_DEFINE_TYPE ( + EAttachmentHandlerSendto, + e_attachment_handler_sendto, + E_TYPE_ATTACHMENT_HANDLER) + static void sendto_save_finished_cb (EAttachment *attachment, GAsyncResult *result, @@ -182,7 +185,8 @@ attachment_handler_sendto_constructed (GObject *object) handler = E_ATTACHMENT_HANDLER (object); /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_attachment_handler_sendto_parent_class)-> + constructed (object); view = e_attachment_handler_get_view (handler); ui_manager = e_attachment_view_get_ui_manager (view); @@ -209,40 +213,15 @@ attachment_handler_sendto_constructed (GObject *object) } static void -attachment_handler_sendto_class_init (EAttachmentHandlerSendtoClass *class) +e_attachment_handler_sendto_class_init (EAttachmentHandlerSendtoClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); - object_class = G_OBJECT_CLASS (class); object_class->constructed = attachment_handler_sendto_constructed; } -GType -e_attachment_handler_sendto_get_type (void) +static void +e_attachment_handler_sendto_init (EAttachmentHandlerSendto *handler) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EAttachmentHandlerSendtoClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) attachment_handler_sendto_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EAttachmentHandlerSendto), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_ATTACHMENT_HANDLER, - "EAttachmentHandlerSendto", - &type_info, 0); - } - - return type; } diff --git a/widgets/misc/e-attachment-handler.c b/widgets/misc/e-attachment-handler.c index 303fc33cc2..947ae666d9 100644 --- a/widgets/misc/e-attachment-handler.c +++ b/widgets/misc/e-attachment-handler.c @@ -34,7 +34,10 @@ enum { PROP_VIEW }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EAttachmentHandler, + e_attachment_handler, + G_TYPE_OBJECT) static void attachment_handler_set_view (EAttachmentHandler *handler, @@ -104,15 +107,14 @@ attachment_handler_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_attachment_handler_parent_class)->dispose (object); } static void -attachment_handler_class_init (EAttachmentHandlerClass *class) +e_attachment_handler_class_init (EAttachmentHandlerClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EAttachmentHandlerPrivate)); object_class = G_OBJECT_CLASS (class); @@ -134,38 +136,11 @@ attachment_handler_class_init (EAttachmentHandlerClass *class) } static void -attachment_handler_init (EAttachmentHandler *handler) +e_attachment_handler_init (EAttachmentHandler *handler) { handler->priv = E_ATTACHMENT_HANDLER_GET_PRIVATE (handler); } -GType -e_attachment_handler_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EAttachmentHandlerClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) attachment_handler_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EAttachmentHandler), - 0, /* n_preallocs */ - (GInstanceInitFunc) attachment_handler_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "EAttachmentHandler", - &type_info, G_TYPE_FLAG_ABSTRACT); - } - - return type; -} - EAttachmentView * e_attachment_handler_get_view (EAttachmentHandler *handler) { diff --git a/widgets/misc/e-attachment-icon-view.c b/widgets/misc/e-attachment-icon-view.c index 35b5d1ed18..5c874f8bca 100644 --- a/widgets/misc/e-attachment-icon-view.c +++ b/widgets/misc/e-attachment-icon-view.c @@ -42,7 +42,18 @@ enum { }; static gint icon_size = GTK_ICON_SIZE_DIALOG; -static gpointer parent_class; + +/* Forward Declarations */ +static void e_attachment_icon_view_interface_init + (EAttachmentViewInterface *interface); + +G_DEFINE_TYPE_WITH_CODE ( + EAttachmentIconView, + e_attachment_icon_view, + GTK_TYPE_ICON_VIEW, + G_IMPLEMENT_INTERFACE ( + E_TYPE_ATTACHMENT_VIEW, + e_attachment_icon_view_interface_init)) void e_attachment_icon_view_set_default_icon_size (gint size) @@ -102,7 +113,7 @@ attachment_icon_view_dispose (GObject *object) e_attachment_view_dispose (E_ATTACHMENT_VIEW (object)); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_attachment_icon_view_parent_class)->dispose (object); } static void @@ -111,7 +122,7 @@ attachment_icon_view_finalize (GObject *object) e_attachment_view_finalize (E_ATTACHMENT_VIEW (object)); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_attachment_icon_view_parent_class)->finalize (object); } static gboolean @@ -124,7 +135,7 @@ attachment_icon_view_button_press_event (GtkWidget *widget, return TRUE; /* Chain up to parent's button_press_event() method. */ - return GTK_WIDGET_CLASS (parent_class)-> + return GTK_WIDGET_CLASS (e_attachment_icon_view_parent_class)-> button_press_event (widget, event); } @@ -138,7 +149,7 @@ attachment_icon_view_button_release_event (GtkWidget *widget, return TRUE; /* Chain up to parent's button_release_event() method. */ - return GTK_WIDGET_CLASS (parent_class)-> + return GTK_WIDGET_CLASS (e_attachment_icon_view_parent_class)-> button_release_event (widget, event); } @@ -152,7 +163,7 @@ attachment_icon_view_motion_notify_event (GtkWidget *widget, return TRUE; /* Chain up to parent's motion_notify_event() method. */ - return GTK_WIDGET_CLASS (parent_class)-> + return GTK_WIDGET_CLASS (e_attachment_icon_view_parent_class)-> motion_notify_event (widget, event); } @@ -166,7 +177,7 @@ attachment_icon_view_key_press_event (GtkWidget *widget, return TRUE; /* Chain up to parent's key_press_event() method. */ - return GTK_WIDGET_CLASS (parent_class)-> + return GTK_WIDGET_CLASS (e_attachment_icon_view_parent_class)-> key_press_event (widget, event); } @@ -177,7 +188,8 @@ attachment_icon_view_drag_begin (GtkWidget *widget, EAttachmentView *view = E_ATTACHMENT_VIEW (widget); /* Chain up to parent's drag_begin() method. */ - GTK_WIDGET_CLASS (parent_class)->drag_begin (widget, context); + GTK_WIDGET_CLASS (e_attachment_icon_view_parent_class)-> + drag_begin (widget, context); e_attachment_view_drag_begin (view, context); } @@ -189,7 +201,8 @@ attachment_icon_view_drag_end (GtkWidget *widget, EAttachmentView *view = E_ATTACHMENT_VIEW (widget); /* Chain up to parent's drag_end() method. */ - GTK_WIDGET_CLASS (parent_class)->drag_end (widget, context); + GTK_WIDGET_CLASS (e_attachment_icon_view_parent_class)-> + drag_end (widget, context); e_attachment_view_drag_end (view, context); } @@ -232,8 +245,8 @@ attachment_icon_view_drag_drop (GtkWidget *widget, return FALSE; /* Chain up to parent's drag_drop() method. */ - return GTK_WIDGET_CLASS (parent_class)->drag_drop ( - widget, context, x, y, time); + return GTK_WIDGET_CLASS (e_attachment_icon_view_parent_class)-> + drag_drop (widget, context, x, y, time); } static void @@ -417,13 +430,12 @@ attachment_icon_view_drag_dest_unset (EAttachmentView *view) } static void -attachment_icon_view_class_init (EAttachmentIconViewClass *class) +e_attachment_icon_view_class_init (EAttachmentIconViewClass *class) { GObjectClass *object_class; GtkWidgetClass *widget_class; GtkIconViewClass *icon_view_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EAttachmentViewPrivate)); object_class = G_OBJECT_CLASS (class); @@ -456,27 +468,7 @@ attachment_icon_view_class_init (EAttachmentIconViewClass *class) } static void -attachment_icon_view_iface_init (EAttachmentViewIface *iface) -{ - iface->get_private = attachment_icon_view_get_private; - iface->get_store = attachment_icon_view_get_store; - - iface->get_path_at_pos = attachment_icon_view_get_path_at_pos; - iface->get_selected_paths = attachment_icon_view_get_selected_paths; - iface->path_is_selected = attachment_icon_view_path_is_selected; - iface->select_path = attachment_icon_view_select_path; - iface->unselect_path = attachment_icon_view_unselect_path; - iface->select_all = attachment_icon_view_select_all; - iface->unselect_all = attachment_icon_view_unselect_all; - - iface->drag_source_set = attachment_icon_view_drag_source_set; - iface->drag_dest_set = attachment_icon_view_drag_dest_set; - iface->drag_source_unset = attachment_icon_view_drag_source_unset; - iface->drag_dest_unset = attachment_icon_view_drag_dest_unset; -} - -static void -attachment_icon_view_init (EAttachmentIconView *icon_view) +e_attachment_icon_view_init (EAttachmentIconView *icon_view) { GtkCellLayout *cell_layout; GtkCellRenderer *renderer; @@ -532,40 +524,24 @@ attachment_icon_view_init (EAttachmentIconView *icon_view) E_ATTACHMENT_STORE_COLUMN_SAVING); } -GType -e_attachment_icon_view_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EAttachmentIconViewClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) attachment_icon_view_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EAttachmentIconView), - 0, /* n_preallocs */ - (GInstanceInitFunc) attachment_icon_view_init, - NULL /* value_table */ - }; - - static const GInterfaceInfo iface_info = { - (GInterfaceInitFunc) attachment_icon_view_iface_init, - (GInterfaceFinalizeFunc) NULL, - NULL /* interface_data */ - }; - - type = g_type_register_static ( - GTK_TYPE_ICON_VIEW, "EAttachmentIconView", - &type_info, 0); - - g_type_add_interface_static ( - type, E_TYPE_ATTACHMENT_VIEW, &iface_info); - } - - return type; +static void +e_attachment_icon_view_interface_init (EAttachmentViewInterface *interface) +{ + interface->get_private = attachment_icon_view_get_private; + interface->get_store = attachment_icon_view_get_store; + + interface->get_path_at_pos = attachment_icon_view_get_path_at_pos; + interface->get_selected_paths = attachment_icon_view_get_selected_paths; + interface->path_is_selected = attachment_icon_view_path_is_selected; + interface->select_path = attachment_icon_view_select_path; + interface->unselect_path = attachment_icon_view_unselect_path; + interface->select_all = attachment_icon_view_select_all; + interface->unselect_all = attachment_icon_view_unselect_all; + + interface->drag_source_set = attachment_icon_view_drag_source_set; + interface->drag_dest_set = attachment_icon_view_drag_dest_set; + interface->drag_source_unset = attachment_icon_view_drag_source_unset; + interface->drag_dest_unset = attachment_icon_view_drag_dest_unset; } GtkWidget * diff --git a/widgets/misc/e-attachment-paned.c b/widgets/misc/e-attachment-paned.c index 64d97ab81f..9e2b73cf35 100644 --- a/widgets/misc/e-attachment-paned.c +++ b/widgets/misc/e-attachment-paned.c @@ -65,7 +65,17 @@ enum { PROP_EXPANDED }; -static gpointer parent_class; +/* Forward Declarations */ +static void e_attachment_paned_interface_init + (EAttachmentViewInterface *interface); + +G_DEFINE_TYPE_WITH_CODE ( + EAttachmentPaned, + e_attachment_paned, + GTK_TYPE_VPANED, + G_IMPLEMENT_INTERFACE ( + E_TYPE_ATTACHMENT_VIEW, + e_attachment_paned_interface_init)) void e_attachment_paned_set_default_height (gint height) @@ -266,7 +276,7 @@ attachment_paned_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_attachment_paned_parent_class)->dispose (object); } static void @@ -440,11 +450,10 @@ attachment_paned_update_actions (EAttachmentView *view) } static void -attachment_paned_class_init (EAttachmentPanedClass *class) +e_attachment_paned_class_init (EAttachmentPanedClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EAttachmentPanedPrivate)); object_class = G_OBJECT_CLASS (class); @@ -485,22 +494,7 @@ attachment_paned_class_init (EAttachmentPanedClass *class) } static void -attachment_paned_iface_init (EAttachmentViewIface *iface) -{ - iface->get_private = attachment_paned_get_private; - iface->get_store = attachment_paned_get_store; - iface->get_path_at_pos = attachment_paned_get_path_at_pos; - iface->get_selected_paths = attachment_paned_get_selected_paths; - iface->path_is_selected = attachment_paned_path_is_selected; - iface->select_path = attachment_paned_select_path; - iface->unselect_path = attachment_paned_unselect_path; - iface->select_all = attachment_paned_select_all; - iface->unselect_all = attachment_paned_unselect_all; - iface->update_actions = attachment_paned_update_actions; -} - -static void -attachment_paned_init (EAttachmentPaned *paned) +e_attachment_paned_init (EAttachmentPaned *paned) { EAttachmentView *view; GtkSizeGroup *size_group; @@ -678,40 +672,19 @@ attachment_paned_init (EAttachmentPaned *paned) g_object_unref (size_group); } -GType -e_attachment_paned_get_type (void) +static void +e_attachment_paned_interface_init (EAttachmentViewInterface *interface) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EAttachmentPanedClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) attachment_paned_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EAttachmentPaned), - 0, /* n_preallocs */ - (GInstanceInitFunc) attachment_paned_init, - NULL /* value_table */ - }; - - static const GInterfaceInfo iface_info = { - (GInterfaceInitFunc) attachment_paned_iface_init, - (GInterfaceFinalizeFunc) NULL, - NULL /* interface_data */ - }; - - type = g_type_register_static ( - GTK_TYPE_VPANED, "EAttachmentPaned", - &type_info, 0); - - g_type_add_interface_static ( - type, E_TYPE_ATTACHMENT_VIEW, &iface_info); - } - - return type; + interface->get_private = attachment_paned_get_private; + interface->get_store = attachment_paned_get_store; + interface->get_path_at_pos = attachment_paned_get_path_at_pos; + interface->get_selected_paths = attachment_paned_get_selected_paths; + interface->path_is_selected = attachment_paned_path_is_selected; + interface->select_path = attachment_paned_select_path; + interface->unselect_path = attachment_paned_unselect_path; + interface->select_all = attachment_paned_select_all; + interface->unselect_all = attachment_paned_unselect_all; + interface->update_actions = attachment_paned_update_actions; } GtkWidget * diff --git a/widgets/misc/e-attachment-store.c b/widgets/misc/e-attachment-store.c index 217d03fd83..009049025e 100644 --- a/widgets/misc/e-attachment-store.c +++ b/widgets/misc/e-attachment-store.c @@ -48,7 +48,10 @@ enum { PROP_TOTAL_SIZE }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EAttachmentStore, + e_attachment_store, + GTK_TYPE_LIST_STORE) static void attachment_store_set_property (GObject *object, @@ -116,7 +119,7 @@ attachment_store_dispose (GObject *object) g_hash_table_remove_all (priv->attachment_index); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_attachment_store_parent_class)->dispose (object); } static void @@ -131,7 +134,7 @@ attachment_store_finalize (GObject *object) g_free (priv->current_folder); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_attachment_store_parent_class)->finalize (object); } static void @@ -147,11 +150,10 @@ attachment_store_constructed (GObject *object) } static void -attachment_store_class_init (EAttachmentStoreClass *class) +e_attachment_store_class_init (EAttachmentStoreClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EAttachmentStorePrivate)); object_class = G_OBJECT_CLASS (class); @@ -210,7 +212,7 @@ attachment_store_class_init (EAttachmentStoreClass *class) } static void -attachment_store_init (EAttachmentStore *store) +e_attachment_store_init (EAttachmentStore *store) { GType types[E_ATTACHMENT_STORE_NUM_COLUMNS]; GHashTable *attachment_index; @@ -240,33 +242,6 @@ attachment_store_init (EAttachmentStore *store) GTK_LIST_STORE (store), G_N_ELEMENTS (types), types); } -GType -e_attachment_store_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EAttachmentStoreClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) attachment_store_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EAttachmentStore), - 0, /* n_preallocs */ - (GInstanceInitFunc) attachment_store_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_LIST_STORE, "EAttachmentStore", - &type_info, 0); - } - - return type; -} - GtkTreeModel * e_attachment_store_new (void) { diff --git a/widgets/misc/e-attachment-tree-view.c b/widgets/misc/e-attachment-tree-view.c index 8e597adebb..c404920d33 100644 --- a/widgets/misc/e-attachment-tree-view.c +++ b/widgets/misc/e-attachment-tree-view.c @@ -41,7 +41,17 @@ enum { PROP_EDITABLE }; -static gpointer parent_class; +/* Forward Declarations */ +static void e_attachment_tree_view_interface_init + (EAttachmentViewInterface *interface); + +G_DEFINE_TYPE_WITH_CODE ( + EAttachmentTreeView, + e_attachment_tree_view, + GTK_TYPE_TREE_VIEW, + G_IMPLEMENT_INTERFACE ( + E_TYPE_ATTACHMENT_VIEW, + e_attachment_tree_view_interface_init)) static void attachment_tree_view_set_property (GObject *object, @@ -95,7 +105,7 @@ attachment_tree_view_dispose (GObject *object) e_attachment_view_dispose (E_ATTACHMENT_VIEW (object)); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_attachment_tree_view_parent_class)->dispose (object); } static void @@ -104,7 +114,7 @@ attachment_tree_view_finalize (GObject *object) e_attachment_view_finalize (E_ATTACHMENT_VIEW (object)); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_attachment_tree_view_parent_class)->finalize (object); } static void @@ -138,7 +148,7 @@ attachment_tree_view_button_press_event (GtkWidget *widget, return TRUE; /* Chain up to parent's button_press_event() method. */ - return GTK_WIDGET_CLASS (parent_class)-> + return GTK_WIDGET_CLASS (e_attachment_tree_view_parent_class)-> button_press_event (widget, event); } @@ -152,7 +162,7 @@ attachment_tree_view_button_release_event (GtkWidget *widget, return TRUE; /* Chain up to parent's button_release_event() method. */ - return GTK_WIDGET_CLASS (parent_class)-> + return GTK_WIDGET_CLASS (e_attachment_tree_view_parent_class)-> button_release_event (widget, event); } @@ -166,7 +176,7 @@ attachment_tree_view_motion_notify_event (GtkWidget *widget, return TRUE; /* Chain up to parent's motion_notify_event() method. */ - return GTK_WIDGET_CLASS (parent_class)-> + return GTK_WIDGET_CLASS (e_attachment_tree_view_parent_class)-> motion_notify_event (widget, event); } @@ -180,7 +190,7 @@ attachment_tree_view_key_press_event (GtkWidget *widget, return TRUE; /* Chain up to parent's key_press_event() method. */ - return GTK_WIDGET_CLASS (parent_class)-> + return GTK_WIDGET_CLASS (e_attachment_tree_view_parent_class)-> key_press_event (widget, event); } @@ -191,7 +201,8 @@ attachment_tree_view_drag_begin (GtkWidget *widget, EAttachmentView *view = E_ATTACHMENT_VIEW (widget); /* Chain up to parent's drag_begin() method. */ - GTK_WIDGET_CLASS (parent_class)->drag_begin (widget, context); + GTK_WIDGET_CLASS (e_attachment_tree_view_parent_class)-> + drag_begin (widget, context); e_attachment_view_drag_begin (view, context); } @@ -203,7 +214,8 @@ attachment_tree_view_drag_end (GtkWidget *widget, EAttachmentView *view = E_ATTACHMENT_VIEW (widget); /* Chain up to parent's drag_end() method. */ - GTK_WIDGET_CLASS (parent_class)->drag_end (widget, context); + GTK_WIDGET_CLASS (e_attachment_tree_view_parent_class)-> + drag_end (widget, context); e_attachment_view_drag_end (view, context); } @@ -246,8 +258,8 @@ attachment_tree_view_drag_drop (GtkWidget *widget, return FALSE; /* Chain up to parent's drag_drop() method. */ - return GTK_WIDGET_CLASS (parent_class)->drag_drop ( - widget, context, x, y, time); + return GTK_WIDGET_CLASS (e_attachment_tree_view_parent_class)-> + drag_drop (widget, context, x, y, time); } static void @@ -449,13 +461,12 @@ attachment_tree_view_drag_dest_unset (EAttachmentView *view) } static void -attachment_tree_view_class_init (EAttachmentTreeViewClass *class) +e_attachment_tree_view_class_init (EAttachmentTreeViewClass *class) { GObjectClass *object_class; GtkWidgetClass *widget_class; GtkTreeViewClass *tree_view_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EAttachmentViewPrivate)); object_class = G_OBJECT_CLASS (class); @@ -488,27 +499,7 @@ attachment_tree_view_class_init (EAttachmentTreeViewClass *class) } static void -attachment_tree_view_iface_init (EAttachmentViewIface *iface) -{ - iface->get_private = attachment_tree_view_get_private; - iface->get_store = attachment_tree_view_get_store; - - iface->get_path_at_pos = attachment_tree_view_get_path_at_pos; - iface->get_selected_paths = attachment_tree_view_get_selected_paths; - iface->path_is_selected = attachment_tree_view_path_is_selected; - iface->select_path = attachment_tree_view_select_path; - iface->unselect_path = attachment_tree_view_unselect_path; - iface->select_all = attachment_tree_view_select_all; - iface->unselect_all = attachment_tree_view_unselect_all; - - iface->drag_source_set = attachment_tree_view_drag_source_set; - iface->drag_dest_set = attachment_tree_view_drag_dest_set; - iface->drag_source_unset = attachment_tree_view_drag_source_unset; - iface->drag_dest_unset = attachment_tree_view_drag_dest_unset; -} - -static void -attachment_tree_view_init (EAttachmentTreeView *tree_view) +e_attachment_tree_view_init (EAttachmentTreeView *tree_view) { GtkTreeSelection *selection; GtkTreeViewColumn *column; @@ -596,40 +587,24 @@ attachment_tree_view_init (EAttachmentTreeView *tree_view) E_ATTACHMENT_STORE_COLUMN_CONTENT_TYPE); } -GType -e_attachment_tree_view_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EAttachmentTreeViewClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) attachment_tree_view_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EAttachmentTreeView), - 0, /* n_preallocs */ - (GInstanceInitFunc) attachment_tree_view_init, - NULL /* value_table */ - }; - - static const GInterfaceInfo iface_info = { - (GInterfaceInitFunc) attachment_tree_view_iface_init, - (GInterfaceFinalizeFunc) NULL, - NULL /* interface_data */ - }; - - type = g_type_register_static ( - GTK_TYPE_TREE_VIEW, "EAttachmentTreeView", - &type_info, 0); - - g_type_add_interface_static ( - type, E_TYPE_ATTACHMENT_VIEW, &iface_info); - } - - return type; +static void +e_attachment_tree_view_interface_init (EAttachmentViewInterface *interface) +{ + interface->get_private = attachment_tree_view_get_private; + interface->get_store = attachment_tree_view_get_store; + + interface->get_path_at_pos = attachment_tree_view_get_path_at_pos; + interface->get_selected_paths = attachment_tree_view_get_selected_paths; + interface->path_is_selected = attachment_tree_view_path_is_selected; + interface->select_path = attachment_tree_view_select_path; + interface->unselect_path = attachment_tree_view_unselect_path; + interface->select_all = attachment_tree_view_select_all; + interface->unselect_all = attachment_tree_view_unselect_all; + + interface->drag_source_set = attachment_tree_view_drag_source_set; + interface->drag_dest_set = attachment_tree_view_drag_dest_set; + interface->drag_source_unset = attachment_tree_view_drag_source_unset; + interface->drag_dest_unset = attachment_tree_view_drag_dest_unset; } GtkWidget * diff --git a/widgets/misc/e-attachment-view.c b/widgets/misc/e-attachment-view.c index cc587bf80b..06ec2e5d2c 100644 --- a/widgets/misc/e-attachment-view.c +++ b/widgets/misc/e-attachment-view.c @@ -71,6 +71,11 @@ static const gchar *ui = static gulong signals[LAST_SIGNAL]; +G_DEFINE_INTERFACE ( + EAttachmentView, + e_attachment_view, + GTK_TYPE_WIDGET) + static void action_add_cb (GtkAction *action, EAttachmentView *view) @@ -817,12 +822,12 @@ attachment_view_init_handlers (EAttachmentView *view) } static void -attachment_view_class_init (EAttachmentViewIface *iface) +e_attachment_view_default_init (EAttachmentViewInterface *interface) { - iface->update_actions = attachment_view_update_actions; + interface->update_actions = attachment_view_update_actions; g_object_interface_install_property ( - iface, + interface, g_param_spec_boolean ( "dragging", "Dragging", @@ -831,7 +836,7 @@ attachment_view_class_init (EAttachmentViewIface *iface) G_PARAM_READWRITE)); g_object_interface_install_property ( - iface, + interface, g_param_spec_boolean ( "editable", "Editable", @@ -842,44 +847,16 @@ attachment_view_class_init (EAttachmentViewIface *iface) signals[UPDATE_ACTIONS] = g_signal_new ( "update-actions", - G_TYPE_FROM_INTERFACE (iface), + G_TYPE_FROM_INTERFACE (interface), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (EAttachmentViewIface, update_actions), + G_STRUCT_OFFSET (EAttachmentViewInterface, update_actions), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); -} - -GType -e_attachment_view_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EAttachmentViewIface), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) attachment_view_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - 0, /* instance_size */ - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_INTERFACE, "EAttachmentView", &type_info, 0); - - g_type_interface_add_prerequisite (type, GTK_TYPE_WIDGET); - - /* Register known handler types. */ - e_attachment_handler_image_get_type (); - e_attachment_handler_sendto_get_type (); - } - return type; + /* Register known handler types. */ + e_attachment_handler_image_get_type (); + e_attachment_handler_sendto_get_type (); } void @@ -990,27 +967,27 @@ e_attachment_view_finalize (EAttachmentView *view) EAttachmentViewPrivate * e_attachment_view_get_private (EAttachmentView *view) { - EAttachmentViewIface *iface; + EAttachmentViewInterface *interface; g_return_val_if_fail (E_IS_ATTACHMENT_VIEW (view), NULL); - iface = E_ATTACHMENT_VIEW_GET_IFACE (view); - g_return_val_if_fail (iface->get_private != NULL, NULL); + interface = E_ATTACHMENT_VIEW_GET_INTERFACE (view); + g_return_val_if_fail (interface->get_private != NULL, NULL); - return iface->get_private (view); + return interface->get_private (view); } EAttachmentStore * e_attachment_view_get_store (EAttachmentView *view) { - EAttachmentViewIface *iface; + EAttachmentViewInterface *interface; g_return_val_if_fail (E_IS_ATTACHMENT_VIEW (view), NULL); - iface = E_ATTACHMENT_VIEW_GET_IFACE (view); - g_return_val_if_fail (iface->get_store != NULL, NULL); + interface = E_ATTACHMENT_VIEW_GET_INTERFACE (view); + g_return_val_if_fail (interface->get_store != NULL, NULL); - return iface->get_store (view); + return interface->get_store (view); } gboolean @@ -1376,34 +1353,34 @@ e_attachment_view_get_path_at_pos (EAttachmentView *view, gint x, gint y) { - EAttachmentViewIface *iface; + EAttachmentViewInterface *interface; g_return_val_if_fail (E_IS_ATTACHMENT_VIEW (view), NULL); - iface = E_ATTACHMENT_VIEW_GET_IFACE (view); - g_return_val_if_fail (iface->get_path_at_pos != NULL, NULL); + interface = E_ATTACHMENT_VIEW_GET_INTERFACE (view); + g_return_val_if_fail (interface->get_path_at_pos != NULL, NULL); - return iface->get_path_at_pos (view, x, y); + return interface->get_path_at_pos (view, x, y); } GList * e_attachment_view_get_selected_paths (EAttachmentView *view) { - EAttachmentViewIface *iface; + EAttachmentViewInterface *interface; g_return_val_if_fail (E_IS_ATTACHMENT_VIEW (view), NULL); - iface = E_ATTACHMENT_VIEW_GET_IFACE (view); - g_return_val_if_fail (iface->get_selected_paths != NULL, NULL); + interface = E_ATTACHMENT_VIEW_GET_INTERFACE (view); + g_return_val_if_fail (interface->get_selected_paths != NULL, NULL); - return iface->get_selected_paths (view); + return interface->get_selected_paths (view); } gboolean e_attachment_view_path_is_selected (EAttachmentView *view, GtkTreePath *path) { - EAttachmentViewIface *iface; + EAttachmentViewInterface *interface; g_return_val_if_fail (E_IS_ATTACHMENT_VIEW (view), FALSE); @@ -1411,66 +1388,66 @@ e_attachment_view_path_is_selected (EAttachmentView *view, if (path == NULL) return FALSE; - iface = E_ATTACHMENT_VIEW_GET_IFACE (view); - g_return_val_if_fail (iface->path_is_selected != NULL, FALSE); + interface = E_ATTACHMENT_VIEW_GET_INTERFACE (view); + g_return_val_if_fail (interface->path_is_selected != NULL, FALSE); - return iface->path_is_selected (view, path); + return interface->path_is_selected (view, path); } void e_attachment_view_select_path (EAttachmentView *view, GtkTreePath *path) { - EAttachmentViewIface *iface; + EAttachmentViewInterface *interface; g_return_if_fail (E_IS_ATTACHMENT_VIEW (view)); g_return_if_fail (path != NULL); - iface = E_ATTACHMENT_VIEW_GET_IFACE (view); - g_return_if_fail (iface->select_path != NULL); + interface = E_ATTACHMENT_VIEW_GET_INTERFACE (view); + g_return_if_fail (interface->select_path != NULL); - iface->select_path (view, path); + interface->select_path (view, path); } void e_attachment_view_unselect_path (EAttachmentView *view, GtkTreePath *path) { - EAttachmentViewIface *iface; + EAttachmentViewInterface *interface; g_return_if_fail (E_IS_ATTACHMENT_VIEW (view)); g_return_if_fail (path != NULL); - iface = E_ATTACHMENT_VIEW_GET_IFACE (view); - g_return_if_fail (iface->unselect_path != NULL); + interface = E_ATTACHMENT_VIEW_GET_INTERFACE (view); + g_return_if_fail (interface->unselect_path != NULL); - iface->unselect_path (view, path); + interface->unselect_path (view, path); } void e_attachment_view_select_all (EAttachmentView *view) { - EAttachmentViewIface *iface; + EAttachmentViewInterface *interface; g_return_if_fail (E_IS_ATTACHMENT_VIEW (view)); - iface = E_ATTACHMENT_VIEW_GET_IFACE (view); - g_return_if_fail (iface->select_all != NULL); + interface = E_ATTACHMENT_VIEW_GET_INTERFACE (view); + g_return_if_fail (interface->select_all != NULL); - iface->select_all (view); + interface->select_all (view); } void e_attachment_view_unselect_all (EAttachmentView *view) { - EAttachmentViewIface *iface; + EAttachmentViewInterface *interface; g_return_if_fail (E_IS_ATTACHMENT_VIEW (view)); - iface = E_ATTACHMENT_VIEW_GET_IFACE (view); - g_return_if_fail (iface->unselect_all != NULL); + interface = E_ATTACHMENT_VIEW_GET_INTERFACE (view); + g_return_if_fail (interface->unselect_all != NULL); - iface->unselect_all (view); + interface->unselect_all (view); } void @@ -1495,22 +1472,22 @@ e_attachment_view_sync_selection (EAttachmentView *view, void e_attachment_view_drag_source_set (EAttachmentView *view) { - EAttachmentViewIface *iface; + EAttachmentViewInterface *interface; GtkTargetEntry *targets; GtkTargetList *list; gint n_targets; g_return_if_fail (E_IS_ATTACHMENT_VIEW (view)); - iface = E_ATTACHMENT_VIEW_GET_IFACE (view); - if (iface->drag_source_set == NULL) + interface = E_ATTACHMENT_VIEW_GET_INTERFACE (view); + if (interface->drag_source_set == NULL) return; list = gtk_target_list_new (NULL, 0); gtk_target_list_add_uri_targets (list, 0); targets = gtk_target_table_new_from_list (list, &n_targets); - iface->drag_source_set ( + interface->drag_source_set ( view, GDK_BUTTON1_MASK, targets, n_targets, GDK_ACTION_COPY); @@ -1521,15 +1498,15 @@ e_attachment_view_drag_source_set (EAttachmentView *view) void e_attachment_view_drag_source_unset (EAttachmentView *view) { - EAttachmentViewIface *iface; + EAttachmentViewInterface *interface; g_return_if_fail (E_IS_ATTACHMENT_VIEW (view)); - iface = E_ATTACHMENT_VIEW_GET_IFACE (view); - if (iface->drag_source_unset == NULL) + interface = E_ATTACHMENT_VIEW_GET_INTERFACE (view); + if (interface->drag_source_unset == NULL) return; - iface->drag_source_unset (view); + interface->drag_source_unset (view); } void @@ -1676,14 +1653,14 @@ void e_attachment_view_drag_dest_set (EAttachmentView *view) { EAttachmentViewPrivate *priv; - EAttachmentViewIface *iface; + EAttachmentViewInterface *interface; GtkTargetEntry *targets; gint n_targets; g_return_if_fail (E_IS_ATTACHMENT_VIEW (view)); - iface = E_ATTACHMENT_VIEW_GET_IFACE (view); - if (iface->drag_dest_set == NULL) + interface = E_ATTACHMENT_VIEW_GET_INTERFACE (view); + if (interface->drag_dest_set == NULL) return; priv = e_attachment_view_get_private (view); @@ -1691,7 +1668,8 @@ e_attachment_view_drag_dest_set (EAttachmentView *view) targets = gtk_target_table_new_from_list ( priv->target_list, &n_targets); - iface->drag_dest_set (view, targets, n_targets, priv->drag_actions); + interface->drag_dest_set ( + view, targets, n_targets, priv->drag_actions); gtk_target_table_free (targets, n_targets); } @@ -1699,15 +1677,15 @@ e_attachment_view_drag_dest_set (EAttachmentView *view) void e_attachment_view_drag_dest_unset (EAttachmentView *view) { - EAttachmentViewIface *iface; + EAttachmentViewInterface *interface; g_return_if_fail (E_IS_ATTACHMENT_VIEW (view)); - iface = E_ATTACHMENT_VIEW_GET_IFACE (view); - if (iface->drag_dest_unset == NULL) + interface = E_ATTACHMENT_VIEW_GET_INTERFACE (view); + if (interface->drag_dest_unset == NULL) return; - iface->drag_dest_unset (view); + interface->drag_dest_unset (view); } gboolean diff --git a/widgets/misc/e-attachment-view.h b/widgets/misc/e-attachment-view.h index 79dbacb151..b95c84bb5b 100644 --- a/widgets/misc/e-attachment-view.h +++ b/widgets/misc/e-attachment-view.h @@ -31,27 +31,27 @@ #define E_ATTACHMENT_VIEW(obj) \ (G_TYPE_CHECK_INSTANCE_CAST \ ((obj), E_TYPE_ATTACHMENT_VIEW, EAttachmentView)) -#define E_ATTACHMENT_VIEW_IFACE(cls) \ +#define E_ATTACHMENT_VIEW_INTERFACE(cls) \ (G_TYPE_CHECK_CLASS_CAST \ - ((cls), E_TYPE_ATTACHMENT_VIEW, EAttachmentViewIface)) + ((cls), E_TYPE_ATTACHMENT_VIEW, EAttachmentViewInterface)) #define E_IS_ATTACHMENT_VIEW(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE \ ((obj), E_TYPE_ATTACHMENT_VIEW)) -#define E_IS_ATTACHMENT_VIEW_IFACE(cls) \ +#define E_IS_ATTACHMENT_VIEW_INTERFACE(cls) \ (G_TYPE_CHECK_CLASS_TYPE \ ((cls), E_TYPE_ATTACHMENT_VIEW)) -#define E_ATTACHMENT_VIEW_GET_IFACE(obj) \ +#define E_ATTACHMENT_VIEW_GET_INTERFACE(obj) \ (G_TYPE_INSTANCE_GET_INTERFACE \ - ((obj), E_TYPE_ATTACHMENT_VIEW, EAttachmentViewIface)) + ((obj), E_TYPE_ATTACHMENT_VIEW, EAttachmentViewInterface)) G_BEGIN_DECLS typedef struct _EAttachmentView EAttachmentView; -typedef struct _EAttachmentViewIface EAttachmentViewIface; +typedef struct _EAttachmentViewInterface EAttachmentViewInterface; typedef struct _EAttachmentViewPrivate EAttachmentViewPrivate; -struct _EAttachmentViewIface { - GTypeInterface parent_iface; +struct _EAttachmentViewInterface { + GTypeInterface parent_interface; /* General Methods */ EAttachmentViewPrivate * diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c index 56659ae01c..e8ba75abee 100644 --- a/widgets/misc/e-attachment.c +++ b/widgets/misc/e-attachment.c @@ -96,7 +96,10 @@ enum { PROP_SIGNED }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EAttachment, + e_attachment, + G_TYPE_OBJECT) static gboolean create_system_thumbnail (EAttachment *attachment, GIcon **icon) @@ -701,7 +704,7 @@ attachment_dispose (GObject *object) priv->reference = NULL; /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_attachment_parent_class)->dispose (object); } static void @@ -714,15 +717,14 @@ attachment_finalize (GObject *object) g_free (priv->disposition); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_attachment_parent_class)->finalize (object); } static void -attachment_class_init (EAttachmentClass *class) +e_attachment_class_init (EAttachmentClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EAttachmentPrivate)); object_class = G_OBJECT_CLASS (class); @@ -877,7 +879,7 @@ attachment_class_init (EAttachmentClass *class) } static void -attachment_init (EAttachment *attachment) +e_attachment_init (EAttachment *attachment) { attachment->priv = E_ATTACHMENT_GET_PRIVATE (attachment); attachment->priv->cancellable = g_cancellable_new (); @@ -937,32 +939,6 @@ attachment_init (EAttachment *attachment) G_CALLBACK (attachment_cancelled_cb), attachment); } -GType -e_attachment_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EAttachmentClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) attachment_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EAttachment), - 0, /* n_preallocs */ - (GInstanceInitFunc) attachment_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "EAttachment", &type_info, 0); - } - - return type; -} - EAttachment * e_attachment_new (void) { diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c index 98ed03a735..7a850ee137 100644 --- a/widgets/misc/e-calendar-item.c +++ b/widgets/misc/e-calendar-item.c @@ -231,8 +231,11 @@ enum { static guint e_calendar_item_signals[LAST_SIGNAL] = { 0 }; G_DEFINE_TYPE_WITH_CODE ( - ECalendarItem, e_calendar_item, GNOME_TYPE_CANVAS_ITEM, - G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)) + ECalendarItem, + e_calendar_item, + GNOME_TYPE_CANVAS_ITEM, + G_IMPLEMENT_INTERFACE ( + E_TYPE_EXTENSIBLE, NULL)) static void e_calendar_item_class_init (ECalendarItemClass *class) diff --git a/widgets/misc/e-calendar.c b/widgets/misc/e-calendar.c index bf556ae657..ab7f2d3442 100644 --- a/widgets/misc/e-calendar.c +++ b/widgets/misc/e-calendar.c @@ -97,7 +97,10 @@ static void e_calendar_start_auto_move (ECalendar *cal, static gboolean e_calendar_auto_move_handler (gpointer data); static void e_calendar_stop_auto_move (ECalendar *cal); -G_DEFINE_TYPE (ECalendar, e_calendar, E_TYPE_CANVAS) +G_DEFINE_TYPE ( + ECalendar, + e_calendar, + E_TYPE_CANVAS) static void e_calendar_class_init (ECalendarClass *class) diff --git a/widgets/misc/e-canvas-background.c b/widgets/misc/e-canvas-background.c index a44a05407a..944f3b63df 100644 --- a/widgets/misc/e-canvas-background.c +++ b/widgets/misc/e-canvas-background.c @@ -41,7 +41,10 @@ /* workaround for avoiding API broken */ #define ecb_get_type e_canvas_background_get_type -G_DEFINE_TYPE (ECanvasBackground, ecb, GNOME_TYPE_CANVAS_ITEM) +G_DEFINE_TYPE ( + ECanvasBackground, + ecb, + GNOME_TYPE_CANVAS_ITEM) #define d(x) diff --git a/widgets/misc/e-canvas-vbox.c b/widgets/misc/e-canvas-vbox.c index 55f8a7d526..3f1c7b3c07 100644 --- a/widgets/misc/e-canvas-vbox.c +++ b/widgets/misc/e-canvas-vbox.c @@ -56,7 +56,10 @@ enum { PROP_SPACING }; -G_DEFINE_TYPE (ECanvasVbox, e_canvas_vbox, GNOME_TYPE_CANVAS_GROUP) +G_DEFINE_TYPE ( + ECanvasVbox, + e_canvas_vbox, + GNOME_TYPE_CANVAS_GROUP) static void e_canvas_vbox_class_init (ECanvasVboxClass *klass) diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c index 8d4336e4dd..23e8176d24 100644 --- a/widgets/misc/e-canvas.c +++ b/widgets/misc/e-canvas.c @@ -37,7 +37,10 @@ enum { static guint signals[LAST_SIGNAL]; -G_DEFINE_TYPE (ECanvas, e_canvas, GNOME_TYPE_CANVAS) +G_DEFINE_TYPE ( + ECanvas, + e_canvas, + GNOME_TYPE_CANVAS) /* Emits an event for an item in the canvas, be it the current * item, grabbed item, or focused item, as appropriate. */ diff --git a/widgets/misc/e-cell-renderer-combo.c b/widgets/misc/e-cell-renderer-combo.c index 96079032fe..a2b65b27be 100644 --- a/widgets/misc/e-cell-renderer-combo.c +++ b/widgets/misc/e-cell-renderer-combo.c @@ -38,7 +38,10 @@ struct _ECellRendererComboPriv { GList *list; }; -G_DEFINE_TYPE (ECellRendererCombo, e_cell_renderer_combo, GTK_TYPE_CELL_RENDERER_TEXT) +G_DEFINE_TYPE ( + ECellRendererCombo, + e_cell_renderer_combo, + GTK_TYPE_CELL_RENDERER_TEXT) static void ecrc_editing_done (GtkCellEditable *editable, ECellRendererCombo *cell) diff --git a/widgets/misc/e-charset-combo-box.c b/widgets/misc/e-charset-combo-box.c index 142c8a98a3..0c6592140b 100644 --- a/widgets/misc/e-charset-combo-box.c +++ b/widgets/misc/e-charset-combo-box.c @@ -52,7 +52,10 @@ enum { PROP_CHARSET }; -static gpointer parent_class; +G_DEFINE_TYPE ( + ECharsetComboBox, + e_charset_combo_box, + E_TYPE_ACTION_COMBO_BOX) static void charset_combo_box_entry_changed_cb (GtkEntry *entry, @@ -234,7 +237,7 @@ charset_combo_box_dispose (GObject *object) g_hash_table_remove_all (priv->charset_index); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_charset_combo_box_parent_class)->dispose (object); } static void @@ -247,7 +250,7 @@ charset_combo_box_finalize (GObject *object) g_hash_table_destroy (priv->charset_index); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_charset_combo_box_parent_class)->finalize (object); } static void @@ -258,7 +261,8 @@ charset_combo_box_changed (GtkComboBox *combo_box) priv = E_CHARSET_COMBO_BOX_GET_PRIVATE (combo_box); /* Chain up to parent's changed() method. */ - GTK_COMBO_BOX_CLASS (parent_class)->changed (combo_box); + GTK_COMBO_BOX_CLASS (e_charset_combo_box_parent_class)-> + changed (combo_box); /* Notify -before- updating previous index. */ g_object_notify (G_OBJECT (combo_box), "charset"); @@ -266,12 +270,11 @@ charset_combo_box_changed (GtkComboBox *combo_box) } static void -charset_combo_box_class_init (ECharsetComboBoxClass *class) +e_charset_combo_box_class_init (ECharsetComboBoxClass *class) { GObjectClass *object_class; GtkComboBoxClass *combo_box_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ECharsetComboBoxPrivate)); object_class = G_OBJECT_CLASS (class); @@ -296,7 +299,7 @@ charset_combo_box_class_init (ECharsetComboBoxClass *class) } static void -charset_combo_box_init (ECharsetComboBox *combo_box) +e_charset_combo_box_init (ECharsetComboBox *combo_box) { GtkActionGroup *action_group; GtkRadioAction *radio_action; @@ -353,33 +356,6 @@ charset_combo_box_init (ECharsetComboBox *combo_box) combo_box->priv->other_action = radio_action; } -GType -e_charset_combo_box_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ECharsetComboBoxClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) charset_combo_box_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ECharsetComboBox), - 0, /* n_preallocs */ - (GInstanceInitFunc) charset_combo_box_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_ACTION_COMBO_BOX, "ECharsetComboBox", - &type_info, 0); - } - - return type; -} - GtkWidget * e_charset_combo_box_new (void) { diff --git a/widgets/misc/e-combo-cell-editable.c b/widgets/misc/e-combo-cell-editable.c index 98cd0b17c5..675e499388 100644 --- a/widgets/misc/e-combo-cell-editable.c +++ b/widgets/misc/e-combo-cell-editable.c @@ -35,7 +35,17 @@ struct _EComboCellEditablePriv { #define GRAB_MASK (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK) -static GtkEventBoxClass *parent_class; +/* Forward Declarations */ +static void e_combo_cell_editable_interface_init + (GtkCellEditableIface *interface); + +G_DEFINE_TYPE_WITH_CODE ( + EComboCellEditable, + e_combo_cell_editable, + GTK_TYPE_EVENT_BOX, + G_IMPLEMENT_INTERFACE ( + GTK_TYPE_CELL_EDITABLE, + e_combo_cell_editable_interface_init)) static void kill_popup (EComboCellEditable *ecce) @@ -292,24 +302,23 @@ ecce_start_editing (GtkCellEditable *cell_editable, GdkEvent *event) } static void -ecce_cell_editable_init (GtkCellEditableIface *iface) +e_combo_cell_editable_interface_init (GtkCellEditableIface *interface) { - iface->start_editing = ecce_start_editing; + interface->start_editing = ecce_start_editing; } static void -ecce_finalize (GObject *obj) +ecce_finalize (GObject *object) { - EComboCellEditable *ecce = (EComboCellEditable *) obj; + EComboCellEditable *ecce = (EComboCellEditable *) object; g_free (ecce->priv); - if (G_OBJECT_CLASS (parent_class)->finalize) - G_OBJECT_CLASS (parent_class)->finalize (obj); + G_OBJECT_CLASS (e_combo_cell_editable_parent_class)->finalize (object); } static void -ecce_init (EComboCellEditable *ecce) +e_combo_cell_editable_init (EComboCellEditable *ecce) { GtkWidget *entry, *btn, *box; @@ -344,53 +353,22 @@ ecce_grab_focus (GtkWidget *widget) } static void -ecce_class_init (GObjectClass *klass) +e_combo_cell_editable_class_init (EComboCellEditableClass *class) { - GtkWidgetClass *widget_class = (GtkWidgetClass *)klass; + GObjectClass *object_class; + GtkWidgetClass *widget_class; - klass->finalize = ecce_finalize; + object_class = G_OBJECT_CLASS (class); + object_class->finalize = ecce_finalize; + widget_class = GTK_WIDGET_CLASS (class); widget_class->grab_focus = ecce_grab_focus; - - parent_class = GTK_EVENT_BOX_CLASS (g_type_class_peek_parent (klass)); -} - -GType -e_combo_cell_editable_get_type (void) -{ - static GType ecce_type = 0; - - if (!ecce_type) { - static const GTypeInfo ecce_info = { - sizeof (EComboCellEditableClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) ecce_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EComboCellEditable), - 0, /* n_preallocs */ - (GInstanceInitFunc) ecce_init, - }; - - static const GInterfaceInfo cell_editable_info = { - (GInterfaceInitFunc) ecce_cell_editable_init, - NULL, - NULL - }; - - ecce_type = g_type_register_static (GTK_TYPE_EVENT_BOX, "EComboCellEditable", &ecce_info, 0); - - g_type_add_interface_static (ecce_type, GTK_TYPE_CELL_EDITABLE, &cell_editable_info); - } - - return ecce_type; } GtkCellEditable * e_combo_cell_editable_new (void) { - return GTK_CELL_EDITABLE (g_object_new (E_TYPE_COMBO_CELL_EDITABLE, NULL)); + return g_object_new (E_TYPE_COMBO_CELL_EDITABLE, NULL); } const GList * diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c index 77ffe91d68..8f14e84e20 100644 --- a/widgets/misc/e-dateedit.c +++ b/widgets/misc/e-dateedit.c @@ -209,8 +209,11 @@ static gboolean e_date_edit_set_time_internal (EDateEdit *dedit, static gint signals[LAST_SIGNAL]; G_DEFINE_TYPE_WITH_CODE ( - EDateEdit, e_date_edit, GTK_TYPE_HBOX, - G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)) + EDateEdit, + e_date_edit, + GTK_TYPE_HBOX, + G_IMPLEMENT_INTERFACE ( + E_TYPE_EXTENSIBLE, NULL)) static void date_edit_set_property (GObject *object, diff --git a/widgets/misc/e-focus-tracker.c b/widgets/misc/e-focus-tracker.c index 882b54726c..4abffac395 100644 --- a/widgets/misc/e-focus-tracker.c +++ b/widgets/misc/e-focus-tracker.c @@ -52,7 +52,10 @@ enum { PROP_SELECT_ALL_ACTION }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EFocusTracker, + e_focus_tracker, + G_TYPE_OBJECT) static void focus_tracker_disable_actions (EFocusTracker *focus_tracker) @@ -413,7 +416,7 @@ focus_tracker_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_focus_tracker_parent_class)->dispose (object); } static void @@ -444,11 +447,10 @@ focus_tracker_constructed (GObject *object) } static void -focus_tracker_class_init (EFocusTrackerClass *class) +e_focus_tracker_class_init (EFocusTrackerClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EFocusTrackerPrivate)); object_class = G_OBJECT_CLASS (class); @@ -530,7 +532,7 @@ focus_tracker_class_init (EFocusTrackerClass *class) } static void -focus_tracker_init (EFocusTracker *focus_tracker) +e_focus_tracker_init (EFocusTracker *focus_tracker) { GtkAction *action; @@ -566,32 +568,6 @@ focus_tracker_init (EFocusTracker *focus_tracker) focus_tracker->priv->select_all = action; } -GType -e_focus_tracker_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EFocusTrackerClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) focus_tracker_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EFocusTracker), - 0, /* n_preallocs */ - (GInstanceInitFunc) focus_tracker_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "EFocusTracker", &type_info, 0); - } - - return type; -} - EFocusTracker * e_focus_tracker_new (GtkWindow *window) { diff --git a/widgets/misc/e-hinted-entry.c b/widgets/misc/e-hinted-entry.c index 355d9bf0e3..7d74fb3d67 100644 --- a/widgets/misc/e-hinted-entry.c +++ b/widgets/misc/e-hinted-entry.c @@ -36,7 +36,10 @@ enum { PROP_HINT_SHOWN }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EHintedEntry, + e_hinted_entry, + GTK_TYPE_ENTRY) static void hinted_entry_show_hint (EHintedEntry *entry) @@ -120,7 +123,7 @@ hinted_entry_finalize (GObject *object) g_free (priv->hint); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_hinted_entry_parent_class)->finalize (object); } static void @@ -130,7 +133,7 @@ hinted_entry_grab_focus (GtkWidget *widget) /* We don't want hints to be selected so we chain to * the GtkEntry parent if we have a hint set */ - chain_class = parent_class; + chain_class = e_hinted_entry_parent_class; if (e_hinted_entry_get_hint_shown (E_HINTED_ENTRY (widget))) chain_class = g_type_class_peek_parent (chain_class); @@ -148,7 +151,7 @@ hinted_entry_focus_in_event (GtkWidget *widget, hinted_entry_show_text (entry, ""); /* Chain up to parent's focus_in_event() method. */ - return GTK_WIDGET_CLASS (parent_class)-> + return GTK_WIDGET_CLASS (e_hinted_entry_parent_class)-> focus_in_event (widget, event); } @@ -165,17 +168,16 @@ hinted_entry_focus_out_event (GtkWidget *widget, hinted_entry_show_hint (E_HINTED_ENTRY (widget)); /* Chain up to parent's focus_out_event() method. */ - return GTK_WIDGET_CLASS (parent_class)-> + return GTK_WIDGET_CLASS (e_hinted_entry_parent_class)-> focus_out_event (widget, event); } static void -hinted_entry_class_init (EHintedEntryClass *class) +e_hinted_entry_class_init (EHintedEntryClass *class) { GObjectClass *object_class; GtkWidgetClass *widget_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EHintedEntryPrivate)); object_class = G_OBJECT_CLASS (class); @@ -210,39 +212,13 @@ hinted_entry_class_init (EHintedEntryClass *class) } static void -hinted_entry_init (EHintedEntry *entry) +e_hinted_entry_init (EHintedEntry *entry) { entry->priv = E_HINTED_ENTRY_GET_PRIVATE (entry); entry->priv->hint = g_strdup (""); /* hint must never be NULL */ hinted_entry_show_hint (entry); } -GType -e_hinted_entry_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EHintedEntryClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) hinted_entry_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EHintedEntry), - 0, /* n_preallocs */ - (GInstanceInitFunc) hinted_entry_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_ENTRY, "EHintedEntry", &type_info, 0); - } - - return type; -} - GtkWidget * e_hinted_entry_new (void) { diff --git a/widgets/misc/e-image-chooser.c b/widgets/misc/e-image-chooser.c index ed0a9e2327..0ddf08ccde 100644 --- a/widgets/misc/e-image-chooser.c +++ b/widgets/misc/e-image-chooser.c @@ -58,11 +58,15 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static guint signals[LAST_SIGNAL]; #define URI_LIST_TYPE "text/uri-list" +G_DEFINE_TYPE ( + EImageChooser, + e_image_chooser, + GTK_TYPE_VBOX) + static gboolean set_image_from_data (EImageChooser *chooser, gchar *data, @@ -384,7 +388,7 @@ image_chooser_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_image_chooser_parent_class)->dispose (object); } static void @@ -398,7 +402,7 @@ image_chooser_finalize (GObject *object) g_free (priv->icon_name); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_image_chooser_parent_class)->finalize (object); } static void @@ -406,7 +410,6 @@ e_image_chooser_class_init (EImageChooserClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EImageChooserPrivate)); object_class = G_OBJECT_CLASS (class); @@ -482,32 +485,6 @@ e_image_chooser_init (EImageChooser *chooser) G_CALLBACK (image_drag_data_received_cb), chooser); } -GType -e_image_chooser_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EImageChooserClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) e_image_chooser_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EImageChooser), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_image_chooser_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_VBOX, "EImageChooser", &type_info, 0); - } - - return type; -} - const gchar * e_image_chooser_get_icon_name (EImageChooser *chooser) { diff --git a/widgets/misc/e-import-assistant.c b/widgets/misc/e-import-assistant.c index 93e3579bb8..896e1fffa7 100644 --- a/widgets/misc/e-import-assistant.c +++ b/widgets/misc/e-import-assistant.c @@ -124,8 +124,11 @@ enum { static guint signals[LAST_SIGNAL]; G_DEFINE_TYPE_WITH_CODE ( - EImportAssistant, e_import_assistant, GTK_TYPE_ASSISTANT, - G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)) + EImportAssistant, + e_import_assistant, + GTK_TYPE_ASSISTANT, + G_IMPLEMENT_INTERFACE ( + E_TYPE_EXTENSIBLE, NULL)) /* Importing functions */ diff --git a/widgets/misc/e-map.c b/widgets/misc/e-map.c index 22ea72fa6a..682e84d50e 100644 --- a/widgets/misc/e-map.c +++ b/widgets/misc/e-map.c @@ -79,13 +79,9 @@ struct _EMapPrivate { /* Internal prototypes */ -static void e_map_class_init (EMapClass *class); -static void e_map_init (EMap *view); static void e_map_finalize (GObject *object); static void e_map_destroy (GtkObject *object); -static void e_map_unmap (GtkWidget *widget); static void e_map_realize (GtkWidget *widget); -static void e_map_unrealize (GtkWidget *widget); static void e_map_size_request (GtkWidget *widget, GtkRequisition *requisition); static void e_map_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static gint e_map_button_press (GtkWidget *widget, GdkEventButton *event); @@ -108,48 +104,15 @@ static void update_and_paint (EMap *map); static void update_render_point (EMap *map, EMapPoint *point); static void repaint_point (EMap *map, EMapPoint *point); -static GtkWidgetClass *parent_class; +G_DEFINE_TYPE ( + EMap, + e_map, + GTK_TYPE_WIDGET) /* ----------------- * * Widget management * * ----------------- */ -/** - * e_map_get_type: - * @void: - * - * Registers the #EMap class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #EMap class. - **/ - -GType -e_map_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EMapClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) e_map_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMap), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_map_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_WIDGET, "EMap", &type_info, 0); - } - - return type; -} - /* Class initialization function for the map view */ static void @@ -163,8 +126,6 @@ e_map_class_init (EMapClass *class) object_class = (GtkObjectClass *) class; widget_class = (GtkWidgetClass *) class; - parent_class = g_type_class_ref(GTK_TYPE_WIDGET); - gobject_class->finalize = e_map_finalize; object_class->destroy = e_map_destroy; @@ -180,9 +141,7 @@ e_map_class_init (EMapClass *class) GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); - widget_class->unmap = e_map_unmap; widget_class->realize = e_map_realize; - widget_class->unrealize = e_map_unrealize; widget_class->size_request = e_map_size_request; widget_class->size_allocate = e_map_size_allocate; widget_class->button_press_event = e_map_button_press; @@ -234,8 +193,7 @@ e_map_destroy (GtkObject *object) g_signal_handlers_disconnect_by_func (priv->hadj, adjustment_changed_cb, view); g_signal_handlers_disconnect_by_func (priv->vadj, adjustment_changed_cb, view); - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (*GTK_OBJECT_CLASS (parent_class)->destroy) (object); + GTK_OBJECT_CLASS (e_map_parent_class)->destroy (object); } /* Finalize handler for the map view */ @@ -273,20 +231,7 @@ e_map_finalize (GObject *object) g_free (priv); view->priv = NULL; - if (G_OBJECT_CLASS (parent_class)->finalize) - (*G_OBJECT_CLASS (parent_class)->finalize) (object); -} - -/* Unmap handler for the map view */ - -static void -e_map_unmap (GtkWidget *widget) -{ - g_return_if_fail (widget != NULL); - g_return_if_fail (E_IS_MAP (widget)); - - if (GTK_WIDGET_CLASS (parent_class)->unmap) - (*GTK_WIDGET_CLASS (parent_class)->unmap) (widget); + G_OBJECT_CLASS (e_map_parent_class)->finalize (object); } /* Realize handler for the map view */ @@ -334,18 +279,6 @@ e_map_realize (GtkWidget *widget) update_render_pixbuf (E_MAP (widget), GDK_INTERP_BILINEAR, TRUE); } -/* Unrealize handler for the map view */ - -static void -e_map_unrealize (GtkWidget *widget) -{ - g_return_if_fail (widget != NULL); - g_return_if_fail (E_IS_MAP (widget)); - - if (GTK_WIDGET_CLASS (parent_class)->unrealize) - (*GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); -} - /* Size_request handler for the map view */ static void diff --git a/widgets/misc/e-menu-tool-action.c b/widgets/misc/e-menu-tool-action.c index 2cfe2783db..6a6505bf0e 100644 --- a/widgets/misc/e-menu-tool-action.c +++ b/widgets/misc/e-menu-tool-action.c @@ -21,43 +21,23 @@ #include "e-menu-tool-action.h" -static gpointer parent_class; +G_DEFINE_TYPE ( + EMenuToolAction, + e_menu_tool_action, + GTK_TYPE_ACTION) static void -menu_tool_action_class_init (EMenuToolActionClass *class) +e_menu_tool_action_class_init (EMenuToolActionClass *class) { GtkActionClass *action_class; - parent_class = g_type_class_peek_parent (class); - action_class = GTK_ACTION_CLASS (class); action_class->toolbar_item_type = GTK_TYPE_MENU_TOOL_BUTTON; } -GType -e_menu_tool_action_get_type (void) +static void +e_menu_tool_action_init (EMenuToolAction *action) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EMenuToolActionClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) menu_tool_action_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMenuToolAction), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_ACTION, "EMenuToolAction", &type_info, 0); - } - - return type; } EMenuToolAction * diff --git a/widgets/misc/e-menu-tool-button.c b/widgets/misc/e-menu-tool-button.c index 5a87e7420a..7ca38bc1e9 100644 --- a/widgets/misc/e-menu-tool-button.c +++ b/widgets/misc/e-menu-tool-button.c @@ -21,7 +21,10 @@ #include "e-menu-tool-button.h" -static gpointer parent_class; +G_DEFINE_TYPE ( + EMenuToolButton, + e_menu_tool_button, + GTK_TYPE_MENU_TOOL_BUTTON) static GtkWidget * menu_tool_button_clone_image (GtkWidget *source) @@ -98,7 +101,8 @@ menu_tool_button_size_request (GtkWidget *widget, gint minimum_width; /* Chain up to parent's size_request() method. */ - GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition); + GTK_WIDGET_CLASS (e_menu_tool_button_parent_class)-> + size_request (widget, requisition); /* XXX This is a hack. This widget is only used for the New * button in the main window toolbar. The New button is @@ -126,13 +130,11 @@ menu_tool_button_clicked (GtkToolButton *tool_button) } static void -menu_tool_button_class_init (EMenuToolButtonClass *class) +e_menu_tool_button_class_init (EMenuToolButtonClass *class) { GtkWidgetClass *widget_class; GtkToolButtonClass *tool_button_class; - parent_class = g_type_class_peek_parent (class); - widget_class = GTK_WIDGET_CLASS (class); widget_class->size_request = menu_tool_button_size_request; @@ -141,40 +143,13 @@ menu_tool_button_class_init (EMenuToolButtonClass *class) } static void -menu_tool_button_init (EMenuToolButton *button) +e_menu_tool_button_init (EMenuToolButton *button) { g_signal_connect ( button, "notify::menu", G_CALLBACK (menu_tool_button_update_button), NULL); } -GType -e_menu_tool_button_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (EMenuToolButtonClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) menu_tool_button_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMenuToolButton), - 0, /* n_preallocs */ - (GInstanceInitFunc) menu_tool_button_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_MENU_TOOL_BUTTON, "EMenuToolButton", - &type_info, 0); - } - - return type; -} - GtkToolItem * e_menu_tool_button_new (const gchar *label) { diff --git a/widgets/misc/e-online-button.c b/widgets/misc/e-online-button.c index 1157ecdb86..10a838888a 100644 --- a/widgets/misc/e-online-button.c +++ b/widgets/misc/e-online-button.c @@ -42,7 +42,10 @@ enum { PROP_ONLINE }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EOnlineButton, + e_online_button, + GTK_TYPE_BUTTON) static void online_button_update_tooltip (EOnlineButton *button) @@ -106,15 +109,14 @@ online_button_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_online_button_parent_class)->dispose (object); } static void -online_button_class_init (EOnlineButtonClass *class) +e_online_button_class_init (EOnlineButtonClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EOnlineButtonPrivate)); object_class = G_OBJECT_CLASS (class); @@ -135,7 +137,7 @@ online_button_class_init (EOnlineButtonClass *class) } static void -online_button_init (EOnlineButton *button) +e_online_button_init (EOnlineButton *button) { GtkWidget *widget; @@ -158,32 +160,6 @@ online_button_init (EOnlineButton *button) G_CALLBACK (online_button_update_tooltip), NULL); } -GType -e_online_button_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (EOnlineButtonClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) online_button_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EOnlineButton), - 0, /* n_preallocs */ - (GInstanceInitFunc) online_button_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_BUTTON, "EOnlineButton", &type_info, 0); - } - - return type; -} - GtkWidget * e_online_button_new (void) { diff --git a/widgets/misc/e-paned.c b/widgets/misc/e-paned.c index 3f8b57011a..6af4b466c8 100644 --- a/widgets/misc/e-paned.c +++ b/widgets/misc/e-paned.c @@ -52,7 +52,10 @@ enum { PROP_FIXED_RESIZE }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EPaned, + e_paned, + GTK_TYPE_PANED) static gboolean paned_window_state_event_cb (EPaned *paned, @@ -217,7 +220,7 @@ paned_realize (GtkWidget *widget) priv = E_PANED_GET_PRIVATE (widget); /* Chain up to parent's realize() method. */ - GTK_WIDGET_CLASS (parent_class)->realize (widget); + GTK_WIDGET_CLASS (e_paned_parent_class)->realize (widget); /* XXX This would be easier if we could be notified of * window state events directly, but I can't seem @@ -250,7 +253,8 @@ paned_size_allocate (GtkWidget *widget, gint position; /* Chain up to parent's size_allocate() method. */ - GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation); + GTK_WIDGET_CLASS (e_paned_parent_class)-> + size_allocate (widget, allocation); if (!paned->priv->toplevel_ready) return; @@ -282,12 +286,11 @@ paned_size_allocate (GtkWidget *widget, } static void -paned_class_init (EPanedClass *class) +e_paned_class_init (EPanedClass *class) { GObjectClass *object_class; GtkWidgetClass *widget_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EPanedPrivate)); object_class = G_OBJECT_CLASS (class); @@ -346,7 +349,7 @@ paned_class_init (EPanedClass *class) } static void -paned_init (EPaned *paned) +e_paned_init (EPaned *paned) { paned->priv = E_PANED_GET_PRIVATE (paned); @@ -362,32 +365,6 @@ paned_init (EPaned *paned) G_CALLBACK (paned_notify_position_cb), NULL); } -GType -e_paned_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EPanedClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) paned_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EPaned), - 0, /* n_preallocs */ - (GInstanceInitFunc) paned_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_PANED, "EPaned", &type_info, 0); - } - - return type; -} - GtkWidget * e_paned_new (GtkOrientation orientation) { diff --git a/widgets/misc/e-popup-action.c b/widgets/misc/e-popup-action.c index 5f060a45cd..73f9c0778a 100644 --- a/widgets/misc/e-popup-action.c +++ b/widgets/misc/e-popup-action.c @@ -41,7 +41,16 @@ struct _EPopupActionPrivate { gulong notify_handler_id; }; -static gpointer parent_class; +/* Forward Declarations */ +static void e_popup_action_activatable_init (GtkActivatableIface *interface); + +G_DEFINE_TYPE_WITH_CODE ( + EPopupAction, + e_popup_action, + GTK_TYPE_ACTION, + G_IMPLEMENT_INTERFACE ( + GTK_TYPE_ACTIVATABLE, + e_popup_action_activatable_init)) static void popup_action_notify_cb (GtkAction *action, @@ -203,7 +212,7 @@ popup_action_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_popup_action_parent_class)->dispose (object); } static void @@ -301,11 +310,10 @@ popup_action_sync_action_properties (GtkActivatable *activatable, } static void -popup_action_class_init (EPopupActionClass *class) +e_popup_action_class_init (EPopupActionClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EPopupActionPrivate)); object_class = G_OBJECT_CLASS (class); @@ -325,14 +333,7 @@ popup_action_class_init (EPopupActionClass *class) } static void -popup_action_iface_init (GtkActivatableIface *iface) -{ - iface->update = popup_action_update; - iface->sync_action_properties = popup_action_sync_action_properties; -} - -static void -popup_action_init (EPopupAction *popup_action) +e_popup_action_init (EPopupAction *popup_action) { popup_action->priv = E_POPUP_ACTION_GET_PRIVATE (popup_action); popup_action->priv->use_action_appearance = TRUE; @@ -341,39 +342,11 @@ popup_action_init (EPopupAction *popup_action) gtk_action_set_visible (GTK_ACTION (popup_action), FALSE); } -GType -e_popup_action_get_type (void) +static void +e_popup_action_activatable_init (GtkActivatableIface *interface) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EPopupActionClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) popup_action_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EPopupAction), - 0, /* n_preallocs */ - (GInstanceInitFunc) popup_action_init, - NULL /* value_table */ - }; - - static const GInterfaceInfo iface_info = { - (GInterfaceInitFunc) popup_action_iface_init, - (GInterfaceFinalizeFunc) NULL, - NULL /* interface_data */ - }; - - type = g_type_register_static ( - GTK_TYPE_ACTION, "EPopupAction", &type_info, 0); - - g_type_add_interface_static ( - type, GTK_TYPE_ACTIVATABLE, &iface_info); - } - - return type; + interface->update = popup_action_update; + interface->sync_action_properties = popup_action_sync_action_properties; } EPopupAction * diff --git a/widgets/misc/e-preferences-window.c b/widgets/misc/e-preferences-window.c index 19053217dd..5e9a28ede8 100644 --- a/widgets/misc/e-preferences-window.c +++ b/widgets/misc/e-preferences-window.c @@ -53,7 +53,43 @@ enum { COLUMN_SORT /* G_TYPE_INT */ }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EPreferencesWindow, + e_preferences_window, + GTK_TYPE_WINDOW) + +static gboolean +preferences_window_filter_view (GtkTreeModel *model, + GtkTreeIter *iter, + EPreferencesWindow *window) +{ + gchar *str; + gboolean visible = FALSE; + + if (!window->priv->filter_view) + return TRUE; + + gtk_tree_model_get (model, iter, COLUMN_ID, &str, -1); + if (strncmp(window->priv->filter_view, "mail", 4) == 0) { + /* Show everything except calendar */ + if (str && (strncmp (str, "cal", 3) == 0)) + visible = FALSE; + else + visible = TRUE; + } else if (strncmp(window->priv->filter_view, "cal", 3) == 0) { + /* Show only calendar and nothing else */ + if (str && (strncmp (str, "cal", 3) != 0)) + visible = FALSE; + else + visible = TRUE; + + } else /* In any other case, show everything */ + visible = TRUE; + + g_free (str); + + return visible; +} static GdkPixbuf * preferences_window_load_pixbuf (const gchar *icon_name) @@ -149,7 +185,7 @@ preferences_window_dispose (GObject *object) g_hash_table_remove_all (priv->index); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_preferences_window_parent_class)->dispose (object); } static void @@ -162,7 +198,7 @@ preferences_window_finalize (GObject *object) g_hash_table_destroy (priv->index); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_preferences_window_parent_class)->finalize (object); } static void @@ -186,16 +222,15 @@ preferences_window_show (GtkWidget *widget) gtk_widget_grab_focus (priv->icon_view); /* Chain up to parent's show() method. */ - GTK_WIDGET_CLASS (parent_class)->show (widget); + GTK_WIDGET_CLASS (e_preferences_window_parent_class)->show (widget); } static void -preferences_window_class_init (EPreferencesWindowClass *class) +e_preferences_window_class_init (EPreferencesWindowClass *class) { GObjectClass *object_class; GtkWidgetClass *widget_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EPreferencesWindowPrivate)); object_class = G_OBJECT_CLASS (class); @@ -206,42 +241,8 @@ preferences_window_class_init (EPreferencesWindowClass *class) widget_class->show = preferences_window_show; } -static gboolean -filter_view (GtkTreeModel *model, - GtkTreeIter *iter, - gpointer data) -{ - EPreferencesWindow *window = (EPreferencesWindow *)data; - gchar *str; - gboolean visible = FALSE; - - if (!window->priv->filter_view) - return TRUE; - - gtk_tree_model_get (model, iter, COLUMN_ID, &str, -1); - if (strncmp(window->priv->filter_view, "mail", 4) == 0) { - /* Show everything except calendar */ - if (str && (strncmp (str, "cal", 3) == 0)) - visible = FALSE; - else - visible = TRUE; - } else if (strncmp(window->priv->filter_view, "cal", 3) == 0) { - /* Show only calendar and nothing else */ - if (str && (strncmp (str, "cal", 3) != 0)) - visible = FALSE; - else - visible = TRUE; - - } else /* In any other case, show everything */ - visible = TRUE; - - g_free (str); - - return visible; -} - static void -preferences_window_init (EPreferencesWindow *window) +e_preferences_window_init (EPreferencesWindow *window) { GtkListStore *store; GtkWidget *container; @@ -271,7 +272,8 @@ preferences_window_init (EPreferencesWindow *window) window->priv->filter = (GtkTreeModelFilter *) gtk_tree_model_filter_new (GTK_TREE_MODEL (store), NULL); gtk_tree_model_filter_set_visible_func ( - window->priv->filter, filter_view, window, NULL); + window->priv->filter, (GtkTreeModelFilterVisibleFunc) + preferences_window_filter_view, window, NULL); title = _("Evolution Preferences"); gtk_window_set_title (GTK_WINDOW (window), title); @@ -358,32 +360,6 @@ preferences_window_init (EPreferencesWindow *window) gtk_widget_show (widget); } -GType -e_preferences_window_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (EPreferencesWindowClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) preferences_window_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EPreferencesWindow), - 0, /* n_preallocs */ - (GInstanceInitFunc) preferences_window_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_WINDOW, "EPreferencesWindow", &type_info, 0); - } - - return type; -} - GtkWidget * e_preferences_window_new (gpointer shell) { diff --git a/widgets/misc/e-preview-pane.c b/widgets/misc/e-preview-pane.c index 240bfbd824..973de3bdb0 100644 --- a/widgets/misc/e-preview-pane.c +++ b/widgets/misc/e-preview-pane.c @@ -43,9 +43,13 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static guint signals[LAST_SIGNAL]; +G_DEFINE_TYPE ( + EPreviewPane, + e_preview_pane, + GTK_TYPE_VBOX) + static void preview_pane_set_web_view (EPreviewPane *preview_pane, EWebView *web_view) @@ -114,7 +118,7 @@ preview_pane_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_preview_pane_parent_class)->dispose (object); } static void @@ -153,12 +157,11 @@ preview_pane_show_search_bar (EPreviewPane *preview_pane) } static void -preview_pane_class_init (EPreviewPaneClass *class) +e_preview_pane_class_init (EPreviewPaneClass *class) { GObjectClass *object_class; GtkBindingSet *binding_set; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EPreviewPanePrivate)); object_class = G_OBJECT_CLASS (class); @@ -207,39 +210,13 @@ preview_pane_class_init (EPreviewPaneClass *class) } static void -preview_pane_init (EPreviewPane *preview_pane) +e_preview_pane_init (EPreviewPane *preview_pane) { preview_pane->priv = E_PREVIEW_PANE_GET_PRIVATE (preview_pane); gtk_box_set_spacing (GTK_BOX (preview_pane), 1); } -GType -e_preview_pane_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EPreviewPaneClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) preview_pane_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EPreviewPane), - 0, /* n_preallocs */ - (GInstanceInitFunc) preview_pane_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_VBOX, "EPreviewPane", &type_info, 0); - } - - return type; -} - GtkWidget * e_preview_pane_new (EWebView *web_view) { diff --git a/widgets/misc/e-printable.c b/widgets/misc/e-printable.c index b42080886a..13de73e068 100644 --- a/widgets/misc/e-printable.c +++ b/widgets/misc/e-printable.c @@ -30,7 +30,10 @@ #define EP_CLASS(e) ((EPrintableClass *)((GtkObject *)e)->klass) -G_DEFINE_TYPE (EPrintable, e_printable, GTK_TYPE_OBJECT) +G_DEFINE_TYPE ( + EPrintable, + e_printable, + GTK_TYPE_OBJECT) enum { PRINT_PAGE, diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c index aaf18b3912..c0b2d43e97 100644 --- a/widgets/misc/e-search-bar.c +++ b/widgets/misc/e-search-bar.c @@ -59,9 +59,13 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static guint signals[LAST_SIGNAL]; +G_DEFINE_TYPE ( + ESearchBar, + e_search_bar, + GTK_TYPE_HBOX) + static void search_bar_update_matches (ESearchBar *search_bar) { @@ -350,7 +354,7 @@ search_bar_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_search_bar_parent_class)->dispose (object); } static void @@ -363,7 +367,7 @@ search_bar_finalize (GObject *object) g_free (priv->active_search); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_search_bar_parent_class)->finalize (object); } static void @@ -386,7 +390,7 @@ search_bar_show (GtkWidget *widget) search_bar = E_SEARCH_BAR (widget); /* Chain up to parent's show() method. */ - GTK_WIDGET_CLASS (parent_class)->show (widget); + GTK_WIDGET_CLASS (e_search_bar_parent_class)->show (widget); gtk_widget_grab_focus (search_bar->priv->entry); @@ -401,7 +405,7 @@ search_bar_hide (GtkWidget *widget) search_bar = E_SEARCH_BAR (widget); /* Chain up to parent's hide() method. */ - GTK_WIDGET_CLASS (parent_class)->hide (widget); + GTK_WIDGET_CLASS (e_search_bar_parent_class)->hide (widget); search_bar_update_tokenizer (search_bar); } @@ -418,7 +422,7 @@ search_bar_key_press_event (GtkWidget *widget, } /* Chain up to parent's key_press_event() method. */ - widget_class = GTK_WIDGET_CLASS (parent_class); + widget_class = GTK_WIDGET_CLASS (e_search_bar_parent_class); return widget_class->key_press_event (widget, event); } @@ -440,12 +444,11 @@ search_bar_clear (ESearchBar *search_bar) } static void -search_bar_class_init (ESearchBarClass *class) +e_search_bar_class_init (ESearchBarClass *class) { GObjectClass *object_class; GtkWidgetClass *widget_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ESearchBarPrivate)); object_class = G_OBJECT_CLASS (class); @@ -523,7 +526,7 @@ search_bar_class_init (ESearchBarClass *class) } static void -search_bar_init (ESearchBar *search_bar) +e_search_bar_init (ESearchBar *search_bar) { GtkWidget *label; GtkWidget *widget; @@ -691,32 +694,6 @@ search_bar_init (ESearchBar *search_bar) gtk_widget_show (widget); } -GType -e_search_bar_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ESearchBarClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) search_bar_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ESearchBar), - 0, /* n_preallocs */ - (GInstanceInitFunc) search_bar_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_HBOX, "ESearchBar", &type_info, 0); - } - - return type; -} - GtkWidget * e_search_bar_new (EWebView *web_view) { diff --git a/widgets/misc/e-searching-tokenizer.c b/widgets/misc/e-searching-tokenizer.c index 8920a7dd21..e7ef585146 100644 --- a/widgets/misc/e-searching-tokenizer.c +++ b/widgets/misc/e-searching-tokenizer.c @@ -46,9 +46,13 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static guint signals[LAST_SIGNAL]; +G_DEFINE_TYPE ( + ESearchingTokenizer, + e_searching_tokenizer, + HTML_TYPE_TOKENIZER) + /* Utility functions */ /* This is faster and safer than glib2's utf8 abomination, but isn't exported from camel as yet */ @@ -914,7 +918,9 @@ struct _ESearchingTokenizerPrivate { static gchar * get_token (HTMLTokenizer *tokenizer) { - HTMLTokenizerClass *class = HTML_TOKENIZER_CLASS (parent_class); + HTMLTokenizerClass *class; + + class = HTML_TOKENIZER_CLASS (e_searching_tokenizer_parent_class); if (class->has_more (tokenizer)) return class->next_token (tokenizer); @@ -946,7 +952,7 @@ searching_tokenizer_finalize (GObject *object) searcher_free (priv->engine); /* Chain up to parent's finalize () method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_searching_tokenizer_parent_class)->finalize (object); } static void @@ -970,7 +976,8 @@ searching_tokenizer_begin (HTMLTokenizer *tokenizer, /* else - no engine, no search active */ /* Chain up to parent's begin() method. */ - HTML_TOKENIZER_CLASS (parent_class)->begin (tokenizer, content_type); + HTML_TOKENIZER_CLASS (e_searching_tokenizer_parent_class)-> + begin (tokenizer, content_type); } static gchar * @@ -984,7 +991,8 @@ searching_tokenizer_peek_token (HTMLTokenizer *tokenizer) return searcher_peek_token (priv->engine); /* Chain up to parent's peek_token() method. */ - return HTML_TOKENIZER_CLASS (parent_class)->peek_token (tokenizer); + return HTML_TOKENIZER_CLASS (e_searching_tokenizer_parent_class)-> + peek_token (tokenizer); } static gchar * @@ -998,7 +1006,9 @@ searching_tokenizer_next_token (HTMLTokenizer *tokenizer) /* If no search is active, just use the default method. */ if (priv->engine == NULL) - return HTML_TOKENIZER_CLASS (parent_class)->next_token (tokenizer); + return HTML_TOKENIZER_CLASS ( + e_searching_tokenizer_parent_class)-> + next_token (tokenizer); oldmatched = priv->engine->matchcount; @@ -1019,7 +1029,8 @@ searching_tokenizer_has_more (HTMLTokenizer *tokenizer) priv = E_SEARCHING_TOKENIZER_GET_PRIVATE (tokenizer); return (priv->engine != NULL && searcher_pending (priv->engine)) || - HTML_TOKENIZER_CLASS (parent_class)->has_more (tokenizer); + HTML_TOKENIZER_CLASS (e_searching_tokenizer_parent_class)-> + has_more (tokenizer); } static HTMLTokenizer * @@ -1043,12 +1054,11 @@ searching_tokenizer_clone (HTMLTokenizer *tokenizer) return HTML_TOKENIZER (new_st); } static void -searching_tokenizer_class_init (ESearchingTokenizerClass *class) +e_searching_tokenizer_class_init (ESearchingTokenizerClass *class) { GObjectClass *object_class; HTMLTokenizerClass *tokenizer_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ESearchingTokenizerPrivate)); object_class = G_OBJECT_CLASS (class); @@ -1072,7 +1082,7 @@ searching_tokenizer_class_init (ESearchingTokenizerClass *class) } static void -searching_tokenizer_init (ESearchingTokenizer *tokenizer) +e_searching_tokenizer_init (ESearchingTokenizer *tokenizer) { tokenizer->priv = E_SEARCHING_TOKENIZER_GET_PRIVATE (tokenizer); @@ -1089,33 +1099,6 @@ searching_tokenizer_init (ESearchingTokenizer *tokenizer) search_info_set_color (tokenizer->priv->secondary, "purple"); } -GType -e_searching_tokenizer_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ESearchingTokenizerClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) searching_tokenizer_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ESearchingTokenizer), - 0, /* n_preallocs */ - (GInstanceInitFunc) searching_tokenizer_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - HTML_TYPE_TOKENIZER, "ESearchingTokenizer", - &type_info, 0); - } - - return type; -} - ESearchingTokenizer * e_searching_tokenizer_new (void) { diff --git a/widgets/misc/e-selectable.c b/widgets/misc/e-selectable.c index da998d320d..433cd21438 100644 --- a/widgets/misc/e-selectable.c +++ b/widgets/misc/e-selectable.c @@ -21,8 +21,13 @@ #include "e-selectable.h" +G_DEFINE_INTERFACE ( + ESelectable, + e_selectable, + GTK_TYPE_WIDGET) + static void -selectable_class_init (ESelectableInterface *interface) +e_selectable_default_init (ESelectableInterface *interface) { g_object_interface_install_property ( interface, @@ -43,34 +48,6 @@ selectable_class_init (ESelectableInterface *interface) G_PARAM_READABLE)); } -GType -e_selectable_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ESelectableInterface), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) selectable_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - 0, /* instance_size */ - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_INTERFACE, "ESelectable", &type_info, 0); - - g_type_interface_add_prerequisite (type, GTK_TYPE_WIDGET); - } - - return type; -} - void e_selectable_update_actions (ESelectable *selectable, EFocusTracker *focus_tracker, diff --git a/widgets/misc/e-selection-model-array.c b/widgets/misc/e-selection-model-array.c index 796b528e46..5406fd635b 100644 --- a/widgets/misc/e-selection-model-array.c +++ b/widgets/misc/e-selection-model-array.c @@ -30,7 +30,10 @@ #include "e-selection-model-array.h" -G_DEFINE_TYPE (ESelectionModelArray, e_selection_model_array, e_selection_model_get_type()) +G_DEFINE_TYPE ( + ESelectionModelArray, + e_selection_model_array, + E_TYPE_SELECTION_MODEL) enum { PROP_0, diff --git a/widgets/misc/e-selection-model-simple.c b/widgets/misc/e-selection-model-simple.c index 917d306ced..571f4a5baf 100644 --- a/widgets/misc/e-selection-model-simple.c +++ b/widgets/misc/e-selection-model-simple.c @@ -31,7 +31,8 @@ static gint esms_get_row_count (ESelectionModelArray *esma); G_DEFINE_TYPE ( - ESelectionModelSimple, e_selection_model_simple, + ESelectionModelSimple, + e_selection_model_simple, E_SELECTION_MODEL_ARRAY_TYPE) static void diff --git a/widgets/misc/e-selection-model.c b/widgets/misc/e-selection-model.c index d27ff9b122..b18a62423e 100644 --- a/widgets/misc/e-selection-model.c +++ b/widgets/misc/e-selection-model.c @@ -29,7 +29,10 @@ #include "e-selection-model.h" -G_DEFINE_TYPE (ESelectionModel, e_selection_model, G_TYPE_OBJECT) +G_DEFINE_TYPE ( + ESelectionModel, + e_selection_model, + G_TYPE_OBJECT) enum { CURSOR_CHANGED, diff --git a/widgets/misc/e-send-options.c b/widgets/misc/e-send-options.c index b858374020..b7793be997 100644 --- a/widgets/misc/e-send-options.c +++ b/widgets/misc/e-send-options.c @@ -97,13 +97,9 @@ struct _ESendOptionsDialogPrivate { gchar *help_section; }; -static void e_sendoptions_dialog_class_init (GObjectClass *object_class); -static void e_sendoptions_dialog_finalize (GObject *object); -static void e_sendoptions_dialog_init (GObject *object); -static void e_sendoptions_dialog_dispose (GObject *object); +static void e_send_options_dialog_finalize (GObject *object); static void e_send_options_cb (GtkDialog *dialog, gint state, gpointer func_data); -static GObjectClass *parent_class = NULL; enum { SOD_RESPONSE, LAST_SIGNAL @@ -111,6 +107,11 @@ enum { static guint signals[LAST_SIGNAL] = {0}; +G_DEFINE_TYPE ( + ESendOptionsDialog, + e_send_options_dialog, + G_TYPE_OBJECT) + static void e_send_options_get_widgets_data (ESendOptionsDialog *sod) { @@ -530,7 +531,7 @@ setup_widgets (ESendOptionsDialog *sod, Item_type type) } ESendOptionsDialog * -e_sendoptions_dialog_new (void) { +e_send_options_dialog_new (void) { ESendOptionsDialog *sod; sod = g_object_new (E_TYPE_SENDOPTIONS_DIALOG, NULL); @@ -539,7 +540,7 @@ e_sendoptions_dialog_new (void) { } void -e_sendoptions_set_need_general_options (ESendOptionsDialog *sod, gboolean needed) +e_send_options_set_need_general_options (ESendOptionsDialog *sod, gboolean needed) { g_return_if_fail (E_IS_SENDOPTIONS_DIALOG (sod)); @@ -547,7 +548,7 @@ e_sendoptions_set_need_general_options (ESendOptionsDialog *sod, gboolean needed } gboolean -e_sendoptions_get_need_general_options (ESendOptionsDialog *sod) +e_send_options_get_need_general_options (ESendOptionsDialog *sod) { g_return_val_if_fail (E_IS_SENDOPTIONS_DIALOG (sod), FALSE); @@ -555,7 +556,7 @@ e_sendoptions_get_need_general_options (ESendOptionsDialog *sod) } gboolean -e_sendoptions_set_global (ESendOptionsDialog *sod, gboolean set) +e_send_options_set_global (ESendOptionsDialog *sod, gboolean set) { g_return_val_if_fail (E_IS_SENDOPTIONS_DIALOG (sod), FALSE); @@ -591,7 +592,7 @@ static void e_send_options_cb (GtkDialog *dialog, gint state, gpointer func_data } gboolean -e_sendoptions_dialog_run (ESendOptionsDialog *sod, GtkWidget *parent, Item_type type) +e_send_options_dialog_run (ESendOptionsDialog *sod, GtkWidget *parent, Item_type type) { ESendOptionsDialogPrivate *priv; GtkWidget *toplevel; @@ -636,7 +637,7 @@ e_sendoptions_dialog_run (ESendOptionsDialog *sod, GtkWidget *parent, Item_type } static void -e_sendoptions_dialog_finalize (GObject *object) +e_send_options_dialog_finalize (GObject *object) { ESendOptionsDialog *sod = (ESendOptionsDialog *) object; ESendOptionsDialogPrivate *priv; @@ -681,32 +682,18 @@ e_sendoptions_dialog_finalize (GObject *object) sod->priv = NULL; } - if (parent_class->finalize) - (* parent_class->finalize) (object); - -} - -static void -e_sendoptions_dialog_dispose (GObject *object) -{ - ESendOptionsDialog *sod = (ESendOptionsDialog *) object; - - g_return_if_fail (E_IS_SENDOPTIONS_DIALOG (sod)); - - if (parent_class->dispose) - (* parent_class->dispose) (object); + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (e_send_options_dialog_parent_class)->finalize (object); } /* Object initialization function for the task page */ static void -e_sendoptions_dialog_init (GObject *object) +e_send_options_dialog_init (ESendOptionsDialog *sod) { - ESendOptionsDialog *sod; ESendOptionsDialogPrivate *priv; ESendOptionsData *new; - sod = E_SENDOPTIONS_DIALOG (object); new = g_new0 (ESendOptionsData, 1); new->gopts = g_new0 (ESendOptionsGeneral, 1); new->sopts = g_new0 (ESendOptionsStatusTracking, 1); @@ -757,19 +744,15 @@ e_sendoptions_dialog_init (GObject *object) /* Class initialization function for the Send Options */ static void -e_sendoptions_dialog_class_init (GObjectClass *object) +e_send_options_dialog_class_init (ESendOptionsDialogClass *class) { - ESendOptionsDialogClass *klass; GObjectClass *object_class; - klass = E_SENDOPTIONS_DIALOG_CLASS (object); - parent_class = g_type_class_peek_parent (klass); - object_class = G_OBJECT_CLASS (klass); + object_class = G_OBJECT_CLASS (class); + object_class->finalize = e_send_options_dialog_finalize; - object_class->finalize = e_sendoptions_dialog_finalize; - object_class->dispose = e_sendoptions_dialog_dispose; signals[SOD_RESPONSE] = g_signal_new ("sod_response", - G_TYPE_FROM_CLASS (klass), + G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (ESendOptionsDialogClass, sod_response), NULL, NULL, @@ -778,26 +761,3 @@ e_sendoptions_dialog_class_init (GObjectClass *object) G_TYPE_INT); } - -GType e_sendoptions_dialog_get_type (void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof (ESendOptionsDialogClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_sendoptions_dialog_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (ESendOptionsDialog), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_sendoptions_dialog_init, - NULL /* instance_init */ - }; - type = g_type_register_static (G_TYPE_OBJECT, - "ESendOptionsDialogType", - &info, 0); - } - return type; -} diff --git a/widgets/misc/e-send-options.h b/widgets/misc/e-send-options.h index 3ed5d6fd24..2e25974dc3 100644 --- a/widgets/misc/e-send-options.h +++ b/widgets/misc/e-send-options.h @@ -27,7 +27,7 @@ #include <gtk/gtk.h> #include <time.h> -#define E_TYPE_SENDOPTIONS_DIALOG (e_sendoptions_dialog_get_type ()) +#define E_TYPE_SENDOPTIONS_DIALOG (e_send_options_dialog_get_type ()) #define E_SENDOPTIONS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SENDOPTIONS_DIALOG, ESendOptionsDialog)) #define E_SENDOPTIONS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SENDOPTIONS_DIALOG, ESendOptionsDialogClass)) #define E_IS_SENDOPTIONS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SENDOPTIONS_DIALOG)) @@ -118,10 +118,10 @@ struct _ESendOptionsDialogClass { void (* sod_response) (ESendOptionsDialog *sd, gint status); }; -GType e_sendoptions_dialog_get_type (void); -ESendOptionsDialog *e_sendoptions_dialog_new (void); -void e_sendoptions_set_need_general_options (ESendOptionsDialog *sod, gboolean needed); -gboolean e_sendoptions_get_need_general_options (ESendOptionsDialog *sod); -gboolean e_sendoptions_dialog_run (ESendOptionsDialog *sod, GtkWidget *parent, Item_type type); -gboolean e_sendoptions_set_global (ESendOptionsDialog *sod, gboolean set); +GType e_send_options_dialog_get_type (void); +ESendOptionsDialog *e_send_options_dialog_new (void); +void e_send_options_set_need_general_options (ESendOptionsDialog *sod, gboolean needed); +gboolean e_send_options_get_need_general_options (ESendOptionsDialog *sod); +gboolean e_send_options_dialog_run (ESendOptionsDialog *sod, GtkWidget *parent, Item_type type); +gboolean e_send_options_set_global (ESendOptionsDialog *sod, gboolean set); #endif diff --git a/widgets/misc/e-signature-combo-box.c b/widgets/misc/e-signature-combo-box.c index a70c9cc38a..540a9e769d 100644 --- a/widgets/misc/e-signature-combo-box.c +++ b/widgets/misc/e-signature-combo-box.c @@ -46,9 +46,13 @@ struct _ESignatureComboBoxPrivate { GHashTable *index; }; -static gpointer parent_class; static guint signal_ids[LAST_SIGNAL]; +G_DEFINE_TYPE ( + ESignatureComboBox, + e_signature_combo_box, + GTK_TYPE_COMBO_BOX) + static void signature_combo_box_refresh_cb (ESignatureList *signature_list, ESignature *unused, @@ -134,7 +138,8 @@ signature_combo_box_constructor (GType type, GtkCellRenderer *renderer; /* Chain up to parent's constructor() method. */ - object = G_OBJECT_CLASS (parent_class)->constructor ( + object = G_OBJECT_CLASS ( + e_signature_combo_box_parent_class)->constructor ( type, n_construct_properties, construct_properties); renderer = gtk_cell_renderer_text_new (); @@ -168,7 +173,7 @@ signature_combo_box_dispose (GObject *object) g_hash_table_remove_all (priv->index); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_signature_combo_box_parent_class)->dispose (object); } static void @@ -181,15 +186,14 @@ signature_combo_box_finalize (GObject *object) g_hash_table_destroy (priv->index); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_signature_combo_box_parent_class)->finalize (object); } static void -signature_combo_box_class_init (ESignatureComboBoxClass *class) +e_signature_combo_box_class_init (ESignatureComboBoxClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ESignatureComboBoxPrivate)); object_class = G_OBJECT_CLASS (class); @@ -207,7 +211,7 @@ signature_combo_box_class_init (ESignatureComboBoxClass *class) } static void -signature_combo_box_init (ESignatureComboBox *combo_box) +e_signature_combo_box_init (ESignatureComboBox *combo_box) { GHashTable *index; @@ -221,33 +225,6 @@ signature_combo_box_init (ESignatureComboBox *combo_box) combo_box->priv->index = index; } -GType -e_signature_combo_box_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ESignatureComboBoxClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) signature_combo_box_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ESignatureComboBox), - 0, /* n_preallocs */ - (GInstanceInitFunc) signature_combo_box_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_COMBO_BOX, "ESignatureComboBox", - &type_info, 0); - } - - return type; -} - GtkWidget * e_signature_combo_box_new (void) { diff --git a/widgets/misc/e-signature-editor.c b/widgets/misc/e-signature-editor.c index 91a4d81c8d..28c5819865 100644 --- a/widgets/misc/e-signature-editor.c +++ b/widgets/misc/e-signature-editor.c @@ -64,7 +64,10 @@ static const gchar *ui = " </toolbar>\n" "</ui>"; -static gpointer parent_class = NULL; +G_DEFINE_TYPE ( + ESignatureEditor, + e_signature_editor, + GTKHTML_TYPE_EDITOR) static void handle_error (GError **error) @@ -302,7 +305,7 @@ signature_editor_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_signature_editor_parent_class)->dispose (object); } static void @@ -315,15 +318,14 @@ signature_editor_finalize (GObject *object) g_free (priv->original_name); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_signature_editor_parent_class)->finalize (object); } static void -signature_editor_class_init (ESignatureEditorClass *class) +e_signature_editor_class_init (ESignatureEditorClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ESignatureEditorPrivate)); object_class = G_OBJECT_CLASS (class); @@ -354,7 +356,7 @@ signature_editor_class_init (ESignatureEditorClass *class) } static void -signature_editor_init (ESignatureEditor *editor) +e_signature_editor_init (ESignatureEditor *editor) { GtkActionGroup *action_group; EFocusTracker *focus_tracker; @@ -435,33 +437,6 @@ signature_editor_init (ESignatureEditor *editor) editor->priv->focus_tracker = focus_tracker; } -GType -e_signature_editor_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ESignatureEditorClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) signature_editor_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ESignatureEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) signature_editor_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTKHTML_TYPE_EDITOR, "ESignatureEditor", - &type_info, 0); - } - - return type; -} - GtkWidget * e_signature_editor_new (void) { diff --git a/widgets/misc/e-signature-manager.c b/widgets/misc/e-signature-manager.c index d30d20368a..e9a04b8641 100644 --- a/widgets/misc/e-signature-manager.c +++ b/widgets/misc/e-signature-manager.c @@ -61,9 +61,13 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static guint signals[LAST_SIGNAL]; +G_DEFINE_TYPE ( + ESignatureManager, + e_signature_manager, + GTK_TYPE_TABLE) + static void signature_manager_emit_editor_created (ESignatureManager *manager, GtkWidget *editor) @@ -264,7 +268,7 @@ signature_manager_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_signature_manager_parent_class)->dispose (object); } static void @@ -398,11 +402,10 @@ signature_manager_remove_signature (ESignatureManager *manager) } static void -signature_manager_class_init (ESignatureManagerClass *class) +e_signature_manager_class_init (ESignatureManagerClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ESignatureManagerPrivate)); object_class = G_OBJECT_CLASS (class); @@ -497,7 +500,7 @@ signature_manager_class_init (ESignatureManagerClass *class) } static void -signature_manager_init (ESignatureManager *manager) +e_signature_manager_init (ESignatureManager *manager) { GtkTreeSelection *selection; GtkWidget *container; @@ -611,32 +614,6 @@ signature_manager_init (ESignatureManager *manager) manager); } -GType -e_signature_manager_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ESignatureManagerClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) signature_manager_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_init */ - sizeof (ESignatureManager), - 0, /* n_preallocs */ - (GInstanceInitFunc) signature_manager_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_TABLE, "ESignatureManager", &type_info, 0); - } - - return type; -} - GtkWidget * e_signature_manager_new (ESignatureList *signature_list) { diff --git a/widgets/misc/e-signature-preview.c b/widgets/misc/e-signature-preview.c index a9316e44ec..af266dd5b3 100644 --- a/widgets/misc/e-signature-preview.c +++ b/widgets/misc/e-signature-preview.c @@ -47,9 +47,13 @@ struct _ESignaturePreviewPrivate { guint allow_scripts : 1; }; -static gpointer parent_class; static guint signals[LAST_SIGNAL]; +G_DEFINE_TYPE ( + ESignaturePreview, + e_signature_preview, + E_TYPE_WEB_VIEW) + static void signature_preview_set_property (GObject *object, guint property_id, @@ -109,7 +113,7 @@ signature_preview_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_signature_preview_parent_class)->dispose (object); } static void @@ -164,11 +168,10 @@ clear: } static void -signature_preview_class_init (ESignaturePreviewClass *class) +e_signature_preview_class_init (ESignaturePreviewClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ESignaturePreviewPrivate)); object_class = G_OBJECT_CLASS (class); @@ -210,37 +213,11 @@ signature_preview_class_init (ESignaturePreviewClass *class) } static void -signature_preview_init (ESignaturePreview *preview) +e_signature_preview_init (ESignaturePreview *preview) { preview->priv = E_SIGNATURE_PREVIEW_GET_PRIVATE (preview); } -GType -e_signature_preview_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ESignaturePreviewClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) signature_preview_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ESignaturePreview), - 0, /* n_preallocs */ - (GInstanceInitFunc) signature_preview_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_WEB_VIEW, "ESignaturePreview", &type_info, 0); - } - - return type; -} - GtkWidget * e_signature_preview_new (void) { diff --git a/widgets/misc/e-signature-script-dialog.c b/widgets/misc/e-signature-script-dialog.c index 777d064f09..d6f48233c2 100644 --- a/widgets/misc/e-signature-script-dialog.c +++ b/widgets/misc/e-signature-script-dialog.c @@ -40,7 +40,10 @@ enum { PROP_SCRIPT_NAME }; -static gpointer parent_class; +G_DEFINE_TYPE ( + ESignatureScriptDialog, + e_signature_script_dialog, + GTK_TYPE_DIALOG) static gboolean signature_script_dialog_filter_cb (const GtkFileFilterInfo *filter_info) @@ -160,7 +163,7 @@ signature_script_dialog_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_signature_script_dialog_parent_class)->dispose (object); } static void @@ -170,7 +173,7 @@ signature_script_dialog_map (GtkWidget *widget) GtkWidget *content_area; /* Chain up to parent's map() method. */ - GTK_WIDGET_CLASS (parent_class)->map (widget); + GTK_WIDGET_CLASS (e_signature_script_dialog_parent_class)->map (widget); /* XXX Override GtkDialog's broken style property defaults. */ action_area = gtk_dialog_get_action_area (GTK_DIALOG (widget)); @@ -182,12 +185,11 @@ signature_script_dialog_map (GtkWidget *widget) } static void -signature_script_dialog_class_init (ESignatureScriptDialogClass *class) +e_signature_script_dialog_class_init (ESignatureScriptDialogClass *class) { GObjectClass *object_class; GtkWidgetClass *widget_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ESignatureScriptDialogPrivate)); object_class = G_OBJECT_CLASS (class); @@ -221,7 +223,7 @@ signature_script_dialog_class_init (ESignatureScriptDialogClass *class) } static void -signature_script_dialog_init (ESignatureScriptDialog *dialog) +e_signature_script_dialog_init (ESignatureScriptDialog *dialog) { GtkFileFilter *filter; GtkWidget *content_area; @@ -366,33 +368,6 @@ signature_script_dialog_init (ESignatureScriptDialog *dialog) signature_script_dialog_update_status (dialog); } -GType -e_signature_script_dialog_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ESignatureScriptDialogClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) signature_script_dialog_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ESignatureScriptDialog), - 0, /* n_preallocs */ - (GInstanceInitFunc) signature_script_dialog_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_DIALOG, "ESignatureScriptDialog", - &type_info, 0); - } - - return type; -} - GtkWidget * e_signature_script_dialog_new (GtkWindow *parent) { diff --git a/widgets/misc/e-signature-tree-view.c b/widgets/misc/e-signature-tree-view.c index 5c931c8d93..9d27ec1929 100644 --- a/widgets/misc/e-signature-tree-view.c +++ b/widgets/misc/e-signature-tree-view.c @@ -46,9 +46,13 @@ struct _ESignatureTreeViewPrivate { GHashTable *index; }; -static gpointer parent_class; static guint signals[LAST_SIGNAL]; +G_DEFINE_TYPE ( + ESignatureTreeView, + e_signature_tree_view, + GTK_TYPE_TREE_VIEW) + static void signature_tree_view_refresh_cb (ESignatureList *signature_list, ESignature *unused, @@ -141,7 +145,8 @@ signature_tree_view_constructor (GType type, GtkCellRenderer *renderer; /* Chain up to parent's constructor() method. */ - object = G_OBJECT_CLASS (parent_class)->constructor ( + object = G_OBJECT_CLASS ( + e_signature_tree_view_parent_class)->constructor ( type, n_construct_properties, construct_properties); tree_view = GTK_TREE_VIEW (object); @@ -223,7 +228,7 @@ signature_tree_view_dispose (GObject *object) g_hash_table_remove_all (priv->index); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_signature_tree_view_parent_class)->dispose (object); } static void @@ -236,15 +241,14 @@ signature_tree_view_finalize (GObject *object) g_hash_table_destroy (priv->index); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_signature_tree_view_parent_class)->finalize (object); } static void -signature_tree_view_class_init (ESignatureTreeViewClass *class) +e_signature_tree_view_class_init (ESignatureTreeViewClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ESignatureTreeViewPrivate)); object_class = G_OBJECT_CLASS (class); @@ -285,7 +289,7 @@ signature_tree_view_class_init (ESignatureTreeViewClass *class) } static void -signature_tree_view_init (ESignatureTreeView *tree_view) +e_signature_tree_view_init (ESignatureTreeView *tree_view) { GHashTable *index; GtkTreeSelection *selection; @@ -307,33 +311,6 @@ signature_tree_view_init (ESignatureTreeView *tree_view) tree_view); } -GType -e_signature_tree_view_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ESignatureTreeViewClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) signature_tree_view_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ESignatureTreeView), - 0, /* n_preallocs */ - (GInstanceInitFunc) signature_tree_view_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_TREE_VIEW, "ESignatureTreeView", - &type_info, 0); - } - - return type; -} - GtkWidget * e_signature_tree_view_new (void) { diff --git a/widgets/misc/e-url-entry.c b/widgets/misc/e-url-entry.c index 3109f16989..eaefdccddd 100644 --- a/widgets/misc/e-url-entry.c +++ b/widgets/misc/e-url-entry.c @@ -34,8 +34,6 @@ struct _EUrlEntryPrivate { GtkWidget *button; }; -static void class_init (EUrlEntryClass *class); -static void init (EUrlEntry *url_entry); static void finalize (GObject *object); static void button_clicked_cb (GtkWidget *widget, gpointer data); @@ -43,42 +41,17 @@ static void entry_changed_cb (GtkEditable *editable, gpointer data); static gboolean mnemonic_activate (GtkWidget *widget, gboolean group_cycling); -static gpointer parent_class = NULL; - -GType -e_url_entry_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EUrlEntryClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EUrlEntry), - 0, /* n_preallocs */ - (GInstanceInitFunc) init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_HBOX, "EUrlEntry", &type_info, 0); - } - - return type; -} +G_DEFINE_TYPE ( + EUrlEntry, + e_url_entry, + GTK_TYPE_HBOX) static void -class_init (EUrlEntryClass *class) +e_url_entry_class_init (EUrlEntryClass *class) { GObjectClass *object_class; GtkWidgetClass *widget_class; - parent_class = g_type_class_peek_parent (class); - object_class = G_OBJECT_CLASS (class); object_class->finalize = finalize; @@ -87,7 +60,7 @@ class_init (EUrlEntryClass *class) } static void -init (EUrlEntry *url_entry) +e_url_entry_init (EUrlEntry *url_entry) { EUrlEntryPrivate *priv; GtkWidget *pixmap; @@ -127,7 +100,8 @@ finalize (GObject *object) url_entry->priv = NULL; } - G_OBJECT_CLASS (parent_class)->finalize (object); + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (e_url_entry_parent_class)->finalize (object); } /* GtkWidget::mnemonic_activate() handler for the EUrlEntry */ diff --git a/widgets/misc/e-web-view-preview.c b/widgets/misc/e-web-view-preview.c index e268779827..ea5cee0241 100644 --- a/widgets/misc/e-web-view-preview.c +++ b/widgets/misc/e-web-view-preview.c @@ -41,7 +41,10 @@ enum { PROP_ESCAPE_VALUES }; -G_DEFINE_TYPE (EWebViewPreview, e_web_view_preview, GTK_TYPE_VPANED); +G_DEFINE_TYPE ( + EWebViewPreview, + e_web_view_preview, + GTK_TYPE_VPANED); static void web_view_preview_set_property (GObject *object, diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c index d484ce9515..26613cb686 100644 --- a/widgets/misc/e-web-view.c +++ b/widgets/misc/e-web-view.c @@ -125,9 +125,14 @@ static const gchar *ui = static void e_web_view_selectable_init (ESelectableInterface *interface); G_DEFINE_TYPE_WITH_CODE ( - EWebView, e_web_view, GTK_TYPE_HTML, - G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL) - G_IMPLEMENT_INTERFACE (E_TYPE_SELECTABLE, e_web_view_selectable_init)) + EWebView, + e_web_view, + GTK_TYPE_HTML, + G_IMPLEMENT_INTERFACE ( + E_TYPE_EXTENSIBLE, NULL) + G_IMPLEMENT_INTERFACE ( + E_TYPE_SELECTABLE, + e_web_view_selectable_init)) static EWebViewRequest * web_view_request_new (EWebView *web_view, |