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 /widgets | |
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.
Diffstat (limited to 'widgets')
56 files changed, 645 insertions, 1604 deletions
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, |