diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-07-06 01:26:43 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-07-06 04:40:50 +0800 |
commit | df1dc37704daf3b1f20d1632b1cef1ea0a2181ad (patch) | |
tree | 18f00ac12457a5e1f9a5cf2bb2b9db482a150d96 /modules/calendar/e-cal-shell-view.c | |
parent | 7bb795b299758e6a81536b81c19693f353106105 (diff) | |
download | gsoc2013-evolution-df1dc37704daf3b1f20d1632b1cef1ea0a2181ad.tar gsoc2013-evolution-df1dc37704daf3b1f20d1632b1cef1ea0a2181ad.tar.gz gsoc2013-evolution-df1dc37704daf3b1f20d1632b1cef1ea0a2181ad.tar.bz2 gsoc2013-evolution-df1dc37704daf3b1f20d1632b1cef1ea0a2181ad.tar.lz gsoc2013-evolution-df1dc37704daf3b1f20d1632b1cef1ea0a2181ad.tar.xz gsoc2013-evolution-df1dc37704daf3b1f20d1632b1cef1ea0a2181ad.tar.zst gsoc2013-evolution-df1dc37704daf3b1f20d1632b1cef1ea0a2181ad.zip |
EShellView can load the GalViewCollection itself now.
EShellView no longer needs help from subclasses other than getting
the needed GalView subclasses registered.
A nice side-effect of this is EShellView subclasses can now use the
G_DEFINE_DYNAMIC_TYPE macro.
Diffstat (limited to 'modules/calendar/e-cal-shell-view.c')
-rw-r--r-- | modules/calendar/e-cal-shell-view.c | 58 |
1 files changed, 23 insertions, 35 deletions
diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index 5350265cae..624647bafb 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -27,8 +27,10 @@ #include "calendar/gui/calendar-view.h" -static gpointer parent_class; -static GType cal_shell_view_type; +G_DEFINE_DYNAMIC_TYPE ( + ECalShellView, + e_cal_shell_view, + E_TYPE_SHELL_VIEW) static void cal_shell_view_add_action_button (GtkBox *box, @@ -80,7 +82,7 @@ cal_shell_view_dispose (GObject *object) e_cal_shell_view_private_dispose (E_CAL_SHELL_VIEW (object)); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_cal_shell_view_parent_class)->dispose (object); } static void @@ -89,7 +91,7 @@ cal_shell_view_finalize (GObject *object) e_cal_shell_view_private_finalize (E_CAL_SHELL_VIEW (object)); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_cal_shell_view_parent_class)->finalize (object); } static void @@ -106,7 +108,7 @@ cal_shell_view_constructed (GObject *object) gulong handler_id; /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_cal_shell_view_parent_class)->constructed (object); cal_shell_view = E_CAL_SHELL_VIEW (object); e_cal_shell_view_private_constructed (cal_shell_view); @@ -370,7 +372,8 @@ cal_shell_view_update_actions (EShellView *shell_view) gboolean refresh_supported; /* Chain up to parent's update_actions() method. */ - E_SHELL_VIEW_CLASS (parent_class)->update_actions (shell_view); + E_SHELL_VIEW_CLASS (e_cal_shell_view_parent_class)-> + update_actions (shell_view); priv = E_CAL_SHELL_VIEW_GET_PRIVATE (shell_view); @@ -572,13 +575,11 @@ cal_shell_view_update_actions (EShellView *shell_view) } static void -cal_shell_view_class_init (ECalShellViewClass *class, - GTypeModule *type_module) +e_cal_shell_view_class_init (ECalShellViewClass *class) { GObjectClass *object_class; EShellViewClass *shell_view_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ECalShellViewPrivate)); object_class = G_OBJECT_CLASS (class); @@ -607,38 +608,25 @@ cal_shell_view_class_init (ECalShellViewClass *class, } static void -cal_shell_view_init (ECalShellView *cal_shell_view, - EShellViewClass *shell_view_class) +e_cal_shell_view_class_finalize (ECalShellViewClass *class) { - cal_shell_view->priv = - E_CAL_SHELL_VIEW_GET_PRIVATE (cal_shell_view); - - e_cal_shell_view_private_init (cal_shell_view, shell_view_class); } -GType -e_cal_shell_view_get_type (void) +static void +e_cal_shell_view_init (ECalShellView *cal_shell_view) { - return cal_shell_view_type; + cal_shell_view->priv = + E_CAL_SHELL_VIEW_GET_PRIVATE (cal_shell_view); + + e_cal_shell_view_private_init (cal_shell_view); } void -e_cal_shell_view_register_type (GTypeModule *type_module) +e_cal_shell_view_type_register (GTypeModule *type_module) { - const GTypeInfo type_info = { - sizeof (ECalShellViewClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) cal_shell_view_class_init, - (GClassFinalizeFunc) NULL, - type_module, - sizeof (ECalShellView), - 0, /* n_preallocs */ - (GInstanceInitFunc) cal_shell_view_init, - NULL /* value_table */ - }; - - cal_shell_view_type = g_type_module_register_type ( - type_module, E_TYPE_SHELL_VIEW, - "ECalShellView", &type_info, 0); + /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration + * function, so we have to wrap it with a public function in + * order to register types from a separate compilation unit. */ + e_cal_shell_view_register_type (type_module); } + |