diff options
author | Milan Crha <mcrha@redhat.com> | 2011-02-25 23:20:41 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:41:39 +0800 |
commit | c003c99a75587ba39a45d164272760c33f9666b5 (patch) | |
tree | ad6d0583fa9e8f078fb1c118f994371d2f1f79d8 /modules/mail | |
parent | f55aaa5e00a40a137f403a8d5c68dd508059b0b4 (diff) | |
download | gsoc2013-evolution-c003c99a75587ba39a45d164272760c33f9666b5.tar.gz gsoc2013-evolution-c003c99a75587ba39a45d164272760c33f9666b5.tar.zst gsoc2013-evolution-c003c99a75587ba39a45d164272760c33f9666b5.zip |
Bug #614480 - Avoid using G_TYPE_INSTANCE_GET_PRIVATE repeatedly
Diffstat (limited to 'modules/mail')
-rw-r--r-- | modules/mail/e-mail-attachment-handler.c | 18 | ||||
-rw-r--r-- | modules/mail/e-mail-junk-hook.c | 10 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-backend.c | 11 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-content.c | 35 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-sidebar.c | 11 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-private.c | 2 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-private.h | 4 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view.c | 7 | ||||
-rw-r--r-- | modules/mail/em-account-prefs.c | 14 |
9 files changed, 40 insertions, 72 deletions
diff --git a/modules/mail/e-mail-attachment-handler.c b/modules/mail/e-mail-attachment-handler.c index b868c3069d..c2b0cf5460 100644 --- a/modules/mail/e-mail-attachment-handler.c +++ b/modules/mail/e-mail-attachment-handler.c @@ -27,10 +27,6 @@ #include "mail/e-mail-backend.h" #include "mail/em-composer-utils.h" -#define E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_MAIL_ATTACHMENT_HANDLER, EMailAttachmentHandlerPrivate)) - struct _EMailAttachmentHandlerPrivate { EShell *shell; EMailSession *session; @@ -71,7 +67,7 @@ mail_attachment_handler_forward (GtkAction *action, GList *selected; view = e_attachment_handler_get_view (handler); - priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (handler); + priv = E_MAIL_ATTACHMENT_HANDLER (handler)->priv; selected = e_attachment_view_get_selected_attachments (view); g_return_if_fail (g_list_length (selected) == 1); @@ -106,7 +102,7 @@ mail_attachment_handler_reply_all (GtkAction *action, GList *selected; view = e_attachment_handler_get_view (handler); - priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (handler); + priv = E_MAIL_ATTACHMENT_HANDLER (handler)->priv; selected = e_attachment_view_get_selected_attachments (view); g_return_if_fail (g_list_length (selected) == 1); @@ -142,7 +138,7 @@ mail_attachment_handler_reply_sender (GtkAction *action, GList *selected; view = e_attachment_handler_get_view (handler); - priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (handler); + priv = E_MAIL_ATTACHMENT_HANDLER (handler)->priv; selected = e_attachment_view_get_selected_attachments (view); g_return_if_fail (g_list_length (selected) == 1); @@ -286,7 +282,7 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view, return; store = e_attachment_view_get_store (view); - priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (handler); + priv = E_MAIL_ATTACHMENT_HANDLER (handler)->priv; parent = gtk_widget_get_toplevel (GTK_WIDGET (view)); parent = gtk_widget_is_toplevel (parent) ? parent : NULL; @@ -453,7 +449,7 @@ mail_attachment_handler_dispose (GObject *object) { EMailAttachmentHandlerPrivate *priv; - priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (object); + priv = E_MAIL_ATTACHMENT_HANDLER (object)->priv; if (priv->shell != NULL) { g_object_unref (priv->shell); @@ -483,7 +479,7 @@ mail_attachment_handler_constructed (GObject *object) GError *error = NULL; handler = E_ATTACHMENT_HANDLER (object); - priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (object); + priv = E_MAIL_ATTACHMENT_HANDLER (object)->priv; /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (parent_class)->constructed (object); @@ -563,7 +559,7 @@ mail_attachment_handler_class_init (EMailAttachmentHandlerClass *class) static void mail_attachment_handler_init (EMailAttachmentHandler *handler) { - handler->priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (handler); + handler->priv = G_TYPE_INSTANCE_GET_PRIVATE (handler, E_TYPE_MAIL_ATTACHMENT_HANDLER, EMailAttachmentHandlerPrivate); } GType diff --git a/modules/mail/e-mail-junk-hook.c b/modules/mail/e-mail-junk-hook.c index 24c1ac77fc..5ee982f27f 100644 --- a/modules/mail/e-mail-junk-hook.c +++ b/modules/mail/e-mail-junk-hook.c @@ -31,10 +31,6 @@ #include "mail/e-mail-backend.h" #include "mail/e-mail-session.h" -#define E_MAIL_JUNK_HOOK_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_MAIL_JUNK_HOOK, EMailJunkHookPrivate)) - struct _EMailJunkHookPrivate { EMJunkInterface interface; }; @@ -195,7 +191,7 @@ mail_junk_hook_finalize (GObject *object) { EMailJunkHookPrivate *priv; - priv = E_MAIL_JUNK_HOOK_GET_PRIVATE (object); + priv = E_MAIL_JUNK_HOOK (object)->priv; g_free (priv->interface.check_junk); g_free (priv->interface.report_junk); @@ -220,7 +216,7 @@ mail_junk_hook_construct (EPluginHook *hook, EMailSession *session; gchar *property; - priv = E_MAIL_JUNK_HOOK_GET_PRIVATE (hook); + priv = E_MAIL_JUNK_HOOK (hook)->priv; /* Chain up to parent's construct() method. */ if (E_PLUGIN_HOOK_CLASS (parent_class)->construct (hook, plugin, node) == -1) @@ -302,7 +298,7 @@ mail_junk_hook_init (EMailJunkHook *mail_junk_hook) { EMJunkInterface *interface; - mail_junk_hook->priv = E_MAIL_JUNK_HOOK_GET_PRIVATE (mail_junk_hook); + mail_junk_hook->priv = G_TYPE_INSTANCE_GET_PRIVATE (mail_junk_hook, E_TYPE_MAIL_JUNK_HOOK, EMailJunkHookPrivate); interface = &mail_junk_hook->priv->interface; interface->camel.get_name = mail_junk_hook_get_name; diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c index d5096c6185..d30dd2efda 100644 --- a/modules/mail/e-mail-shell-backend.c +++ b/modules/mail/e-mail-shell-backend.c @@ -55,10 +55,6 @@ #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 { @@ -374,7 +370,7 @@ mail_shell_backend_prepare_for_quit_cb (EShell *shell, { EMailShellBackendPrivate *priv; - priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (shell_backend); + priv = E_MAIL_SHELL_BACKEND (shell_backend)->priv; /* Prevent a sync from starting while trying to shutdown. */ if (priv->mail_sync_source_id > 0) { @@ -535,7 +531,7 @@ mail_shell_backend_start (EShellBackend *shell_backend) gboolean enable_search_folders; const gchar *data_dir; - priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (shell_backend); + priv = E_MAIL_SHELL_BACKEND (shell_backend)->priv; shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); @@ -706,8 +702,7 @@ mail_shell_backend_class_init (EMailShellBackendClass *class) static void mail_shell_backend_init (EMailShellBackend *mail_shell_backend) { - mail_shell_backend->priv = - E_MAIL_SHELL_BACKEND_GET_PRIVATE (mail_shell_backend); + mail_shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (mail_shell_backend, E_TYPE_MAIL_SHELL_BACKEND, EMailShellBackendPrivate); } GType diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c index 2f7bea3017..d367994086 100644 --- a/modules/mail/e-mail-shell-content.c +++ b/modules/mail/e-mail-shell-content.c @@ -43,10 +43,6 @@ #include "e-mail-shell-backend.h" #include "e-mail-shell-view-actions.h" -#define E_MAIL_SHELL_CONTENT_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_MAIL_SHELL_CONTENT, EMailShellContentPrivate)) - struct _EMailShellContentPrivate { EMailView *mail_view; }; @@ -154,7 +150,7 @@ mail_shell_content_dispose (GObject *object) { EMailShellContentPrivate *priv; - priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object); + priv = E_MAIL_SHELL_CONTENT (object)->priv; if (priv->mail_view != NULL) { g_object_unref (priv->mail_view); @@ -174,7 +170,7 @@ mail_shell_content_constructed (GObject *object) GtkWidget *container; GtkWidget *widget; - priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object); + priv = E_MAIL_SHELL_CONTENT (object)->priv; /* Chain up to parent's constructed () method. */ G_OBJECT_CLASS (parent_class)->constructed (object); @@ -213,7 +209,7 @@ mail_shell_content_check_state (EShellContent *shell_content) EMailShellContentPrivate *priv; EMailReader *reader; - priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (shell_content); + priv = E_MAIL_SHELL_CONTENT (shell_content)->priv; /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ @@ -229,7 +225,7 @@ mail_shell_content_focus_search_results (EShellContent *shell_content) GtkWidget *message_list; EMailReader *reader; - priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (shell_content); + priv = E_MAIL_SHELL_CONTENT (shell_content)->priv; reader = E_MAIL_READER (priv->mail_view); message_list = e_mail_reader_get_message_list (reader); @@ -242,7 +238,7 @@ mail_shell_content_open_selected_mail (EMailReader *reader) { EMailShellContentPrivate *priv; - priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + priv = E_MAIL_SHELL_CONTENT (reader)->priv; /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ @@ -270,7 +266,7 @@ mail_shell_content_get_alert_sink (EMailReader *reader) { EMailShellContentPrivate *priv; - priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + priv = E_MAIL_SHELL_CONTENT (reader)->priv; /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ @@ -284,7 +280,7 @@ mail_shell_content_get_backend (EMailReader *reader) { EMailShellContentPrivate *priv; - priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + priv = E_MAIL_SHELL_CONTENT (reader)->priv; /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ @@ -298,7 +294,7 @@ mail_shell_content_get_formatter (EMailReader *reader) { EMailShellContentPrivate *priv; - priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + priv = E_MAIL_SHELL_CONTENT (reader)->priv; /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ @@ -312,7 +308,7 @@ mail_shell_content_get_hide_deleted (EMailReader *reader) { EMailShellContentPrivate *priv; - priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + priv = E_MAIL_SHELL_CONTENT (reader)->priv; /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ @@ -326,7 +322,7 @@ mail_shell_content_get_message_list (EMailReader *reader) { EMailShellContentPrivate *priv; - priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + priv = E_MAIL_SHELL_CONTENT (reader)->priv; /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ @@ -340,7 +336,7 @@ mail_shell_content_get_popup_menu (EMailReader *reader) { EMailShellContentPrivate *priv; - priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + priv = E_MAIL_SHELL_CONTENT (reader)->priv; /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ @@ -354,7 +350,7 @@ mail_shell_content_get_window (EMailReader *reader) { EMailShellContentPrivate *priv; - priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + priv = E_MAIL_SHELL_CONTENT (reader)->priv; /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ @@ -370,7 +366,7 @@ mail_shell_content_set_folder (EMailReader *reader, { EMailShellContentPrivate *priv; - priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + priv = E_MAIL_SHELL_CONTENT (reader)->priv; /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ @@ -384,7 +380,7 @@ mail_shell_content_show_search_bar (EMailReader *reader) { EMailShellContentPrivate *priv; - priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + priv = E_MAIL_SHELL_CONTENT (reader)->priv; /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ @@ -444,8 +440,7 @@ mail_shell_content_class_init (EMailShellContentClass *class) static void mail_shell_content_init (EMailShellContent *mail_shell_content) { - mail_shell_content->priv = - E_MAIL_SHELL_CONTENT_GET_PRIVATE (mail_shell_content); + mail_shell_content->priv = G_TYPE_INSTANCE_GET_PRIVATE (mail_shell_content, E_TYPE_MAIL_SHELL_CONTENT, EMailShellContentPrivate); /* Postpone widget construction until we have a shell view. */ } diff --git a/modules/mail/e-mail-shell-sidebar.c b/modules/mail/e-mail-shell-sidebar.c index 8a3587b1c8..5e5e515a9a 100644 --- a/modules/mail/e-mail-shell-sidebar.c +++ b/modules/mail/e-mail-shell-sidebar.c @@ -25,10 +25,6 @@ #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; }; @@ -99,7 +95,7 @@ mail_shell_sidebar_dispose (GObject *object) { EMailShellSidebarPrivate *priv; - priv = E_MAIL_SHELL_SIDEBAR_GET_PRIVATE (object); + priv = E_MAIL_SHELL_SIDEBAR (object)->priv; if (priv->folder_tree != NULL) { g_object_unref (priv->folder_tree); @@ -294,7 +290,7 @@ mail_shell_sidebar_check_state (EShellSidebar *shell_sidebar) EMailShellSidebarPrivate *priv; EMailSidebar *sidebar; - priv = E_MAIL_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); + priv = E_MAIL_SHELL_SIDEBAR (shell_sidebar)->priv; sidebar = E_MAIL_SIDEBAR (priv->folder_tree); return e_mail_sidebar_check_state (sidebar); @@ -336,8 +332,7 @@ mail_shell_sidebar_class_init (EMailShellSidebarClass *class) static void mail_shell_sidebar_init (EMailShellSidebar *mail_shell_sidebar) { - mail_shell_sidebar->priv = - E_MAIL_SHELL_SIDEBAR_GET_PRIVATE (mail_shell_sidebar); + 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. */ } diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c index d69ba8da3b..08ed7a97e7 100644 --- a/modules/mail/e-mail-shell-view-private.c +++ b/modules/mail/e-mail-shell-view-private.c @@ -1537,7 +1537,7 @@ e_mail_shell_view_update_send_receive_menus (EMailShellView *mail_shell_view) g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view)); - priv = E_MAIL_SHELL_VIEW_GET_PRIVATE (mail_shell_view); + priv = mail_shell_view->priv; shell_view = E_SHELL_VIEW (mail_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h index a3aa3455e4..ac460a7b40 100644 --- a/modules/mail/e-mail-shell-view-private.h +++ b/modules/mail/e-mail-shell-view-private.h @@ -66,10 +66,6 @@ #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 f43b1f3732..c808ea3d7a 100644 --- a/modules/mail/e-mail-shell-view.c +++ b/modules/mail/e-mail-shell-view.c @@ -174,7 +174,7 @@ mail_shell_view_toggled (EShellView *shell_view) const gchar *basename; gboolean view_is_active; - priv = E_MAIL_SHELL_VIEW_GET_PRIVATE (shell_view); + priv = E_MAIL_SHELL_VIEW (shell_view)->priv; shell_window = e_shell_view_get_shell_window (shell_view); ui_manager = e_shell_window_get_ui_manager (shell_window); @@ -243,7 +243,7 @@ mail_shell_view_execute_search (EShellView *shell_view) const gchar *use_tag; gint value; - priv = E_MAIL_SHELL_VIEW_GET_PRIVATE (shell_view); + priv = E_MAIL_SHELL_VIEW (shell_view)->priv; shell_window = e_shell_view_get_shell_window (shell_view); shell_backend = e_shell_view_get_shell_backend (shell_view); @@ -1059,8 +1059,7 @@ static void mail_shell_view_init (EMailShellView *mail_shell_view, EShellViewClass *shell_view_class) { - mail_shell_view->priv = - E_MAIL_SHELL_VIEW_GET_PRIVATE (mail_shell_view); + mail_shell_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (mail_shell_view, E_TYPE_MAIL_SHELL_VIEW, EMailShellViewPrivate); e_mail_shell_view_private_init (mail_shell_view, shell_view_class); } diff --git a/modules/mail/em-account-prefs.c b/modules/mail/em-account-prefs.c index e309d2c4ba..378207c365 100644 --- a/modules/mail/em-account-prefs.c +++ b/modules/mail/em-account-prefs.c @@ -42,10 +42,6 @@ #include "shell/e-shell.h" #include "capplet/settings/mail-capplet-shell.h" -#define EM_ACCOUNT_PREFS_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), EM_TYPE_ACCOUNT_PREFS, EMAccountPrefsPrivate)) - struct _EMAccountPrefsPrivate { EMailSession *session; gpointer assistant; /* weak pointer */ @@ -162,7 +158,7 @@ account_prefs_dispose (GObject *object) { EMAccountPrefsPrivate *priv; - priv = EM_ACCOUNT_PREFS_GET_PRIVATE (object); + priv = EM_ACCOUNT_PREFS (object)->priv; if (priv->session != NULL) { g_object_unref (priv->session); @@ -192,7 +188,7 @@ account_prefs_add_account (EAccountManager *manager) EMAccountEditor *emae; gpointer parent; - priv = EM_ACCOUNT_PREFS_GET_PRIVATE (manager); + priv = EM_ACCOUNT_PREFS (manager)->priv; if (priv->assistant != NULL) { gtk_window_present (GTK_WINDOW (priv->assistant)); @@ -239,7 +235,7 @@ account_prefs_edit_account (EAccountManager *manager) EAccount *account; gpointer parent; - priv = EM_ACCOUNT_PREFS_GET_PRIVATE (manager); + priv = EM_ACCOUNT_PREFS (manager)->priv; if (priv->editor != NULL) { gtk_window_present (GTK_WINDOW (priv->editor)); @@ -286,7 +282,7 @@ account_prefs_delete_account (EAccountManager *manager) gpointer parent; gint response; - priv = EM_ACCOUNT_PREFS_GET_PRIVATE (manager); + priv = EM_ACCOUNT_PREFS (manager)->priv; account_list = e_account_manager_get_account_list (manager); tree_view = e_account_manager_get_tree_view (manager); @@ -364,7 +360,7 @@ em_account_prefs_init (EMAccountPrefs *prefs) EAccountManager *manager; EAccountTreeView *tree_view; - prefs->priv = EM_ACCOUNT_PREFS_GET_PRIVATE (prefs); + prefs->priv = G_TYPE_INSTANCE_GET_PRIVATE (prefs, EM_TYPE_ACCOUNT_PREFS, EMAccountPrefsPrivate); manager = E_ACCOUNT_MANAGER (prefs); tree_view = e_account_manager_get_tree_view (manager); |