aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-12-01 10:53:20 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-02-20 23:04:25 +0800
commit23f5773903d64a554d977ae7d0ebbaca73528f1f (patch)
tree104e1a59da8bf96b004bce204b79f47bbe0a6d13 /addressbook
parent49bc4c2d765ee1780c23fdc9f42152850dabb220 (diff)
downloadgsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.gz
gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.zst
gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.zip
Coding style and whitespace cleanup.
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c41
-rw-r--r--addressbook/gui/contact-editor/e-contact-quick-add.c8
-rw-r--r--addressbook/gui/contact-editor/eab-editor.c38
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c38
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-model.c6
-rw-r--r--addressbook/gui/merging/eab-contact-merging.c13
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c42
-rw-r--r--addressbook/gui/widgets/e-addressbook-reflow-adapter.c155
-rw-r--r--addressbook/gui/widgets/e-addressbook-selector.c48
-rw-r--r--addressbook/gui/widgets/e-addressbook-table-adapter.c97
-rw-r--r--addressbook/gui/widgets/e-addressbook-table-adapter.h41
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c70
-rw-r--r--addressbook/gui/widgets/e-minicard-label.c39
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.c31
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c55
-rw-r--r--addressbook/gui/widgets/e-minicard.c26
-rw-r--r--addressbook/gui/widgets/eab-config.c44
-rw-r--r--addressbook/gui/widgets/eab-contact-display.c60
-rw-r--r--addressbook/gui/widgets/eab-gui-util.c13
-rw-r--r--addressbook/gui/widgets/gal-view-minicard.c31
-rw-r--r--addressbook/printing/e-contact-print.c4
21 files changed, 314 insertions, 586 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index f926eea764..3189632d53 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -73,8 +73,6 @@ enum {
NUM_IM_COLUMNS
};
-static void e_contact_editor_init (EContactEditor *editor);
-static void e_contact_editor_class_init (EContactEditorClass *klass);
static void e_contact_editor_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -205,6 +203,8 @@ static const gint email_default[] = { 0, 1, 2, 2 };
#define STRING_IS_EMPTY(x) (!(x) || !(*(x)))
#define STRING_MAKE_NON_NULL(x) ((x) ? (x) : "")
+G_DEFINE_TYPE (EContactEditor, e_contact_editor, EAB_TYPE_EDITOR)
+
static void
e_contact_editor_contact_added (EABEditor *editor,
const GError *error,
@@ -256,37 +256,11 @@ e_contact_editor_closed (EABEditor *editor)
g_object_unref (editor);
}
-GType
-e_contact_editor_get_type (void)
-{
- static GType contact_editor_type = 0;
-
- if (!contact_editor_type) {
- static const GTypeInfo contact_editor_info = {
- sizeof (EContactEditorClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_contact_editor_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EContactEditor),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_contact_editor_init,
- };
-
- contact_editor_type = g_type_register_static (
- EAB_TYPE_EDITOR, "EContactEditor",
- &contact_editor_info, 0);
- }
-
- return contact_editor_type;
-}
-
static void
-e_contact_editor_class_init (EContactEditorClass *klass)
+e_contact_editor_class_init (EContactEditorClass *class)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- EABEditorClass *editor_class = EAB_EDITOR_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+ EABEditorClass *editor_class = EAB_EDITOR_CLASS (class);
parent_class = g_type_class_ref (EAB_TYPE_EDITOR);
@@ -3286,8 +3260,9 @@ categories_clicked (GtkWidget *button,
return;
}
- g_signal_connect (dialog, "response",
- G_CALLBACK (categories_response), editor);
+ g_signal_connect (
+ dialog, "response",
+ G_CALLBACK (categories_response), editor);
/* Close the category dialog if the editor is closed*/
g_signal_connect_swapped (
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c
index 3595437f28..3ec9430040 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -450,7 +450,9 @@ build_quick_add_dialog (QuickAdd *qa)
container = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_container_set_border_width (GTK_CONTAINER (container), 0);
- g_signal_connect (dialog, "response", G_CALLBACK (clicked_cb), qa);
+ g_signal_connect (
+ dialog, "response",
+ G_CALLBACK (clicked_cb), qa);
qa->dialog = dialog;
@@ -607,7 +609,9 @@ e_contact_quick_add_free_form (const gchar *text,
/* walk backwards to whitespace or a < or a quote... */
while (last_at >= text && !bad_char
- && !(isspace ((gint) *last_at) || *last_at == '<' || *last_at == '"')) {
+ && !(isspace ((gint) *last_at) ||
+ *last_at == '<' ||
+ *last_at == '"')) {
/* Check for some stuff that can't appear in a legal e-mail address. */
if (*last_at == '['
|| *last_at == ']'
diff --git a/addressbook/gui/contact-editor/eab-editor.c b/addressbook/gui/contact-editor/eab-editor.c
index 241bc477a4..d6e8322ad8 100644
--- a/addressbook/gui/contact-editor/eab-editor.c
+++ b/addressbook/gui/contact-editor/eab-editor.c
@@ -31,6 +31,10 @@
#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;
};
@@ -52,6 +56,8 @@ static GSList *all_editors;
static gpointer parent_class;
static guint signals[LAST_SIGNAL];
+G_DEFINE_ABSTRACT_TYPE (EABEditor, eab_editor, G_TYPE_OBJECT)
+
static void
eab_editor_quit_requested_cb (EShell *shell,
EShellQuitReason reason,
@@ -123,7 +129,7 @@ eab_editor_dispose (GObject *object)
{
EABEditorPrivate *priv;
- priv = EAB_EDITOR (object)->priv;
+ priv = EAB_EDITOR_GET_PRIVATE (object);
if (priv->shell != NULL) {
g_signal_handlers_disconnect_matched (
@@ -214,39 +220,11 @@ eab_editor_class_init (EABEditorClass *class)
static void
eab_editor_init (EABEditor *editor)
{
- editor->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- editor, EAB_TYPE_EDITOR, EABEditorPrivate);
+ editor->priv = EAB_EDITOR_GET_PRIVATE (editor);
all_editors = g_slist_prepend (all_editors, editor);
}
-GType
-eab_editor_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EABEditorClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) eab_editor_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EABEditor),
- 0, /* n_preallocs */
- (GInstanceInitFunc) eab_editor_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- G_TYPE_OBJECT, "EABEditor", &type_info,
- G_TYPE_FLAG_ABSTRACT);
- }
-
- return type;
-}
-
EShell *
eab_editor_get_shell (EABEditor *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 e95d87e3e9..42099d1e05 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -53,9 +53,13 @@
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_CONTACT_LIST_EDITOR, EContactListEditorPrivate))
+#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 (editor)->priv->builder, name))
+ (E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor)->builder, name))
/* More macros, less typos. */
#define CONTACT_LIST_EDITOR_WIDGET_ADD_BUTTON(editor) \
@@ -65,7 +69,7 @@
#define CONTACT_LIST_EDITOR_WIDGET_DIALOG(editor) \
CONTACT_LIST_EDITOR_WIDGET ((editor), "dialog")
#define CONTACT_LIST_EDITOR_WIDGET_EMAIL_ENTRY(editor) \
- editor->priv->email_entry
+ E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor)->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) \
@@ -137,6 +141,8 @@ struct _EContactListEditorPrivate {
static gpointer parent_class;
+G_DEFINE_TYPE (EContactListEditor, e_contact_list_editor, EAB_TYPE_EDITOR)
+
static EContactListEditor *
contact_list_editor_extract (GtkWidget *widget)
{
@@ -1174,7 +1180,7 @@ setup_custom_widgets (EContactListEditor *editor)
g_return_if_fail (editor != NULL);
- priv = editor->priv;
+ priv = E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor);
combo_box = WIDGET (SOURCE_MENU);
if (!e_book_client_get_sources (&source_list, &error))
@@ -1378,7 +1384,8 @@ contact_list_editor_constructed (GObject *object)
selection = gtk_tree_view_get_selection (view);
gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
- g_signal_connect (selection, "changed",
+ g_signal_connect (
+ selection, "changed",
G_CALLBACK (contact_list_editor_selection_changed_cb), editor);
gtk_tree_view_enable_model_drag_dest (view, NULL, 0, GDK_ACTION_LINK);
@@ -1492,7 +1499,7 @@ contact_list_editor_is_valid (EABEditor *editor)
static gboolean
contact_list_editor_is_changed (EABEditor *editor)
{
- return E_CONTACT_LIST_EDITOR (editor)->priv->changed;
+ return E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor)->changed;
}
static GtkWindow *
@@ -1555,7 +1562,7 @@ contact_list_editor_closed (EABEditor *editor)
/****************************** GType Callbacks ******************************/
static void
-contact_list_editor_class_init (EContactListEditorClass *class)
+e_contact_list_editor_class_init (EContactListEditorClass *class)
{
GObjectClass *object_class;
EABEditorClass *editor_class;
@@ -1624,30 +1631,13 @@ contact_list_editor_class_init (EContactListEditorClass *class)
}
static void
-contact_list_editor_init (EContactListEditor *editor)
+e_contact_list_editor_init (EContactListEditor *editor)
{
editor->priv = E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor);
}
/***************************** Public Interface ******************************/
-GType
-e_contact_list_editor_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- type = g_type_register_static_simple (
- EAB_TYPE_EDITOR,
- "EContactListEditor",
- sizeof (EContactListEditorClass),
- (GClassInitFunc) contact_list_editor_class_init,
- sizeof (EContactListEditor),
- (GInstanceInitFunc) contact_list_editor_init, 0);
-
- return type;
-}
-
EABEditor *
e_contact_list_editor_new (EShell *shell,
EBookClient *book_client,
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-model.c b/addressbook/gui/contact-list-editor/e-contact-list-model.c
index 8236bafea4..c81beeecbe 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-model.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-model.c
@@ -29,6 +29,10 @@
#include "e-util/e-alert-dialog.h"
#include "shell/e-shell.h"
+#define E_CONTACT_LIST_MODEL_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CONTACT_LIST_MODEL, EContactListModelPrivate))
+
static gpointer parent_class;
G_DEFINE_TYPE (EContactListModel, e_contact_list_model, GTK_TYPE_TREE_STORE);
@@ -111,7 +115,7 @@ e_contact_list_model_class_init (EContactListModelClass *class)
static void
e_contact_list_model_init (EContactListModel *model)
{
- model->priv = G_TYPE_INSTANCE_GET_PRIVATE (model, E_TYPE_CONTACT_LIST_MODEL, EContactListModelPrivate);
+ model->priv = E_CONTACT_LIST_MODEL_GET_PRIVATE (model);
model->priv->uids_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
model->priv->emails_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c
index 4309354007..2302761812 100644
--- a/addressbook/gui/merging/eab-contact-merging.c
+++ b/addressbook/gui/merging/eab-contact-merging.c
@@ -405,7 +405,9 @@ mergeit (EContactMergingLookup *lookup)
data->field = use_field;
data->match = lookup->match;
e_contact_set (lookup->match, use_field, string);
- g_signal_connect (dropdown, "changed", G_CALLBACK(dropdown_changed), data);
+ g_signal_connect (
+ dropdown, "changed",
+ G_CALLBACK (dropdown_changed), data);
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget *) dropdown, FALSE, FALSE, 0);
@@ -451,7 +453,10 @@ mergeit (EContactMergingLookup *lookup)
if (field == E_CONTACT_NICKNAME || field == E_CONTACT_GIVEN_NAME)
gtk_widget_set_sensitive ((GtkWidget *) dropdown, FALSE);
- g_signal_connect (dropdown, "changed", G_CALLBACK(dropdown_changed), data);
+ g_signal_connect (
+ dropdown, "changed",
+ G_CALLBACK (dropdown_changed), data);
+
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget *) dropdown, FALSE, FALSE, 0);
gtk_table_attach_defaults (table, (GtkWidget *) hbox, 1, 2, row, row + 1);
@@ -464,7 +469,9 @@ mergeit (EContactMergingLookup *lookup)
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), GTK_WIDGET (table));
gtk_box_pack_start (GTK_BOX (content_area), GTK_WIDGET (scrolled_window), TRUE, TRUE, 0);
gtk_widget_show (scrolled_window);
- g_signal_connect (dialog, "map-event", G_CALLBACK (dialog_map), table);
+ g_signal_connect (
+ dialog, "map-event",
+ G_CALLBACK (dialog_map), table);
gtk_widget_show_all ((GtkWidget *) table);
result = gtk_dialog_run (GTK_DIALOG (dialog));
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index fa61c4e5e2..bb8f2b59e3 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -31,6 +31,10 @@
#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 {
EBookClient *book_client;
gchar *query_str;
@@ -80,6 +84,8 @@ enum {
static gpointer parent_class;
static guint signals[LAST_SIGNAL];
+G_DEFINE_TYPE (EAddressbookModel, e_addressbook_model, G_TYPE_OBJECT)
+
static void
free_data (EAddressbookModel *model)
{
@@ -546,7 +552,7 @@ addressbook_model_finalize (GObject *object)
{
EAddressbookModelPrivate *priv;
- priv = E_ADDRESSBOOK_MODEL (object)->priv;
+ priv = E_ADDRESSBOOK_MODEL_GET_PRIVATE (object);
g_ptr_array_free (priv->contacts, TRUE);
@@ -555,7 +561,7 @@ addressbook_model_finalize (GObject *object)
}
static void
-addressbook_model_class_init (EAddressbookModelClass *class)
+e_addressbook_model_class_init (EAddressbookModelClass *class)
{
GObjectClass *object_class;
@@ -705,41 +711,13 @@ addressbook_model_class_init (EAddressbookModelClass *class)
}
static void
-addressbook_model_init (EAddressbookModel *model)
+e_addressbook_model_init (EAddressbookModel *model)
{
- model->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- model, E_TYPE_ADDRESSBOOK_MODEL, EAddressbookModelPrivate);
-
+ model->priv = E_ADDRESSBOOK_MODEL_GET_PRIVATE (model);
model->priv->contacts = g_ptr_array_new ();
model->priv->first_get_view = TRUE;
}
-GType
-e_addressbook_model_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EAddressbookModelClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) addressbook_model_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EAddressbookModel),
- 0, /* n_preallocs */
- (GInstanceInitFunc) addressbook_model_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- G_TYPE_OBJECT, "EAddressbookModel", &type_info, 0);
- }
-
- return type;
-}
-
EAddressbookModel *
e_addressbook_model_new (void)
{
diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
index 71e63867d6..00a86ce73f 100644
--- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
+++ b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
@@ -31,6 +31,10 @@
#include <e-util/e-util.h>
#include "addressbook/printing/e-contact-print.h"
+#define E_ADDRESSBOOK_REFLOW_ADAPTER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER, EAddressbookReflowAdapterPrivate))
+
struct _EAddressbookReflowAdapterPrivate {
EAddressbookModel *model;
@@ -40,9 +44,6 @@ struct _EAddressbookReflowAdapterPrivate {
gint search_started_id, search_result_id;
};
-#define PARENT_TYPE e_reflow_model_get_type()
-static EReflowModel *parent_class;
-
#define d(x)
enum {
@@ -61,6 +62,11 @@ enum {
static guint signals[LAST_SIGNAL] = {0, };
+G_DEFINE_TYPE (
+ EAddressbookReflowAdapter,
+ e_addressbook_reflow_adapter,
+ E_TYPE_REFLOW_MODEL)
+
static void
unlink_model (EAddressbookReflowAdapter *adapter)
{
@@ -307,22 +313,19 @@ addressbook_incarnate (EReflowModel *erm,
EAddressbookReflowAdapterPrivate *priv = adapter->priv;
GnomeCanvasItem *item;
- item = gnome_canvas_item_new (parent,
- e_minicard_get_type (),
- "contact", e_addressbook_model_contact_at (priv->model, i),
- "editable", e_addressbook_model_get_editable (priv->model),
- NULL);
+ item = gnome_canvas_item_new (
+ parent, e_minicard_get_type (),
+ "contact", e_addressbook_model_contact_at (priv->model, i),
+ "editable", e_addressbook_model_get_editable (priv->model),
+ NULL);
-#if 0
- g_signal_connect (item, "selected",
- G_CALLBACK (card_selected), 0, emvm);
-#endif
+ g_signal_connect (
+ item, "drag_begin",
+ G_CALLBACK (adapter_drag_begin), adapter);
- g_signal_connect (item, "drag_begin",
- G_CALLBACK (adapter_drag_begin), adapter);
-
- g_signal_connect (item, "open-contact",
- G_CALLBACK (adapter_open_contact), adapter);
+ g_signal_connect (
+ item, "open-contact",
+ G_CALLBACK (adapter_open_contact), adapter);
return item;
}
@@ -470,16 +473,28 @@ addressbook_get_property (GObject *object,
}
static void
-e_addressbook_reflow_adapter_class_init (GObjectClass *object_class)
+e_addressbook_reflow_adapter_class_init (EAddressbookReflowAdapterClass *class)
{
- EReflowModelClass *model_class = (EReflowModelClass *) object_class;
+ GObjectClass *object_class;
+ EReflowModelClass *reflow_model_class;
- parent_class = g_type_class_peek_parent (object_class);
+ g_type_class_add_private (
+ class, sizeof (EAddressbookReflowAdapterPrivate));
+ object_class = G_OBJECT_CLASS (class);
object_class->set_property = addressbook_set_property;
object_class->get_property = addressbook_get_property;
object_class->dispose = addressbook_dispose;
+ reflow_model_class = E_REFLOW_MODEL_CLASS (class);
+ reflow_model_class->set_width = addressbook_set_width;
+ reflow_model_class->count = addressbook_count;
+ reflow_model_class->height = addressbook_height;
+ reflow_model_class->create_cmp_cache = addressbook_create_cmp_cache;
+ reflow_model_class->compare = addressbook_compare;
+ reflow_model_class->incarnate = addressbook_incarnate;
+ reflow_model_class->reincarnate = addressbook_reincarnate;
+
g_object_class_install_property (object_class, PROP_CLIENT,
g_param_spec_object ("client",
"EBookClient",
@@ -526,56 +541,12 @@ e_addressbook_reflow_adapter_class_init (GObjectClass *object_class)
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
E_TYPE_CONTACT);
-
- model_class->set_width = addressbook_set_width;
- model_class->count = addressbook_count;
- model_class->height = addressbook_height;
- model_class->create_cmp_cache = addressbook_create_cmp_cache;
- model_class->compare = addressbook_compare;
- model_class->incarnate = addressbook_incarnate;
- model_class->reincarnate = addressbook_reincarnate;
}
static void
-e_addressbook_reflow_adapter_init (GObject *object)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER (object);
- EAddressbookReflowAdapterPrivate *priv;
-
- priv = adapter->priv = g_new0 (EAddressbookReflowAdapterPrivate, 1);
-
- priv->loading = FALSE;
- priv->create_contact_id = 0;
- priv->remove_contact_id = 0;
- priv->modify_contact_id = 0;
- priv->model_changed_id = 0;
- priv->search_started_id = 0;
- priv->search_result_id = 0;
-}
-
-GType
-e_addressbook_reflow_adapter_get_type (void)
+e_addressbook_reflow_adapter_init (EAddressbookReflowAdapter *adapter)
{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EAddressbookReflowAdapterClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_addressbook_reflow_adapter_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EAddressbookReflowAdapter),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_addressbook_reflow_adapter_init,
- };
-
- type = g_type_register_static (
- PARENT_TYPE, "EAddressbookReflowAdapter", &info, 0);
- }
-
- return type;
+ adapter->priv = E_ADDRESSBOOK_REFLOW_ADAPTER_GET_PRIVATE (adapter);
}
void
@@ -584,33 +555,31 @@ e_addressbook_reflow_adapter_construct (EAddressbookReflowAdapter *adapter,
{
EAddressbookReflowAdapterPrivate *priv = adapter->priv;
- priv->model = model;
- g_object_ref (priv->model);
-
- priv->create_contact_id = g_signal_connect (priv->model,
- "contact_added",
- G_CALLBACK (create_contact),
- adapter);
- priv->remove_contact_id = g_signal_connect (priv->model,
- "contacts_removed",
- G_CALLBACK (remove_contacts),
- adapter);
- priv->modify_contact_id = g_signal_connect (priv->model,
- "contact_changed",
- G_CALLBACK (modify_contact),
- adapter);
- priv->model_changed_id = g_signal_connect (priv->model,
- "model_changed",
- G_CALLBACK (model_changed),
- adapter);
- priv->search_started_id = g_signal_connect (priv->model,
- "search_started",
- G_CALLBACK (search_started),
- adapter);
- priv->search_result_id = g_signal_connect (priv->model,
- "search_result",
- G_CALLBACK (search_result),
- adapter);
+ priv->model = g_object_ref (model);
+
+ priv->create_contact_id = g_signal_connect (
+ priv->model, "contact_added",
+ G_CALLBACK (create_contact), adapter);
+
+ priv->remove_contact_id = g_signal_connect (
+ priv->model, "contacts_removed",
+ G_CALLBACK (remove_contacts), adapter);
+
+ priv->modify_contact_id = g_signal_connect (
+ priv->model, "contact_changed",
+ G_CALLBACK (modify_contact), adapter);
+
+ priv->model_changed_id = g_signal_connect (
+ priv->model, "model_changed",
+ G_CALLBACK (model_changed), adapter);
+
+ priv->search_started_id = g_signal_connect (
+ priv->model, "search_started",
+ G_CALLBACK (search_started), adapter);
+
+ priv->search_result_id = g_signal_connect (
+ priv->model, "search_result",
+ G_CALLBACK (search_result), adapter);
}
EReflowModel *
diff --git a/addressbook/gui/widgets/e-addressbook-selector.c b/addressbook/gui/widgets/e-addressbook-selector.c
index 30bb8899f5..6fc1df3ebf 100644
--- a/addressbook/gui/widgets/e-addressbook-selector.c
+++ b/addressbook/gui/widgets/e-addressbook-selector.c
@@ -30,6 +30,10 @@
#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 {
@@ -60,6 +64,11 @@ static GtkTargetEntry drag_types[] = {
static gpointer parent_class;
+G_DEFINE_TYPE (
+ EAddressbookSelector,
+ e_addressbook_selector,
+ E_TYPE_SOURCE_SELECTOR)
+
static void
merge_context_next (MergeContext *merge_context)
{
@@ -233,7 +242,7 @@ addressbook_selector_dispose (GObject *object)
{
EAddressbookSelectorPrivate *priv;
- priv = E_ADDRESSBOOK_SELECTOR (object)->priv;
+ priv = E_ADDRESSBOOK_SELECTOR_GET_PRIVATE (object);
if (priv->current_view != NULL) {
g_object_unref (priv->current_view);
@@ -313,7 +322,7 @@ addressbook_selector_data_dropped (ESourceSelector *selector,
const gchar *string;
gboolean remove_from_source;
- priv = E_ADDRESSBOOK_SELECTOR (selector)->priv;
+ priv = E_ADDRESSBOOK_SELECTOR_GET_PRIVATE (selector);
g_return_val_if_fail (priv->current_view != NULL, FALSE);
string = (const gchar *) gtk_selection_data_get_data (selection_data);
@@ -345,7 +354,7 @@ addressbook_selector_data_dropped (ESourceSelector *selector,
}
static void
-addressbook_selector_class_init (EAddressbookSelectorClass *class)
+e_addressbook_selector_class_init (EAddressbookSelectorClass *class)
{
GObjectClass *object_class;
ESourceSelectorClass *selector_class;
@@ -374,11 +383,9 @@ addressbook_selector_class_init (EAddressbookSelectorClass *class)
}
static void
-addressbook_selector_init (EAddressbookSelector *selector)
+e_addressbook_selector_init (EAddressbookSelector *selector)
{
- selector->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- selector, E_TYPE_ADDRESSBOOK_SELECTOR,
- EAddressbookSelectorPrivate);
+ selector->priv = E_ADDRESSBOOK_SELECTOR_GET_PRIVATE (selector);
gtk_drag_dest_set (
GTK_WIDGET (selector), GTK_DEST_DEFAULT_ALL,
@@ -388,33 +395,6 @@ addressbook_selector_init (EAddressbookSelector *selector)
e_drag_dest_add_directory_targets (GTK_WIDGET (selector));
}
-GType
-e_addressbook_selector_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- const GTypeInfo type_info = {
- sizeof (EAddressbookSelectorClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) addressbook_selector_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EAddressbookSelector),
- 0, /* n_preallocs */
- (GInstanceInitFunc) addressbook_selector_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- E_TYPE_SOURCE_SELECTOR, "EAddressbookSelector",
- &type_info, 0);
- }
-
- return type;
-}
-
GtkWidget *
e_addressbook_selector_new (ESourceList *source_list)
{
diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.c b/addressbook/gui/widgets/e-addressbook-table-adapter.c
index 463bdc7a3d..5a2a9b473f 100644
--- a/addressbook/gui/widgets/e-addressbook-table-adapter.c
+++ b/addressbook/gui/widgets/e-addressbook-table-adapter.c
@@ -36,6 +36,10 @@
#include <libxml/parser.h>
#include <libxml/xmlmemory.h>
+#define E_ADDRESSBOOK_TABLE_ADAPTER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ADDRESSBOOK_TABLE_ADAPTER, EAddressbookTableAdapterPrivate))
+
struct _EAddressbookTableAdapterPrivate {
EAddressbookModel *model;
@@ -44,11 +48,13 @@ struct _EAddressbookTableAdapterPrivate {
GHashTable *emails;
};
-#define PARENT_TYPE e_table_model_get_type()
-static ETableModelClass *parent_class;
-
#define COLS (E_CONTACT_FIELD_LAST)
+G_DEFINE_TYPE (
+ EAddressbookTableAdapter,
+ e_addressbook_table_adapter,
+ E_TYPE_TABLE_MODEL)
+
static void
unlink_model (EAddressbookTableAdapter *adapter)
{
@@ -70,22 +76,18 @@ unlink_model (EAddressbookTableAdapter *adapter)
}
static void
-addressbook_dispose (GObject *object)
+addressbook_finalize (GObject *object)
{
- EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER (object);
+ EAddressbookTableAdapter *adapter;
- if (adapter->priv) {
- unlink_model (adapter);
+ adapter = E_ADDRESSBOOK_TABLE_ADAPTER (object);
- g_hash_table_remove_all (adapter->priv->emails);
- g_hash_table_destroy (adapter->priv->emails);
+ unlink_model (adapter);
- g_free (adapter->priv);
- adapter->priv = NULL;
- }
+ g_hash_table_destroy (adapter->priv->emails);
- /* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (e_addressbook_table_adapter_parent_class)->finalize (object);
}
/* This function returns the number of columns in our ETableModel. */
@@ -99,7 +101,7 @@ addressbook_col_count (ETableModel *etc)
static gint
addressbook_row_count (ETableModel *etc)
{
- EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER (etc);
+ EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER (etc);
EAddressbookTableAdapterPrivate *priv = adapter->priv;
return e_addressbook_model_contact_count (priv->model);
@@ -111,7 +113,7 @@ addressbook_value_at (ETableModel *etc,
gint col,
gint row)
{
- EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER (etc);
+ EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER (etc);
EAddressbookTableAdapterPrivate *priv = adapter->priv;
EContact *contact;
const gchar *value;
@@ -164,7 +166,7 @@ addressbook_set_value_at (ETableModel *etc,
gint row,
gconstpointer val)
{
- EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER (etc);
+ EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER (etc);
EAddressbookTableAdapterPrivate *priv = adapter->priv;
if (e_addressbook_model_get_editable (priv->model)) {
@@ -219,7 +221,7 @@ addressbook_append_row (ETableModel *etm,
ETableModel *source,
gint row)
{
- EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER (etm);
+ EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER (etm);
EAddressbookTableAdapterPrivate *priv = adapter->priv;
EBookClient *book_client;
EContact *contact;
@@ -280,14 +282,18 @@ addressbook_value_to_string (ETableModel *etc,
}
static void
-eab_table_adapter_class_init (GObjectClass *object_class)
+e_addressbook_table_adapter_class_init (EAddressbookTableAdapterClass *class)
{
- ETableModelClass *model_class = (ETableModelClass *) object_class;
+ GObjectClass *object_class;
+ ETableModelClass *model_class;
- parent_class = g_type_class_peek_parent (object_class);
+ g_type_class_add_private (
+ class, sizeof (EAddressbookTableAdapterPrivate));
- object_class->dispose = addressbook_dispose;
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = addressbook_finalize;
+ model_class = E_TABLE_MODEL_CLASS (class);
model_class->column_count = addressbook_col_count;
model_class->row_count = addressbook_row_count;
model_class->value_at = addressbook_value_at;
@@ -302,17 +308,9 @@ eab_table_adapter_class_init (GObjectClass *object_class)
}
static void
-eab_table_adapter_init (GObject *object)
+e_addressbook_table_adapter_init (EAddressbookTableAdapter *adapter)
{
- EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER (object);
- EAddressbookTableAdapterPrivate *priv;
-
- priv = adapter->priv = g_new0 (EAddressbookTableAdapterPrivate, 1);
-
- priv->create_contact_id = 0;
- priv->remove_contact_id = 0;
- priv->modify_contact_id = 0;
- priv->model_changed_id = 0;
+ adapter->priv = E_ADDRESSBOOK_TABLE_ADAPTER_GET_PRIVATE (adapter);
}
static void
@@ -368,34 +366,9 @@ model_changed (EAddressbookModel *model,
e_table_model_changed (E_TABLE_MODEL (adapter));
}
-GType
-eab_table_adapter_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EAddressbookTableAdapterClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) eab_table_adapter_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EAddressbookTableAdapter),
- 0, /* n_preallocs */
- (GInstanceInitFunc) eab_table_adapter_init,
- };
-
- type = g_type_register_static (
- PARENT_TYPE, "EAddressbookTableAdapter", &info, 0);
- }
-
- return type;
-}
-
void
-eab_table_adapter_construct (EAddressbookTableAdapter *adapter,
- EAddressbookModel *model)
+e_addressbook_table_adapter_construct (EAddressbookTableAdapter *adapter,
+ EAddressbookModel *model)
{
EAddressbookTableAdapterPrivate *priv = adapter->priv;
@@ -425,13 +398,13 @@ eab_table_adapter_construct (EAddressbookTableAdapter *adapter,
}
ETableModel *
-eab_table_adapter_new (EAddressbookModel *model)
+e_addressbook_table_adapter_new (EAddressbookModel *model)
{
EAddressbookTableAdapter *et;
- et = g_object_new (E_TYPE_AB_TABLE_ADAPTER, NULL);
+ et = g_object_new (E_TYPE_ADDRESSBOOK_TABLE_ADAPTER, NULL);
- eab_table_adapter_construct (et, model);
+ e_addressbook_table_adapter_construct (et, model);
return E_TABLE_MODEL (et);
}
diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.h b/addressbook/gui/widgets/e-addressbook-table-adapter.h
index 17cf4cfadb..51c9436ff2 100644
--- a/addressbook/gui/widgets/e-addressbook-table-adapter.h
+++ b/addressbook/gui/widgets/e-addressbook-table-adapter.h
@@ -23,19 +23,33 @@
#include <table/e-table-model.h>
-#define E_TYPE_AB_TABLE_ADAPTER (eab_table_adapter_get_type ())
-#define EAB_TABLE_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_AB_TABLE_ADAPTER, EAddressbookTableAdapter))
-#define EAB_TABLE_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_AB_TABLE_ADAPTER, EAddressbookTableAdapterClass))
-#define E_IS_ADDRESSBOOK_TABLE_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_AB_TABLE_ADAPTER))
-#define E_IS_ADDRESSBOOK_TABLE_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_AB_TABLE_ADAPTER))
+/* Standard GObject macros */
+#define E_TYPE_ADDRESSBOOK_TABLE_ADAPTER \
+ (e_addressbook_table_adapter_get_type ())
+#define E_ADDRESSBOOK_TABLE_ADAPTER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_ADDRESSBOOK_TABLE_ADAPTER, EAddressbookTableAdapter))
+#define E_ADDRESSBOOK_TABLE_ADAPTER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_ADDRESSBOOK_TABLE_ADAPTER, EAddressbookTableAdapterClass))
+#define E_IS_ADDRESSBOOK_TABLE_ADAPTER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_ADDRESSBOOK_TABLE_ADAPTER))
+#define E_IS_ADDRESSBOOK_TABLE_ADAPTER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_ADDRESSBOOK_TABLE_ADAPTER))
+#define E_ADDRESSBOOK_TABLE_ADAPTER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_ADDRESSBOOK_TABLE_ADAPTER, EAddressbookTableAdapterClass))
+
+G_BEGIN_DECLS
typedef struct _EAddressbookTableAdapter EAddressbookTableAdapter;
-typedef struct _EAddressbookTableAdapterPrivate EAddressbookTableAdapterPrivate;
typedef struct _EAddressbookTableAdapterClass EAddressbookTableAdapterClass;
+typedef struct _EAddressbookTableAdapterPrivate EAddressbookTableAdapterPrivate;
struct _EAddressbookTableAdapter {
ETableModel parent;
-
EAddressbookTableAdapterPrivate *priv;
};
@@ -43,9 +57,14 @@ struct _EAddressbookTableAdapterClass {
ETableModelClass parent_class;
};
-GType eab_table_adapter_get_type (void);
-void eab_table_adapter_construct (EAddressbookTableAdapter *adapter,
- EAddressbookModel *model);
-ETableModel *eab_table_adapter_new (EAddressbookModel *model);
+GType e_addressbook_table_adapter_get_type
+ (void) G_GNUC_CONST;
+void e_addressbook_table_adapter_construct
+ (EAddressbookTableAdapter *adapter,
+ EAddressbookModel *model);
+ETableModel * e_addressbook_table_adapter_new
+ (EAddressbookModel *model);
+
+G_END_DECLS
#endif /* _EAB_TABLE_ADAPTER_H_ */
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 9bda90a280..1212cc60bd 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -61,6 +61,10 @@
#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,
@@ -126,6 +130,18 @@ static GtkTargetEntry drag_types[] = {
static gpointer parent_class;
static guint signals[LAST_SIGNAL];
+/* Forward Declarations */
+static void e_addressbook_view_selectable_init
+ (ESelectableInterface *interface);
+
+G_DEFINE_TYPE_WITH_CODE (
+ EAddressbookView,
+ e_addressbook_view,
+ GTK_TYPE_SCROLLED_WINDOW,
+ G_IMPLEMENT_INTERFACE (
+ E_TYPE_SELECTABLE,
+ e_addressbook_view_selectable_init))
+
static void
addressbook_view_emit_open_contact (EAddressbookView *view,
EContact *contact,
@@ -289,7 +305,7 @@ addressbook_view_create_table_view (EAddressbookView *view,
GtkWidget *widget;
gchar *etspecfile;
- adapter = eab_table_adapter_new (view->priv->model);
+ adapter = e_addressbook_table_adapter_new (view->priv->model);
extras = e_table_extras_new ();
@@ -494,7 +510,7 @@ addressbook_view_dispose (GObject *object)
{
EAddressbookViewPrivate *priv;
- priv = E_ADDRESSBOOK_VIEW (object)->priv;
+ priv = E_ADDRESSBOOK_VIEW_GET_PRIVATE (object);
if (priv->shell_view != NULL) {
g_object_remove_weak_pointer (
@@ -737,7 +753,7 @@ addressbook_view_select_all (ESelectable *selectable)
}
static void
-addressbook_view_class_init (EAddressbookViewClass *class)
+e_addressbook_view_class_init (EAddressbookViewClass *class)
{
GObjectClass *object_class;
@@ -838,12 +854,11 @@ addressbook_view_class_init (EAddressbookViewClass *class)
}
static void
-addressbook_view_init (EAddressbookView *view)
+e_addressbook_view_init (EAddressbookView *view)
{
GtkTargetList *target_list;
- view->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- view, E_TYPE_ADDRESSBOOK_VIEW, EAddressbookViewPrivate);
+ view->priv = E_ADDRESSBOOK_VIEW_GET_PRIVATE (view);
view->priv->model = e_addressbook_model_new ();
@@ -863,7 +878,7 @@ addressbook_view_init (EAddressbookView *view)
}
static void
-addressbook_view_selectable_init (ESelectableInterface *interface)
+e_addressbook_view_selectable_init (ESelectableInterface *interface)
{
interface->update_actions = addressbook_view_update_actions;
interface->cut_clipboard = addressbook_view_cut_clipboard;
@@ -873,42 +888,6 @@ addressbook_view_selectable_init (ESelectableInterface *interface)
interface->select_all = addressbook_view_select_all;
}
-GType
-e_addressbook_view_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EAddressbookViewClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) addressbook_view_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EAddressbookView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) addressbook_view_init,
- NULL /* value_table */
- };
-
- static const GInterfaceInfo selectable_info = {
- (GInterfaceInitFunc) addressbook_view_selectable_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL /* interface_data */
- };
-
- type = g_type_register_static (
- GTK_TYPE_SCROLLED_WINDOW, "EAddressbookView",
- &type_info, 0);
-
- g_type_add_interface_static (
- type, E_TYPE_SELECTABLE, &selectable_info);
- }
-
- return type;
-}
-
GtkWidget *
e_addressbook_view_new (EShellView *shell_view,
ESource *source)
@@ -933,8 +912,9 @@ e_addressbook_view_new (EShellView *shell_view,
g_signal_connect_swapped (
view->priv->model, "folder_bar_message",
G_CALLBACK (folder_bar_message), view);
- g_signal_connect (view->priv->model, "stop_state_changed",
- G_CALLBACK (stop_state_changed), view);
+ g_signal_connect (
+ view->priv->model, "stop_state_changed",
+ G_CALLBACK (stop_state_changed), view);
g_signal_connect_swapped (
view->priv->model, "writable-status",
G_CALLBACK (command_state_change), view);
diff --git a/addressbook/gui/widgets/e-minicard-label.c b/addressbook/gui/widgets/e-minicard-label.c
index c22ffe58a5..88d9458c39 100644
--- a/addressbook/gui/widgets/e-minicard-label.c
+++ b/addressbook/gui/widgets/e-minicard-label.c
@@ -35,8 +35,6 @@
#include <misc/e-canvas-utils.h>
#include <gdk/gdkkeysyms.h>
-static void e_minicard_label_init (EMinicardLabel *card);
-static void e_minicard_label_class_init (EMinicardLabelClass *klass);
static void e_minicard_label_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
static void e_minicard_label_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
static gboolean e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event);
@@ -71,42 +69,23 @@ enum {
static guint e_minicard_label_signals[LAST_SIGNAL] = {0, };
-GType
-e_minicard_label_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EMinicardLabelClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_minicard_label_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EMinicardLabel),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_minicard_label_init,
- };
-
- type = g_type_register_static (gnome_canvas_group_get_type (), "EMinicardLabel", &info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (
+ EMinicardLabel,
+ e_minicard_label,
+ GNOME_TYPE_CANVAS_GROUP)
static void
-e_minicard_label_class_init (EMinicardLabelClass *klass)
+e_minicard_label_class_init (EMinicardLabelClass *class)
{
GObjectClass *object_class;
GnomeCanvasItemClass *item_class;
- object_class = G_OBJECT_CLASS (klass);
- item_class = (GnomeCanvasItemClass *) klass;
+ object_class = G_OBJECT_CLASS (class);
+ item_class = (GnomeCanvasItemClass *) class;
- klass->style_set = e_minicard_label_style_set;
+ class->style_set = e_minicard_label_style_set;
- parent_class = g_type_class_peek_parent (klass);
+ parent_class = g_type_class_peek_parent (class);
object_class->set_property = e_minicard_label_set_property;
object_class->get_property = e_minicard_label_get_property;
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.c b/addressbook/gui/widgets/e-minicard-view-widget.c
index 0a0b19df94..b06e92dbf9 100644
--- a/addressbook/gui/widgets/e-minicard-view-widget.c
+++ b/addressbook/gui/widgets/e-minicard-view-widget.c
@@ -32,9 +32,6 @@
#include "e-util/e-util.h"
#include "e-minicard-view-widget.h"
-static void e_minicard_view_widget_init (EMinicardViewWidget *widget);
-static void e_minicard_view_widget_class_init
- (EMinicardViewWidgetClass *class);
static void e_minicard_view_widget_set_property
(GObject *object,
guint property_id,
@@ -80,30 +77,10 @@ enum {
static guint signals[LAST_SIGNAL] = {0, };
-GType
-e_minicard_view_widget_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EMinicardViewWidgetClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_minicard_view_widget_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EMinicardViewWidget),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_minicard_view_widget_init,
- };
-
- type = g_type_register_static (
- E_TYPE_CANVAS, "EMinicardViewWidget", &info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (
+ EMinicardViewWidget,
+ e_minicard_view_widget,
+ E_TYPE_CANVAS)
static void
e_minicard_view_widget_class_init (EMinicardViewWidgetClass *class)
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index ba52e7a0a8..a07c5d90bf 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -48,7 +48,6 @@ static void e_minicard_view_drag_data_get (GtkWidget *widget,
EMinicardView *view);
static EReflowClass *parent_class = NULL;
-#define PARENT_TYPE (E_REFLOW_TYPE)
/* The arguments we take */
enum {
@@ -79,6 +78,8 @@ static GtkTargetEntry drag_types[] = {
{ (gchar *) VCARD_LIST_TYPE, 0, DND_TARGET_TYPE_VCARD_LIST }
};
+G_DEFINE_TYPE (EMinicardView, e_minicard_view, E_TYPE_REFLOW)
+
static void
e_minicard_view_drag_data_get (GtkWidget *widget,
GdkDragContext *context,
@@ -229,8 +230,9 @@ adapter_changed (EMinicardView *view)
{
set_empty_message (view);
- g_signal_connect (view->adapter, "drag_begin",
- G_CALLBACK (e_minicard_view_drag_begin), view);
+ g_signal_connect (
+ view->adapter, "drag_begin",
+ G_CALLBACK (e_minicard_view_drag_begin), view);
}
static void
@@ -275,12 +277,12 @@ e_minicard_view_set_property (GObject *object,
"model", &model,
NULL);
if (model) {
- view->writable_status_id =
- g_signal_connect (model, "writable_status",
- G_CALLBACK (writable_status_change), view);
- view->stop_state_id =
- g_signal_connect (model, "stop_state_changed",
- G_CALLBACK (stop_state_changed), view);
+ view->writable_status_id = g_signal_connect (
+ model, "writable_status",
+ G_CALLBACK (writable_status_change), view);
+ view->stop_state_id = g_signal_connect (
+ model, "stop_state_changed",
+ G_CALLBACK (stop_state_changed), view);
}
}
@@ -466,17 +468,17 @@ e_minicard_view_selection_event (EReflow *reflow,
}
static void
-e_minicard_view_class_init (EMinicardViewClass *klass)
+e_minicard_view_class_init (EMinicardViewClass *class)
{
GObjectClass *object_class;
GnomeCanvasItemClass *item_class;
EReflowClass *reflow_class;
- object_class = G_OBJECT_CLASS (klass);
- item_class = (GnomeCanvasItemClass *) klass;
- reflow_class = (EReflowClass *) klass;
+ object_class = G_OBJECT_CLASS (class);
+ item_class = (GnomeCanvasItemClass *) class;
+ reflow_class = (EReflowClass *) class;
- parent_class = g_type_class_peek_parent (klass);
+ parent_class = g_type_class_peek_parent (class);
object_class->set_property = e_minicard_view_set_property;
object_class->get_property = e_minicard_view_get_property;
@@ -556,31 +558,6 @@ e_minicard_view_init (EMinicardView *view)
set_empty_message (view);
}
-GType
-e_minicard_view_get_type (void)
-{
- static GType reflow_type = 0;
-
- if (!reflow_type) {
- static const GTypeInfo reflow_info = {
- sizeof (EMinicardViewClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_minicard_view_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EMinicardView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_minicard_view_init,
- };
-
- reflow_type = g_type_register_static (
- PARENT_TYPE, "EMinicardView", &reflow_info, 0);
- }
-
- return reflow_type;
-}
-
void
e_minicard_view_jump_to_letter (EMinicardView *view,
gunichar letter)
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
index 3c13a0cd71..86a17eca87 100644
--- a/addressbook/gui/widgets/e-minicard.c
+++ b/addressbook/gui/widgets/e-minicard.c
@@ -41,8 +41,6 @@
#include <libebook/e-destination.h>
#include "ea-addressbook.h"
-static void e_minicard_init (EMinicard *card);
-static void e_minicard_class_init (EMinicardClass *class);
static void e_minicard_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
static void e_minicard_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
static void e_minicard_dispose (GObject *object);
@@ -104,29 +102,7 @@ common_location[] =
static guint signals[LAST_SIGNAL] = {0, };
-GType
-e_minicard_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EMinicardClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_minicard_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EMinicard),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_minicard_init,
- };
-
- type = g_type_register_static (gnome_canvas_group_get_type (), "EMinicard", &info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (EMinicard, e_minicard, GNOME_TYPE_CANVAS_GROUP)
static void
e_minicard_class_init (EMinicardClass *class)
diff --git a/addressbook/gui/widgets/eab-config.c b/addressbook/gui/widgets/eab-config.c
index 6974df22d1..df91f12802 100644
--- a/addressbook/gui/widgets/eab-config.c
+++ b/addressbook/gui/widgets/eab-config.c
@@ -26,17 +26,22 @@
#include "eab-config.h"
+#define EAB_CONFIG_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), EAB_TYPE_CONFIG, EABConfigPrivate))
+
static GObjectClass *ecp_parent_class;
struct _EABConfigPrivate {
guint source_changed_id;
};
+G_DEFINE_TYPE (EABConfig, eab_config, E_TYPE_CONFIG)
+
static void
-ecp_init (EABConfig *cfg)
+eab_config_init (EABConfig *cfg)
{
- cfg->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- cfg, EAB_TYPE_CONFIG, EABConfigPrivate);
+ cfg->priv = EAB_CONFIG_GET_PRIVATE (cfg);
}
static void
@@ -89,7 +94,7 @@ static void
ecp_set_target (EConfig *ec,
EConfigTarget *t)
{
- struct _EABConfigPrivate *p = EAB_CONFIG (ec)->priv;
+ struct _EABConfigPrivate *p = EAB_CONFIG_GET_PRIVATE (ec);
((EConfigClass *) ecp_parent_class)->set_target (ec, t);
@@ -109,34 +114,15 @@ ecp_set_target (EConfig *ec,
}
static void
-ecp_class_init (GObjectClass *klass)
+eab_config_class_init (EABConfigClass *class)
{
- ((EConfigClass *) klass)->set_target = ecp_set_target;
- ((EConfigClass *) klass)->target_free = ecp_target_free;
+ EConfigClass *config_class;
- g_type_class_add_private (klass, sizeof (struct _EABConfigPrivate));
-}
-
-GType
-eab_config_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EABConfigClass),
- NULL, NULL,
- (GClassInitFunc) ecp_class_init,
- NULL, NULL,
- sizeof (EABConfig), 0,
- (GInstanceInitFunc) ecp_init
- };
-
- ecp_parent_class = g_type_class_ref (e_config_get_type ());
- type = g_type_register_static (e_config_get_type (), "EABConfig", &info, 0);
- }
+ g_type_class_add_private (class, sizeof (struct _EABConfigPrivate));
- return type;
+ config_class = E_CONFIG_CLASS (class);
+ config_class->set_target = ecp_set_target;
+ config_class->target_free = ecp_target_free;
}
EABConfig *
diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c
index 44935c4ca9..8ade5c5026 100644
--- a/addressbook/gui/widgets/eab-contact-display.c
+++ b/addressbook/gui/widgets/eab-contact-display.c
@@ -43,6 +43,10 @@
#include <gtkhtml/gtkhtml-stream.h>
#include <gtkhtml/gtkhtml-embedded.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)
@@ -112,6 +116,11 @@ static const gchar *ui =
static gpointer parent_class;
static guint signals[LAST_SIGNAL];
+G_DEFINE_TYPE (
+ EABContactDisplay,
+ eab_contact_display,
+ E_TYPE_WEB_VIEW)
+
static void
contact_display_emit_send_message (EABContactDisplay *display,
gint email_num)
@@ -1163,7 +1172,7 @@ contact_display_dispose (GObject *object)
{
EABContactDisplayPrivate *priv;
- priv = EAB_CONTACT_DISPLAY (object)->priv;
+ priv = EAB_CONTACT_DISPLAY_GET_PRIVATE (object);
if (priv->contact != NULL) {
g_object_unref (priv->contact);
@@ -1355,15 +1364,20 @@ contact_display_object_requested (GtkHTML *html,
GtkWidget *map = e_contact_map_new ();
gtk_container_add (GTK_CONTAINER (eb), map);
gtk_widget_set_size_request (map, 250, 250);
- g_signal_connect (E_CONTACT_MAP (map), "contact-added",
+ g_signal_connect (
+ E_CONTACT_MAP (map), "contact-added",
G_CALLBACK (e_contact_map_zoom_on_marker), NULL);
- g_signal_connect_swapped (E_CONTACT_MAP (map), "contact-added",
+ g_signal_connect_swapped (
+ E_CONTACT_MAP (map), "contact-added",
G_CALLBACK (gtk_widget_show_all), map);
- g_signal_connect (GTK_CHAMPLAIN_EMBED (map), "scroll-event",
+ g_signal_connect (
+ GTK_CHAMPLAIN_EMBED (map), "scroll-event",
G_CALLBACK (handle_map_scroll_event), NULL);
- /* No need to display photo in contact preview ------------------v */
- e_contact_map_add_marker (E_CONTACT_MAP (map), full_name, contact_uid, address, NULL);
+ /* No need to display photo in contact preview. */
+ e_contact_map_add_marker (
+ E_CONTACT_MAP (map), full_name,
+ contact_uid, address, NULL);
}
g_free (full_name);
@@ -1489,8 +1503,7 @@ eab_contact_display_init (EABContactDisplay *display)
const gchar *domain = GETTEXT_PACKAGE;
GError *error = NULL;
- display->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- display, EAB_TYPE_CONTACT_DISPLAY, EABContactDisplayPrivate);
+ display->priv = EAB_CONTACT_DISPLAY_GET_PRIVATE (display);
display->priv->mode = EAB_CONTACT_DISPLAY_RENDER_NORMAL;
display->priv->orientation = GTK_ORIENTATION_HORIZONTAL;
display->priv->show_maps = FALSE;
@@ -1501,8 +1514,9 @@ eab_contact_display_init (EABContactDisplay *display)
ui_manager = e_web_view_get_ui_manager (web_view);
#ifdef WITH_CONTACT_MAPS
- g_signal_connect (web_view, "object-requested",
- G_CALLBACK (contact_display_object_requested), display);
+ g_signal_connect (
+ web_view, "object-requested",
+ G_CALLBACK (contact_display_object_requested), display);
#endif
action_group = gtk_action_group_new ("internal-mailto");
@@ -1522,32 +1536,6 @@ eab_contact_display_init (EABContactDisplay *display)
g_error ("%s", error->message);
}
-GType
-eab_contact_display_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EABContactDisplayClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) eab_contact_display_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EABContactDisplay),
- 0, /* n_preallocs */
- (GInstanceInitFunc) eab_contact_display_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- E_TYPE_WEB_VIEW, "EABContactDisplay", &type_info, 0);
- }
-
- return type;
-}
-
GtkWidget *
eab_contact_display_new (void)
{
diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c
index e3b8537caa..12c08d0b22 100644
--- a/addressbook/gui/widgets/eab-gui-util.c
+++ b/addressbook/gui/widgets/eab-gui-util.c
@@ -181,12 +181,19 @@ eab_load_error_dialog (GtkWidget *parent,
}
if (alert_sink) {
- e_alert_submit (alert_sink, "addressbook:load-error", label_string, NULL);
+ e_alert_submit (
+ alert_sink, "addressbook:load-error",
+ label_string, NULL);
} else {
GtkWidget *dialog;
- dialog = e_alert_dialog_new_for_args ((GtkWindow *) parent, "addressbook:load-error", label_string, NULL);
- g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
+ dialog = e_alert_dialog_new_for_args (
+ (GtkWindow *) parent,
+ "addressbook:load-error",
+ label_string, NULL);
+ g_signal_connect (
+ dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
gtk_widget_show (dialog);
}
diff --git a/addressbook/gui/widgets/gal-view-minicard.c b/addressbook/gui/widgets/gal-view-minicard.c
index 280ae7583f..277866a20c 100644
--- a/addressbook/gui/widgets/gal-view-minicard.c
+++ b/addressbook/gui/widgets/gal-view-minicard.c
@@ -35,6 +35,11 @@
static gpointer parent_class;
+G_DEFINE_TYPE (
+ GalViewMinicard,
+ gal_view_minicard,
+ GAL_TYPE_VIEW)
+
static void
view_minicard_column_width_changed (EAddressbookView *address_view,
gdouble width)
@@ -183,32 +188,6 @@ gal_view_minicard_init (GalViewMinicard *gvm)
gvm->emvw_column_width_changed_id = 0;
}
-GType
-gal_view_minicard_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (GalViewMinicardClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gal_view_minicard_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (GalViewMinicard),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gal_view_minicard_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- GAL_TYPE_VIEW, "GalViewMinicard", &type_info, 0);
- }
-
- return type;
-}
-
/**
* gal_view_minicard_new
* @title: The name of the new view.
diff --git a/addressbook/printing/e-contact-print.c b/addressbook/printing/e-contact-print.c
index 519f3bc336..0746a431c5 100644
--- a/addressbook/printing/e-contact-print.c
+++ b/addressbook/printing/e-contact-print.c
@@ -380,7 +380,9 @@ contact_compare (EContact *contact1,
field1 = e_contact_get_const (contact1, E_CONTACT_UID);
field2 = e_contact_get_const (contact2, E_CONTACT_UID);
- g_return_val_if_fail (field1 != NULL && field2 != NULL, (field1 != NULL) ? -1 : 1);
+ g_return_val_if_fail (
+ field1 != NULL && field2 != NULL,
+ (field1 != NULL) ? -1 : 1);
return strcmp (field1, field2);
}