Commit e7954c3f authored by Matthew Barnes's avatar Matthew Barnes Committed by Rodrigo Moya
Browse files

Coding style and whitespace cleanups.

parent dcaf6c52
......@@ -69,7 +69,7 @@ type_as_function ## _factory_get_type (void) \
static const GTypeInfo tinfo = \
{ \
sizeof (AtkObjectFactoryClass), \
NULL, NULL, (GClassInitFunc) type_as_function ## _factory_class_init, \
NULL, NULL, (GClassInitFunc) type_as_function ## _factory_class_init, \
NULL, NULL, sizeof (AtkObjectFactory), 0, NULL, NULL \
}; \
\
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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
......
......@@ -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 (
......
......@@ -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);
......
......@@ -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);
}
}
......
......@@ -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 {
......
......@@ -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;
......
......@@ -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;
}
}
......
......@@ -2120,7 +2120,8 @@ remove_client_alarms (ClientAlarms *ca)
{
debug (("size %d", g_hash_table_size (ca->uid_alarms_hash)));
g_hash_table_foreach_remove (ca->uid_alarms_hash, (GHRFunc) remove_comp_by_id, ca);
g_hash_table_foreach_remove (
ca->uid_alarms_hash, (GHRFunc) remove_comp_by_id, ca);
/* The hash table should be empty now */
g_return_if_fail (g_hash_table_size (ca->uid_alarms_hash) == 0);
......
......@@ -309,9 +309,13 @@ config_data_get_last_notification_time (ECal *cal)
if (cal) {
ESource *source = e_cal_get_source (cal);
if (source) {
const gchar *last_notified = e_source_get_property (source, "last-notified");
const gchar *last_notified;
GTimeVal tmval = {0};
last_notified = e_source_get_property (
source, "last-notified");
if (last_notified && *last_notified &&
g_time_val_from_iso8601 (last_notified, &tmval)) {
time_t now = time (NULL), val = (time_t) tmval.tv_sec;
......@@ -326,9 +330,13 @@ config_data_get_last_notification_time (ECal *cal)
if (!(client = config_data_get_conf_client ()))
return -1;
value = gconf_client_get_without_default (client, KEY_LAST_NOTIFICATION_TIME, NULL);
value = gconf_client_get_without_default (
client, KEY_LAST_NOTIFICATION_TIME, NULL);
if (value) {
time_t val = (time_t) gconf_value_get_int (value), now = time (NULL);
time_t val, now;
val = (time_t) gconf_value_get_int (value);
now = time (NULL);
if (val > now)
val = now;
......
......@@ -444,11 +444,15 @@ cal_comp_update_time_by_active_window (ECalComponent *comp, EShell *shell)
g_return_if_fail (shell != NULL);
window = e_shell_get_active_window (shell);
if (window && E_IS_SHELL_WINDOW (window)) {
EShellWindow *shell_window = E_SHELL_WINDOW (window);
if (e_shell_window_get_active_view (shell_window)
&& g_str_equal (e_shell_window_get_active_view (shell_window), "calendar")) {
if (E_IS_SHELL_WINDOW (window)) {
EShellWindow *shell_window;
const gchar *active_view;
shell_window = E_SHELL_WINDOW (window);
active_view = e_shell_window_get_active_view (shell_window);
if (g_strcmp0 (active_view, "calendar") == 0) {
EShellContent *shell_content;
EShellView *shell_view;
GnomeCalendar *gnome_cal;
......
......@@ -477,9 +477,14 @@ save_comp (CompEditor *editor)
if (result)
g_signal_emit_by_name (editor, "object_created");
} else {
gboolean has_recurrences;
if (e_cal_component_has_recurrences (priv->comp) && priv->mod == CALOBJ_MOD_ALL)
comp_util_sanitize_recurrence_master (priv->comp, priv->client);
has_recurrences =
e_cal_component_has_recurrences (priv->comp);
if (has_recurrences && priv->mod == CALOBJ_MOD_ALL)
comp_util_sanitize_recurrence_master (
priv->comp, priv->client);
if (priv->mod == CALOBJ_MOD_THIS) {
e_cal_component_set_rdate_list (priv->comp, NULL);
......@@ -904,7 +909,9 @@ action_save_cb (GtkAction *action,
e_cal_component_has_recurrences (priv->comp)) {
gchar *rid;
rid = e_cal_component_get_recurid_as_string (priv->comp);
e_cal_remove_object_with_mod (priv->client, uid, rid, priv->mod, &error);
e_cal_remove_object_with_mod (
priv->client, uid, rid,
priv->mod, &error);
g_free (rid);
} else
e_cal_remove_object (priv->client, uid, &error);
......@@ -3020,8 +3027,8 @@ set_attendees_for_delegation (ECalComponent *comp,
icalcomp = e_cal_component_get_icalcomponent (comp);
for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY);
prop;
prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) {
prop;
prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) {
const gchar *attendee = icalproperty_get_attendee (prop);
const gchar *delfrom = NULL;
......@@ -3049,14 +3056,17 @@ get_users_from_memo_comp (ECalComponent *comp, GList **users)
icalcomp = e_cal_component_get_icalcomponent (comp);
for (icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
icalprop != NULL;
icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY)) {
if (g_str_equal (icalproperty_get_x_name (icalprop), "X-EVOLUTION-RECIPIENTS")) {
icalprop != NULL;
icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY)) {