aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-02-25 23:20:41 +0800
committerMilan Crha <mcrha@redhat.com>2011-02-25 23:20:41 +0800
commit1301cf02efdacd20fb5ce3e2554ae15b8f146e8a (patch)
tree8d5f3985a82ec7d330af27ee0a29a79a2f0ecfa3 /addressbook
parent1a4be6c521d674c4a60e54203521e2721b81b921 (diff)
downloadgsoc2013-evolution-1301cf02efdacd20fb5ce3e2554ae15b8f146e8a.tar
gsoc2013-evolution-1301cf02efdacd20fb5ce3e2554ae15b8f146e8a.tar.gz
gsoc2013-evolution-1301cf02efdacd20fb5ce3e2554ae15b8f146e8a.tar.bz2
gsoc2013-evolution-1301cf02efdacd20fb5ce3e2554ae15b8f146e8a.tar.lz
gsoc2013-evolution-1301cf02efdacd20fb5ce3e2554ae15b8f146e8a.tar.xz
gsoc2013-evolution-1301cf02efdacd20fb5ce3e2554ae15b8f146e8a.tar.zst
gsoc2013-evolution-1301cf02efdacd20fb5ce3e2554ae15b8f146e8a.zip
Bug #614480 - Avoid using G_TYPE_INSTANCE_GET_PRIVATE repeatedly
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/gui/contact-editor/eab-editor.c8
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c16
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c8
-rw-r--r--addressbook/gui/widgets/e-addressbook-selector.c10
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c8
-rw-r--r--addressbook/gui/widgets/eab-config.c9
-rw-r--r--addressbook/gui/widgets/eab-config.h7
-rw-r--r--addressbook/gui/widgets/eab-contact-display.c8
8 files changed, 27 insertions, 47 deletions
diff --git a/addressbook/gui/contact-editor/eab-editor.c b/addressbook/gui/contact-editor/eab-editor.c
index b5e5232e00..dcce405470 100644
--- a/addressbook/gui/contact-editor/eab-editor.c
+++ b/addressbook/gui/contact-editor/eab-editor.c
@@ -31,10 +31,6 @@
#include "e-util/e-util.h"
#include "addressbook/gui/widgets/eab-gui-util.h"
-#define EAB_EDITOR_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE \
- ((obj), EAB_TYPE_EDITOR, EABEditorPrivate))
-
struct _EABEditorPrivate {
EShell *shell;
};
@@ -127,7 +123,7 @@ eab_editor_dispose (GObject *object)
{
EABEditorPrivate *priv;
- priv = EAB_EDITOR_GET_PRIVATE (object);
+ priv = EAB_EDITOR (object)->priv;
if (priv->shell != NULL) {
g_signal_handlers_disconnect_matched (
@@ -218,7 +214,7 @@ eab_editor_class_init (EABEditorClass *class)
static void
eab_editor_init (EABEditor *editor)
{
- editor->priv = EAB_EDITOR_GET_PRIVATE (editor);
+ editor->priv = G_TYPE_INSTANCE_GET_PRIVATE (editor, EAB_TYPE_EDITOR, EABEditorPrivate);
all_editors = g_slist_prepend (all_editors, editor);
}
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index 67c9c88c6f..547e172bca 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -47,13 +47,9 @@
#include "e-contact-list-model.h"
#include "eab-contact-merging.h"
-#define E_CONTACT_LIST_EDITOR_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE \
- ((obj), E_TYPE_CONTACT_LIST_EDITOR, EContactListEditorPrivate))
-
#define CONTACT_LIST_EDITOR_WIDGET(editor, name) \
(e_builder_get_widget \
- (E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor)->builder, name))
+ (E_CONTACT_LIST_EDITOR (editor)->priv->builder, name))
/* More macros, less typos. */
#define CONTACT_LIST_EDITOR_WIDGET_ADD_BUTTON(editor) \
@@ -63,7 +59,7 @@
#define CONTACT_LIST_EDITOR_WIDGET_DIALOG(editor) \
CONTACT_LIST_EDITOR_WIDGET ((editor), "dialog")
#define CONTACT_LIST_EDITOR_WIDGET_EMAIL_ENTRY(editor) \
- E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor)->email_entry
+ editor->priv->email_entry
#define CONTACT_LIST_EDITOR_WIDGET_LIST_NAME_ENTRY(editor) \
CONTACT_LIST_EDITOR_WIDGET ((editor), "list-name-entry")
#define CONTACT_LIST_EDITOR_WIDGET_MEMBERS_VBOX(editor) \
@@ -881,7 +877,7 @@ setup_custom_widgets (EContactListEditor *editor)
g_return_if_fail (editor != NULL);
- priv = E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor);
+ priv = editor->priv;
combo_box = WIDGET (SOURCE_MENU);
client = gconf_client_get_default ();
@@ -1134,7 +1130,7 @@ contact_list_editor_is_valid (EABEditor *editor)
static gboolean
contact_list_editor_is_changed (EABEditor *editor)
{
- return E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor)->changed;
+ return E_CONTACT_LIST_EDITOR (editor)->priv->changed;
}
static GtkWindow *
@@ -1270,7 +1266,7 @@ contact_list_editor_init (EContactListEditor *editor)
GtkCellRenderer *renderer;
GtkTreeView *view;
- priv = E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor);
+ editor->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (editor, E_TYPE_CONTACT_LIST_EDITOR, EContactListEditorPrivate);
priv->editable = TRUE;
priv->allows_contact_lists = TRUE;
@@ -1328,8 +1324,6 @@ contact_list_editor_init (EContactListEditor *editor)
gtk_widget_show_all (WIDGET (DIALOG));
setup_custom_widgets (editor);
-
- editor->priv = priv;
}
/***************************** Public Interface ******************************/
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;