diff options
Diffstat (limited to 'modules/addressbook')
-rw-r--r-- | modules/addressbook/e-book-shell-backend.c | 55 | ||||
-rw-r--r-- | modules/addressbook/e-book-shell-backend.h | 2 | ||||
-rw-r--r-- | modules/addressbook/e-book-shell-content.c | 85 | ||||
-rw-r--r-- | modules/addressbook/e-book-shell-content.h | 2 | ||||
-rw-r--r-- | modules/addressbook/e-book-shell-sidebar.c | 59 | ||||
-rw-r--r-- | modules/addressbook/e-book-shell-sidebar.h | 2 | ||||
-rw-r--r-- | modules/addressbook/e-book-shell-view-actions.c | 31 | ||||
-rw-r--r-- | modules/addressbook/e-book-shell-view-private.h | 4 | ||||
-rw-r--r-- | modules/addressbook/e-book-shell-view.c | 7 | ||||
-rw-r--r-- | modules/addressbook/evolution-module-addressbook.c | 8 |
10 files changed, 120 insertions, 135 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 |