aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/text
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-12-01 10:53:20 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-02-20 23:04:25 +0800
commit23f5773903d64a554d977ae7d0ebbaca73528f1f (patch)
tree104e1a59da8bf96b004bce204b79f47bbe0a6d13 /widgets/text
parent49bc4c2d765ee1780c23fdc9f42152850dabb220 (diff)
downloadgsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar
gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.gz
gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.bz2
gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.lz
gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.xz
gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.zst
gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.zip
Coding style and whitespace cleanup.
Diffstat (limited to 'widgets/text')
-rw-r--r--widgets/text/e-reflow-model.c209
-rw-r--r--widgets/text/e-reflow-model.h37
-rw-r--r--widgets/text/e-reflow.c95
-rw-r--r--widgets/text/e-reflow.h52
-rw-r--r--widgets/text/e-text-model.c195
-rw-r--r--widgets/text/e-text.c171
-rw-r--r--widgets/text/gal-a11y-e-text-factory.c4
-rw-r--r--widgets/text/gal-a11y-e-text.c12
8 files changed, 433 insertions, 342 deletions
diff --git a/widgets/text/e-reflow-model.c b/widgets/text/e-reflow-model.c
index 05457d0145..35d0eaf9da 100644
--- a/widgets/text/e-reflow-model.c
+++ b/widgets/text/e-reflow-model.c
@@ -44,7 +44,7 @@ enum {
LAST_SIGNAL
};
-static guint e_reflow_model_signals[LAST_SIGNAL] = { 0, };
+static guint signals[LAST_SIGNAL] = { 0, };
/**
* e_reflow_model_set_width:
@@ -55,10 +55,14 @@ void
e_reflow_model_set_width (EReflowModel *e_reflow_model,
gint width)
{
- g_return_if_fail (e_reflow_model != NULL);
+ EReflowModelClass *class;
+
g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model));
- E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->set_width (e_reflow_model, width);
+ class = E_REFLOW_MODEL_GET_CLASS (e_reflow_model);
+ g_return_if_fail (class->set_width != NULL);
+
+ class->set_width (e_reflow_model, width);
}
/**
@@ -70,10 +74,14 @@ e_reflow_model_set_width (EReflowModel *e_reflow_model,
gint
e_reflow_model_count (EReflowModel *e_reflow_model)
{
- g_return_val_if_fail (e_reflow_model != NULL, 0);
+ EReflowModelClass *class;
+
g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), 0);
- return E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->count (e_reflow_model);
+ class = E_REFLOW_MODEL_GET_CLASS (e_reflow_model);
+ g_return_val_if_fail (class->count != NULL, 0);
+
+ return class->count (e_reflow_model);
}
/**
@@ -89,10 +97,14 @@ e_reflow_model_height (EReflowModel *e_reflow_model,
gint n,
GnomeCanvasGroup *parent)
{
- g_return_val_if_fail (e_reflow_model != NULL, 0);
+ EReflowModelClass *class;
+
g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), 0);
- return E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->height (e_reflow_model, n, parent);
+ class = E_REFLOW_MODEL_GET_CLASS (e_reflow_model);
+ g_return_val_if_fail (class->height != NULL, 0);
+
+ return class->height (e_reflow_model, n, parent);
}
/**
@@ -110,10 +122,14 @@ e_reflow_model_incarnate (EReflowModel *e_reflow_model,
gint n,
GnomeCanvasGroup *parent)
{
- g_return_val_if_fail (e_reflow_model != NULL, NULL);
+ EReflowModelClass *class;
+
g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), NULL);
- return E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->incarnate (e_reflow_model, n, parent);
+ class = E_REFLOW_MODEL_GET_CLASS (e_reflow_model);
+ g_return_val_if_fail (class->incarnate != NULL, NULL);
+
+ return class->incarnate (e_reflow_model, n, parent);
}
/**
@@ -129,13 +145,16 @@ e_reflow_model_incarnate (EReflowModel *e_reflow_model,
GHashTable *
e_reflow_model_create_cmp_cache (EReflowModel *e_reflow_model)
{
- g_return_val_if_fail (e_reflow_model != NULL, NULL);
+ EReflowModelClass *class;
+
g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), NULL);
- if (!E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->create_cmp_cache)
+ class = E_REFLOW_MODEL_GET_CLASS (e_reflow_model);
+
+ if (class->create_cmp_cache == NULL)
return NULL;
- return E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->create_cmp_cache (e_reflow_model);
+ return class->create_cmp_cache (e_reflow_model);
}
/**
@@ -158,12 +177,14 @@ e_reflow_model_compare (EReflowModel *e_reflow_model,
gint n2,
GHashTable *cmp_cache)
{
-#if 0
- g_return_val_if_fail (e_reflow_model != NULL, 0);
+ EReflowModelClass *class;
+
g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), 0);
-#endif
- return E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->compare (e_reflow_model, n1, n2, cmp_cache);
+ class = E_REFLOW_MODEL_GET_CLASS (e_reflow_model);
+ g_return_val_if_fail (class->compare != NULL, 0);
+
+ return class->compare (e_reflow_model, n1, n2, cmp_cache);
}
/**
@@ -179,73 +200,77 @@ e_reflow_model_reincarnate (EReflowModel *e_reflow_model,
gint n,
GnomeCanvasItem *item)
{
- g_return_if_fail (e_reflow_model != NULL);
+ EReflowModelClass *class;
+
g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model));
- E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->reincarnate (e_reflow_model, n, item);
+ class = E_REFLOW_MODEL_GET_CLASS (e_reflow_model);
+ g_return_if_fail (class->reincarnate != NULL);
+
+ class->reincarnate (e_reflow_model, n, item);
}
static void
-e_reflow_model_class_init (EReflowModelClass *klass)
+e_reflow_model_class_init (EReflowModelClass *class)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- e_reflow_model_signals[MODEL_CHANGED] =
- g_signal_new ("model_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EReflowModelClass, model_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- e_reflow_model_signals[COMPARISON_CHANGED] =
- g_signal_new ("comparison_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EReflowModelClass, comparison_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- e_reflow_model_signals[MODEL_ITEMS_INSERTED] =
- g_signal_new ("model_items_inserted",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EReflowModelClass, model_items_inserted),
- NULL, NULL,
- e_marshal_NONE__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
-
- e_reflow_model_signals[MODEL_ITEM_CHANGED] =
- g_signal_new ("model_item_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EReflowModelClass, model_item_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- e_reflow_model_signals[MODEL_ITEM_REMOVED] =
- g_signal_new ("model_item_removed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EReflowModelClass, model_item_removed),
- NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- klass->set_width = NULL;
- klass->count = NULL;
- klass->height = NULL;
- klass->incarnate = NULL;
- klass->reincarnate = NULL;
-
- klass->model_changed = NULL;
- klass->comparison_changed = NULL;
- klass->model_items_inserted = NULL;
- klass->model_item_removed = NULL;
- klass->model_item_changed = NULL;
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+ class->set_width = NULL;
+ class->count = NULL;
+ class->height = NULL;
+ class->incarnate = NULL;
+ class->reincarnate = NULL;
+
+ class->model_changed = NULL;
+ class->comparison_changed = NULL;
+ class->model_items_inserted = NULL;
+ class->model_item_removed = NULL;
+ class->model_item_changed = NULL;
+
+ signals[MODEL_CHANGED] = g_signal_new (
+ "model_changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EReflowModelClass, model_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[COMPARISON_CHANGED] = g_signal_new (
+ "comparison_changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EReflowModelClass, comparison_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[MODEL_ITEMS_INSERTED] = g_signal_new (
+ "model_items_inserted",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EReflowModelClass, model_items_inserted),
+ NULL, NULL,
+ e_marshal_NONE__INT_INT,
+ G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
+
+ signals[MODEL_ITEM_CHANGED] = g_signal_new (
+ "model_item_changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EReflowModelClass, model_item_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1, G_TYPE_INT);
+
+ signals[MODEL_ITEM_REMOVED] = g_signal_new (
+ "model_item_removed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EReflowModelClass, model_item_removed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1, G_TYPE_INT);
}
static void
@@ -285,8 +310,7 @@ e_reflow_model_changed (EReflowModel *e_reflow_model)
d (print_tabs ());
d(g_print("Emitting model_changed on model 0x%p.\n", e_reflow_model));
d (depth++);
- g_signal_emit (e_reflow_model,
- e_reflow_model_signals[MODEL_CHANGED], 0);
+ g_signal_emit (e_reflow_model, signals[MODEL_CHANGED], 0);
d (depth--);
}
@@ -306,10 +330,11 @@ e_reflow_model_comparison_changed (EReflowModel *e_reflow_model)
g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model));
d (print_tabs ());
- d(g_print("Emitting comparison_changed on model 0x%p.\n", e_reflow_model));
+ d (g_print (
+ "Emitting comparison_changed on model 0x%p.\n",
+ e_reflow_model));
d (depth++);
- g_signal_emit (e_reflow_model,
- e_reflow_model_signals[COMPARISON_CHANGED], 0);
+ g_signal_emit (e_reflow_model, signals[COMPARISON_CHANGED], 0);
d (depth--);
}
@@ -319,7 +344,8 @@ e_reflow_model_comparison_changed (EReflowModel *e_reflow_model)
* @position: The position the items were insert in.
* @count: The number of items inserted.
*
- * Use this function to notify any views of the reflow model that a number of items have been inserted.
+ * Use this function to notify any views of the reflow model that a number
+ * of items have been inserted.
**/
void
e_reflow_model_items_inserted (EReflowModel *e_reflow_model,
@@ -330,11 +356,11 @@ e_reflow_model_items_inserted (EReflowModel *e_reflow_model,
g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model));
d (print_tabs ());
- d(g_print("Emitting items_inserted on model 0x%p, position=%d, count=%d.\n", e_reflow_model, position, count));
d (depth++);
- g_signal_emit (e_reflow_model,
- e_reflow_model_signals[MODEL_ITEMS_INSERTED], 0,
- position, count);
+ g_signal_emit (
+ e_reflow_model,
+ signals[MODEL_ITEMS_INSERTED], 0,
+ position, count);
d (depth--);
}
@@ -354,11 +380,8 @@ e_reflow_model_item_removed (EReflowModel *e_reflow_model,
g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model));
d (print_tabs ());
- d(g_print("Emitting item_removed on model 0x%p, n=%d.\n", e_reflow_model, n));
d (depth++);
- g_signal_emit (e_reflow_model,
- e_reflow_model_signals[MODEL_ITEM_REMOVED], 0,
- n);
+ g_signal_emit (e_reflow_model, signals[MODEL_ITEM_REMOVED], 0, n);
d (depth--);
}
@@ -383,8 +406,6 @@ e_reflow_model_item_changed (EReflowModel *e_reflow_model,
d (print_tabs ());
d(g_print("Emitting item_changed on model 0x%p, n=%d.\n", e_reflow_model, n));
d (depth++);
- g_signal_emit (e_reflow_model,
- e_reflow_model_signals[MODEL_ITEM_CHANGED], 0,
- n);
+ g_signal_emit (e_reflow_model, signals[MODEL_ITEM_CHANGED], 0, n);
d (depth--);
}
diff --git a/widgets/text/e-reflow-model.h b/widgets/text/e-reflow-model.h
index 224a6ab4e3..33cad68da0 100644
--- a/widgets/text/e-reflow-model.h
+++ b/widgets/text/e-reflow-model.h
@@ -26,20 +26,35 @@
#include <libgnomecanvas/libgnomecanvas.h>
+/* Standard GObject macros */
+#define E_TYPE_REFLOW_MODEL \
+ (e_reflow_model_get_type ())
+#define E_REFLOW_MODEL(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_REFLOW_MODEL, EReflowModel))
+#define E_REFLOW_MODEL_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_REFLOW_MODEL, EReflowModelClass))
+#define E_IS_REFLOW_MODEL(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_REFLOW_MODEL))
+#define E_IS_REFLOW_MODEL_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_REFLOW_MODEL))
+#define E_REFLOW_MODEL_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_REFLOW_MODEL, EReflowModelClass))
+
G_BEGIN_DECLS
-#define E_REFLOW_MODEL_TYPE (e_reflow_model_get_type ())
-#define E_REFLOW_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_REFLOW_MODEL_TYPE, EReflowModel))
-#define E_REFLOW_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_REFLOW_MODEL_TYPE, EReflowModelClass))
-#define E_IS_REFLOW_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_REFLOW_MODEL_TYPE))
-#define E_IS_REFLOW_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_REFLOW_MODEL_TYPE))
-#define E_REFLOW_MODEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_REFLOW_MODEL_TYPE, EReflowModelClass))
+typedef struct _EReflowModel EReflowModel;
+typedef struct _EReflowModelClass EReflowModelClass;
-typedef struct {
- GObject base;
-} EReflowModel;
+struct _EReflowModel {
+ GObject parent;
+};
-typedef struct {
+struct _EReflowModelClass {
GObjectClass parent_class;
/*
@@ -69,7 +84,7 @@ typedef struct {
void (*model_items_inserted) (EReflowModel *etm, gint position, gint count);
void (*model_item_removed) (EReflowModel *etm, gint position);
void (*model_item_changed) (EReflowModel *etm, gint n);
-} EReflowModelClass;
+};
GType e_reflow_model_get_type (void);
diff --git a/widgets/text/e-reflow.c b/widgets/text/e-reflow.c
index 296d732590..dba051e2cc 100644
--- a/widgets/text/e-reflow.c
+++ b/widgets/text/e-reflow.c
@@ -645,23 +645,28 @@ connect_model (EReflow *reflow,
if (model == NULL)
return;
- reflow->model = model;
- g_object_ref (reflow->model);
- reflow->model_changed_id =
- g_signal_connect (reflow->model, "model_changed",
- G_CALLBACK (model_changed), reflow);
- reflow->comparison_changed_id =
- g_signal_connect (reflow->model, "comparison_changed",
- G_CALLBACK (comparison_changed), reflow);
- reflow->model_items_inserted_id =
- g_signal_connect (reflow->model, "model_items_inserted",
- G_CALLBACK (items_inserted), reflow);
- reflow->model_item_removed_id =
- g_signal_connect (reflow->model, "model_item_removed",
- G_CALLBACK (item_removed), reflow);
- reflow->model_item_changed_id =
- g_signal_connect (reflow->model, "model_item_changed",
- G_CALLBACK (item_changed), reflow);
+ reflow->model = g_object_ref (model);
+
+ reflow->model_changed_id = g_signal_connect (
+ reflow->model, "model_changed",
+ G_CALLBACK (model_changed), reflow);
+
+ reflow->comparison_changed_id = g_signal_connect (
+ reflow->model, "comparison_changed",
+ G_CALLBACK (comparison_changed), reflow);
+
+ reflow->model_items_inserted_id = g_signal_connect (
+ reflow->model, "model_items_inserted",
+ G_CALLBACK (items_inserted), reflow);
+
+ reflow->model_item_removed_id = g_signal_connect (
+ reflow->model, "model_item_removed",
+ G_CALLBACK (item_removed), reflow);
+
+ reflow->model_item_changed_id = g_signal_connect (
+ reflow->model, "model_item_changed",
+ G_CALLBACK (item_changed), reflow);
+
model_changed (model, reflow);
}
@@ -700,14 +705,15 @@ connect_adjustment (EReflow *reflow,
if (adjustment == NULL)
return;
- reflow->adjustment = adjustment;
- reflow->adjustment_changed_id =
- g_signal_connect (adjustment, "changed",
- G_CALLBACK (adjustment_changed), reflow);
- reflow->adjustment_value_changed_id =
- g_signal_connect (adjustment, "value_changed",
- G_CALLBACK (adjustment_changed), reflow);
- g_object_ref (adjustment);
+ reflow->adjustment = g_object_ref (adjustment);
+
+ reflow->adjustment_changed_id = g_signal_connect (
+ adjustment, "changed",
+ G_CALLBACK (adjustment_changed), reflow);
+
+ reflow->adjustment_value_changed_id = g_signal_connect (
+ adjustment, "value_changed",
+ G_CALLBACK (adjustment_changed), reflow);
}
#if 0
@@ -723,10 +729,9 @@ set_scroll_adjustments (GtkLayout *layout,
static void
connect_set_adjustment (EReflow *reflow)
{
- reflow->set_scroll_adjustments_id =
- g_signal_connect (GNOME_CANVAS_ITEM (reflow)->canvas,
- "set_scroll_adjustments",
- G_CALLBACK (set_scroll_adjustments), reflow);
+ reflow->set_scroll_adjustments_id = g_signal_connect (
+ GNOME_CANVAS_ITEM (reflow)->canvas, "set_scroll_adjustments",
+ G_CALLBACK (set_scroll_adjustments), reflow);
}
#endif
@@ -1519,13 +1524,13 @@ e_reflow_selection_event_real (EReflow *reflow,
}
static void
-e_reflow_class_init (EReflowClass *klass)
+e_reflow_class_init (EReflowClass *class)
{
GObjectClass *object_class;
GnomeCanvasItemClass *item_class;
- object_class = (GObjectClass *) klass;
- item_class = (GnomeCanvasItemClass *) klass;
+ object_class = (GObjectClass *) class;
+ item_class = (GnomeCanvasItemClass *) class;
object_class->set_property = e_reflow_set_property;
object_class->get_property = e_reflow_get_property;
@@ -1539,8 +1544,8 @@ e_reflow_class_init (EReflowClass *klass)
item_class->update = e_reflow_update;
item_class->point = e_reflow_point;
- klass->selection_event = e_reflow_selection_event_real;
- klass->column_width_changed = NULL;
+ 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",
@@ -1574,7 +1579,7 @@ e_reflow_class_init (EReflowClass *klass)
g_param_spec_object ("model",
"Reflow model",
"Reflow model",
- E_REFLOW_MODEL_TYPE,
+ E_TYPE_REFLOW_MODEL,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_COLUMN_WIDTH,
@@ -1651,15 +1656,17 @@ e_reflow_init (EReflow *reflow)
"sorter", reflow->sorter,
NULL);
- reflow->selection_changed_id =
- g_signal_connect (reflow->selection, "selection_changed",
- G_CALLBACK (selection_changed), reflow);
- reflow->selection_row_changed_id =
- g_signal_connect (reflow->selection, "selection_row_changed",
- G_CALLBACK (selection_row_changed), reflow);
- reflow->cursor_changed_id =
- g_signal_connect (reflow->selection, "cursor_changed",
- G_CALLBACK (cursor_changed), reflow);
+ reflow->selection_changed_id = g_signal_connect (
+ reflow->selection, "selection_changed",
+ G_CALLBACK (selection_changed), reflow);
+
+ reflow->selection_row_changed_id = g_signal_connect (
+ reflow->selection, "selection_row_changed",
+ G_CALLBACK (selection_row_changed), reflow);
+
+ reflow->cursor_changed_id = g_signal_connect (
+ reflow->selection, "cursor_changed",
+ G_CALLBACK (cursor_changed), reflow);
e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM (reflow), e_reflow_reflow);
}
diff --git a/widgets/text/e-reflow.h b/widgets/text/e-reflow.h
index d6b49064eb..979857ea5c 100644
--- a/widgets/text/e-reflow.h
+++ b/widgets/text/e-reflow.h
@@ -20,40 +20,40 @@
*
*/
-#ifndef __E_REFLOW_H__
-#define __E_REFLOW_H__
+#ifndef E_REFLOW_H
+#define E_REFLOW_H
#include <libgnomecanvas/libgnomecanvas.h>
#include <text/e-reflow-model.h>
#include <misc/e-selection-model.h>
#include <e-util/e-sorter-array.h>
-G_BEGIN_DECLS
-
-/* EReflow - A canvas item container.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- * minimum_width gdouble RW minimum width of the reflow. width >= minimum_width
- * width gdouble R width of the reflow
- * height gdouble RW height of the reflow
- */
-
-#define E_REFLOW_TYPE (e_reflow_get_type ())
-#define E_REFLOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_REFLOW_TYPE, EReflow))
-#define E_REFLOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_REFLOW_TYPE, EReflowClass))
-#define E_IS_REFLOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_REFLOW_TYPE))
-#define E_IS_REFLOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_REFLOW_TYPE))
+/* Standard GObject macros */
+#define E_TYPE_REFLOW \
+ (e_reflow_get_type ())
+#define E_REFLOW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_REFLOW, EReflow))
+#define E_REFLOW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_REFLOW, EReflowClass))
+#define E_IS_REFLOW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_REFLOW))
+#define E_IS_REFLOW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_REFLOW))
+#define E_REFLOW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_REFLOW, EReflowClass))
-typedef struct EReflowPriv EReflowPriv;
+G_BEGIN_DECLS
-typedef struct _EReflow EReflow;
-typedef struct _EReflowClass EReflowClass;
+typedef struct _EReflow EReflow;
+typedef struct _EReflowClass EReflowClass;
+typedef struct _EReflowPrivate EReflowPrivate;
-struct _EReflow
-{
+struct _EReflow {
GnomeCanvasGroup parent;
/* item specific fields */
@@ -137,4 +137,4 @@ GType e_reflow_get_type (void);
G_END_DECLS
-#endif /* __E_REFLOW_H__ */
+#endif /* E_REFLOW_H */
diff --git a/widgets/text/e-text-model.c b/widgets/text/e-text-model.c
index a2c34a7a84..b9b2a09154 100644
--- a/widgets/text/e-text-model.c
+++ b/widgets/text/e-text-model.c
@@ -36,6 +36,10 @@
#include "e-text-model.h"
#include "e-text-model-repos.h"
+#define E_TEXT_MODEL_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TEXT_MODEL, ETextModelPrivate))
+
enum {
E_TEXT_MODEL_CHANGED,
E_TEXT_MODEL_REPOSITION,
@@ -44,14 +48,12 @@ enum {
E_TEXT_MODEL_LAST_SIGNAL
};
-static guint e_text_model_signals[E_TEXT_MODEL_LAST_SIGNAL] = { 0 };
+static guint signals[E_TEXT_MODEL_LAST_SIGNAL] = { 0 };
struct _ETextModelPrivate {
GString *text;
};
-static void e_text_model_dispose (GObject *object);
-
static gint e_text_model_real_validate_position
(ETextModel *, gint pos);
static const gchar *
@@ -73,15 +75,30 @@ static void e_text_model_real_delete (ETextModel *model,
G_DEFINE_TYPE (ETextModel, e_text_model, G_TYPE_OBJECT)
-/* Class initialization function for the text item */
static void
-e_text_model_class_init (ETextModelClass *klass)
+e_text_model_finalize (GObject *object)
+{
+ ETextModelPrivate *priv;
+
+ priv = E_TEXT_MODEL_GET_PRIVATE (object);
+
+ g_string_free (priv->text, TRUE);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (e_text_model_parent_class)->finalize (object);
+}
+
+static void
+e_text_model_class_init (ETextModelClass *class)
{
GObjectClass *object_class;
- object_class = (GObjectClass *) klass;
+ g_type_class_add_private (class, sizeof (ETextModelPrivate));
- e_text_model_signals[E_TEXT_MODEL_CHANGED] =
+ 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,
@@ -90,7 +107,7 @@ e_text_model_class_init (ETextModelClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- e_text_model_signals[E_TEXT_MODEL_REPOSITION] =
+ signals[E_TEXT_MODEL_REPOSITION] =
g_signal_new ("reposition",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
@@ -100,7 +117,7 @@ e_text_model_class_init (ETextModelClass *klass)
G_TYPE_NONE, 2,
G_TYPE_POINTER, G_TYPE_POINTER);
- e_text_model_signals[E_TEXT_MODEL_OBJECT_ACTIVATED] =
+ signals[E_TEXT_MODEL_OBJECT_ACTIVATED] =
g_signal_new ("object_activated",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
@@ -110,7 +127,7 @@ e_text_model_class_init (ETextModelClass *klass)
G_TYPE_NONE, 1,
G_TYPE_INT);
- e_text_model_signals[E_TEXT_MODEL_CANCEL_COMPLETION] =
+ signals[E_TEXT_MODEL_CANCEL_COMPLETION] =
g_signal_new ("cancel_completion",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
@@ -120,56 +137,32 @@ e_text_model_class_init (ETextModelClass *klass)
G_TYPE_NONE, 0);
/* No default signal handlers. */
- klass->changed = NULL;
- klass->reposition = NULL;
- klass->object_activated = NULL;
+ class->changed = NULL;
+ class->reposition = NULL;
+ class->object_activated = NULL;
- klass->validate_pos = e_text_model_real_validate_position;
+ class->validate_pos = e_text_model_real_validate_position;
- klass->get_text = e_text_model_real_get_text;
- klass->get_text_len = e_text_model_real_get_text_length;
- klass->set_text = e_text_model_real_set_text;
- klass->insert = e_text_model_real_insert;
- klass->insert_length = e_text_model_real_insert_length;
- klass->delete = e_text_model_real_delete;
+ class->get_text = e_text_model_real_get_text;
+ class->get_text_len = e_text_model_real_get_text_length;
+ class->set_text = e_text_model_real_set_text;
+ class->insert = e_text_model_real_insert;
+ class->insert_length = e_text_model_real_insert_length;
+ class->delete = e_text_model_real_delete;
/* We explicitly don't define default handlers for these. */
- klass->objectify = NULL;
- klass->obj_count = NULL;
- klass->get_nth_obj = NULL;
-
- object_class->dispose = e_text_model_dispose;
+ class->objectify = NULL;
+ class->obj_count = NULL;
+ class->get_nth_obj = NULL;
}
-/* Object initialization function for the text item */
static void
e_text_model_init (ETextModel *model)
{
- model->priv = g_new0 (struct _ETextModelPrivate, 1);
+ model->priv = E_TEXT_MODEL_GET_PRIVATE (model);
model->priv->text = g_string_new ("");
}
-/* Dispose handler for the text item */
-static void
-e_text_model_dispose (GObject *object)
-{
- ETextModel *model;
-
- g_return_if_fail (E_IS_TEXT_MODEL (object));
-
- model = E_TEXT_MODEL (object);
-
- if (model->priv) {
- g_string_free (model->priv->text, TRUE);
-
- g_free (model->priv);
- model->priv = NULL;
- }
-
- /* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (e_text_model_parent_class)->dispose (object);
-}
-
static gint
e_text_model_real_validate_position (ETextModel *model,
gint pos)
@@ -305,18 +298,21 @@ e_text_model_real_delete (ETextModel *model,
void
e_text_model_changed (ETextModel *model)
{
+ ETextModelClass *class;
+
g_return_if_fail (E_IS_TEXT_MODEL (model));
+ class = E_TEXT_MODEL_GET_CLASS (model);
+
/*
Objectify before emitting any signal.
While this method could, in theory, do pretty much anything, it is meant
for scanning objects and converting substrings into embedded objects.
*/
- if (E_TEXT_MODEL_GET_CLASS (model)->objectify)
- E_TEXT_MODEL_GET_CLASS (model)->objectify (model);
+ if (class->objectify != NULL)
+ class->objectify (model);
- g_signal_emit (model,
- e_text_model_signals[E_TEXT_MODEL_CHANGED], 0);
+ g_signal_emit (model, signals[E_TEXT_MODEL_CHANGED], 0);
}
void
@@ -324,7 +320,7 @@ e_text_model_cancel_completion (ETextModel *model)
{
g_return_if_fail (E_IS_TEXT_MODEL (model));
- g_signal_emit (model, e_text_model_signals[E_TEXT_MODEL_CANCEL_COMPLETION], 0);
+ g_signal_emit (model, signals[E_TEXT_MODEL_CANCEL_COMPLETION], 0);
}
void
@@ -335,19 +331,22 @@ e_text_model_reposition (ETextModel *model,
g_return_if_fail (E_IS_TEXT_MODEL (model));
g_return_if_fail (fn != NULL);
- g_signal_emit (model,
- e_text_model_signals[E_TEXT_MODEL_REPOSITION], 0,
- fn, repos_data);
+ g_signal_emit (
+ model, signals[E_TEXT_MODEL_REPOSITION], 0, fn, repos_data);
}
gint
e_text_model_validate_position (ETextModel *model,
gint pos)
{
+ ETextModelClass *class;
+
g_return_val_if_fail (E_IS_TEXT_MODEL (model), 0);
- if (E_TEXT_MODEL_GET_CLASS (model)->validate_pos)
- pos = E_TEXT_MODEL_GET_CLASS (model)->validate_pos (model, pos);
+ class = E_TEXT_MODEL_GET_CLASS (model);
+
+ if (class->validate_pos != NULL)
+ pos = class->validate_pos (model, pos);
return pos;
}
@@ -355,22 +354,30 @@ e_text_model_validate_position (ETextModel *model,
const gchar *
e_text_model_get_text (ETextModel *model)
{
+ ETextModelClass *class;
+
g_return_val_if_fail (E_IS_TEXT_MODEL (model), NULL);
- if (E_TEXT_MODEL_GET_CLASS (model)->get_text)
- return E_TEXT_MODEL_GET_CLASS (model)->get_text (model);
+ class = E_TEXT_MODEL_GET_CLASS (model);
- return "";
+ if (class->get_text == NULL)
+ return "";
+
+ return class->get_text (model);
}
gint
e_text_model_get_text_length (ETextModel *model)
{
+ ETextModelClass *class;
+
g_return_val_if_fail (E_IS_TEXT_MODEL (model), 0);
- if (E_TEXT_MODEL_GET_CLASS (model)->get_text_len (model)) {
+ class = E_TEXT_MODEL_GET_CLASS (model);
- gint len = E_TEXT_MODEL_GET_CLASS (model)->get_text_len (model);
+ if (class->get_text_len (model)) {
+
+ gint len = class->get_text_len (model);
#ifdef PARANOID_DEBUGGING
const gchar *str = e_text_model_get_text (model);
@@ -392,10 +399,14 @@ void
e_text_model_set_text (ETextModel *model,
const gchar *text)
{
+ ETextModelClass *class;
+
g_return_if_fail (E_IS_TEXT_MODEL (model));
- if (E_TEXT_MODEL_GET_CLASS (model)->set_text)
- E_TEXT_MODEL_GET_CLASS (model)->set_text (model, text);
+ class = E_TEXT_MODEL_GET_CLASS (model);
+
+ if (class->set_text != NULL)
+ class->set_text (model, text);
}
void
@@ -403,13 +414,17 @@ e_text_model_insert (ETextModel *model,
gint position,
const gchar *text)
{
+ ETextModelClass *class;
+
g_return_if_fail (E_IS_TEXT_MODEL (model));
if (text == NULL)
return;
- if (E_TEXT_MODEL_GET_CLASS (model)->insert)
- E_TEXT_MODEL_GET_CLASS (model)->insert (model, position, text);
+ class = E_TEXT_MODEL_GET_CLASS (model);
+
+ if (class->insert != NULL)
+ class->insert (model, position, text);
}
void
@@ -418,14 +433,18 @@ e_text_model_insert_length (ETextModel *model,
const gchar *text,
gint length)
{
+ ETextModelClass *class;
+
g_return_if_fail (E_IS_TEXT_MODEL (model));
g_return_if_fail (length >= 0);
if (text == NULL || length == 0)
return;
- if (E_TEXT_MODEL_GET_CLASS (model)->insert_length)
- E_TEXT_MODEL_GET_CLASS (model)->insert_length (model, position, text, length);
+ class = E_TEXT_MODEL_GET_CLASS (model);
+
+ if (class->insert_length != NULL)
+ class->insert_length (model, position, text, length);
}
void
@@ -457,6 +476,7 @@ e_text_model_delete (ETextModel *model,
gint position,
gint length)
{
+ ETextModelClass *class;
gint txt_len;
g_return_if_fail (E_IS_TEXT_MODEL (model));
@@ -469,19 +489,25 @@ e_text_model_delete (ETextModel *model,
if (length <= 0)
return;
- if (E_TEXT_MODEL_GET_CLASS (model)->delete)
- E_TEXT_MODEL_GET_CLASS (model)->delete (model, position, length);
+ class = E_TEXT_MODEL_GET_CLASS (model);
+
+ if (class->delete != NULL)
+ class->delete (model, position, length);
}
gint
e_text_model_object_count (ETextModel *model)
{
+ ETextModelClass *class;
+
g_return_val_if_fail (E_IS_TEXT_MODEL (model), 0);
- if (E_TEXT_MODEL_GET_CLASS (model)->obj_count)
- return E_TEXT_MODEL_GET_CLASS (model)->obj_count (model);
+ class = E_TEXT_MODEL_GET_CLASS (model);
+
+ if (class->obj_count == NULL)
+ return 0;
- return 0;
+ return class->obj_count (model);
}
const gchar *
@@ -489,15 +515,19 @@ e_text_model_get_nth_object (ETextModel *model,
gint n,
gint *len)
{
+ ETextModelClass *class;
+
g_return_val_if_fail (E_IS_TEXT_MODEL (model), NULL);
if (n < 0 || n >= e_text_model_object_count (model))
return NULL;
- if (E_TEXT_MODEL_GET_CLASS (model)->get_nth_obj)
- return E_TEXT_MODEL_GET_CLASS (model)->get_nth_obj (model, n, len);
+ class = E_TEXT_MODEL_GET_CLASS (model);
- return NULL;
+ if (class->get_nth_obj == NULL)
+ return NULL;
+
+ return class->get_nth_obj (model, n, len);
}
gchar *
@@ -547,15 +577,18 @@ gint
e_text_model_get_object_at_offset (ETextModel *model,
gint offset)
{
+ ETextModelClass *class;
+
g_return_val_if_fail (E_IS_TEXT_MODEL (model), -1);
if (offset < 0 || offset >= e_text_model_get_text_length (model))
return -1;
- /* If an optimized version has been provided, we use it. */
- if (E_TEXT_MODEL_GET_CLASS (model)->obj_at_offset) {
+ class = E_TEXT_MODEL_GET_CLASS (model);
- return E_TEXT_MODEL_GET_CLASS (model)->obj_at_offset (model, offset);
+ /* If an optimized version has been provided, we use it. */
+ if (class->obj_at_offset != NULL) {
+ return class->obj_at_offset (model, offset);
} else {
/* If not, we fake it.*/
@@ -595,7 +628,7 @@ e_text_model_activate_nth_object (ETextModel *model,
g_return_if_fail (n >= 0);
g_return_if_fail (n < e_text_model_object_count (model));
- g_signal_emit (model, e_text_model_signals[E_TEXT_MODEL_OBJECT_ACTIVATED], 0, n);
+ g_signal_emit (model, signals[E_TEXT_MODEL_OBJECT_ACTIVATED], 0, n);
}
ETextModel *
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index 8e2149cd10..d75727fc7c 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -356,9 +356,12 @@ reset_layout_attrs (EText *text)
for (i = 0; i < object_count; i++) {
gint start_pos, end_pos;
- PangoAttribute *attr = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
+ PangoAttribute *attr;
- e_text_model_get_nth_object_bounds (text->model, i, &start_pos, &end_pos);
+ attr = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
+
+ e_text_model_get_nth_object_bounds (
+ text->model, i, &start_pos, &end_pos);
attr->start_index = g_utf8_offset_to_pointer (
text->text, start_pos) - text->text;
@@ -642,17 +645,13 @@ e_text_set_property (GObject *object,
text->model = E_TEXT_MODEL (g_value_get_object (value));
g_object_ref (text->model);
- text->model_changed_signal_id =
- g_signal_connect (text->model,
- "changed",
- G_CALLBACK (e_text_text_model_changed),
- text);
+ text->model_changed_signal_id = g_signal_connect (
+ text->model, "changed",
+ G_CALLBACK (e_text_text_model_changed), text);
- text->model_repos_signal_id =
- g_signal_connect (text->model,
- "reposition",
- G_CALLBACK (e_text_text_model_reposition),
- text);
+ text->model_repos_signal_id = g_signal_connect (
+ text->model, "reposition",
+ G_CALLBACK (e_text_text_model_reposition), text);
text->text = e_text_model_get_text (text->model);
g_signal_emit (text, e_text_signals[E_TEXT_CHANGED], 0);
@@ -670,11 +669,11 @@ e_text_set_property (GObject *object,
}
text->tep = E_TEXT_EVENT_PROCESSOR (g_value_get_object (value));
g_object_ref (text->tep);
- text->tep_command_id =
- g_signal_connect (text->tep,
- "command",
- G_CALLBACK (e_text_command),
- text);
+
+ text->tep_command_id = g_signal_connect (
+ text->tep, "command",
+ G_CALLBACK (e_text_command), text);
+
if (!text->allow_newlines)
g_object_set (text->tep,
"allow_newlines", FALSE,
@@ -1194,11 +1193,10 @@ _get_tep (EText *text)
{
if (!text->tep) {
text->tep = e_text_event_processor_emacs_like_new ();
- text->tep_command_id =
- g_signal_connect (text->tep,
- "command",
- G_CALLBACK (e_text_command),
- text);
+
+ text->tep_command_id = g_signal_connect (
+ text->tep, "command",
+ G_CALLBACK (e_text_command), text);
}
}
@@ -1397,13 +1395,15 @@ e_text_draw (GnomeCanvasItem *item,
thisheight = allocation.height - border_width * 2;
if (gtk_widget_has_default (widget) &&
- relief == GTK_RELIEF_NORMAL)
- {
- gtk_paint_box (style, cr,
- GTK_STATE_NORMAL, GTK_SHADOW_IN,
- widget, "buttondefault",
- thisx + xoff, thisy + yoff, thiswidth, thisheight);
- }
+ relief == GTK_RELIEF_NORMAL) {
+ gtk_paint_box (
+ style, cr,
+ GTK_STATE_NORMAL,
+ GTK_SHADOW_IN,
+ widget, "buttondefault",
+ thisx + xoff, thisy + yoff,
+ thiswidth, thisheight);
+ }
if (gtk_widget_get_can_default (widget)) {
thisx += style->xthickness;
@@ -1429,10 +1429,11 @@ e_text_draw (GnomeCanvasItem *item,
if ((relief != GTK_RELIEF_NONE) ||
((state != GTK_STATE_NORMAL) &&
(state != GTK_STATE_INSENSITIVE)))
- gtk_paint_box (style, cr, state,
- shadow_type, widget, "button",
- thisx + xoff, thisy + yoff,
- thiswidth, thisheight);
+ gtk_paint_box (
+ style, cr, state,
+ shadow_type, widget, "button",
+ thisx + xoff, thisy + yoff,
+ thiswidth, thisheight);
if (gtk_widget_has_focus (widget)) {
thisx -= 1;
@@ -1440,10 +1441,11 @@ e_text_draw (GnomeCanvasItem *item,
thiswidth += 2;
thisheight += 2;
- gtk_paint_focus (style, cr, state,
- widget, "button",
- thisx + xoff, thisy + yoff,
- thiswidth - 1, thisheight - 1);
+ gtk_paint_focus (
+ style, cr, state,
+ widget, "button",
+ thisx + xoff, thisy + yoff,
+ thiswidth - 1, thisheight - 1);
}
}
}
@@ -1472,10 +1474,10 @@ e_text_draw (GnomeCanvasItem *item,
cairo_save (cr);
if (text->clip) {
- cairo_rectangle (cr,
- xpos, ypos,
- text->clip_cwidth - text->xofs,
- text->clip_cheight - text->yofs);
+ cairo_rectangle (
+ cr, xpos, ypos,
+ text->clip_cwidth - text->xofs,
+ text->clip_cheight - text->yofs);
cairo_clip (cr);
}
@@ -1843,14 +1845,18 @@ e_text_event (GnomeCanvasItem *item,
if (focus_event->in) {
if (text->im_context) {
if (!text->im_context_signals_registered) {
- g_signal_connect (text->im_context, "commit",
- G_CALLBACK (e_text_commit_cb), text);
- g_signal_connect (text->im_context, "preedit_changed",
- G_CALLBACK (e_text_preedit_changed_cb), text);
- g_signal_connect (text->im_context, "retrieve_surrounding",
- G_CALLBACK (e_text_retrieve_surrounding_cb), text);
- g_signal_connect (text->im_context, "delete_surrounding",
- G_CALLBACK (e_text_delete_surrounding_cb), text);
+ g_signal_connect (
+ text->im_context, "commit",
+ G_CALLBACK (e_text_commit_cb), text);
+ g_signal_connect (
+ text->im_context, "preedit_changed",
+ G_CALLBACK (e_text_preedit_changed_cb), text);
+ g_signal_connect (
+ text->im_context, "retrieve_surrounding",
+ G_CALLBACK (e_text_retrieve_surrounding_cb), text);
+ g_signal_connect (
+ text->im_context, "delete_surrounding",
+ G_CALLBACK (e_text_delete_surrounding_cb), text);
text->im_context_signals_registered = TRUE;
}
gtk_im_context_focus_in (text->im_context);
@@ -1927,7 +1933,8 @@ e_text_event (GnomeCanvasItem *item,
e_tep_event.key.state = key.state;
e_tep_event.key.keyval = key.keyval;
- /* This is probably ugly hack, but we have to handle UTF-8 input somehow */
+ /* This is probably ugly hack, but we
+ * have to handle UTF-8 input somehow. */
#if 0
e_tep_event.key.length = key.length;
e_tep_event.key.string = key.string;
@@ -2206,11 +2213,11 @@ e_text_update_primary_selection (EText *text)
GDK_SELECTION_PRIMARY);
if (text->selection_start != text->selection_end) {
- if (!gtk_clipboard_set_with_owner (clipboard, targets, G_N_ELEMENTS (targets),
- primary_get_cb, primary_clear_cb, G_OBJECT (text)))
+ if (!gtk_clipboard_set_with_owner (
+ clipboard, targets, G_N_ELEMENTS (targets),
+ primary_get_cb, primary_clear_cb, G_OBJECT (text)))
primary_clear_cb (clipboard, text);
- }
- else {
+ } else {
if (gtk_clipboard_get_owner (clipboard) == G_OBJECT (text))
gtk_clipboard_clear (clipboard);
}
@@ -2301,8 +2308,9 @@ popup_targets_received (GtkClipboard *clipboard,
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_CUT, NULL);
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menuitem);
- g_signal_connect_swapped (menuitem, "activate",
- G_CALLBACK (e_text_cut_clipboard), text);
+ 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));
@@ -2311,16 +2319,18 @@ popup_targets_received (GtkClipboard *clipboard,
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_COPY, NULL);
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menuitem);
- g_signal_connect_swapped (menuitem, "activate",
- G_CALLBACK (e_text_copy_clipboard), text);
+ g_signal_connect_swapped (
+ menuitem, "activate",
+ G_CALLBACK (e_text_copy_clipboard), text);
gtk_widget_set_sensitive (menuitem, text->selection_start != text->selection_end);
/* paste menu item */
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_PASTE, NULL);
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menuitem);
- g_signal_connect_swapped (menuitem, "activate",
- G_CALLBACK (e_text_paste_clipboard), text);
+ 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));
@@ -2328,8 +2338,9 @@ popup_targets_received (GtkClipboard *clipboard,
menuitem = gtk_menu_item_new_with_label (_("Select All"));
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menuitem);
- g_signal_connect_swapped (menuitem, "activate",
- G_CALLBACK (e_text_select_all), text);
+ g_signal_connect_swapped (
+ menuitem, "activate",
+ G_CALLBACK (e_text_select_all), text);
gtk_widget_set_sensitive (menuitem, strlen (text->text) > 0);
menuitem = gtk_separator_menu_item_new ();
@@ -2451,7 +2462,9 @@ find_offset_into_line (EText *text,
if (*p == '\n') {
if (start_of_line)
*start_of_line = p+1;
- return offset_into_text - g_utf8_pointer_to_offset (text->text, p + 1);
+ return offset_into_text -
+ g_utf8_pointer_to_offset (
+ text->text, p + 1);
}
p = g_utf8_find_prev_char (text->text, p);
}
@@ -2689,7 +2702,10 @@ _get_position (EText *text,
break;
}
case E_TEP_BACKWARD_LINE: {
- gint offset_into_line = find_offset_into_line (text, text->selection_end, &p);
+ gint offset_into_line;
+
+ offset_into_line = find_offset_into_line (
+ text, text->selection_end, &p);
if (offset_into_line == -1)
return text->selection_end;
@@ -3131,13 +3147,13 @@ e_text_command (ETextEventProcessor *tep,
/* Class initialization function for the text item */
static void
-e_text_class_init (ETextClass *klass)
+e_text_class_init (ETextClass *class)
{
GObjectClass *gobject_class;
GnomeCanvasItemClass *item_class;
- gobject_class = (GObjectClass *) klass;
- item_class = (GnomeCanvasItemClass *) klass;
+ gobject_class = (GObjectClass *) class;
+ item_class = (GnomeCanvasItemClass *) class;
gobject_class->dispose = e_text_dispose;
gobject_class->set_property = e_text_set_property;
@@ -3151,8 +3167,8 @@ e_text_class_init (ETextClass *klass)
item_class->bounds = e_text_bounds;
item_class->event = e_text_event;
- klass->changed = NULL;
- klass->activate = NULL;
+ class->changed = NULL;
+ class->activate = NULL;
e_text_signals[E_TEXT_CHANGED] =
g_signal_new ("changed",
@@ -3432,16 +3448,13 @@ e_text_init (EText *text)
text->revert = NULL;
- text->model_changed_signal_id =
- g_signal_connect (text->model,
- "changed",
- G_CALLBACK (e_text_text_model_changed),
- text);
- text->model_repos_signal_id =
- g_signal_connect (text->model,
- "reposition",
- G_CALLBACK (e_text_text_model_reposition),
- text);
+ text->model_changed_signal_id = g_signal_connect (
+ text->model, "changed",
+ G_CALLBACK (e_text_text_model_changed), text);
+
+ text->model_repos_signal_id = g_signal_connect (
+ text->model, "reposition",
+ G_CALLBACK (e_text_text_model_reposition), text);
text->justification = GTK_JUSTIFY_LEFT;
text->clip_width = -1.0;
diff --git a/widgets/text/gal-a11y-e-text-factory.c b/widgets/text/gal-a11y-e-text-factory.c
index 8da12ee294..8e33b38562 100644
--- a/widgets/text/gal-a11y-e-text-factory.c
+++ b/widgets/text/gal-a11y-e-text-factory.c
@@ -53,9 +53,9 @@ gal_a11y_e_text_factory_create_accessible (GObject *obj)
}
static void
-gal_a11y_e_text_factory_class_init (GalA11yETextFactoryClass *klass)
+gal_a11y_e_text_factory_class_init (GalA11yETextFactoryClass *class)
{
- AtkObjectFactoryClass *factory_class = ATK_OBJECT_FACTORY_CLASS (klass);
+ AtkObjectFactoryClass *factory_class = ATK_OBJECT_FACTORY_CLASS (class);
parent_class = g_type_class_ref (PARENT_TYPE);
diff --git a/widgets/text/gal-a11y-e-text.c b/widgets/text/gal-a11y-e-text.c
index 609b23a900..ba7e7dd35f 100644
--- a/widgets/text/gal-a11y-e-text.c
+++ b/widgets/text/gal-a11y-e-text.c
@@ -1024,21 +1024,23 @@ et_real_initialize (AtkObject *obj,
etext = E_TEXT (data);
/* Set up signal callbacks */
- g_signal_connect (etext->model, "reposition",
+ g_signal_connect (
+ etext->model, "reposition",
G_CALLBACK (_et_reposition_cb), obj);
if (etext->tep)
- g_signal_connect_after (etext->tep, "command",
+ g_signal_connect_after (
+ etext->tep, "command",
(GCallback) _et_command_cb, obj);
obj->role = ATK_ROLE_TEXT;
}
static void
-et_class_init (GalA11yETextClass *klass)
+et_class_init (GalA11yETextClass *class)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+ AtkObjectClass *atk_class = ATK_OBJECT_CLASS (class);
quark_accessible_object =
g_quark_from_static_string ("gtk-accessible-object");