From 1301cf02efdacd20fb5ce3e2554ae15b8f146e8a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 25 Feb 2011 16:20:41 +0100 Subject: Bug #614480 - Avoid using G_TYPE_INSTANCE_GET_PRIVATE repeatedly --- composer/e-composer-activity.c | 6 +----- composer/e-composer-header-table.c | 10 +++------- composer/e-composer-header.c | 10 +++------- composer/e-composer-name-header.c | 14 +++++--------- composer/e-composer-post-header.c | 14 +++++--------- composer/e-composer-private.h | 4 ---- composer/e-msg-composer.c | 8 ++++---- 7 files changed, 21 insertions(+), 45 deletions(-) (limited to 'composer') diff --git a/composer/e-composer-activity.c b/composer/e-composer-activity.c index e0e159704c..f29834b24d 100644 --- a/composer/e-composer-activity.c +++ b/composer/e-composer-activity.c @@ -18,10 +18,6 @@ #include "e-composer-private.h" -#define E_COMPOSER_ACTIVITY_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_COMPOSER_ACTIVITY, EComposerActivityPrivate)) - struct _EComposerActivityPrivate { EMsgComposer *composer; gboolean saved_editable; @@ -164,7 +160,7 @@ e_composer_activity_class_init (EComposerActivityClass *class) static void e_composer_activity_init (EComposerActivity *activity) { - activity->priv = E_COMPOSER_ACTIVITY_GET_PRIVATE (activity); + activity->priv = G_TYPE_INSTANCE_GET_PRIVATE (activity, E_TYPE_COMPOSER_ACTIVITY, EComposerActivityPrivate); } EActivity * diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c index 1e78111da4..d2d41dfdcc 100644 --- a/composer/e-composer-header-table.c +++ b/composer/e-composer-header-table.c @@ -32,10 +32,6 @@ #include "e-composer-post-header.h" #include "e-composer-text-header.h" -#define E_COMPOSER_HEADER_TABLE_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_COMPOSER_HEADER_TABLE, EComposerHeaderTablePrivate)) - #define HEADER_TOOLTIP_TO \ _("Enter the recipients of the message") #define HEADER_TOOLTIP_CC \ @@ -538,7 +534,7 @@ composer_header_table_constructor (GType type, e_composer_header_table_parent_class)->constructor ( type, n_construct_properties, construct_properties); - priv = E_COMPOSER_HEADER_TABLE_GET_PRIVATE (object); + priv = E_COMPOSER_HEADER_TABLE (object)->priv; small_screen_mode = e_shell_get_small_screen_mode (priv->shell); @@ -810,7 +806,7 @@ composer_header_table_dispose (GObject *object) EComposerHeaderTablePrivate *priv; gint ii; - priv = E_COMPOSER_HEADER_TABLE_GET_PRIVATE (object); + priv = E_COMPOSER_HEADER_TABLE (object)->priv; for (ii = 0; ii < G_N_ELEMENTS (priv->headers); ii++) { if (priv->headers[ii] != NULL) { @@ -998,7 +994,7 @@ e_composer_header_table_init (EComposerHeaderTable *table) GtkWidget *widget; gint ii; - table->priv = E_COMPOSER_HEADER_TABLE_GET_PRIVATE (table); + table->priv = G_TYPE_INSTANCE_GET_PRIVATE (table, E_TYPE_COMPOSER_HEADER_TABLE, EComposerHeaderTablePrivate); name_selector = e_name_selector_new (); table->priv->name_selector = name_selector; diff --git a/composer/e-composer-header.c b/composer/e-composer-header.c index 76c5d89b14..baf5ea3845 100644 --- a/composer/e-composer-header.c +++ b/composer/e-composer-header.c @@ -24,10 +24,6 @@ #include -#define E_COMPOSER_HEADER_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_COMPOSER_HEADER, EComposerHeaderPrivate)) - enum { PROP_0, PROP_BUTTON, @@ -122,7 +118,7 @@ composer_header_set_property (GObject *object, { EComposerHeaderPrivate *priv; - priv = E_COMPOSER_HEADER_GET_PRIVATE (object); + priv = E_COMPOSER_HEADER (object)->priv; switch (property_id) { case PROP_BUTTON: /* construct only */ @@ -157,7 +153,7 @@ composer_header_get_property (GObject *object, { EComposerHeaderPrivate *priv; - priv = E_COMPOSER_HEADER_GET_PRIVATE (object); + priv = E_COMPOSER_HEADER (object)->priv; switch (property_id) { case PROP_BUTTON: /* construct only */ @@ -282,7 +278,7 @@ e_composer_header_class_init (EComposerHeaderClass *class) static void e_composer_header_init (EComposerHeader *header) { - header->priv = E_COMPOSER_HEADER_GET_PRIVATE (header); + header->priv = G_TYPE_INSTANCE_GET_PRIVATE (header, E_TYPE_COMPOSER_HEADER, EComposerHeaderPrivate); } gchar * diff --git a/composer/e-composer-name-header.c b/composer/e-composer-name-header.c index 057266c707..a8cdc6fca4 100644 --- a/composer/e-composer-name-header.c +++ b/composer/e-composer-name-header.c @@ -27,10 +27,6 @@ #include "addressbook/gui/contact-editor/e-contact-editor.h" #include "addressbook/gui/contact-list-editor/e-contact-list-editor.h" -#define E_COMPOSER_NAME_HEADER_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_COMPOSER_NAME_HEADER, EComposerNameHeaderPrivate)) - /* Convenience macro */ #define E_COMPOSER_NAME_HEADER_GET_ENTRY(header) \ (E_NAME_SELECTOR_ENTRY (E_COMPOSER_HEADER (header)->input_widget)) @@ -123,7 +119,7 @@ composer_name_header_constructor (GType type, e_composer_name_header_parent_class)->constructor ( type, n_construct_properties, construct_properties); - priv = E_COMPOSER_NAME_HEADER_GET_PRIVATE (object); + priv = E_COMPOSER_NAME_HEADER (object)->priv; g_assert (E_IS_NAME_SELECTOR (priv->name_selector)); model = e_name_selector_peek_model (priv->name_selector); @@ -171,7 +167,7 @@ composer_name_header_set_property (GObject *object, { EComposerNameHeaderPrivate *priv; - priv = E_COMPOSER_NAME_HEADER_GET_PRIVATE (object); + priv = E_COMPOSER_NAME_HEADER (object)->priv; switch (property_id) { case PROP_NAME_SELECTOR: /* construct only */ @@ -206,7 +202,7 @@ composer_name_header_dispose (GObject *object) { EComposerNameHeaderPrivate *priv; - priv = E_COMPOSER_NAME_HEADER_GET_PRIVATE (object); + priv = E_COMPOSER_NAME_HEADER (object)->priv; if (priv->name_selector != NULL) { g_object_unref (priv->name_selector); @@ -223,7 +219,7 @@ composer_name_header_clicked (EComposerHeader *header) EComposerNameHeaderPrivate *priv; ENameSelectorDialog *dialog; - priv = E_COMPOSER_NAME_HEADER_GET_PRIVATE (header); + priv = E_COMPOSER_NAME_HEADER (header)->priv; dialog = e_name_selector_peek_dialog (priv->name_selector); e_name_selector_dialog_set_destination_index ( @@ -265,7 +261,7 @@ e_composer_name_header_class_init (EComposerNameHeaderClass *class) static void e_composer_name_header_init (EComposerNameHeader *header) { - header->priv = E_COMPOSER_NAME_HEADER_GET_PRIVATE (header); + header->priv = G_TYPE_INSTANCE_GET_PRIVATE (header, E_TYPE_COMPOSER_NAME_HEADER, EComposerNameHeaderPrivate); } EComposerHeader * diff --git a/composer/e-composer-post-header.c b/composer/e-composer-post-header.c index be7e57727e..49611d29f8 100644 --- a/composer/e-composer-post-header.c +++ b/composer/e-composer-post-header.c @@ -24,10 +24,6 @@ #include #include -#define E_COMPOSER_POST_HEADER_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_COMPOSER_POST_HEADER, EComposerPostHeaderPrivate)) - enum { PROP_0, PROP_ACCOUNT @@ -172,7 +168,7 @@ composer_post_header_dispose (GObject *object) { EComposerPostHeaderPrivate *priv; - priv = E_COMPOSER_POST_HEADER_GET_PRIVATE (object); + priv = E_COMPOSER_POST_HEADER (object)->priv; if (priv->account != NULL) { g_object_unref (priv->account); @@ -188,7 +184,7 @@ composer_post_header_finalize (GObject *object) { EComposerPostHeaderPrivate *priv; - priv = E_COMPOSER_POST_HEADER_GET_PRIVATE (object); + priv = E_COMPOSER_POST_HEADER (object)->priv; g_free (priv->base_url); @@ -201,7 +197,7 @@ composer_post_header_changed (EComposerHeader *header) { EComposerPostHeaderPrivate *priv; - priv = E_COMPOSER_POST_HEADER_GET_PRIVATE (header); + priv = E_COMPOSER_POST_HEADER (header)->priv; priv->custom = TRUE; } @@ -211,7 +207,7 @@ composer_post_header_clicked (EComposerHeader *header) { EComposerPostHeaderPrivate *priv; - priv = E_COMPOSER_POST_HEADER_GET_PRIVATE (header); + priv = E_COMPOSER_POST_HEADER (header)->priv; priv->custom = FALSE; } @@ -249,7 +245,7 @@ e_composer_post_header_class_init (EComposerPostHeaderClass *class) static void e_composer_post_header_init (EComposerPostHeader *header) { - header->priv = E_COMPOSER_POST_HEADER_GET_PRIVATE (header); + header->priv = G_TYPE_INSTANCE_GET_PRIVATE (header, E_TYPE_COMPOSER_POST_HEADER, EComposerPostHeaderPrivate); } EComposerHeader * diff --git a/composer/e-composer-private.h b/composer/e-composer-private.h index 9ed3b11c59..229897756f 100644 --- a/composer/e-composer-private.h +++ b/composer/e-composer-private.h @@ -61,10 +61,6 @@ #include #endif -#define E_MSG_COMPOSER_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_MSG_COMPOSER, EMsgComposerPrivate)) - /* Mail configuration keys */ #define MAIL_GCONF_PREFIX \ "/apps/evolution/mail" diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index ae6c5258f6..d2d9837a45 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -1471,7 +1471,7 @@ is_top_signature (EMsgComposer *composer) { EShell *shell; EShellSettings *shell_settings; - EMsgComposerPrivate *priv = E_MSG_COMPOSER_GET_PRIVATE (composer); + EMsgComposerPrivate *priv = composer->priv; g_return_val_if_fail (priv != NULL, FALSE); @@ -2475,7 +2475,7 @@ msg_composer_submit_alert (EAlertSink *alert_sink, GtkWidget *dialog; GtkWindow *parent; - priv = E_MSG_COMPOSER_GET_PRIVATE (alert_sink); + priv = E_MSG_COMPOSER (alert_sink)->priv; switch (e_alert_get_message_type (alert)) { case GTK_MESSAGE_INFO: @@ -2627,7 +2627,7 @@ e_msg_composer_alert_sink_init (EAlertSinkInterface *interface) static void e_msg_composer_init (EMsgComposer *composer) { - composer->priv = E_MSG_COMPOSER_GET_PRIVATE (composer); + composer->priv = G_TYPE_INSTANCE_GET_PRIVATE (composer, E_TYPE_MSG_COMPOSER, EMsgComposerPrivate); } /* Callbacks. */ @@ -3159,7 +3159,7 @@ e_msg_composer_new_with_message (EShell *shell, } composer = e_msg_composer_new (shell); - priv = E_MSG_COMPOSER_GET_PRIVATE (composer); + priv = composer->priv; table = e_msg_composer_get_header_table (composer); if (postto) { -- cgit