aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-account-combo-box.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-08-24 23:21:41 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-08-25 02:37:02 +0800
commitecf3434da05b1f39f793c24b38bfd278e10b5786 (patch)
tree485ed2399920ecb10dbee2b4db4c437c22574a20 /widgets/misc/e-account-combo-box.c
parentf1d2541c487fbf7433a1b9aad8e8982ef08b85f5 (diff)
downloadgsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.gz
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/misc/e-account-combo-box.c')
-rw-r--r--widgets/misc/e-account-combo-box.c45
1 files changed, 12 insertions, 33 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)
{