aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-combo-cell-editable.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-combo-cell-editable.c
parentf1d2541c487fbf7433a1b9aad8e8982ef08b85f5 (diff)
downloadgsoc2013-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/misc/e-combo-cell-editable.c')
-rw-r--r--widgets/misc/e-combo-cell-editable.c70
1 files changed, 24 insertions, 46 deletions
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 *