aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-06-05 04:53:10 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-06-09 01:14:48 +0800
commitf014ab82c81078d60cb1df8c986305c2cc9948c2 (patch)
treec3bde4e5da923c9ee082fcb994b10c2ce2f61dc2 /addressbook
parent7428fc93d58921bab9968a999172b843af2a2244 (diff)
downloadgsoc2013-evolution-f014ab82c81078d60cb1df8c986305c2cc9948c2.tar
gsoc2013-evolution-f014ab82c81078d60cb1df8c986305c2cc9948c2.tar.gz
gsoc2013-evolution-f014ab82c81078d60cb1df8c986305c2cc9948c2.tar.bz2
gsoc2013-evolution-f014ab82c81078d60cb1df8c986305c2cc9948c2.tar.lz
gsoc2013-evolution-f014ab82c81078d60cb1df8c986305c2cc9948c2.tar.xz
gsoc2013-evolution-f014ab82c81078d60cb1df8c986305c2cc9948c2.tar.zst
gsoc2013-evolution-f014ab82c81078d60cb1df8c986305c2cc9948c2.zip
Coding style and whitespace cleanups.
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-fullname.c38
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c41
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c85
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c15
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.c49
-rw-r--r--addressbook/gui/widgets/ea-addressbook.c3
-rw-r--r--addressbook/importers/evolution-csv-importer.c14
-rw-r--r--addressbook/importers/evolution-ldif-importer.c5
-rw-r--r--addressbook/importers/evolution-vcard-importer.c4
9 files changed, 172 insertions, 82 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.c b/addressbook/gui/contact-editor/e-contact-editor-fullname.c
index 21eddb14d2..c2dc45304b 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-fullname.c
+++ b/addressbook/gui/contact-editor/e-contact-editor-fullname.c
@@ -71,7 +71,9 @@ e_contact_editor_fullname_set_property (GObject *object,
}
break;
case PROP_EDITABLE: {
+ gboolean editable;
gint i;
+
const gchar *widget_names[] = {
"comboentry-title",
"comboentry-suffix",
@@ -85,22 +87,32 @@ e_contact_editor_fullname_set_property (GObject *object,
"label-last",
NULL
};
- e_contact_editor_fullname->editable = g_value_get_boolean (value) ? TRUE : FALSE;
+
+ editable = g_value_get_boolean (value);
+ e_contact_editor_fullname->editable = editable;
+
for (i = 0; widget_names[i] != NULL; i++) {
- GtkWidget *w = e_builder_get_widget (
+ GtkWidget *widget;
+
+ widget = e_builder_get_widget (
e_contact_editor_fullname->builder,
widget_names[i]);
- if (GTK_IS_ENTRY (w)) {
- gtk_editable_set_editable (GTK_EDITABLE (w),
- e_contact_editor_fullname->editable);
- }
- else if (GTK_IS_COMBO_BOX (w)) {
- gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (w))),
- e_contact_editor_fullname->editable);
- gtk_widget_set_sensitive (w, e_contact_editor_fullname->editable);
- }
- else if (GTK_IS_LABEL (w)) {
- gtk_widget_set_sensitive (w, e_contact_editor_fullname->editable);
+
+ if (GTK_IS_ENTRY (widget)) {
+ gtk_editable_set_editable (
+ GTK_EDITABLE (widget), editable);
+
+ } else if (GTK_IS_COMBO_BOX (widget)) {
+ GtkWidget *child;
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+
+ gtk_editable_set_editable (
+ GTK_EDITABLE (child), editable);
+ gtk_widget_set_sensitive (widget, editable);
+
+ } else if (GTK_IS_LABEL (widget)) {
+ gtk_widget_set_sensitive (widget, editable);
}
}
break;
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 1df7b62082..b636190777 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -1787,7 +1787,9 @@ fill_in_im (EContactEditor *editor)
gint slot;
im_name = e_vcard_attribute_get_value (attr);
- slot = alloc_ui_slot (editor, "entry-im-name", get_ui_slot (attr), IM_SLOTS);
+ slot = alloc_ui_slot (
+ editor, "entry-im-name",
+ get_ui_slot (attr), IM_SLOTS);
if (slot < 1)
break;
@@ -1870,7 +1872,8 @@ extract_im (EContactEditor *editor)
e_vcard_attribute_add_value (attr, name);
set_ui_slot (attr, i);
- service_attr_list[service] = g_list_append (service_attr_list[service], attr);
+ service_attr_list[service] = g_list_append (
+ service_attr_list[service], attr);
}
g_free (name);
@@ -2795,7 +2798,8 @@ init_simple (EContactEditor *editor)
gint i;
for (i = 0; i < G_N_ELEMENTS (simple_field_map); i++) {
- widget = e_builder_get_widget (editor->builder, simple_field_map[i].widget_name);
+ widget = e_builder_get_widget (
+ editor->builder, simple_field_map[i].widget_name);
if (!widget)
continue;
@@ -2829,7 +2833,8 @@ fill_in_simple (EContactEditor *editor)
!simple_field_map[i].process_data)
continue;
- widget = e_builder_get_widget (editor->builder, simple_field_map[i].widget_name);
+ widget = e_builder_get_widget (
+ editor->builder, simple_field_map[i].widget_name);
if (!widget)
continue;
@@ -2878,7 +2883,8 @@ extract_simple (EContactEditor *editor)
!simple_field_map[i].process_data)
continue;
- widget = e_builder_get_widget (editor->builder, simple_field_map[i].widget_name);
+ widget = e_builder_get_widget (
+ editor->builder, simple_field_map[i].widget_name);
if (!widget)
continue;
@@ -2899,7 +2905,8 @@ sensitize_simple (EContactEditor *editor)
GtkWidget *widget;
gboolean enabled = TRUE;
- widget = e_builder_get_widget (editor->builder, simple_field_map[i].widget_name);
+ widget = e_builder_get_widget (
+ editor->builder, simple_field_map[i].widget_name);
if (!widget)
continue;
@@ -3121,15 +3128,23 @@ static void
categories_response (GtkDialog *dialog, gint response, EContactEditor *editor)
{
const gchar *categories;
- GtkWidget *entry = e_builder_get_widget(editor->builder, "entry-categories");
+ GtkWidget *entry;
+
+ entry = e_builder_get_widget (editor->builder, "entry-categories");
if (response == GTK_RESPONSE_OK) {
- categories = e_categories_dialog_get_categories (E_CATEGORIES_DIALOG (dialog));
- if (entry && GTK_IS_ENTRY (entry))
- gtk_entry_set_text (GTK_ENTRY (entry), categories);
+ categories = e_categories_dialog_get_categories (
+ E_CATEGORIES_DIALOG (dialog));
+ if (GTK_IS_ENTRY (entry))
+ gtk_entry_set_text (
+ GTK_ENTRY (entry), categories);
else
- e_contact_set (editor->contact, E_CONTACT_CATEGORIES, (gchar *) categories);
+ e_contact_set (
+ editor->contact,
+ E_CONTACT_CATEGORIES,
+ (gchar *) categories);
}
+
gtk_widget_destroy (GTK_WIDGET (dialog));
editor->categories_dialog = NULL;
}
@@ -4150,7 +4165,9 @@ e_contact_editor_set_property (GObject *object,
break;
if (editor->target_book) {
- g_signal_handler_disconnect (editor->target_book, editor->target_editable_id);
+ g_signal_handler_disconnect (
+ editor->target_book,
+ editor->target_editable_id);
g_object_unref (editor->target_book);
}
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 31709bcf06..3fae1a2013 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -386,7 +386,9 @@ contact_list_editor_selection_changed_cb (GtkTreeSelection *selection,
/* Item before selected item exists => enable Top/Up buttons */
selected = gtk_tree_selection_get_selected_rows (selection, &model);
- first_item = gtk_tree_path_copy (selected->data); /* Don't update path in the list! */
+
+ /* Don't update path in the list! */
+ first_item = gtk_tree_path_copy (selected->data);
if (gtk_tree_path_prev (first_item)) {
gtk_widget_set_sensitive (WIDGET (TOP_BUTTON), TRUE);
gtk_widget_set_sensitive (WIDGET (UP_BUTTON), TRUE);
@@ -934,21 +936,33 @@ contact_list_editor_top_button_clicked_cb (GtkButton *button);
void
contact_list_editor_top_button_clicked_cb (GtkButton *button)
{
- EContactListEditor *editor = contact_list_editor_extract (GTK_WIDGET (button));
- GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (WIDGET (TREE_VIEW)));
- GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (WIDGET (TREE_VIEW)));
+ EContactListEditor *editor;
+ GtkTreeView *tree_view;
+ GtkTreeModel *model;
+ GtkTreeSelection *selection;
GtkTreeIter iter;
GtkTreePath *path;
GList *references = NULL;
+ GList *l, *selected;
+
+ editor = contact_list_editor_extract (GTK_WIDGET (button));
+
+ tree_view = GTK_TREE_VIEW (WIDGET (TREE_VIEW));
+ model = gtk_tree_view_get_model (tree_view);
+ selection = gtk_tree_view_get_selection (tree_view);
+
+ selected = gtk_tree_selection_get_selected_rows (selection, &model);
- GList *l, *selected = gtk_tree_selection_get_selected_rows (selection, &model);
for (l = selected; l; l = l->next)
- references = g_list_prepend (references, gtk_tree_row_reference_new (model, l->data));
+ references = g_list_prepend (
+ references,
+ gtk_tree_row_reference_new (model, l->data));
for (l = references; l; l = l->next) {
path = gtk_tree_row_reference_get_path (l->data);
gtk_tree_model_get_iter (model, &iter, path);
- gtk_list_store_move_after (GTK_LIST_STORE (model), &iter, NULL);
+ gtk_list_store_move_after (
+ GTK_LIST_STORE (model), &iter, NULL);
gtk_tree_path_free (path);
}
@@ -966,13 +980,21 @@ contact_list_editor_up_button_clicked_cb (GtkButton *button);
void
contact_list_editor_up_button_clicked_cb (GtkButton *button)
{
- EContactListEditor *editor = contact_list_editor_extract (GTK_WIDGET (button));
- GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (WIDGET (TREE_VIEW)));
- GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (WIDGET (TREE_VIEW)));
+ EContactListEditor *editor;
+ GtkTreeView *tree_view;
+ GtkTreeModel *model;
+ GtkTreeSelection *selection;
GtkTreeIter iter, iter2;
GtkTreePath *path;
+ GList *selected;
- GList *selected = gtk_tree_selection_get_selected_rows (selection, &model);
+ editor = contact_list_editor_extract (GTK_WIDGET (button));
+
+ tree_view = GTK_TREE_VIEW (WIDGET (TREE_VIEW));
+ model = gtk_tree_view_get_model (tree_view);
+ selection = gtk_tree_view_get_selection (tree_view);
+
+ selected = gtk_tree_selection_get_selected_rows (selection, &model);
/* Get iter of item above the first selected item */
path = gtk_tree_path_copy (selected->data);
@@ -997,12 +1019,20 @@ contact_list_editor_down_button_clicked_cb (GtkButton *button);
void
contact_list_editor_down_button_clicked_cb (GtkButton *button)
{
- EContactListEditor *editor = contact_list_editor_extract (GTK_WIDGET (button));
- GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (WIDGET (TREE_VIEW)));
- GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (WIDGET (TREE_VIEW)));
+ EContactListEditor *editor;
+ GtkTreeView *tree_view;
+ GtkTreeModel *model;
+ GtkTreeSelection *selection;
GtkTreeIter iter, iter2;
+ GList *selected;
- GList *selected = gtk_tree_selection_get_selected_rows (selection, &model);
+ editor = contact_list_editor_extract (GTK_WIDGET (button));
+
+ tree_view = GTK_TREE_VIEW (WIDGET (TREE_VIEW));
+ model = gtk_tree_view_get_model (tree_view);
+ selection = gtk_tree_view_get_selection (tree_view);
+
+ selected = gtk_tree_selection_get_selected_rows (selection, &model);
/* Iter of the first selected item */
gtk_tree_model_get_iter (model, &iter, selected->data);
@@ -1025,22 +1055,34 @@ contact_list_editor_bottom_button_clicked_cb (GtkButton *button);
void
contact_list_editor_bottom_button_clicked_cb (GtkButton *button)
{
- EContactListEditor *editor = contact_list_editor_extract (GTK_WIDGET (button));
- GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (WIDGET (TREE_VIEW)));
- GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (WIDGET (TREE_VIEW)));
+ EContactListEditor *editor;
+ GtkTreeView *tree_view;
+ GtkTreeModel *model;
+ GtkTreeSelection *selection;
GtkTreeIter iter;
GtkTreePath *path;
GList *references = NULL;
- GList *l, *selected = gtk_tree_selection_get_selected_rows (selection, &model);
+ GList *l, *selected;
+
+ editor = contact_list_editor_extract (GTK_WIDGET (button));
+
+ tree_view = GTK_TREE_VIEW (WIDGET (TREE_VIEW));
+ model = gtk_tree_view_get_model (tree_view);
+ selection = gtk_tree_view_get_selection (tree_view);
+
+ selected = gtk_tree_selection_get_selected_rows (selection, &model);
for (l = selected; l; l = l->next)
- references = g_list_prepend (references, gtk_tree_row_reference_new (model, l->data));
+ references = g_list_prepend (
+ references,
+ gtk_tree_row_reference_new (model, l->data));
references = g_list_reverse (references);
for (l = references; l; l = l->next) {
path = gtk_tree_row_reference_get_path (l->data);
gtk_tree_model_get_iter (model, &iter, path);
- gtk_list_store_move_before (GTK_LIST_STORE (model), &iter, NULL);
+ gtk_list_store_move_before (
+ GTK_LIST_STORE (model), &iter, NULL);
gtk_tree_path_free (path);
}
@@ -1052,7 +1094,6 @@ contact_list_editor_bottom_button_clicked_cb (GtkButton *button)
contact_list_editor_selection_changed_cb (selection, editor);
}
-
/******************** GtkBuilder Custom Widgets Functions ********************/
static gpointer
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index c2c21bdd78..30720513d0 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -395,19 +395,24 @@ addressbook_model_idle_cb (EAddressbookModel *model)
remove_book_view (model);
if (model->priv->first_get_view) {
+ gboolean do_initial_query;
+
model->priv->first_get_view = FALSE;
- if (e_book_check_static_capability (model->priv->book, "do-initial-query")) {
+ do_initial_query = e_book_check_static_capability (
+ model->priv->book, "do-initial-query");
+
+ if (do_initial_query) {
e_book_get_book_view_async (
model->priv->book, model->priv->query,
NULL, limit, book_view_loaded, model);
} else {
free_data (model);
- g_signal_emit (model,
- signals[MODEL_CHANGED], 0);
- g_signal_emit (model,
- signals[STOP_STATE_CHANGED], 0);
+ g_signal_emit (
+ model, signals[MODEL_CHANGED], 0);
+ g_signal_emit (
+ model, signals[STOP_STATE_CHANGED], 0);
}
} else
e_book_get_book_view_async (
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.c b/addressbook/gui/widgets/e-minicard-view-widget.c
index 1508e0690f..4421b1a739 100644
--- a/addressbook/gui/widgets/e-minicard-view-widget.c
+++ b/addressbook/gui/widgets/e-minicard-view-widget.c
@@ -399,13 +399,14 @@ e_minicard_view_widget_realize (GtkWidget *widget)
EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET (widget);
GtkStyle *style = gtk_widget_get_style (widget);
- view->background = gnome_canvas_item_new (gnome_canvas_root ( GNOME_CANVAS (view) ),
- e_canvas_background_get_type (),
- "fill_color_gdk", &style->base[GTK_STATE_NORMAL],
- NULL );
+ view->background = gnome_canvas_item_new (
+ gnome_canvas_root (GNOME_CANVAS (view)),
+ e_canvas_background_get_type (),
+ "fill_color_gdk", &style->base[GTK_STATE_NORMAL],
+ NULL );
view->emv = gnome_canvas_item_new (
- gnome_canvas_root ( GNOME_CANVAS (view) ),
+ gnome_canvas_root (GNOME_CANVAS (view)),
e_minicard_view_get_type (),
"height", (double) 100,
"minimum_width", (double) 100,
@@ -413,24 +414,26 @@ e_minicard_view_widget_realize (GtkWidget *widget)
"column_width", view->column_width,
NULL );
- g_signal_connect (E_REFLOW (view->emv)->selection,
- "selection_changed",
- G_CALLBACK (selection_change), view);
- g_signal_connect (E_REFLOW (view->emv)->selection,
- "selection_row_changed",
- G_CALLBACK (selection_row_change), view);
- g_signal_connect (view->emv,
- "column_width_changed",
- G_CALLBACK (column_width_changed), view);
- g_signal_connect (view->emv,
- "create-contact",
- G_CALLBACK (create_contact), view);
- g_signal_connect (view->emv,
- "create-contact-list",
- G_CALLBACK (create_contact_list), view);
- g_signal_connect (view->emv,
- "right_click",
- G_CALLBACK (right_click), view);
+ g_signal_connect (
+ E_REFLOW (view->emv)->selection,
+ "selection_changed",
+ G_CALLBACK (selection_change), view);
+ g_signal_connect (
+ E_REFLOW (view->emv)->selection,
+ "selection_row_changed",
+ G_CALLBACK (selection_row_change), view);
+ g_signal_connect (
+ view->emv, "column_width_changed",
+ G_CALLBACK (column_width_changed), view);
+ g_signal_connect (
+ view->emv, "create-contact",
+ G_CALLBACK (create_contact), view);
+ g_signal_connect (
+ view->emv, "create-contact-list",
+ G_CALLBACK (create_contact_list), view);
+ g_signal_connect (
+ view->emv, "right_click",
+ G_CALLBACK (right_click), view);
if (GTK_WIDGET_CLASS (parent_class)->realize)
GTK_WIDGET_CLASS (parent_class)->realize (widget);
diff --git a/addressbook/gui/widgets/ea-addressbook.c b/addressbook/gui/widgets/ea-addressbook.c
index 20bca97948..b67d876139 100644
--- a/addressbook/gui/widgets/ea-addressbook.c
+++ b/addressbook/gui/widgets/ea-addressbook.c
@@ -79,7 +79,8 @@ ea_addressbook_focus_watcher (GSignalInvocationHint *ihint,
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (object);
ea_event = atk_gobject_accessible_for_object (object);
if (event->type == GDK_FOCUS_CHANGE) {
- if ((event->focus_change.in) && (E_IS_MINICARD (item->canvas->focused_item)))
+ if ((event->focus_change.in) &&
+ (E_IS_MINICARD (item->canvas->focused_item)))
atk_focus_tracker_notify (ea_event);
}
}
diff --git a/addressbook/importers/evolution-csv-importer.c b/addressbook/importers/evolution-csv-importer.c
index 28d9f2d617..358b8198ab 100644
--- a/addressbook/importers/evolution-csv-importer.c
+++ b/addressbook/importers/evolution-csv-importer.c
@@ -316,7 +316,8 @@ date_from_string (const gchar *str)
date->day = str[i] - '0' * 1;
i = i+2;
}
- date->year = str[i] * 1000 + str[i+1] * 100 + str[i+2] * 10 + str[i+3] - '0' * 1111;
+ date->year = str[i] * 1000 + str[i + 1] * 100 +
+ str[i + 2] * 10 + str[i + 3] - '0' * 1111;
return date;
}
@@ -388,7 +389,9 @@ map_fields (const gchar *header_line, gint pimporter)
while (value = parseNextValue (&pptr), value != NULL) {
for (j = 0; j < n_fields; j++) {
if (g_ascii_strcasecmp (fields_array[j].csv_attribute, value->str) == 0) {
- g_hash_table_insert (fmap, GINT_TO_POINTER (idx), GINT_TO_POINTER (j + 1));
+ g_hash_table_insert (
+ fmap, GINT_TO_POINTER (idx),
+ GINT_TO_POINTER (j + 1));
any_found = TRUE;
break;
}
@@ -445,9 +448,12 @@ parseLine (CSVImporter *gci, EContact *contact, gchar *buf) {
idx = ii;
if (gci->fields_map) {
- gpointer found = g_hash_table_lookup (gci->fields_map, GINT_TO_POINTER (idx));
+ gpointer found;
- if (!found) {
+ found = g_hash_table_lookup (
+ gci->fields_map, GINT_TO_POINTER (idx));
+
+ if (found == NULL) {
g_warning ("%s: No map for index %d, skipping it", G_STRFUNC, idx);
idx = -1;
} else {
diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c
index c76f0763bf..85e46923d1 100644
--- a/addressbook/importers/evolution-ldif-importer.c
+++ b/addressbook/importers/evolution-ldif-importer.c
@@ -302,7 +302,10 @@ parseLine (GHashTable *dn_contact_hash, EContact *contact,
}
else {
/* FIXME is everything a string? */
- e_contact_set (contact, ldif_fields[i].contact_field, ldif_value->str);
+ e_contact_set (
+ contact,
+ ldif_fields[i].contact_field,
+ ldif_value->str);
g_message ("set %s to %s", ptr, ldif_value->str);
}
field_handled = TRUE;
diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c
index 97f2551c38..04f81b222c 100644
--- a/addressbook/importers/evolution-vcard-importer.c
+++ b/addressbook/importers/evolution-vcard-importer.c
@@ -936,7 +936,9 @@ evolution_contact_importer_get_preview_widget (const GList *contacts)
if (description) {
const gchar *at = strchr (description, '@');
if (at) {
- free_description = g_strndup (description, (gsize)(at - description));
+ free_description = g_strndup (
+ description,
+ (gsize) (at - description));
description = free_description;
}
}