From ecf3434da05b1f39f793c24b38bfd278e10b5786 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 24 Aug 2010 11:21:41 -0400 Subject: 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. --- widgets/misc/e-attachment-dialog.c | 40 ++++++++------------------------------ 1 file changed, 8 insertions(+), 32 deletions(-) (limited to 'widgets/misc/e-attachment-dialog.c') 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) -- cgit