From f014ab82c81078d60cb1df8c986305c2cc9948c2 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 4 Jun 2011 15:53:10 -0500 Subject: Coding style and whitespace cleanups. --- widgets/table/e-cell-number.c | 6 ++- widgets/table/e-cell-toggle.c | 7 ++- widgets/table/e-table-config.c | 18 +++---- widgets/table/e-table-field-chooser-item.c | 12 +++-- widgets/table/e-table-group-leaf.c | 83 ++++++++++++++++++------------ widgets/table/e-table-header-item.c | 23 +++++---- widgets/table/e-table-without.c | 3 +- widgets/table/e-tree-memory.c | 7 ++- widgets/table/e-tree.c | 13 +++-- widgets/table/gal-a11y-e-cell-vbox.c | 3 +- widgets/table/gal-a11y-e-cell.c | 4 +- 11 files changed, 111 insertions(+), 68 deletions(-) (limited to 'widgets/table') diff --git a/widgets/table/e-cell-number.c b/widgets/table/e-cell-number.c index 7e9395ba6c..7944bbea51 100644 --- a/widgets/table/e-cell-number.c +++ b/widgets/table/e-cell-number.c @@ -37,7 +37,11 @@ G_DEFINE_TYPE (ECellNumber, e_cell_number, E_TYPE_CELL_TEXT) static gchar * ecn_get_text (ECellText *cell, ETableModel *model, gint col, gint row) { - return e_format_number (GPOINTER_TO_INT (e_table_model_value_at (model, col, row))); + gpointer value; + + value = e_table_model_value_at (model, col, row); + + return e_format_number (GPOINTER_TO_INT (value)); } static void diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c index 06b26c53d4..bec9f5d005 100644 --- a/widgets/table/e-cell-toggle.c +++ b/widgets/table/e-cell-toggle.c @@ -246,10 +246,13 @@ cell_toggle_event (ECellView *ecell_view, return FALSE; /* Fall through */ case GDK_BUTTON_PRESS: - if (!e_table_model_is_cell_editable (ecell_view->e_table_model, model_col, row)) + if (!e_table_model_is_cell_editable ( + ecell_view->e_table_model, model_col, row)) return FALSE; - etog_set_value (toggle_view, model_col, view_col, row, value + 1); + etog_set_value ( + toggle_view, model_col, view_col, row, value + 1); + return TRUE; default: diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index 9b85cd3b85..4bfb80d1e9 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -1398,19 +1398,19 @@ e_table_config_construct (ETableConfig *config, * Returns: The config object. */ ETableConfig * -e_table_config_new (const gchar *header, - ETableSpecification *spec, - ETableState *state, - GtkWindow *parent_window) +e_table_config_new (const gchar *header, + ETableSpecification *spec, + ETableState *state, + GtkWindow *parent_window) { - ETableConfig *config = g_object_new (E_TYPE_TABLE_CONFIG, NULL); + ETableConfig *config; GtkDialog *dialog; GtkWidget *widget; - if (e_table_config_construct (config, header, spec, state, parent_window) == NULL) { - g_object_unref (config); - return NULL; - } + config = g_object_new (E_TYPE_TABLE_CONFIG, NULL); + + e_table_config_construct ( + config, header, spec, state, parent_window); dialog = GTK_DIALOG (config->dialog_toplevel); diff --git a/widgets/table/e-table-field-chooser-item.c b/widgets/table/e-table-field-chooser-item.c index 451b0388b0..e2dc6f1721 100644 --- a/widgets/table/e-table-field-chooser-item.c +++ b/widgets/table/e-table-field-chooser-item.c @@ -129,7 +129,9 @@ etfci_rebuild_combined (ETableFieldChooserItem *etfci) ETableCol *ecol = e_table_header_get_column (etfci->header, i); if (ecol->disabled) continue; - g_hash_table_insert (hash, GINT_TO_POINTER (ecol->col_idx), GINT_TO_POINTER (1)); + g_hash_table_insert ( + hash, GINT_TO_POINTER (ecol->col_idx), + GINT_TO_POINTER (1)); } count = e_table_header_count (etfci->full_header); @@ -357,13 +359,17 @@ etfci_set_property (GObject *object, case PROP_FULL_HEADER: etfci_drop_full_header (etfci); if (g_value_get_object (value)) - etfci_add_full_header (etfci, E_TABLE_HEADER (g_value_get_object (value))); + etfci_add_full_header ( + etfci, E_TABLE_HEADER ( + g_value_get_object (value))); break; case PROP_HEADER: etfci_drop_table_header (etfci); if (g_value_get_object (value)) - etfci_add_table_header (etfci, E_TABLE_HEADER (g_value_get_object (value))); + etfci_add_table_header ( + etfci, E_TABLE_HEADER ( + g_value_get_object (value))); break; case PROP_DND_CODE: diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c index 46f30a9cf4..bf4f1553aa 100644 --- a/widgets/table/e-table-group-leaf.c +++ b/widgets/table/e-table-group-leaf.c @@ -151,10 +151,10 @@ e_table_group_leaf_construct (GnomeCanvasGroup *parent, */ ETableGroup * e_table_group_leaf_new (GnomeCanvasGroup *parent, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - ETableSortInfo *sort_info) + ETableHeader *full_header, + ETableHeader *header, + ETableModel *model, + ETableSortInfo *sort_info) { ETableGroupLeaf *etgl; @@ -162,32 +162,44 @@ e_table_group_leaf_new (GnomeCanvasGroup *parent, etgl = g_object_new (E_TYPE_TABLE_GROUP_LEAF, NULL); - e_table_group_leaf_construct (parent, etgl, full_header, - header, model, sort_info); + e_table_group_leaf_construct ( + parent, etgl, full_header, + header, model, sort_info); + return E_TABLE_GROUP (etgl); } static void -etgl_cursor_change (GObject *object, gint row, ETableGroupLeaf *etgl) +etgl_cursor_change (GObject *object, + gint row, + ETableGroupLeaf *etgl) { if (row < E_TABLE_SUBSET (etgl->ets)->n_map) - e_table_group_cursor_change (E_TABLE_GROUP (etgl), - E_TABLE_SUBSET (etgl->ets)->map_table[row]); + e_table_group_cursor_change ( + E_TABLE_GROUP (etgl), + E_TABLE_SUBSET (etgl->ets)->map_table[row]); } static void -etgl_cursor_activated (GObject *object, gint view_row, ETableGroupLeaf *etgl) +etgl_cursor_activated (GObject *object, + gint view_row, + ETableGroupLeaf *etgl) { if (view_row < E_TABLE_SUBSET (etgl->ets)->n_map) - e_table_group_cursor_activated (E_TABLE_GROUP (etgl), - E_TABLE_SUBSET (etgl->ets)->map_table[view_row]); + e_table_group_cursor_activated ( + E_TABLE_GROUP (etgl), + E_TABLE_SUBSET (etgl->ets)->map_table[view_row]); } static void -etgl_double_click (GObject *object, gint model_row, gint model_col, GdkEvent *event, - ETableGroupLeaf *etgl) +etgl_double_click (GObject *object, + gint model_row, + gint model_col, + GdkEvent *event, + ETableGroupLeaf *etgl) { - e_table_group_double_click (E_TABLE_GROUP (etgl), model_row, model_col, event); + e_table_group_double_click ( + E_TABLE_GROUP (etgl), model_row, model_col, event); } static gboolean @@ -207,21 +219,28 @@ etgl_key_press (GObject *object, } static gboolean -etgl_start_drag (GObject *object, gint model_row, gint model_col, GdkEvent *event, - ETableGroupLeaf *etgl) +etgl_start_drag (GObject *object, + gint model_row, + gint model_col, + GdkEvent *event, + ETableGroupLeaf *etgl) { - return e_table_group_start_drag (E_TABLE_GROUP (etgl), model_row, model_col, event); + return e_table_group_start_drag ( + E_TABLE_GROUP (etgl), model_row, model_col, event); } static gboolean -etgl_right_click (GObject *object, gint view_row, gint model_col, GdkEvent *event, - ETableGroupLeaf *etgl) +etgl_right_click (GObject *object, + gint view_row, + gint model_col, + GdkEvent *event, + ETableGroupLeaf *etgl) { if (view_row < E_TABLE_SUBSET (etgl->ets)->n_map) - return e_table_group_right_click (E_TABLE_GROUP (etgl), - E_TABLE_SUBSET (etgl->ets)->map_table[view_row], - model_col, - event); + return e_table_group_right_click ( + E_TABLE_GROUP (etgl), + E_TABLE_SUBSET (etgl->ets)->map_table[view_row], + model_col, event); else return FALSE; } @@ -234,10 +253,10 @@ etgl_click (GObject *object, ETableGroupLeaf *etgl) { if (row < E_TABLE_SUBSET (etgl->ets)->n_map) - return e_table_group_click (E_TABLE_GROUP (etgl), - E_TABLE_SUBSET (etgl->ets)->map_table[row], - col, - event); + return e_table_group_click ( + E_TABLE_GROUP (etgl), + E_TABLE_SUBSET (etgl->ets)->map_table[row], + col, event); else return FALSE; } @@ -247,12 +266,8 @@ etgl_reflow (GnomeCanvasItem *item, gint flags) { ETableGroupLeaf *leaf = E_TABLE_GROUP_LEAF (item); - g_object_get (leaf->item, - "height", &leaf->height, - NULL); - g_object_get (leaf->item, - "width", &leaf->width, - NULL); + g_object_get (leaf->item, "height", &leaf->height, NULL); + g_object_get (leaf->item, "width", &leaf->width, NULL); e_canvas_item_request_parent_reflow (item); } diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index d8a7d0d7a0..16633f967c 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -1625,13 +1625,13 @@ ethi_header_context_menu (ETableHeaderItem *ethi, GdkEventButton *event) info->ethi = ethi; info->col = ethi_find_col_by_x (ethi, event->x); - popup = e_popup_menu_create_with_domain (ethi_context_menu, - 1 + - 0 + - ((ethi->table || ethi->tree) ? 0 : 4) + - ((e_table_header_count (ethi->eth) > 1) ? 0 : 8), - ((e_table_sort_info_get_can_group (ethi->sort_info)) ? 0 : 16) + - 128, info, GETTEXT_PACKAGE); + popup = e_popup_menu_create_with_domain ( + ethi_context_menu, + 1 + + ((ethi->table || ethi->tree) ? 0 : 4) + + ((e_table_header_count (ethi->eth) > 1) ? 0 : 8), + ((e_table_sort_info_get_can_group (ethi->sort_info)) ? 0 : 16) + + 128, info, GETTEXT_PACKAGE); menu_item = gtk_menu_item_new_with_mnemonic (_("_Sort By")); gtk_widget_show (menu_item); @@ -1761,9 +1761,9 @@ ethi_change_sort_state (ETableHeaderItem *ethi, ETableCol *col) gint j; for (j = i + 1; j < length; j++) - e_table_sort_info_sorting_set_nth (ethi->sort_info, - j - 1, - e_table_sort_info_sorting_get_nth (ethi->sort_info, j)); + e_table_sort_info_sorting_set_nth ( + ethi->sort_info, j - 1, + e_table_sort_info_sorting_get_nth (ethi->sort_info, j)); e_table_sort_info_sorting_truncate (ethi->sort_info, length - 1); length--; @@ -1968,7 +1968,8 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e) (e->key.keyval == GDK_KEY_KP_Left)) { ETableCol *ecol; - if ((ethi->selected_col <= 0) || (ethi->selected_col >= ethi->eth->col_count)) + if ((ethi->selected_col <= 0) || + (ethi->selected_col >= ethi->eth->col_count)) ethi->selected_col = ethi->eth->col_count - 1; else ethi->selected_col--; diff --git a/widgets/table/e-table-without.c b/widgets/table/e-table-without.c index ea2554b7bc..59d254c862 100644 --- a/widgets/table/e-table-without.c +++ b/widgets/table/e-table-without.c @@ -193,7 +193,8 @@ etw_proxy_model_rows_deleted (ETableSubset *etss, gboolean shift = FALSE; for (i = 0; i < etss->n_map; i++) { - if (etss->map_table[i] >= model_row && etss->map_table[i] < model_row + count) { + if (etss->map_table[i] >= model_row && + etss->map_table[i] < model_row + count) { remove_row (etw, i); i--; } else if (etss->map_table[i] >= model_row + count) { diff --git a/widgets/table/e-tree-memory.c b/widgets/table/e-tree-memory.c index eec9333e65..4b9a977f05 100644 --- a/widgets/table/e-tree-memory.c +++ b/widgets/table/e-tree-memory.c @@ -514,11 +514,14 @@ e_tree_memory_node_insert (ETreeMemory *tree_model, if (parent_path != NULL) { e_tree_memory_path_insert (parent_path, position, new_path); if (!tree_model->priv->frozen) - e_tree_model_node_inserted (E_TREE_MODEL (tree_model), parent_path, new_path); + e_tree_model_node_inserted ( + E_TREE_MODEL (tree_model), + parent_path, new_path); } else { priv->root = new_path; if (!tree_model->priv->frozen) - e_tree_model_node_changed (E_TREE_MODEL (tree_model), new_path); + e_tree_model_node_changed ( + E_TREE_MODEL (tree_model), new_path); } return new_path; diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index fe9f3d7474..25fdcc7e48 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -1257,7 +1257,8 @@ e_tree_set_state_object (ETree *e_tree, ETableState *state) NULL); if (e_tree->priv->etta) - e_tree_table_adapter_set_sort_info (e_tree->priv->etta, e_tree->priv->sort_info); + e_tree_table_adapter_set_sort_info ( + e_tree->priv->etta, e_tree->priv->sort_info); e_tree_state_change (e_tree); } @@ -2065,11 +2066,17 @@ e_tree_get_next_row (ETree *e_tree, return e_sorter_sorted_to_model (E_SORTER (e_tree->priv->sorter), i); } else return -1; - } else - if (model_row < e_table_model_row_count (E_TABLE_MODEL (e_tree->priv->etta)) - 1) + } else { + gint row_count; + + row_count = e_table_model_row_count ( + E_TABLE_MODEL (e_tree->priv->etta)); + + if (model_row < row_count - 1) return model_row + 1; else return -1; + } } gint diff --git a/widgets/table/gal-a11y-e-cell-vbox.c b/widgets/table/gal-a11y-e-cell-vbox.c index bbe278537a..e663bb1f1f 100644 --- a/widgets/table/gal-a11y-e-cell-vbox.c +++ b/widgets/table/gal-a11y-e-cell-vbox.c @@ -220,7 +220,8 @@ AtkObject *gal_a11y_e_cell_vbox_new (ETableItem *item, a11y = g_object_new (gal_a11y_e_cell_vbox_get_type (), NULL); - gal_a11y_e_cell_construct (a11y, item, cell_view, parent, model_col, view_col, row); + gal_a11y_e_cell_construct ( + a11y, item, cell_view, parent, model_col, view_col, row); gaec = GAL_A11Y_E_CELL (a11y); gaev = GAL_A11Y_E_CELL_VBOX (a11y); diff --git a/widgets/table/gal-a11y-e-cell.c b/widgets/table/gal-a11y-e-cell.c index 0ba51dcb4d..d5853270a4 100644 --- a/widgets/table/gal-a11y-e-cell.c +++ b/widgets/table/gal-a11y-e-cell.c @@ -350,7 +350,9 @@ gal_a11y_e_cell_remove_action_by_name (GalA11yECell *cell, g_return_val_if_fail (GAL_A11Y_IS_E_CELL (cell), FALSE); for (list_node = cell->action_list; list_node && !action_found; list_node = list_node->next) { - if (!g_ascii_strcasecmp (((ActionInfo *)(list_node->data))->name, action_name)) { + if (!g_ascii_strcasecmp ( + ((ActionInfo *)(list_node->data))->name, + action_name)) { action_found = TRUE; break; } -- cgit