diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-07-11 23:31:15 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-07-12 10:25:06 +0800 |
commit | eb29179da623f9cf4abd663577395a085452ca18 (patch) | |
tree | a7eec4690f254d4cb9048ca87a5e7f401a2e74ae /widgets | |
parent | beb8e74577f695d0d3c2efea52dc10c2136f0135 (diff) | |
download | gsoc2013-evolution-eb29179da623f9cf4abd663577395a085452ca18.tar gsoc2013-evolution-eb29179da623f9cf4abd663577395a085452ca18.tar.gz gsoc2013-evolution-eb29179da623f9cf4abd663577395a085452ca18.tar.bz2 gsoc2013-evolution-eb29179da623f9cf4abd663577395a085452ca18.tar.lz gsoc2013-evolution-eb29179da623f9cf4abd663577395a085452ca18.tar.xz gsoc2013-evolution-eb29179da623f9cf4abd663577395a085452ca18.tar.zst gsoc2013-evolution-eb29179da623f9cf4abd663577395a085452ca18.zip |
Coding style and whitespace cleanup.
Diffstat (limited to 'widgets')
28 files changed, 541 insertions, 341 deletions
diff --git a/widgets/menus/gal-view-collection.c b/widgets/menus/gal-view-collection.c index e2b97c4771..296b634e28 100644 --- a/widgets/menus/gal-view-collection.c +++ b/widgets/menus/gal-view-collection.c @@ -443,11 +443,11 @@ load_single_dir (GalViewCollection *collection, if (item->filename && *item->filename) { collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1); collection->view_data[collection->view_count] = item; - collection->view_count ++; + collection->view_count++; } else { collection->removed_view_data = g_renew(GalViewCollectionItem *, collection->removed_view_data, collection->removed_view_count + 1); collection->removed_view_data[collection->removed_view_count] = item; - collection->removed_view_count ++; + collection->removed_view_count++; } } g_free(id); @@ -665,7 +665,7 @@ gal_view_collection_append (GalViewCollection *collection, collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1); collection->view_data[collection->view_count] = item; - collection->view_count ++; + collection->view_count++; gal_view_collection_changed(collection); } @@ -682,14 +682,14 @@ gal_view_collection_delete_view (GalViewCollection *collection, item = collection->view_data[i]; memmove(collection->view_data + i, collection->view_data + i + 1, (collection->view_count - i - 1) * sizeof(GalViewCollectionItem *)); - collection->view_count --; + collection->view_count--; if (item->built_in) { g_free(item->filename); item->filename = NULL; collection->removed_view_data = g_renew(GalViewCollectionItem *, collection->removed_view_data, collection->removed_view_count + 1); collection->removed_view_data[collection->removed_view_count] = item; - collection->removed_view_count ++; + collection->removed_view_count++; } else { gal_view_collection_item_free (item); } @@ -727,7 +727,7 @@ gal_view_collection_copy_view (GalViewCollection *collection, collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1); collection->view_data[collection->view_count] = item; - collection->view_count ++; + collection->view_count++; gal_view_collection_changed(collection); } @@ -770,7 +770,7 @@ gal_view_collection_append_with_title (GalViewCollection *collection, const gcha collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1); collection->view_data[collection->view_count] = item; - collection->view_count ++; + collection->view_count++; gal_view_collection_changed(collection); return item->id; diff --git a/widgets/misc/e-canvas-vbox.c b/widgets/misc/e-canvas-vbox.c index 5fc939939b..55f8a7d526 100644 --- a/widgets/misc/e-canvas-vbox.c +++ b/widgets/misc/e-canvas-vbox.c @@ -285,7 +285,7 @@ e_canvas_vbox_resize_children (GnomeCanvasItem *item) ECanvasVbox *e_canvas_vbox; e_canvas_vbox = E_CANVAS_VBOX (item); - for ( list = e_canvas_vbox->items; list; list = list->next ) { + for (list = e_canvas_vbox->items; list; list = list->next) { GnomeCanvasItem *child = GNOME_CANVAS_ITEM(list->data); gnome_canvas_item_set(child, "width", (gdouble) e_canvas_vbox->minimum_width, diff --git a/widgets/misc/e-selection-model-array.c b/widgets/misc/e-selection-model-array.c index 3dc47e99c3..796b528e46 100644 --- a/widgets/misc/e-selection-model-array.c +++ b/widgets/misc/e-selection-model-array.c @@ -148,9 +148,9 @@ e_selection_model_array_move_row(ESelectionModelArray *esma, gint old_row, gint new_row_sorted = es_row_model_to_sorted (esma, new_row); if (old_row_sorted < esma->cursor_row_sorted && esma->cursor_row_sorted < new_row_sorted) - esma->cursor_row_sorted --; + esma->cursor_row_sorted--; else if (new_row_sorted < esma->cursor_row_sorted && esma->cursor_row_sorted < old_row_sorted) - esma->cursor_row_sorted ++; + esma->cursor_row_sorted++; e_bit_array_move_row(esma->eba, old_row, new_row); diff --git a/widgets/misc/test-preferences-window.c b/widgets/misc/test-preferences-window.c index c5291cf755..dec6b85cb5 100644 --- a/widgets/misc/test-preferences-window.c +++ b/widgets/misc/test-preferences-window.c @@ -30,7 +30,7 @@ add_pages (EPreferencesWindow *preferences_window) { gint i; - for (i = 0; i < NUM_PAGES; i ++) { + for (i = 0; i < NUM_PAGES; i++) { GtkWidget *widget; gchar *caption; gchar *page_name; diff --git a/widgets/table/e-cell-hbox.c b/widgets/table/e-cell-hbox.c index 53d1b79934..67c3117b6b 100644 --- a/widgets/table/e-cell-hbox.c +++ b/widgets/table/e-cell-hbox.c @@ -307,7 +307,7 @@ e_cell_hbox_new (void) void e_cell_hbox_append (ECellHbox *hbox, ECell *subcell, gint model_col, gint size) { - hbox->subcell_count ++; + hbox->subcell_count++; hbox->subcells = g_renew (ECell *, hbox->subcells, hbox->subcell_count); hbox->model_cols = g_renew (int, hbox->model_cols, hbox->subcell_count); diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c index b5506af13b..781579da24 100644 --- a/widgets/table/e-cell-tree.c +++ b/widgets/table/e-cell-tree.c @@ -356,7 +356,7 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable, rect.y + rect.height); } parent_node = e_tree_model_node_get_parent (tree_model, parent_node); - depth --; + depth--; offset -= INDENT_AMOUNT; } } @@ -761,7 +761,7 @@ ect_print (ECellView *ecell_view, GtkPrintContext *context, offset - INDENT_AMOUNT / 2, 0); } node = e_tree_model_node_get_parent (tree_model, node); - depth --; + depth--; offset -= INDENT_AMOUNT; } } diff --git a/widgets/table/e-cell-vbox.c b/widgets/table/e-cell-vbox.c index 767d4d1c4f..af3ac2e181 100644 --- a/widgets/table/e-cell-vbox.c +++ b/widgets/table/e-cell-vbox.c @@ -299,7 +299,7 @@ e_cell_vbox_new (void) void e_cell_vbox_append (ECellVbox *vbox, ECell *subcell, gint model_col) { - vbox->subcell_count ++; + vbox->subcell_count++; vbox->subcells = g_renew (ECell *, vbox->subcells, vbox->subcell_count); vbox->model_cols = g_renew (int, vbox->model_cols, vbox->subcell_count); diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index 736473a81c..dd8d995d4a 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -1045,7 +1045,7 @@ config_button_remove (GtkWidget *widget, ETableConfig *config) memmove (config->temp_state->columns + row, config->temp_state->columns + row + 1, sizeof (gint) * (config->temp_state->col_count - row - 1)); memmove (config->temp_state->expansions + row, config->temp_state->expansions + row + 1, sizeof (gdouble) * (config->temp_state->col_count - row - 1)); - config->temp_state->col_count --; + config->temp_state->col_count--; } config->temp_state->columns = g_renew (int, config->temp_state->columns, config->temp_state->col_count); config->temp_state->expansions = g_renew (double, config->temp_state->expansions, config->temp_state->col_count); diff --git a/widgets/table/e-table-field-chooser-item.c b/widgets/table/e-table-field-chooser-item.c index a04e4f3742..7108b33ee7 100644 --- a/widgets/table/e-table-field-chooser-item.c +++ b/widgets/table/e-table-field-chooser-item.c @@ -103,7 +103,8 @@ etfci_find_button (ETableFieldChooserItem *etfci, gdouble loc) ecol = e_table_header_get_column (etfci->combined_header, i); if (ecol->disabled) continue; - height += e_table_header_compute_height (ecol, GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas)); + height += e_table_header_compute_height ( + ecol, GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas)); if (height > loc) return i; } @@ -164,7 +165,8 @@ etfci_reflow (GnomeCanvasItem *item, gint flags) ecol = e_table_header_get_column (etfci->combined_header, i); if (ecol->disabled) continue; - height += e_table_header_compute_height (ecol, GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas)); + height += e_table_header_compute_height ( + ecol, GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas)); } etfci->height = height; @@ -176,14 +178,18 @@ etfci_reflow (GnomeCanvasItem *item, gint flags) } static void -etfci_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags) +etfci_update (GnomeCanvasItem *item, + gdouble *affine, + ArtSVP *clip_path, + gint flags) { ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item); gdouble i2c [6]; ArtPoint c1, c2, i1, i2; if (GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)->update) - (*GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)->update)(item, affine, clip_path, flags); + GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)->update ( + item, affine, clip_path, flags); i1.x = i1.y = 0; i2.x = etfci->width; @@ -198,17 +204,21 @@ etfci_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint fl item->x2 != c2.x || item->y2 != c2.y) { - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); + gnome_canvas_request_redraw ( + item->canvas, item->x1, + item->y1, item->x2, item->y2); item->x1 = c1.x; item->y1 = c1.y; item->x2 = c2.x; item->y2 = c2.y; /* FIXME: Group Child bounds !? */ #if 0 - gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item); + gnome_canvas_group_child_bounds ( + GNOME_CANVAS_GROUP (item->parent), item); #endif } - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, item->x2, item->y2); } static void @@ -235,9 +245,11 @@ etfci_drop_full_header (ETableFieldChooserItem *etfci) header = G_OBJECT (etfci->full_header); if (etfci->full_header_structure_change_id) - g_signal_handler_disconnect (header, etfci->full_header_structure_change_id); + g_signal_handler_disconnect ( + header, etfci->full_header_structure_change_id); if (etfci->full_header_dimension_change_id) - g_signal_handler_disconnect (header, etfci->full_header_dimension_change_id); + g_signal_handler_disconnect ( + header, etfci->full_header_dimension_change_id); etfci->full_header_structure_change_id = 0; etfci->full_header_dimension_change_id = 0; @@ -249,19 +261,23 @@ etfci_drop_full_header (ETableFieldChooserItem *etfci) } static void -full_header_structure_changed (ETableHeader *header, ETableFieldChooserItem *etfci) +full_header_structure_changed (ETableHeader *header, + ETableFieldChooserItem *etfci) { e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci)); } static void -full_header_dimension_changed (ETableHeader *header, gint col, ETableFieldChooserItem *etfci) +full_header_dimension_changed (ETableHeader *header, + gint col, + ETableFieldChooserItem *etfci) { e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci)); } static void -etfci_add_full_header (ETableFieldChooserItem *etfci, ETableHeader *header) +etfci_add_full_header (ETableFieldChooserItem *etfci, + ETableHeader *header) { etfci->full_header = header; g_object_ref (etfci->full_header); @@ -299,19 +315,23 @@ etfci_drop_table_header (ETableFieldChooserItem *etfci) } static void -table_header_structure_changed (ETableHeader *header, ETableFieldChooserItem *etfci) +table_header_structure_changed (ETableHeader *header, + ETableFieldChooserItem *etfci) { e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci)); } static void -table_header_dimension_changed (ETableHeader *header, gint col, ETableFieldChooserItem *etfci) +table_header_dimension_changed (ETableHeader *header, + gint col, + ETableFieldChooserItem *etfci) { e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci)); } static void -etfci_add_table_header (ETableFieldChooserItem *etfci, ETableHeader *header) +etfci_add_table_header (ETableFieldChooserItem *etfci, + ETableHeader *header) { etfci->header = header; g_object_ref (etfci->header); @@ -326,7 +346,10 @@ etfci_add_table_header (ETableFieldChooserItem *etfci, ETableHeader *header) } static void -etfci_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) +etfci_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { GnomeCanvasItem *item; ETableFieldChooserItem *etfci; @@ -449,7 +472,12 @@ etfci_unrealize (GnomeCanvasItem *item) } static void -etfci_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gint x, gint y, gint width, gint height) +etfci_draw (GnomeCanvasItem *item, + GdkDrawable *drawable, + gint x, + gint y, + gint width, + gint height) { ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item); GnomeCanvas *canvas = item->canvas; @@ -548,7 +576,8 @@ etfci_start_drag (ETableFieldChooserItem *etfci, GdkEvent *event, gdouble x, gdo etfci->drag_col = ecol->col_idx; - etfci_drag_types[0].target = g_strdup_printf("%s-%s", etfci_drag_types[0].target, etfci->dnd_code); + etfci_drag_types[0].target = g_strdup_printf ( + "%s-%s", etfci_drag_types[0].target, etfci->dnd_code); d(g_print ("etfci - %s\n", etfci_drag_types[0].target)); list = gtk_target_list_new (etfci_drag_types, G_N_ELEMENTS (etfci_drag_types)); context = gtk_drag_begin (widget, list, GDK_ACTION_MOVE, 1, event); diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index 0af5dc8b98..2f45be08ec 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -496,7 +496,7 @@ etgc_add (ETableGroup *etg, gint row) if (comp_val == 0) { e_table_sorting_utils_free_cmp_cache (cmp_cache); child = child_node->child; - child_node->count ++; + child_node->count++; e_table_group_add (child, row); compute_text (etgc, child_node); return; @@ -598,7 +598,7 @@ etgc_remove (ETableGroup *etg, gint row) ETableGroup *child = child_node->child; if (e_table_group_remove (child, row)) { - child_node->count --; + child_node->count--; if (child_node->count == 0) { e_table_group_container_child_node_free (etgc, child_node); etgc->children = g_list_remove (etgc->children, child_node); diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index a80315a596..5084e19ebc 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -1241,7 +1241,7 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event) ETableSortColumn column = e_table_sort_info_grouping_get_nth( ethi->sort_info, i); - group_indent ++; + group_indent++; g_hash_table_insert ( arrows, GINT_TO_POINTER ((gint) column.column), @@ -1782,8 +1782,8 @@ ethi_change_sort_state (ETableHeaderItem *ethi, ETableCol *col) e_table_sort_info_sorting_get_nth (ethi->sort_info, j)); e_table_sort_info_sorting_truncate (ethi->sort_info, length - 1); - length --; - i --; + length--; + i--; } else { ascending = !ascending; column.ascending = ascending; diff --git a/widgets/table/e-table-header-item.h b/widgets/table/e-table-header-item.h index 17e6e964f3..911f7d4884 100644 --- a/widgets/table/e-table-header-item.h +++ b/widgets/table/e-table-header-item.h @@ -46,7 +46,7 @@ typedef struct { GdkCursor *change_cursor; GdkCursor *resize_cursor; - short height, width; + gshort height, width; PangoFontDescription *font_desc; /* diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c index 3ff4c3472b..0ec180818e 100644 --- a/widgets/table/e-table-header.c +++ b/widgets/table/e-table-header.c @@ -365,7 +365,7 @@ eth_do_insert (ETableHeader *eth, gint pos, ETableCol *val) memmove (ð->columns [pos+1], ð->columns [pos], sizeof (ETableCol *) * (eth->col_count - pos)); eth->columns [pos] = val; - eth->col_count ++; + eth->col_count++; } /** @@ -639,7 +639,7 @@ e_table_header_move (ETableHeader *eth, gint source_index, gint target_index) g_return_if_fail (target_index < eth->col_count + 1); if (source_index < target_index) - target_index --; + target_index--; old = eth->columns [source_index]; eth_do_remove (eth, source_index, FALSE); @@ -723,7 +723,7 @@ eth_set_size (ETableHeader *eth, gint idx, gint size) min_width += eth->columns[i]->min_width + eth->width_extras; if (eth->columns[i]->resizable) { expansion += eth->columns[i]->expansion; - expandable_count ++; + expandable_count++; } } /* If there's no room for anything, don't change. */ diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 2d88258be9..c0def7f286 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -205,7 +205,7 @@ eti_grab (ETableItem *eti, guint32 time) eti->gtk_grabbed = TRUE; } } - eti->grabbed_count ++; + eti->grabbed_count++; } inline static void @@ -213,7 +213,7 @@ eti_ungrab (ETableItem *eti, guint32 time) { GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti); d(g_print ("%s: time: %d\n", __FUNCTION__, time)); - eti->grabbed_count --; + eti->grabbed_count--; if (eti->grabbed_count == 0) { if (eti->grab_cancelled) { eti->grab_cancelled = FALSE; @@ -660,7 +660,7 @@ height_cache_idle(ETableItem *eti) for (i = eti->height_cache_idle_count; i < eti->rows; i++) { if (eti->height_cache[i] == -1) { eti_row_height(eti, i); - changed ++; + changed++; if (changed >= 20) break; } @@ -1045,7 +1045,7 @@ eti_cancel_drag_due_to_model_change (ETableItem *eti) static void eti_freeze (ETableItem *eti) { - eti->frozen_count ++; + eti->frozen_count++; d(g_print ("%s: %d\n", __FUNCTION__, eti->frozen_count)); } @@ -1055,7 +1055,7 @@ eti_unfreeze (ETableItem *eti) if (eti->frozen_count <= 0) return; - eti->frozen_count --; + eti->frozen_count--; d(g_print ("%s: %d\n", __FUNCTION__, eti->frozen_count)); if (eti->frozen_count == 0 && eti->queue_show_cursor) { eti_show_cursor (eti, 0); @@ -2258,7 +2258,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) if (cursor_row != new_cursor_row || cursor_col != new_cursor_col) { eti->click_count = 1; } else { - eti->click_count ++; + eti->click_count++; eti->row_guess = row; if ((!eti_editing(eti)) && e_table_model_is_cell_editable(eti->table_model, cursor_col, row)) { @@ -3464,7 +3464,7 @@ e_table_item_print_page (EPrintable *ep, if (eti->horizontal_draw_grid) { gp_draw_rect(context, 0, yd, width, 1); } - yd ++; + yd++; } itemcontext->rows_printed = row; diff --git a/widgets/table/e-table-memory-store.c b/widgets/table/e-table-memory-store.c index 2775d2d461..4354b57189 100644 --- a/widgets/table/e-table-memory-store.c +++ b/widgets/table/e-table-memory-store.c @@ -544,7 +544,7 @@ e_table_memory_store_remove (ETableMemoryStore *etms, gint row) model = E_TABLE_MODEL (etms); column_count = e_table_model_column_count (model); - for (i = 0; i < column_count; i ++) + for (i = 0; i < column_count; i++) e_table_model_free_value (model, i, e_table_model_value_at (model, i, row)); row_count = e_table_model_row_count (E_TABLE_MODEL (etms)) - 1; @@ -567,8 +567,8 @@ e_table_memory_store_clear (ETableMemoryStore *etms) row_count = e_table_model_row_count (model); column_count = e_table_model_column_count (model); - for (i = 0; i < row_count; i ++) { - for (j = 0; j < column_count; j ++) { + for (i = 0; i < row_count; i++) { + for (j = 0; j < column_count; j++) { e_table_model_free_value (model, j, e_table_model_value_at (model, j, i)); } } diff --git a/widgets/table/e-table-memory.c b/widgets/table/e-table-memory.c index e79448ee20..a761339b2b 100644 --- a/widgets/table/e-table-memory.c +++ b/widgets/table/e-table-memory.c @@ -175,7 +175,7 @@ e_table_memory_insert (ETableMemory *etmm, etmm->priv->data + row, (etmm->priv->num_rows - row) * sizeof (gpointer)); etmm->priv->data[row] = data; - etmm->priv->num_rows ++; + etmm->priv->num_rows++; if (!etmm->priv->frozen) e_table_model_row_inserted(E_TABLE_MODEL(etmm), row); } @@ -206,7 +206,7 @@ e_table_memory_remove (ETableMemory *etmm, gint row) etmm->priv->data + row, etmm->priv->data + row + 1, (etmm->priv->num_rows - row - 1) * sizeof (gpointer)); - etmm->priv->num_rows --; + etmm->priv->num_rows--; if (!etmm->priv->frozen) e_table_model_row_deleted(E_TABLE_MODEL(etmm), row); return ret; @@ -250,7 +250,7 @@ e_table_memory_freeze(ETableMemory *etmm) if (priv->frozen == 0) e_table_model_pre_change(E_TABLE_MODEL(etmm)); - priv->frozen ++; + priv->frozen++; } /** @@ -268,7 +268,7 @@ e_table_memory_thaw(ETableMemory *etmm) ETableMemoryPriv *priv = etmm->priv; if (priv->frozen > 0) - priv->frozen --; + priv->frozen--; if (priv->frozen == 0) { e_table_model_changed(E_TABLE_MODEL(etmm)); } diff --git a/widgets/table/e-table-sorted.c b/widgets/table/e-table-sorted.c index 75a8e768d3..9e4f1c4046 100644 --- a/widgets/table/e-table-sorted.c +++ b/widgets/table/e-table-sorted.c @@ -220,7 +220,7 @@ ets_proxy_model_rows_inserted (ETableSubset *etss, ETableModel *source, gint row etss->map_table = g_realloc (etss->map_table, (etss->n_map + count) * sizeof(gint)); - for (; count > 0; count --) { + for (; count > 0; count--) { if (!full_change) e_table_model_pre_change (etm); i = etss->n_map; @@ -272,7 +272,7 @@ ets_proxy_model_rows_deleted (ETableSubset *etss, ETableModel *source, gint row, if (shift) e_table_model_pre_change (etm); memmove (etss->map_table + i, etss->map_table + i + 1, (etss->n_map - i - 1) * sizeof(gint)); - etss->n_map --; + etss->n_map--; if (shift) e_table_model_row_deleted (etm, i); } diff --git a/widgets/table/e-table-sorting-utils.c b/widgets/table/e-table-sorting-utils.c index c07293242c..ff808da1c0 100644 --- a/widgets/table/e-table-sorting-utils.c +++ b/widgets/table/e-table-sorting-utils.c @@ -213,13 +213,13 @@ e_table_sorting_utils_check_position (ETableModel *source, ETableSortInfo *sort_ i = view_row; if (i < rows - 1 && etsu_compare(source, sort_info, full_header, map_table[i + 1], row, cmp_cache) < 0) { - i ++; + i++; while (i < rows - 1 && etsu_compare(source, sort_info, full_header, map_table[i], row, cmp_cache) < 0) - i ++; + i++; } else if (i > 0 && etsu_compare(source, sort_info, full_header, map_table[i - 1], row, cmp_cache) > 0) { - i --; + i--; while (i > 0 && etsu_compare(source, sort_info, full_header, map_table[i], row, cmp_cache) > 0) - i --; + i--; } e_table_sorting_utils_free_cmp_cache (cmp_cache); @@ -339,13 +339,13 @@ e_table_sorting_utils_tree_check_position (ETreeModel *source, ETableSortInfo *s path = map_table[i]; if (i < count - 1 && etsu_tree_compare(source, sort_info, full_header, map_table[i + 1], path, cmp_cache) < 0) { - i ++; + i++; while (i < count - 1 && etsu_tree_compare(source, sort_info, full_header, map_table[i], path, cmp_cache) < 0) - i ++; + i++; } else if (i > 0 && etsu_tree_compare(source, sort_info, full_header, map_table[i - 1], path, cmp_cache) > 0) { - i --; + i--; while (i > 0 && etsu_tree_compare(source, sort_info, full_header, map_table[i], path, cmp_cache) > 0) - i --; + i--; } e_table_sorting_utils_free_cmp_cache (cmp_cache); diff --git a/widgets/table/e-table-subset-variable.c b/widgets/table/e-table-subset-variable.c index b63ecd01ec..f27d220f10 100644 --- a/widgets/table/e-table-subset-variable.c +++ b/widgets/table/e-table-subset-variable.c @@ -110,7 +110,7 @@ etssv_remove (ETableSubsetVariable *etssv, 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)); - etss->n_map --; + etss->n_map--; e_table_model_row_deleted (etm, i); return TRUE; diff --git a/widgets/table/e-table-without.c b/widgets/table/e-table-without.c index f1f6a88b31..b19bdeb615 100644 --- a/widgets/table/e-table-without.c +++ b/widgets/table/e-table-without.c @@ -118,7 +118,7 @@ remove_row (ETableWithout *etw, gint view_row) etss->map_table + view_row, etss->map_table + view_row + 1, (etss->n_map - view_row - 1) * sizeof (gint)); - etss->n_map --; + etss->n_map--; e_table_model_row_deleted (E_TABLE_MODEL (etw), view_row); } @@ -325,7 +325,7 @@ void e_table_without_hide (ETableWithout *etw, for (i = 0; i < etss->n_map; i++) { if (check_with_key (etw, key, etw_view_to_model_row (etw, i))) { remove_row (etw, i); - i --; + i--; } } } @@ -341,7 +341,7 @@ void e_table_without_hide_adopt (ETableWithout *etw, for (i = 0; i < etss->n_map; i++) { if (check_with_key (etw, key, etw_view_to_model_row (etw, i))) { remove_row (etw, i); - i --; + i--; } } } diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 088e4e1693..9c1070bf4d 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -1701,7 +1701,7 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, 0, 1, 0 + row, 1 + row, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); - row ++; + row++; } gtk_table_attach (GTK_TABLE (e_table), GTK_WIDGET (e_table->table_canvas), 0, 1, 0 + row, 1 + row, diff --git a/widgets/table/e-tree-memory.c b/widgets/table/e-tree-memory.c index b40dda8e3e..13103fc47a 100644 --- a/widgets/table/e-tree-memory.c +++ b/widgets/table/e-tree-memory.c @@ -96,7 +96,7 @@ e_tree_memory_path_depth (ETreeMemoryPath *path) g_return_val_if_fail(path != NULL, -1); for ( path = path->parent; path; path = path->parent) - depth ++; + depth++; return depth; } @@ -133,7 +133,7 @@ e_tree_memory_path_insert (ETreeMemoryPath *parent, parent->first_child = child; break; } - position --; + position--; } } @@ -152,7 +152,7 @@ e_tree_path_unlink (ETreeMemoryPath *path) if (path == parent->last_child) parent->last_child = path->prev_sibling; - parent->num_children --; + parent->num_children--; } /* unlink prev/next sibling links */ @@ -185,7 +185,7 @@ e_tree_memory_freeze(ETreeMemory *etmm) if (priv->frozen == 0) e_tree_model_pre_change(E_TREE_MODEL(etmm)); - priv->frozen ++; + priv->frozen++; } /** @@ -203,7 +203,7 @@ e_tree_memory_thaw(ETreeMemory *etmm) ETreeMemoryPriv *priv = etmm->priv; if (priv->frozen > 0) - priv->frozen --; + priv->frozen--; if (priv->frozen == 0) { e_tree_model_node_changed(E_TREE_MODEL(etmm), priv->root); } @@ -566,7 +566,7 @@ e_tree_memory_node_insert_before (ETreeMemory *etree, for (child = parent_path->first_child; child; child = child->next_sibling) { if (child == sibling_path) break; - position ++; + position++; } } else position = parent_path->num_children; @@ -619,7 +619,7 @@ e_tree_memory_node_remove (ETreeMemory *etree, ETreePath node) sibling; old_position++, sibling = sibling->prev_sibling) /* Empty intentionally*/; - old_position --; + old_position--; } /* unlink this node - we only have to unlink the root node being removed, diff --git a/widgets/table/e-tree-sorted.c b/widgets/table/e-tree-sorted.c index 6beaa34d89..1e887fa7b9 100644 --- a/widgets/table/e-tree-sorted.c +++ b/widgets/table/e-tree-sorted.c @@ -237,7 +237,7 @@ find_path(ETreeSorted *ets, ETreePath corresponding) path = ets->priv->root; - for (i = depth - 1; i >= 0 && path != NULL; i --) { + for (i = depth - 1; i >= 0 && path != NULL; i--) { gint j; if (path->num_children == -1) { @@ -313,7 +313,7 @@ find_or_create_path(ETreeSorted *ets, ETreePath corresponding) path = ets->priv->root; - for (i = depth - 1; i >= 0 && path != NULL; i --) { + for (i = depth - 1; i >= 0 && path != NULL; i--) { gint j; if (path->num_children == -1) { @@ -465,7 +465,7 @@ generate_children(ETreeSorted *ets, ETreeSortedPath *path) for (child = e_tree_model_node_get_first_child(ets->priv->source, path->corresponding); child; child = e_tree_model_node_get_next(ets->priv->source, child)) { - count ++; + count++; } path->num_children = count; @@ -782,7 +782,7 @@ ets_get_children (ETreeModel *etm, ETreePath node, ETreePath **nodes) gint i; (*nodes) = g_malloc (sizeof (ETreePath) * n_children); - for (i = 0; i < n_children; i ++) { + for (i = 0; i < n_children; i++) { (*nodes)[i] = path->children[i]; } } @@ -1027,7 +1027,7 @@ ets_proxy_node_inserted (ETreeModel *etm, ETreePath parent, ETreePath child, ETr for (counter = e_tree_model_node_get_next(etm, child); counter; counter = e_tree_model_node_get_next(etm, counter)) - position --; + position--; if (position != parent_path->num_children) { for (i = 0; i < parent_path->num_children; i++) { @@ -1060,7 +1060,7 @@ ets_proxy_node_inserted (ETreeModel *etm, ETreePath parent, ETreePath child, ETr } else { mark_path_needs_resort(ets, parent_path, TRUE, FALSE); } - parent_path->num_children ++; + parent_path->num_children++; parent_path->children = g_renew(ETreeSortedPath *, parent_path->children, parent_path->num_children); memmove(parent_path->children + i + 1, parent_path->children + i, (parent_path->num_children - 1 - i) * sizeof(gint)); parent_path->children[i] = path; @@ -1098,12 +1098,12 @@ ets_proxy_node_removed (ETreeModel *etm, ETreePath parent, ETreePath child, gint gint i; for (i = 0; i < parent_path->num_children; i++) { if (parent_path->children[i]->orig_position > old_position) - parent_path->children[i]->orig_position --; + parent_path->children[i]->orig_position--; } i = path->position; - parent_path->num_children --; + parent_path->num_children--; memmove(parent_path->children + i, parent_path->children + i + 1, sizeof(ETreeSortedPath *) * (parent_path->num_children - i)); for (; i < parent_path->num_children; i++) { parent_path->children[i]->position = i; diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index f813b64e8f..f0a007c097 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -56,12 +56,6 @@ #define d(x) -#if d(!)0 -#define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x)), g_print ("%s: e_table_item_leave_edit\n", __FUNCTION__)) -#else -#define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x))) -#endif - enum { CURSOR_CHANGE, CURSOR_ACTIVATED, @@ -199,7 +193,7 @@ struct ETreePriv { GList *expanded_list; }; -static guint et_signals [LAST_SIGNAL] = { 0, }; +static guint et_signals[LAST_SIGNAL] = { 0, }; static void et_grab_focus (GtkWidget *widget); @@ -298,7 +292,7 @@ current_search_col (ETree *et) static void e_tree_state_change (ETree *et) { - g_signal_emit (G_OBJECT (et), et_signals [STATE_CHANGE], 0); + g_signal_emit (G_OBJECT (et), et_signals[STATE_CHANGE], 0); } static void @@ -349,24 +343,27 @@ connect_header (ETree *e_tree, ETableState *state) if (e_tree->priv->header != NULL) disconnect_header (e_tree); - e_tree->priv->header = e_table_state_to_header (GTK_WIDGET(e_tree), e_tree->priv->full_header, state); + e_tree->priv->header = e_table_state_to_header ( + GTK_WIDGET(e_tree), e_tree->priv->full_header, state); + + e_tree->priv->structure_change_id = g_signal_connect ( + e_tree->priv->header, "structure_change", + G_CALLBACK (search_col_change_trigger), e_tree); - e_tree->priv->structure_change_id = - g_signal_connect (G_OBJECT (e_tree->priv->header), "structure_change", - G_CALLBACK (search_col_change_trigger), e_tree); - e_tree->priv->expansion_change_id = - g_signal_connect (G_OBJECT (e_tree->priv->header), "expansion_change", - G_CALLBACK (change_trigger), e_tree); + e_tree->priv->expansion_change_id = g_signal_connect ( + e_tree->priv->header, "expansion_change", + G_CALLBACK (change_trigger), e_tree); if (state->sort_info) { e_tree->priv->sort_info = e_table_sort_info_duplicate(state->sort_info); e_table_sort_info_set_can_group (e_tree->priv->sort_info, FALSE); - e_tree->priv->sort_info_change_id = - g_signal_connect (G_OBJECT (e_tree->priv->sort_info), "sort_info_changed", - G_CALLBACK (search_col_change_trigger), e_tree); - e_tree->priv->group_info_change_id = - g_signal_connect (G_OBJECT (e_tree->priv->sort_info), "group_info_changed", - G_CALLBACK (search_col_change_trigger), e_tree); + e_tree->priv->sort_info_change_id = g_signal_connect ( + e_tree->priv->sort_info, "sort_info_changed", + G_CALLBACK (search_col_change_trigger), e_tree); + + e_tree->priv->group_info_change_id = g_signal_connect ( + e_tree->priv->sort_info, "group_info_changed", + G_CALLBACK (search_col_change_trigger), e_tree); } else e_tree->priv->sort_info = NULL; @@ -467,13 +464,17 @@ search_search_callback (ETreeModel *model, ETreePath path, gpointer data) gconstpointer value; ETableCol *col = current_search_col (cb_data->et); - value = e_tree_model_value_at (model, path, cb_data->et->priv->current_search_col->col_idx); + value = e_tree_model_value_at ( + model, path, cb_data->et->priv->current_search_col->col_idx); return col->search (value, cb_data->string); } static gboolean -et_search_search (ETableSearch *search, gchar *string, ETableSearchFlags flags, ETree *et) +et_search_search (ETableSearch *search, + gchar *string, + ETableSearchFlags flags, + ETree *et) { ETreePath cursor; ETreePath found; @@ -498,9 +499,15 @@ et_search_search (ETableSearch *search, gchar *string, ETableSearchFlags flags, } } - found = e_tree_model_node_find (et->priv->model, cursor, NULL, E_TREE_FIND_NEXT_FORWARD, search_search_callback, &cb_data); + found = e_tree_model_node_find ( + et->priv->model, cursor, NULL, + E_TREE_FIND_NEXT_FORWARD, + search_search_callback, &cb_data); if (found == NULL) - found = e_tree_model_node_find (et->priv->model, NULL, cursor, E_TREE_FIND_NEXT_FORWARD, search_search_callback, &cb_data); + found = e_tree_model_node_find ( + et->priv->model, NULL, cursor, + E_TREE_FIND_NEXT_FORWARD, + search_search_callback, &cb_data); if (found && found != cursor) { gint model_row; @@ -508,7 +515,9 @@ et_search_search (ETableSearch *search, gchar *string, ETableSearchFlags flags, e_tree_table_adapter_show_node (et->priv->etta, found); model_row = e_tree_table_adapter_row_of_node (et->priv->etta, found); - e_selection_model_select_as_key_press(E_SELECTION_MODEL (et->priv->selection), model_row, col->col_idx, GDK_CONTROL_MASK); + e_selection_model_select_as_key_press ( + E_SELECTION_MODEL (et->priv->selection), + model_row, col->col_idx, GDK_CONTROL_MASK); return TRUE; } else if (cursor && !(flags & E_TABLE_SEARCH_FLAGS_CHECK_CURSOR_FIRST)) { gconstpointer value; @@ -529,10 +538,11 @@ et_search_accept (ETableSearch *search, ETree *et) if (col == NULL) return; - g_object_get(et->priv->selection, - "cursor_row", &cursor, - NULL); - e_selection_model_select_as_key_press(E_SELECTION_MODEL (et->priv->selection), cursor, col->col_idx, 0); + g_object_get (et->priv->selection, "cursor_row", &cursor, NULL); + + e_selection_model_select_as_key_press ( + E_SELECTION_MODEL (et->priv->selection), + cursor, col->col_idx, 0); } static void @@ -603,9 +613,11 @@ e_tree_init (ETree *e_tree) e_tree->priv->do_drag = FALSE; #ifdef E_TREE_USE_TREE_SELECTION - e_tree->priv->selection = E_SELECTION_MODEL(e_tree_selection_model_new()); + e_tree->priv->selection = + E_SELECTION_MODEL (e_tree_selection_model_new ()); #else - e_tree->priv->selection = E_SELECTION_MODEL(e_table_selection_model_new()); + e_tree->priv->selection = + E_SELECTION_MODEL (e_table_selection_model_new ()); #endif e_tree->priv->spec = NULL; @@ -667,7 +679,8 @@ set_header_canvas_width (ETree *e_tree) { gdouble oldwidth, oldheight, width; - if (!(e_tree->priv->header_item && e_tree->priv->header_canvas && e_tree->priv->table_canvas)) + if (!(e_tree->priv->header_item && + e_tree->priv->header_canvas && e_tree->priv->table_canvas)) return; gnome_canvas_get_scroll_region (GNOME_CANVAS (e_tree->priv->table_canvas), @@ -850,45 +863,45 @@ static void tree_canvas_reflow (GnomeCanvas *canvas, ETree *e_tree) { if (!e_tree->priv->reflow_idle_id) - e_tree->priv->reflow_idle_id = g_idle_add_full (400, (GSourceFunc) tree_canvas_reflow_idle, e_tree, NULL); + e_tree->priv->reflow_idle_id = g_idle_add_full ( + 400, (GSourceFunc) tree_canvas_reflow_idle, + e_tree, NULL); } static void item_cursor_change (ETableItem *eti, gint row, ETree *et) { ETreePath path = e_tree_table_adapter_node_at_row(et->priv->etta, row); - g_signal_emit (et, - et_signals [CURSOR_CHANGE], 0, - row, path); + + g_signal_emit (et, et_signals[CURSOR_CHANGE], 0, row, path); } static void item_cursor_activated (ETableItem *eti, gint row, ETree *et) { ETreePath path = e_tree_table_adapter_node_at_row(et->priv->etta, row); - g_signal_emit (et, - et_signals [CURSOR_ACTIVATED], 0, - row, path); - d(g_print("%s: Emitted CURSOR_ACTIVATED signal on row: %d and path: 0x%p\n", __FUNCTION__, row, path)); + + g_signal_emit (et, et_signals[CURSOR_ACTIVATED], 0, row, path); } static void item_double_click (ETableItem *eti, gint row, gint col, GdkEvent *event, ETree *et) { ETreePath path = e_tree_table_adapter_node_at_row(et->priv->etta, row); - g_signal_emit (et, - et_signals [DOUBLE_CLICK], 0, - row, path, col, event); + + g_signal_emit (et, et_signals[DOUBLE_CLICK], 0, row, path, col, event); } static gboolean item_right_click (ETableItem *eti, gint row, gint col, GdkEvent *event, ETree *et) { - gboolean return_val = 0; ETreePath path = e_tree_table_adapter_node_at_row(et->priv->etta, row); - g_signal_emit (et, - et_signals [RIGHT_CLICK], 0, - row, path, col, event, &return_val); + gboolean return_val = 0; + + g_signal_emit ( + et, et_signals[RIGHT_CLICK], 0, + row, path, col, event, &return_val); + return return_val; } @@ -897,9 +910,10 @@ item_click (ETableItem *eti, gint row, gint col, GdkEvent *event, ETree *et) { gboolean return_val = 0; ETreePath path = e_tree_table_adapter_node_at_row(et->priv->etta, row); - g_signal_emit (et, - et_signals [CLICK], 0, - row, path, col, event, &return_val); + + g_signal_emit ( + et, et_signals[CLICK], 0, row, path, col, event, &return_val); + return return_val; } @@ -934,8 +948,11 @@ item_key_press (ETableItem *eti, gint row, gint col, GdkEvent *event, ETree *et) row_local = e_table_model_row_count (E_TABLE_MODEL(et->priv->etta)) - 1; row_local = e_tree_view_to_model_row (et, row_local); - col_local = e_selection_model_cursor_col (E_SELECTION_MODEL (et->priv->selection)); - e_selection_model_select_as_key_press (E_SELECTION_MODEL (et->priv->selection), row_local, col_local, key->state); + col_local = e_selection_model_cursor_col ( + E_SELECTION_MODEL (et->priv->selection)); + e_selection_model_select_as_key_press ( + E_SELECTION_MODEL (et->priv->selection), + row_local, col_local, key->state); return_val = 1; break; @@ -949,8 +966,11 @@ item_key_press (ETableItem *eti, gint row, gint col, GdkEvent *event, ETree *et) row_local = e_table_model_row_count (E_TABLE_MODEL(et->priv->etta)) - 1; row_local = e_tree_view_to_model_row (et, row_local); - col_local = e_selection_model_cursor_col (E_SELECTION_MODEL (et->priv->selection)); - e_selection_model_select_as_key_press (E_SELECTION_MODEL (et->priv->selection), row_local, col_local, key->state); + col_local = e_selection_model_cursor_col ( + E_SELECTION_MODEL (et->priv->selection)); + e_selection_model_select_as_key_press ( + E_SELECTION_MODEL (et->priv->selection), + row_local, col_local, key->state); return_val = 1; break; @@ -958,8 +978,10 @@ item_key_press (ETableItem *eti, gint row, gint col, GdkEvent *event, ETree *et) case GDK_KP_Add: case GDK_Right: case GDK_KP_Right: - /* Only allow if the Shift modifier is used -- eg. Ctrl-Equal shouldn't be handled. */ - if ((key->state & (GDK_SHIFT_MASK | GDK_LOCK_MASK | GDK_MOD1_MASK)) != GDK_SHIFT_MASK) + /* Only allow if the Shift modifier is used. + * eg. Ctrl-Equal shouldn't be handled. */ + if ((key->state & (GDK_SHIFT_MASK | GDK_LOCK_MASK | + GDK_MOD1_MASK)) != GDK_SHIFT_MASK) break; if (row != -1) { path = e_tree_table_adapter_node_at_row(et->priv->etta, row); @@ -972,8 +994,10 @@ item_key_press (ETableItem *eti, gint row, gint col, GdkEvent *event, ETree *et) case GDK_KP_Subtract: case GDK_Left: case GDK_KP_Left: - /* Only allow if the Shift modifier is used -- eg. Ctrl-Minus shouldn't be handled. */ - if ((key->state & (GDK_SHIFT_MASK | GDK_LOCK_MASK | GDK_MOD1_MASK)) != GDK_SHIFT_MASK) + /* Only allow if the Shift modifier is used. + * eg. Ctrl-Minus shouldn't be handled. */ + if ((key->state & (GDK_SHIFT_MASK | GDK_LOCK_MASK | + GDK_MOD1_MASK)) != GDK_SHIFT_MASK) break; if (row != -1) { path = e_tree_table_adapter_node_at_row(et->priv->etta, row); @@ -987,7 +1011,9 @@ item_key_press (ETableItem *eti, gint row, gint col, GdkEvent *event, ETree *et) return TRUE; /* Fallthrough */ default: - if ((key->state & ~(GDK_SHIFT_MASK | GDK_LOCK_MASK | GDK_MOD1_MASK | GDK_MOD2_MASK | GDK_MOD3_MASK | GDK_MOD4_MASK | GDK_MOD5_MASK)) == 0 + if ((key->state & ~(GDK_SHIFT_MASK | GDK_LOCK_MASK | + GDK_MOD1_MASK | GDK_MOD2_MASK | GDK_MOD3_MASK | + GDK_MOD4_MASK | GDK_MOD5_MASK)) == 0 && ((key->keyval >= GDK_a && key->keyval <= GDK_z) || (key->keyval >= GDK_A && key->keyval <= GDK_Z) || (key->keyval >= GDK_0 && key->keyval <= GDK_9))) { @@ -995,7 +1021,7 @@ item_key_press (ETableItem *eti, gint row, gint col, GdkEvent *event, ETree *et) } path = e_tree_table_adapter_node_at_row(et->priv->etta, row); g_signal_emit (et, - et_signals [KEY_PRESS], 0, + et_signals[KEY_PRESS], 0, row, path, col, event, &return_val); break; } @@ -1010,9 +1036,9 @@ item_start_drag (ETableItem *eti, gint row, gint col, GdkEvent *event, ETree *et path = e_tree_table_adapter_node_at_row(et->priv->etta, row); - g_signal_emit (et, - et_signals [START_DRAG], 0, - row, path, col, event, &return_val); + g_signal_emit ( + et, et_signals[START_DRAG], 0, + row, path, col, event, &return_val); return return_val; } @@ -1020,33 +1046,35 @@ item_start_drag (ETableItem *eti, gint row, gint col, GdkEvent *event, ETree *et static void et_selection_model_selection_changed (ETableSelectionModel *etsm, ETree *et) { - g_signal_emit (et, - et_signals [SELECTION_CHANGE], 0); + g_signal_emit (et, et_signals[SELECTION_CHANGE], 0); } static void -et_selection_model_selection_row_changed (ETableSelectionModel *etsm, gint row, ETree *et) +et_selection_model_selection_row_changed (ETableSelectionModel *etsm, + gint row, + ETree *et) { - g_signal_emit (et, - et_signals [SELECTION_CHANGE], 0); + g_signal_emit (et, et_signals[SELECTION_CHANGE], 0); } static void et_build_item (ETree *et) { - et->priv->item = gnome_canvas_item_new(GNOME_CANVAS_GROUP (gnome_canvas_root(et->priv->table_canvas)), - e_table_item_get_type(), - "ETableHeader", et->priv->header, - "ETableModel", et->priv->etta, - "selection_model", et->priv->selection, - "alternating_row_colors", et->priv->alternating_row_colors, - "horizontal_draw_grid", et->priv->horizontal_draw_grid, - "vertical_draw_grid", et->priv->vertical_draw_grid, - "drawfocus", et->priv->draw_focus, - "cursor_mode", et->priv->cursor_mode, - "length_threshold", et->priv->length_threshold, - "uniform_row_height", et->priv->uniform_row_height, - NULL); + et->priv->item = gnome_canvas_item_new ( + GNOME_CANVAS_GROUP ( + gnome_canvas_root (et->priv->table_canvas)), + e_table_item_get_type(), + "ETableHeader", et->priv->header, + "ETableModel", et->priv->etta, + "selection_model", et->priv->selection, + "alternating_row_colors", et->priv->alternating_row_colors, + "horizontal_draw_grid", et->priv->horizontal_draw_grid, + "vertical_draw_grid", et->priv->vertical_draw_grid, + "drawfocus", et->priv->draw_focus, + "cursor_mode", et->priv->cursor_mode, + "length_threshold", et->priv->length_threshold, + "uniform_row_height", et->priv->uniform_row_height, + NULL); g_signal_connect (et->priv->item, "cursor_change", G_CALLBACK (item_cursor_change), et); @@ -1082,7 +1110,7 @@ white_item_event (GnomeCanvasItem *white_item, GdkEvent *event, ETree *e_tree) { gboolean return_val = 0; g_signal_emit (e_tree, - et_signals [WHITE_SPACE_EVENT], 0, + et_signals[WHITE_SPACE_EVENT], 0, event, &return_val); return return_val; } @@ -1099,7 +1127,7 @@ et_canvas_root_event (GnomeCanvasItem *root, GdkEvent *event, ETree *e_tree) GnomeCanvasItem *item = GNOME_CANVAS(root->canvas)->focused_item; if (E_IS_TABLE_ITEM(item)) { - e_table_item_leave_edit_(E_TABLE_ITEM(item)); + e_table_item_leave_edit(E_TABLE_ITEM(item)); return TRUE; } } @@ -1129,7 +1157,8 @@ table_canvas_focus_event_cb (GtkWidget *widget, GdkEventFocus *event, gpointer d canvas = GNOME_CANVAS (widget); tree = E_TREE (data); - if (!canvas->focused_item || (e_selection_model_cursor_row (tree->priv->selection) == -1)) { + if (!canvas->focused_item || + (e_selection_model_cursor_row (tree->priv->selection) == -1)) { e_table_item_set_cursor (E_TABLE_ITEM (tree->priv->item), 0, 0); gnome_canvas_item_grab_focus (tree->priv->item); } @@ -1221,7 +1250,8 @@ e_tree_set_search_column (ETree *e_tree, gint col) } e_tree->priv->search_col_set = TRUE; - e_tree->priv->current_search_col = e_table_header_get_column (e_tree->priv->full_header, col); + e_tree->priv->current_search_col = e_table_header_get_column ( + e_tree->priv->full_header, col); } void @@ -1458,17 +1488,21 @@ et_table_rows_deleted (ETableModel *table_model, gint row, gint count, ETree *et static void et_connect_to_etta (ETree *et) { - et->priv->table_model_change_id = g_signal_connect (et->priv->etta, "model_changed", - G_CALLBACK (et_table_model_changed), et); + et->priv->table_model_change_id = g_signal_connect ( + et->priv->etta, "model_changed", + G_CALLBACK (et_table_model_changed), et); - et->priv->table_row_change_id = g_signal_connect (et->priv->etta, "model_row_changed", - G_CALLBACK (et_table_row_changed), et); + et->priv->table_row_change_id = g_signal_connect ( + et->priv->etta, "model_row_changed", + G_CALLBACK (et_table_row_changed), et); - et->priv->table_cell_change_id = g_signal_connect (et->priv->etta, "model_cell_changed", - G_CALLBACK (et_table_cell_changed), et); + et->priv->table_cell_change_id = g_signal_connect ( + et->priv->etta, "model_cell_changed", + G_CALLBACK (et_table_cell_changed), et); - et->priv->table_rows_delete_id = g_signal_connect (et->priv->etta, "model_rows_deleted", - G_CALLBACK (et_table_rows_deleted), et); + et->priv->table_rows_delete_id = g_signal_connect ( + et->priv->etta, "model_rows_deleted", + G_CALLBACK (et_table_rows_deleted), et); } @@ -1499,7 +1533,9 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, e_tree->priv->model = etm; g_object_ref (etm); - e_tree->priv->etta = E_TREE_TABLE_ADAPTER(e_tree_table_adapter_new(e_tree->priv->model, e_tree->priv->sort_info, e_tree->priv->full_header)); + e_tree->priv->etta = E_TREE_TABLE_ADAPTER ( + e_tree_table_adapter_new (e_tree->priv->model, + e_tree->priv->sort_info, e_tree->priv->full_header)); et_connect_to_etta (e_tree); @@ -1545,7 +1581,7 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, 0, 1, 0 + row, 1 + row, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); - row ++; + row++; } gtk_table_attach (GTK_TABLE (e_tree), GTK_WIDGET (e_tree->priv->table_canvas), 0, 1, 0 + row, 1 + row, @@ -1743,7 +1779,10 @@ e_tree_new (ETreeModel *etm, ETableExtras *ete, const gchar *spec, const gchar * * The newly created #ETree or %NULL if there's an error. **/ GtkWidget * -e_tree_new_from_spec_file (ETreeModel *etm, ETableExtras *ete, const gchar *spec_fn, const gchar *state_fn) +e_tree_new_from_spec_file (ETreeModel *etm, + ETableExtras *ete, + const gchar *spec_fn, + const gchar *state_fn) { ETree *e_tree; @@ -1782,10 +1821,13 @@ e_tree_set_cursor (ETree *e_tree, ETreePath path) g_return_if_fail(path != NULL); #ifdef E_TREE_USE_TREE_SELECTION - e_tree_selection_model_select_single_path (E_TREE_SELECTION_MODEL(e_tree->priv->selection), path); - e_tree_selection_model_change_cursor (E_TREE_SELECTION_MODEL(e_tree->priv->selection), path); + e_tree_selection_model_select_single_path ( + E_TREE_SELECTION_MODEL(e_tree->priv->selection), path); + e_tree_selection_model_change_cursor ( + E_TREE_SELECTION_MODEL(e_tree->priv->selection), path); #else - row = e_tree_table_adapter_row_of_node(E_TREE_TABLE_ADAPTER(e_tree->priv->etta), path); + row = e_tree_table_adapter_row_of_node ( + E_TREE_TABLE_ADAPTER(e_tree->priv->etta), path); if (row == -1) return; @@ -1800,10 +1842,10 @@ ETreePath e_tree_get_cursor (ETree *e_tree) { #ifdef E_TREE_USE_TREE_SELECTION - return e_tree_selection_model_get_cursor (E_TREE_SELECTION_MODEL(e_tree->priv->selection)); + return e_tree_selection_model_get_cursor ( + E_TREE_SELECTION_MODEL(e_tree->priv->selection)); #else gint row; - ETreePath path; g_return_val_if_fail(e_tree != NULL, NULL); g_return_val_if_fail(E_IS_TREE(e_tree), NULL); @@ -1812,8 +1854,9 @@ e_tree_get_cursor (ETree *e_tree) NULL); if (row == -1) return NULL; - path = e_tree_table_adapter_node_at_row(E_TREE_TABLE_ADAPTER(e_tree->priv->etta), row); - return path; + + return e_tree_table_adapter_node_at_row ( + E_TREE_TABLE_ADAPTER(e_tree->priv->etta), row); #endif } @@ -1839,9 +1882,9 @@ e_tree_selected_path_foreach (ETree *e_tree, g_return_if_fail(e_tree != NULL); g_return_if_fail(E_IS_TREE(e_tree)); - e_tree_selection_model_foreach(E_TREE_SELECTION_MODEL (e_tree->priv->selection), - callback, - closure); + e_tree_selection_model_foreach ( + E_TREE_SELECTION_MODEL (e_tree->priv->selection), + callback, closure); } /* Standard functions */ @@ -2227,7 +2270,10 @@ find_prev_in_range (ETree *et, gint start, gint end, ETreePathFunc func, gpointe } gboolean -e_tree_find_next (ETree *et, ETreeFindNextParams params, ETreePathFunc func, gpointer data) +e_tree_find_next (ETree *et, + ETreeFindNextParams params, + ETreePathFunc func, + gpointer data) { ETreePath cursor, found; gint row, row_count; @@ -2718,8 +2764,10 @@ e_tree_get_cell_at (ETree *tree, * @tree: The tree. * @row: The row to get the geometry of. * @col: The col to get the geometry of. - * @x_return: Returns the x coordinate of the upper right hand corner of the cell with respect to the widget. - * @y_return: Returns the y coordinate of the upper right hand corner of the cell with respect to the widget. + * @x_return: Returns the x coordinate of the upper right hand corner + * of the cell with respect to the widget. + * @y_return: Returns the y coordinate of the upper right hand corner + * of the cell with respect to the widget. * @width_return: Returns the width of the cell. * @height_return: Returns the height of the cell. * @@ -2765,7 +2813,7 @@ et_drag_begin (GtkWidget *widget, ETree *et) { g_signal_emit (et, - et_signals [TREE_DRAG_BEGIN], 0, + et_signals[TREE_DRAG_BEGIN], 0, et->priv->drag_row, et->priv->drag_path, et->priv->drag_col, @@ -2778,7 +2826,7 @@ et_drag_end (GtkWidget *widget, ETree *et) { g_signal_emit (et, - et_signals [TREE_DRAG_END], 0, + et_signals[TREE_DRAG_END], 0, et->priv->drag_row, et->priv->drag_path, et->priv->drag_col, @@ -2794,7 +2842,7 @@ et_drag_data_get(GtkWidget *widget, ETree *et) { g_signal_emit (et, - et_signals [TREE_DRAG_DATA_GET], 0, + et_signals[TREE_DRAG_DATA_GET], 0, et->priv->drag_row, et->priv->drag_path, et->priv->drag_col, @@ -2810,7 +2858,7 @@ et_drag_data_delete(GtkWidget *widget, ETree *et) { g_signal_emit (et, - et_signals [TREE_DRAG_DATA_DELETE], 0, + et_signals[TREE_DRAG_DATA_DELETE], 0, et->priv->drag_row, et->priv->drag_path, et->priv->drag_col, @@ -2835,7 +2883,7 @@ do_drag_motion(ETree *et, &col); if (row != et->priv->drop_row && col != et->priv->drop_col) { g_signal_emit (et, - et_signals [TREE_DRAG_LEAVE], 0, + et_signals[TREE_DRAG_LEAVE], 0, et->priv->drop_row, et->priv->drop_path, et->priv->drop_col, @@ -2849,7 +2897,7 @@ do_drag_motion(ETree *et, et->priv->drop_path = path; et->priv->drop_col = col; g_signal_emit (et, - et_signals [TREE_DRAG_MOTION], 0, + et_signals[TREE_DRAG_MOTION], 0, et->priv->drop_row, et->priv->drop_path, et->priv->drop_col, @@ -2960,9 +3008,15 @@ hover_timeout (gpointer data) path = e_tree_table_adapter_node_at_row(et->priv->etta, row); if (path && e_tree_model_node_is_expandable (et->priv->model, path)) { if (!e_tree_table_adapter_node_is_expanded (et->priv->etta, path)) { - if (e_tree_model_has_save_id (et->priv->model) && e_tree_model_has_get_node_by_id (et->priv->model)) - et->priv->expanded_list = g_list_prepend (et->priv->expanded_list, e_tree_model_get_save_id (et->priv->model, path)); - e_tree_table_adapter_node_set_expanded (et->priv->etta, path, TRUE); + if (e_tree_model_has_save_id (et->priv->model) && + e_tree_model_has_get_node_by_id (et->priv->model)) + et->priv->expanded_list = g_list_prepend ( + et->priv->expanded_list, + e_tree_model_get_save_id ( + et->priv->model, path)); + + e_tree_table_adapter_node_set_expanded ( + et->priv->etta, path, TRUE); } } @@ -3007,7 +3061,9 @@ collapse_drag (ETree *et, ETreePath drop) ETreePath search; gboolean found = FALSE; - for (search = drop; search; search = e_tree_model_node_get_parent (et->priv->model, search)) { + for (search = drop; search; + search = e_tree_model_node_get_parent ( + et->priv->model, search)) { if (path == search) { found = TRUE; break; @@ -3015,7 +3071,8 @@ collapse_drag (ETree *et, ETreePath drop) } if (!found) - e_tree_table_adapter_node_set_expanded (et->priv->etta, path, FALSE); + e_tree_table_adapter_node_set_expanded ( + et->priv->etta, path, FALSE); } g_free (save_id); } @@ -3060,7 +3117,7 @@ et_drag_leave(GtkWidget *widget, ETree *et) { g_signal_emit (et, - et_signals [TREE_DRAG_LEAVE], 0, + et_signals[TREE_DRAG_LEAVE], 0, et->priv->drop_row, et->priv->drop_path, et->priv->drop_col, @@ -3141,14 +3198,14 @@ et_drag_drop(GtkWidget *widget, if (row != et->priv->drop_row && col != et->priv->drop_row) { g_signal_emit (et, - et_signals [TREE_DRAG_LEAVE], 0, + et_signals[TREE_DRAG_LEAVE], 0, et->priv->drop_row, et->priv->drop_path, et->priv->drop_col, context, time); g_signal_emit (et, - et_signals [TREE_DRAG_MOTION], 0, + et_signals[TREE_DRAG_MOTION], 0, row, path, col, @@ -3163,7 +3220,7 @@ et_drag_drop(GtkWidget *widget, et->priv->drop_col = col; g_signal_emit (et, - et_signals [TREE_DRAG_DROP], 0, + et_signals[TREE_DRAG_DROP], 0, et->priv->drop_row, et->priv->drop_path, et->priv->drop_col, @@ -3202,7 +3259,7 @@ et_drag_data_received(GtkWidget *widget, &col); path = e_tree_table_adapter_node_at_row(et->priv->etta, row); g_signal_emit (et, - et_signals [TREE_DRAG_DATA_RECEIVED], 0, + et_signals[TREE_DRAG_DATA_RECEIVED], 0, row, path, col, @@ -3253,7 +3310,7 @@ e_tree_class_init (ETreeClass *class) class->tree_drag_drop = NULL; class->tree_drag_data_received = NULL; - et_signals [CURSOR_CHANGE] = + et_signals[CURSOR_CHANGE] = g_signal_new ("cursor_change", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, @@ -3262,7 +3319,7 @@ e_tree_class_init (ETreeClass *class) e_marshal_NONE__INT_POINTER, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_POINTER); - et_signals [CURSOR_ACTIVATED] = + et_signals[CURSOR_ACTIVATED] = g_signal_new ("cursor_activated", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, @@ -3271,7 +3328,7 @@ e_tree_class_init (ETreeClass *class) e_marshal_NONE__INT_POINTER, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_POINTER); - et_signals [SELECTION_CHANGE] = + et_signals[SELECTION_CHANGE] = g_signal_new ("selection_change", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, @@ -3280,7 +3337,7 @@ e_tree_class_init (ETreeClass *class) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - et_signals [DOUBLE_CLICK] = + et_signals[DOUBLE_CLICK] = g_signal_new ("double_click", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, @@ -3290,7 +3347,7 @@ e_tree_class_init (ETreeClass *class) G_TYPE_NONE, 4, G_TYPE_INT, G_TYPE_POINTER, G_TYPE_INT, GDK_TYPE_EVENT); - et_signals [RIGHT_CLICK] = + et_signals[RIGHT_CLICK] = g_signal_new ("right_click", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, @@ -3300,7 +3357,7 @@ e_tree_class_init (ETreeClass *class) G_TYPE_BOOLEAN, 4, G_TYPE_INT, G_TYPE_POINTER, G_TYPE_INT, GDK_TYPE_EVENT); - et_signals [CLICK] = + et_signals[CLICK] = g_signal_new ("click", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, @@ -3310,7 +3367,7 @@ e_tree_class_init (ETreeClass *class) G_TYPE_BOOLEAN, 4, G_TYPE_INT, G_TYPE_POINTER, G_TYPE_INT, GDK_TYPE_EVENT); - et_signals [KEY_PRESS] = + et_signals[KEY_PRESS] = g_signal_new ("key_press", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, @@ -3320,7 +3377,7 @@ e_tree_class_init (ETreeClass *class) G_TYPE_BOOLEAN, 4, G_TYPE_INT, G_TYPE_POINTER, G_TYPE_INT, GDK_TYPE_EVENT); - et_signals [START_DRAG] = + et_signals[START_DRAG] = g_signal_new ("start_drag", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, @@ -3330,7 +3387,7 @@ e_tree_class_init (ETreeClass *class) G_TYPE_NONE, 4, G_TYPE_INT, G_TYPE_POINTER, G_TYPE_INT, GDK_TYPE_EVENT); - et_signals [STATE_CHANGE] = + et_signals[STATE_CHANGE] = g_signal_new ("state_change", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, @@ -3339,7 +3396,7 @@ e_tree_class_init (ETreeClass *class) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - et_signals [WHITE_SPACE_EVENT] = + et_signals[WHITE_SPACE_EVENT] = g_signal_new ("white_space_event", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, @@ -3547,11 +3604,15 @@ tree_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETree *tree) g_return_if_fail (tree->priv != NULL); g_return_if_fail (tree->priv->info_text != NULL); - gnome_canvas_get_scroll_region (GNOME_CANVAS (tree->priv->table_canvas), NULL, NULL, &width, NULL); + gnome_canvas_get_scroll_region ( + GNOME_CANVAS (tree->priv->table_canvas), + NULL, NULL, &width, NULL); width -= 60.0; - g_object_set (tree->priv->info_text, "width", width, "clip_width", width, NULL); + g_object_set ( + tree->priv->info_text, "width", width, + "clip_width", width, NULL); } /** @@ -3599,7 +3660,9 @@ e_tree_set_info_message (ETree *tree, const gchar *info_message) e_canvas_item_move_absolute (tree->priv->info_text, 30, 30); - tree->priv->info_text_resize_id = g_signal_connect (tree, "size_allocate", G_CALLBACK (tree_size_allocate), tree); + tree->priv->info_text_resize_id = g_signal_connect ( + tree, "size_allocate", + G_CALLBACK (tree_size_allocate), tree); } else gnome_canvas_item_set (tree->priv->info_text, "text", info_message, NULL); } diff --git a/widgets/table/gal-a11y-e-table-item.c b/widgets/table/gal-a11y-e-table-item.c index 85c4f9164d..f2b865ac0c 100644 --- a/widgets/table/gal-a11y-e-table-item.c +++ b/widgets/table/gal-a11y-e-table-item.c @@ -42,13 +42,13 @@ #include "gal-a11y-e-cell.h" #include "gal-a11y-e-table-column-header.h" -#define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yETableItemClass)) static GObjectClass *parent_class; static AtkComponentIface *component_parent_iface; static GType parent_type; static gint priv_offset; static GQuark quark_accessible_object = 0; -#define GET_PRIVATE(object) ((GalA11yETableItemPrivate *) (((gchar *) object) + priv_offset)) +#define GET_PRIVATE(object) \ + ((GalA11yETableItemPrivate *) (((gchar *) object) + priv_offset)) #define PARENT_TYPE (parent_type) struct _GalA11yETableItemPrivate { @@ -156,7 +156,9 @@ eti_a11y_get_gobject (AtkObject *accessible) } static void -eti_a11y_reset_focus_object (GalA11yETableItem *a11y, ETableItem *item, gboolean notify) +eti_a11y_reset_focus_object (GalA11yETableItem *a11y, + ETableItem *item, + gboolean notify) { ESelectionModel * esm; gint cursor_row, cursor_col, view_row, view_col; @@ -270,7 +272,9 @@ eti_get_extents (AtkComponent *component, coord_type); if (parent && GAL_A11Y_IS_E_TABLE_CLICK_TO_ADD (parent)) { - ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (parent))); + ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD ( + atk_gobject_accessible_get_object ( + ATK_GOBJECT_ACCESSIBLE (parent))); if (etcta) { *width = etcta->width; *height = etcta->height; @@ -366,9 +370,13 @@ eti_ref_at (AtkTable *table, gint row, gint column) (GWeakNotify) cell_destroyed, ret); /* if current cell is focused, add FOCUSED state */ - if (e_selection_model_cursor_row (item->selection) == GAL_A11Y_E_CELL (ret)->row && - e_selection_model_cursor_col (item->selection) == GAL_A11Y_E_CELL (ret)->model_col) - gal_a11y_e_cell_add_state (GAL_A11Y_E_CELL (ret), ATK_STATE_FOCUSED, FALSE); + if (e_selection_model_cursor_row (item->selection) == + GAL_A11Y_E_CELL (ret)->row && + e_selection_model_cursor_col (item->selection) == + GAL_A11Y_E_CELL (ret)->model_col) + gal_a11y_e_cell_add_state ( + GAL_A11Y_E_CELL (ret), + ATK_STATE_FOCUSED, FALSE); } else ret = NULL; @@ -565,7 +573,8 @@ table_is_row_selected (AtkTable *table, gint row) if (!item) return FALSE; - return e_selection_model_is_row_selected(item->selection, view_to_model_row (item, row)); + return e_selection_model_is_row_selected ( + item->selection, view_to_model_row (item, row)); } static gboolean @@ -697,8 +706,8 @@ eti_rows_inserted (ETableModel * model, gint row, gint count, g_signal_emit_by_name (table_item, "row-inserted", row, count, NULL); - for (i = row; i < (row + count); i ++) { - for (j = 0; j < n_cols; j ++) { + for (i = row; i < (row + count); i++) { + for (j = 0; j < n_cols; j++) { g_signal_emit_by_name (table_item, "children_changed::add", ( ((i + 1)*n_cols) + j), NULL, NULL); @@ -713,7 +722,9 @@ eti_rows_deleted (ETableModel * model, gint row, gint count, AtkObject * table_item) { gint i,j, n_rows, n_cols, old_nrows; - ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table_item))); + ETableItem *item = E_TABLE_ITEM ( + atk_gobject_accessible_get_object ( + ATK_GOBJECT_ACCESSIBLE (table_item))); n_rows = atk_table_get_n_rows (ATK_TABLE(table_item)); n_cols = atk_table_get_n_columns (ATK_TABLE(table_item)); @@ -727,8 +738,8 @@ eti_rows_deleted (ETableModel * model, gint row, gint count, g_signal_emit_by_name (table_item, "row-deleted", row, count, NULL); - for (i = row; i < (row + count); i ++) { - for (j = 0; j < n_cols; j ++) { + for (i = row; i < (row + count); i++) { + for (j = 0; j < n_cols; j++) { g_signal_emit_by_name (table_item, "children_changed::remove", ( ((i + 1)*n_cols) + j), NULL, NULL); @@ -797,8 +808,8 @@ eti_header_structure_changed (ETableHeader *eth, AtkObject *a11y) reorder = g_malloc0 (sizeof (gint) * n_cols); /* Compare with previously saved column headers. */ - for ( i = 0; i < n_cols && cols[i]; i ++ ) { - for ( j = 0; j < prev_n_cols && prev_cols[j]; j ++ ) { + for (i = 0; i < n_cols && cols[i]; i++) { + for (j = 0; j < prev_n_cols && prev_cols[j]; j++) { if (prev_cols [j] == cols[i] && i != j) { reorder_found = TRUE; @@ -820,8 +831,8 @@ eti_header_structure_changed (ETableHeader *eth, AtkObject *a11y) } /* Now try to find if there are removed columns. */ - for (i = 0; i < prev_n_cols && prev_cols[i]; i ++) { - for (j = 0; j < n_cols && cols[j]; j ++) + for (i = 0; i < prev_n_cols && prev_cols[i]; i++) { + for (j = 0; j < n_cols && cols[j]; j++) if (prev_cols [j] == cols[i]) break; @@ -843,19 +854,31 @@ eti_header_structure_changed (ETableHeader *eth, AtkObject *a11y) if (removed_found) { for (i = 0; i < prev_n_cols; i ++ ) { if (prev_state[i] == ETI_HEADER_REMOVED) { - g_signal_emit_by_name (G_OBJECT(a11y_item), "column-deleted", i, 1); - for (j = 0; j < n_rows; j ++) - g_signal_emit_by_name (G_OBJECT(a11y_item), "children_changed::remove", ((j+1)*prev_n_cols+i), NULL, NULL); + g_signal_emit_by_name ( + G_OBJECT(a11y_item), + "column-deleted", i, 1); + for (j = 0; j < n_rows; j++) + g_signal_emit_by_name ( + G_OBJECT(a11y_item), + "children_changed::remove", + ((j+1)*prev_n_cols+i), + NULL, NULL); } } } if (added_found) { - for ( i = 0; i < n_cols; i ++ ) { + for (i = 0; i < n_cols; i++) { if (state[i] == ETI_HEADER_NEW_ADDED) { - g_signal_emit_by_name (G_OBJECT(a11y_item), "column-inserted", i, 1); - for (j = 0; j < n_rows; j ++) - g_signal_emit_by_name (G_OBJECT(a11y_item), "children_changed::add", ((j+1)*n_cols+i), NULL, NULL); + g_signal_emit_by_name ( + G_OBJECT(a11y_item), + "column-inserted", i, 1); + for (j = 0; j < n_rows; j++) + g_signal_emit_by_name ( + G_OBJECT(a11y_item), + "children_changed::add", + ((j+1)*n_cols+i), + NULL, NULL); } } } @@ -899,16 +922,17 @@ eti_class_init (GalA11yETableItemClass *klass) AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass); - quark_accessible_object = g_quark_from_static_string ("gtk-accessible-object"); + quark_accessible_object = + g_quark_from_static_string ("gtk-accessible-object"); - parent_class = g_type_class_ref (PARENT_TYPE); + parent_class = g_type_class_ref (PARENT_TYPE); - object_class->dispose = eti_dispose; + object_class->dispose = eti_dispose; - atk_object_class->get_n_children = eti_get_n_children; - atk_object_class->ref_child = eti_ref_child; - atk_object_class->initialize = eti_real_initialize; - atk_object_class->ref_state_set = eti_ref_state_set; + atk_object_class->get_n_children = eti_get_n_children; + atk_object_class->ref_child = eti_ref_child; + atk_object_class->initialize = eti_real_initialize; + atk_object_class->ref_state_set = eti_ref_state_set; } static void @@ -925,15 +949,16 @@ eti_init (GalA11yETableItem *a11y) /* atk selection */ -static void atk_selection_interface_init (AtkSelectionIface *iface); -static gboolean selection_add_selection (AtkSelection *selection, - gint i); -static gboolean selection_clear_selection (AtkSelection *selection); -static AtkObject* selection_ref_selection (AtkSelection *selection, - gint i); -static gint selection_get_selection_count (AtkSelection *selection); -static gboolean selection_is_child_selected (AtkSelection *selection, - gint i); +static void atk_selection_interface_init (AtkSelectionIface *iface); +static gboolean selection_add_selection (AtkSelection *selection, + gint i); +static gboolean selection_clear_selection (AtkSelection *selection); +static AtkObject * + selection_ref_selection (AtkSelection *selection, + gint i); +static gint selection_get_selection_count (AtkSelection *selection); +static gboolean selection_is_child_selected (AtkSelection *selection, + gint i); /* callbacks */ static void eti_a11y_selection_model_removed_cb (ETableItem *eti, @@ -995,11 +1020,13 @@ gal_a11y_e_table_item_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, "GalA11yETableItem", &info, 0, - sizeof (GalA11yETableItemPrivate), &priv_offset); + type = gal_a11y_type_register_static_with_private ( + PARENT_TYPE, "GalA11yETableItem", &info, 0, + sizeof (GalA11yETableItemPrivate), &priv_offset); g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info); g_type_add_interface_static (type, ATK_TYPE_TABLE, &atk_table_info); @@ -1051,7 +1078,8 @@ gal_a11y_e_table_item_new (ETableItem *item) item->selection); /* find the TableItem's parent: table or tree */ - GET_PRIVATE (a11y)->widget = gtk_widget_get_parent (GTK_WIDGET (item->parent.canvas)); + GET_PRIVATE (a11y)->widget = gtk_widget_get_parent ( + GTK_WIDGET (item->parent.canvas)); parent = gtk_widget_get_accessible (GET_PRIVATE (a11y)->widget); name = atk_object_get_name (parent); if (name) diff --git a/widgets/text/e-reflow.c b/widgets/text/e-reflow.c index b35856808c..ddbbf5a987 100644 --- a/widgets/text/e-reflow.c +++ b/widgets/text/e-reflow.c @@ -259,7 +259,7 @@ incarnate (EReflow *reflow) last_column = value + page_size + 1 - E_REFLOW_BORDER_WIDTH - E_REFLOW_DIVIDER_WIDTH; last_column /= column_width + E_REFLOW_FULL_GUTTER; - last_column ++; + last_column++; if (first_column >= 0 && first_column < reflow->column_count) first_cell = reflow->columns[first_column]; @@ -335,7 +335,7 @@ reflow_columns (EReflow *reflow) gint unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i); if (i != 0 && running_height + reflow->heights[unsorted] + E_REFLOW_BORDER_WIDTH > reflow->height) { list = g_slist_prepend (list, GINT_TO_POINTER(i)); - column_count ++; + column_count++; running_height = E_REFLOW_BORDER_WIDTH * 2 + reflow->heights[unsorted]; } else running_height += reflow->heights[unsorted] + E_REFLOW_BORDER_WIDTH; @@ -343,7 +343,7 @@ reflow_columns (EReflow *reflow) reflow->column_count = column_count; reflow->columns = g_renew (int, reflow->columns, column_count); - column_count --; + column_count--; for (; column_count > column_start; column_count--) { GSList *to_free; @@ -403,7 +403,7 @@ item_removed (EReflowModel *model, gint i, EReflow *reflow) memmove (reflow->heights + i, reflow->heights + i + 1, (reflow->count - i - 1) * sizeof (gint)); memmove (reflow->items + i, reflow->items + i + 1, (reflow->count - i - 1) * sizeof (GnomeCanvasItem *)); - reflow->count --; + reflow->count--; reflow->heights [reflow->count] = 0; reflow->items [reflow->count] = NULL; @@ -448,7 +448,7 @@ items_inserted (EReflowModel *model, gint position, gint count, EReflow *reflow) else e_sorter_array_set_count (reflow->sorter, reflow->count); - for (i = position; i < position + count; i ++) { + for (i = position; i < position + count; i++) { gint sorted = e_sorter_model_to_sorted (E_SORTER (reflow->sorter), i); gint c; @@ -1401,7 +1401,7 @@ e_reflow_reflow( GnomeCanvasItem *item, gint flags ) if (next_column < reflow->column_count && i == reflow->columns[next_column]) { running_height = E_REFLOW_BORDER_WIDTH; running_width += reflow->column_width + E_REFLOW_FULL_GUTTER; - next_column ++; + next_column++; } if (unsorted >= 0 && reflow->items[unsorted]) { diff --git a/widgets/text/e-text-model.c b/widgets/text/e-text-model.c index 5f3b88d366..b65ee7e6cc 100644 --- a/widgets/text/e-text-model.c +++ b/widgets/text/e-text-model.c @@ -248,7 +248,7 @@ e_text_model_real_insert_length (ETextModel *model, for (p = text, l = 0; l < length; - p = g_utf8_next_char (p), l ++); + p = g_utf8_next_char (p), l++); byte_length = p - text; @@ -278,7 +278,7 @@ e_text_model_real_delete (ETextModel *model, gint position, gint length) for (p = offs, l = 0; l < length; - p = g_utf8_next_char (p), l ++); + p = g_utf8_next_char (p), l++); byte_length = p - offs; diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index bb55b87f4c..0383b00597 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -112,10 +112,16 @@ enum { PROP_HANDLE_POPUP }; -static void e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data); +static void e_text_command (ETextEventProcessor *tep, + ETextEventProcessorCommand *command, + gpointer data); -static void e_text_text_model_changed(ETextModel *model, EText *text); -static void e_text_text_model_reposition (ETextModel *model, ETextModelReposFn fn, gpointer repos_data, gpointer data); +static void e_text_text_model_changed (ETextModel *model, + EText *text); +static void e_text_text_model_reposition (ETextModel *model, + ETextModelReposFn fn, + gpointer repos_data, + gpointer data); static void _get_tep(EText *text); @@ -395,7 +401,9 @@ create_layout (EText *text) text->layout = gtk_widget_create_pango_layout (GTK_WIDGET (item->canvas), text->text); if (text->line_wrap) - pango_layout_set_width (text->layout, text->clip_width < 0 ? -1 : text->clip_width * PANGO_SCALE); + pango_layout_set_width ( + text->layout, text->clip_width < 0 + ? -1 : text->clip_width * PANGO_SCALE); reset_layout_attrs (text); } @@ -440,7 +448,9 @@ reset_layout (EText *text) PangoRectangle strong_pos, weak_pos; gchar *offs = g_utf8_offset_to_pointer (text->text, text->selection_start); - pango_layout_get_cursor_pos (text->layout, offs - text->text, &strong_pos, &weak_pos); + pango_layout_get_cursor_pos ( + text->layout, offs - text->text, + &strong_pos, &weak_pos); if (strong_pos.x != weak_pos.x || strong_pos.y != weak_pos.y || @@ -472,7 +482,10 @@ e_text_text_model_changed (ETextModel *model, EText *text) } static void -e_text_text_model_reposition (ETextModel *model, ETextModelReposFn fn, gpointer repos_data, gpointer user_data) +e_text_text_model_reposition (ETextModel *model, + ETextModelReposFn fn, + gpointer repos_data, + gpointer user_data) { EText *text = E_TEXT (user_data); gint model_len = e_text_model_get_text_length (model); @@ -620,8 +633,9 @@ calc_ellipsis (EText *text) { /* FIXME: a pango layout per calc_ellipsis sucks */ gint width; - PangoLayout *layout = gtk_widget_create_pango_layout (GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas), - text->ellipsis ? text->ellipsis : "..."); + PangoLayout *layout = gtk_widget_create_pango_layout ( + GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas), + text->ellipsis ? text->ellipsis : "..."); pango_layout_get_size (layout, &width, NULL); text->ellipsis_width = width; @@ -781,7 +795,9 @@ e_text_set_property (GObject *object, calc_ellipsis (text); if (text->line_wrap) { if (text->layout) - pango_layout_set_width (text->layout, text->clip_width < 0 ? -1 : text->clip_width * PANGO_SCALE); + pango_layout_set_width ( + text->layout, text->clip_width < 0 + ? -1 : text->clip_width * PANGO_SCALE); text->needs_split_into_lines = 1; } else { text->needs_calc_height = 1; @@ -890,7 +906,9 @@ e_text_set_property (GObject *object, text->line_wrap = g_value_get_boolean (value); if (text->line_wrap) { if (text->layout) { - pango_layout_set_width (text->layout, text->width < 0 ? -1 : text->width * PANGO_SCALE); + pango_layout_set_width ( + text->layout, text->width < 0 + ? -1 : text->width * PANGO_SCALE); } } text->needs_split_into_lines = 1; @@ -919,7 +937,9 @@ e_text_set_property (GObject *object, calc_ellipsis (text); if (text->line_wrap) { if (text->layout) { - pango_layout_set_width (text->layout, text->width < 0 ? -1 : text->width * PANGO_SCALE); + pango_layout_set_width ( + text->layout, text->width < 0 ? + -1 : text->width * PANGO_SCALE); } text->needs_split_into_lines = 1; } @@ -992,7 +1012,8 @@ e_text_set_property (GObject *object, } if (color_changed) { - GdkColormap *colormap = gtk_widget_get_colormap (GTK_WIDGET (item->canvas)); + GdkColormap *colormap = gtk_widget_get_colormap ( + GTK_WIDGET (item->canvas)); text->color = color; gdk_rgb_find_color (colormap, &text->color); @@ -1124,7 +1145,11 @@ e_text_get_property (GObject *object, break; case PROP_HEIGHT: - g_value_set_double (value, text->clip && text->clip_height != -1 ? text->clip_height : text->height / text->item.canvas->pixels_per_unit); + g_value_set_double ( + value, text->clip && + text->clip_height != -1 ? + text->clip_height : text->height / + text->item.canvas->pixels_per_unit); break; case PROP_DRAW_BORDERS: @@ -1200,7 +1225,8 @@ e_text_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint f text = E_TEXT (item); if (GNOME_CANVAS_ITEM_CLASS (e_text_parent_class)->update) - (* GNOME_CANVAS_ITEM_CLASS (e_text_parent_class)->update) (item, affine, clip_path, flags); + GNOME_CANVAS_ITEM_CLASS (e_text_parent_class)->update ( + item, affine, clip_path, flags); if ( text->needs_recalc_bounds || (flags & GNOME_CANVAS_UPDATE_AFFINE)) { @@ -1292,7 +1318,11 @@ _get_tep(EText *text) } static void -draw_pango_rectangle (GdkDrawable *drawable, GdkGC *gc, gint x1, gint y1, PangoRectangle rect) +draw_pango_rectangle (GdkDrawable *drawable, + GdkGC *gc, + gint x1, + gint y1, + PangoRectangle rect) { gint width = rect.width / PANGO_SCALE; gint height = rect.height / PANGO_SCALE; @@ -1661,7 +1691,10 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, PangoRectangle strong_pos, weak_pos; gchar *offs = g_utf8_offset_to_pointer (text->text, text->selection_start); - pango_layout_get_cursor_pos (text->layout, offs - text->text + text->preedit_len, &strong_pos, &weak_pos); + pango_layout_get_cursor_pos ( + text->layout, offs - text->text + + text->preedit_len, &strong_pos, + &weak_pos); draw_pango_rectangle (drawable, main_gc, xpos, ypos, strong_pos); if (strong_pos.x != weak_pos.x || strong_pos.y != weak_pos.y || @@ -1729,7 +1762,11 @@ e_text_point (GnomeCanvasItem *item, gdouble x, gdouble y, /* Bounds handler for the text item */ static void -e_text_bounds (GnomeCanvasItem *item, gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2) +e_text_bounds (GnomeCanvasItem *item, + gdouble *x1, + gdouble *y1, + gdouble *x2, + gdouble *y2) { EText *text; gdouble width, height; @@ -1816,7 +1853,9 @@ get_position_from_xy (EText *text, gint x, gint y) x -= text->cx; y -= text->cy; - pango_layout_xy_to_index (text->layout, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); + pango_layout_xy_to_index ( + text->layout, x * PANGO_SCALE, + y * PANGO_SCALE, &index, &trailing); return g_utf8_pointer_to_offset (text->text, text->text + index + trailing); } @@ -2012,11 +2051,12 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) */ if (save_text && save_text->im_context) { - g_signal_handlers_disconnect_matched (save_text->im_context, - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, - NULL, save_text); - save_text->im_context_signals_registered = FALSE; + g_signal_handlers_disconnect_matched ( + save_text->im_context, + G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, save_text); + save_text->im_context_signals_registered = + FALSE; } if (text->im_context) { @@ -2091,7 +2131,9 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) GdkEventKey key; gint ret; - if (text->im_context && gtk_im_context_filter_keypress (text->im_context, (GdkEventKey*)event)) { + if (text->im_context && + gtk_im_context_filter_keypress ( + text->im_context, (GdkEventKey*)event)) { text->need_im_reset = TRUE; return 1; } @@ -2106,7 +2148,9 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) e_tep_event.key.length = key.length; e_tep_event.key.string = key.string; #else - e_tep_event.key.string = e_utf8_from_gtk_event_key (GTK_WIDGET (item->canvas), key.keyval, key.string); + e_tep_event.key.string = e_utf8_from_gtk_event_key ( + GTK_WIDGET (item->canvas), + key.keyval, key.string); if (e_tep_event.key.string != NULL) { e_tep_event.key.length = strlen (e_tep_event.key.string); } else { @@ -2260,14 +2304,17 @@ e_text_copy_clipboard (EText *text) selection_end_pos = MAX (text->selection_start, text->selection_end); /* convert sel_start/sel_end to byte indices */ - selection_start_pos = g_utf8_offset_to_pointer (text->text, selection_start_pos) - text->text; - selection_end_pos = g_utf8_offset_to_pointer (text->text, selection_end_pos) - text->text; + selection_start_pos = g_utf8_offset_to_pointer ( + text->text, selection_start_pos) - text->text; + selection_end_pos = g_utf8_offset_to_pointer ( + text->text, selection_end_pos) - text->text; gtk_clipboard_set_text ( - gtk_widget_get_clipboard (GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas), - GDK_SELECTION_CLIPBOARD), - text->text + selection_start_pos, - selection_end_pos - selection_start_pos); + gtk_widget_get_clipboard ( + GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas), + GDK_SELECTION_CLIPBOARD), + text->text + selection_start_pos, + selection_end_pos - selection_start_pos); } void @@ -2342,7 +2389,8 @@ primary_clear_cb (GtkClipboard *clipboard, { #ifdef notyet /* XXX */ - gtk_editable_select_region (GTK_EDITABLE (entry), entry->current_pos, entry->current_pos); + gtk_editable_select_region ( + GTK_EDITABLE (entry), entry->current_pos, entry->current_pos); #endif } @@ -2358,7 +2406,9 @@ e_text_update_primary_selection (EText *text) }; GtkClipboard *clipboard; - clipboard = gtk_widget_get_clipboard (GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas), GDK_SELECTION_PRIMARY); + clipboard = gtk_widget_get_clipboard ( + GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas), + GDK_SELECTION_PRIMARY); if (text->selection_start != text->selection_end) { if (!gtk_clipboard_set_with_owner (clipboard, targets, G_N_ELEMENTS (targets), @@ -2412,7 +2462,11 @@ popup_menu_detach (GtkWidget *attach_widget, } static void -popup_menu_placement_cb (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data) +popup_menu_placement_cb (GtkMenu *menu, + gint *x, + gint *y, + gboolean *push_in, + gpointer user_data) { EText *text = E_TEXT(user_data); GnomeCanvasItem *item = &text->item; @@ -2454,7 +2508,9 @@ popup_targets_received (GtkClipboard *clipboard, gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menuitem); g_signal_connect_swapped (menuitem, "activate", G_CALLBACK (e_text_cut_clipboard), text); - gtk_widget_set_sensitive (menuitem, text->editable && (text->selection_start != text->selection_end)); + gtk_widget_set_sensitive ( + menuitem, text->editable && + (text->selection_start != text->selection_end)); /* copy menu item */ menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_COPY, NULL); @@ -2470,7 +2526,9 @@ popup_targets_received (GtkClipboard *clipboard, gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menuitem); g_signal_connect_swapped (menuitem, "activate", G_CALLBACK (e_text_paste_clipboard), text); - gtk_widget_set_sensitive (menuitem, text->editable && gtk_selection_data_targets_include_text (data)); + gtk_widget_set_sensitive ( + menuitem, text->editable && + gtk_selection_data_targets_include_text (data)); menuitem = gtk_menu_item_new_with_label (_("Select All")); gtk_widget_show (menuitem); @@ -2608,7 +2666,8 @@ find_offset_into_line (EText *text, gint offset_into_text, gchar **start_of_line } /* direction = TRUE (move forward), FALSE (move backward) - Any error shall return length(text->text) or 0 or text->selection_end (as deemed fit) */ + Any error shall return length(text->text) or 0 or + text->selection_end (as deemed fit) */ static gint _get_updated_position (EText *text, gboolean direction) { @@ -2634,7 +2693,8 @@ _get_updated_position (EText *text, gboolean direction) if (!g_utf8_validate(text->text, -1, NULL)) return text->selection_end; - /* get layout's PangoLogAttr to facilitate moving when moving across grapheme cluster as in indic langs */ + /* get layout's PangoLogAttr to facilitate moving when + * moving across grapheme cluster as in indic langs */ pango_layout_get_log_attrs (text->layout, &log_attrs, &n_attrs); /* Fetch the current gchar index in the line & keep moving @@ -2748,14 +2808,16 @@ _get_position(EText *text, ETextEventProcessorCommand *command) if (text->selection_end >= length) new_pos = length; else - new_pos = _get_updated_position(text, TRUE); /* get updated position to display cursor */ + /* get updated position to display cursor */ + new_pos = _get_updated_position(text, TRUE); break; case E_TEP_BACKWARD_CHARACTER: new_pos = 0; if (text->selection_end >= 1) - new_pos = _get_updated_position(text, FALSE); /* get updated position to display cursor */ + /* get updated position to display cursor */ + new_pos = _get_updated_position (text, FALSE); break; @@ -2768,12 +2830,14 @@ _get_position(EText *text, ETextEventProcessorCommand *command) if (text->selection_end >= 1) { gint pos = text->selection_end; - p = g_utf8_find_prev_char (text->text, g_utf8_offset_to_pointer (text->text, text->selection_end)); - pos --; + p = g_utf8_find_prev_char ( + text->text, g_utf8_offset_to_pointer ( + text->text, text->selection_end)); + pos--; if (p != text->text) { p = g_utf8_find_prev_char (text->text, p); - pos --; + pos--; while (p && p > text->text) { unival = g_utf8_get_char (p); @@ -2783,7 +2847,7 @@ _get_position(EText *text, ETextEventProcessorCommand *command) } else { p = g_utf8_find_prev_char (text->text, p); - pos --; + pos--; } } } @@ -2813,7 +2877,7 @@ _get_position(EText *text, ETextEventProcessorCommand *command) p = g_utf8_next_char (p); while (offset_into_line > 0 && p && *p != '\n' && *p != '\0') { p = g_utf8_next_char (p); - offset_into_line --; + offset_into_line--; } } @@ -2837,7 +2901,7 @@ _get_position(EText *text, ETextEventProcessorCommand *command) p = g_utf8_find_prev_char (text->text, p); while (p > text->text) { if (*p == '\n') { - p ++; + p++; break; } p = g_utf8_find_prev_char (text->text, p); @@ -2851,7 +2915,7 @@ _get_position(EText *text, ETextEventProcessorCommand *command) while (offset_into_line > 0 && p && *p != '\n' && *p != '\0') { p = g_utf8_next_char (p); - offset_into_line --; + offset_into_line--; } /* at this point, p points to the new location, @@ -2894,7 +2958,9 @@ _get_position(EText *text, ETextEventProcessorCommand *command) else text->selection_start = g_utf8_pointer_to_offset (text->text, p); - text->selection_start = e_text_model_validate_position (text->model, text->selection_start); + text->selection_start = + e_text_model_validate_position ( + text->model, text->selection_start); length = g_utf8_strlen (text->text, -1); if (text->selection_end >= length) { @@ -3024,7 +3090,9 @@ capitalize (EText *text, gint start, gint end, ETextEventProcessorCaps type) } static void -e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data) +e_text_command (ETextEventProcessor *tep, + ETextEventProcessorCommand *command, + gpointer data) { EText *text = E_TEXT(data); gboolean scroll = TRUE; @@ -3041,7 +3109,9 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp use_start = TRUE; break; case E_TEP_SELECT: - text->selection_start = e_text_model_validate_position (text->model, text->selection_start); /* paranoia */ + text->selection_start = + e_text_model_validate_position ( + text->model, text->selection_start); /* paranoia */ text->selection_end = _get_position(text, command); e_text_update_primary_selection (text); @@ -3117,11 +3187,18 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp break; case E_TEP_CAPS: if (text->selection_start == text->selection_end) { - capitalize (text, text->selection_start, next_word (text, text->selection_start), command->value); + capitalize ( + text, text->selection_start, + next_word (text, text->selection_start), + command->value); } else { - gint selection_start = MIN (text->selection_start, text->selection_end); - gint selection_end = MAX (text->selection_start, text->selection_end); - capitalize (text, selection_start, selection_end, command->value); + gint selection_start = MIN ( + text->selection_start, text->selection_end); + gint selection_end = MAX ( + text->selection_start, text->selection_end); + capitalize ( + text, selection_start, + selection_end, command->value); } break; case E_TEP_NOP: @@ -3149,12 +3226,14 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp selection_index = use_start ? text->selection_start : text->selection_end; /* convert to a byte index */ - selection_index = g_utf8_offset_to_pointer (text->text, selection_index) - text->text; + selection_index = g_utf8_offset_to_pointer ( + text->text, selection_index) - text->text; do { PangoLayoutLine *line = pango_layout_iter_get_line (iter); - if (selection_index >= line->start_index && selection_index <= line->start_index + line->length) { + if (selection_index >= line->start_index && + selection_index <= line->start_index + line->length) { /* found the line with the start of the selection */ cur_line = line; break; @@ -3168,7 +3247,8 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp /* gboolean trailing = FALSE; */ PangoRectangle pango_pos; - if (selection_index > 0 && selection_index == cur_line->start_index + cur_line->length) { + if (selection_index > 0 && selection_index == + cur_line->start_index + cur_line->length) { selection_index--; /* trailing = TRUE; */ } @@ -3612,7 +3692,6 @@ e_text_init (EText *text) text->allow_newlines = TRUE; text->last_type_request = -1; - d(g_print ("Setting last_type_request to %d at line %d\n", text->last_type_request, __LINE__)); text->last_time_request = 0; text->queued_requests = NULL; @@ -3651,7 +3730,8 @@ e_text_preedit_changed_cb (GtkIMContext *context, cursor_pos = CLAMP (cursor_pos, 0, g_utf8_strlen (preedit_string, -1)); etext->preedit_len = strlen (preedit_string); - etext->preedit_pos = g_utf8_offset_to_pointer (preedit_string, cursor_pos) - preedit_string; + etext->preedit_pos = g_utf8_offset_to_pointer ( + preedit_string, cursor_pos) - preedit_string; g_free (preedit_string); g_signal_emit (etext, e_text_signals[E_TEXT_KEYPRESS], 0, 0, 0); @@ -3661,10 +3741,10 @@ static gboolean e_text_retrieve_surrounding_cb (GtkIMContext *context, EText *text) { - gtk_im_context_set_surrounding (context, - text->text, - strlen (text->text), - g_utf8_offset_to_pointer (text->text, MIN (text->selection_start, text->selection_end)) - text->text); + gtk_im_context_set_surrounding ( + context, text->text, strlen (text->text), + g_utf8_offset_to_pointer (text->text, MIN ( + text->selection_start, text->selection_end)) - text->text); return TRUE; } |