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 /addressbook/gui/widgets | |
parent | f55aaa5e00a40a137f403a8d5c68dd508059b0b4 (diff) | |
download | gsoc2013-evolution-c003c99a75587ba39a45d164272760c33f9666b5.tar gsoc2013-evolution-c003c99a75587ba39a45d164272760c33f9666b5.tar.gz gsoc2013-evolution-c003c99a75587ba39a45d164272760c33f9666b5.tar.bz2 gsoc2013-evolution-c003c99a75587ba39a45d164272760c33f9666b5.tar.lz gsoc2013-evolution-c003c99a75587ba39a45d164272760c33f9666b5.tar.xz gsoc2013-evolution-c003c99a75587ba39a45d164272760c33f9666b5.tar.zst gsoc2013-evolution-c003c99a75587ba39a45d164272760c33f9666b5.zip |
Bug #614480 - Avoid using G_TYPE_INSTANCE_GET_PRIVATE repeatedly
Diffstat (limited to 'addressbook/gui/widgets')
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-model.c | 8 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-selector.c | 10 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.c | 8 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-config.c | 9 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-config.h | 7 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-contact-display.c | 8 |
6 files changed, 20 insertions, 30 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c index e64848f527..b4afd76e74 100644 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ b/addressbook/gui/widgets/e-addressbook-model.c @@ -28,10 +28,6 @@ #include <e-util/e-util.h> #include "eab-gui-util.h" -#define E_ADDRESSBOOK_MODEL_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_ADDRESSBOOK_MODEL, EAddressbookModelPrivate)) - struct _EAddressbookModelPrivate { EBook *book; EBookQuery *query; @@ -516,7 +512,7 @@ addressbook_model_finalize (GObject *object) { EAddressbookModelPrivate *priv; - priv = E_ADDRESSBOOK_MODEL_GET_PRIVATE (object); + priv = E_ADDRESSBOOK_MODEL (object)->priv; g_ptr_array_free (priv->contacts, TRUE); @@ -674,7 +670,7 @@ addressbook_model_class_init (EAddressbookModelClass *class) static void addressbook_model_init (EAddressbookModel *model) { - model->priv = E_ADDRESSBOOK_MODEL_GET_PRIVATE (model); + model->priv = G_TYPE_INSTANCE_GET_PRIVATE (model, E_TYPE_ADDRESSBOOK_MODEL, EAddressbookModelPrivate); model->priv->contacts = g_ptr_array_new (); model->priv->first_get_view = TRUE; diff --git a/addressbook/gui/widgets/e-addressbook-selector.c b/addressbook/gui/widgets/e-addressbook-selector.c index 018205e09f..727bf3c402 100644 --- a/addressbook/gui/widgets/e-addressbook-selector.c +++ b/addressbook/gui/widgets/e-addressbook-selector.c @@ -25,10 +25,6 @@ #include <eab-book-util.h> #include <eab-contact-merging.h> -#define E_ADDRESSBOOK_SELECTOR_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_ADDRESSBOOK_SELECTOR, EAddressbookSelectorPrivate)) - typedef struct _MergeContext MergeContext; struct _EAddressbookSelectorPrivate { @@ -219,7 +215,7 @@ addressbook_selector_dispose (GObject *object) { EAddressbookSelectorPrivate *priv; - priv = E_ADDRESSBOOK_SELECTOR_GET_PRIVATE (object); + priv = E_ADDRESSBOOK_SELECTOR (object)->priv; if (priv->current_view != NULL) { g_object_unref (priv->current_view); @@ -258,7 +254,7 @@ addressbook_selector_data_dropped (ESourceSelector *selector, const gchar *string; gboolean remove_from_source; - priv = E_ADDRESSBOOK_SELECTOR_GET_PRIVATE (selector); + priv = E_ADDRESSBOOK_SELECTOR (selector)->priv; g_return_val_if_fail (priv->current_view != NULL, FALSE); string = (const gchar *) gtk_selection_data_get_data (selection_data); @@ -324,7 +320,7 @@ addressbook_selector_class_init (EAddressbookSelectorClass *class) static void addressbook_selector_init (EAddressbookSelector *selector) { - selector->priv = E_ADDRESSBOOK_SELECTOR_GET_PRIVATE (selector); + selector->priv = G_TYPE_INSTANCE_GET_PRIVATE (selector, E_TYPE_ADDRESSBOOK_SELECTOR, EAddressbookSelectorPrivate); gtk_drag_dest_set ( GTK_WIDGET (selector), GTK_DEST_DEFAULT_ALL, diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 5d2636a413..4e759f9dcc 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -59,10 +59,6 @@ #include <ctype.h> #include <string.h> -#define E_ADDRESSBOOK_VIEW_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_ADDRESSBOOK_VIEW, EAddressbookViewPrivate)) - #define d(x) static void status_message (EAddressbookView *view, @@ -498,7 +494,7 @@ addressbook_view_dispose (GObject *object) { EAddressbookViewPrivate *priv; - priv = E_ADDRESSBOOK_VIEW_GET_PRIVATE (object); + priv = E_ADDRESSBOOK_VIEW (object)->priv; if (priv->shell_view != NULL) { g_object_remove_weak_pointer ( @@ -848,7 +844,7 @@ addressbook_view_init (EAddressbookView *view) { GtkTargetList *target_list; - view->priv = E_ADDRESSBOOK_VIEW_GET_PRIVATE (view); + view->priv = G_TYPE_INSTANCE_GET_PRIVATE (view, E_TYPE_ADDRESSBOOK_VIEW, EAddressbookViewPrivate); view->priv->model = e_addressbook_model_new (); diff --git a/addressbook/gui/widgets/eab-config.c b/addressbook/gui/widgets/eab-config.c index 79ba6c8445..e1f841af3f 100644 --- a/addressbook/gui/widgets/eab-config.c +++ b/addressbook/gui/widgets/eab-config.c @@ -32,17 +32,16 @@ struct _EABConfigPrivate { guint source_changed_id; }; -#define _PRIVATE(o) (g_type_instance_get_private((GTypeInstance *)o, eab_config_get_type())) - static void -ecp_init (GObject *o) +ecp_init (EABConfig *cfg) { + cfg->priv = G_TYPE_INSTANCE_GET_PRIVATE (cfg, EAB_TYPE_CONFIG, EABConfigPrivate); } static void ecp_target_free (EConfig *ec, EConfigTarget *t) { - struct _EABConfigPrivate *p = _PRIVATE (ec); + struct _EABConfigPrivate *p = EAB_CONFIG (ec)->priv; if (ec->target == t) { switch (t->type) { @@ -78,7 +77,7 @@ ecp_source_changed (struct _ESource *source, EConfig *ec) static void ecp_set_target (EConfig *ec, EConfigTarget *t) { - struct _EABConfigPrivate *p = _PRIVATE (ec); + struct _EABConfigPrivate *p = EAB_CONFIG (ec)->priv; ((EConfigClass *)ecp_parent_class)->set_target (ec, t); diff --git a/addressbook/gui/widgets/eab-config.h b/addressbook/gui/widgets/eab-config.h index fcf6b76f00..ef9bc0752c 100644 --- a/addressbook/gui/widgets/eab-config.h +++ b/addressbook/gui/widgets/eab-config.h @@ -28,13 +28,20 @@ #include "e-util/e-config.h" +#define EAB_TYPE_CONFIG (eab_config_get_type ()) +#define EAB_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EAB_TYPE_CONFIG, EABConfig)) + + G_BEGIN_DECLS typedef struct _EABConfig EABConfig; typedef struct _EABConfigClass EABConfigClass; +typedef struct _EABConfigPrivate EABConfigPrivate; struct _EABConfig { EConfig config; + + EABConfigPrivate *priv; }; struct _EABConfigClass { diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c index 47052f443a..449d112da4 100644 --- a/addressbook/gui/widgets/eab-contact-display.c +++ b/addressbook/gui/widgets/eab-contact-display.c @@ -37,10 +37,6 @@ #include <gtkhtml/gtkhtml.h> #include <gtkhtml/gtkhtml-stream.h> -#define EAB_CONTACT_DISPLAY_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), EAB_TYPE_CONTACT_DISPLAY, EABContactDisplayPrivate)) - #define TEXT_IS_RIGHT_TO_LEFT \ (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) @@ -952,7 +948,7 @@ contact_display_dispose (GObject *object) { EABContactDisplayPrivate *priv; - priv = EAB_CONTACT_DISPLAY_GET_PRIVATE (object); + priv = EAB_CONTACT_DISPLAY (object)->priv; if (priv->contact != NULL) { g_object_unref (priv->contact); @@ -1198,7 +1194,7 @@ eab_contact_display_init (EABContactDisplay *display) const gchar *domain = GETTEXT_PACKAGE; GError *error = NULL; - display->priv = EAB_CONTACT_DISPLAY_GET_PRIVATE (display); + display->priv = G_TYPE_INSTANCE_GET_PRIVATE (display, EAB_TYPE_CONTACT_DISPLAY, EABContactDisplayPrivate); display->priv->mode = EAB_CONTACT_DISPLAY_RENDER_NORMAL; display->priv->orientation = GTK_ORIENTATION_HORIZONTAL; |