Commit 23f57739 authored by Matthew Barnes's avatar Matthew Barnes

Coding style and whitespace cleanup.

parent 49bc4c2d
......@@ -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 (
......
......@@ -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 == ']'
......
......@@ -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)
{
......
......@@ -49,13 +49,17 @@
#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 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,
......
......@@ -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);
......
......@@ -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));
......
......@@ -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)
{
......
......@@ -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,