diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-05-21 22:02:58 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:42:17 +0800 |
commit | 5146ff4c535f443fe25290eb96631e91ad44c8ef (patch) | |
tree | b8cc31419c1f297092e13eedd9a5877f4c106eda /widgets/table | |
parent | ea8a59a443f861af88ddb21d5dcbde1c95006203 (diff) | |
download | gsoc2013-evolution-5146ff4c535f443fe25290eb96631e91ad44c8ef.tar.gz gsoc2013-evolution-5146ff4c535f443fe25290eb96631e91ad44c8ef.tar.zst gsoc2013-evolution-5146ff4c535f443fe25290eb96631e91ad44c8ef.zip |
Coding style and whitespace cleanup.
Diffstat (limited to 'widgets/table')
-rw-r--r-- | widgets/table/e-cell-combo.c | 172 | ||||
-rw-r--r-- | widgets/table/e-cell-date-edit.c | 59 | ||||
-rw-r--r-- | widgets/table/e-cell-toggle.c | 13 | ||||
-rw-r--r-- | widgets/table/e-table-config.c | 25 | ||||
-rw-r--r-- | widgets/table/e-table-extras.c | 3 | ||||
-rw-r--r-- | widgets/table/e-table-header-item.c | 88 | ||||
-rw-r--r-- | widgets/table/e-table-header.c | 3 | ||||
-rw-r--r-- | widgets/table/e-table-subset-variable.c | 17 | ||||
-rw-r--r-- | widgets/table/e-table.c | 143 | ||||
-rw-r--r-- | widgets/table/e-tree-memory.c | 9 | ||||
-rw-r--r-- | widgets/table/gal-a11y-e-table-click-to-add.c | 44 | ||||
-rw-r--r-- | widgets/table/gal-a11y-e-table-item.c | 5 |
12 files changed, 347 insertions, 234 deletions
diff --git a/widgets/table/e-cell-combo.c b/widgets/table/e-cell-combo.c index 48a762a8d9..b366c9382c 100644 --- a/widgets/table/e-cell-combo.c +++ b/widgets/table/e-cell-combo.c @@ -73,38 +73,36 @@ /* The height to make the popup list if there aren't any items in it. */ #define E_CELL_COMBO_LIST_EMPTY_HEIGHT 15 -static void e_cell_combo_dispose (GObject *object); - -static gint e_cell_combo_do_popup (ECellPopup *ecp, - GdkEvent *event, - gint row, - gint view_col); -static void e_cell_combo_select_matching_item (ECellCombo *ecc); -static void e_cell_combo_show_popup (ECellCombo *ecc, - gint row, - gint view_col); -static void e_cell_combo_get_popup_pos (ECellCombo *ecc, - gint row, - gint view_col, - gint *x, - gint *y, - gint *height, - gint *width); - -static void e_cell_combo_selection_changed (GtkTreeSelection *selection, ECellCombo *ecc); - -static gint e_cell_combo_button_press (GtkWidget *popup_window, - GdkEvent *event, - ECellCombo *ecc); -static gint e_cell_combo_button_release (GtkWidget *popup_window, - GdkEventButton *event, - ECellCombo *ecc); -static gint e_cell_combo_key_press (GtkWidget *popup_window, - GdkEventKey *event, - ECellCombo *ecc); - -static void e_cell_combo_update_cell (ECellCombo *ecc); -static void e_cell_combo_restart_edit (ECellCombo *ecc); +static void e_cell_combo_dispose (GObject *object); +static gint e_cell_combo_do_popup (ECellPopup *ecp, + GdkEvent *event, + gint row, + gint view_col); +static void e_cell_combo_select_matching_item + (ECellCombo *ecc); +static void e_cell_combo_show_popup (ECellCombo *ecc, + gint row, + gint view_col); +static void e_cell_combo_get_popup_pos (ECellCombo *ecc, + gint row, + gint view_col, + gint *x, + gint *y, + gint *height, + gint *width); +static void e_cell_combo_selection_changed (GtkTreeSelection *selection, + ECellCombo *ecc); +static gint e_cell_combo_button_press (GtkWidget *popup_window, + GdkEvent *event, + ECellCombo *ecc); +static gint e_cell_combo_button_release (GtkWidget *popup_window, + GdkEventButton *event, + ECellCombo *ecc); +static gint e_cell_combo_key_press (GtkWidget *popup_window, + GdkEventKey *event, + ECellCombo *ecc); +static void e_cell_combo_update_cell (ECellCombo *ecc); +static void e_cell_combo_restart_edit (ECellCombo *ecc); G_DEFINE_TYPE (ECellCombo, e_cell_combo, E_TYPE_CELL_POPUP) @@ -132,7 +130,8 @@ e_cell_combo_init (ECellCombo *ecc) ever be one popup in use at a time. */ ecc->popup_window = gtk_window_new (GTK_WINDOW_POPUP); - gtk_window_set_type_hint (GTK_WINDOW (ecc->popup_window), GDK_WINDOW_TYPE_HINT_COMBO); + gtk_window_set_type_hint ( + GTK_WINDOW (ecc->popup_window), GDK_WINDOW_TYPE_HINT_COMBO); gtk_window_set_resizable (GTK_WINDOW (ecc->popup_window), TRUE); frame = gtk_frame_new (NULL); @@ -143,53 +142,60 @@ e_cell_combo_init (ECellCombo *ecc) ecc->popup_scrolled_window = gtk_scrolled_window_new (NULL, NULL); scrolled_window = GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window); - gtk_scrolled_window_set_policy (scrolled_window, - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_widget_set_can_focus (gtk_scrolled_window_get_hscrollbar (scrolled_window), FALSE); - gtk_widget_set_can_focus (gtk_scrolled_window_get_vscrollbar (scrolled_window), FALSE); + gtk_scrolled_window_set_policy ( + scrolled_window, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_widget_set_can_focus ( + gtk_scrolled_window_get_hscrollbar (scrolled_window), FALSE); + gtk_widget_set_can_focus ( + gtk_scrolled_window_get_vscrollbar (scrolled_window), FALSE); gtk_container_add (GTK_CONTAINER (frame), ecc->popup_scrolled_window); gtk_widget_show (ecc->popup_scrolled_window); store = gtk_list_store_new (1, G_TYPE_STRING); - ecc->popup_tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store)); + ecc->popup_tree_view = + gtk_tree_view_new_with_model (GTK_TREE_MODEL (store)); g_object_unref (store); gtk_tree_view_append_column ( GTK_TREE_VIEW (ecc->popup_tree_view), - gtk_tree_view_column_new_with_attributes ("Text", gtk_cell_renderer_text_new (), "text", 0, NULL)); + gtk_tree_view_column_new_with_attributes ( + "Text", gtk_cell_renderer_text_new (), + "text", 0, NULL)); - gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (ecc->popup_tree_view), FALSE); + gtk_tree_view_set_headers_visible ( + GTK_TREE_VIEW (ecc->popup_tree_view), FALSE); - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ecc->popup_tree_view)); + selection = gtk_tree_view_get_selection ( + GTK_TREE_VIEW (ecc->popup_tree_view)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); - gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window), ecc->popup_tree_view); - gtk_container_set_focus_vadjustment (GTK_CONTAINER (ecc->popup_tree_view), - gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window))); - gtk_container_set_focus_hadjustment (GTK_CONTAINER (ecc->popup_tree_view), - gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window))); + gtk_scrolled_window_add_with_viewport ( + GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window), + ecc->popup_tree_view); + gtk_container_set_focus_vadjustment ( + GTK_CONTAINER (ecc->popup_tree_view), + gtk_scrolled_window_get_vadjustment ( + GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window))); + gtk_container_set_focus_hadjustment ( + GTK_CONTAINER (ecc->popup_tree_view), + gtk_scrolled_window_get_hadjustment ( + GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window))); gtk_widget_show (ecc->popup_tree_view); a11y = gtk_widget_get_accessible (ecc->popup_tree_view); atk_object_set_name (a11y, _("popup list")); - g_signal_connect (selection, - "changed", - G_CALLBACK (e_cell_combo_selection_changed), - ecc); - g_signal_connect (ecc->popup_window, - "button_press_event", - G_CALLBACK (e_cell_combo_button_press), - ecc); - /* We use connect_after here so the list updates the selection before - we hide the popup and update the cell. */ - g_signal_connect (ecc->popup_window, - "button_release_event", - G_CALLBACK (e_cell_combo_button_release), - ecc); - g_signal_connect (ecc->popup_window, - "key_press_event", - G_CALLBACK (e_cell_combo_key_press), ecc); + g_signal_connect ( + selection, "changed", + G_CALLBACK (e_cell_combo_selection_changed), ecc); + g_signal_connect ( + ecc->popup_window, "button_press_event", + G_CALLBACK (e_cell_combo_button_press), ecc); + g_signal_connect ( + ecc->popup_window, "button_release_event", + G_CALLBACK (e_cell_combo_button_release), ecc); + g_signal_connect ( + ecc->popup_window, "key_press_event", + G_CALLBACK (e_cell_combo_key_press), ecc); } /** @@ -209,7 +215,7 @@ e_cell_combo_new (void) * GObject::dispose method */ static void -e_cell_combo_dispose (GObject *object) +e_cell_combo_dispose (GObject *object) { ECellCombo *ecc = E_CELL_COMBO (object); @@ -221,8 +227,8 @@ e_cell_combo_dispose (GObject *object) } void -e_cell_combo_set_popdown_strings (ECellCombo *ecc, - GList *strings) +e_cell_combo_set_popdown_strings (ECellCombo *ecc, + GList *strings) { GList *elem; GtkListStore *store; @@ -230,7 +236,9 @@ e_cell_combo_set_popdown_strings (ECellCombo *ecc, g_return_if_fail (E_IS_CELL_COMBO (ecc)); g_return_if_fail (strings != NULL); - store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (ecc->popup_tree_view))); + store = GTK_LIST_STORE ( + gtk_tree_view_get_model ( + GTK_TREE_VIEW (ecc->popup_tree_view))); gtk_list_store_clear (store); for (elem = strings; elem; elem = elem->next) { @@ -243,10 +251,10 @@ e_cell_combo_set_popdown_strings (ECellCombo *ecc, } static gint -e_cell_combo_do_popup (ECellPopup *ecp, - GdkEvent *event, - gint row, - gint view_col) +e_cell_combo_do_popup (ECellPopup *ecp, + GdkEvent *event, + gint row, + gint view_col) { ECellCombo *ecc = E_CELL_COMBO (ecp); guint32 time; @@ -311,9 +319,12 @@ e_cell_combo_select_matching_item (ECellCombo *ecc) gtk_tree_model_get (model, &iter, 0, &str, -1); if (str && g_str_equal (str, cell_text)) { - GtkTreePath *path = gtk_tree_model_get_path (model, &iter); + GtkTreePath *path; - gtk_tree_view_set_cursor (GTK_TREE_VIEW (ecc->popup_tree_view), path, NULL, FALSE); + path = gtk_tree_model_get_path (model, &iter); + gtk_tree_view_set_cursor ( + GTK_TREE_VIEW (ecc->popup_tree_view), + path, NULL, FALSE); gtk_tree_path_free (path); found = TRUE; @@ -444,7 +455,9 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc, gtk_widget_get_preferred_size (ecc->popup_tree_view, &list_requisition, NULL); min_height = MIN (list_requisition.height, requisition.height); - if (!gtk_tree_model_iter_n_children (gtk_tree_view_get_model (GTK_TREE_VIEW (ecc->popup_tree_view)), NULL)) + if (!gtk_tree_model_iter_n_children ( + gtk_tree_view_get_model ( + GTK_TREE_VIEW (ecc->popup_tree_view)), NULL)) list_requisition.height += E_CELL_COMBO_LIST_EMPTY_HEIGHT; popwin_child = gtk_bin_get_child (popwin); @@ -530,7 +543,8 @@ e_cell_combo_selection_changed (GtkTreeSelection *selection, ECellCombo *ecc) GtkTreeIter iter; GtkTreeModel *model; - if (!gtk_widget_get_realized (ecc->popup_window) || !gtk_tree_selection_get_selected (selection, &model, &iter)) + if (!gtk_widget_get_realized (ecc->popup_window) || + !gtk_tree_selection_get_selected (selection, &model, &iter)) return; e_cell_combo_update_cell (ecc); @@ -633,7 +647,8 @@ e_cell_combo_key_press (GtkWidget *popup_window, && event->keyval != GDK_KEY_3270_Enter) return FALSE; - if (event->keyval == GDK_KEY_Escape && (!ecc->popup_window||!gtk_widget_get_visible (ecc->popup_window))) + if (event->keyval == GDK_KEY_Escape && + (!ecc->popup_window || !gtk_widget_get_visible (ecc->popup_window))) return FALSE; gtk_grab_remove (ecc->popup_window); @@ -660,7 +675,8 @@ e_cell_combo_update_cell (ECellCombo *ecc) ECellText *ecell_text = E_CELL_TEXT (ecp->child); ETableItem *eti = E_TABLE_ITEM (ecv->e_table_item_view); ETableCol *ecol; - GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ecc->popup_tree_view)); + GtkTreeSelection *selection = gtk_tree_view_get_selection ( + GTK_TREE_VIEW (ecc->popup_tree_view)); GtkTreeModel *model; GtkTreeIter iter; gchar *text = NULL, *old_text; diff --git a/widgets/table/e-cell-date-edit.c b/widgets/table/e-cell-date-edit.c index fc81d59cfd..750b4dea0b 100644 --- a/widgets/table/e-cell-date-edit.c +++ b/widgets/table/e-cell-date-edit.c @@ -843,7 +843,7 @@ e_cell_date_edit_on_ok_clicked (GtkWidget *button, } static void -e_cell_date_edit_show_time_invalid_warning (ECellDateEdit *ecde) +e_cell_date_edit_show_time_invalid_warning (ECellDateEdit *ecde) { GtkWidget *dialog; struct tm date_tm; @@ -873,46 +873,48 @@ e_cell_date_edit_show_time_invalid_warning (ECellDateEdit *ecde) } static void -e_cell_date_edit_on_now_clicked (GtkWidget *button, - ECellDateEdit *ecde) +e_cell_date_edit_on_now_clicked (GtkWidget *button, + ECellDateEdit *ecde) { struct tm tmp_tm; time_t t; gchar buffer[64]; if (ecde->time_callback) { - tmp_tm = (*ecde->time_callback) (ecde, ecde->time_callback_data); + tmp_tm = ecde->time_callback ( + ecde, ecde->time_callback_data); } else { t = time (NULL); tmp_tm = *localtime (&t); } - e_time_format_date_and_time (&tmp_tm, - ecde->use_24_hour_format, - TRUE, FALSE, - buffer, sizeof (buffer)); + + e_time_format_date_and_time ( + &tmp_tm, ecde->use_24_hour_format, + TRUE, FALSE, buffer, sizeof (buffer)); e_cell_date_edit_update_cell (ecde, buffer); e_cell_date_edit_hide_popup (ecde); } static void -e_cell_date_edit_on_none_clicked (GtkWidget *button, - ECellDateEdit *ecde) +e_cell_date_edit_on_none_clicked (GtkWidget *button, + ECellDateEdit *ecde) { e_cell_date_edit_update_cell (ecde, ""); e_cell_date_edit_hide_popup (ecde); } static void -e_cell_date_edit_on_today_clicked (GtkWidget *button, - ECellDateEdit *ecde) +e_cell_date_edit_on_today_clicked (GtkWidget *button, + ECellDateEdit *ecde) { struct tm tmp_tm; time_t t; gchar buffer[64]; if (ecde->time_callback) { - tmp_tm = (*ecde->time_callback) (ecde, ecde->time_callback_data); + tmp_tm = ecde->time_callback ( + ecde, ecde->time_callback_data); } else { t = time (NULL); tmp_tm = *localtime (&t); @@ -921,18 +923,18 @@ e_cell_date_edit_on_today_clicked (GtkWidget *button, tmp_tm.tm_hour = 0; tmp_tm.tm_min = 0; tmp_tm.tm_sec = 0; - e_time_format_date_and_time (&tmp_tm, - ecde->use_24_hour_format, - FALSE, FALSE, - buffer, sizeof (buffer)); + + e_time_format_date_and_time ( + &tmp_tm, ecde->use_24_hour_format, + FALSE, FALSE, buffer, sizeof (buffer)); e_cell_date_edit_update_cell (ecde, buffer); e_cell_date_edit_hide_popup (ecde); } static void -e_cell_date_edit_update_cell (ECellDateEdit *ecde, - const gchar *text) +e_cell_date_edit_update_cell (ECellDateEdit *ecde, + const gchar *text) { ECellPopup *ecp = E_CELL_POPUP (ecde); ECellText *ecell_text = E_CELL_TEXT (ecp->child); @@ -944,21 +946,26 @@ e_cell_date_edit_update_cell (ECellDateEdit *ecde, /* Compare the new text with the existing cell contents. */ ecol = e_table_header_get_column (eti->header, ecp->popup_view_col); - old_text = e_cell_text_get_text (ecell_text, ecv->e_table_model, - ecol->col_idx, ecp->popup_row); + old_text = e_cell_text_get_text ( + ecell_text, ecv->e_table_model, + ecol->col_idx, ecp->popup_row); /* If they are different, update the cell contents. */ if (strcmp (old_text, text)) { - e_cell_text_set_value (ecell_text, ecv->e_table_model, - ecol->col_idx, ecp->popup_row, text); - e_cell_leave_edit (ecv, ecp->popup_view_col, ecol->col_idx, ecp->popup_row, NULL); + e_cell_text_set_value ( + ecell_text, ecv->e_table_model, + ecol->col_idx, ecp->popup_row, text); + e_cell_leave_edit ( + ecv, ecp->popup_view_col, + ecol->col_idx, ecp->popup_row, NULL); } e_cell_text_free_text (ecell_text, old_text); } static void -e_cell_date_edit_on_time_selected (GtkTreeSelection *selection, ECellDateEdit *ecde) +e_cell_date_edit_on_time_selected (GtkTreeSelection *selection, + ECellDateEdit *ecde) { gchar *list_item_text = NULL; GtkTreeIter iter; @@ -977,7 +984,7 @@ e_cell_date_edit_on_time_selected (GtkTreeSelection *selection, ECellDateEdit *e } static void -e_cell_date_edit_hide_popup (ECellDateEdit *ecde) +e_cell_date_edit_hide_popup (ECellDateEdit *ecde) { gtk_grab_remove (ecde->popup_window); gtk_widget_hide (ecde->popup_window); diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c index b1edb1424e..76fd452397 100644 --- a/widgets/table/e-cell-toggle.c +++ b/widgets/table/e-cell-toggle.c @@ -185,11 +185,8 @@ cell_toggle_draw (ECellView *ecell_view, priv = E_CELL_TOGGLE (ecell_view->ecell)->priv; - if (value < 0 || value >= priv->pixbufs->len) { - g_warning ("Value from the table model is %d, the states we support are [0..%d)\n", - value, priv->pixbufs->len); + if (value < 0 || value >= priv->pixbufs->len) return; - } image = g_ptr_array_index (priv->pixbufs, value); @@ -238,7 +235,8 @@ cell_toggle_event (ECellView *ecell_view, ECellActions *actions) { ECellToggleView *toggle_view = (ECellToggleView *) ecell_view; - gpointer _value = e_table_model_value_at (ecell_view->e_table_model, model_col, row); + gpointer _value = e_table_model_value_at ( + ecell_view->e_table_model, model_col, row); const gint value = GPOINTER_TO_INT (_value); switch (event->type) { @@ -290,11 +288,8 @@ cell_toggle_print (ECellView *ecell_view, priv = E_CELL_TOGGLE (ecell_view->ecell)->priv; - if (value >= priv->pixbufs->len) { - g_warning ("Value from the table model is %d, the states we support are [0..%d)\n", - value, priv->pixbufs->len); + if (value >= priv->pixbufs->len) return; - } image = g_ptr_array_index (priv->pixbufs, value); if (image) { diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index 00ad664e61..01d62602e2 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -835,7 +835,14 @@ configure_sort_dialog (ETableConfig *config, GtkBuilder *builder) { GSList *l; gint i; - const gchar *algs[] = {"alignment4", "alignment3", "alignment2", "alignment1", NULL}; + + const gchar *algs[] = { + "alignment4", + "alignment3", + "alignment2", + "alignment1", + NULL + }; for (i = 0; i < 4; i++) { gchar buffer[80]; @@ -1268,7 +1275,9 @@ setup_gui (ETableConfig *config) builder, "e-table-config"); if (config->header) - gtk_window_set_title (GTK_WINDOW (config->dialog_toplevel), config->header); + gtk_window_set_title ( + GTK_WINDOW (config->dialog_toplevel), + config->header); config->dialog_show_fields = e_builder_get_widget ( builder, "dialog-show-fields"); @@ -1284,9 +1293,15 @@ setup_gui (ETableConfig *config) config->fields_label = e_builder_get_widget ( builder, "label-fields"); - connect_button (config, builder, "button-sort", G_CALLBACK (config_button_sort)); - connect_button (config, builder, "button-group", G_CALLBACK (config_button_group)); - connect_button (config, builder, "button-fields", G_CALLBACK (config_button_fields)); + connect_button ( + config, builder, "button-sort", + G_CALLBACK (config_button_sort)); + connect_button ( + config, builder, "button-group", + G_CALLBACK (config_button_group)); + connect_button ( + config, builder, "button-fields", + G_CALLBACK (config_button_fields)); if (!can_group) { GtkWidget *w; diff --git a/widgets/table/e-table-extras.c b/widgets/table/e-table-extras.c index db18a8cf9e..75626aa2a9 100644 --- a/widgets/table/e-table-extras.c +++ b/widgets/table/e-table-extras.c @@ -123,7 +123,8 @@ g_utf8_strncasecmp (const gchar *s1, c1 = g_unichar_tolower (g_utf8_get_char (s1)); c2 = g_unichar_tolower (g_utf8_get_char (s2)); - /* Collation is locale-dependent, so this totally fails to do the right thing. */ + /* Collation is locale-dependent, so this + * totally fails to do the right thing. */ if (c1 != c2) return c1 < c2 ? -1 : 1; diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index 5d38b686a0..12fc9b95bb 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -131,7 +131,8 @@ ethi_dispose (GObject *object) { ethi->full_header = NULL; if (ethi->etfcd.widget) - g_object_remove_weak_pointer (G_OBJECT (ethi->etfcd.widget), ði->etfcd.pointer); + g_object_remove_weak_pointer ( + G_OBJECT (ethi->etfcd.widget), ði->etfcd.pointer); if (ethi->config) g_object_unref (ethi->config); @@ -586,7 +587,8 @@ do_drag_motion (ETableHeaderItem *ethi, col = ethi_find_col_by_x_nearest (ethi, x); suggested_action = gdk_drag_context_get_suggested_action (context); - if (ethi->drag_col != -1 && (col == ethi->drag_col || col == ethi->drag_col + 1)) { + if (ethi->drag_col != -1 && (col == ethi->drag_col || + col == ethi->drag_col + 1)) { if (ethi->drag_col != -1) ethi_remove_destroy_marker (ethi); @@ -701,10 +703,10 @@ static void context_connect (ETableHeaderItem *ethi, GdkDragContext *context) { - if (g_dataset_get_data (context, "e-table-header-item") == NULL) { - g_object_ref (ethi); - g_dataset_set_data_full (context, "e-table-header-item", ethi, context_destroyed); - } + if (g_dataset_get_data (context, "e-table-header-item") == NULL) + g_dataset_set_data_full ( + context, "e-table-header-item", + g_object_ref (ethi), context_destroyed); } static gboolean @@ -984,26 +986,39 @@ ethi_draw (GnomeCanvasItem *item, style = gtk_widget_get_style (GTK_WIDGET (canvas)); if (ethi->sort_info) { - gint length = e_table_sort_info_grouping_get_count (ethi->sort_info); + gint length; gint i; + + length = e_table_sort_info_grouping_get_count (ethi->sort_info); for (i = 0; i < length; i++) { - ETableSortColumn column = - e_table_sort_info_grouping_get_nth ( + ETableSortColumn column; + + column = e_table_sort_info_grouping_get_nth ( ethi->sort_info, i); - g_hash_table_insert (arrows, - GINT_TO_POINTER ((gint) column.column), - GINT_TO_POINTER (column.ascending ? - E_TABLE_COL_ARROW_DOWN : - E_TABLE_COL_ARROW_UP)); + + g_hash_table_insert ( + arrows, + GINT_TO_POINTER ((gint) column.column), + GINT_TO_POINTER ( + column.ascending ? + E_TABLE_COL_ARROW_DOWN : + E_TABLE_COL_ARROW_UP)); } + length = e_table_sort_info_sorting_get_count (ethi->sort_info); for (i = 0; i < length; i++) { - ETableSortColumn column = e_table_sort_info_sorting_get_nth (ethi->sort_info, i); - g_hash_table_insert (arrows, - GINT_TO_POINTER ((gint) column.column), - GINT_TO_POINTER (column.ascending ? - E_TABLE_COL_ARROW_DOWN : - E_TABLE_COL_ARROW_UP)); + ETableSortColumn column; + + column = e_table_sort_info_sorting_get_nth ( + ethi->sort_info, i); + + g_hash_table_insert ( + arrows, + GINT_TO_POINTER ((gint) column.column), + GINT_TO_POINTER ( + column.ascending ? + E_TABLE_COL_ARROW_DOWN : + E_TABLE_COL_ARROW_UP)); } } @@ -1710,7 +1725,11 @@ ethi_change_sort_state (ETableHeaderItem *ethi, ETableCol *col) length = e_table_sort_info_grouping_get_count (ethi->sort_info); for (i = 0; i < length; i++) { - ETableSortColumn column = e_table_sort_info_grouping_get_nth (ethi->sort_info, i); + ETableSortColumn column; + + column = e_table_sort_info_grouping_get_nth ( + ethi->sort_info, i); + if (model_col == column.column || model_col == -1) { gint ascending = column.ascending; ascending = !ascending; @@ -1725,7 +1744,10 @@ ethi_change_sort_state (ETableHeaderItem *ethi, ETableCol *col) if (!found) { length = e_table_sort_info_sorting_get_count (ethi->sort_info); for (i = 0; i < length; i++) { - ETableSortColumn column = e_table_sort_info_sorting_get_nth (ethi->sort_info, i); + ETableSortColumn column; + + column = e_table_sort_info_sorting_get_nth ( + ethi->sort_info, i); if (model_col == column.column || model_col == -1) { gint ascending = column.ascending; @@ -1909,13 +1931,15 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e) info->col = ethi->selected_col; ecol = e_table_header_get_column (ethi->eth, info->col); - popup = e_popup_menu_create_with_domain (ethi_context_menu, - 1 + - (ecol->sortable ? 0 : 2) + - ((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 + + (ecol->sortable ? 0 : 2) + + ((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); g_object_ref_sink (popup); g_signal_connect (popup, "selection-done", G_CALLBACK (free_popup_info), info); @@ -1932,13 +1956,15 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e) (e->key.keyval == GDK_KEY_KP_Right)) { ETableCol *ecol; - if ((ethi->selected_col < 0) || (ethi->selected_col >= ethi->eth->col_count - 1)) + if ((ethi->selected_col < 0) || + (ethi->selected_col >= ethi->eth->col_count - 1)) ethi->selected_col = 0; else ethi->selected_col++; ecol = e_table_header_get_column (ethi->eth, ethi->selected_col); ethi_change_sort_state (ethi, ecol); - } else if ((e->key.keyval == GDK_KEY_Left) || (e->key.keyval == GDK_KEY_KP_Left)) { + } else if ((e->key.keyval == GDK_KEY_Left) || + (e->key.keyval == GDK_KEY_KP_Left)) { ETableCol *ecol; if ((ethi->selected_col <= 0) || (ethi->selected_col >= ethi->eth->col_count)) diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c index cc5b147747..e890d4836c 100644 --- a/widgets/table/e-table-header.c +++ b/widgets/table/e-table-header.c @@ -395,7 +395,8 @@ e_table_header_add_column (ETableHeader *eth, ETableCol *tc, gint pos) if (pos == -1) pos = eth->col_count; - eth->columns = g_realloc (eth->columns, sizeof (ETableCol *) * (eth->col_count + 1)); + eth->columns = g_realloc ( + eth->columns, sizeof (ETableCol *) * (eth->col_count + 1)); /* * We are the primary owners of the column diff --git a/widgets/table/e-table-subset-variable.c b/widgets/table/e-table-subset-variable.c index be9e3e29ec..78a980a660 100644 --- a/widgets/table/e-table-subset-variable.c +++ b/widgets/table/e-table-subset-variable.c @@ -48,7 +48,9 @@ etssv_add (ETableSubsetVariable *etssv, if (etss->n_map + 1 > etssv->n_vals_allocated) { etssv->n_vals_allocated += INCREMENT_AMOUNT; - etss->map_table = g_realloc (etss->map_table, etssv->n_vals_allocated * sizeof (gint)); + etss->map_table = g_realloc ( + etss->map_table, + etssv->n_vals_allocated * sizeof (gint)); } etss->map_table[etss->n_map++] = row; @@ -69,7 +71,9 @@ etssv_add_array (ETableSubsetVariable *etssv, if (etss->n_map + count > etssv->n_vals_allocated) { etssv->n_vals_allocated += MAX (INCREMENT_AMOUNT, count); - etss->map_table = g_realloc (etss->map_table, etssv->n_vals_allocated * sizeof (gint)); + etss->map_table = g_realloc ( + etss->map_table, + etssv->n_vals_allocated * sizeof (gint)); } for (i = 0; i < count; i++) etss->map_table[etss->n_map++] = array[i]; @@ -90,7 +94,9 @@ etssv_add_all (ETableSubsetVariable *etssv) rows = e_table_model_row_count (etss->source); if (etss->n_map + rows > etssv->n_vals_allocated) { etssv->n_vals_allocated += MAX (INCREMENT_AMOUNT, rows); - etss->map_table = g_realloc (etss->map_table, etssv->n_vals_allocated * sizeof (gint)); + etss->map_table = g_realloc ( + etss->map_table, + etssv->n_vals_allocated * sizeof (gint)); } for (i = 0; i < rows; i++) etss->map_table[etss->n_map++] = i; @@ -109,7 +115,10 @@ etssv_remove (ETableSubsetVariable *etssv, for (i = 0; i < etss->n_map; i++) { if (etss->map_table[i] == row) { e_table_model_pre_change (etm); - memmove (etss->map_table + i, etss->map_table + i + 1, (etss->n_map - i - 1) * sizeof (gint)); + memmove ( + etss->map_table + i, + etss->map_table + i + 1, + (etss->n_map - i - 1) * sizeof (gint)); etss->n_map--; e_table_model_row_deleted (etm, i); diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index c1d0a2ad94..d1241543a5 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -1665,41 +1665,47 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, e_table->horizontal_resize = specification->horizontal_resize; e_table->allow_grouping = specification->allow_grouping; - e_table->sort_info = state->sort_info; - g_object_ref (state->sort_info); - e_table_sort_info_set_can_group (e_table->sort_info, e_table->allow_grouping); + e_table->sort_info = g_object_ref (state->sort_info); + + e_table_sort_info_set_can_group ( + e_table->sort_info, e_table->allow_grouping); - e_table->group_info_change_id = - g_signal_connect (G_OBJECT (e_table->sort_info), "group_info_changed", - G_CALLBACK (group_info_changed), e_table); + e_table->group_info_change_id = g_signal_connect ( + e_table->sort_info, "group_info_changed", + G_CALLBACK (group_info_changed), e_table); - e_table->sort_info_change_id = - g_signal_connect (G_OBJECT (e_table->sort_info), "sort_info_changed", - G_CALLBACK (sort_info_changed), e_table); + e_table->sort_info_change_id = g_signal_connect ( + e_table->sort_info, "sort_info_changed", + G_CALLBACK (sort_info_changed), e_table); g_value_set_object (val, e_table->sort_info); g_object_set_property (G_OBJECT(e_table->header), "sort_info", val); g_free (val); - e_table->sorter = e_table_sorter_new (etm, e_table->full_header, e_table->sort_info); + e_table->sorter = e_table_sorter_new ( + etm, e_table->full_header, e_table->sort_info); - g_object_set (e_table->selection, - "model", etm, - "selection_mode", specification->selection_mode, - "cursor_mode", specification->cursor_mode, - "sorter", e_table->sorter, - "header", e_table->header, - NULL); + g_object_set ( + e_table->selection, + "model", etm, + "selection_mode", specification->selection_mode, + "cursor_mode", specification->cursor_mode, + "sorter", e_table->sorter, + "header", e_table->header, + NULL); - g_signal_connect(e_table->selection, "selection_changed", - G_CALLBACK (et_selection_model_selection_changed), e_table); - g_signal_connect(e_table->selection, "selection_row_changed", - G_CALLBACK (et_selection_model_selection_row_changed), e_table); + g_signal_connect ( + e_table->selection, "selection_changed", + G_CALLBACK (et_selection_model_selection_changed), e_table); + g_signal_connect ( + e_table->selection, "selection_row_changed", + G_CALLBACK (et_selection_model_selection_row_changed), e_table); - if (!specification->no_headers) { + if (!specification->no_headers) e_table_setup_header (e_table); - } - e_table_setup_table (e_table, e_table->full_header, e_table->header, etm); + + e_table_setup_table ( + e_table, e_table->full_header, e_table->header, etm); e_table_fill_table (e_table, etm); scrollable = GTK_SCROLLABLE (e_table->table_canvas); @@ -2235,7 +2241,8 @@ e_table_commit_click_to_add (ETable *table) { et_eti_leave_edit (table); if (table->click_to_add) - e_table_click_to_add_commit (E_TABLE_CLICK_TO_ADD (table->click_to_add)); + e_table_click_to_add_commit ( + E_TABLE_CLICK_TO_ADD (table->click_to_add)); } static void @@ -2261,25 +2268,33 @@ et_get_property (GObject *object, break; case PROP_HADJUSTMENT: if (etable->table_canvas) - g_object_get_property (G_OBJECT (etable->table_canvas), "hadjustment", value); + g_object_get_property ( + G_OBJECT (etable->table_canvas), + "hadjustment", value); else g_value_set_object (value, NULL); break; case PROP_VADJUSTMENT: if (etable->table_canvas) - g_object_get_property (G_OBJECT (etable->table_canvas), "vadjustment", value); + g_object_get_property ( + G_OBJECT (etable->table_canvas), + "vadjustment", value); else g_value_set_object (value, NULL); break; case PROP_HSCROLL_POLICY: if (etable->table_canvas) - g_object_get_property (G_OBJECT (etable->table_canvas), "hscroll-policy", value); + g_object_get_property ( + G_OBJECT (etable->table_canvas), + "hscroll-policy", value); else g_value_set_enum (value, 0); break; case PROP_VSCROLL_POLICY: if (etable->table_canvas) - g_object_get_property (G_OBJECT (etable->table_canvas), "vscroll-policy", value); + g_object_get_property ( + G_OBJECT (etable->table_canvas), + "vscroll-policy", value); else g_value_set_enum (value, 0); break; @@ -2295,9 +2310,9 @@ typedef struct { static void et_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) + guint prop_id, + const GValue *value, + GParamSpec *pspec) { ETable *etable = E_TABLE (object); @@ -2305,17 +2320,21 @@ et_set_property (GObject *object, case PROP_LENGTH_THRESHOLD: etable->length_threshold = g_value_get_int (value); if (etable->group) { - gnome_canvas_item_set (GNOME_CANVAS_ITEM (etable->group), - "length_threshold", etable->length_threshold, - NULL); + gnome_canvas_item_set ( + GNOME_CANVAS_ITEM (etable->group), + "length_threshold", + etable->length_threshold, + NULL); } break; case PROP_UNIFORM_ROW_HEIGHT: etable->uniform_row_height = g_value_get_boolean (value); if (etable->group) { - gnome_canvas_item_set (GNOME_CANVAS_ITEM (etable->group), - "uniform_row_height", etable->uniform_row_height, - NULL); + gnome_canvas_item_set ( + GNOME_CANVAS_ITEM (etable->group), + "uniform_row_height", + etable->uniform_row_height, + NULL); } break; case PROP_ALWAYS_SEARCH: @@ -2333,23 +2352,27 @@ et_set_property (GObject *object, clear_current_search_col (etable); if (etable->use_click_to_add) { - etable->click_to_add = gnome_canvas_item_new - (GNOME_CANVAS_GROUP (etable->canvas_vbox), - e_table_click_to_add_get_type (), - "header", etable->header, - "model", etable->model, - "message", etable->click_to_add_message, - NULL); + etable->click_to_add = gnome_canvas_item_new ( + GNOME_CANVAS_GROUP (etable->canvas_vbox), + e_table_click_to_add_get_type (), + "header", etable->header, + "model", etable->model, + "message", etable->click_to_add_message, + NULL); if (etable->use_click_to_add_end) - e_canvas_vbox_add_item (E_CANVAS_VBOX (etable->canvas_vbox), - etable->click_to_add); + e_canvas_vbox_add_item ( + E_CANVAS_VBOX (etable->canvas_vbox), + etable->click_to_add); else - e_canvas_vbox_add_item_start (E_CANVAS_VBOX (etable->canvas_vbox), - etable->click_to_add); - - g_signal_connect (G_OBJECT (etable->click_to_add), "cursor_change", - G_CALLBACK (click_to_add_cursor_change), etable); + e_canvas_vbox_add_item_start ( + E_CANVAS_VBOX (etable->canvas_vbox), + etable->click_to_add); + + g_signal_connect ( + etable->click_to_add, "cursor_change", + G_CALLBACK (click_to_add_cursor_change), + etable); } else { g_object_run_dispose (G_OBJECT (etable->click_to_add)); etable->click_to_add = NULL; @@ -2357,19 +2380,27 @@ et_set_property (GObject *object, break; case PROP_HADJUSTMENT: if (etable->table_canvas) - g_object_set_property (G_OBJECT (etable->table_canvas), "hadjustment", value); + g_object_set_property ( + G_OBJECT (etable->table_canvas), + "hadjustment", value); break; case PROP_VADJUSTMENT: if (etable->table_canvas) - g_object_set_property (G_OBJECT (etable->table_canvas), "vadjustment", value); + g_object_set_property ( + G_OBJECT (etable->table_canvas), + "vadjustment", value); break; case PROP_HSCROLL_POLICY: if (etable->table_canvas) - g_object_set_property (G_OBJECT (etable->table_canvas), "hscroll-policy", value); + g_object_set_property ( + G_OBJECT (etable->table_canvas), + "hscroll-policy", value); break; case PROP_VSCROLL_POLICY: if (etable->table_canvas) - g_object_set_property (G_OBJECT (etable->table_canvas), "vscroll-policy", value); + g_object_set_property ( + G_OBJECT (etable->table_canvas), + "vscroll-policy", value); break; } } diff --git a/widgets/table/e-tree-memory.c b/widgets/table/e-tree-memory.c index 61200cda4c..0fe0cb79b0 100644 --- a/widgets/table/e-tree-memory.c +++ b/widgets/table/e-tree-memory.c @@ -338,12 +338,15 @@ etmm_clear_children_computed (ETreeMemoryPath *path) static void etmm_node_request_collapse (ETreeModel *etm, ETreePath node) { + ETreeModelClass *parent_class; + if (node) etmm_clear_children_computed (node); - if (E_TREE_MODEL_CLASS (e_tree_memory_parent_class)->node_request_collapse) { - E_TREE_MODEL_CLASS (e_tree_memory_parent_class)->node_request_collapse (etm, node); - } + parent_class = E_TREE_MODEL_CLASS (e_tree_memory_parent_class); + + if (parent_class->node_request_collapse != NULL) + parent_class->node_request_collapse (etm, node); } diff --git a/widgets/table/gal-a11y-e-table-click-to-add.c b/widgets/table/gal-a11y-e-table-click-to-add.c index 1b7ce531e2..a118359b1c 100644 --- a/widgets/table/gal-a11y-e-table-click-to-add.c +++ b/widgets/table/gal-a11y-e-table-click-to-add.c @@ -36,7 +36,9 @@ static AtkObjectClass *parent_class; static GType parent_type; static gint priv_offset; -#define GET_PRIVATE(object) ((GalA11yETableClickToAddPrivate *) (((gchar *) object) + priv_offset)) +#define GET_PRIVATE(object) \ + ((GalA11yETableClickToAddPrivate *) \ + (((gchar *) object) + priv_offset)) #define PARENT_TYPE (parent_type) struct _GalA11yETableClickToAddPrivate { @@ -128,7 +130,9 @@ etcta_get_name (AtkObject *obj) g_return_val_if_fail (GAL_A11Y_IS_E_TABLE_CLICK_TO_ADD (obj), NULL); - etcta = E_TABLE_CLICK_TO_ADD (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (obj))); + etcta = E_TABLE_CLICK_TO_ADD ( + atk_gobject_accessible_get_object ( + ATK_GOBJECT_ACCESSIBLE (obj))); if (etcta && etcta->message != NULL) return etcta->message; @@ -141,9 +145,9 @@ etcta_get_n_children (AtkObject *accessible) return 1; } -static AtkObject* +static AtkObject * etcta_ref_child (AtkObject *accessible, - gint i) + gint i) { AtkObject * atk_obj = NULL; ETableClickToAdd * etcta; @@ -151,14 +155,18 @@ etcta_ref_child (AtkObject *accessible, if (i != 0) return NULL; - etcta = E_TABLE_CLICK_TO_ADD (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (accessible))); + etcta = E_TABLE_CLICK_TO_ADD ( + atk_gobject_accessible_get_object ( + ATK_GOBJECT_ACCESSIBLE (accessible))); g_return_val_if_fail (etcta, NULL); if (etcta->rect) { - atk_obj = atk_gobject_accessible_for_object (G_OBJECT (etcta->rect)); + atk_obj = atk_gobject_accessible_for_object ( + G_OBJECT (etcta->rect)); } else if (etcta->row) { - atk_obj = atk_gobject_accessible_for_object (G_OBJECT (etcta->row)); + atk_obj = atk_gobject_accessible_for_object ( + G_OBJECT (etcta->row)); } g_object_ref (atk_obj); @@ -198,15 +206,6 @@ etcta_init (GalA11yETableClickToAdd *a11y) { } -/** - * gal_a11y_e_table_click_to_add_get_type: - * @void: - * - * Registers the &GalA11yETableClickToAdd class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &GalA11yETableClickToAdd class. - **/ GType gal_a11y_e_table_click_to_add_get_type (void) { @@ -234,7 +233,9 @@ gal_a11y_e_table_click_to_add_get_type (void) NULL }; - factory = atk_registry_get_factory (atk_get_default_registry (), GNOME_TYPE_CANVAS_ITEM); + factory = atk_registry_get_factory ( + atk_get_default_registry (), + GNOME_TYPE_CANVAS_ITEM); parent_type = atk_object_factory_get_accessible_type (factory); type = gal_a11y_type_register_static_with_private (PARENT_TYPE, @@ -288,14 +289,19 @@ etcta_selection_cursor_changed (ESelectionModel *esm, gint row, gint col, ETableClickToAdd *etcta; AtkObject *row_a11y; - etcta = E_TABLE_CLICK_TO_ADD (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (a11y))); + etcta = E_TABLE_CLICK_TO_ADD ( + atk_gobject_accessible_get_object ( + ATK_GOBJECT_ACCESSIBLE (a11y))); if (etcta == NULL || etcta->row == NULL) return; row_a11y = atk_gobject_accessible_for_object (G_OBJECT (etcta->row)); if (row_a11y) { - AtkObject *cell_a11y = g_object_get_data (G_OBJECT(row_a11y), "gail-focus-object"); + AtkObject *cell_a11y; + + cell_a11y = g_object_get_data ( + G_OBJECT (row_a11y), "gail-focus-object"); if (cell_a11y) { atk_focus_tracker_notify (cell_a11y); } diff --git a/widgets/table/gal-a11y-e-table-item.c b/widgets/table/gal-a11y-e-table-item.c index ffa4bd51c2..1d0add2353 100644 --- a/widgets/table/gal-a11y-e-table-item.c +++ b/widgets/table/gal-a11y-e-table-item.c @@ -654,7 +654,10 @@ table_remove_row_selection (AtkTable *table, gint row) if (!atk_table_is_row_selected (table, row)) return TRUE; - e_selection_model_toggle_single_row (item->selection, view_to_model_row (item, row)); + + e_selection_model_toggle_single_row ( + item->selection, view_to_model_row (item, row)); + return TRUE; } |