aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-attachment-tree-view.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-attachment-tree-view.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-attachment-tree-view.c')
-rw-r--r--widgets/misc/e-attachment-tree-view.c111
1 files changed, 43 insertions, 68 deletions
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 *