From 2c4ae5e7685c462f8d464448e4617b8dea029e72 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 9 Nov 2012 22:40:00 -0500 Subject: Coding style and whitespace cleanup. --- widgets/text/e-reflow.c | 378 ++++++++++++---------- widgets/text/e-text-model.c | 87 ++--- widgets/text/e-text.c | 709 ++++++++++++++++++++++++----------------- widgets/text/gal-a11y-e-text.c | 27 +- 4 files changed, 684 insertions(+), 517 deletions(-) (limited to 'widgets/text') diff --git a/widgets/text/e-reflow.c b/widgets/text/e-reflow.c index edfaadc157..1c3b0da4fe 100644 --- a/widgets/text/e-reflow.c +++ b/widgets/text/e-reflow.c @@ -126,9 +126,10 @@ e_reflow_resize_children (GnomeCanvasItem *item) count = reflow->count; for (i = 0; i < count; i++) { if (reflow->items[i]) - gnome_canvas_item_set (reflow->items[i], - "width", (gdouble) reflow->column_width, - NULL); + gnome_canvas_item_set ( + reflow->items[i], + "width", (gdouble) reflow->column_width, + NULL); } } @@ -137,15 +138,17 @@ e_reflow_update_selection_row (EReflow *reflow, gint row) { if (reflow->items[row]) { - g_object_set (reflow->items[row], - "selected", e_selection_model_is_row_selected (E_SELECTION_MODEL (reflow->selection), row), - NULL); + g_object_set ( + reflow->items[row], + "selected", e_selection_model_is_row_selected (E_SELECTION_MODEL (reflow->selection), row), + NULL); } else if (e_selection_model_is_row_selected (E_SELECTION_MODEL (reflow->selection), row)) { reflow->items[row] = e_reflow_model_incarnate (reflow->model, row, GNOME_CANVAS_GROUP (reflow)); - g_object_set (reflow->items[row], - "selected", e_selection_model_is_row_selected (E_SELECTION_MODEL (reflow->selection), row), - "width", (gdouble) reflow->column_width, - NULL); + g_object_set ( + reflow->items[row], + "selected", e_selection_model_is_row_selected (E_SELECTION_MODEL (reflow->selection), row), + "width", (gdouble) reflow->column_width, + NULL); } } @@ -226,9 +229,10 @@ cursor_changed (ESelectionModel *selection, if (old_cursor < count && old_cursor >= 0) { if (reflow->items[old_cursor]) { - g_object_set (reflow->items[old_cursor], - "has_cursor", FALSE, - NULL); + g_object_set ( + reflow->items[old_cursor], + "has_cursor", FALSE, + NULL); } } @@ -236,15 +240,17 @@ cursor_changed (ESelectionModel *selection, if (row < count && row >= 0) { if (reflow->items[row]) { - g_object_set (reflow->items[row], - "has_cursor", TRUE, - NULL); + g_object_set ( + reflow->items[row], + "has_cursor", TRUE, + NULL); } else { reflow->items[row] = e_reflow_model_incarnate (reflow->model, row, GNOME_CANVAS_GROUP (reflow)); - g_object_set (reflow->items[row], - "has_cursor", TRUE, - "width", (gdouble) reflow->column_width, - NULL); + g_object_set ( + reflow->items[row], + "has_cursor", TRUE, + "width", (gdouble) reflow->column_width, + NULL); } } @@ -297,10 +303,11 @@ incarnate (EReflow *reflow) if (reflow->items[unsorted] == NULL) { if (reflow->model) { reflow->items[unsorted] = e_reflow_model_incarnate (reflow->model, unsorted, GNOME_CANVAS_GROUP (reflow)); - g_object_set (reflow->items[unsorted], - "selected", e_selection_model_is_row_selected (E_SELECTION_MODEL (reflow->selection), unsorted), - "width", (gdouble) reflow->column_width, - NULL); + g_object_set ( + reflow->items[unsorted], + "selected", e_selection_model_is_row_selected (E_SELECTION_MODEL (reflow->selection), unsorted), + "width", (gdouble) reflow->column_width, + NULL); } } } @@ -552,31 +559,34 @@ set_empty (EReflow *reflow) if (reflow->count == 0) { if (reflow->empty_text) { if (reflow->empty_message) { - gnome_canvas_item_set (reflow->empty_text, - "width", reflow->minimum_width, - "text", reflow->empty_message, - NULL); - e_canvas_item_move_absolute (reflow->empty_text, - reflow->minimum_width / 2, - 0); + gnome_canvas_item_set ( + reflow->empty_text, + "width", reflow->minimum_width, + "text", reflow->empty_message, + NULL); + e_canvas_item_move_absolute ( + reflow->empty_text, + reflow->minimum_width / 2, + 0); } else { g_object_run_dispose (G_OBJECT (reflow->empty_text)); reflow->empty_text = NULL; } } else { if (reflow->empty_message) { - reflow->empty_text = - gnome_canvas_item_new (GNOME_CANVAS_GROUP (reflow), - e_text_get_type (), - "width", reflow->minimum_width, - "clip", TRUE, - "use_ellipsis", TRUE, - "justification", GTK_JUSTIFY_CENTER, - "text", reflow->empty_message, - NULL); - e_canvas_item_move_absolute (reflow->empty_text, - reflow->minimum_width / 2, - 0); + reflow->empty_text = gnome_canvas_item_new ( + GNOME_CANVAS_GROUP (reflow), + e_text_get_type (), + "width", reflow->minimum_width, + "clip", TRUE, + "use_ellipsis", TRUE, + "justification", GTK_JUSTIFY_CENTER, + "text", reflow->empty_message, + NULL); + e_canvas_item_move_absolute ( + reflow->empty_text, + reflow->minimum_width / 2, + 0); } } } else { @@ -593,16 +603,21 @@ disconnect_model (EReflow *reflow) if (reflow->model == NULL) return; - g_signal_handler_disconnect (reflow->model, - reflow->model_changed_id); - g_signal_handler_disconnect (reflow->model, - reflow->comparison_changed_id); - g_signal_handler_disconnect (reflow->model, - reflow->model_items_inserted_id); - g_signal_handler_disconnect (reflow->model, - reflow->model_item_removed_id); - g_signal_handler_disconnect (reflow->model, - reflow->model_item_changed_id); + g_signal_handler_disconnect ( + reflow->model, + reflow->model_changed_id); + g_signal_handler_disconnect ( + reflow->model, + reflow->comparison_changed_id); + g_signal_handler_disconnect ( + reflow->model, + reflow->model_items_inserted_id); + g_signal_handler_disconnect ( + reflow->model, + reflow->model_item_removed_id); + g_signal_handler_disconnect ( + reflow->model, + reflow->model_item_changed_id); g_object_unref (reflow->model); reflow->model_changed_id = 0; @@ -619,12 +634,15 @@ disconnect_selection (EReflow *reflow) if (reflow->selection == NULL) return; - g_signal_handler_disconnect (reflow->selection, - reflow->selection_changed_id); - g_signal_handler_disconnect (reflow->selection, - reflow->selection_row_changed_id); - g_signal_handler_disconnect (reflow->selection, - reflow->cursor_changed_id); + g_signal_handler_disconnect ( + reflow->selection, + reflow->selection_changed_id); + g_signal_handler_disconnect ( + reflow->selection, + reflow->selection_row_changed_id); + g_signal_handler_disconnect ( + reflow->selection, + reflow->cursor_changed_id); g_object_unref (reflow->selection); reflow->selection_changed_id = 0; @@ -681,10 +699,12 @@ disconnect_adjustment (EReflow *reflow) if (reflow->adjustment == NULL) return; - g_signal_handler_disconnect (reflow->adjustment, - reflow->adjustment_changed_id); - g_signal_handler_disconnect (reflow->adjustment, - reflow->adjustment_value_changed_id); + g_signal_handler_disconnect ( + reflow->adjustment, + reflow->adjustment_changed_id); + g_signal_handler_disconnect ( + reflow->adjustment, + reflow->adjustment_value_changed_id); g_object_unref (reflow->adjustment); @@ -737,8 +757,9 @@ static void disconnect_set_adjustment (EReflow *reflow) { if (reflow->set_scroll_adjustments_id != 0) { - g_signal_handler_disconnect (GNOME_CANVAS_ITEM (reflow)->canvas, - reflow->set_scroll_adjustments_id); + g_signal_handler_disconnect ( + GNOME_CANVAS_ITEM (reflow)->canvas, + reflow->set_scroll_adjustments_id); reflow->set_scroll_adjustments_id = 0; } } @@ -909,9 +930,10 @@ e_reflow_realize (GnomeCanvasItem *item) count = reflow->count; for (i = 0; i < count; i++) { if (reflow->items[i]) - gnome_canvas_item_set (reflow->items[i], - "width", reflow->column_width, - NULL); + gnome_canvas_item_set ( + reflow->items[i], + "width", reflow->column_width, + NULL); } set_empty (reflow); @@ -981,9 +1003,10 @@ e_reflow_event (GnomeCanvasItem *item, GnomeCanvasItem *item = reflow->items[unsorted]; EFocus has_focus; if (item) { - g_object_get (item, - "has_focus", &has_focus, - NULL); + g_object_get ( + item, + "has_focus", &has_focus, + NULL); if (has_focus) { if (event->key.state & GDK_SHIFT_MASK) { if (i == 0) @@ -1001,9 +1024,10 @@ e_reflow_event (GnomeCanvasItem *item, } item = reflow->items[unsorted]; - gnome_canvas_item_set (item, - "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START, - NULL); + gnome_canvas_item_set ( + item, + "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START, + NULL); return TRUE; } } @@ -1030,10 +1054,11 @@ e_reflow_event (GnomeCanvasItem *item, reflow->temp_column_width = reflow->column_width; reflow->column_drag = TRUE; - gnome_canvas_item_grab (item, - GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, - reflow->arrow_cursor, - button->time); + gnome_canvas_item_grab ( + item, + GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, + reflow->arrow_cursor, + button->time); reflow->previous_temp_column_width = -1; reflow->need_column_resize = TRUE; @@ -1193,7 +1218,7 @@ e_reflow_event (GnomeCanvasItem *item, window = gtk_widget_get_window (GTK_WIDGET (item->canvas)); - if (!( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER )) { + if (!(crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER)) { if (!reflow->default_cursor_shown) { gdk_window_set_cursor (window, reflow->default_cursor); reflow->default_cursor_shown = TRUE; @@ -1206,8 +1231,8 @@ e_reflow_event (GnomeCanvasItem *item, } if (return_val) return return_val; - else if (GNOME_CANVAS_ITEM_CLASS ( e_reflow_parent_class )->event) - return (* GNOME_CANVAS_ITEM_CLASS ( e_reflow_parent_class )->event) (item, event); + else if (GNOME_CANVAS_ITEM_CLASS (e_reflow_parent_class)->event) + return (* GNOME_CANVAS_ITEM_CLASS (e_reflow_parent_class)->event) (item, event); else return FALSE; } @@ -1246,16 +1271,17 @@ e_reflow_draw (GnomeCanvasItem *item, if (running_width > x + width) break; x_rect = running_width; - gtk_paint_flat_box (style, - cr, - GTK_STATE_ACTIVE, - GTK_SHADOW_NONE, - GTK_WIDGET (item->canvas), - "reflow", - x_rect - x, - y_rect - y, - width_rect, - height_rect); + gtk_paint_flat_box ( + style, + cr, + GTK_STATE_ACTIVE, + GTK_SHADOW_NONE, + GTK_WIDGET (item->canvas), + "reflow", + x_rect - x, + y_rect - y, + width_rect, + height_rect); running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; } if (reflow->column_drag) { @@ -1290,11 +1316,12 @@ e_reflow_draw (GnomeCanvasItem *item, if (running_width > x + width) break; x_rect = running_width; - cairo_rectangle (cr, - x_rect - x, - y_rect - y, - width_rect - 1, - height_rect - 1); + cairo_rectangle ( + cr, + x_rect - x, + y_rect - y, + width_rect - 1, + height_rect - 1); cairo_fill (cr); running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; } @@ -1366,7 +1393,7 @@ e_reflow_update (GnomeCanvasItem *item, width_rect = E_REFLOW_DIVIDER_WIDTH; height_rect = reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - for ( i = 0; i < reflow->column_count; i++) { + for (i = 0; i < reflow->column_count; i++) { x_rect = running_width; gnome_canvas_request_redraw (item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect); running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; @@ -1382,7 +1409,7 @@ e_reflow_update (GnomeCanvasItem *item, width_rect = E_REFLOW_DIVIDER_WIDTH; height_rect = reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - for ( i = 0; i < reflow->column_count; i++) { + for (i = 0; i < reflow->column_count; i++) { x_rect = running_width; gnome_canvas_request_redraw (item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect); running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; @@ -1456,9 +1483,10 @@ e_reflow_reflow (GnomeCanvasItem *item, } if (unsorted >= 0 && reflow->items[unsorted]) { - e_canvas_item_move_absolute (GNOME_CANVAS_ITEM (reflow->items[unsorted]), - (gdouble) running_width, - (gdouble) running_height); + e_canvas_item_move_absolute ( + GNOME_CANVAS_ITEM (reflow->items[unsorted]), + (gdouble) running_width, + (gdouble) running_height); running_height += reflow->heights[unsorted] + E_REFLOW_BORDER_WIDTH; } } @@ -1545,67 +1573,86 @@ e_reflow_class_init (EReflowClass *class) class->selection_event = e_reflow_selection_event_real; class->column_width_changed = NULL; - g_object_class_install_property (object_class, PROP_MINIMUM_WIDTH, - g_param_spec_double ("minimum_width", - "Minimum width", - "Minimum Width", - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_WIDTH, - g_param_spec_double ("width", - "Width", - "Width", - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READABLE)); - - g_object_class_install_property (object_class, PROP_HEIGHT, - g_param_spec_double ("height", - "Height", - "Height", - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EMPTY_MESSAGE, - g_param_spec_string ("empty_message", - "Empty message", - "Empty message", - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_MODEL, - g_param_spec_object ("model", - "Reflow model", - "Reflow model", - E_TYPE_REFLOW_MODEL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_COLUMN_WIDTH, - g_param_spec_double ("column_width", - "Column width", - "Column width", - 0.0, G_MAXDOUBLE, 150.0, - G_PARAM_READWRITE)); - - signals[SELECTION_EVENT] = - g_signal_new ("selection_event", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EReflowClass, selection_event), - NULL, NULL, - e_marshal_INT__OBJECT_BOXED, - G_TYPE_INT, 2, - G_TYPE_OBJECT, - GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); - - signals[COLUMN_WIDTH_CHANGED] = - g_signal_new ("column_width_changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EReflowClass, column_width_changed), - NULL, NULL, - g_cclosure_marshal_VOID__DOUBLE, - G_TYPE_NONE, 1, G_TYPE_DOUBLE); + g_object_class_install_property ( + object_class, + PROP_MINIMUM_WIDTH, + g_param_spec_double ( + "minimum_width", + "Minimum width", + "Minimum Width", + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_WIDTH, + g_param_spec_double ( + "width", + "Width", + "Width", + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READABLE)); + + g_object_class_install_property ( + object_class, + PROP_HEIGHT, + g_param_spec_double ( + "height", + "Height", + "Height", + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_EMPTY_MESSAGE, + g_param_spec_string ( + "empty_message", + "Empty message", + "Empty message", + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_MODEL, + g_param_spec_object ( + "model", + "Reflow model", + "Reflow model", + E_TYPE_REFLOW_MODEL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_COLUMN_WIDTH, + g_param_spec_double ( + "column_width", + "Column width", + "Column width", + 0.0, G_MAXDOUBLE, 150.0, + G_PARAM_READWRITE)); + + signals[SELECTION_EVENT] = g_signal_new ( + "selection_event", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EReflowClass, selection_event), + NULL, NULL, + e_marshal_INT__OBJECT_BOXED, + G_TYPE_INT, 2, + G_TYPE_OBJECT, + GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); + + signals[COLUMN_WIDTH_CHANGED] = g_signal_new ( + "column_width_changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EReflowClass, column_width_changed), + NULL, NULL, + g_cclosure_marshal_VOID__DOUBLE, + G_TYPE_NONE, 1, + G_TYPE_DOUBLE); } static void @@ -1650,9 +1697,10 @@ e_reflow_init (EReflow *reflow) reflow->selection = E_SELECTION_MODEL (e_selection_model_simple_new ()); reflow->sorter = e_sorter_array_new (er_create_cmp_cache, er_compare, reflow); - g_object_set (reflow->selection, - "sorter", reflow->sorter, - NULL); + g_object_set ( + reflow->selection, + "sorter", reflow->sorter, + NULL); reflow->selection_changed_id = g_signal_connect ( reflow->selection, "selection_changed", diff --git a/widgets/text/e-text-model.c b/widgets/text/e-text-model.c index b9b2a09154..e1a7ee8526 100644 --- a/widgets/text/e-text-model.c +++ b/widgets/text/e-text-model.c @@ -98,43 +98,44 @@ e_text_model_class_init (ETextModelClass *class) object_class = G_OBJECT_CLASS (class); object_class->finalize = e_text_model_finalize; - signals[E_TEXT_MODEL_CHANGED] = - g_signal_new ("changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETextModelClass, changed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - signals[E_TEXT_MODEL_REPOSITION] = - g_signal_new ("reposition", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETextModelClass, reposition), - NULL, NULL, - e_marshal_NONE__POINTER_POINTER, - G_TYPE_NONE, 2, - G_TYPE_POINTER, G_TYPE_POINTER); - - signals[E_TEXT_MODEL_OBJECT_ACTIVATED] = - g_signal_new ("object_activated", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETextModelClass, object_activated), - NULL, NULL, - g_cclosure_marshal_VOID__INT, - G_TYPE_NONE, 1, - G_TYPE_INT); - - signals[E_TEXT_MODEL_CANCEL_COMPLETION] = - g_signal_new ("cancel_completion", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETextModelClass, cancel_completion), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + signals[E_TEXT_MODEL_CHANGED] = g_signal_new ( + "changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETextModelClass, changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[E_TEXT_MODEL_REPOSITION] = g_signal_new ( + "reposition", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETextModelClass, reposition), + NULL, NULL, + e_marshal_NONE__POINTER_POINTER, + G_TYPE_NONE, 2, + G_TYPE_POINTER, + G_TYPE_POINTER); + + signals[E_TEXT_MODEL_OBJECT_ACTIVATED] = g_signal_new ( + "object_activated", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETextModelClass, object_activated), + NULL, NULL, + g_cclosure_marshal_VOID__INT, + G_TYPE_NONE, 1, + G_TYPE_INT); + + signals[E_TEXT_MODEL_CANCEL_COMPLETION] = g_signal_new ( + "cancel_completion", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETextModelClass, cancel_completion), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); /* No default signal handlers. */ class->changed = NULL; @@ -251,9 +252,10 @@ e_text_model_real_insert_length (ETextModel *model, byte_length = p - text; - g_string_insert_len (model->priv->text, - offs - model->priv->text->str, - text, byte_length); + g_string_insert_len ( + model->priv->text, + offs - model->priv->text->str, + text, byte_length); e_text_model_changed (model); @@ -283,8 +285,9 @@ e_text_model_real_delete (ETextModel *model, byte_length = p - offs; - g_string_erase (model->priv->text, - byte_position, byte_length); + g_string_erase ( + model->priv->text, + byte_position, byte_length); e_text_model_changed (model); diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index c46de3adfc..1a56f9af40 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -167,13 +167,15 @@ e_text_dispose (GObject *object) text = E_TEXT (object); if (text->model_changed_signal_id) - g_signal_handler_disconnect (text->model, - text->model_changed_signal_id); + g_signal_handler_disconnect ( + text->model, + text->model_changed_signal_id); text->model_changed_signal_id = 0; if (text->model_repos_signal_id) - g_signal_handler_disconnect (text->model, - text->model_repos_signal_id); + g_signal_handler_disconnect ( + text->model, + text->model_repos_signal_id); text->model_repos_signal_id = 0; if (text->model) @@ -181,8 +183,9 @@ e_text_dispose (GObject *object) text->model = NULL; if (text->tep_command_id) - g_signal_handler_disconnect (text->tep, - text->tep_command_id); + g_signal_handler_disconnect ( + text->tep, + text->tep_command_id); text->tep_command_id = 0; if (text->tep) @@ -388,12 +391,15 @@ reset_layout (EText *text) } text->font_desc = pango_font_description_new (); if (!pango_font_description_get_size_is_absolute (style->font_desc)) - pango_font_description_set_size (text->font_desc, + pango_font_description_set_size ( + text->font_desc, pango_font_description_get_size (style->font_desc)); else - pango_font_description_set_absolute_size (text->font_desc, + pango_font_description_set_absolute_size ( + text->font_desc, pango_font_description_get_size (style->font_desc)); - pango_font_description_set_family (text->font_desc, + pango_font_description_set_family ( + text->font_desc, pango_font_description_get_family (style->font_desc)); pango_layout_set_font_description (text->layout, text->font_desc); @@ -584,12 +590,14 @@ e_text_set_property (GObject *object, case PROP_MODEL: if (text->model_changed_signal_id) - g_signal_handler_disconnect (text->model, - text->model_changed_signal_id); + g_signal_handler_disconnect ( + text->model, + text->model_changed_signal_id); if (text->model_repos_signal_id) - g_signal_handler_disconnect (text->model, - text->model_repos_signal_id); + g_signal_handler_disconnect ( + text->model, + text->model_repos_signal_id); g_object_unref (text->model); text->model = E_TEXT_MODEL (g_value_get_object (value)); @@ -612,8 +620,9 @@ e_text_set_property (GObject *object, case PROP_EVENT_PROCESSOR: if (text->tep && text->tep_command_id) - g_signal_handler_disconnect (text->tep, - text->tep_command_id); + g_signal_handler_disconnect ( + text->tep, + text->tep_command_id); if (text->tep) { g_object_unref (text->tep); } @@ -625,9 +634,10 @@ e_text_set_property (GObject *object, G_CALLBACK (e_text_command), text); if (!text->allow_newlines) - g_object_set (text->tep, - "allow_newlines", FALSE, - NULL); + g_object_set ( + text->tep, + "allow_newlines", FALSE, + NULL); break; case PROP_TEXT: @@ -791,7 +801,7 @@ e_text_set_property (GObject *object, text->break_characters = NULL; } if (g_value_get_string (value)) - text->break_characters = g_strdup ( g_value_get_string (value) ); + text->break_characters = g_strdup (g_value_get_string (value)); text->needs_split_into_lines = 1; needs_reflow = 1; break; @@ -822,9 +832,10 @@ e_text_set_property (GObject *object, case PROP_ALLOW_NEWLINES: text->allow_newlines = g_value_get_boolean (value); _get_tep (text); - g_object_set (text->tep, - "allow_newlines", g_value_get_boolean (value), - NULL); + g_object_set ( + text->tep, + "allow_newlines", g_value_get_boolean (value), + NULL); break; case PROP_CURSOR_POS: { @@ -1040,13 +1051,13 @@ e_text_update (GnomeCanvasItem *item, GNOME_CANVAS_ITEM_CLASS (e_text_parent_class)->update ( item, i2c, flags); - if ( text->needs_recalc_bounds + if (text->needs_recalc_bounds || (flags & GNOME_CANVAS_UPDATE_AFFINE)) { get_bounds (text, &x1, &y1, &x2, &y2); - if ( item->x1 != x1 || - item->x2 != x2 || - item->y1 != y1 || - item->y2 != y2 ) { + if (item->x1 != x1 || + item->x2 != x2 || + item->y1 != y1 || + item->y2 != y2) { gnome_canvas_request_redraw ( item->canvas, item->x1, item->y1, item->x2, item->y2); @@ -1214,11 +1225,12 @@ e_text_draw (GnomeCanvasItem *item, if (!text->rgba_set) { gdk_cairo_set_source_color (cr, &style->fg[state]); } else { - cairo_set_source_rgba (cr, - ((text->rgba >> 24) & 0xff) / 255.0, - ((text->rgba >> 16) & 0xff) / 255.0, - ((text->rgba >> 8) & 0xff) / 255.0, - ( text->rgba & 0xff) / 255.0); + cairo_set_source_rgba ( + cr, + ((text->rgba >> 24) & 0xff) / 255.0, + ((text->rgba >> 16) & 0xff) / 255.0, + ((text->rgba >> 8) & 0xff) / 255.0, + ( text->rgba & 0xff) / 255.0); } /* Insert preedit text only when im_context signals are connected & @@ -1485,8 +1497,9 @@ _blink_scroll_timeout (gpointer data) get_position_from_xy ( text, text->lastx, text->lasty); _get_tep (text); - e_text_event_processor_handle_event (text->tep, - &e_tep_event); + e_text_event_processor_handle_event ( + text->tep, + &e_tep_event); text->scroll_start = current_time; redraw = TRUE; } @@ -1660,7 +1673,7 @@ e_text_event (GnomeCanvasItem *item, if (event->key.keyval == GDK_KEY_F10 && (event->key.state & GDK_SHIFT_MASK) - && text->handle_popup ) { + && text->handle_popup) { /* Simulate a GdkEventButton here, so that we can * call e_text_do_popup directly */ @@ -1711,8 +1724,9 @@ e_text_event (GnomeCanvasItem *item, ret = e_text_event_processor_handle_event (text->tep, &e_tep_event); if (event->type == GDK_KEY_PRESS) - g_signal_emit (text, e_text_signals[E_TEXT_KEYPRESS], 0, - e_tep_event.key.keyval, e_tep_event.key.state); + g_signal_emit ( + text, e_text_signals[E_TEXT_KEYPRESS], 0, + e_tep_event.key.keyval, e_tep_event.key.state); if (e_tep_event.key.string) g_free ((gpointer) e_tep_event.key.string); @@ -1915,9 +1929,10 @@ primary_get_cb (GtkClipboard *clipboard, sel_end = g_utf8_offset_to_pointer (text->text, sel_end) - text->text; if (sel_start != sel_end) { - gtk_selection_data_set_text (selection_data, - text->text + sel_start, - sel_end - sel_start); + gtk_selection_data_set_text ( + selection_data, + text->text + sel_start, + sel_end - sel_start); } } @@ -2036,9 +2051,10 @@ popup_targets_received (GtkClipboard *clipboard, g_free (closure); - gtk_menu_attach_to_widget (GTK_MENU (popup_menu), - GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas), - popup_menu_detach); + gtk_menu_attach_to_widget ( + GTK_MENU (popup_menu), + GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas), + popup_menu_detach); /* cut menu item */ menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_CUT, NULL); @@ -2091,8 +2107,9 @@ popup_targets_received (GtkClipboard *clipboard, gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menuitem); - gtk_im_multicontext_append_menuitems (GTK_IM_MULTICONTEXT (text->im_context), - GTK_MENU_SHELL (submenu)); + gtk_im_multicontext_append_menuitems ( + GTK_IM_MULTICONTEXT (text->im_context), + GTK_MENU_SHELL (submenu)); } g_signal_emit (text, @@ -2738,19 +2755,21 @@ e_text_command (ETextEventProcessor *tep, text->select_by_word = command->value; break; case E_TEP_GRAB: - e_canvas_item_grab (E_CANVAS (GNOME_CANVAS_ITEM (text)->canvas), - GNOME_CANVAS_ITEM (text), - GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, - text->i_cursor, - command->time, - NULL, - NULL); + e_canvas_item_grab ( + E_CANVAS (GNOME_CANVAS_ITEM (text)->canvas), + GNOME_CANVAS_ITEM (text), + GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, + text->i_cursor, + command->time, + NULL, + NULL); scroll = FALSE; break; case E_TEP_UNGRAB: - e_canvas_item_ungrab (E_CANVAS (GNOME_CANVAS_ITEM (text)->canvas), - GNOME_CANVAS_ITEM (text), - command->time); + e_canvas_item_ungrab ( + E_CANVAS (GNOME_CANVAS_ITEM (text)->canvas), + GNOME_CANVAS_ITEM (text), + command->time); scroll = FALSE; break; case E_TEP_CAPS: @@ -2895,244 +2914,336 @@ e_text_class_init (ETextClass *class) class->changed = NULL; class->activate = NULL; - e_text_signals[E_TEXT_CHANGED] = - g_signal_new ("changed", - G_OBJECT_CLASS_TYPE (gobject_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETextClass, changed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - e_text_signals[E_TEXT_ACTIVATE] = - g_signal_new ("activate", - G_OBJECT_CLASS_TYPE (gobject_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETextClass, activate), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - e_text_signals[E_TEXT_KEYPRESS] = - g_signal_new ("keypress", - G_OBJECT_CLASS_TYPE (gobject_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETextClass, keypress), - NULL, NULL, - e_marshal_NONE__INT_INT, - G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT); - - e_text_signals[E_TEXT_POPULATE_POPUP] = - g_signal_new ("populate_popup", - G_OBJECT_CLASS_TYPE (gobject_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETextClass, populate_popup), - NULL, NULL, - e_marshal_NONE__POINTER_INT_OBJECT, - G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, GTK_TYPE_MENU); - - g_object_class_install_property (gobject_class, PROP_MODEL, - g_param_spec_object ("model", - "Model", - "Model", - E_TYPE_TEXT_MODEL, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_EVENT_PROCESSOR, - g_param_spec_object ("event_processor", - "Event Processor", - "Event Processor", - E_TEXT_EVENT_PROCESSOR_TYPE, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_TEXT, - g_param_spec_string ("text", - "Text", - "Text", - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_BOLD, - g_param_spec_boolean ("bold", - "Bold", - "Bold", - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_STRIKEOUT, - g_param_spec_boolean ("strikeout", - "Strikeout", - "Strikeout", - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_JUSTIFICATION, - g_param_spec_enum ("justification", - "Justification", - "Justification", - GTK_TYPE_JUSTIFICATION, GTK_JUSTIFY_LEFT, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_CLIP_WIDTH, - g_param_spec_double ("clip_width", - "Clip Width", - "Clip Width", - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_CLIP_HEIGHT, - g_param_spec_double ("clip_height", - "Clip Height", - "Clip Height", - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_CLIP, - g_param_spec_boolean ("clip", - "Clip", - "Clip", - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_FILL_CLIP_RECTANGLE, - g_param_spec_boolean ("fill_clip_rectangle", - "Fill clip rectangle", - "Fill clip rectangle", - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_X_OFFSET, - g_param_spec_double ("x_offset", - "X Offset", - "X Offset", - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_Y_OFFSET, - g_param_spec_double ("y_offset", - "Y Offset", - "Y Offset", - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_FILL_COLOR, - g_param_spec_string ("fill_color", - "Fill color", - "Fill color", - NULL, - G_PARAM_WRITABLE)); - - g_object_class_install_property (gobject_class, PROP_FILL_COLOR_GDK, - g_param_spec_boxed ("fill_color_gdk", - "GDK fill color", - "GDK fill color", - GDK_TYPE_COLOR, - G_PARAM_WRITABLE)); - - g_object_class_install_property (gobject_class, PROP_FILL_COLOR_RGBA, - g_param_spec_uint ("fill_color_rgba", - "GDK fill color", - "GDK fill color", - 0, G_MAXUINT, 0, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_TEXT_WIDTH, - g_param_spec_double ("text_width", - "Text width", - "Text width", - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READABLE)); - - g_object_class_install_property (gobject_class, PROP_TEXT_HEIGHT, - g_param_spec_double ("text_height", - "Text height", - "Text height", - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READABLE)); - - g_object_class_install_property (gobject_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - "Editable", - "Editable", - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_USE_ELLIPSIS, - g_param_spec_boolean ("use_ellipsis", - "Use ellipsis", - "Use ellipsis", - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_ELLIPSIS, - g_param_spec_string ("ellipsis", - "Ellipsis", - "Ellipsis", - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_LINE_WRAP, - g_param_spec_boolean ("line_wrap", - "Line wrap", - "Line wrap", - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_BREAK_CHARACTERS, - g_param_spec_string ("break_characters", - "Break characters", - "Break characters", - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_MAX_LINES, - g_param_spec_int ("max_lines", - "Max lines", - "Max lines", - 0, G_MAXINT, 0, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_WIDTH, - g_param_spec_double ("width", - "Width", - "Width", - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_HEIGHT, - g_param_spec_double ("height", - "Height", - "Height", - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_ALLOW_NEWLINES, - g_param_spec_boolean ("allow_newlines", - "Allow newlines", - "Allow newlines", - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_CURSOR_POS, - g_param_spec_int ("cursor_pos", - "Cursor position", - "Cursor position", - 0, G_MAXINT, 0, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_IM_CONTEXT, - g_param_spec_object ("im_context", - "IM Context", - "IM Context", - GTK_TYPE_IM_CONTEXT, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_HANDLE_POPUP, - g_param_spec_boolean ("handle_popup", - "Handle Popup", - "Handle Popup", - FALSE, - G_PARAM_READWRITE)); + e_text_signals[E_TEXT_CHANGED] = g_signal_new ( + "changed", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETextClass, changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + e_text_signals[E_TEXT_ACTIVATE] = g_signal_new ( + "activate", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETextClass, activate), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + e_text_signals[E_TEXT_KEYPRESS] = g_signal_new ( + "keypress", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETextClass, keypress), + NULL, NULL, + e_marshal_NONE__INT_INT, + G_TYPE_NONE, 2, + G_TYPE_UINT, + G_TYPE_UINT); + + e_text_signals[E_TEXT_POPULATE_POPUP] = g_signal_new ( + "populate_popup", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETextClass, populate_popup), + NULL, NULL, + e_marshal_NONE__POINTER_INT_OBJECT, + G_TYPE_NONE, 3, + G_TYPE_POINTER, + G_TYPE_INT, + GTK_TYPE_MENU); + + g_object_class_install_property ( + gobject_class, + PROP_MODEL, + g_param_spec_object ( + "model", + "Model", + "Model", + E_TYPE_TEXT_MODEL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_EVENT_PROCESSOR, + g_param_spec_object ( + "event_processor", + "Event Processor", + "Event Processor", + E_TEXT_EVENT_PROCESSOR_TYPE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_TEXT, + g_param_spec_string ( + "text", + "Text", + "Text", + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_BOLD, + g_param_spec_boolean ( + "bold", + "Bold", + "Bold", + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_STRIKEOUT, + g_param_spec_boolean ( + "strikeout", + "Strikeout", + "Strikeout", + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_JUSTIFICATION, + g_param_spec_enum ( + "justification", + "Justification", + "Justification", + GTK_TYPE_JUSTIFICATION, + GTK_JUSTIFY_LEFT, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_CLIP_WIDTH, + g_param_spec_double ( + "clip_width", + "Clip Width", + "Clip Width", + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_CLIP_HEIGHT, + g_param_spec_double ( + "clip_height", + "Clip Height", + "Clip Height", + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_CLIP, + g_param_spec_boolean ( + "clip", + "Clip", + "Clip", + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_FILL_CLIP_RECTANGLE, + g_param_spec_boolean ( + "fill_clip_rectangle", + "Fill clip rectangle", + "Fill clip rectangle", + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_X_OFFSET, + g_param_spec_double ( + "x_offset", + "X Offset", + "X Offset", + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_Y_OFFSET, + g_param_spec_double ( + "y_offset", + "Y Offset", + "Y Offset", + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_FILL_COLOR, + g_param_spec_string ( + "fill_color", + "Fill color", + "Fill color", + NULL, + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_FILL_COLOR_GDK, + g_param_spec_boxed ( + "fill_color_gdk", + "GDK fill color", + "GDK fill color", + GDK_TYPE_COLOR, + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_FILL_COLOR_RGBA, + g_param_spec_uint ( + "fill_color_rgba", + "GDK fill color", + "GDK fill color", + 0, G_MAXUINT, 0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_TEXT_WIDTH, + g_param_spec_double ( + "text_width", + "Text width", + "Text width", + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_TEXT_HEIGHT, + g_param_spec_double ( + "text_height", + "Text height", + "Text height", + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_EDITABLE, + g_param_spec_boolean ( + "editable", + "Editable", + "Editable", + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_USE_ELLIPSIS, + g_param_spec_boolean ( + "use_ellipsis", + "Use ellipsis", + "Use ellipsis", + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_ELLIPSIS, + g_param_spec_string ( + "ellipsis", + "Ellipsis", + "Ellipsis", + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_LINE_WRAP, + g_param_spec_boolean ( + "line_wrap", + "Line wrap", + "Line wrap", + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_BREAK_CHARACTERS, + g_param_spec_string ( + "break_characters", + "Break characters", + "Break characters", + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, PROP_MAX_LINES, + g_param_spec_int ( + "max_lines", + "Max lines", + "Max lines", + 0, G_MAXINT, 0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_WIDTH, + g_param_spec_double ( + "width", + "Width", + "Width", + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_HEIGHT, + g_param_spec_double ( + "height", + "Height", + "Height", + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_ALLOW_NEWLINES, + g_param_spec_boolean ( + "allow_newlines", + "Allow newlines", + "Allow newlines", + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_CURSOR_POS, + g_param_spec_int ( + "cursor_pos", + "Cursor position", + "Cursor position", + 0, G_MAXINT, 0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_IM_CONTEXT, + g_param_spec_object ( + "im_context", + "IM Context", + "IM Context", + GTK_TYPE_IM_CONTEXT, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + gobject_class, + PROP_HANDLE_POPUP, + g_param_spec_boolean ( + "handle_popup", + "Handle Popup", + "Handle Popup", + FALSE, + G_PARAM_READWRITE)); if (!clipboard_atom) clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); @@ -3241,8 +3352,9 @@ e_text_preedit_changed_cb (GtkIMContext *context, gchar *preedit_string = NULL; gint cursor_pos; - gtk_im_context_get_preedit_string (context, &preedit_string, - NULL, &cursor_pos); + gtk_im_context_get_preedit_string ( + context, &preedit_string, + NULL, &cursor_pos); cursor_pos = CLAMP (cursor_pos, 0, g_utf8_strlen (preedit_string, -1)); etext->preedit_len = strlen (preedit_string); @@ -3271,9 +3383,10 @@ e_text_delete_surrounding_cb (GtkIMContext *context, gint n_chars, EText *text) { - e_text_model_delete (text->model, - MIN (text->selection_start, text->selection_end) + offset, - n_chars); + e_text_model_delete ( + text->model, + MIN (text->selection_start, text->selection_end) + offset, + n_chars); return TRUE; } diff --git a/widgets/text/gal-a11y-e-text.c b/widgets/text/gal-a11y-e-text.c index 6f62ae74c6..44b069d3a7 100644 --- a/widgets/text/gal-a11y-e-text.c +++ b/widgets/text/gal-a11y-e-text.c @@ -79,10 +79,11 @@ et_get_extents (AtkComponent *component, &fake_height, coord_type); - g_object_get (item, - "text_width", &real_width, - "text_height", &real_height, - NULL); + g_object_get ( + item, + "text_width", &real_width, + "text_height", &real_height, + NULL); if (width) *width = real_width; @@ -646,11 +647,12 @@ et_get_offset_at_point (AtkText *text, x -= etext->cx; y -= etext->cy; - pango_layout_xy_to_index (etext->layout, - x * PANGO_SCALE - PANGO_SCALE / 2, - y * PANGO_SCALE - PANGO_SCALE / 2, - &index, - &trailing); + pango_layout_xy_to_index ( + etext->layout, + x * PANGO_SCALE - PANGO_SCALE / 2, + y * PANGO_SCALE - PANGO_SCALE / 2, + &index, + &trailing); return g_utf8_pointer_to_offset (etext->text, etext->text + index + trailing); } @@ -1130,9 +1132,10 @@ void gal_a11y_e_text_init (void) { if (atk_get_root ()) - atk_registry_set_factory_type (atk_get_default_registry (), - E_TYPE_TEXT, - gal_a11y_e_text_factory_get_type ()); + atk_registry_set_factory_type ( + atk_get_default_registry (), + E_TYPE_TEXT, + gal_a11y_e_text_factory_get_type ()); } -- cgit v1.2.3