diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-12-08 04:25:02 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-12-08 11:11:21 +0800 |
commit | a01525c9316b13153cb00fa99cdc587e3ce7c350 (patch) | |
tree | 8053b4a68ca33a68cb8123f0a703c003184fa8d0 | |
parent | 8927e9d2e0d2bfc0f0a2cc7821d2ef8658e8670f (diff) | |
download | gsoc2013-evolution-a01525c9316b13153cb00fa99cdc587e3ce7c350.tar gsoc2013-evolution-a01525c9316b13153cb00fa99cdc587e3ce7c350.tar.gz gsoc2013-evolution-a01525c9316b13153cb00fa99cdc587e3ce7c350.tar.bz2 gsoc2013-evolution-a01525c9316b13153cb00fa99cdc587e3ce7c350.tar.lz gsoc2013-evolution-a01525c9316b13153cb00fa99cdc587e3ce7c350.tar.xz gsoc2013-evolution-a01525c9316b13153cb00fa99cdc587e3ce7c350.tar.zst gsoc2013-evolution-a01525c9316b13153cb00fa99cdc587e3ce7c350.zip |
Miscellaneous EShellView-related cleanups.
54 files changed, 657 insertions, 731 deletions
diff --git a/modules/addressbook/e-book-shell-backend.c b/modules/addressbook/e-book-shell-backend.c index ea65ce360f..a07d500bfc 100644 --- a/modules/addressbook/e-book-shell-backend.c +++ b/modules/addressbook/e-book-shell-backend.c @@ -56,6 +56,10 @@ #include "smime/gui/certificate-manager.h" #endif +#define E_BOOK_SHELL_BACKEND_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_BOOK_SHELL_BACKEND, EBookShellBackendPrivate)) + struct _EBookShellBackendPrivate { ESourceList *source_list; }; @@ -65,8 +69,10 @@ enum { PROP_SOURCE_LIST }; -static gpointer parent_class; -static GType book_shell_backend_type; +G_DEFINE_DYNAMIC_TYPE ( + EBookShellBackend, + e_book_shell_backend, + E_TYPE_SHELL_BACKEND) static void book_shell_backend_ensure_sources (EShellBackend *shell_backend) @@ -84,7 +90,7 @@ book_shell_backend_ensure_sources (EShellBackend *shell_backend) on_this_computer = NULL; personal = NULL; - priv = E_BOOK_SHELL_BACKEND (shell_backend)->priv; + priv = E_BOOK_SHELL_BACKEND_GET_PRIVATE (shell_backend); e_book_client_get_sources (&priv->source_list, &error); @@ -483,7 +489,7 @@ book_shell_backend_dispose (GObject *object) { EBookShellBackendPrivate *priv; - priv = E_BOOK_SHELL_BACKEND (object)->priv; + priv = E_BOOK_SHELL_BACKEND_GET_PRIVATE (object); if (priv->source_list != NULL) { g_object_unref (priv->source_list); @@ -491,7 +497,7 @@ book_shell_backend_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_book_shell_backend_parent_class)->dispose (object); } static void @@ -537,16 +543,15 @@ book_shell_backend_constructed (GObject *object) g_idle_add ((GSourceFunc) book_shell_backend_init_preferences, shell); /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_book_shell_backend_parent_class)->constructed (object); } static void -book_shell_backend_class_init (EBookShellBackendClass *class) +e_book_shell_backend_class_init (EBookShellBackendClass *class) { GObjectClass *object_class; EShellBackendClass *shell_backend_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EBookShellBackendPrivate)); object_class = G_OBJECT_CLASS (class); @@ -576,38 +581,24 @@ book_shell_backend_class_init (EBookShellBackendClass *class) } static void -book_shell_backend_init (EBookShellBackend *book_shell_backend) +e_book_shell_backend_class_finalize (EBookShellBackendClass *class) { - book_shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - book_shell_backend, E_TYPE_BOOK_SHELL_BACKEND, - EBookShellBackendPrivate); } -GType -e_book_shell_backend_get_type (void) +static void +e_book_shell_backend_init (EBookShellBackend *book_shell_backend) { - return book_shell_backend_type; + book_shell_backend->priv = + E_BOOK_SHELL_BACKEND_GET_PRIVATE (book_shell_backend); } void -e_book_shell_backend_register_type (GTypeModule *type_module) +e_book_shell_backend_type_register (GTypeModule *type_module) { - const GTypeInfo type_info = { - sizeof (EBookShellBackendClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) book_shell_backend_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EBookShellBackend), - 0, /* n_preallocs */ - (GInstanceInitFunc) book_shell_backend_init, - NULL /* value_table */ - }; - - book_shell_backend_type = g_type_module_register_type ( - type_module, E_TYPE_SHELL_BACKEND, - "EBookShellBackend", &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_book_shell_backend_register_type (type_module); } ESourceList * diff --git a/modules/addressbook/e-book-shell-backend.h b/modules/addressbook/e-book-shell-backend.h index c61e43b814..00ebe3d536 100644 --- a/modules/addressbook/e-book-shell-backend.h +++ b/modules/addressbook/e-book-shell-backend.h @@ -60,7 +60,7 @@ struct _EBookShellBackendClass { }; GType e_book_shell_backend_get_type (void); -void e_book_shell_backend_register_type +void e_book_shell_backend_type_register (GTypeModule *type_module); ESourceList * e_book_shell_backend_get_source_list (EBookShellBackend *book_shell_backend); diff --git a/modules/addressbook/e-book-shell-content.c b/modules/addressbook/e-book-shell-content.c index f4c3d74784..0183512f5b 100644 --- a/modules/addressbook/e-book-shell-content.c +++ b/modules/addressbook/e-book-shell-content.c @@ -33,6 +33,10 @@ #include "widgets/misc/e-preview-pane.h" #include "e-book-shell-view.h" +#define E_BOOK_SHELL_CONTENT_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_BOOK_SHELL_CONTENT, EBookShellContentPrivate)) + struct _EBookShellContentPrivate { GtkWidget *paned; GtkWidget *notebook; @@ -53,8 +57,13 @@ enum { PROP_PREVIEW_SHOW_MAPS }; -static gpointer parent_class; -static GType book_shell_content_type; +G_DEFINE_DYNAMIC_TYPE_EXTENDED ( + EBookShellContent, + e_book_shell_content, + E_TYPE_SHELL_CONTENT, + 0, + G_IMPLEMENT_INTERFACE_DYNAMIC ( + GTK_TYPE_ORIENTABLE, NULL)) static void book_shell_content_send_message_cb (EBookShellContent *book_shell_content, @@ -83,14 +92,21 @@ book_shell_content_restore_state_cb (EShellWindow *shell_window, EBookShellContentPrivate *priv; GSettings *settings; - priv = E_BOOK_SHELL_CONTENT (shell_content)->priv; + priv = E_BOOK_SHELL_CONTENT_GET_PRIVATE (shell_content); /* Bind GObject properties to GSettings keys. */ settings = g_settings_new ("org.gnome.evolution.addressbook"); - g_settings_bind (settings, "hpane-position", priv->paned, "hposition", G_SETTINGS_BIND_DEFAULT); - g_settings_bind (settings, "vpane-position", priv->paned, "vposition", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "hpane-position", + priv->paned, "hposition", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind ( + settings, "vpane-position", + priv->paned, "vposition", + G_SETTINGS_BIND_DEFAULT); g_object_unref (settings); } @@ -202,7 +218,7 @@ book_shell_content_dispose (GObject *object) { EBookShellContentPrivate *priv; - priv = E_BOOK_SHELL_CONTENT (object)->priv; + priv = E_BOOK_SHELL_CONTENT_GET_PRIVATE (object); if (priv->paned != NULL) { g_object_unref (priv->paned); @@ -220,7 +236,7 @@ book_shell_content_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_book_shell_content_parent_class)->dispose (object); } static void @@ -234,10 +250,10 @@ book_shell_content_constructed (GObject *object) GtkWidget *container; GtkWidget *widget; - priv = E_BOOK_SHELL_CONTENT (object)->priv; + priv = E_BOOK_SHELL_CONTENT_GET_PRIVATE (object); /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_book_shell_content_parent_class)->constructed (object); shell_content = E_SHELL_CONTENT (object); shell_view = e_shell_content_get_shell_view (shell_content); @@ -415,12 +431,11 @@ book_shell_content_focus_search_results (EShellContent *shell_content) } static void -book_shell_content_class_init (EBookShellContentClass *class) +e_book_shell_content_class_init (EBookShellContentClass *class) { GObjectClass *object_class; EShellContentClass *shell_content_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EBookShellContentPrivate)); object_class = G_OBJECT_CLASS (class); @@ -480,50 +495,26 @@ book_shell_content_class_init (EBookShellContentClass *class) } static void -book_shell_content_init (EBookShellContent *book_shell_content) +e_book_shell_content_class_finalize (EBookShellContentClass *class) { - book_shell_content->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - book_shell_content, E_TYPE_BOOK_SHELL_CONTENT, - EBookShellContentPrivate); - - /* Postpone widget construction until we have a shell view. */ } -GType -e_book_shell_content_get_type (void) +static void +e_book_shell_content_init (EBookShellContent *book_shell_content) { - return book_shell_content_type; + book_shell_content->priv = + E_BOOK_SHELL_CONTENT_GET_PRIVATE (book_shell_content); + + /* Postpone widget construction until we have a shell view. */ } void -e_book_shell_content_register_type (GTypeModule *type_module) +e_book_shell_content_type_register (GTypeModule *type_module) { - static const GTypeInfo type_info = { - sizeof (EBookShellContentClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) book_shell_content_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EBookShellContent), - 0, /* n_preallocs */ - (GInstanceInitFunc) book_shell_content_init, - NULL /* value_table */ - }; - - static const GInterfaceInfo orientable_info = { - (GInterfaceInitFunc) NULL, - (GInterfaceFinalizeFunc) NULL, - NULL /* interface_data */ - }; - - book_shell_content_type = g_type_module_register_type ( - type_module, E_TYPE_SHELL_CONTENT, - "EBookShellContent", &type_info, 0); - - g_type_module_add_interface ( - type_module, book_shell_content_type, - GTK_TYPE_ORIENTABLE, &orientable_info); + /* 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_book_shell_content_register_type (type_module); } GtkWidget * diff --git a/modules/addressbook/e-book-shell-content.h b/modules/addressbook/e-book-shell-content.h index 28fef270bd..92bb716d72 100644 --- a/modules/addressbook/e-book-shell-content.h +++ b/modules/addressbook/e-book-shell-content.h @@ -77,7 +77,7 @@ struct _EBookShellContentClass { }; GType e_book_shell_content_get_type (void); -void e_book_shell_content_register_type +void e_book_shell_content_type_register (GTypeModule *type_module); GtkWidget * e_book_shell_content_new (EShellView *shell_view); diff --git a/modules/addressbook/e-book-shell-sidebar.c b/modules/addressbook/e-book-shell-sidebar.c index def7507486..af28f8bbb1 100644 --- a/modules/addressbook/e-book-shell-sidebar.c +++ b/modules/addressbook/e-book-shell-sidebar.c @@ -34,6 +34,10 @@ #include "e-book-shell-backend.h" #include "e-addressbook-selector.h" +#define E_BOOK_SHELL_SIDEBAR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_BOOK_SHELL_SIDEBAR, EBookShellSidebarPrivate)) + struct _EBookShellSidebarPrivate { GtkWidget *selector; }; @@ -43,8 +47,10 @@ enum { PROP_SELECTOR }; -static gpointer parent_class; -static GType book_shell_sidebar_type; +G_DEFINE_DYNAMIC_TYPE ( + EBookShellSidebar, + e_book_shell_sidebar, + E_TYPE_SHELL_SIDEBAR) static void book_shell_sidebar_get_property (GObject *object, @@ -68,7 +74,7 @@ book_shell_sidebar_dispose (GObject *object) { EBookShellSidebarPrivate *priv; - priv = E_BOOK_SHELL_SIDEBAR (object)->priv; + priv = E_BOOK_SHELL_SIDEBAR_GET_PRIVATE (object); if (priv->selector != NULL) { g_object_unref (priv->selector); @@ -76,7 +82,7 @@ book_shell_sidebar_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_book_shell_sidebar_parent_class)->dispose (object); } static void @@ -92,10 +98,10 @@ book_shell_sidebar_constructed (GObject *object) GtkContainer *container; GtkWidget *widget; - priv = E_BOOK_SHELL_SIDEBAR (object)->priv; + priv = E_BOOK_SHELL_SIDEBAR_GET_PRIVATE (object); /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_book_shell_sidebar_parent_class)->constructed (object); shell_sidebar = E_SHELL_SIDEBAR (object); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); @@ -174,12 +180,11 @@ book_shell_sidebar_check_state (EShellSidebar *shell_sidebar) } static void -book_shell_sidebar_class_init (EBookShellSidebarClass *class) +e_book_shell_sidebar_class_init (EBookShellSidebarClass *class) { GObjectClass *object_class; EShellSidebarClass *shell_sidebar_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EBookShellSidebarPrivate)); object_class = G_OBJECT_CLASS (class); @@ -202,40 +207,26 @@ book_shell_sidebar_class_init (EBookShellSidebarClass *class) } static void -book_shell_sidebar_init (EBookShellSidebar *book_shell_sidebar) +e_book_shell_sidebar_class_finalize (EBookShellSidebarClass *class) { - book_shell_sidebar->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - book_shell_sidebar, E_TYPE_BOOK_SHELL_SIDEBAR, - EBookShellSidebarPrivate); - - /* Postpone widget construction until we have a shell view. */ } -GType -e_book_shell_sidebar_get_type (void) +static void +e_book_shell_sidebar_init (EBookShellSidebar *book_shell_sidebar) { - return book_shell_sidebar_type; + book_shell_sidebar->priv = + E_BOOK_SHELL_SIDEBAR_GET_PRIVATE (book_shell_sidebar); + + /* Postpone widget construction until we have a shell view. */ } void -e_book_shell_sidebar_register_type (GTypeModule *type_module) +e_book_shell_sidebar_type_register (GTypeModule *type_module) { - static const GTypeInfo type_info = { - sizeof (EBookShellSidebarClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) book_shell_sidebar_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EBookShellSidebar), - 0, /* n_preallocs */ - (GInstanceInitFunc) book_shell_sidebar_init, - NULL /* value_table */ - }; - - book_shell_sidebar_type = g_type_module_register_type ( - type_module, E_TYPE_SHELL_SIDEBAR, - "EBookShellSidebar", &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_book_shell_sidebar_register_type (type_module); } GtkWidget * diff --git a/modules/addressbook/e-book-shell-sidebar.h b/modules/addressbook/e-book-shell-sidebar.h index 560609f53d..104a4d4b47 100644 --- a/modules/addressbook/e-book-shell-sidebar.h +++ b/modules/addressbook/e-book-shell-sidebar.h @@ -68,7 +68,7 @@ struct _EBookShellSidebarClass { }; GType e_book_shell_sidebar_get_type (void); -void e_book_shell_sidebar_register_type +void e_book_shell_sidebar_type_register (GTypeModule *type_module); GtkWidget * e_book_shell_sidebar_new (EShellView *shell_view); diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c index 73736052ff..2aa0e1a94b 100644 --- a/modules/addressbook/e-book-shell-view-actions.c +++ b/modules/addressbook/e-book-shell-view-actions.c @@ -278,9 +278,11 @@ map_window_show_contact_editor_cb (EContactMapWindow *window, editor = e_contact_editor_new (shell, book_client, contact, FALSE, TRUE); - g_signal_connect (editor, "contact-modified", + g_signal_connect ( + editor, "contact-modified", G_CALLBACK (contact_editor_contact_modified_cb), window); - g_signal_connect_swapped (editor, "editor-closed", + g_signal_connect_swapped ( + editor, "editor-closed", G_CALLBACK (g_object_unref), editor); eab_editor_show (editor); @@ -317,9 +319,11 @@ action_address_book_map_cb (GtkAction *action, e_contact_map_window_load_addressbook (map_window, book_client); /* Free the map_window automatically when it is closed */ - g_signal_connect_swapped (GTK_WIDGET (map_window), "hide", + g_signal_connect_swapped ( + map_window, "hide", G_CALLBACK (gtk_widget_destroy), GTK_WIDGET (map_window)); - g_signal_connect (map_window, "show-contact-editor", + g_signal_connect ( + map_window, "show-contact-editor", G_CALLBACK (map_window_show_contact_editor_cb), book_shell_view); gtk_widget_show_all (GTK_WIDGET (map_window)); @@ -1149,7 +1153,6 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view) GtkActionGroup *action_group; GSettings *settings; GtkAction *action; - GObject *object; shell_view = E_SHELL_VIEW (book_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); @@ -1209,14 +1212,20 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view) settings = g_settings_new ("org.gnome.evolution.addressbook"); - object = G_OBJECT (ACTION (CONTACT_PREVIEW)); - g_settings_bind (settings, "show-preview", object, "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "show-preview", + ACTION (CONTACT_PREVIEW), "active", + G_SETTINGS_BIND_DEFAULT); - object = G_OBJECT (ACTION (CONTACT_VIEW_VERTICAL)); - g_settings_bind (settings, "layout", object, "current-value", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "layout", + ACTION (CONTACT_VIEW_VERTICAL), "current-value", + G_SETTINGS_BIND_DEFAULT); - object = G_OBJECT (ACTION (CONTACT_PREVIEW_SHOW_MAPS)); - g_settings_bind (settings, "preview-show-maps", object, "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "preview-show-maps", + ACTION (CONTACT_PREVIEW_SHOW_MAPS), "active", + G_SETTINGS_BIND_DEFAULT); g_object_unref (settings); diff --git a/modules/addressbook/e-book-shell-view-private.h b/modules/addressbook/e-book-shell-view-private.h index 408574d53a..d1b30efec4 100644 --- a/modules/addressbook/e-book-shell-view-private.h +++ b/modules/addressbook/e-book-shell-view-private.h @@ -54,6 +54,10 @@ #include "e-book-shell-sidebar.h" #include "e-book-shell-view-actions.h" +#define E_BOOK_SHELL_VIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_BOOK_SHELL_VIEW, EBookShellViewPrivate)) + /* Shorthand, requires a variable named "shell_window". */ #define ACTION(name) \ (E_SHELL_WINDOW_ACTION_##name (shell_window)) diff --git a/modules/addressbook/e-book-shell-view.c b/modules/addressbook/e-book-shell-view.c index f0541eb40c..84526e4a98 100644 --- a/modules/addressbook/e-book-shell-view.c +++ b/modules/addressbook/e-book-shell-view.c @@ -145,7 +145,7 @@ book_shell_view_execute_search (EShellView *shell_view) gchar *search_text = NULL; EFilterRule *advanced_search = NULL; - priv = E_BOOK_SHELL_VIEW (shell_view)->priv; + priv = E_BOOK_SHELL_VIEW_GET_PRIVATE (shell_view); if (priv->search_locked) return; @@ -415,9 +415,8 @@ static void book_shell_view_init (EBookShellView *book_shell_view, EShellViewClass *shell_view_class) { - book_shell_view->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - book_shell_view, E_TYPE_BOOK_SHELL_VIEW, - EBookShellViewPrivate); + book_shell_view->priv = + E_BOOK_SHELL_VIEW_GET_PRIVATE (book_shell_view); e_book_shell_view_private_init (book_shell_view, shell_view_class); } diff --git a/modules/addressbook/evolution-module-addressbook.c b/modules/addressbook/evolution-module-addressbook.c index f38c8e23bf..1caf7ddf08 100644 --- a/modules/addressbook/evolution-module-addressbook.c +++ b/modules/addressbook/evolution-module-addressbook.c @@ -25,10 +25,10 @@ #include "e-book-config-hook.h" +#include "e-book-shell-view.h" #include "e-book-shell-backend.h" #include "e-book-shell-content.h" #include "e-book-shell-sidebar.h" -#include "e-book-shell-view.h" /* Module Entry Points */ void e_module_load (GTypeModule *type_module); @@ -41,10 +41,10 @@ e_module_load (GTypeModule *type_module) e_book_config_hook_register_type (type_module); - e_book_shell_backend_register_type (type_module); - e_book_shell_content_register_type (type_module); - e_book_shell_sidebar_register_type (type_module); e_book_shell_view_register_type (type_module); + e_book_shell_backend_type_register (type_module); + e_book_shell_content_type_register (type_module); + e_book_shell_sidebar_type_register (type_module); } G_MODULE_EXPORT void diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 74bc62daa8..6541863b32 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -55,6 +55,10 @@ #include "e-calendar-preferences.h" +#define E_CAL_SHELL_BACKEND_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CAL_SHELL_BACKEND, ECalShellBackendPrivate)) + struct _ECalShellBackendPrivate { ESourceList *source_list; }; @@ -64,8 +68,10 @@ enum { PROP_SOURCE_LIST }; -static gpointer parent_class; -static GType cal_shell_backend_type; +G_DEFINE_DYNAMIC_TYPE ( + ECalShellBackend, + e_cal_shell_backend, + E_TYPE_SHELL_BACKEND) static void cal_shell_backend_ensure_sources (EShellBackend *shell_backend) @@ -741,7 +747,7 @@ cal_shell_backend_dispose (GObject *object) { ECalShellBackendPrivate *priv; - priv = E_CAL_SHELL_BACKEND (object)->priv; + priv = E_CAL_SHELL_BACKEND_GET_PRIVATE (object); if (priv->source_list != NULL) { g_object_unref (priv->source_list); @@ -749,7 +755,7 @@ cal_shell_backend_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_cal_shell_backend_parent_class)->dispose (object); } static void @@ -790,16 +796,15 @@ cal_shell_backend_constructed (GObject *object) 600); /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_cal_shell_backend_parent_class)->constructed (object); } static void -cal_shell_backend_class_init (ECalShellBackendClass *class) +e_cal_shell_backend_class_init (ECalShellBackendClass *class) { GObjectClass *object_class; EShellBackendClass *shell_backend_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ECalShellBackendPrivate)); object_class = G_OBJECT_CLASS (class); @@ -829,14 +834,18 @@ cal_shell_backend_class_init (ECalShellBackendClass *class) } static void -cal_shell_backend_init (ECalShellBackend *cal_shell_backend) +e_cal_shell_backend_class_finalize (ECalShellBackendClass *class) +{ +} + +static void +e_cal_shell_backend_init (ECalShellBackend *cal_shell_backend) { icalarray *builtin_timezones; gint ii; - cal_shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - cal_shell_backend, E_TYPE_CAL_SHELL_BACKEND, - ECalShellBackendPrivate); + cal_shell_backend->priv = + E_CAL_SHELL_BACKEND_GET_PRIVATE (cal_shell_backend); /* XXX Pre-load all built-in timezones in libical. * @@ -862,31 +871,13 @@ cal_shell_backend_init (ECalShellBackend *cal_shell_backend) } } -GType -e_cal_shell_backend_get_type (void) -{ - return cal_shell_backend_type; -} - void -e_cal_shell_backend_register_type (GTypeModule *type_module) +e_cal_shell_backend_type_register (GTypeModule *type_module) { - const GTypeInfo type_info = { - sizeof (ECalShellBackendClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) cal_shell_backend_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ECalShellBackend), - 0, /* n_preallocs */ - (GInstanceInitFunc) cal_shell_backend_init, - NULL /* value_table */ - }; - - cal_shell_backend_type = g_type_module_register_type ( - type_module, E_TYPE_SHELL_BACKEND, - "ECalShellBackend", &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_backend_register_type (type_module); } ESourceList * @@ -915,7 +906,8 @@ e_cal_shell_backend_get_selected_calendars (ECalShellBackend *cal_shell_backend) if (strv != NULL) { for (ii = 0; strv[ii] != NULL; ii++) - selected_calendars = g_slist_append (selected_calendars, g_strdup (strv[ii])); + selected_calendars = g_slist_append ( + selected_calendars, g_strdup (strv[ii])); g_strfreev (strv); } @@ -938,7 +930,9 @@ e_cal_shell_backend_set_selected_calendars (ECalShellBackend *cal_shell_backend, g_ptr_array_add (array, NULL); settings = g_settings_new ("org.gnome.evolution.calendar"); - g_settings_set_strv (settings, "selected-calendars", (const gchar *const *) array->pdata); + g_settings_set_strv ( + settings, "selected-calendars", + (const gchar *const *) array->pdata); g_object_unref (settings); g_ptr_array_free (array, FALSE); diff --git a/modules/calendar/e-cal-shell-backend.h b/modules/calendar/e-cal-shell-backend.h index 32fca7f53b..0907c7edee 100644 --- a/modules/calendar/e-cal-shell-backend.h +++ b/modules/calendar/e-cal-shell-backend.h @@ -60,7 +60,7 @@ struct _ECalShellBackendClass { }; GType e_cal_shell_backend_get_type (void); -void e_cal_shell_backend_register_type +void e_cal_shell_backend_type_register (GTypeModule *type_module); ESourceList * e_cal_shell_backend_get_source_list (ECalShellBackend *cal_shell_backend); diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c index 5c2d1bd994..faa6422737 100644 --- a/modules/calendar/e-cal-shell-content.c +++ b/modules/calendar/e-cal-shell-content.c @@ -42,6 +42,10 @@ #include "e-cal-shell-view-private.h" +#define E_CAL_SHELL_CONTENT_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CAL_SHELL_CONTENT, ECalShellContentPrivate)) + struct _ECalShellContentPrivate { GtkWidget *hpaned; GtkWidget *notebook; @@ -69,8 +73,10 @@ typedef enum { FOCUS_OTHER } FocusLocation; -static gpointer parent_class; -static GType cal_shell_content_type; +G_DEFINE_DYNAMIC_TYPE ( + ECalShellContent, + e_cal_shell_content, + E_TYPE_SHELL_CONTENT) static void cal_shell_content_display_view_cb (ECalShellContent *cal_shell_content, @@ -127,7 +133,10 @@ cal_shell_content_notify_view_id_cb (ECalShellContent *cal_shell_content) g_settings_unbind (paned, "hposition"); - g_settings_bind (settings, key, G_OBJECT (paned), "hposition", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, key, + paned, "hposition", + G_SETTINGS_BIND_DEFAULT); g_object_unref (settings); } @@ -254,7 +263,7 @@ cal_shell_content_dispose (GObject *object) { ECalShellContentPrivate *priv; - priv = E_CAL_SHELL_CONTENT (object)->priv; + priv = E_CAL_SHELL_CONTENT_GET_PRIVATE (object); if (priv->hpaned != NULL) { g_object_unref (priv->hpaned); @@ -292,7 +301,7 @@ cal_shell_content_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_cal_shell_content_parent_class)->dispose (object); } static time_t @@ -331,10 +340,10 @@ cal_shell_content_constructed (GObject *object) gchar *markup; gint ii; - priv = E_CAL_SHELL_CONTENT (object)->priv; + priv = E_CAL_SHELL_CONTENT_GET_PRIVATE (object); /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_cal_shell_content_parent_class)->constructed (object); shell_content = E_SHELL_CONTENT (object); shell_view = e_shell_content_get_shell_view (shell_content); @@ -515,8 +524,10 @@ cal_shell_content_constructed (GObject *object) settings = g_settings_new ("org.gnome.evolution.calendar"); - object = G_OBJECT (priv->vpaned); - g_settings_bind (settings, "tag-vpane-position", object, "proportion", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "tag-vpane-position", + priv->vpaned, "proportion", + G_SETTINGS_BIND_DEFAULT); g_object_unref (settings); } @@ -538,11 +549,11 @@ cal_shell_content_map (GtkWidget *widget) * callback in GnomeCalendar that requires the date navigator. * Ordinarily we would do this at the end of constructed(), but * that's too soon in this case. (This feels kind of kludgy.) */ - priv = E_CAL_SHELL_CONTENT (widget)->priv; + priv = E_CAL_SHELL_CONTENT_GET_PRIVATE (widget); gal_view_instance_load (priv->view_instance); /* Chain up to parent's map() method. */ - GTK_WIDGET_CLASS (parent_class)->map (widget); + GTK_WIDGET_CLASS (e_cal_shell_content_parent_class)->map (widget); } static void @@ -562,13 +573,12 @@ cal_shell_content_focus_search_results (EShellContent *shell_content) } static void -cal_shell_content_class_init (ECalShellContentClass *class) +e_cal_shell_content_class_init (ECalShellContentClass *class) { GObjectClass *object_class; GtkWidgetClass *widget_class; EShellContentClass *shell_content_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ECalShellContentPrivate)); object_class = G_OBJECT_CLASS (class); @@ -615,40 +625,26 @@ cal_shell_content_class_init (ECalShellContentClass *class) } static void -cal_shell_content_init (ECalShellContent *cal_shell_content) +e_cal_shell_content_class_finalize (ECalShellContentClass *class) { - cal_shell_content->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - cal_shell_content, E_TYPE_CAL_SHELL_CONTENT, - ECalShellContentPrivate); - - /* Postpone widget construction until we have a shell view. */ } -GType -e_cal_shell_content_get_type (void) +static void +e_cal_shell_content_init (ECalShellContent *cal_shell_content) { - return cal_shell_content_type; + cal_shell_content->priv = + E_CAL_SHELL_CONTENT_GET_PRIVATE (cal_shell_content); + + /* Postpone widget construction until we have a shell view. */ } void -e_cal_shell_content_register_type (GTypeModule *type_module) +e_cal_shell_content_type_register (GTypeModule *type_module) { - static const GTypeInfo type_info = { - sizeof (ECalShellContentClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) cal_shell_content_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ECalShellContent), - 0, /* n_preallocs */ - (GInstanceInitFunc) cal_shell_content_init, - NULL /* value_table */ - }; - - cal_shell_content_type = g_type_module_register_type ( - type_module, E_TYPE_SHELL_CONTENT, - "ECalShellContent", &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_content_register_type (type_module); } GtkWidget * diff --git a/modules/calendar/e-cal-shell-content.h b/modules/calendar/e-cal-shell-content.h index 9ef66d968d..906fe80bc0 100644 --- a/modules/calendar/e-cal-shell-content.h +++ b/modules/calendar/e-cal-shell-content.h @@ -80,7 +80,7 @@ struct _ECalShellContentClass { }; GType e_cal_shell_content_get_type (void); -void e_cal_shell_content_register_type +void e_cal_shell_content_type_register (GTypeModule *type_module); GtkWidget * e_cal_shell_content_new (EShellView *shell_view); ECalModel * e_cal_shell_content_get_model diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index c73ca8ab77..8b91a4c22c 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -40,6 +40,10 @@ #include "e-cal-shell-backend.h" #include "e-cal-shell-content.h" +#define E_CAL_SHELL_SIDEBAR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebarPrivate)) + struct _ECalShellSidebarPrivate { GtkWidget *paned; GtkWidget *selector; @@ -75,9 +79,12 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static guint signals[LAST_SIGNAL]; -static GType cal_shell_sidebar_type; + +G_DEFINE_DYNAMIC_TYPE ( + ECalShellSidebar, + e_cal_shell_sidebar, + E_TYPE_SHELL_SIDEBAR) static void cal_shell_sidebar_emit_client_added (ECalShellSidebar *cal_shell_sidebar, @@ -347,7 +354,7 @@ cal_shell_sidebar_default_loaded_cb (GObject *source_object, EClient *client = NULL; GError *error = NULL; - priv = E_CAL_SHELL_SIDEBAR (shell_sidebar)->priv; + priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); @@ -527,7 +534,7 @@ cal_shell_sidebar_restore_state_cb (EShellWindow *shell_window, GSList *list, *iter; GObject *object; - priv = E_CAL_SHELL_SIDEBAR (shell_sidebar)->priv; + priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); shell = e_shell_window_get_shell (shell_window); shell_settings = e_shell_get_shell_settings (shell); @@ -630,7 +637,7 @@ cal_shell_sidebar_dispose (GObject *object) { ECalShellSidebarPrivate *priv; - priv = E_CAL_SHELL_SIDEBAR (object)->priv; + priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (object); if (priv->paned != NULL) { g_object_unref (priv->paned); @@ -667,7 +674,7 @@ cal_shell_sidebar_dispose (GObject *object) g_hash_table_remove_all (priv->client_table); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_cal_shell_sidebar_parent_class)->dispose (object); } static void @@ -675,12 +682,12 @@ cal_shell_sidebar_finalize (GObject *object) { ECalShellSidebarPrivate *priv; - priv = E_CAL_SHELL_SIDEBAR (object)->priv; + priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (object); g_hash_table_destroy (priv->client_table); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_cal_shell_sidebar_parent_class)->finalize (object); } static void @@ -712,10 +719,10 @@ cal_shell_sidebar_constructed (GObject *object) GtkWidget *widget; AtkObject *a11y; - priv = E_CAL_SHELL_SIDEBAR (object)->priv; + priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (object); /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_cal_shell_sidebar_parent_class)->constructed (object); shell_sidebar = E_SHELL_SIDEBAR (object); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); @@ -873,12 +880,11 @@ cal_shell_sidebar_client_removed (ECalShellSidebar *cal_shell_sidebar, } static void -cal_shell_sidebar_class_init (ECalShellSidebarClass *class) +e_cal_shell_sidebar_class_init (ECalShellSidebarClass *class) { GObjectClass *object_class; EShellSidebarClass *shell_sidebar_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ECalShellSidebarPrivate)); object_class = G_OBJECT_CLASS (class); @@ -954,7 +960,12 @@ cal_shell_sidebar_class_init (ECalShellSidebarClass *class) } static void -cal_shell_sidebar_init (ECalShellSidebar *cal_shell_sidebar) +e_cal_shell_sidebar_class_finalize (ECalShellSidebarClass *class) +{ +} + +static void +e_cal_shell_sidebar_init (ECalShellSidebar *cal_shell_sidebar) { GHashTable *client_table; @@ -963,9 +974,8 @@ cal_shell_sidebar_init (ECalShellSidebar *cal_shell_sidebar) (GDestroyNotify) g_free, (GDestroyNotify) g_object_unref); - cal_shell_sidebar->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - cal_shell_sidebar, E_TYPE_CAL_SHELL_SIDEBAR, - ECalShellSidebarPrivate); + cal_shell_sidebar->priv = + E_CAL_SHELL_SIDEBAR_GET_PRIVATE (cal_shell_sidebar); cal_shell_sidebar->priv->client_table = client_table; cal_shell_sidebar->priv->loading_clients = g_cancellable_new (); @@ -973,31 +983,13 @@ cal_shell_sidebar_init (ECalShellSidebar *cal_shell_sidebar) /* Postpone widget construction until we have a shell view. */ } -GType -e_cal_shell_sidebar_get_type (void) -{ - return cal_shell_sidebar_type; -} - void -e_cal_shell_sidebar_register_type (GTypeModule *type_module) +e_cal_shell_sidebar_type_register (GTypeModule *type_module) { - static const GTypeInfo type_info = { - sizeof (ECalShellSidebarClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) cal_shell_sidebar_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ECalShellSidebar), - 0, /* n_preallocs */ - (GInstanceInitFunc) cal_shell_sidebar_init, - NULL /* value_table */ - }; - - cal_shell_sidebar_type = g_type_module_register_type ( - type_module, E_TYPE_SHELL_SIDEBAR, - "ECalShellSidebar", &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_sidebar_register_type (type_module); } GtkWidget * diff --git a/modules/calendar/e-cal-shell-sidebar.h b/modules/calendar/e-cal-shell-sidebar.h index 3e4d00a87f..016ade2a7b 100644 --- a/modules/calendar/e-cal-shell-sidebar.h +++ b/modules/calendar/e-cal-shell-sidebar.h @@ -70,16 +70,18 @@ struct _ECalShellSidebarClass { EShellSidebarClass parent_class; /* Signals */ - void (*client_added) (ECalShellSidebar *cal_shell_sidebar, - ECalClient *client); - void (*client_removed) (ECalShellSidebar *cal_shell_sidebar, - ECalClient *client); - void (*status_message) (ECalShellSidebar *cal_shell_sidebar, - const gchar *status_message); + void (*client_added) (ECalShellSidebar *cal_shell_sidebar, + ECalClient *client); + void (*client_removed) + (ECalShellSidebar *cal_shell_sidebar, + ECalClient *client); + void (*status_message) + (ECalShellSidebar *cal_shell_sidebar, + const gchar *status_message); }; GType e_cal_shell_sidebar_get_type (void); -void e_cal_shell_sidebar_register_type +void e_cal_shell_sidebar_type_register (GTypeModule *type_module); GtkWidget * e_cal_shell_sidebar_new (EShellView *shell_view); GList * e_cal_shell_sidebar_get_clients diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c index c2f39c5f9b..37cdc0738b 100644 --- a/modules/calendar/e-cal-shell-view-private.c +++ b/modules/calendar/e-cal-shell-view-private.c @@ -249,7 +249,7 @@ cal_shell_view_popup_event_cb (EShellView *shell_view, const gchar *widget_path; gint n_selected; - priv = E_CAL_SHELL_VIEW (shell_view)->priv; + priv = E_CAL_SHELL_VIEW_GET_PRIVATE (shell_view); calendar = e_cal_shell_content_get_calendar (priv->cal_shell_content); @@ -490,10 +490,10 @@ init_timezone_monitors (ECalShellView *view) g_object_unref (file); if (priv->monitors[i]) - g_signal_connect_object (G_OBJECT (priv->monitors[i]), - "changed", - G_CALLBACK (system_timezone_monitor_changed), - view, 0); + g_signal_connect_object ( + priv->monitors[i], "changed", + G_CALLBACK (system_timezone_monitor_changed), + view, 0); } } diff --git a/modules/calendar/e-cal-shell-view-private.h b/modules/calendar/e-cal-shell-view-private.h index 6653632662..27aaca6e9e 100644 --- a/modules/calendar/e-cal-shell-view-private.h +++ b/modules/calendar/e-cal-shell-view-private.h @@ -64,6 +64,10 @@ #include "e-cal-shell-sidebar.h" #include "e-cal-shell-view-actions.h" +#define E_CAL_SHELL_VIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CAL_SHELL_VIEW, ECalShellViewPrivate)) + /* Shorthand, requires a variable named "shell_window". */ #define ACTION(name) \ (E_SHELL_WINDOW_ACTION_##name (shell_window)) diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index f644402080..ad3477c5ea 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -171,7 +171,9 @@ cal_shell_view_execute_search (EShellView *shell_view) end = isodate_from_time_t (end_range); temp = g_strdup_printf ( - "(and %s (occur-in-time-range? (make-time \"%s\") (make-time \"%s\") \"%s\"))", + "(and %s (occur-in-time-range? " + "(make-time \"%s\") " + "(make-time \"%s\") \"%s\"))", query, start, end, default_tzloc); g_free (query); query = temp; @@ -186,7 +188,9 @@ cal_shell_view_execute_search (EShellView *shell_view) end = isodate_from_time_t (end_range); temp = g_strdup_printf ( - "(and %s (occur-in-time-range? (make-time \"%s\") (make-time \"%s\") \"%s\"))", + "(and %s (occur-in-time-range? " + "(make-time \"%s\") " + "(make-time \"%s\") \"%s\"))", query, start, end, default_tzloc); g_free (query); query = temp; @@ -195,7 +199,8 @@ cal_shell_view_execute_search (EShellView *shell_view) break; case CALENDAR_FILTER_OCCURS_LESS_THAN_5_TIMES: - temp = g_strdup_printf ("(and %s (< (occurrences-count?) 5))", query); + temp = g_strdup_printf ( + "(and %s (< (occurrences-count?) 5))", query); g_free (query); query = temp; break; @@ -334,7 +339,7 @@ cal_shell_view_update_actions (EShellView *shell_view) /* Chain up to parent's update_actions() method. */ E_SHELL_VIEW_CLASS (parent_class)->update_actions (shell_view); - priv = E_CAL_SHELL_VIEW (shell_view)->priv; + priv = E_CAL_SHELL_VIEW_GET_PRIVATE (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); shell = e_shell_window_get_shell (shell_window); @@ -543,8 +548,8 @@ static void cal_shell_view_init (ECalShellView *cal_shell_view, EShellViewClass *shell_view_class) { - cal_shell_view->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - cal_shell_view, E_TYPE_CAL_SHELL_VIEW, ECalShellViewPrivate); + 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); } diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c index c83c0fdfd9..93d2084885 100644 --- a/modules/calendar/e-memo-shell-backend.c +++ b/modules/calendar/e-memo-shell-backend.c @@ -48,6 +48,10 @@ #define WEB_BASE_URI "webcal://" #define PERSONAL_RELATIVE_URI "system" +#define E_MEMO_SHELL_BACKEND_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MEMO_SHELL_BACKEND, EMemoShellBackendPrivate)) + struct _EMemoShellBackendPrivate { ESourceList *source_list; }; @@ -57,8 +61,10 @@ enum { PROP_SOURCE_LIST }; -static gpointer parent_class; -static GType memo_shell_backend_type; +G_DEFINE_DYNAMIC_TYPE ( + EMemoShellBackend, + e_memo_shell_backend, + E_TYPE_SHELL_BACKEND) static void memo_shell_backend_ensure_sources (EShellBackend *shell_backend) @@ -527,7 +533,7 @@ memo_shell_backend_dispose (GObject *object) { EMemoShellBackendPrivate *priv; - priv = E_MEMO_SHELL_BACKEND (object)->priv; + priv = E_MEMO_SHELL_BACKEND_GET_PRIVATE (object); if (priv->source_list != NULL) { g_object_unref (priv->source_list); @@ -535,7 +541,7 @@ memo_shell_backend_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_memo_shell_backend_parent_class)->dispose (object); } static void @@ -560,16 +566,15 @@ memo_shell_backend_constructed (GObject *object) shell_backend); /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_memo_shell_backend_parent_class)->constructed (object); } static void -memo_shell_backend_class_init (EMemoShellBackendClass *class) +e_memo_shell_backend_class_init (EMemoShellBackendClass *class) { GObjectClass *object_class; EShellBackendClass *shell_backend_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EMemoShellBackendPrivate)); object_class = G_OBJECT_CLASS (class); @@ -599,38 +604,24 @@ memo_shell_backend_class_init (EMemoShellBackendClass *class) } static void -memo_shell_backend_init (EMemoShellBackend *memo_shell_backend) +e_memo_shell_backend_class_finalize (EMemoShellBackendClass *class) { - memo_shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - memo_shell_backend, E_TYPE_MEMO_SHELL_BACKEND, - EMemoShellBackendPrivate); } -GType -e_memo_shell_backend_get_type (void) +static void +e_memo_shell_backend_init (EMemoShellBackend *memo_shell_backend) { - return memo_shell_backend_type; + memo_shell_backend->priv = + E_MEMO_SHELL_BACKEND_GET_PRIVATE (memo_shell_backend); } void -e_memo_shell_backend_register_type (GTypeModule *type_module) +e_memo_shell_backend_type_register (GTypeModule *type_module) { - const GTypeInfo type_info = { - sizeof (EMemoShellBackendClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) memo_shell_backend_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMemoShellBackend), - 0, /* n_preallocs */ - (GInstanceInitFunc) memo_shell_backend_init, - NULL /* value_table */ - }; - - memo_shell_backend_type = g_type_module_register_type ( - type_module, E_TYPE_SHELL_BACKEND, - "EMemoShellBackend", &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_memo_shell_backend_register_type (type_module); } ESourceList * @@ -659,7 +650,8 @@ e_memo_shell_backend_get_selected_memo_lists (EMemoShellBackend *memo_shell_back if (strv != NULL) { for (ii = 0; strv[ii] != NULL; ii++) - selected_memo_lists = g_slist_append (selected_memo_lists, g_strdup (strv[ii])); + selected_memo_lists = g_slist_append ( + selected_memo_lists, g_strdup (strv[ii])); g_strfreev (strv); } @@ -682,7 +674,9 @@ e_memo_shell_backend_set_selected_memo_lists (EMemoShellBackend *memo_shell_back g_ptr_array_add (array, NULL); settings = g_settings_new ("org.gnome.evolution.calendar"); - g_settings_set_strv (settings, "selected-memos", (const gchar *const *) array->pdata); + g_settings_set_strv ( + settings, "selected-memos", + (const gchar *const *) array->pdata); g_object_unref (settings); g_ptr_array_free (array, FALSE); diff --git a/modules/calendar/e-memo-shell-backend.h b/modules/calendar/e-memo-shell-backend.h index 8a005c4385..5bf66b37a3 100644 --- a/modules/calendar/e-memo-shell-backend.h +++ b/modules/calendar/e-memo-shell-backend.h @@ -60,7 +60,7 @@ struct _EMemoShellBackendClass { }; GType e_memo_shell_backend_get_type (void); -void e_memo_shell_backend_register_type +void e_memo_shell_backend_type_register (GTypeModule *type_module); ESourceList * e_memo_shell_backend_get_source_list (EMemoShellBackend *memo_shell_backend); diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c index 60936ccb8c..528db0911b 100644 --- a/modules/calendar/e-memo-shell-content.c +++ b/modules/calendar/e-memo-shell-content.c @@ -38,6 +38,10 @@ #include "calendar/gui/e-cal-model-memos.h" #include "calendar/gui/e-memo-table.h" +#define E_MEMO_SHELL_CONTENT_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MEMO_SHELL_CONTENT, EMemoShellContentPrivate)) + #define E_MEMO_TABLE_DEFAULT_STATE \ "<?xml version=\"1.0\"?>" \ "<ETableState>" \ @@ -68,8 +72,13 @@ enum { PROP_PREVIEW_VISIBLE }; -static gpointer parent_class; -static GType memo_shell_content_type; +G_DEFINE_DYNAMIC_TYPE_EXTENDED ( + EMemoShellContent, + e_memo_shell_content, + E_TYPE_SHELL_CONTENT, + 0, + G_IMPLEMENT_INTERFACE_DYNAMIC ( + GTK_TYPE_ORIENTABLE, NULL)) static void memo_shell_content_display_view_cb (EMemoShellContent *memo_shell_content, @@ -273,19 +282,22 @@ memo_shell_content_restore_state_cb (EShellWindow *shell_window, { EMemoShellContentPrivate *priv; GSettings *settings; - GObject *object; - priv = E_MEMO_SHELL_CONTENT (shell_content)->priv; + priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (shell_content); /* Bind GObject properties to settings keys. */ settings = g_settings_new ("org.gnome.evolution.calendar"); - object = G_OBJECT (priv->paned); - g_settings_bind (settings, "memo-hpane-position", object, "hposition", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "memo-hpane-position", + priv->paned, "hposition", + G_SETTINGS_BIND_DEFAULT); - object = G_OBJECT (priv->paned); - g_settings_bind (settings, "memo-vpane-position", object, "vposition", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "memo-vpane-position", + priv->paned, "vposition", + G_SETTINGS_BIND_DEFAULT); } static GtkOrientation @@ -363,7 +375,7 @@ memo_shell_content_dispose (GObject *object) { EMemoShellContentPrivate *priv; - priv = E_MEMO_SHELL_CONTENT (object)->priv; + priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (object); if (priv->paned != NULL) { g_object_unref (priv->paned); @@ -391,7 +403,7 @@ memo_shell_content_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_memo_shell_content_parent_class)->dispose (object); } static void @@ -399,12 +411,12 @@ memo_shell_content_finalize (GObject *object) { EMemoShellContentPrivate *priv; - priv = E_MEMO_SHELL_CONTENT (object)->priv; + priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (object); g_free (priv->current_uid); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_memo_shell_content_parent_class)->finalize (object); } static void @@ -422,10 +434,10 @@ memo_shell_content_constructed (GObject *object) GtkWidget *widget; gint n_targets; - priv = E_MEMO_SHELL_CONTENT (object)->priv; + priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (object); /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_memo_shell_content_parent_class)->constructed (object); shell_content = E_SHELL_CONTENT (object); shell_view = e_shell_content_get_shell_view (shell_content); @@ -597,18 +609,17 @@ memo_shell_content_focus_search_results (EShellContent *shell_content) { EMemoShellContentPrivate *priv; - priv = E_MEMO_SHELL_CONTENT (shell_content)->priv; + priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (shell_content); gtk_widget_grab_focus (priv->memo_table); } static void -memo_shell_content_class_init (EMemoShellContentClass *class) +e_memo_shell_content_class_init (EMemoShellContentClass *class) { GObjectClass *object_class; EShellContentClass *shell_content_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EMemoShellContentPrivate)); object_class = G_OBJECT_CLASS (class); @@ -649,50 +660,26 @@ memo_shell_content_class_init (EMemoShellContentClass *class) } static void -memo_shell_content_init (EMemoShellContent *memo_shell_content) +e_memo_shell_content_class_finalize (EMemoShellContentClass *class) { - memo_shell_content->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - memo_shell_content, E_TYPE_MEMO_SHELL_CONTENT, - EMemoShellContentPrivate); - - /* Postpone widget construction until we have a shell view. */ } -GType -e_memo_shell_content_get_type (void) +static void +e_memo_shell_content_init (EMemoShellContent *memo_shell_content) { - return memo_shell_content_type; + memo_shell_content->priv = + E_MEMO_SHELL_CONTENT_GET_PRIVATE (memo_shell_content); + + /* Postpone widget construction until we have a shell view. */ } void -e_memo_shell_content_register_type (GTypeModule *type_module) +e_memo_shell_content_type_register (GTypeModule *type_module) { - static const GTypeInfo type_info = { - sizeof (EMemoShellContentClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) memo_shell_content_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMemoShellContent), - 0, /* n_preallocs */ - (GInstanceInitFunc) memo_shell_content_init, - NULL /* value_table */ - }; - - static const GInterfaceInfo orientable_info = { - (GInterfaceInitFunc) NULL, - (GInterfaceFinalizeFunc) NULL, - NULL /* interface_data */ - }; - - memo_shell_content_type = g_type_module_register_type ( - type_module, E_TYPE_SHELL_CONTENT, - "EMemoShellContent", &type_info, 0); - - g_type_module_add_interface ( - type_module, memo_shell_content_type, - GTK_TYPE_ORIENTABLE, &orientable_info); + /* 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_memo_shell_content_register_type (type_module); } GtkWidget * diff --git a/modules/calendar/e-memo-shell-content.h b/modules/calendar/e-memo-shell-content.h index 3ab68db440..18ee590fc7 100644 --- a/modules/calendar/e-memo-shell-content.h +++ b/modules/calendar/e-memo-shell-content.h @@ -73,7 +73,7 @@ struct _EMemoShellContentClass { }; GType e_memo_shell_content_get_type (void); -void e_memo_shell_content_register_type +void e_memo_shell_content_type_register (GTypeModule *type_module); GtkWidget * e_memo_shell_content_new (EShellView *shell_view); diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index df9ea9a59a..9763a5d9e0 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -39,6 +39,10 @@ #include "e-memo-shell-backend.h" #include "e-memo-shell-content.h" +#define E_MEMO_SHELL_SIDEBAR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MEMO_SHELL_SIDEBAR, EMemoShellSidebarPrivate)) + struct _EMemoShellSidebarPrivate { GtkWidget *selector; @@ -71,9 +75,12 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static guint signals[LAST_SIGNAL]; -static GType memo_shell_sidebar_type; + +G_DEFINE_DYNAMIC_TYPE ( + EMemoShellSidebar, + e_memo_shell_sidebar, + E_TYPE_SHELL_SIDEBAR) static void memo_shell_sidebar_emit_client_added (EMemoShellSidebar *memo_shell_sidebar, @@ -342,7 +349,7 @@ memo_shell_sidebar_default_loaded_cb (GObject *source_object, EClient *client = NULL; GError *error = NULL; - priv = E_MEMO_SHELL_SIDEBAR (shell_sidebar)->priv; + priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); @@ -520,7 +527,7 @@ memo_shell_sidebar_restore_state_cb (EShellWindow *shell_window, GtkTreeModel *model; GSList *list, *iter; - priv = E_MEMO_SHELL_SIDEBAR (shell_sidebar)->priv; + priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); shell = e_shell_window_get_shell (shell_window); shell_settings = e_shell_get_shell_settings (shell); @@ -607,7 +614,7 @@ memo_shell_sidebar_dispose (GObject *object) { EMemoShellSidebarPrivate *priv; - priv = E_MEMO_SHELL_SIDEBAR (object)->priv; + priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (object); if (priv->selector != NULL) { g_object_unref (priv->selector); @@ -634,7 +641,7 @@ memo_shell_sidebar_dispose (GObject *object) g_hash_table_remove_all (priv->client_table); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_memo_shell_sidebar_parent_class)->dispose (object); } static void @@ -642,12 +649,12 @@ memo_shell_sidebar_finalize (GObject *object) { EMemoShellSidebarPrivate *priv; - priv = E_MEMO_SHELL_SIDEBAR (object)->priv; + priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (object); g_hash_table_destroy (priv->client_table); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_memo_shell_sidebar_parent_class)->finalize (object); } static void @@ -663,10 +670,10 @@ memo_shell_sidebar_constructed (GObject *object) GtkWidget *widget; AtkObject *a11y; - priv = E_MEMO_SHELL_SIDEBAR (object)->priv; + priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (object); /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_memo_shell_sidebar_parent_class)->constructed (object); shell_sidebar = E_SHELL_SIDEBAR (object); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); @@ -778,12 +785,11 @@ memo_shell_sidebar_client_removed (EMemoShellSidebar *memo_shell_sidebar, } static void -memo_shell_sidebar_class_init (EMemoShellSidebarClass *class) +e_memo_shell_sidebar_class_init (EMemoShellSidebarClass *class) { GObjectClass *object_class; EShellSidebarClass *shell_sidebar_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EMemoShellSidebarPrivate)); object_class = G_OBJECT_CLASS (class); @@ -850,7 +856,12 @@ memo_shell_sidebar_class_init (EMemoShellSidebarClass *class) } static void -memo_shell_sidebar_init (EMemoShellSidebar *memo_shell_sidebar) +e_memo_shell_sidebar_class_finalize (EMemoShellSidebarClass *class) +{ +} + +static void +e_memo_shell_sidebar_init (EMemoShellSidebar *memo_shell_sidebar) { GHashTable *client_table; @@ -859,9 +870,8 @@ memo_shell_sidebar_init (EMemoShellSidebar *memo_shell_sidebar) (GDestroyNotify) g_free, (GDestroyNotify) g_object_unref); - memo_shell_sidebar->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - memo_shell_sidebar, E_TYPE_MEMO_SHELL_SIDEBAR, - EMemoShellSidebarPrivate); + memo_shell_sidebar->priv = + E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (memo_shell_sidebar); memo_shell_sidebar->priv->client_table = client_table; memo_shell_sidebar->priv->loading_clients = g_cancellable_new (); @@ -869,31 +879,13 @@ memo_shell_sidebar_init (EMemoShellSidebar *memo_shell_sidebar) /* Postpone widget construction until we have a shell view. */ } -GType -e_memo_shell_sidebar_get_type (void) -{ - return memo_shell_sidebar_type; -} - void -e_memo_shell_sidebar_register_type (GTypeModule *type_module) +e_memo_shell_sidebar_type_register (GTypeModule *type_module) { - static const GTypeInfo type_info = { - sizeof (EMemoShellSidebarClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) memo_shell_sidebar_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMemoShellSidebar), - 0, /* n_preallocs */ - (GInstanceInitFunc) memo_shell_sidebar_init, - NULL /* value_table */ - }; - - memo_shell_sidebar_type = g_type_module_register_type ( - type_module, E_TYPE_SHELL_SIDEBAR, - "EMemoShellSidebar", &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_memo_shell_sidebar_register_type (type_module); } GtkWidget * diff --git a/modules/calendar/e-memo-shell-sidebar.h b/modules/calendar/e-memo-shell-sidebar.h index 24e73f11d1..f233aef290 100644 --- a/modules/calendar/e-memo-shell-sidebar.h +++ b/modules/calendar/e-memo-shell-sidebar.h @@ -69,17 +69,19 @@ struct _EMemoShellSidebarClass { EShellSidebarClass parent_class; /* Signals */ - void (*client_added) (EMemoShellSidebar *memo_shell_sidebar, - ECalClient *client); - void (*client_removed) (EMemoShellSidebar *memo_shell_sidebar, - ECalClient *client); - void (*status_message) (EMemoShellSidebar *memo_shell_sidebar, - const gchar *status_message, - gdouble percent); + void (*client_added) (EMemoShellSidebar *memo_shell_sidebar, + ECalClient *client); + void (*client_removed) + (EMemoShellSidebar *memo_shell_sidebar, + ECalClient *client); + void (*status_message) + (EMemoShellSidebar *memo_shell_sidebar, + const gchar *status_message, + gdouble percent); }; GType e_memo_shell_sidebar_get_type (void); -void e_memo_shell_sidebar_register_type +void e_memo_shell_sidebar_type_register (GTypeModule *type_module); GtkWidget * e_memo_shell_sidebar_new (EShellView *shell_view); diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c index 3a0874616f..f8715eebb1 100644 --- a/modules/calendar/e-memo-shell-view-actions.c +++ b/modules/calendar/e-memo-shell-view-actions.c @@ -865,7 +865,6 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view) GtkActionGroup *action_group; GSettings *memo_settings; GtkAction *action; - GObject *object; shell_view = E_SHELL_VIEW (memo_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); @@ -925,11 +924,15 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view) memo_settings = g_settings_new ("org.gnome.evolution.calendar"); - object = G_OBJECT (ACTION (MEMO_PREVIEW)); - g_settings_bind (memo_settings, "show-memo-preview", object, "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + memo_settings, "show-memo-preview", + ACTION (MEMO_PREVIEW), "active", + G_SETTINGS_BIND_DEFAULT); - object = G_OBJECT (ACTION (MEMO_VIEW_VERTICAL)); - g_settings_bind (memo_settings, "memo-layout", object, "current-value", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + memo_settings, "memo-layout", + ACTION (MEMO_VIEW_VERTICAL), "current-value", + G_SETTINGS_BIND_DEFAULT); g_object_unref (G_OBJECT (memo_settings)); diff --git a/modules/calendar/e-memo-shell-view-private.h b/modules/calendar/e-memo-shell-view-private.h index 444bc0f307..85b2418439 100644 --- a/modules/calendar/e-memo-shell-view-private.h +++ b/modules/calendar/e-memo-shell-view-private.h @@ -49,6 +49,10 @@ #include "e-memo-shell-sidebar.h" #include "e-memo-shell-view-actions.h" +#define E_MEMO_SHELL_VIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MEMO_SHELL_VIEW, EMemoShellViewPrivate)) + /* Shorthand, requires a variable named "shell_window". */ #define ACTION(name) \ (E_SHELL_WINDOW_ACTION_##name (shell_window)) diff --git a/modules/calendar/e-memo-shell-view.c b/modules/calendar/e-memo-shell-view.c index 6679b3436b..acf95e92f3 100644 --- a/modules/calendar/e-memo-shell-view.c +++ b/modules/calendar/e-memo-shell-view.c @@ -306,9 +306,8 @@ static void memo_shell_view_init (EMemoShellView *memo_shell_view, EShellViewClass *shell_view_class) { - memo_shell_view->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - memo_shell_view, E_TYPE_MEMO_SHELL_VIEW, - EMemoShellViewPrivate); + memo_shell_view->priv = + E_MEMO_SHELL_VIEW_GET_PRIVATE (memo_shell_view); e_memo_shell_view_private_init (memo_shell_view, shell_view_class); } diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c index 84500e4427..1bb7ca338f 100644 --- a/modules/calendar/e-task-shell-backend.c +++ b/modules/calendar/e-task-shell-backend.c @@ -47,6 +47,10 @@ #include "e-task-shell-sidebar.h" #include "e-task-shell-view.h" +#define E_TASK_SHELL_BACKEND_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TASK_SHELL_BACKEND, ETaskShellBackendPrivate)) + struct _ETaskShellBackendPrivate { ESourceList *source_list; }; @@ -56,8 +60,10 @@ enum { PROP_SOURCE_LIST }; -static gpointer parent_class; -static GType task_shell_backend_type; +G_DEFINE_DYNAMIC_TYPE ( + ETaskShellBackend, + e_task_shell_backend, + E_TYPE_SHELL_BACKEND) static void task_shell_backend_ensure_sources (EShellBackend *shell_backend) @@ -532,7 +538,7 @@ task_shell_backend_dispose (GObject *object) { ETaskShellBackendPrivate *priv; - priv = E_TASK_SHELL_BACKEND (object)->priv; + priv = E_TASK_SHELL_BACKEND_GET_PRIVATE (object); if (priv->source_list != NULL) { g_object_unref (priv->source_list); @@ -540,7 +546,7 @@ task_shell_backend_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_task_shell_backend_parent_class)->dispose (object); } static void @@ -565,16 +571,15 @@ task_shell_backend_constructed (GObject *object) shell_backend); /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_task_shell_backend_parent_class)->constructed (object); } static void -task_shell_backend_class_init (ETaskShellBackendClass *class) +e_task_shell_backend_class_init (ETaskShellBackendClass *class) { GObjectClass *object_class; EShellBackendClass *shell_backend_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ETaskShellBackendPrivate)); object_class = G_OBJECT_CLASS (class); @@ -604,38 +609,24 @@ task_shell_backend_class_init (ETaskShellBackendClass *class) } static void -task_shell_backend_init (ETaskShellBackend *task_shell_backend) +e_task_shell_backend_class_finalize (ETaskShellBackendClass *class) { - task_shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - task_shell_backend, E_TYPE_TASK_SHELL_BACKEND, - ETaskShellBackendPrivate); } -GType -e_task_shell_backend_get_type (void) +static void +e_task_shell_backend_init (ETaskShellBackend *task_shell_backend) { - return task_shell_backend_type; + task_shell_backend->priv = + E_TASK_SHELL_BACKEND_GET_PRIVATE (task_shell_backend); } void -e_task_shell_backend_register_type (GTypeModule *type_module) +e_task_shell_backend_type_register (GTypeModule *type_module) { - const GTypeInfo type_info = { - sizeof (ETaskShellBackendClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) task_shell_backend_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ETaskShellBackend), - 0, /* n_preallocs */ - (GInstanceInitFunc) task_shell_backend_init, - NULL /* value_table */ - }; - - task_shell_backend_type = g_type_module_register_type ( - type_module, E_TYPE_SHELL_BACKEND, - "ETaskShellBackend", &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_task_shell_backend_register_type (type_module); } ESourceList * @@ -664,7 +655,8 @@ e_task_shell_backend_get_selected_task_lists (ETaskShellBackend *task_shell_back if (strv != NULL) { for (ii = 0; strv[ii] != NULL; ii++) - selected_task_lists = g_slist_append (selected_task_lists, g_strdup (strv[ii])); + selected_task_lists = g_slist_append ( + selected_task_lists, g_strdup (strv[ii])); g_strfreev (strv); } @@ -687,7 +679,9 @@ e_task_shell_backend_set_selected_task_lists (ETaskShellBackend *task_shell_back g_ptr_array_add (array, NULL); settings = g_settings_new ("org.gnome.evolution.calendar"); - g_settings_set_strv (settings, "selected-tasks", (const gchar *const *) array->pdata); + g_settings_set_strv ( + settings, "selected-tasks", + (const gchar *const *) array->pdata); g_object_unref (settings); g_ptr_array_free (array, FALSE); diff --git a/modules/calendar/e-task-shell-backend.h b/modules/calendar/e-task-shell-backend.h index ba56e91dd9..3b489a7ceb 100644 --- a/modules/calendar/e-task-shell-backend.h +++ b/modules/calendar/e-task-shell-backend.h @@ -60,7 +60,7 @@ struct _ETaskShellBackendClass { }; GType e_task_shell_backend_get_type (void); -void e_task_shell_backend_register_type +void e_task_shell_backend_type_register (GTypeModule *type_module); ESourceList * e_task_shell_backend_get_source_list (ETaskShellBackend *task_shell_backend); diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c index cb2443f19d..67b1e368b3 100644 --- a/modules/calendar/e-task-shell-content.c +++ b/modules/calendar/e-task-shell-content.c @@ -37,6 +37,10 @@ #include "calendar/gui/e-cal-component-preview.h" #include "calendar/gui/e-cal-model-tasks.h" +#define E_TASK_SHELL_CONTENT_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TASK_SHELL_CONTENT, ETaskShellContentPrivate)) + #define E_TASK_TABLE_DEFAULT_STATE \ "<?xml version=\"1.0\"?>" \ "<ETableState>" \ @@ -68,8 +72,13 @@ enum { PROP_PREVIEW_VISIBLE }; -static gpointer parent_class; -static GType task_shell_content_type; +G_DEFINE_DYNAMIC_TYPE_EXTENDED ( + ETaskShellContent, + e_task_shell_content, + E_TYPE_SHELL_CONTENT, + 0, + G_IMPLEMENT_INTERFACE_DYNAMIC ( + GTK_TYPE_ORIENTABLE, NULL)) static void task_shell_content_display_view_cb (ETaskShellContent *task_shell_content, @@ -271,19 +280,22 @@ task_shell_content_restore_state_cb (EShellWindow *shell_window, { ETaskShellContentPrivate *priv; GSettings *settings; - GObject *object; - priv = E_TASK_SHELL_CONTENT (shell_content)->priv; + priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (shell_content); /* Bind GObject properties to settings keys. */ settings = g_settings_new ("org.gnome.evolution.calendar"); - object = G_OBJECT (priv->paned); - g_settings_bind (settings, "task-hpane-position", object, "hposition", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "task-hpane-position", + priv->paned, "hposition", + G_SETTINGS_BIND_DEFAULT); - object = G_OBJECT (priv->paned); - g_settings_bind (settings, "task-vpane-position", object, "vposition", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "task-vpane-position", + priv->paned, "vposition", + G_SETTINGS_BIND_DEFAULT); g_object_unref (G_OBJECT (settings)); } @@ -363,7 +375,7 @@ task_shell_content_dispose (GObject *object) { ETaskShellContentPrivate *priv; - priv = E_TASK_SHELL_CONTENT (object)->priv; + priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (object); if (priv->paned != NULL) { g_object_unref (priv->paned); @@ -391,7 +403,7 @@ task_shell_content_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_task_shell_content_parent_class)->dispose (object); } static void @@ -399,12 +411,12 @@ task_shell_content_finalize (GObject *object) { ETaskShellContentPrivate *priv; - priv = E_TASK_SHELL_CONTENT (object)->priv; + priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (object); g_free (priv->current_uid); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_task_shell_content_parent_class)->finalize (object); } static void @@ -422,10 +434,10 @@ task_shell_content_constructed (GObject *object) GtkWidget *widget; gint n_targets; - priv = E_TASK_SHELL_CONTENT (object)->priv; + priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (object); /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_task_shell_content_parent_class)->constructed (object); shell_content = E_SHELL_CONTENT (object); shell_view = e_shell_content_get_shell_view (shell_content); @@ -622,18 +634,17 @@ task_shell_content_focus_search_results (EShellContent *shell_content) { ETaskShellContentPrivate *priv; - priv = E_TASK_SHELL_CONTENT (shell_content)->priv; + priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (shell_content); gtk_widget_grab_focus (priv->task_table); } static void -task_shell_content_class_init (ETaskShellContentClass *class) +e_task_shell_content_class_init (ETaskShellContentClass *class) { GObjectClass *object_class; EShellContentClass *shell_content_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ETaskShellContentPrivate)); object_class = G_OBJECT_CLASS (class); @@ -674,50 +685,26 @@ task_shell_content_class_init (ETaskShellContentClass *class) } static void -task_shell_content_init (ETaskShellContent *task_shell_content) +e_task_shell_content_class_finalize (ETaskShellContentClass *class) { - task_shell_content->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - task_shell_content, E_TYPE_TASK_SHELL_CONTENT, - ETaskShellContentPrivate); - - /* Postpone widget construction until we have a shell view. */ } -GType -e_task_shell_content_get_type (void) +static void +e_task_shell_content_init (ETaskShellContent *task_shell_content) { - return task_shell_content_type; + task_shell_content->priv = + E_TASK_SHELL_CONTENT_GET_PRIVATE (task_shell_content); + + /* Postpone widget construction until we have a shell view. */ } void -e_task_shell_content_register_type (GTypeModule *type_module) +e_task_shell_content_type_register (GTypeModule *type_module) { - static const GTypeInfo type_info = { - sizeof (ETaskShellContentClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) task_shell_content_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ETaskShellContent), - 0, /* n_preallocs */ - (GInstanceInitFunc) task_shell_content_init, - NULL /* value_table */ - }; - - static const GInterfaceInfo orientable_info = { - (GInterfaceInitFunc) NULL, - (GInterfaceFinalizeFunc) NULL, - NULL /* interface_data */ - }; - - task_shell_content_type = g_type_module_register_type ( - type_module, E_TYPE_SHELL_CONTENT, - "ETaskShellContent", &type_info, 0); - - g_type_module_add_interface ( - type_module, task_shell_content_type, - GTK_TYPE_ORIENTABLE, &orientable_info); + /* 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_task_shell_content_register_type (type_module); } GtkWidget * diff --git a/modules/calendar/e-task-shell-content.h b/modules/calendar/e-task-shell-content.h index eb327afdb7..84a5f675da 100644 --- a/modules/calendar/e-task-shell-content.h +++ b/modules/calendar/e-task-shell-content.h @@ -77,7 +77,7 @@ struct _ETaskShellContentClass { }; GType e_task_shell_content_get_type (void); -void e_task_shell_content_register_type +void e_task_shell_content_type_register (GTypeModule *type_module); GtkWidget * e_task_shell_content_new (EShellView *shell_view); diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index 7987071eb8..1a59112489 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -39,6 +39,10 @@ #include "e-task-shell-backend.h" #include "e-task-shell-content.h" +#define E_TASK_SHELL_SIDEBAR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TASK_SHELL_SIDEBAR, ETaskShellSidebarPrivate)) + struct _ETaskShellSidebarPrivate { GtkWidget *selector; @@ -71,9 +75,12 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static guint signals[LAST_SIGNAL]; -static GType task_shell_sidebar_type; + +G_DEFINE_DYNAMIC_TYPE ( + ETaskShellSidebar, + e_task_shell_sidebar, + E_TYPE_SHELL_SIDEBAR) static void task_shell_sidebar_emit_client_added (ETaskShellSidebar *task_shell_sidebar, @@ -342,7 +349,7 @@ task_shell_sidebar_default_loaded_cb (GObject *source_object, EClient *client = NULL; GError *error = NULL; - priv = E_TASK_SHELL_SIDEBAR (shell_sidebar)->priv; + priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); @@ -520,7 +527,7 @@ task_shell_sidebar_restore_state_cb (EShellWindow *shell_window, GtkTreeModel *model; GSList *list, *iter; - priv = E_TASK_SHELL_SIDEBAR (shell_sidebar)->priv; + priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); shell = e_shell_window_get_shell (shell_window); shell_settings = e_shell_get_shell_settings (shell); @@ -607,7 +614,7 @@ task_shell_sidebar_dispose (GObject *object) { ETaskShellSidebarPrivate *priv; - priv = E_TASK_SHELL_SIDEBAR (object)->priv; + priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (object); if (priv->selector != NULL) { g_object_unref (priv->selector); @@ -634,7 +641,7 @@ task_shell_sidebar_dispose (GObject *object) g_hash_table_remove_all (priv->client_table); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_task_shell_sidebar_parent_class)->dispose (object); } static void @@ -642,12 +649,12 @@ task_shell_sidebar_finalize (GObject *object) { ETaskShellSidebarPrivate *priv; - priv = E_TASK_SHELL_SIDEBAR (object)->priv; + priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (object); g_hash_table_destroy (priv->client_table); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_task_shell_sidebar_parent_class)->finalize (object); } static void @@ -663,10 +670,10 @@ task_shell_sidebar_constructed (GObject *object) GtkWidget *widget; AtkObject *a11y; - priv = E_TASK_SHELL_SIDEBAR (object)->priv; + priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (object); /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_task_shell_sidebar_parent_class)->constructed (object); shell_sidebar = E_SHELL_SIDEBAR (object); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); @@ -779,12 +786,11 @@ task_shell_sidebar_client_removed (ETaskShellSidebar *task_shell_sidebar, } static void -task_shell_sidebar_class_init (ETaskShellSidebarClass *class) +e_task_shell_sidebar_class_init (ETaskShellSidebarClass *class) { GObjectClass *object_class; EShellSidebarClass *shell_sidebar_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ETaskShellSidebarPrivate)); object_class = G_OBJECT_CLASS (class); @@ -851,7 +857,12 @@ task_shell_sidebar_class_init (ETaskShellSidebarClass *class) } static void -task_shell_sidebar_init (ETaskShellSidebar *task_shell_sidebar) +e_task_shell_sidebar_class_finalize (ETaskShellSidebarClass *class) +{ +} + +static void +e_task_shell_sidebar_init (ETaskShellSidebar *task_shell_sidebar) { GHashTable *client_table; @@ -860,9 +871,8 @@ task_shell_sidebar_init (ETaskShellSidebar *task_shell_sidebar) (GDestroyNotify) g_free, (GDestroyNotify) g_object_unref); - task_shell_sidebar->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - task_shell_sidebar, E_TYPE_TASK_SHELL_SIDEBAR, - ETaskShellSidebarPrivate); + task_shell_sidebar->priv = + E_TASK_SHELL_SIDEBAR_GET_PRIVATE (task_shell_sidebar); task_shell_sidebar->priv->client_table = client_table; task_shell_sidebar->priv->loading_clients = g_cancellable_new (); @@ -870,31 +880,13 @@ task_shell_sidebar_init (ETaskShellSidebar *task_shell_sidebar) /* Postpone widget construction until we have a shell view. */ } -GType -e_task_shell_sidebar_get_type (void) -{ - return task_shell_sidebar_type; -} - void -e_task_shell_sidebar_register_type (GTypeModule *type_module) +e_task_shell_sidebar_type_register (GTypeModule *type_module) { - static const GTypeInfo type_info = { - sizeof (ETaskShellSidebarClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) task_shell_sidebar_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ETaskShellSidebar), - 0, /* n_preallocs */ - (GInstanceInitFunc) task_shell_sidebar_init, - NULL /* value_table */ - }; - - task_shell_sidebar_type = g_type_module_register_type ( - type_module, E_TYPE_SHELL_SIDEBAR, - "ETaskShellSidebar", &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_task_shell_sidebar_register_type (type_module); } GtkWidget * diff --git a/modules/calendar/e-task-shell-sidebar.h b/modules/calendar/e-task-shell-sidebar.h index 24c64cf2af..07b9df38ad 100644 --- a/modules/calendar/e-task-shell-sidebar.h +++ b/modules/calendar/e-task-shell-sidebar.h @@ -69,23 +69,25 @@ struct _ETaskShellSidebarClass { EShellSidebarClass parent_class; /* Signals */ - void (*client_added) (ETaskShellSidebar *task_shell_sidebar, - ECalClient *client); - void (*client_removed) (ETaskShellSidebar *task_shell_sidebar, - ECalClient *client); - void (*status_message) (ETaskShellSidebar *task_shell_sidebar, - const gchar *status_message, - gdouble percent); + void (*client_added) (ETaskShellSidebar *task_shell_sidebar, + ECalClient *client); + void (*client_removed) + (ETaskShellSidebar *task_shell_sidebar, + ECalClient *client); + void (*status_message) + (ETaskShellSidebar *task_shell_sidebar, + const gchar *status_message, + gdouble percent); }; GType e_task_shell_sidebar_get_type (void); -void e_task_shell_sidebar_register_type +void e_task_shell_sidebar_type_register (GTypeModule *type_module); GtkWidget * e_task_shell_sidebar_new (EShellView *shell_view); GList * e_task_shell_sidebar_get_clients (ETaskShellSidebar *task_shell_sidebar); -ECalClient * e_task_shell_sidebar_get_default_client +ECalClient * e_task_shell_sidebar_get_default_client (ETaskShellSidebar *task_shell_sidebar); ESourceSelector * e_task_shell_sidebar_get_selector diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c index c7e91d2955..6c13d04354 100644 --- a/modules/calendar/e-task-shell-view-actions.c +++ b/modules/calendar/e-task-shell-view-actions.c @@ -1064,7 +1064,6 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view) GtkActionGroup *action_group; GSettings *settings; GtkAction *action; - GObject *object; shell_view = E_SHELL_VIEW (task_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); @@ -1124,11 +1123,15 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view) settings = g_settings_new ("org.gnome.evolution.calendar"); - object = G_OBJECT (ACTION (TASK_PREVIEW)); - g_settings_bind (settings, "show-task-preview", object, "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "show-task-preview", + ACTION (TASK_PREVIEW), "active", + G_SETTINGS_BIND_DEFAULT); - object = G_OBJECT (ACTION (TASK_VIEW_VERTICAL)); - g_settings_bind (settings, "task-layout", object, "current-value", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "task-layout", + ACTION (TASK_VIEW_VERTICAL), "current-value", + G_SETTINGS_BIND_DEFAULT); g_object_unref (G_OBJECT (settings)); diff --git a/modules/calendar/e-task-shell-view-private.h b/modules/calendar/e-task-shell-view-private.h index 1903ec58fc..cf890c5c27 100644 --- a/modules/calendar/e-task-shell-view-private.h +++ b/modules/calendar/e-task-shell-view-private.h @@ -53,6 +53,10 @@ #include "e-task-shell-sidebar.h" #include "e-task-shell-view-actions.h" +#define E_TASK_SHELL_VIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TASK_SHELL_VIEW, ETaskShellViewPrivate)) + /* Shorthand, requires a variable named "shell_window". */ #define ACTION(name) \ (E_SHELL_WINDOW_ACTION_##name (shell_window)) diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c index 21004cc9ec..0654ef3eea 100644 --- a/modules/calendar/e-task-shell-view.c +++ b/modules/calendar/e-task-shell-view.c @@ -471,9 +471,8 @@ static void task_shell_view_init (ETaskShellView *task_shell_view, EShellViewClass *shell_view_class) { - task_shell_view->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - task_shell_view, E_TYPE_TASK_SHELL_VIEW, - ETaskShellViewPrivate); + task_shell_view->priv = + E_TASK_SHELL_VIEW_GET_PRIVATE (task_shell_view); e_task_shell_view_private_init (task_shell_view, shell_view_class); } diff --git a/modules/calendar/evolution-module-calendar.c b/modules/calendar/evolution-module-calendar.c index ebc11b6117..9b24bf3854 100644 --- a/modules/calendar/evolution-module-calendar.c +++ b/modules/calendar/evolution-module-calendar.c @@ -67,19 +67,19 @@ e_module_load (GTypeModule *type_module) e_cal_config_hook_register_type (type_module); e_cal_event_hook_register_type (type_module); - e_cal_shell_backend_register_type (type_module); - e_cal_shell_content_register_type (type_module); - e_cal_shell_sidebar_register_type (type_module); + e_cal_shell_backend_type_register (type_module); + e_cal_shell_content_type_register (type_module); + e_cal_shell_sidebar_type_register (type_module); e_cal_shell_view_register_type (type_module); - e_memo_shell_backend_register_type (type_module); - e_memo_shell_content_register_type (type_module); - e_memo_shell_sidebar_register_type (type_module); + e_memo_shell_backend_type_register (type_module); + e_memo_shell_content_type_register (type_module); + e_memo_shell_sidebar_type_register (type_module); e_memo_shell_view_register_type (type_module); - e_task_shell_backend_register_type (type_module); - e_task_shell_content_register_type (type_module); - e_task_shell_sidebar_register_type (type_module); + e_task_shell_backend_type_register (type_module); + e_task_shell_content_type_register (type_module); + e_task_shell_sidebar_type_register (type_module); e_task_shell_view_register_type (type_module); e_cal_config_calendar_item_register_type (type_module); diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c index 5ea75ee5b4..aba140b865 100644 --- a/modules/mail/e-mail-shell-backend.c +++ b/modules/mail/e-mail-shell-backend.c @@ -60,6 +60,10 @@ #include "mail-vfolder.h" #include "importers/mail-importer.h" +#define E_MAIL_SHELL_BACKEND_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MAIL_SHELL_BACKEND, EMailShellBackendPrivate)) + #define BACKEND_NAME "mail" struct _EMailShellBackendPrivate { @@ -67,12 +71,14 @@ struct _EMailShellBackendPrivate { guint mail_sync_source_id; }; -static gpointer parent_class; -static GType mail_shell_backend_type; - static void mbox_create_preview_cb (GObject *preview, GtkWidget **preview_widget); static void mbox_fill_preview_cb (GObject *preview, CamelMimeMessage *msg); +G_DEFINE_DYNAMIC_TYPE ( + EMailShellBackend, + e_mail_shell_backend, + E_TYPE_MAIL_BACKEND) + static void mail_shell_backend_init_importers (void) { @@ -279,7 +285,7 @@ mail_shell_backend_prepare_for_quit_cb (EShell *shell, { EMailShellBackendPrivate *priv; - priv = E_MAIL_SHELL_BACKEND (shell_backend)->priv; + priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (shell_backend); /* Prevent a sync from starting while trying to shutdown. */ if (priv->mail_sync_source_id > 0) { @@ -370,7 +376,7 @@ mail_shell_backend_constructed (GObject *object) shell = e_shell_backend_get_shell (shell_backend); /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_mail_shell_backend_parent_class)->constructed (object); /* Register format types for EMFormatHook. */ em_format_hook_register_type (em_format_get_type ()); @@ -446,7 +452,7 @@ mail_shell_backend_start (EShellBackend *shell_backend) gboolean enable_search_folders; const gchar *data_dir; - priv = E_MAIL_SHELL_BACKEND (shell_backend)->priv; + priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (shell_backend); shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); @@ -554,13 +560,12 @@ mail_shell_backend_empty_trash_policy_decision (EMailBackend *backend) } static void -mail_shell_backend_class_init (EMailShellBackendClass *class) +e_mail_shell_backend_class_init (EMailShellBackendClass *class) { GObjectClass *object_class; EShellBackendClass *shell_backend_class; EMailBackendClass *mail_backend_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EMailShellBackendPrivate)); object_class = G_OBJECT_CLASS (class); @@ -583,38 +588,24 @@ mail_shell_backend_class_init (EMailShellBackendClass *class) } static void -mail_shell_backend_init (EMailShellBackend *mail_shell_backend) +e_mail_shell_backend_class_finalize (EMailShellBackendClass *class) { - mail_shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - mail_shell_backend, E_TYPE_MAIL_SHELL_BACKEND, - EMailShellBackendPrivate); } -GType -e_mail_shell_backend_get_type (void) +static void +e_mail_shell_backend_init (EMailShellBackend *mail_shell_backend) { - return mail_shell_backend_type; + mail_shell_backend->priv = + E_MAIL_SHELL_BACKEND_GET_PRIVATE (mail_shell_backend); } void -e_mail_shell_backend_register_type (GTypeModule *type_module) +e_mail_shell_backend_type_register (GTypeModule *type_module) { - const GTypeInfo type_info = { - sizeof (EMailShellBackendClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) mail_shell_backend_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMailShellBackend), - 0, /* n_preallocs */ - (GInstanceInitFunc) mail_shell_backend_init, - NULL /* value_table */ - }; - - mail_shell_backend_type = g_type_module_register_type ( - type_module, E_TYPE_MAIL_BACKEND, - "EMailShellBackend", &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_mail_shell_backend_register_type (type_module); } /******************* Code below here belongs elsewhere. *******************/ diff --git a/modules/mail/e-mail-shell-backend.h b/modules/mail/e-mail-shell-backend.h index edec7c67a3..9d9a8e1dad 100644 --- a/modules/mail/e-mail-shell-backend.h +++ b/modules/mail/e-mail-shell-backend.h @@ -59,8 +59,8 @@ struct _EMailShellBackendClass { }; GType e_mail_shell_backend_get_type (void); -void e_mail_shell_backend_register_type - (GTypeModule *type_module); +void e_mail_shell_backend_type_register + (GTypeModule *type_module); /* XXX Find a better place for this function. */ GSList * e_mail_labels_get_filter_options (void); diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c index e3b9f1f5ff..56a0c52de6 100644 --- a/modules/mail/e-mail-shell-content.c +++ b/modules/mail/e-mail-shell-content.c @@ -62,8 +62,18 @@ enum { PROP_REPLY_STYLE }; -static gpointer parent_class; -static GType mail_shell_content_type; +/* Forward Declarations */ +static void e_mail_shell_content_reader_init + (EMailReaderInterface *interface); + +G_DEFINE_DYNAMIC_TYPE_EXTENDED ( + EMailShellContent, + e_mail_shell_content, + E_TYPE_SHELL_CONTENT, + 0, + G_IMPLEMENT_INTERFACE_DYNAMIC ( + E_TYPE_MAIL_READER, + e_mail_shell_content_reader_init)) static void reconnect_changed_event (EMailReader *child, @@ -74,7 +84,7 @@ reconnect_changed_event (EMailReader *child, static void reconnect_folder_loaded_event (EMailReader *child, - EMailReader *parent) + EMailReader *parent) { g_signal_emit_by_name (parent, "folder-loaded"); } @@ -165,7 +175,7 @@ mail_shell_content_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_mail_shell_content_parent_class)->dispose (object); } static void @@ -180,7 +190,7 @@ mail_shell_content_constructed (GObject *object) priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object); /* Chain up to parent's constructed () method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_mail_shell_content_parent_class)->constructed (object); shell_content = E_SHELL_CONTENT (object); shell_view = e_shell_content_get_shell_view (shell_content); @@ -395,12 +405,11 @@ mail_shell_content_set_folder (EMailReader *reader, } static void -mail_shell_content_class_init (EMailShellContentClass *class) +e_mail_shell_content_class_init (EMailShellContentClass *class) { GObjectClass *object_class; EShellContentClass *shell_content_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EMailShellContentPrivate)); object_class = G_OBJECT_CLASS (class); @@ -444,22 +453,12 @@ mail_shell_content_class_init (EMailShellContentClass *class) } static void -mail_shell_content_init (EMailShellContent *mail_shell_content) +e_mail_shell_content_class_finalize (EMailShellContentClass *class) { - mail_shell_content->priv = - E_MAIL_SHELL_CONTENT_GET_PRIVATE (mail_shell_content); - - /* Postpone widget construction until we have a shell view. */ -} - -GType -e_mail_shell_content_get_type (void) -{ - return mail_shell_content_type; } static void -mail_shell_content_reader_init (EMailReaderInterface *interface) +e_mail_shell_content_reader_init (EMailReaderInterface *interface) { interface->get_action_group = mail_shell_content_get_action_group; interface->get_backend = mail_shell_content_get_backend; @@ -473,35 +472,22 @@ mail_shell_content_reader_init (EMailReaderInterface *interface) interface->open_selected_mail = mail_shell_content_open_selected_mail; } +static void +e_mail_shell_content_init (EMailShellContent *mail_shell_content) +{ + mail_shell_content->priv = + E_MAIL_SHELL_CONTENT_GET_PRIVATE (mail_shell_content); + + /* Postpone widget construction until we have a shell view. */ +} + void -e_mail_shell_content_register_type (GTypeModule *type_module) +e_mail_shell_content_type_register (GTypeModule *type_module) { - static const GTypeInfo type_info = { - sizeof (EMailShellContentClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) mail_shell_content_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMailShellContent), - 0, /* n_preallocs */ - (GInstanceInitFunc) mail_shell_content_init, - NULL /* value_table */ - }; - - static const GInterfaceInfo reader_info = { - (GInterfaceInitFunc) mail_shell_content_reader_init, - (GInterfaceFinalizeFunc) NULL, - NULL /* interface_data */ - }; - - mail_shell_content_type = g_type_module_register_type ( - type_module, E_TYPE_SHELL_CONTENT, - "EMailShellContent", &type_info, 0); - - g_type_module_add_interface ( - type_module, mail_shell_content_type, - E_TYPE_MAIL_READER, &reader_info); + /* 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_mail_shell_content_register_type (type_module); } GtkWidget * diff --git a/modules/mail/e-mail-shell-content.h b/modules/mail/e-mail-shell-content.h index 58f7ee9fd2..b3eecbef63 100644 --- a/modules/mail/e-mail-shell-content.h +++ b/modules/mail/e-mail-shell-content.h @@ -63,7 +63,7 @@ struct _EMailShellContentClass { }; GType e_mail_shell_content_get_type (void); -void e_mail_shell_content_register_type +void e_mail_shell_content_type_register (GTypeModule *type_module); GtkWidget * e_mail_shell_content_new (EShellView *shell_view); diff --git a/modules/mail/e-mail-shell-sidebar.c b/modules/mail/e-mail-shell-sidebar.c index 437df3e944..698c02119d 100644 --- a/modules/mail/e-mail-shell-sidebar.c +++ b/modules/mail/e-mail-shell-sidebar.c @@ -29,6 +29,10 @@ #include "mail/e-mail-sidebar.h" #include "mail/em-folder-utils.h" +#define E_MAIL_SHELL_SIDEBAR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MAIL_SHELL_SIDEBAR, EMailShellSidebarPrivate)) + struct _EMailShellSidebarPrivate { GtkWidget *folder_tree; }; @@ -38,8 +42,10 @@ enum { PROP_FOLDER_TREE }; -static gpointer parent_class; -static GType mail_shell_sidebar_type; +G_DEFINE_DYNAMIC_TYPE ( + EMailShellSidebar, + e_mail_shell_sidebar, + E_TYPE_SHELL_SIDEBAR) static void mail_shell_sidebar_selection_changed_cb (EShellSidebar *shell_sidebar, @@ -99,7 +105,7 @@ mail_shell_sidebar_dispose (GObject *object) { EMailShellSidebarPrivate *priv; - priv = E_MAIL_SHELL_SIDEBAR (object)->priv; + priv = E_MAIL_SHELL_SIDEBAR_GET_PRIVATE (object); if (priv->folder_tree != NULL) { g_object_unref (priv->folder_tree); @@ -107,7 +113,7 @@ mail_shell_sidebar_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_mail_shell_sidebar_parent_class)->dispose (object); } static void @@ -126,7 +132,7 @@ mail_shell_sidebar_constructed (GObject *object) GtkWidget *widget; /* Chain up to parent's constructed method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_mail_shell_sidebar_parent_class)->constructed (object); shell_sidebar = E_SHELL_SIDEBAR (object); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); @@ -232,8 +238,8 @@ mail_shell_sidebar_get_preferred_height (GtkWidget *widget, gint *minimum_height, gint *natural_height) { - GTK_WIDGET_CLASS (parent_class)->get_preferred_height ( - widget, minimum_height, natural_height); + GTK_WIDGET_CLASS (e_mail_shell_sidebar_parent_class)-> + get_preferred_height (widget, minimum_height, natural_height); } static void @@ -265,8 +271,8 @@ mail_shell_sidebar_get_preferred_width (GtkWidget *widget, sidebar = E_MAIL_SHELL_SIDEBAR (widget); - GTK_WIDGET_CLASS (parent_class)->get_preferred_width ( - widget, minimum_width, natural_width); + GTK_WIDGET_CLASS (e_mail_shell_sidebar_parent_class)-> + get_preferred_width (widget, minimum_width, natural_width); /* This string is a mockup only; it doesn't need to be translated */ layout = gtk_widget_create_pango_layout ( @@ -291,20 +297,19 @@ mail_shell_sidebar_check_state (EShellSidebar *shell_sidebar) EMailShellSidebarPrivate *priv; EMailSidebar *sidebar; - priv = E_MAIL_SHELL_SIDEBAR (shell_sidebar)->priv; + priv = E_MAIL_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); sidebar = E_MAIL_SIDEBAR (priv->folder_tree); return e_mail_sidebar_check_state (sidebar); } static void -mail_shell_sidebar_class_init (EMailShellSidebarClass *class) +e_mail_shell_sidebar_class_init (EMailShellSidebarClass *class) { GObjectClass *object_class; GtkWidgetClass *widget_class; EShellSidebarClass *shell_sidebar_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EMailShellSidebarPrivate)); object_class = G_OBJECT_CLASS (class); @@ -331,40 +336,26 @@ mail_shell_sidebar_class_init (EMailShellSidebarClass *class) } static void -mail_shell_sidebar_init (EMailShellSidebar *mail_shell_sidebar) +e_mail_shell_sidebar_class_finalize (EMailShellSidebarClass *class) { - mail_shell_sidebar->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - mail_shell_sidebar, E_TYPE_MAIL_SHELL_SIDEBAR, - EMailShellSidebarPrivate); - - /* Postpone widget construction until we have a shell view. */ } -GType -e_mail_shell_sidebar_get_type (void) +static void +e_mail_shell_sidebar_init (EMailShellSidebar *mail_shell_sidebar) { - return mail_shell_sidebar_type; + mail_shell_sidebar->priv = + E_MAIL_SHELL_SIDEBAR_GET_PRIVATE (mail_shell_sidebar); + + /* Postpone widget construction until we have a shell view. */ } void -e_mail_shell_sidebar_register_type (GTypeModule *type_module) +e_mail_shell_sidebar_type_register (GTypeModule *type_module) { - static const GTypeInfo type_info = { - sizeof (EMailShellSidebarClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) mail_shell_sidebar_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMailShellSidebar), - 0, /* n_preallocs */ - (GInstanceInitFunc) mail_shell_sidebar_init, - NULL /* value_table */ - }; - - mail_shell_sidebar_type = g_type_module_register_type ( - type_module, E_TYPE_SHELL_SIDEBAR, - "EMailShellSidebar", &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_mail_shell_sidebar_register_type (type_module); } GtkWidget * diff --git a/modules/mail/e-mail-shell-sidebar.h b/modules/mail/e-mail-shell-sidebar.h index ca3a43654d..c36f0ff4a4 100644 --- a/modules/mail/e-mail-shell-sidebar.h +++ b/modules/mail/e-mail-shell-sidebar.h @@ -61,7 +61,7 @@ struct _EMailShellSidebarClass { }; GType e_mail_shell_sidebar_get_type (void); -void e_mail_shell_sidebar_register_type +void e_mail_shell_sidebar_type_register (GTypeModule *type_module); GtkWidget * e_mail_shell_sidebar_new (EShellView *shell_view); diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index 7bed18d8b8..abe3d2b6c5 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -1634,7 +1634,6 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) GtkActionGroup *action_group; GtkAction *action; GSettings *settings; - GObject *object; g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view)); @@ -1694,11 +1693,15 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) settings = g_settings_new ("org.gnome.evolution.mail"); - object = G_OBJECT (ACTION (MAIL_SHOW_DELETED)); - g_settings_bind (settings, "show-deleted", object, "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "show-deleted", + ACTION (MAIL_SHOW_DELETED), "active", + G_SETTINGS_BIND_DEFAULT); - object = G_OBJECT (ACTION (MAIL_VIEW_VERTICAL)); - g_settings_bind (settings, "layout", object, "current-value", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "layout", + ACTION (MAIL_VIEW_VERTICAL), "current-value", + G_SETTINGS_BIND_DEFAULT); g_object_unref (settings); diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c index 50525c7c7f..ab669d3cb9 100644 --- a/modules/mail/e-mail-shell-view-private.c +++ b/modules/mail/e-mail-shell-view-private.c @@ -985,7 +985,8 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) num_deleted = camel_folder_summary_get_deleted_count (folder->summary); num_junked = camel_folder_summary_get_junk_count (folder->summary); - num_junked_not_deleted = camel_folder_summary_get_junk_not_deleted_count (folder->summary); + num_junked_not_deleted = + camel_folder_summary_get_junk_not_deleted_count (folder->summary); num_unread = camel_folder_summary_get_unread_count (folder->summary); num_visible = camel_folder_summary_get_visible_count (folder->summary); diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h index 12dfbd3183..5bc477dbcd 100644 --- a/modules/mail/e-mail-shell-view-private.h +++ b/modules/mail/e-mail-shell-view-private.h @@ -68,6 +68,10 @@ #include "e-mail-shell-sidebar.h" #include "e-mail-shell-view-actions.h" +#define E_MAIL_SHELL_VIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MAIL_SHELL_VIEW, EMailShellViewPrivate)) + /* Shorthand, requires a variable named "shell_window". */ #define ACTION(name) \ (E_SHELL_WINDOW_ACTION_##name (shell_window)) diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c index 1e80e77a3c..74a69a9127 100644 --- a/modules/mail/e-mail-shell-view.c +++ b/modules/mail/e-mail-shell-view.c @@ -181,7 +181,7 @@ mail_shell_view_toggled (EShellView *shell_view) const gchar *basename; gboolean view_is_active; - priv = E_MAIL_SHELL_VIEW (shell_view)->priv; + priv = E_MAIL_SHELL_VIEW_GET_PRIVATE (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); ui_manager = e_shell_window_get_ui_manager (shell_window); @@ -248,7 +248,7 @@ mail_shell_view_execute_search (EShellView *shell_view) const gchar *use_tag; gint value; - priv = E_MAIL_SHELL_VIEW (shell_view)->priv; + priv = E_MAIL_SHELL_VIEW_GET_PRIVATE (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); shell_backend = e_shell_view_get_shell_backend (shell_view); @@ -1066,9 +1066,8 @@ static void mail_shell_view_init (EMailShellView *mail_shell_view, EShellViewClass *shell_view_class) { - mail_shell_view->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - mail_shell_view, E_TYPE_MAIL_SHELL_VIEW, - EMailShellViewPrivate); + mail_shell_view->priv = + E_MAIL_SHELL_VIEW_GET_PRIVATE (mail_shell_view); e_mail_shell_view_private_init (mail_shell_view, shell_view_class); } diff --git a/modules/mail/evolution-module-mail.c b/modules/mail/evolution-module-mail.c index bda0db5d95..6a44c935e7 100644 --- a/modules/mail/evolution-module-mail.c +++ b/modules/mail/evolution-module-mail.c @@ -52,9 +52,9 @@ e_module_load (GTypeModule *type_module) e_mail_config_hook_register_type (type_module); e_mail_event_hook_register_type (type_module); - e_mail_shell_backend_register_type (type_module); - e_mail_shell_content_register_type (type_module); - e_mail_shell_sidebar_register_type (type_module); + e_mail_shell_backend_type_register (type_module); + e_mail_shell_content_type_register (type_module); + e_mail_shell_sidebar_type_register (type_module); e_mail_shell_view_register_type (type_module); e_mail_config_format_html_register_type (type_module); diff --git a/shell/e-shell-switcher.c b/shell/e-shell-switcher.c index 3a72851f97..1deefa5613 100644 --- a/shell/e-shell-switcher.c +++ b/shell/e-shell-switcher.c @@ -647,10 +647,12 @@ e_shell_switcher_add_action (EShellSwitcher *switcher, gtk_tool_item_set_is_important (GTK_TOOL_ITEM (widget), TRUE); gtk_widget_show (widget); - if ((button = tool_item_get_button (widget)) != NULL) - g_signal_connect (button, "button-release-event", - G_CALLBACK (tool_item_button_cb), - new_window_action); + button = tool_item_get_button (widget); + if (button != NULL) + g_signal_connect ( + button, "button-release-event", + G_CALLBACK (tool_item_button_cb), + new_window_action); switcher->priv->proxies = g_list_append ( switcher->priv->proxies, widget); diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c index 2dd8228548..6807472b90 100644 --- a/shell/e-shell-window-actions.c +++ b/shell/e-shell-window-actions.c @@ -702,10 +702,13 @@ action_contents_cb (GtkAction *action, EShellWindow *shell_window) { #ifdef G_OS_WIN32 - /* On Windows, link to online help instead. See https://bugzilla.gnome.org/show_bug.cgi?id=576478 */ + /* On Windows, link to online help instead. + * See https://bugzilla.gnome.org/show_bug.cgi?id=576478 */ gchar *online_help_url; + online_help_url = g_strconcat ( - "http://library.gnome.org/users/evolution/", BASE_VERSION, NULL); + "http://library.gnome.org/users/evolution/", + BASE_VERSION, NULL); e_show_uri (GTK_WINDOW (shell_window), online_help_url); g_free (online_help_url); #else diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c index 6518324ed1..54a1e8e3fd 100644 --- a/shell/e-shell-window-private.c +++ b/shell/e-shell-window-private.c @@ -259,7 +259,6 @@ e_shell_window_private_constructed (EShellWindow *shell_window) GtkPaned *paned; GtkWidget *widget; GtkWindow *window; - GObject *object; guint merge_id; const gchar *id; @@ -409,27 +408,39 @@ e_shell_window_private_constructed (EShellWindow *shell_window) settings = g_settings_new ("org.gnome.evolution.shell"); - object = G_OBJECT (shell_window); - g_settings_bind (settings, "default-component-id", object, "active-view", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "default-component-id", + shell_window, "active-view", + G_SETTINGS_BIND_DEFAULT); - object = G_OBJECT (priv->content_pane); - g_settings_bind (settings, "folder-bar-width", object, "position", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "folder-bar-width", + priv->content_pane, "position", + G_SETTINGS_BIND_DEFAULT); - object = G_OBJECT (shell_window); - g_settings_bind (settings, "sidebar-visible", object, "sidebar-visible", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "sidebar-visible", + shell_window, "sidebar-visible", + G_SETTINGS_BIND_DEFAULT); - object = G_OBJECT (shell_window); - g_settings_bind (settings, "statusbar-visible", object, "taskbar-visible", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "statusbar-visible", + shell_window, "taskbar-visible", + G_SETTINGS_BIND_DEFAULT); if (e_shell_get_express_mode (shell)) { e_shell_window_set_switcher_visible (shell_window, FALSE); } else { - object = G_OBJECT (shell_window); - g_settings_bind (settings, "buttons-visible", object, "switcher-visible", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "buttons-visible", + shell_window, "switcher-visible", + G_SETTINGS_BIND_DEFAULT); } - object = G_OBJECT (shell_window); - g_settings_bind (settings, "toolbar-visible", object, "toolbar-visible", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "toolbar-visible", + shell_window, "toolbar-visible", + G_SETTINGS_BIND_DEFAULT); /* Configure the initial size and position of the window by way * of either a user-supplied geometry string or the last recorded diff --git a/shell/test/e-test-shell-backend.c b/shell/test/e-test-shell-backend.c index 79f4aa876f..0d97308c48 100644 --- a/shell/test/e-test-shell-backend.c +++ b/shell/test/e-test-shell-backend.c @@ -28,10 +28,6 @@ #include "e-test-shell-view.h" -struct _ETestShellBackendPrivate { - gint placeholder; -}; - static gpointer parent_class; static GType test_shell_backend_type; @@ -159,7 +155,6 @@ test_shell_backend_class_init (ETestShellBackendClass *class) EShellBackendClass *shell_backend_class; parent_class = g_type_class_peek_parent (class); - g_type_class_add_private (class, sizeof (ETestShellBackendPrivate)); object_class = G_OBJECT_CLASS (class); object_class->constructed = test_shell_backend_constructed; @@ -178,9 +173,6 @@ test_shell_backend_class_init (ETestShellBackendClass *class) static void test_shell_backend_init (ETestShellBackend *test_shell_backend) { - test_shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - test_shell_backend, E_TYPE_TEST_SHELL_BACKEND, - ETestShellBackendPrivate); } GType diff --git a/shell/test/e-test-shell-view.c b/shell/test/e-test-shell-view.c index 825e27fa37..68d4ff9a7b 100644 --- a/shell/test/e-test-shell-view.c +++ b/shell/test/e-test-shell-view.c @@ -24,6 +24,10 @@ #include "shell/e-shell-content.h" #include "shell/e-shell-sidebar.h" +#define E_TEST_SHELL_VIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TEST_SHELL_VIEW, ETestShellViewPrivate)) + struct _ETestShellViewPrivate { EActivity *activity; }; @@ -49,7 +53,7 @@ test_shell_view_dispose (GObject *object) { ETestShellViewPrivate *priv; - priv = E_TEST_SHELL_VIEW (object)->priv; + priv = E_TEST_SHELL_VIEW_GET_PRIVATE (object); if (priv->activity != NULL) { e_activity_set_state (priv->activity, E_ACTIVITY_COMPLETED); @@ -76,7 +80,7 @@ test_shell_view_constructed (GObject *object) /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (parent_class)->constructed (object); - priv = E_TEST_SHELL_VIEW (object)->priv; + priv = E_TEST_SHELL_VIEW_GET_PRIVATE (object); shell_view = E_SHELL_VIEW (object); shell_backend = e_shell_view_get_shell_backend (shell_view); @@ -123,9 +127,8 @@ test_shell_view_class_init (ETestShellViewClass *class, static void test_shell_view_init (ETestShellView *test_shell_view) { - test_shell_view->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - test_shell_view, E_TYPE_TEST_SHELL_VIEW, - ETestShellViewPrivate); + test_shell_view->priv = + E_TEST_SHELL_VIEW_GET_PRIVATE (test_shell_view); } GType |