aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
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
parent49bc4c2d765ee1780c23fdc9f42152850dabb220 (diff)
downloadgsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.gz
gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.zst
gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.zip
Coding style and whitespace cleanup.
Diffstat (limited to 'widgets')
-rw-r--r--widgets/e-timezone-dialog/e-timezone-dialog.c105
-rw-r--r--widgets/menus/gal-define-views-dialog.c17
-rw-r--r--widgets/menus/gal-define-views-model.c12
-rw-r--r--widgets/menus/gal-view-collection.c38
-rw-r--r--widgets/menus/gal-view-etable.c23
-rw-r--r--widgets/menus/gal-view-factory-etable.c12
-rw-r--r--widgets/menus/gal-view-instance-save-as-dialog.c16
-rw-r--r--widgets/menus/gal-view-instance.c25
-rw-r--r--widgets/menus/gal-view-new-dialog.c224
-rw-r--r--widgets/misc/e-account-combo-box.c13
-rw-r--r--widgets/misc/e-action-combo-box.c11
-rw-r--r--widgets/misc/e-alert-bar.c4
-rw-r--r--widgets/misc/e-attachment-button.c9
-rw-r--r--widgets/misc/e-attachment-dialog.c11
-rw-r--r--widgets/misc/e-attachment-handler-image.c8
-rw-r--r--widgets/misc/e-attachment-handler.c7
-rw-r--r--widgets/misc/e-attachment-icon-view.c10
-rw-r--r--widgets/misc/e-attachment-paned.c37
-rw-r--r--widgets/misc/e-attachment-store.c9
-rw-r--r--widgets/misc/e-attachment-tree-view.c10
-rw-r--r--widgets/misc/e-attachment.c14
-rw-r--r--widgets/misc/e-buffer-tagger.c32
-rw-r--r--widgets/misc/e-calendar-item.c409
-rw-r--r--widgets/misc/e-canvas-background.c23
-rw-r--r--widgets/misc/e-canvas-vbox.c10
-rw-r--r--widgets/misc/e-canvas.c12
-rw-r--r--widgets/misc/e-charset-combo-box.c13
-rw-r--r--widgets/misc/e-contact-map-window.c36
-rw-r--r--widgets/misc/e-contact-map.c5
-rw-r--r--widgets/misc/e-contact-marker.c9
-rw-r--r--widgets/misc/e-dateedit.c70
-rw-r--r--widgets/misc/e-focus-tracker.c9
-rw-r--r--widgets/misc/e-image-chooser.c11
-rw-r--r--widgets/misc/e-import-assistant.c110
-rw-r--r--widgets/misc/e-map.c24
-rw-r--r--widgets/misc/e-menu-tool-button.c26
-rw-r--r--widgets/misc/e-online-button.c9
-rw-r--r--widgets/misc/e-paned.c9
-rw-r--r--widgets/misc/e-picture-gallery.c12
-rw-r--r--widgets/misc/e-popup-action.c9
-rw-r--r--widgets/misc/e-preferences-window.c31
-rw-r--r--widgets/misc/e-preview-pane.c11
-rw-r--r--widgets/misc/e-printable.c16
-rw-r--r--widgets/misc/e-search-bar.c13
-rw-r--r--widgets/misc/e-searching-tokenizer.c18
-rw-r--r--widgets/misc/e-selection-model-array.c8
-rw-r--r--widgets/misc/e-send-options.c147
-rw-r--r--widgets/misc/e-send-options.h14
-rw-r--r--widgets/misc/e-signature-combo-box.c14
-rw-r--r--widgets/misc/e-signature-editor.c11
-rw-r--r--widgets/misc/e-signature-manager.c9
-rw-r--r--widgets/misc/e-signature-preview.c9
-rw-r--r--widgets/misc/e-signature-script-dialog.c10
-rw-r--r--widgets/misc/e-signature-tree-view.c14
-rw-r--r--widgets/misc/e-url-entry.c59
-rw-r--r--widgets/misc/e-web-view-preview.c9
-rw-r--r--widgets/misc/ea-calendar-item.c14
-rw-r--r--widgets/misc/test-calendar.c15
-rw-r--r--widgets/misc/test-dateedit.c70
-rw-r--r--widgets/table/e-cell-combo.c53
-rw-r--r--widgets/table/e-cell-date-edit.c59
-rw-r--r--widgets/table/e-cell-text.c27
-rw-r--r--widgets/table/e-cell-toggle.c23
-rw-r--r--widgets/table/e-cell.c176
-rw-r--r--widgets/table/e-popup-menu.c7
-rw-r--r--widgets/table/e-table-click-to-add.c15
-rw-r--r--widgets/table/e-table-config.c15
-rw-r--r--widgets/table/e-table-extras.c9
-rw-r--r--widgets/table/e-table-field-chooser-dialog.c216
-rw-r--r--widgets/table/e-table-field-chooser-item.c6
-rw-r--r--widgets/table/e-table-field-chooser.c18
-rw-r--r--widgets/table/e-table-group-container.c82
-rw-r--r--widgets/table/e-table-group-leaf.c260
-rw-r--r--widgets/table/e-table-header-item.c119
-rw-r--r--widgets/table/e-table-header-utils.c8
-rw-r--r--widgets/table/e-table-header.c3
-rw-r--r--widgets/table/e-table-item.c46
-rw-r--r--widgets/table/e-table-memory-store.c9
-rw-r--r--widgets/table/e-table-memory.c9
-rw-r--r--widgets/table/e-table-model.c318
-rw-r--r--widgets/table/e-table-search.c9
-rw-r--r--widgets/table/e-table-sorter.c51
-rw-r--r--widgets/table/e-table-subset.c33
-rw-r--r--widgets/table/e-table-utils.c10
-rw-r--r--widgets/table/e-table-without.c15
-rw-r--r--widgets/table/e-table.c901
-rw-r--r--widgets/table/e-tree-memory.c9
-rw-r--r--widgets/table/e-tree-model.c118
-rw-r--r--widgets/table/e-tree-selection-model.c240
-rw-r--r--widgets/table/e-tree-sorted.c11
-rw-r--r--widgets/table/e-tree-table-adapter.c11
-rw-r--r--widgets/table/e-tree.c169
-rw-r--r--widgets/table/gal-a11y-e-cell-registry.c11
-rw-r--r--widgets/table/gal-a11y-e-cell-toggle.c7
-rw-r--r--widgets/table/gal-a11y-e-cell-tree.c7
-rw-r--r--widgets/table/gal-a11y-e-table-click-to-add.c18
-rw-r--r--widgets/table/gal-a11y-e-table-column-header.c9
-rw-r--r--widgets/table/gal-a11y-e-table-factory.c3
-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
106 files changed, 3173 insertions, 2657 deletions
diff --git a/widgets/e-timezone-dialog/e-timezone-dialog.c b/widgets/e-timezone-dialog/e-timezone-dialog.c
index 717a9ea024..c5ccfd3a4c 100644
--- a/widgets/e-timezone-dialog/e-timezone-dialog.c
+++ b/widgets/e-timezone-dialog/e-timezone-dialog.c
@@ -54,6 +54,10 @@
#define E_TIMEZONE_DIALOG_MAP_POINT_SELECTED_1_RGBA 0xff60e0ff
#define E_TIMEZONE_DIALOG_MAP_POINT_SELECTED_2_RGBA 0x000000ff
+#define E_TIMEZONE_DIALOG_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TIMEZONE_DIALOG, ETimezoneDialogPrivate))
+
struct _ETimezoneDialogPrivate {
/* The selected timezone. May be NULL for a 'local time' (i.e. when
* the displayed name is ""). */
@@ -78,7 +82,6 @@ struct _ETimezoneDialogPrivate {
};
static void e_timezone_dialog_dispose (GObject *object);
-static void e_timezone_dialog_finalize (GObject *object);
static gboolean get_widgets (ETimezoneDialog *etd);
static gboolean on_map_timeout (gpointer data);
@@ -118,37 +121,26 @@ e_timezone_dialog_class_init (ETimezoneDialogClass *class)
{
GObjectClass *object_class;
+ g_type_class_add_private (class, sizeof (ETimezoneDialogPrivate));
+
object_class = G_OBJECT_CLASS (class);
object_class->dispose = e_timezone_dialog_dispose;
- object_class->finalize = e_timezone_dialog_finalize;
}
/* Object initialization function for the event editor */
static void
e_timezone_dialog_init (ETimezoneDialog *etd)
{
- ETimezoneDialogPrivate *priv;
-
- priv = g_new0 (ETimezoneDialogPrivate, 1);
- etd->priv = priv;
-
- priv->point_selected = NULL;
- priv->point_hover = NULL;
- priv->timeout_id = 0;
+ etd->priv = E_TIMEZONE_DIALOG_GET_PRIVATE (etd);
}
/* Dispose handler for the event editor */
static void
e_timezone_dialog_dispose (GObject *object)
{
- ETimezoneDialog *etd;
ETimezoneDialogPrivate *priv;
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_TIMEZONE_DIALOG (object));
-
- etd = E_TIMEZONE_DIALOG (object);
- priv = etd->priv;
+ priv = E_TIMEZONE_DIALOG_GET_PRIVATE (object);
/* Destroy the actual dialog. */
if (priv->app != NULL) {
@@ -166,25 +158,8 @@ e_timezone_dialog_dispose (GObject *object)
priv->builder = NULL;
}
- (* G_OBJECT_CLASS (e_timezone_dialog_parent_class)->dispose) (object);
-}
-
-/* Finalize handler for the event editor */
-static void
-e_timezone_dialog_finalize (GObject *object)
-{
- ETimezoneDialog *etd;
- ETimezoneDialogPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_TIMEZONE_DIALOG (object));
-
- etd = E_TIMEZONE_DIALOG (object);
- priv = etd->priv;
-
- g_free (priv);
-
- (* G_OBJECT_CLASS (e_timezone_dialog_parent_class)->finalize) (object);
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (e_timezone_dialog_parent_class)->dispose (object);
}
static void
@@ -414,33 +389,39 @@ static void
format_utc_offset (gint utc_offset,
gchar *buffer)
{
- const gchar *sign = "+";
- gint hours, minutes, seconds;
-
- if (utc_offset < 0) {
- utc_offset = -utc_offset;
- sign = "-";
- }
-
- hours = utc_offset / 3600;
- minutes = (utc_offset % 3600) / 60;
- seconds = utc_offset % 60;
-
- /* Sanity check. Standard timezone offsets shouldn't be much more than 12
- hours, and daylight saving shouldn't change it by more than a few hours.
- (The maximum offset is 15 hours 56 minutes at present.) */
- if (hours < 0 || hours >= 24 || minutes < 0 || minutes >= 60
- || seconds < 0 || seconds >= 60) {
- fprintf (stderr, "Warning: Strange timezone offset: H:%i M:%i S:%i\n",
- hours, minutes, seconds);
- }
-
- if (hours == 0 && minutes == 0 && seconds == 0)
- strcpy (buffer, _("UTC"));
- else if (seconds == 0)
- sprintf (buffer, "%s %s%02i:%02i", _("UTC"), sign, hours, minutes);
- else
- sprintf (buffer, "%s %s%02i:%02i:%02i", _("UTC"), sign, hours, minutes, seconds);
+ const gchar *sign = "+";
+ gint hours, minutes, seconds;
+
+ if (utc_offset < 0) {
+ utc_offset = -utc_offset;
+ sign = "-";
+ }
+
+ hours = utc_offset / 3600;
+ minutes = (utc_offset % 3600) / 60;
+ seconds = utc_offset % 60;
+
+ /* Sanity check. Standard timezone offsets shouldn't be much more
+ * than 12 hours, and daylight saving shouldn't change it by more
+ * than a few hours. (The maximum offset is 15 hours 56 minutes
+ * at present.) */
+ if (hours < 0 || hours >= 24 || minutes < 0 || minutes >= 60
+ || seconds < 0 || seconds >= 60) {
+ fprintf (
+ stderr, "Warning: Strange timezone offset: "
+ "H:%i M:%i S:%i\n", hours, minutes, seconds);
+ }
+
+ if (hours == 0 && minutes == 0 && seconds == 0)
+ strcpy (buffer, _("UTC"));
+ else if (seconds == 0)
+ sprintf (
+ buffer, "%s %s%02i:%02i",
+ _("UTC"), sign, hours, minutes);
+ else
+ sprintf (
+ buffer, "%s %s%02i:%02i:%02i",
+ _("UTC"), sign, hours, minutes, seconds);
}
static gchar *
diff --git a/widgets/menus/gal-define-views-dialog.c b/widgets/menus/gal-define-views-dialog.c
index 1c4ff5172e..fb0d852a24 100644
--- a/widgets/menus/gal-define-views-dialog.c
+++ b/widgets/menus/gal-define-views-dialog.c
@@ -61,11 +61,11 @@ typedef struct {
G_DEFINE_TYPE (GalDefineViewsDialog, gal_define_views_dialog, GTK_TYPE_DIALOG)
static void
-gal_define_views_dialog_class_init (GalDefineViewsDialogClass *klass)
+gal_define_views_dialog_class_init (GalDefineViewsDialogClass *class)
{
GObjectClass *object_class;
- object_class = (GObjectClass *) klass;
+ object_class = (GObjectClass *) class;
object_class->set_property = gal_define_views_dialog_set_property;
object_class->get_property = gal_define_views_dialog_get_property;
@@ -130,8 +130,9 @@ gdvd_button_new_callback (GtkWidget *widget,
{
GtkWidget *view_new_dialog = gal_view_new_dialog_new (dialog->collection);
gtk_window_set_transient_for (GTK_WINDOW (view_new_dialog), GTK_WINDOW (dialog));
- g_signal_connect (view_new_dialog, "response",
- G_CALLBACK (gdvd_button_new_dialog_callback), dialog);
+ g_signal_connect (
+ view_new_dialog, "response",
+ G_CALLBACK (gdvd_button_new_dialog_callback), dialog);
gtk_widget_show (view_new_dialog);
}
@@ -280,10 +281,14 @@ gal_define_views_dialog_init (GalDefineViewsDialog *dialog)
gdvd_connect_signal (dialog, "button-new", "clicked", G_CALLBACK (gdvd_button_new_callback));
gdvd_connect_signal (dialog, "button-modify", "clicked", G_CALLBACK (gdvd_button_modify_callback));
gdvd_connect_signal (dialog, "button-delete", "clicked", G_CALLBACK (gdvd_button_delete_callback));
- g_signal_connect (dialog, "response", G_CALLBACK (dialog_response), NULL);
+ g_signal_connect (
+ dialog, "response",
+ G_CALLBACK (dialog_response), NULL);
selection = gtk_tree_view_get_selection (dialog->treeview);
- g_signal_connect (selection, "changed", G_CALLBACK (gdvd_selection_changed_callback), dialog);
+ g_signal_connect (
+ selection, "changed",
+ G_CALLBACK (gdvd_selection_changed_callback), dialog);
gdvd_selection_changed_callback (selection, dialog);
gtk_widget_show (GTK_WIDGET (dialog));
diff --git a/widgets/menus/gal-define-views-model.c b/widgets/menus/gal-define-views-model.c
index 7c69bce720..bdfd970761 100644
--- a/widgets/menus/gal-define-views-model.c
+++ b/widgets/menus/gal-define-views-model.c
@@ -131,11 +131,13 @@ gdvm_value_at (ETableModel *etc,
gint row)
{
GalDefineViewsModel *views = GAL_DEFINE_VIEWS_MODEL (etc);
+ GalView *view;
const gchar *value;
- value = gal_view_get_title (gal_view_collection_get_view (views->collection, row));
+ view = gal_view_collection_get_view (views->collection, row);
+ value = gal_view_get_title (view);
- return (gpointer)(value ? value : "");
+ return (gpointer) ((value != NULL) ? value : "");
}
/* This function sets the value at a particular point in our ETableModel. */
@@ -234,10 +236,10 @@ gal_define_views_model_append (GalDefineViewsModel *model,
}
static void
-gal_define_views_model_class_init (GalDefineViewsModelClass *klass)
+gal_define_views_model_class_init (GalDefineViewsModelClass *class)
{
- ETableModelClass *model_class = E_TABLE_MODEL_CLASS (klass);
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ ETableModelClass *model_class = E_TABLE_MODEL_CLASS (class);
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->dispose = gdvm_dispose;
object_class->set_property = gal_define_views_model_set_property;
diff --git a/widgets/menus/gal-view-collection.c b/widgets/menus/gal-view-collection.c
index 1d565d7c21..2cd26c96c5 100644
--- a/widgets/menus/gal-view-collection.c
+++ b/widgets/menus/gal-view-collection.c
@@ -190,9 +190,9 @@ gal_view_collection_dispose (GObject *object)
}
static void
-gal_view_collection_class_init (GalViewCollectionClass *klass)
+gal_view_collection_class_init (GalViewCollectionClass *class)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->dispose = gal_view_collection_dispose;
@@ -214,8 +214,8 @@ gal_view_collection_class_init (GalViewCollectionClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- klass->display_view = NULL;
- klass->changed = NULL;
+ class->display_view = NULL;
+ class->changed = NULL;
}
static void
@@ -376,9 +376,9 @@ load_single_file (GalViewCollection *collection,
item->view = gal_view_collection_real_load_view_from_file (collection, item->type, item->title, dir, fullpath);
g_free (fullpath);
if (item->view) {
- item->view_changed_id =
- g_signal_connect (item->view, "changed",
- G_CALLBACK (view_changed), item);
+ item->view_changed_id = g_signal_connect (
+ item->view, "changed",
+ G_CALLBACK (view_changed), item);
}
}
return item;
@@ -654,9 +654,9 @@ gal_view_collection_append (GalViewCollection *collection,
item->collection = collection;
g_object_ref (view);
- item->view_changed_id =
- g_signal_connect (item->view, "changed",
- G_CALLBACK (view_changed), item);
+ item->view_changed_id = g_signal_connect (
+ item->view, "changed",
+ G_CALLBACK (view_changed), item);
collection->view_data = g_renew (GalViewCollectionItem *, collection->view_data, collection->view_count + 1);
collection->view_data[collection->view_count] = item;
@@ -714,9 +714,9 @@ gal_view_collection_copy_view (GalViewCollection *collection,
item->view = gal_view_clone (view);
item->collection = collection;
- item->view_changed_id =
- g_signal_connect (item->view, "changed",
- G_CALLBACK (view_changed), item);
+ item->view_changed_id = g_signal_connect (
+ item->view, "changed",
+ G_CALLBACK (view_changed), item);
collection->view_data = g_renew (GalViewCollectionItem *, collection->view_data, collection->view_count + 1);
collection->view_data[collection->view_count] = item;
@@ -757,9 +757,9 @@ gal_view_collection_append_with_title (GalViewCollection *collection,
item->collection = collection;
g_object_ref (view);
- item->view_changed_id =
- g_signal_connect (item->view, "changed",
- G_CALLBACK (view_changed), item);
+ item->view_changed_id = g_signal_connect (
+ item->view, "changed",
+ G_CALLBACK (view_changed), item);
collection->view_data = g_renew (GalViewCollectionItem *, collection->view_data, collection->view_count + 1);
collection->view_data[collection->view_count] = item;
@@ -798,9 +798,9 @@ gal_view_collection_set_nth_view (GalViewCollection *collection,
item->changed = TRUE;
item->type = g_strdup (gal_view_get_type_code (view));
- item->view_changed_id =
- g_signal_connect (item->view, "changed",
- G_CALLBACK (view_changed), item);
+ item->view_changed_id = g_signal_connect (
+ item->view, "changed",
+ G_CALLBACK (view_changed), item);
gal_view_collection_changed (collection);
return item->id;
diff --git a/widgets/menus/gal-view-etable.c b/widgets/menus/gal-view-etable.c
index a16c72bcc0..c097db0ded 100644
--- a/widgets/menus/gal-view-etable.c
+++ b/widgets/menus/gal-view-etable.c
@@ -86,8 +86,9 @@ gal_view_etable_edit (GalView *view,
etable_view->state,
parent);
- g_signal_connect (config, "changed",
- G_CALLBACK (config_changed), view);
+ g_signal_connect (
+ config, "changed",
+ G_CALLBACK (config_changed), view);
}
static void
@@ -165,10 +166,10 @@ gal_view_etable_dispose (GObject *object)
}
static void
-gal_view_etable_class_init (GalViewEtableClass *klass)
+gal_view_etable_class_init (GalViewEtableClass *class)
{
- GalViewClass *gal_view_class = GAL_VIEW_CLASS (klass);
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GalViewClass *gal_view_class = GAL_VIEW_CLASS (class);
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
gal_view_class->edit = gal_view_etable_edit;
gal_view_class->load = gal_view_etable_load;
@@ -297,9 +298,9 @@ gal_view_etable_attach_table (GalViewEtable *view,
e_table_set_state_object (view->table, view->state);
g_object_ref (view->table);
- view->table_state_changed_id =
- g_signal_connect (view->table, "state_change",
- G_CALLBACK (table_state_changed), view);
+ view->table_state_changed_id = g_signal_connect (
+ view->table, "state_change",
+ G_CALLBACK (table_state_changed), view);
}
void
@@ -315,9 +316,9 @@ gal_view_etable_attach_tree (GalViewEtable *view,
e_tree_set_state_object (view->tree, view->state);
g_object_ref (view->tree);
- view->tree_state_changed_id =
- g_signal_connect (view->tree, "state_change",
- G_CALLBACK (tree_state_changed), view);
+ view->tree_state_changed_id = g_signal_connect (
+ view->tree, "state_change",
+ G_CALLBACK (tree_state_changed), view);
}
void
diff --git a/widgets/menus/gal-view-factory-etable.c b/widgets/menus/gal-view-factory-etable.c
index 3d5d0d23c3..8570d3c98c 100644
--- a/widgets/menus/gal-view-factory-etable.c
+++ b/widgets/menus/gal-view-factory-etable.c
@@ -31,6 +31,10 @@
#include "gal-view-etable.h"
#include "gal-view-factory-etable.h"
+#define GAL_VIEW_FACTORY_ETABLE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), GAL_TYPE_VIEW_FACTORY_ETABLE, GalViewFactoryEtablePrivate))
+
struct _GalViewFactoryEtablePrivate {
ETableSpecification *specification;
};
@@ -94,7 +98,7 @@ view_factory_etable_dispose (GObject *object)
{
GalViewFactoryEtablePrivate *priv;
- priv = GAL_VIEW_FACTORY_ETABLE (object)->priv;
+ priv = GAL_VIEW_FACTORY_ETABLE_GET_PRIVATE (object);
if (priv->specification != NULL) {
g_object_unref (priv->specification);
@@ -123,7 +127,7 @@ view_factory_etable_new_view (GalViewFactory *factory,
{
GalViewFactoryEtablePrivate *priv;
- priv = GAL_VIEW_FACTORY_ETABLE (factory)->priv;
+ priv = GAL_VIEW_FACTORY_ETABLE_GET_PRIVATE (factory);
return gal_view_etable_new (priv->specification, name);
}
@@ -161,9 +165,7 @@ gal_view_factory_etable_class_init (GalViewFactoryEtableClass *class)
static void
gal_view_factory_etable_init (GalViewFactoryEtable *factory)
{
- factory->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- factory, GAL_TYPE_VIEW_FACTORY_ETABLE,
- GalViewFactoryEtablePrivate);
+ factory->priv = GAL_VIEW_FACTORY_ETABLE_GET_PRIVATE (factory);
}
/**
diff --git a/widgets/menus/gal-view-instance-save-as-dialog.c b/widgets/menus/gal-view-instance-save-as-dialog.c
index a098e094b8..414a287f45 100644
--- a/widgets/menus/gal-view-instance-save-as-dialog.c
+++ b/widgets/menus/gal-view-instance-save-as-dialog.c
@@ -218,11 +218,11 @@ gal_view_instance_save_as_dialog_dispose (GObject *object)
/* Init functions */
static void
-gal_view_instance_save_as_dialog_class_init (GalViewInstanceSaveAsDialogClass *klass)
+gal_view_instance_save_as_dialog_class_init (GalViewInstanceSaveAsDialogClass *class)
{
GObjectClass *object_class;
- object_class = (GObjectClass *) klass;
+ object_class = (GObjectClass *) class;
object_class->set_property = gal_view_instance_save_as_dialog_set_property;
object_class->get_property = gal_view_instance_save_as_dialog_get_property;
@@ -273,9 +273,15 @@ gal_view_instance_save_as_dialog_init (GalViewInstanceSaveAsDialog *dialog)
gtk_tree_view_set_reorderable (GTK_TREE_VIEW (dialog->treeview), FALSE);
gtk_tree_view_set_headers_visible (dialog->treeview, FALSE);
- g_signal_connect (dialog->radiobutton_replace, "toggled", G_CALLBACK (gvisad_radio_toggled), dialog);
- g_signal_connect (dialog->radiobutton_create, "toggled", G_CALLBACK (gvisad_radio_toggled), dialog);
- g_signal_connect (dialog->entry_create, "changed", G_CALLBACK (gvisad_entry_changed), dialog);
+ g_signal_connect (
+ dialog->radiobutton_replace, "toggled",
+ G_CALLBACK (gvisad_radio_toggled), dialog);
+ g_signal_connect (
+ dialog->radiobutton_create, "toggled",
+ G_CALLBACK (gvisad_radio_toggled), dialog);
+ g_signal_connect (
+ dialog->entry_create, "changed",
+ G_CALLBACK (gvisad_entry_changed), dialog);
gvisad_setup_radio_buttons (dialog);
gvisad_setup_validate_button (dialog);
diff --git a/widgets/menus/gal-view-instance.c b/widgets/menus/gal-view-instance.c
index f127868ab3..84e4872955 100644
--- a/widgets/menus/gal-view-instance.c
+++ b/widgets/menus/gal-view-instance.c
@@ -144,9 +144,9 @@ connect_view (GalViewInstance *instance,
instance->current_title = g_strdup (gal_view_get_title (view));
instance->current_type = g_strdup (gal_view_get_type_code (view));
- instance->view_changed_id =
- g_signal_connect (instance->current_view, "changed",
- G_CALLBACK (view_changed), instance);
+ instance->view_changed_id = g_signal_connect (
+ instance->current_view, "changed",
+ G_CALLBACK (view_changed), instance);
gal_view_instance_display_view (instance, instance->current_view);
}
@@ -178,9 +178,9 @@ gal_view_instance_dispose (GObject *object)
}
static void
-gal_view_instance_class_init (GalViewInstanceClass *klass)
+gal_view_instance_class_init (GalViewInstanceClass *class)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->dispose = gal_view_instance_dispose;
@@ -211,8 +211,8 @@ gal_view_instance_class_init (GalViewInstanceClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- klass->display_view = NULL;
- klass->changed = NULL;
+ class->display_view = NULL;
+ class->changed = NULL;
}
static void
@@ -345,9 +345,9 @@ gal_view_instance_construct (GalViewInstance *instance,
instance->collection = collection;
if (collection)
g_object_ref (collection);
- instance->collection_changed_id =
- g_signal_connect (collection, "changed",
- G_CALLBACK (collection_changed), instance);
+ instance->collection_changed_id = g_signal_connect (
+ collection, "changed",
+ G_CALLBACK (collection_changed), instance);
if (instance_id)
instance->instance_id = g_strdup (instance_id);
@@ -448,8 +448,9 @@ gal_view_instance_save_as (GalViewInstance *instance)
g_return_if_fail (instance != NULL);
dialog = gal_view_instance_save_as_dialog_new (instance);
- g_signal_connect (dialog, "response",
- G_CALLBACK (dialog_response), instance);
+ g_signal_connect (
+ dialog, "response",
+ G_CALLBACK (dialog_response), instance);
gtk_widget_show (dialog);
}
diff --git a/widgets/menus/gal-view-new-dialog.c b/widgets/menus/gal-view-new-dialog.c
index c26619f2bd..36d742963a 100644
--- a/widgets/menus/gal-view-new-dialog.c
+++ b/widgets/menus/gal-view-new-dialog.c
@@ -33,11 +33,6 @@
#include "gal-define-views-model.h"
#include "gal-view-new-dialog.h"
-static void gal_view_new_dialog_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
-static void gal_view_new_dialog_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
-static void gal_view_new_dialog_dispose (GObject *object);
-
-/* The arguments we take */
enum {
PROP_0,
PROP_NAME,
@@ -47,29 +42,98 @@ enum {
G_DEFINE_TYPE (GalViewNewDialog, gal_view_new_dialog, GTK_TYPE_DIALOG)
static void
-gal_view_new_dialog_class_init (GalViewNewDialogClass *klass)
+gal_view_new_dialog_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- GObjectClass *object_class;
+ GalViewNewDialog *dialog;
+ GtkWidget *entry;
+
+ dialog = GAL_VIEW_NEW_DIALOG (object);
+
+ switch (property_id) {
+ case PROP_NAME:
+ entry = e_builder_get_widget(dialog->builder, "entry-name");
+ if (entry && GTK_IS_ENTRY (entry)) {
+ gtk_entry_set_text (GTK_ENTRY (entry), g_value_get_string (value));
+ }
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ return;
+ }
+}
+
+static void
+gal_view_new_dialog_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GalViewNewDialog *dialog;
+ GtkWidget *entry;
+
+ dialog = GAL_VIEW_NEW_DIALOG (object);
+
+ switch (property_id) {
+ case PROP_NAME:
+ entry = e_builder_get_widget(dialog->builder, "entry-name");
+ if (entry && GTK_IS_ENTRY (entry)) {
+ g_value_set_string (value, gtk_entry_get_text (GTK_ENTRY (entry)));
+ }
+ break;
+ case PROP_FACTORY:
+ g_value_set_object (value, dialog->selected_factory);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
- object_class = (GObjectClass *) klass;
+static void
+gal_view_new_dialog_dispose (GObject *object)
+{
+ GalViewNewDialog *gal_view_new_dialog = GAL_VIEW_NEW_DIALOG (object);
+
+ if (gal_view_new_dialog->builder)
+ g_object_unref (gal_view_new_dialog->builder);
+ gal_view_new_dialog->builder = NULL;
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (gal_view_new_dialog_parent_class)->dispose (object);
+}
+
+static void
+gal_view_new_dialog_class_init (GalViewNewDialogClass *class)
+{
+ GObjectClass *object_class;
+ object_class = G_OBJECT_CLASS (class);
object_class->set_property = gal_view_new_dialog_set_property;
object_class->get_property = gal_view_new_dialog_get_property;
- object_class->dispose = gal_view_new_dialog_dispose;
-
- g_object_class_install_property (object_class, PROP_NAME,
- g_param_spec_string ("name",
- "Name",
- NULL,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FACTORY,
- g_param_spec_object ("factory",
- "Factory",
- NULL,
- GAL_TYPE_VIEW_FACTORY,
- G_PARAM_READWRITE));
+ object_class->dispose = gal_view_new_dialog_dispose;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_NAME,
+ g_param_spec_string (
+ "name",
+ "Name",
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FACTORY,
+ g_param_spec_object (
+ "factory",
+ "Factory",
+ NULL,
+ GAL_TYPE_VIEW_FACTORY,
+ G_PARAM_READWRITE));
}
static void
@@ -111,19 +175,6 @@ gal_view_new_dialog_init (GalViewNewDialog *dialog)
dialog->selected_factory = NULL;
}
-static void
-gal_view_new_dialog_dispose (GObject *object)
-{
- GalViewNewDialog *gal_view_new_dialog = GAL_VIEW_NEW_DIALOG (object);
-
- if (gal_view_new_dialog->builder)
- g_object_unref (gal_view_new_dialog->builder);
- gal_view_new_dialog->builder = NULL;
-
- /* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (gal_view_new_dialog_parent_class)->dispose (object);
-}
-
GtkWidget *
gal_view_new_dialog_new (GalViewCollection *collection)
{
@@ -162,16 +213,10 @@ selection_func (GtkTreeSelection *selection,
if (path_currently_selected)
return TRUE;
- gtk_tree_model_get_iter (GTK_TREE_MODEL (dialog->list_store),
- &iter,
- (GtkTreePath *) path);
+ model = GTK_TREE_MODEL (dialog->list_store);
- gtk_tree_model_get (GTK_TREE_MODEL (dialog->list_store),
- &iter,
- 1, &dialog->selected_factory,
- -1);
-
- printf ("%s factory selected\n", gal_view_factory_get_title(dialog->selected_factory));
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_model_get (model, &iter, 1, &dialog->selected_factory, -1);
sensitize_ok_response (dialog);
@@ -199,15 +244,13 @@ gal_view_new_dialog_construct (GalViewNewDialog *dialog,
dialog->collection = collection;
dialog->list = e_builder_get_widget(dialog->builder,"list-type-list");
dialog->entry = e_builder_get_widget(dialog->builder, "entry-name");
- dialog->list_store = gtk_list_store_new (2,
- G_TYPE_STRING,
- G_TYPE_POINTER);
+
+ dialog->list_store = gtk_list_store_new (
+ 2, G_TYPE_STRING, G_TYPE_POINTER);
rend = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes ("factory title",
- rend,
- "text", 0,
- NULL);
+ column = gtk_tree_view_column_new_with_attributes (
+ "factory title", rend, "text", 0, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->list), column);
@@ -217,75 +260,30 @@ gal_view_new_dialog_construct (GalViewNewDialog *dialog,
GtkTreeIter iter;
g_object_ref (factory);
- gtk_list_store_append (dialog->list_store,
- &iter);
- gtk_list_store_set (dialog->list_store,
- &iter,
- 0, gal_view_factory_get_title (factory),
- 1, factory,
- -1);
+ gtk_list_store_append (
+ dialog->list_store, &iter);
+ gtk_list_store_set (
+ dialog->list_store, &iter,
+ 0, gal_view_factory_get_title (factory),
+ 1, factory,
+ -1);
}
- gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->list), GTK_TREE_MODEL (dialog->list_store));
+ gtk_tree_view_set_model (
+ GTK_TREE_VIEW (dialog->list),
+ GTK_TREE_MODEL (dialog->list_store));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->list));
- gtk_tree_selection_set_select_function (selection, selection_func, dialog, NULL);
- g_signal_connect (dialog->entry, "changed",
- G_CALLBACK (entry_changed), dialog);
+ gtk_tree_selection_set_select_function (
+ selection, selection_func, dialog, NULL);
+
+ g_signal_connect (
+ dialog->entry, "changed",
+ G_CALLBACK (entry_changed), dialog);
sensitize_ok_response (dialog);
return GTK_WIDGET (dialog);
}
-static void
-gal_view_new_dialog_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GalViewNewDialog *dialog;
- GtkWidget *entry;
-
- dialog = GAL_VIEW_NEW_DIALOG (object);
-
- switch (property_id) {
- case PROP_NAME:
- entry = e_builder_get_widget(dialog->builder, "entry-name");
- if (entry && GTK_IS_ENTRY (entry)) {
- gtk_entry_set_text (GTK_ENTRY (entry), g_value_get_string (value));
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- return;
- }
-}
-
-static void
-gal_view_new_dialog_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GalViewNewDialog *dialog;
- GtkWidget *entry;
-
- dialog = GAL_VIEW_NEW_DIALOG (object);
-
- switch (property_id) {
- case PROP_NAME:
- entry = e_builder_get_widget(dialog->builder, "entry-name");
- if (entry && GTK_IS_ENTRY (entry)) {
- g_value_set_string (value, gtk_entry_get_text (GTK_ENTRY (entry)));
- }
- break;
- case PROP_FACTORY:
- g_value_set_object (value, dialog->selected_factory);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
diff --git a/widgets/misc/e-account-combo-box.c b/widgets/misc/e-account-combo-box.c
index a649df5f8b..9c750f9ec4 100644
--- a/widgets/misc/e-account-combo-box.c
+++ b/widgets/misc/e-account-combo-box.c
@@ -27,6 +27,10 @@
#include <string.h>
+#define E_ACCOUNT_COMBO_BOX_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ACCOUNT_COMBO_BOX, EAccountComboBoxPrivate))
+
enum {
COLUMN_STRING,
COLUMN_ACCOUNT
@@ -255,7 +259,7 @@ account_combo_box_dispose (GObject *object)
{
EAccountComboBoxPrivate *priv;
- priv = E_ACCOUNT_COMBO_BOX (object)->priv;
+ priv = E_ACCOUNT_COMBO_BOX_GET_PRIVATE (object);
if (priv->account_list != NULL) {
g_signal_handlers_disconnect_by_func (
@@ -276,7 +280,7 @@ account_combo_box_finalize (GObject *object)
{
EAccountComboBoxPrivate *priv;
- priv = E_ACCOUNT_COMBO_BOX (object)->priv;
+ priv = E_ACCOUNT_COMBO_BOX_GET_PRIVATE (object);
g_hash_table_destroy (priv->index);
@@ -316,8 +320,7 @@ e_account_combo_box_init (EAccountComboBox *combo_box)
(GDestroyNotify) g_object_unref,
(GDestroyNotify) gtk_tree_row_reference_free);
- combo_box->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- combo_box, E_TYPE_ACCOUNT_COMBO_BOX, EAccountComboBoxPrivate);
+ combo_box->priv = E_ACCOUNT_COMBO_BOX_GET_PRIVATE (combo_box);
combo_box->priv->index = index;
}
@@ -364,7 +367,7 @@ e_account_combo_box_set_account_list (EAccountComboBox *combo_box,
if (account_list != NULL)
g_return_if_fail (E_IS_ACCOUNT_LIST (account_list));
- priv = combo_box->priv;
+ priv = E_ACCOUNT_COMBO_BOX_GET_PRIVATE (combo_box);
if (priv->account_list != NULL) {
g_signal_handlers_disconnect_by_func (
diff --git a/widgets/misc/e-action-combo-box.c b/widgets/misc/e-action-combo-box.c
index cd99c346fb..0747a6ed27 100644
--- a/widgets/misc/e-action-combo-box.c
+++ b/widgets/misc/e-action-combo-box.c
@@ -26,6 +26,10 @@
#include <glib/gi18n.h>
+#define E_ACTION_COMBO_BOX_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ACTION_COMBO_BOX, EActionComboBoxPrivate))
+
enum {
COLUMN_ACTION,
COLUMN_SORT
@@ -319,7 +323,7 @@ action_combo_box_get_property (GObject *object,
static void
action_combo_box_dispose (GObject *object)
{
- EActionComboBoxPrivate *priv = E_ACTION_COMBO_BOX (object)->priv;
+ EActionComboBoxPrivate *priv = E_ACTION_COMBO_BOX_GET_PRIVATE (object);
if (priv->action != NULL) {
g_object_unref (priv->action);
@@ -340,7 +344,7 @@ action_combo_box_dispose (GObject *object)
static void
action_combo_box_finalize (GObject *object)
{
- EActionComboBoxPrivate *priv = E_ACTION_COMBO_BOX (object)->priv;
+ EActionComboBoxPrivate *priv = E_ACTION_COMBO_BOX_GET_PRIVATE (object);
g_hash_table_destroy (priv->index);
@@ -431,8 +435,7 @@ e_action_combo_box_class_init (EActionComboBoxClass *class)
static void
e_action_combo_box_init (EActionComboBox *combo_box)
{
- combo_box->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- combo_box, E_TYPE_ACTION_COMBO_BOX, EActionComboBoxPrivate);
+ combo_box->priv = E_ACTION_COMBO_BOX_GET_PRIVATE (combo_box);
combo_box->priv->index = g_hash_table_new_full (
g_direct_hash, g_direct_equal,
diff --git a/widgets/misc/e-alert-bar.c b/widgets/misc/e-alert-bar.c
index 75bf55ff25..eb4afdde8c 100644
--- a/widgets/misc/e-alert-bar.c
+++ b/widgets/misc/e-alert-bar.c
@@ -25,6 +25,10 @@
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_ALERT_BAR, EAlertBarPrivate))
+#define E_ALERT_BAR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ALERT_BAR, EAlertBarPrivate))
+
/* GTK_ICON_SIZE_DIALOG is a tad too big. */
#define ICON_SIZE GTK_ICON_SIZE_DND
diff --git a/widgets/misc/e-attachment-button.c b/widgets/misc/e-attachment-button.c
index efc184b090..4847cd204a 100644
--- a/widgets/misc/e-attachment-button.c
+++ b/widgets/misc/e-attachment-button.c
@@ -27,6 +27,10 @@
#include "e-attachment-button.h"
+#define E_ATTACHMENT_BUTTON_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ATTACHMENT_BUTTON, EAttachmentButtonPrivate))
+
struct _EAttachmentButtonPrivate {
EAttachmentView *view;
@@ -450,7 +454,7 @@ attachment_button_dispose (GObject *object)
{
EAttachmentButtonPrivate *priv;
- priv = E_ATTACHMENT_BUTTON (object)->priv;
+ priv = E_ATTACHMENT_BUTTON_GET_PRIVATE (object);
if (priv->view != NULL) {
g_object_unref (priv->view);
@@ -577,8 +581,7 @@ e_attachment_button_init (EAttachmentButton *button)
GtkWidget *widget;
gint n_targets;
- button->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- button, E_TYPE_ATTACHMENT_BUTTON, EAttachmentButtonPrivate);
+ button->priv = E_ATTACHMENT_BUTTON_GET_PRIVATE (button);
/* Configure Widgets */
diff --git a/widgets/misc/e-attachment-dialog.c b/widgets/misc/e-attachment-dialog.c
index 1f31f9d5a3..9a9a1e7942 100644
--- a/widgets/misc/e-attachment-dialog.c
+++ b/widgets/misc/e-attachment-dialog.c
@@ -27,6 +27,10 @@
#include <glib/gi18n.h>
+#define E_ATTACHMENT_DIALOG_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ATTACHMENT_DIALOG, EAttachmentDialogPrivate))
+
struct _EAttachmentDialogPrivate {
EAttachment *attachment;
GtkWidget *display_name_entry;
@@ -158,7 +162,7 @@ attachment_dialog_dispose (GObject *object)
{
EAttachmentDialogPrivate *priv;
- priv = E_ATTACHMENT_DIALOG (object)->priv;
+ priv = E_ATTACHMENT_DIALOG_GET_PRIVATE (object);
if (priv->attachment != NULL) {
g_object_unref (priv->attachment);
@@ -223,7 +227,7 @@ attachment_dialog_response (GtkDialog *dialog,
if (response_id != GTK_RESPONSE_OK)
return;
- priv = E_ATTACHMENT_DIALOG (dialog)->priv;
+ priv = E_ATTACHMENT_DIALOG_GET_PRIVATE (dialog);
g_return_if_fail (E_IS_ATTACHMENT (priv->attachment));
attachment = priv->attachment;
@@ -295,8 +299,7 @@ e_attachment_dialog_init (EAttachmentDialog *dialog)
GtkWidget *container;
GtkWidget *widget;
- dialog->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- dialog, E_TYPE_ATTACHMENT_DIALOG, EAttachmentDialogPrivate);
+ dialog->priv = E_ATTACHMENT_DIALOG_GET_PRIVATE (dialog);
gtk_dialog_add_button (
GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
diff --git a/widgets/misc/e-attachment-handler-image.c b/widgets/misc/e-attachment-handler-image.c
index a66aa1d5a6..a8c29f24c0 100644
--- a/widgets/misc/e-attachment-handler-image.c
+++ b/widgets/misc/e-attachment-handler-image.c
@@ -30,6 +30,10 @@
#include <e-util/e-util.h>
+#define E_ATTACHMENT_HANDLER_IMAGE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ATTACHMENT_HANDLER_IMAGE, EAttachmentHandlerImagePrivate))
+
struct _EAttachmentHandlerImagePrivate {
gint placeholder;
};
@@ -240,7 +244,5 @@ e_attachment_handler_image_class_init (EAttachmentHandlerImageClass *class)
static void
e_attachment_handler_image_init (EAttachmentHandlerImage *handler)
{
- handler->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- handler, E_TYPE_ATTACHMENT_HANDLER_IMAGE,
- EAttachmentHandlerImagePrivate);
+ handler->priv = E_ATTACHMENT_HANDLER_IMAGE_GET_PRIVATE (handler);
}
diff --git a/widgets/misc/e-attachment-handler.c b/widgets/misc/e-attachment-handler.c
index 054cd24a1e..87b9abddb5 100644
--- a/widgets/misc/e-attachment-handler.c
+++ b/widgets/misc/e-attachment-handler.c
@@ -25,6 +25,10 @@
#include "e-attachment-handler.h"
+#define E_ATTACHMENT_HANDLER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ATTACHMENT_HANDLER, EAttachmentHandlerPrivate))
+
struct _EAttachmentHandlerPrivate {
gpointer placeholder;
};
@@ -77,8 +81,7 @@ e_attachment_handler_class_init (EAttachmentHandlerClass *class)
static void
e_attachment_handler_init (EAttachmentHandler *handler)
{
- handler->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- handler, E_TYPE_ATTACHMENT_HANDLER, EAttachmentHandlerPrivate);
+ handler->priv = E_ATTACHMENT_HANDLER_GET_PRIVATE (handler);
}
EAttachmentView *
diff --git a/widgets/misc/e-attachment-icon-view.c b/widgets/misc/e-attachment-icon-view.c
index cf14d97746..26ffe9e056 100644
--- a/widgets/misc/e-attachment-icon-view.c
+++ b/widgets/misc/e-attachment-icon-view.c
@@ -32,6 +32,10 @@
#include "e-attachment-store.h"
#include "e-attachment-view.h"
+#define E_ATTACHMENT_ICON_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ATTACHMENT_ICON_VIEW, EAttachmentIconViewPrivate))
+
struct _EAttachmentIconViewPrivate {
EAttachmentViewPrivate view_priv;
};
@@ -348,7 +352,7 @@ attachment_icon_view_get_private (EAttachmentView *view)
{
EAttachmentIconViewPrivate *priv;
- priv = E_ATTACHMENT_ICON_VIEW (view)->priv;
+ priv = E_ATTACHMENT_ICON_VIEW_GET_PRIVATE (view);
return &priv->view_priv;
}
@@ -531,9 +535,7 @@ e_attachment_icon_view_class_init (EAttachmentIconViewClass *class)
static void
e_attachment_icon_view_init (EAttachmentIconView *icon_view)
{
- icon_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- icon_view, E_TYPE_ATTACHMENT_ICON_VIEW,
- EAttachmentIconViewPrivate);
+ icon_view->priv = E_ATTACHMENT_ICON_VIEW_GET_PRIVATE (icon_view);
e_attachment_view_init (E_ATTACHMENT_VIEW (icon_view));
diff --git a/widgets/misc/e-attachment-paned.c b/widgets/misc/e-attachment-paned.c
index c5fb9b43b5..c0048fcd31 100644
--- a/widgets/misc/e-attachment-paned.c
+++ b/widgets/misc/e-attachment-paned.c
@@ -32,6 +32,10 @@
#include "e-attachment-icon-view.h"
#include "e-attachment-tree-view.h"
+#define E_ATTACHMENT_PANED_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ATTACHMENT_PANED, EAttachmentPanedPrivate))
+
#define NUM_VIEWS 2
/* Initial height of the lower pane. */
@@ -283,7 +287,7 @@ attachment_paned_dispose (GObject *object)
{
EAttachmentPanedPrivate *priv;
- priv = E_ATTACHMENT_PANED (object)->priv;
+ priv = E_ATTACHMENT_PANED_GET_PRIVATE (object);
if (priv->model != NULL) {
e_attachment_store_remove_all (E_ATTACHMENT_STORE (priv->model));
@@ -346,7 +350,7 @@ attachment_paned_constructed (GObject *object)
EAttachmentPanedPrivate *priv;
GSettings *settings;
- priv = E_ATTACHMENT_PANED (object)->priv;
+ priv = E_ATTACHMENT_PANED_GET_PRIVATE (object);
settings = g_settings_new ("org.gnome.evolution.shell");
@@ -407,7 +411,11 @@ attachment_paned_constructed (GObject *object)
G_BINDING_SYNC_CREATE);
/* Set up property-to-GSettings bindings. */
- g_settings_bind (settings, "attachment-view", object, "active-view", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (
+ settings, "attachment-view",
+ object, "active-view",
+ G_SETTINGS_BIND_DEFAULT);
+
g_object_unref (settings);
/* Chain up to parent's constructed() method. */
@@ -419,7 +427,7 @@ attachment_paned_get_private (EAttachmentView *view)
{
EAttachmentPanedPrivate *priv;
- priv = E_ATTACHMENT_PANED (view)->priv;
+ priv = E_ATTACHMENT_PANED_GET_PRIVATE (view);
view = E_ATTACHMENT_VIEW (priv->icon_view);
return e_attachment_view_get_private (view);
@@ -430,7 +438,7 @@ attachment_paned_get_store (EAttachmentView *view)
{
EAttachmentPanedPrivate *priv;
- priv = E_ATTACHMENT_PANED (view)->priv;
+ priv = E_ATTACHMENT_PANED_GET_PRIVATE (view);
view = E_ATTACHMENT_VIEW (priv->icon_view);
return e_attachment_view_get_store (view);
@@ -443,7 +451,7 @@ attachment_paned_get_path_at_pos (EAttachmentView *view,
{
EAttachmentPanedPrivate *priv;
- priv = E_ATTACHMENT_PANED (view)->priv;
+ priv = E_ATTACHMENT_PANED_GET_PRIVATE (view);
view = E_ATTACHMENT_VIEW (priv->icon_view);
return e_attachment_view_get_path_at_pos (view, x, y);
@@ -454,7 +462,7 @@ attachment_paned_get_selected_paths (EAttachmentView *view)
{
EAttachmentPanedPrivate *priv;
- priv = E_ATTACHMENT_PANED (view)->priv;
+ priv = E_ATTACHMENT_PANED_GET_PRIVATE (view);
view = E_ATTACHMENT_VIEW (priv->icon_view);
return e_attachment_view_get_selected_paths (view);
@@ -466,7 +474,7 @@ attachment_paned_path_is_selected (EAttachmentView *view,
{
EAttachmentPanedPrivate *priv;
- priv = E_ATTACHMENT_PANED (view)->priv;
+ priv = E_ATTACHMENT_PANED_GET_PRIVATE (view);
view = E_ATTACHMENT_VIEW (priv->icon_view);
return e_attachment_view_path_is_selected (view, path);
@@ -478,7 +486,7 @@ attachment_paned_select_path (EAttachmentView *view,
{
EAttachmentPanedPrivate *priv;
- priv = E_ATTACHMENT_PANED (view)->priv;
+ priv = E_ATTACHMENT_PANED_GET_PRIVATE (view);
view = E_ATTACHMENT_VIEW (priv->icon_view);
e_attachment_view_select_path (view, path);
@@ -490,7 +498,7 @@ attachment_paned_unselect_path (EAttachmentView *view,
{
EAttachmentPanedPrivate *priv;
- priv = E_ATTACHMENT_PANED (view)->priv;
+ priv = E_ATTACHMENT_PANED_GET_PRIVATE (view);
view = E_ATTACHMENT_VIEW (priv->icon_view);
e_attachment_view_unselect_path (view, path);
@@ -501,7 +509,7 @@ attachment_paned_select_all (EAttachmentView *view)
{
EAttachmentPanedPrivate *priv;
- priv = E_ATTACHMENT_PANED (view)->priv;
+ priv = E_ATTACHMENT_PANED_GET_PRIVATE (view);
view = E_ATTACHMENT_VIEW (priv->icon_view);
e_attachment_view_select_all (view);
@@ -512,7 +520,7 @@ attachment_paned_unselect_all (EAttachmentView *view)
{
EAttachmentPanedPrivate *priv;
- priv = E_ATTACHMENT_PANED (view)->priv;
+ priv = E_ATTACHMENT_PANED_GET_PRIVATE (view);
view = E_ATTACHMENT_VIEW (priv->icon_view);
e_attachment_view_unselect_all (view);
@@ -523,7 +531,7 @@ attachment_paned_update_actions (EAttachmentView *view)
{
EAttachmentPanedPrivate *priv;
- priv = E_ATTACHMENT_PANED (view)->priv;
+ priv = E_ATTACHMENT_PANED_GET_PRIVATE (view);
view = E_ATTACHMENT_VIEW (priv->icon_view);
e_attachment_view_update_actions (view);
@@ -596,8 +604,7 @@ e_attachment_paned_init (EAttachmentPaned *paned)
GtkWidget *widget;
GtkAction *action;
- paned->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- paned, E_TYPE_ATTACHMENT_PANED, EAttachmentPanedPrivate);
+ paned->priv = E_ATTACHMENT_PANED_GET_PRIVATE (paned);
paned->priv->model = e_attachment_store_new ();
/* Keep the expander label and combo box the same height. */
diff --git a/widgets/misc/e-attachment-store.c b/widgets/misc/e-attachment-store.c
index c6208b6866..95465eba81 100644
--- a/widgets/misc/e-attachment-store.c
+++ b/widgets/misc/e-attachment-store.c
@@ -31,6 +31,10 @@
#include "e-util/e-util.h"
#include "e-util/e-mktemp.h"
+#define E_ATTACHMENT_STORE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ATTACHMENT_STORE, EAttachmentStorePrivate))
+
struct _EAttachmentStorePrivate {
GHashTable *attachment_index;
@@ -95,7 +99,7 @@ attachment_store_finalize (GObject *object)
{
EAttachmentStorePrivate *priv;
- priv = E_ATTACHMENT_STORE (object)->priv;
+ priv = E_ATTACHMENT_STORE_GET_PRIVATE (object);
g_hash_table_destroy (priv->attachment_index);
@@ -164,8 +168,7 @@ e_attachment_store_init (EAttachmentStore *store)
(GDestroyNotify) g_object_unref,
(GDestroyNotify) gtk_tree_row_reference_free);
- store->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- store, E_TYPE_ATTACHMENT_STORE, EAttachmentStorePrivate);
+ store->priv = E_ATTACHMENT_STORE_GET_PRIVATE (store);
store->priv->attachment_index = attachment_index;
types[column++] = E_TYPE_ATTACHMENT; /* COLUMN_ATTACHMENT */
diff --git a/widgets/misc/e-attachment-tree-view.c b/widgets/misc/e-attachment-tree-view.c
index 7c67fdb917..59a9e43436 100644
--- a/widgets/misc/e-attachment-tree-view.c
+++ b/widgets/misc/e-attachment-tree-view.c
@@ -32,6 +32,10 @@
#include "e-attachment-store.h"
#include "e-attachment-view.h"
+#define E_ATTACHMENT_TREE_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ATTACHMENT_TREE_VIEW, EAttachmentTreeViewPrivate))
+
struct _EAttachmentTreeViewPrivate {
EAttachmentViewPrivate view_priv;
};
@@ -305,7 +309,7 @@ attachment_tree_view_get_private (EAttachmentView *view)
{
EAttachmentTreeViewPrivate *priv;
- priv = E_ATTACHMENT_TREE_VIEW (view)->priv;
+ priv = E_ATTACHMENT_TREE_VIEW_GET_PRIVATE (view);
return &priv->view_priv;
}
@@ -508,9 +512,7 @@ e_attachment_tree_view_init (EAttachmentTreeView *tree_view)
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
- tree_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- tree_view, E_TYPE_ATTACHMENT_TREE_VIEW,
- EAttachmentTreeViewPrivate);
+ tree_view->priv = E_ATTACHMENT_TREE_VIEW_GET_PRIVATE (tree_view);
e_attachment_view_init (E_ATTACHMENT_VIEW (tree_view));
diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c
index 166020596e..0678296767 100644
--- a/widgets/misc/e-attachment.c
+++ b/widgets/misc/e-attachment.c
@@ -36,6 +36,10 @@
#include "e-util/e-mktemp.h"
#include "e-attachment-store.h"
+#define E_ATTACHMENT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ATTACHMENT, EAttachmentPrivate))
+
/* Fallback Icon */
#define DEFAULT_ICON_NAME "mail-attachment"
@@ -162,7 +166,8 @@ attachment_get_default_charset (void)
charset = g_settings_get_string (settings, "composer-charset");
if (charset == NULL || *charset == '\0') {
g_free (charset);
- /* FIXME: this was "/apps/evolution/mail/format/charset", not sure it relates to "charset" */
+ /* FIXME This was "/apps/evolution/mail/format/charset",
+ * not sure it relates to "charset" */
charset = g_settings_get_string (settings, "charset");
if (charset == NULL || *charset == '\0') {
g_free (charset);
@@ -665,7 +670,7 @@ attachment_dispose (GObject *object)
{
EAttachmentPrivate *priv;
- priv = E_ATTACHMENT (object)->priv;
+ priv = E_ATTACHMENT_GET_PRIVATE (object);
if (priv->file != NULL) {
g_object_unref (priv->file);
@@ -710,7 +715,7 @@ attachment_finalize (GObject *object)
{
EAttachmentPrivate *priv;
- priv = E_ATTACHMENT (object)->priv;
+ priv = E_ATTACHMENT_GET_PRIVATE (object);
g_free (priv->disposition);
@@ -879,8 +884,7 @@ e_attachment_class_init (EAttachmentClass *class)
static void
e_attachment_init (EAttachment *attachment)
{
- attachment->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- attachment, E_TYPE_ATTACHMENT, EAttachmentPrivate);
+ attachment->priv = E_ATTACHMENT_GET_PRIVATE (attachment);
attachment->priv->cancellable = g_cancellable_new ();
attachment->priv->encrypted = CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE;
attachment->priv->signed_ = CAMEL_CIPHER_VALIDITY_SIGN_NONE;
diff --git a/widgets/misc/e-buffer-tagger.c b/widgets/misc/e-buffer-tagger.c
index cd260252de..0baa96ce69 100644
--- a/widgets/misc/e-buffer-tagger.c
+++ b/widgets/misc/e-buffer-tagger.c
@@ -565,17 +565,33 @@ e_buffer_tagger_connect (GtkTextView *textview)
set_state (buffer, E_BUFFER_TAGGER_STATE_NONE);
- g_signal_connect (buffer, "insert-text", G_CALLBACK (buffer_insert_text), NULL);
- g_signal_connect (buffer, "delete-range", G_CALLBACK (buffer_delete_range), NULL);
- g_signal_connect (buffer, "notify::cursor-position", G_CALLBACK (buffer_cursor_position), NULL);
+ g_signal_connect (
+ buffer, "insert-text",
+ G_CALLBACK (buffer_insert_text), NULL);
+ g_signal_connect (
+ buffer, "delete-range",
+ G_CALLBACK (buffer_delete_range), NULL);
+ g_signal_connect (
+ buffer, "notify::cursor-position",
+ G_CALLBACK (buffer_cursor_position), NULL);
gtk_widget_set_has_tooltip (GTK_WIDGET (textview), TRUE);
- g_signal_connect (textview, "query-tooltip", G_CALLBACK (textview_query_tooltip), NULL);
- g_signal_connect (textview, "key-press-event", G_CALLBACK (textview_key_press_event), NULL);
- g_signal_connect (textview, "event-after", G_CALLBACK (textview_event_after), NULL);
- g_signal_connect (textview, "motion-notify-event", G_CALLBACK (textview_motion_notify_event), NULL);
- g_signal_connect (textview, "visibility-notify-event", G_CALLBACK (textview_visibility_notify_event), NULL);
+ g_signal_connect (
+ textview, "query-tooltip",
+ G_CALLBACK (textview_query_tooltip), NULL);
+ g_signal_connect (
+ textview, "key-press-event",
+ G_CALLBACK (textview_key_press_event), NULL);
+ g_signal_connect (
+ textview, "event-after",
+ G_CALLBACK (textview_event_after), NULL);
+ g_signal_connect (
+ textview, "motion-notify-event",
+ G_CALLBACK (textview_motion_notify_event), NULL);
+ g_signal_connect (
+ textview, "visibility-notify-event",
+ G_CALLBACK (textview_visibility_notify_event), NULL);
}
void
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index c7f2e049d9..577741054b 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -47,150 +47,169 @@ static const gint e_calendar_item_days_in_month[12] = {
e_calendar_item_days_in_month[month] + (((month) == 1 \
&& ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))) ? 1 : 0)
-static void e_calendar_item_dispose (GObject *object);
-static void e_calendar_item_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
-static void e_calendar_item_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void e_calendar_item_realize (GnomeCanvasItem *item);
-static void e_calendar_item_unmap (GnomeCanvasItem *item);
-static void e_calendar_item_update (GnomeCanvasItem *item,
- const cairo_matrix_t *i2c,
- gint flags);
-static void e_calendar_item_draw (GnomeCanvasItem *item,
- cairo_t *cr,
- gint x,
- gint y,
- gint width,
- gint height);
-static void e_calendar_item_draw_month (ECalendarItem *calitem,
- cairo_t *cr,
- gint x,
- gint y,
- gint width,
- gint height,
- gint row,
- gint col);
-static void e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
- cairo_t *cr,
- gint width,
- gint height,
- gint row,
- gint col,
- gint year,
- gint month,
- gint start_weekday,
- gint cells_x,
- gint cells_y);
+static void e_calendar_item_dispose (GObject *object);
+static void e_calendar_item_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void e_calendar_item_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void e_calendar_item_realize (GnomeCanvasItem *item);
+static void e_calendar_item_unmap (GnomeCanvasItem *item);
+static void e_calendar_item_update (GnomeCanvasItem *item,
+ const cairo_matrix_t *i2c,
+ gint flags);
+static void e_calendar_item_draw (GnomeCanvasItem *item,
+ cairo_t *cr,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+static void e_calendar_item_draw_month (ECalendarItem *calitem,
+ cairo_t *cr,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint row,
+ gint col);
+static void e_calendar_item_draw_day_numbers
+ (ECalendarItem *calitem,
+ cairo_t *cr,
+ gint width,
+ gint height,
+ gint row,
+ gint col,
+ gint year,
+ gint month,
+ gint start_weekday,
+ gint cells_x,
+ gint cells_y);
static GnomeCanvasItem *e_calendar_item_point (GnomeCanvasItem *item,
- gdouble x,
- gdouble y,
- gint cx,
- gint cy);
-static void e_calendar_item_stop_selecting (ECalendarItem *calitem,
- guint32 time);
-static void e_calendar_item_selection_add_days (ECalendarItem *calitem,
- gint n_days,
- gboolean multi_selection);
-static gint e_calendar_item_key_press_event (ECalendarItem *item,
- GdkEvent *event);
-static gint e_calendar_item_event (GnomeCanvasItem *item,
- GdkEvent *event);
-static void e_calendar_item_bounds (GnomeCanvasItem *item, gdouble *x1, gdouble *y1,
- gdouble *x2, gdouble *y2);
-
-static gboolean e_calendar_item_button_press (ECalendarItem *calitem,
- GdkEvent *event);
-static gboolean e_calendar_item_button_release (ECalendarItem *calitem,
- GdkEvent *event);
-static gboolean e_calendar_item_motion (ECalendarItem *calitem,
- GdkEvent *event);
-
-static gboolean e_calendar_item_convert_position_to_day (ECalendarItem *calitem,
- gint x,
- gint y,
- gboolean round_empty_positions,
- gint *month_offset,
- gint *day,
- gboolean *entire_week);
-static void e_calendar_item_get_month_info (ECalendarItem *calitem,
- gint row,
- gint col,
- gint *first_day_offset,
- gint *days_in_month,
- gint *days_in_prev_month);
-static void e_calendar_item_recalc_sizes (ECalendarItem *calitem);
-
-static void e_calendar_item_get_day_style (ECalendarItem *calitem,
- gint year,
- gint month,
- gint day,
- gint day_style,
- gboolean today,
- gboolean prev_or_next_month,
- gboolean selected,
- gboolean has_focus,
- gboolean drop_target,
- GdkColor **bg_color,
- GdkColor **fg_color,
- GdkColor **box_color,
- gboolean *bold,
- gboolean *italic);
-static void e_calendar_item_check_selection_end (ECalendarItem *calitem,
- gint start_month,
- gint start_day,
- gint *end_month,
- gint *end_day);
-static void e_calendar_item_check_selection_start (ECalendarItem *calitem,
- gint *start_month,
- gint *start_day,
- gint end_month,
- gint end_day);
-static void e_calendar_item_add_days_to_selection (ECalendarItem *calitem,
- gint days);
-static void e_calendar_item_round_up_selection (ECalendarItem *calitem,
- gint *month_offset,
- gint *day);
-static void e_calendar_item_round_down_selection (ECalendarItem *calitem,
- gint *month_offset,
- gint *day);
-static gint e_calendar_item_get_inclusive_days (ECalendarItem *calitem,
- gint start_month_offset,
- gint start_day,
- gint end_month_offset,
- gint end_day);
-static void e_calendar_item_ensure_valid_day (ECalendarItem *calitem,
- gint *month_offset,
- gint *day);
-static gboolean e_calendar_item_ensure_days_visible (ECalendarItem *calitem,
- gint start_year,
- gint start_month,
- gint start_day,
- gint end_year,
- gint end_month,
- gint end_day,
- gboolean emission);
-static void e_calendar_item_show_popup_menu (ECalendarItem *calitem,
- GdkEventButton *event,
- gint month_offset);
-static void e_calendar_item_on_menu_item_activate (GtkWidget *menuitem,
- ECalendarItem *calitem);
-static void e_calendar_item_position_menu (GtkMenu *menu,
- gint *x,
- gint *y,
- gboolean *push_in,
- gpointer user_data);
-static void e_calendar_item_date_range_changed (ECalendarItem *calitem);
-static void e_calendar_item_queue_signal_emission (ECalendarItem *calitem);
-static gboolean e_calendar_item_signal_emission_idle_cb (gpointer data);
-static void e_calendar_item_set_selection_if_emission (ECalendarItem *calitem,
- const GDate *start_date,
- const GDate *end_date,
- gboolean emission);
+ gdouble x,
+ gdouble y,
+ gint cx,
+ gint cy);
+static void e_calendar_item_stop_selecting (ECalendarItem *calitem,
+ guint32 time);
+static void e_calendar_item_selection_add_days
+ (ECalendarItem *calitem,
+ gint n_days,
+ gboolean multi_selection);
+static gint e_calendar_item_key_press_event (ECalendarItem *item,
+ GdkEvent *event);
+static gint e_calendar_item_event (GnomeCanvasItem *item,
+ GdkEvent *event);
+static void e_calendar_item_bounds (GnomeCanvasItem *item,
+ gdouble *x1,
+ gdouble *y1,
+ gdouble *x2,
+ gdouble *y2);
+
+static gboolean e_calendar_item_button_press (ECalendarItem *calitem,
+ GdkEvent *event);
+static gboolean e_calendar_item_button_release (ECalendarItem *calitem,
+ GdkEvent *event);
+static gboolean e_calendar_item_motion (ECalendarItem *calitem,
+ GdkEvent *event);
+
+static gboolean e_calendar_item_convert_position_to_day
+ (ECalendarItem *calitem,
+ gint x,
+ gint y,
+ gboolean round_empty_positions,
+ gint *month_offset,
+ gint *day,
+ gboolean *entire_week);
+static void e_calendar_item_get_month_info (ECalendarItem *calitem,
+ gint row,
+ gint col,
+ gint *first_day_offset,
+ gint *days_in_month,
+ gint *days_in_prev_month);
+static void e_calendar_item_recalc_sizes (ECalendarItem *calitem);
+
+static void e_calendar_item_get_day_style (ECalendarItem *calitem,
+ gint year,
+ gint month,
+ gint day,
+ gint day_style,
+ gboolean today,
+ gboolean prev_or_next_month,
+ gboolean selected,
+ gboolean has_focus,
+ gboolean drop_target,
+ GdkColor **bg_color,
+ GdkColor **fg_color,
+ GdkColor **box_color,
+ gboolean *bold,
+ gboolean *italic);
+static void e_calendar_item_check_selection_end
+ (ECalendarItem *calitem,
+ gint start_month,
+ gint start_day,
+ gint *end_month,
+ gint *end_day);
+static void e_calendar_item_check_selection_start
+ (ECalendarItem *calitem,
+ gint *start_month,
+ gint *start_day,
+ gint end_month,
+ gint end_day);
+static void e_calendar_item_add_days_to_selection
+ (ECalendarItem *calitem,
+ gint days);
+static void e_calendar_item_round_up_selection
+ (ECalendarItem *calitem,
+ gint *month_offset,
+ gint *day);
+static void e_calendar_item_round_down_selection
+ (ECalendarItem *calitem,
+ gint *month_offset,
+ gint *day);
+static gint e_calendar_item_get_inclusive_days
+ (ECalendarItem *calitem,
+ gint start_month_offset,
+ gint start_day,
+ gint end_month_offset,
+ gint end_day);
+static void e_calendar_item_ensure_valid_day
+ (ECalendarItem *calitem,
+ gint *month_offset,
+ gint *day);
+static gboolean e_calendar_item_ensure_days_visible
+ (ECalendarItem *calitem,
+ gint start_year,
+ gint start_month,
+ gint start_day,
+ gint end_year,
+ gint end_month,
+ gint end_day,
+ gboolean emission);
+static void e_calendar_item_show_popup_menu (ECalendarItem *calitem,
+ GdkEventButton *event,
+ gint month_offset);
+static void e_calendar_item_on_menu_item_activate
+ (GtkWidget *menuitem,
+ ECalendarItem *calitem);
+static void e_calendar_item_position_menu (GtkMenu *menu,
+ gint *x,
+ gint *y,
+ gboolean *push_in,
+ gpointer user_data);
+static void e_calendar_item_date_range_changed
+ (ECalendarItem *calitem);
+static void e_calendar_item_queue_signal_emission
+ (ECalendarItem *calitem);
+static gboolean e_calendar_item_signal_emission_idle_cb
+ (gpointer data);
+static void e_calendar_item_set_selection_if_emission
+ (ECalendarItem *calitem,
+ const GDate *start_date,
+ const GDate *end_date,
+ gboolean emission);
/* Our arguments. */
enum {
@@ -1483,7 +1502,8 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
/* Get today's date, so we can highlight it. */
if (calitem->time_callback) {
- today_tm = (*calitem->time_callback) (calitem, calitem->time_callback_data);
+ today_tm = calitem->time_callback (
+ calitem, calitem->time_callback_data);
} else {
t = time (NULL);
today_tm = *localtime (&t);
@@ -1499,10 +1519,8 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
for (drow = 0; drow < 6; drow++) {
/* Draw the week number. */
if (calitem->show_week_numbers) {
- week_num = e_calendar_item_get_week_number (calitem,
- day_num,
- months[mon],
- years[mon]);
+ week_num = e_calendar_item_get_week_number (
+ calitem, day_num, months[mon], years[mon]);
text_x = cells_x - E_CALENDAR_ITEM_XPAD_BEFORE_CELLS - 1
- E_CALENDAR_ITEM_XPAD_AFTER_WEEK_NUMBERS;
@@ -1513,15 +1531,20 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
if (week_num >= 10) {
digit = week_num / 10;
text_x -= calitem->week_number_digit_widths[digit];
- num_chars += sprintf (&buffer[num_chars], get_digit_fomat (), digit);
+ num_chars += sprintf (
+ &buffer[num_chars],
+ get_digit_fomat (), digit);
}
digit = week_num % 10;
text_x -= calitem->week_number_digit_widths[digit] + 6;
- num_chars += sprintf (&buffer[num_chars], get_digit_fomat (), digit);
+ num_chars += sprintf (
+ &buffer[num_chars],
+ get_digit_fomat (), digit);
cairo_save (cr);
- gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_ACTIVE]);
+ gdk_cairo_set_source_color (
+ cr, &style->text[GTK_STATE_ACTIVE]);
pango_layout_set_font_description (layout, font_desc);
pango_layout_set_text (layout, buffer, num_chars);
cairo_move_to (cr, text_x, text_y);
@@ -1564,8 +1587,8 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
italic = FALSE;
if (calitem->style_callback)
- (*calitem->style_callback)
- (calitem,
+ calitem->style_callback (
+ calitem,
years[mon],
months[mon],
day_num,
@@ -1582,8 +1605,8 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
&italic,
calitem->style_callback_data);
else
- e_calendar_item_get_day_style
- (calitem,
+ e_calendar_item_get_day_style (
+ calitem,
years[mon],
months[mon],
day_num,
@@ -1603,9 +1626,10 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
if (bg_color) {
cairo_save (cr);
gdk_cairo_set_source_color (cr, bg_color);
- cairo_rectangle (cr, day_x , day_y,
- calitem->cell_width,
- calitem->cell_height);
+ cairo_rectangle (
+ cr, day_x , day_y,
+ calitem->cell_width,
+ calitem->cell_height);
cairo_fill (cr);
cairo_restore (cr);
}
@@ -1614,9 +1638,10 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
if (box_color) {
cairo_save (cr);
gdk_cairo_set_source_color (cr, box_color);
- cairo_rectangle (cr, day_x , day_y,
- calitem->cell_width - 1,
- calitem->cell_height - 1);
+ cairo_rectangle (
+ cr, day_x , day_y,
+ calitem->cell_width - 1,
+ calitem->cell_height - 1);
cairo_stroke (cr);
cairo_restore (cr);
}
@@ -1640,25 +1665,33 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
digit = day_num % 10;
day_x -= calitem->digit_widths[digit];
- num_chars += sprintf (&buffer[num_chars], get_digit_fomat (), digit);
+ num_chars += sprintf (
+ &buffer[num_chars],
+ get_digit_fomat (), digit);
cairo_save (cr);
if (fg_color) {
- gdk_cairo_set_source_color (cr, fg_color);
+ gdk_cairo_set_source_color (
+ cr, fg_color);
} else {
- gdk_cairo_set_source_color (cr, &style->fg[GTK_STATE_NORMAL]);
+ gdk_cairo_set_source_color (
+ cr, &style->fg[GTK_STATE_NORMAL]);
}
if (bold) {
- pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
+ pango_font_description_set_weight (
+ font_desc, PANGO_WEIGHT_BOLD);
} else {
- pango_font_description_set_weight (font_desc, PANGO_WEIGHT_NORMAL);
+ pango_font_description_set_weight (
+ font_desc, PANGO_WEIGHT_NORMAL);
}
if (italic) {
- pango_font_description_set_style (font_desc, PANGO_STYLE_ITALIC);
+ pango_font_description_set_style (
+ font_desc, PANGO_STYLE_ITALIC);
} else {
- pango_font_description_set_style (font_desc, PANGO_STYLE_NORMAL);
+ pango_font_description_set_style (
+ font_desc, PANGO_STYLE_NORMAL);
}
pango_layout_set_font_description (layout, font_desc);
@@ -1715,7 +1748,8 @@ e_calendar_item_get_week_number (ECalendarItem *calitem,
g_date_clear (&date, 1);
g_date_set_dmy (&date, day, month + 1, year);
- /* This results in a value of 0 (Monday) - 6 (Sunday). (or -1 on error - oops!!) */
+ /* This results in a value of 0 (Monday) - 6 (Sunday).
+ * (or -1 on error - oops!!) */
weekday = g_date_get_weekday (&date) - 1;
if (weekday > 0) {
@@ -1962,9 +1996,11 @@ e_calendar_item_recalc_sizes (ECalendarItem *calitem)
if (!font_desc)
font_desc = style->font_desc;
- pango_context = gtk_widget_create_pango_context (GTK_WIDGET (canvas_item->canvas));
- font_metrics = pango_context_get_metrics (pango_context, font_desc,
- pango_context_get_language (pango_context));
+ pango_context = gtk_widget_create_pango_context (
+ GTK_WIDGET (canvas_item->canvas));
+ font_metrics = pango_context_get_metrics (
+ pango_context, font_desc,
+ pango_context_get_language (pango_context));
layout = pango_layout_new (pango_context);
char_height =
@@ -2067,8 +2103,10 @@ e_calendar_item_get_day_style (ECalendarItem *calitem,
*fg_color = NULL;
*box_color = NULL;
- *bold = (day_style & E_CALENDAR_ITEM_MARK_BOLD) == E_CALENDAR_ITEM_MARK_BOLD;
- *italic = (day_style & E_CALENDAR_ITEM_MARK_ITALIC) == E_CALENDAR_ITEM_MARK_ITALIC;
+ *bold = (day_style & E_CALENDAR_ITEM_MARK_BOLD) ==
+ E_CALENDAR_ITEM_MARK_BOLD;
+ *italic = (day_style & E_CALENDAR_ITEM_MARK_ITALIC) ==
+ E_CALENDAR_ITEM_MARK_ITALIC;
if (today)
*box_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_TODAY_BOX];
@@ -3399,18 +3437,25 @@ e_calendar_item_show_popup_menu (ECalendarItem *calitem,
gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (menuitem), label);
- g_object_set_data(G_OBJECT(menuitem), "month",
- GINT_TO_POINTER (month));
+ g_object_set_data (
+ G_OBJECT (menuitem), "month",
+ GINT_TO_POINTER (month));
- g_signal_connect ((menuitem), "activate",
- G_CALLBACK (e_calendar_item_on_menu_item_activate), calitem);
+ g_signal_connect (
+ menuitem, "activate",
+ G_CALLBACK (e_calendar_item_on_menu_item_activate),
+ calitem);
}
}
- g_signal_connect (menu, "deactivate", G_CALLBACK (deactivate_menu_cb), NULL);
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
- e_calendar_item_position_menu, calitem,
- event->button, event->time);
+ g_signal_connect (
+ menu, "deactivate",
+ G_CALLBACK (deactivate_menu_cb), NULL);
+
+ gtk_menu_popup (
+ GTK_MENU (menu), NULL, NULL,
+ e_calendar_item_position_menu, calitem,
+ event->button, event->time);
}
static void
diff --git a/widgets/misc/e-canvas-background.c b/widgets/misc/e-canvas-background.c
index ea45aab4d5..a12a36471d 100644
--- a/widgets/misc/e-canvas-background.c
+++ b/widgets/misc/e-canvas-background.c
@@ -40,6 +40,10 @@
#include "e-canvas-background.h"
+#define E_CANVAS_BACKGROUND_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_CANVAS_BACKGROUND_TYPE, ECanvasBackgroundPrivate))
+
/* workaround for avoiding API broken */
#define ecb_get_type e_canvas_background_get_type
G_DEFINE_TYPE (
@@ -103,20 +107,6 @@ ecb_update (GnomeCanvasItem *item,
}
static void
-ecb_dispose (GObject *object)
-{
- ECanvasBackground *ecb = E_CANVAS_BACKGROUND (object);
-
- if (ecb->priv) {
- g_free (ecb->priv);
- ecb->priv = NULL;
- }
-
- /* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (ecb_parent_class)->dispose (object);
-}
-
-static void
ecb_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -184,7 +174,7 @@ ecb_get_property (GObject *object,
static void
ecb_init (ECanvasBackground *ecb)
{
- ecb->priv = g_new (ECanvasBackgroundPrivate, 1);
+ ecb->priv = E_CANVAS_BACKGROUND_GET_PRIVATE (ecb);
}
static void
@@ -233,7 +223,8 @@ ecb_class_init (ECanvasBackgroundClass *ecb_class)
GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (ecb_class);
GObjectClass *object_class = G_OBJECT_CLASS (ecb_class);
- object_class->dispose = ecb_dispose;
+ g_type_class_add_private (ecb_class, sizeof (ECanvasBackgroundPrivate));
+
object_class->set_property = ecb_set_property;
object_class->get_property = ecb_get_property;
diff --git a/widgets/misc/e-canvas-vbox.c b/widgets/misc/e-canvas-vbox.c
index 1b7e6ac900..db5ad51319 100644
--- a/widgets/misc/e-canvas-vbox.c
+++ b/widgets/misc/e-canvas-vbox.c
@@ -64,16 +64,16 @@ G_DEFINE_TYPE (
GNOME_TYPE_CANVAS_GROUP)
static void
-e_canvas_vbox_class_init (ECanvasVboxClass *klass)
+e_canvas_vbox_class_init (ECanvasVboxClass *class)
{
GObjectClass *object_class;
GnomeCanvasItemClass *item_class;
- object_class = (GObjectClass *) klass;
- item_class = (GnomeCanvasItemClass *) klass;
+ object_class = (GObjectClass *) class;
+ item_class = (GnomeCanvasItemClass *) class;
- klass->add_item = e_canvas_vbox_real_add_item;
- klass->add_item_start = e_canvas_vbox_real_add_item_start;
+ class->add_item = e_canvas_vbox_real_add_item;
+ class->add_item_start = e_canvas_vbox_real_add_item_start;
object_class->set_property = e_canvas_vbox_set_property;
object_class->get_property = e_canvas_vbox_get_property;
diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c
index 5e6889fa8e..91bd7c4091 100644
--- a/widgets/misc/e-canvas.c
+++ b/widgets/misc/e-canvas.c
@@ -262,11 +262,15 @@ pick_current_item (GnomeCanvas *canvas,
/* these fields don't have the same offsets in both types of events */
if (canvas->pick_event.type == GDK_ENTER_NOTIFY) {
- x = canvas->pick_event.crossing.x + canvas->scroll_x1 - canvas->zoom_xofs;
- y = canvas->pick_event.crossing.y + canvas->scroll_y1 - canvas->zoom_yofs;
+ x = canvas->pick_event.crossing.x +
+ canvas->scroll_x1 - canvas->zoom_xofs;
+ y = canvas->pick_event.crossing.y +
+ canvas->scroll_y1 - canvas->zoom_yofs;
} else {
- x = canvas->pick_event.motion.x + canvas->scroll_x1 - canvas->zoom_xofs;
- y = canvas->pick_event.motion.y + canvas->scroll_y1 - canvas->zoom_yofs;
+ x = canvas->pick_event.motion.x +
+ canvas->scroll_x1 - canvas->zoom_xofs;
+ y = canvas->pick_event.motion.y +
+ canvas->scroll_y1 - canvas->zoom_yofs;
}
/* canvas pixel coords */
diff --git a/widgets/misc/e-charset-combo-box.c b/widgets/misc/e-charset-combo-box.c
index a2ec3489f6..01a814ad10 100644
--- a/widgets/misc/e-charset-combo-box.c
+++ b/widgets/misc/e-charset-combo-box.c
@@ -30,6 +30,10 @@
#include "e-util/e-charset.h"
#include "e-util/e-util.h"
+#define E_CHARSET_COMBO_BOX_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CHARSET_COMBO_BOX, ECharsetComboBoxPrivate))
+
#define DEFAULT_CHARSET "UTF-8"
#define OTHER_VALUE G_MAXINT
@@ -221,7 +225,7 @@ charset_combo_box_dispose (GObject *object)
{
ECharsetComboBoxPrivate *priv;
- priv = E_CHARSET_COMBO_BOX (object)->priv;
+ priv = E_CHARSET_COMBO_BOX_GET_PRIVATE (object);
if (priv->action_group != NULL) {
g_object_unref (priv->action_group);
@@ -244,7 +248,7 @@ charset_combo_box_finalize (GObject *object)
{
ECharsetComboBoxPrivate *priv;
- priv = E_CHARSET_COMBO_BOX (object)->priv;
+ priv = E_CHARSET_COMBO_BOX_GET_PRIVATE (object);
g_hash_table_destroy (priv->charset_index);
@@ -257,7 +261,7 @@ charset_combo_box_changed (GtkComboBox *combo_box)
{
ECharsetComboBoxPrivate *priv;
- priv = E_CHARSET_COMBO_BOX (combo_box)->priv;
+ priv = E_CHARSET_COMBO_BOX_GET_PRIVATE (combo_box);
/* Chain up to parent's changed() method. */
GTK_COMBO_BOX_CLASS (e_charset_combo_box_parent_class)->
@@ -312,8 +316,7 @@ e_charset_combo_box_init (ECharsetComboBox *combo_box)
(GDestroyNotify) g_free,
(GDestroyNotify) g_object_unref);
- combo_box->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- combo_box, E_TYPE_CHARSET_COMBO_BOX, ECharsetComboBoxPrivate);
+ combo_box->priv = E_CHARSET_COMBO_BOX_GET_PRIVATE (combo_box);
combo_box->priv->action_group = action_group;
combo_box->priv->charset_index = charset_index;
diff --git a/widgets/misc/e-contact-map-window.c b/widgets/misc/e-contact-map-window.c
index 9612f0d6ac..87ce665793 100644
--- a/widgets/misc/e-contact-map-window.c
+++ b/widgets/misc/e-contact-map-window.c
@@ -165,7 +165,8 @@ map_contact_added_cb (EContactMap *map,
gtk_list_store_set (priv->completion_model, &iter,
0, name, -1);
- g_signal_connect (E_CONTACT_MARKER (marker), "double-clicked",
+ g_signal_connect (
+ marker, "double-clicked",
G_CALLBACK (marker_doubleclick_cb), user_data);
priv->tasks_cnt--;
@@ -342,8 +343,7 @@ e_contact_map_window_init (EContactMapWindow *window)
ChamplainView *view;
GHashTable *hash_table;
- priv = G_TYPE_INSTANCE_GET_PRIVATE (
- window, E_TYPE_CONTACT_MAP_WINDOW, EContactMapWindowPrivate);
+ priv = E_CONTACT_MAP_WINDOW_GET_PRIVATE (window);
window->priv = priv;
priv->tasks_cnt = 0;
@@ -361,15 +361,20 @@ e_contact_map_window_init (EContactMapWindow *window)
view = e_contact_map_get_view (E_CONTACT_MAP (map));
champlain_view_set_zoom_level (view, 2);
priv->map = E_CONTACT_MAP (map);
- g_signal_connect (view, "notify::zoom-level",
+ g_signal_connect (
+ view, "notify::zoom-level",
G_CALLBACK (zoom_level_changed_cb), window);
- g_signal_connect (map, "contact-added",
+ g_signal_connect (
+ map, "contact-added",
G_CALLBACK (map_contact_added_cb), window);
- g_signal_connect (map, "contact-removed",
+ g_signal_connect (
+ map, "contact-removed",
G_CALLBACK (map_contact_removed_cb), window);
- g_signal_connect (map, "geocoding-started",
+ g_signal_connect (
+ map, "geocoding-started",
G_CALLBACK (map_contact_geocoding_started_cb), window);
- g_signal_connect (map, "geocoding-failed",
+ g_signal_connect (
+ map, "geocoding-failed",
G_CALLBACK (map_contact_geocoding_failed_cb), window);
/* HBox container */
@@ -383,14 +388,16 @@ e_contact_map_window_init (EContactMapWindow *window)
/* Zoom-in button */
button = gtk_button_new_from_stock (GTK_STOCK_ZOOM_IN);
- g_signal_connect (button, "clicked",
+ g_signal_connect (
+ button, "clicked",
G_CALLBACK (contact_map_window_zoom_in_cb), window);
priv->zoom_in_btn = button;
gtk_container_add (GTK_CONTAINER (hbox), button);
/* Zoom-out button */
button = gtk_button_new_from_stock (GTK_STOCK_ZOOM_OUT);
- g_signal_connect (button, "clicked",
+ g_signal_connect (
+ button, "clicked",
G_CALLBACK (contact_map_window_zoom_out_cb), window);
priv->zoom_out_btn = button;
gtk_container_add (GTK_CONTAINER (hbox), button);
@@ -404,20 +411,23 @@ e_contact_map_window_init (EContactMapWindow *window)
gtk_entry_completion_set_model (
entry_completion, GTK_TREE_MODEL (completion_model));
gtk_entry_completion_set_text_column (entry_completion, 0);
- g_signal_connect (entry_completion, "match-selected",
+ g_signal_connect (
+ entry_completion, "match-selected",
G_CALLBACK (entry_completion_match_selected_cb), window);
/* Search entry */
entry = gtk_entry_new ();
gtk_entry_set_completion (GTK_ENTRY (entry), entry_completion);
- g_signal_connect (entry, "key-press-event",
+ g_signal_connect (
+ entry, "key-press-event",
G_CALLBACK (contact_map_window_entry_key_pressed_cb), window);
window->priv->search_entry = entry;
gtk_container_add (GTK_CONTAINER (hbox), entry);
/* Search button */
button = gtk_button_new_from_stock (GTK_STOCK_FIND);
- g_signal_connect (button, "clicked",
+ g_signal_connect (
+ button, "clicked",
G_CALLBACK (contact_map_window_find_contact_cb), window);
gtk_container_add (GTK_CONTAINER (hbox), button);
diff --git a/widgets/misc/e-contact-map.c b/widgets/misc/e-contact-map.c
index b2f6ff591e..7158aaeed5 100644
--- a/widgets/misc/e-contact-map.c
+++ b/widgets/misc/e-contact-map.c
@@ -205,7 +205,7 @@ e_contact_map_class_init (EContactMapClass *class)
{
GObjectClass *object_class;
- g_type_class_add_private (class, sizeof (EContactMap));
+ g_type_class_add_private (class, sizeof (EContactMapPrivate));
object_class = G_OBJECT_CLASS (class);
object_class->finalize = contact_map_finalize;
@@ -254,8 +254,7 @@ e_contact_map_init (EContactMap *map)
ChamplainMarkerLayer *layer;
ChamplainView *view;
- map->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- map, E_TYPE_CONTACT_MAP, EContactMapPrivate);
+ map->priv = E_CONTACT_MAP_GET_PRIVATE (map);
hash_table = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) g_free, NULL);
diff --git a/widgets/misc/e-contact-marker.c b/widgets/misc/e-contact-marker.c
index 7d7f57db25..2f7c2cbf45 100644
--- a/widgets/misc/e-contact-marker.c
+++ b/widgets/misc/e-contact-marker.c
@@ -546,8 +546,7 @@ e_contact_marker_init (EContactMarker *marker)
{
EContactMarkerPrivate *priv;
- priv = G_TYPE_INSTANCE_GET_PRIVATE (
- marker, E_TYPE_CONTACT_MARKER, EContactMarkerPrivate);
+ priv = E_CONTACT_MARKER_GET_PRIVATE (marker);
marker->priv = priv;
priv->contact_uid = NULL;
@@ -565,9 +564,11 @@ e_contact_marker_init (EContactMarker *marker)
priv->total_width = 0;
priv->total_height = 0;
- g_signal_connect (marker, "notify::selected",
+ g_signal_connect (
+ marker, "notify::selected",
G_CALLBACK (notify_selected), NULL);
- g_signal_connect (CLUTTER_ACTOR (marker), "button-release-event",
+ g_signal_connect (
+ marker, "button-release-event",
G_CALLBACK (contact_marker_clicked_cb), NULL);
}
diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c
index 970a06b402..4513aec28f 100644
--- a/widgets/misc/e-dateedit.c
+++ b/widgets/misc/e-dateedit.c
@@ -43,6 +43,10 @@
#include <e-util/e-util.h>
#include "e-calendar.h"
+#define E_DATE_EDIT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_DATE_EDIT, EDateEditPrivate))
+
struct _EDateEditPrivate {
GtkWidget *date_entry;
GtkWidget *date_button;
@@ -451,8 +455,7 @@ e_date_edit_class_init (EDateEditClass *class)
static void
e_date_edit_init (EDateEdit *dedit)
{
- dedit->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- dedit, E_TYPE_DATE_EDIT, EDateEditPrivate);
+ dedit->priv = E_DATE_EDIT_GET_PRIVATE (dedit);
dedit->priv->show_date = TRUE;
dedit->priv->show_time = TRUE;
@@ -524,20 +527,20 @@ create_children (EDateEdit *dedit)
gtk_box_pack_start (GTK_BOX (dedit), priv->date_entry, FALSE, TRUE, 0);
gtk_widget_set_size_request (priv->date_entry, 100, -1);
- g_signal_connect (priv->date_entry, "key_press_event",
- G_CALLBACK (on_date_entry_key_press),
- dedit);
- g_signal_connect (priv->date_entry, "key_release_event",
- G_CALLBACK (on_date_entry_key_release),
- dedit);
- g_signal_connect_after (priv->date_entry,
- "focus_out_event",
- G_CALLBACK (on_date_entry_focus_out),
- dedit);
+ g_signal_connect (
+ priv->date_entry, "key_press_event",
+ G_CALLBACK (on_date_entry_key_press), dedit);
+ g_signal_connect (
+ priv->date_entry, "key_release_event",
+ G_CALLBACK (on_date_entry_key_release), dedit);
+ g_signal_connect_after (
+ priv->date_entry, "focus_out_event",
+ G_CALLBACK (on_date_entry_focus_out), dedit);
priv->date_button = gtk_button_new ();
- g_signal_connect (priv->date_button, "clicked",
- G_CALLBACK (on_date_button_clicked), dedit);
+ g_signal_connect (
+ priv->date_button, "clicked",
+ G_CALLBACK (on_date_button_clicked), dedit);
gtk_box_pack_start (GTK_BOX (dedit), priv->date_button,
FALSE, FALSE, 0);
a11y = gtk_widget_get_accessible (priv->date_button);
@@ -620,15 +623,15 @@ create_children (EDateEdit *dedit)
gtk_widget_set_events (priv->cal_popup,
gtk_widget_get_events (priv->cal_popup)
| GDK_KEY_PRESS_MASK);
- g_signal_connect (priv->cal_popup, "delete_event",
- G_CALLBACK (on_date_popup_delete_event),
- dedit);
- g_signal_connect (priv->cal_popup, "key_press_event",
- G_CALLBACK (on_date_popup_key_press),
- dedit);
- g_signal_connect (priv->cal_popup, "button_press_event",
- G_CALLBACK (on_date_popup_button_press),
- dedit);
+ g_signal_connect (
+ priv->cal_popup, "delete_event",
+ G_CALLBACK (on_date_popup_delete_event), dedit);
+ g_signal_connect (
+ priv->cal_popup, "key_press_event",
+ G_CALLBACK (on_date_popup_key_press), dedit);
+ g_signal_connect (
+ priv->cal_popup, "button_press_event",
+ G_CALLBACK (on_date_popup_button_press), dedit);
gtk_window_set_resizable (GTK_WINDOW (priv->cal_popup), TRUE);
frame = gtk_frame_new (NULL);
@@ -647,9 +650,9 @@ create_children (EDateEdit *dedit)
"move_selection_when_moving", FALSE,
NULL);
- g_signal_connect (calendar->calitem,
- "selection_changed",
- G_CALLBACK (on_date_popup_date_selected), dedit);
+ g_signal_connect (
+ calendar->calitem, "selection_changed",
+ G_CALLBACK (on_date_popup_date_selected), dedit);
gtk_box_pack_start (GTK_BOX (vbox), priv->calendar, FALSE, FALSE, 0);
gtk_widget_show (priv->calendar);
@@ -663,21 +666,24 @@ create_children (EDateEdit *dedit)
priv->now_button = gtk_button_new_with_mnemonic (_("No_w"));
gtk_container_add (GTK_CONTAINER (bbox), priv->now_button);
gtk_widget_show (priv->now_button);
- g_signal_connect (priv->now_button, "clicked",
- G_CALLBACK (on_date_popup_now_button_clicked), dedit);
+ g_signal_connect (
+ priv->now_button, "clicked",
+ G_CALLBACK (on_date_popup_now_button_clicked), dedit);
priv->today_button = gtk_button_new_with_mnemonic (_("_Today"));
gtk_container_add (GTK_CONTAINER (bbox), priv->today_button);
gtk_widget_show (priv->today_button);
- g_signal_connect (priv->today_button, "clicked",
- G_CALLBACK (on_date_popup_today_button_clicked), dedit);
+ g_signal_connect (
+ priv->today_button, "clicked",
+ G_CALLBACK (on_date_popup_today_button_clicked), dedit);
/* Note that we don't show this here, since by default a 'None' date
* is not permitted. */
priv->none_button = gtk_button_new_with_mnemonic (_("_None"));
gtk_container_add (GTK_CONTAINER (bbox), priv->none_button);
- g_signal_connect (priv->none_button, "clicked",
- G_CALLBACK (on_date_popup_none_button_clicked), dedit);
+ g_signal_connect (
+ priv->none_button, "clicked",
+ G_CALLBACK (on_date_popup_none_button_clicked), dedit);
g_object_bind_property (
dedit, "allow-no-date-set",
priv->none_button, "visible",
diff --git a/widgets/misc/e-focus-tracker.c b/widgets/misc/e-focus-tracker.c
index 1e7082b207..505d991a2f 100644
--- a/widgets/misc/e-focus-tracker.c
+++ b/widgets/misc/e-focus-tracker.c
@@ -29,6 +29,10 @@
#include <misc/e-selectable.h>
+#define E_FOCUS_TRACKER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_FOCUS_TRACKER, EFocusTrackerPrivate))
+
struct _EFocusTrackerPrivate {
GtkWidget *focus; /* not referenced */
GtkWindow *window;
@@ -356,7 +360,7 @@ focus_tracker_dispose (GObject *object)
{
EFocusTrackerPrivate *priv;
- priv = E_FOCUS_TRACKER (object)->priv;
+ priv = E_FOCUS_TRACKER_GET_PRIVATE (object);
g_signal_handlers_disconnect_matched (
gtk_clipboard_get (GDK_SELECTION_PRIMARY),
@@ -538,8 +542,7 @@ e_focus_tracker_init (EFocusTracker *focus_tracker)
{
GtkAction *action;
- focus_tracker->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- focus_tracker, E_TYPE_FOCUS_TRACKER, EFocusTrackerPrivate);
+ focus_tracker->priv = E_FOCUS_TRACKER_GET_PRIVATE (focus_tracker);
/* Define dummy actions. These will most likely be overridden,
* but for cases where they're not it ensures ESelectable objects
diff --git a/widgets/misc/e-image-chooser.c b/widgets/misc/e-image-chooser.c
index 932d4ebc51..5fe6941d58 100644
--- a/widgets/misc/e-image-chooser.c
+++ b/widgets/misc/e-image-chooser.c
@@ -32,6 +32,10 @@
#include "e-util/e-util.h"
#include "e-util/e-icon-factory.h"
+#define E_IMAGE_CHOOSER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_IMAGE_CHOOSER, EImageChooserPrivate))
+
struct _EImageChooserPrivate {
GtkWidget *frame;
GtkWidget *image;
@@ -372,7 +376,7 @@ image_chooser_dispose (GObject *object)
{
EImageChooserPrivate *priv;
- priv = E_IMAGE_CHOOSER (object)->priv;
+ priv = E_IMAGE_CHOOSER_GET_PRIVATE (object);
if (priv->frame != NULL) {
g_object_unref (priv->frame);
@@ -393,7 +397,7 @@ image_chooser_finalize (GObject *object)
{
EImageChooserPrivate *priv;
- priv = E_IMAGE_CHOOSER (object)->priv;
+ priv = E_IMAGE_CHOOSER_GET_PRIVATE (object);
g_free (priv->image_buf);
g_free (priv->icon_name);
@@ -442,8 +446,7 @@ e_image_chooser_init (EImageChooser *chooser)
GtkWidget *container;
GtkWidget *widget;
- chooser->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- chooser, E_TYPE_IMAGE_CHOOSER, EImageChooserPrivate);
+ chooser->priv = E_IMAGE_CHOOSER_GET_PRIVATE (chooser);
container = GTK_WIDGET (chooser);
diff --git a/widgets/misc/e-import-assistant.c b/widgets/misc/e-import-assistant.c
index a2588cd075..6bda3952b2 100644
--- a/widgets/misc/e-import-assistant.c
+++ b/widgets/misc/e-import-assistant.c
@@ -37,6 +37,10 @@
#include <e-util/e-import.h>
#include <e-util/e-util-private.h>
+#define E_IMPORT_ASSISTANT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_IMPORT_ASSISTANT, EImportAssistantPrivate))
+
typedef struct _ImportFilePage ImportFilePage;
typedef struct _ImportDestinationPage ImportDestinationPage;
typedef struct _ImportTypePage ImportTypePage;
@@ -147,12 +151,15 @@ filename_changed (GtkWidget *widget,
const gchar *filename;
gint fileok;
- priv = E_IMPORT_ASSISTANT (assistant)->priv;
+ priv = E_IMPORT_ASSISTANT_GET_PRIVATE (assistant);
page = &priv->file_page;
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
- fileok = filename && filename[0] && g_file_test (filename, G_FILE_TEST_IS_REGULAR);
+ fileok =
+ filename != NULL && *filename != '\0' &&
+ g_file_test (filename, G_FILE_TEST_IS_REGULAR);
+
if (fileok) {
GtkTreeIter iter;
GtkTreeModel *model;
@@ -219,7 +226,7 @@ filetype_changed_cb (GtkComboBox *combo_box,
GtkTreeModel *model;
GtkTreeIter iter;
- priv = E_IMPORT_ASSISTANT (assistant)->priv;
+ priv = E_IMPORT_ASSISTANT_GET_PRIVATE (assistant);
g_return_if_fail (gtk_combo_box_get_active_iter (combo_box, &iter));
@@ -503,7 +510,7 @@ prepare_intelligent_page (GtkAssistant *assistant,
gint row;
ImportSelectionPage *page;
- priv = E_IMPORT_ASSISTANT (assistant)->priv;
+ priv = E_IMPORT_ASSISTANT_GET_PRIVATE (assistant);
page = &priv->selection_page;
if (page->target != NULL) {
@@ -666,7 +673,7 @@ prepare_file_page (GtkAssistant *assistant,
GtkListStore *store;
ImportFilePage *page;
- priv = E_IMPORT_ASSISTANT (assistant)->priv;
+ priv = E_IMPORT_ASSISTANT_GET_PRIVATE (assistant);
page = &priv->file_page;
if (page->target != NULL) {
@@ -729,7 +736,7 @@ prepare_destination_page (GtkAssistant *assistant,
EImportAssistantPrivate *priv;
ImportDestinationPage *page;
- priv = E_IMPORT_ASSISTANT (assistant)->priv;
+ priv = E_IMPORT_ASSISTANT_GET_PRIVATE (assistant);
page = &priv->destination_page;
if (page->control)
@@ -756,7 +763,7 @@ prepare_progress_page (GtkAssistant *assistant,
gboolean intelligent_import;
gboolean is_simple = FALSE;
- priv = E_IMPORT_ASSISTANT (assistant)->priv;
+ priv = E_IMPORT_ASSISTANT_GET_PRIVATE (assistant);
page = &priv->selection_page;
/* Because we're a GTK_ASSISTANT_PAGE_PROGRESS, this will
@@ -820,7 +827,7 @@ simple_filetype_changed_cb (GtkComboBox *combo_box,
GtkWidget *vbox;
GtkWidget *control;
- priv = E_IMPORT_ASSISTANT (assistant)->priv;
+ priv = E_IMPORT_ASSISTANT_GET_PRIVATE (assistant);
page = &priv->simple_page;
g_return_if_fail (gtk_combo_box_get_active_iter (combo_box, &iter));
@@ -864,7 +871,7 @@ prepare_simple_page (GtkAssistant *assistant,
ImportSimplePage *page;
gchar *uri;
- priv = E_IMPORT_ASSISTANT (assistant)->priv;
+ priv = E_IMPORT_ASSISTANT_GET_PRIVATE (assistant);
page = &priv->simple_page;
g_return_if_fail (priv->fileuris != NULL);
@@ -942,7 +949,7 @@ prepare_simple_destination_page (GtkAssistant *assistant,
ImportDestinationPage *page;
ImportSimplePage *simple_page;
- priv = E_IMPORT_ASSISTANT (assistant)->priv;
+ priv = E_IMPORT_ASSISTANT_GET_PRIVATE (assistant);
page = &priv->destination_page;
simple_page = &priv->simple_page;
@@ -1004,7 +1011,7 @@ set_import_uris (EImportAssistant *assistant,
g_return_val_if_fail (assistant->priv->import != NULL, FALSE);
g_return_val_if_fail (uris != NULL, FALSE);
- priv = E_IMPORT_ASSISTANT (assistant)->priv;
+ priv = E_IMPORT_ASSISTANT_GET_PRIVATE (assistant);
for (i = 0; uris[i]; i++) {
const gchar *uri = uris[i];
@@ -1014,7 +1021,8 @@ set_import_uris (EImportAssistant *assistant,
if (!filename)
filename = g_strdup (uri);
- if (filename && *filename && g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
+ if (filename && *filename &&
+ g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
gchar *furi;
if (!g_path_is_absolute (filename)) {
@@ -1069,11 +1077,49 @@ set_import_uris (EImportAssistant *assistant,
}
static void
+import_assistant_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EImportAssistantPrivate *priv;
+
+ priv = E_IMPORT_ASSISTANT_GET_PRIVATE (object);
+
+ switch (property_id) {
+ case PROP_IS_SIMPLE:
+ priv->is_simple = g_value_get_boolean (value);
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+import_assistant_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EImportAssistantPrivate *priv;
+
+ priv = E_IMPORT_ASSISTANT_GET_PRIVATE (object);
+
+ switch (property_id) {
+ case PROP_IS_SIMPLE:
+ g_value_set_boolean (value, priv->is_simple);
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
import_assistant_dispose (GObject *object)
{
EImportAssistantPrivate *priv;
- priv = E_IMPORT_ASSISTANT (object)->priv;
+ priv = E_IMPORT_ASSISTANT_GET_PRIVATE (object);
if (priv->file_page.target != NULL) {
e_import_target_free (
@@ -1116,7 +1162,7 @@ import_assistant_finalize (GObject *object)
{
EImportAssistantPrivate *priv;
- priv = E_IMPORT_ASSISTANT (object)->priv;
+ priv = E_IMPORT_ASSISTANT_GET_PRIVATE (object);
g_slist_free (priv->selection_page.importers);
@@ -1124,37 +1170,6 @@ import_assistant_finalize (GObject *object)
G_OBJECT_CLASS (e_import_assistant_parent_class)->finalize (object);
}
-static void
-import_assistant_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- switch (property_id) {
- case PROP_IS_SIMPLE:
- E_IMPORT_ASSISTANT (object)->priv->is_simple = g_value_get_boolean (value);
- return;
- }
-
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
-static void
-import_assistant_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- switch (property_id) {
- case PROP_IS_SIMPLE:
- g_value_set_boolean (value,
- E_IMPORT_ASSISTANT (object)->priv->is_simple);
- return;
- }
-
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
static gboolean
import_assistant_key_press_event (GtkWidget *widget,
GdkEventKey *event)
@@ -1372,9 +1387,8 @@ import_assistant_construct (EImportAssistant *import_assistant)
static void
e_import_assistant_init (EImportAssistant *import_assistant)
{
- import_assistant->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- import_assistant, E_TYPE_IMPORT_ASSISTANT,
- EImportAssistantPrivate);
+ import_assistant->priv =
+ E_IMPORT_ASSISTANT_GET_PRIVATE (import_assistant);
}
GtkWidget *
diff --git a/widgets/misc/e-map.c b/widgets/misc/e-map.c
index a239709415..1d114d0c07 100644
--- a/widgets/misc/e-map.c
+++ b/widgets/misc/e-map.c
@@ -36,6 +36,10 @@
#include "e-map.h"
+#define E_MAP_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAP, EMapPrivate))
+
#define E_MAP_TWEEN_TIMEOUT_MSECS 25
#define E_MAP_TWEEN_DURATION_MSECS 150
@@ -563,9 +567,6 @@ e_map_finalize (GObject *object)
/* gone in unrealize */
g_assert (map->priv->map_render_surface == NULL);
- g_free (map->priv);
- map->priv = NULL;
-
G_OBJECT_CLASS (e_map_parent_class)->finalize (object);
}
@@ -807,10 +808,12 @@ e_map_class_init (EMapClass *class)
GObjectClass *object_class;
GtkWidgetClass *widget_class;
+ g_type_class_add_private (class, sizeof (EMapPrivate));
+
object_class = G_OBJECT_CLASS (class);
- object_class->finalize = e_map_finalize;
object_class->set_property = e_map_set_property;
object_class->get_property = e_map_get_property;
+ object_class->finalize = e_map_finalize;
/* Scrollable interface properties */
g_object_class_override_property (
@@ -846,7 +849,7 @@ e_map_init (EMap *map)
widget = GTK_WIDGET (map);
- map->priv = g_new0 (EMapPrivate, 1);
+ map->priv = E_MAP_GET_PRIVATE (map);
load_map_background (map, map_file_name);
g_free (map_file_name);
@@ -1244,10 +1247,12 @@ update_render_surface (EMap *map,
/* Scale the original map into the rendering pixbuf */
- if (width > 1 && height > 1)
- {
+ if (width > 1 && height > 1) {
cairo_t *cr = cairo_create (map->priv->map_render_surface);
- cairo_scale (cr, (gdouble) width / orig_width, (gdouble) height / orig_height);
+ cairo_scale (
+ cr,
+ (gdouble) width / orig_width,
+ (gdouble) height / orig_height);
gdk_cairo_set_source_pixbuf (cr, map->priv->map_pixbuf, 0, 0);
cairo_paint (cr);
cairo_destroy (cr);
@@ -1260,8 +1265,7 @@ update_render_surface (EMap *map,
if (render_overlays) {
/* Add points */
- for (i = 0; i < map->priv->points->len; i++)
- {
+ for (i = 0; i < map->priv->points->len; i++) {
point = g_ptr_array_index (map->priv->points, i);
update_render_point (map, point);
}
diff --git a/widgets/misc/e-menu-tool-button.c b/widgets/misc/e-menu-tool-button.c
index 5a052a1844..c2a68d0c05 100644
--- a/widgets/misc/e-menu-tool-button.c
+++ b/widgets/misc/e-menu-tool-button.c
@@ -25,16 +25,19 @@
#include "e-menu-tool-button.h"
+#define E_MENU_TOOL_BUTTON_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MENU_TOOL_BUTTON, EMenuToolButtonPrivate))
+
+struct _EMenuToolButtonPrivate {
+ gchar *prefer_item;
+};
+
enum {
PROP_0,
PROP_PREFER_ITEM
};
-struct _EMenuToolButtonPrivate
-{
- gchar *prefer_item;
-};
-
G_DEFINE_TYPE (
EMenuToolButton,
e_menu_tool_button,
@@ -73,8 +76,9 @@ menu_tool_button_get_prefer_menu_item (GtkMenuToolButton *menu_tool_button)
if (children == NULL)
return NULL;
- prefer_item = e_menu_tool_button_get_prefer_item (E_MENU_TOOL_BUTTON (menu_tool_button));
- if (prefer_item && *prefer_item) {
+ prefer_item = e_menu_tool_button_get_prefer_item (
+ E_MENU_TOOL_BUTTON (menu_tool_button));
+ if (prefer_item != NULL && *prefer_item != '\0') {
GtkAction *action;
GList *iter;
@@ -84,7 +88,8 @@ menu_tool_button_get_prefer_menu_item (GtkMenuToolButton *menu_tool_button)
if (!item)
continue;
- action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (item));
+ action = gtk_activatable_get_related_action (
+ GTK_ACTIVATABLE (item));
if (action && g_strcmp0 (gtk_action_get_name (action), prefer_item) == 0)
break;
else if (!action && g_strcmp0 (gtk_widget_get_name (GTK_WIDGET (item)), prefer_item) == 0)
@@ -227,8 +232,7 @@ e_menu_tool_button_class_init (EMenuToolButtonClass *class)
static void
e_menu_tool_button_init (EMenuToolButton *button)
{
- button->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- button, E_TYPE_MENU_TOOL_BUTTON, EMenuToolButtonPrivate);
+ button->priv = E_MENU_TOOL_BUTTON_GET_PRIVATE (button);
button->priv->prefer_item = NULL;
@@ -245,7 +249,7 @@ e_menu_tool_button_new (const gchar *label)
void
e_menu_tool_button_set_prefer_item (EMenuToolButton *button,
- const gchar *prefer_item)
+ const gchar *prefer_item)
{
g_return_if_fail (button != NULL);
g_return_if_fail (E_IS_MENU_TOOL_BUTTON (button));
diff --git a/widgets/misc/e-online-button.c b/widgets/misc/e-online-button.c
index 351413e954..07ff998dc3 100644
--- a/widgets/misc/e-online-button.c
+++ b/widgets/misc/e-online-button.c
@@ -23,6 +23,10 @@
#include <glib/gi18n.h>
+#define E_ONLINE_BUTTON_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ONLINE_BUTTON, EOnlineButtonPrivate))
+
#define ONLINE_TOOLTIP \
_("Evolution is currently online. Click this button to work offline.")
@@ -101,7 +105,7 @@ online_button_dispose (GObject *object)
{
EOnlineButtonPrivate *priv;
- priv = E_ONLINE_BUTTON (object)->priv;
+ priv = E_ONLINE_BUTTON_GET_PRIVATE (object);
if (priv->image != NULL) {
g_object_unref (priv->image);
@@ -141,8 +145,7 @@ e_online_button_init (EOnlineButton *button)
{
GtkWidget *widget;
- button->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- button, E_TYPE_ONLINE_BUTTON, EOnlineButtonPrivate);
+ button->priv = E_ONLINE_BUTTON_GET_PRIVATE (button);
gtk_widget_set_can_focus (GTK_WIDGET (button), FALSE);
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
diff --git a/widgets/misc/e-paned.c b/widgets/misc/e-paned.c
index c90d40c140..3b8f16bbec 100644
--- a/widgets/misc/e-paned.c
+++ b/widgets/misc/e-paned.c
@@ -27,6 +27,10 @@
#include <glib/gi18n-lib.h>
+#define E_PANED_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_PANED, EPanedPrivate))
+
#define SYNC_REQUEST_NONE 0
#define SYNC_REQUEST_POSITION 1
#define SYNC_REQUEST_PROPORTION 2
@@ -224,7 +228,7 @@ paned_realize (GtkWidget *widget)
GdkWindowState state;
GdkWindow *window;
- priv = E_PANED (widget)->priv;
+ priv = E_PANED_GET_PRIVATE (widget);
/* Chain up to parent's realize() method. */
GTK_WIDGET_CLASS (e_paned_parent_class)->realize (widget);
@@ -367,8 +371,7 @@ e_paned_class_init (EPanedClass *class)
static void
e_paned_init (EPaned *paned)
{
- paned->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- paned, E_TYPE_PANED, EPanedPrivate);
+ paned->priv = E_PANED_GET_PRIVATE (paned);
paned->priv->proportion = 0.5;
paned->priv->fixed_resize = TRUE;
diff --git a/widgets/misc/e-picture-gallery.c b/widgets/misc/e-picture-gallery.c
index a742a5e37c..372e70146c 100644
--- a/widgets/misc/e-picture-gallery.c
+++ b/widgets/misc/e-picture-gallery.c
@@ -27,6 +27,10 @@
#include "e-picture-gallery.h"
+#define E_PICTURE_GALLERY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_PICTURE_GALLERY, EPictureGalleryPrivate))
+
struct _EPictureGalleryPrivate {
gboolean initialized;
gchar *path;
@@ -262,7 +266,10 @@ picture_gallery_start_loading_cb (EPictureGallery *gallery)
g_object_unref (file);
if (gallery->priv->monitor)
- g_signal_connect (gallery->priv->monitor, "changed", G_CALLBACK (picture_gallery_dir_changed_cb), gallery);
+ g_signal_connect (
+ gallery->priv->monitor, "changed",
+ G_CALLBACK (picture_gallery_dir_changed_cb),
+ gallery);
}
g_object_unref (icon_view);
@@ -414,8 +421,7 @@ e_picture_gallery_class_init (EPictureGalleryClass *class)
static void
e_picture_gallery_init (EPictureGallery *gallery)
{
- gallery->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- gallery, E_TYPE_PICTURE_GALLERY, EPictureGalleryPrivate);
+ gallery->priv = E_PICTURE_GALLERY_GET_PRIVATE (gallery);
gallery->priv->initialized = FALSE;
gallery->priv->monitor = NULL;
picture_gallery_set_path (gallery, NULL);
diff --git a/widgets/misc/e-popup-action.c b/widgets/misc/e-popup-action.c
index 52813c570d..2fd000ccad 100644
--- a/widgets/misc/e-popup-action.c
+++ b/widgets/misc/e-popup-action.c
@@ -27,6 +27,10 @@
#include <glib/gi18n.h>
+#define E_POPUP_ACTION_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_POPUP_ACTION, EPopupActionPrivate))
+
enum {
PROP_0,
PROP_RELATED_ACTION,
@@ -197,7 +201,7 @@ popup_action_dispose (GObject *object)
{
EPopupActionPrivate *priv;
- priv = E_POPUP_ACTION (object)->priv;
+ priv = E_POPUP_ACTION_GET_PRIVATE (object);
if (priv->related_action != NULL) {
g_signal_handler_disconnect (
@@ -334,8 +338,7 @@ e_popup_action_class_init (EPopupActionClass *class)
static void
e_popup_action_init (EPopupAction *popup_action)
{
- popup_action->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- popup_action, E_TYPE_POPUP_ACTION, EPopupActionPrivate);
+ popup_action->priv = E_POPUP_ACTION_GET_PRIVATE (popup_action);
popup_action->priv->use_action_appearance = TRUE;
/* Remain invisible until we have a related action. */
diff --git a/widgets/misc/e-preferences-window.c b/widgets/misc/e-preferences-window.c
index 4d90640796..3bce24371e 100644
--- a/widgets/misc/e-preferences-window.c
+++ b/widgets/misc/e-preferences-window.c
@@ -31,6 +31,10 @@
#define SWITCH_PAGE_INTERVAL 250
+#define E_PREFERENCES_WINDOW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_PREFERENCES_WINDOW, EPreferencesWindowPrivate))
+
struct _EPreferencesWindowPrivate {
gboolean setup;
gpointer shell;
@@ -138,19 +142,25 @@ preferences_window_help_clicked_cb (EPreferencesWindow *window)
g_return_if_fail (window != NULL);
model = GTK_TREE_MODEL (window->priv->filter);
- list = gtk_icon_view_get_selected_items (GTK_ICON_VIEW (window->priv->icon_view));
+ list = gtk_icon_view_get_selected_items (
+ GTK_ICON_VIEW (window->priv->icon_view));
+
if (list != NULL) {
gtk_tree_model_get_iter (model, &iter, list->data);
gtk_tree_model_get (model, &iter, COLUMN_HELP, &help, -1);
+
} else if (gtk_tree_model_get_iter_first (model, &iter)) {
gint page_index, current_index;
- current_index = gtk_notebook_get_current_page (GTK_NOTEBOOK (window->priv->notebook));
+ current_index = gtk_notebook_get_current_page (
+ GTK_NOTEBOOK (window->priv->notebook));
do {
- gtk_tree_model_get (model, &iter, COLUMN_PAGE, &page_index, -1);
+ gtk_tree_model_get (
+ model, &iter, COLUMN_PAGE, &page_index, -1);
if (page_index == current_index) {
- gtk_tree_model_get (model, &iter, COLUMN_HELP, &help, -1);
+ gtk_tree_model_get (
+ model, &iter, COLUMN_HELP, &help, -1);
break;
}
} while (gtk_tree_model_iter_next (model, &iter));
@@ -194,7 +204,7 @@ preferences_window_dispose (GObject *object)
{
EPreferencesWindowPrivate *priv;
- priv = E_PREFERENCES_WINDOW (object)->priv;
+ priv = E_PREFERENCES_WINDOW_GET_PRIVATE (object);
if (priv->icon_view != NULL) {
g_object_unref (priv->icon_view);
@@ -222,7 +232,7 @@ preferences_window_finalize (GObject *object)
{
EPreferencesWindowPrivate *priv;
- priv = E_PREFERENCES_WINDOW (object)->priv;
+ priv = E_PREFERENCES_WINDOW_GET_PRIVATE (object);
g_hash_table_destroy (priv->index);
@@ -237,7 +247,7 @@ preferences_window_show (GtkWidget *widget)
GtkIconView *icon_view;
GtkTreePath *path;
- priv = E_PREFERENCES_WINDOW (widget)->priv;
+ priv = E_PREFERENCES_WINDOW_GET_PRIVATE (widget);
if (!priv->setup)
g_warning ("Preferences window has not been setup correctly");
@@ -287,8 +297,7 @@ e_preferences_window_init (EPreferencesWindow *window)
(GDestroyNotify) g_free,
(GDestroyNotify) gtk_tree_row_reference_free);
- window->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- window, E_TYPE_PREFERENCES_WINDOW, EPreferencesWindowPrivate);
+ window->priv = E_PREFERENCES_WINDOW_GET_PRIVATE (window);
window->priv->index = index;
window->priv->filter_view = NULL;
@@ -419,7 +428,7 @@ e_preferences_window_add_page (EPreferencesWindow *window,
const gchar *page_name,
const gchar *icon_name,
const gchar *caption,
- const gchar *help_target,
+ const gchar *help_target,
EPreferencesWindowCreatePageFn create_fn,
gint sort_order)
{
@@ -546,7 +555,7 @@ e_preferences_window_setup (EPreferencesWindow *window)
g_return_if_fail (E_IS_PREFERENCES_WINDOW (window));
- priv = window->priv;
+ priv = E_PREFERENCES_WINDOW_GET_PRIVATE (window);
notebook = GTK_NOTEBOOK (priv->notebook);
num = gtk_notebook_get_n_pages (notebook);
diff --git a/widgets/misc/e-preview-pane.c b/widgets/misc/e-preview-pane.c
index 42f338c75b..f9750c5885 100644
--- a/widgets/misc/e-preview-pane.c
+++ b/widgets/misc/e-preview-pane.c
@@ -32,6 +32,10 @@
#include "e-alert-bar.h"
+#define E_PREVIEW_PANE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_PREVIEW_PANE, EPreviewPanePrivate))
+
struct _EPreviewPanePrivate {
GtkWidget *alert_bar;
GtkWidget *web_view;
@@ -118,7 +122,7 @@ preview_pane_dispose (GObject *object)
{
EPreviewPanePrivate *priv;
- priv = E_PREVIEW_PANE (object)->priv;
+ priv = E_PREVIEW_PANE_GET_PRIVATE (object);
if (priv->alert_bar != NULL) {
g_object_unref (priv->alert_bar);
@@ -145,7 +149,7 @@ preview_pane_constructed (GObject *object)
EPreviewPanePrivate *priv;
GtkWidget *widget;
- priv = E_PREVIEW_PANE (object)->priv;
+ priv = E_PREVIEW_PANE_GET_PRIVATE (object);
widget = e_alert_bar_new ();
gtk_box_pack_start (GTK_BOX (object), widget, FALSE, FALSE, 0);
@@ -273,8 +277,7 @@ e_preview_pane_alert_sink_init (EAlertSinkInterface *interface)
static void
e_preview_pane_init (EPreviewPane *preview_pane)
{
- preview_pane->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- preview_pane, E_TYPE_PREVIEW_PANE, EPreviewPanePrivate);
+ preview_pane->priv = E_PREVIEW_PANE_GET_PRIVATE (preview_pane);
gtk_box_set_spacing (GTK_BOX (preview_pane), 1);
}
diff --git a/widgets/misc/e-printable.c b/widgets/misc/e-printable.c
index ada5398523..29c85c5b29 100644
--- a/widgets/misc/e-printable.c
+++ b/widgets/misc/e-printable.c
@@ -30,7 +30,7 @@
#include "e-printable.h"
-#define EP_CLASS(e) ((EPrintableClass *)((GObject *)e)->klass)
+#define EP_CLASS(e) ((EPrintableClass *)((GObject *)e)->class)
G_DEFINE_TYPE (
EPrintable,
@@ -49,9 +49,9 @@ enum {
static guint e_printable_signals[LAST_SIGNAL] = { 0, };
static void
-e_printable_class_init (EPrintableClass *klass)
+e_printable_class_init (EPrintableClass *class)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
e_printable_signals[PRINT_PAGE] =
g_signal_new ("print_page",
@@ -101,11 +101,11 @@ e_printable_class_init (EPrintableClass *klass)
G_TYPE_BOOLEAN, 4, G_TYPE_OBJECT, G_TYPE_DOUBLE,
G_TYPE_DOUBLE, G_TYPE_BOOLEAN);
- klass->print_page = NULL;
- klass->data_left = NULL;
- klass->reset = NULL;
- klass->height = NULL;
- klass->will_fit = NULL;
+ class->print_page = NULL;
+ class->data_left = NULL;
+ class->reset = NULL;
+ class->height = NULL;
+ class->will_fit = NULL;
}
static void
diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c
index d70106e060..eafb1b6ad4 100644
--- a/widgets/misc/e-search-bar.c
+++ b/widgets/misc/e-search-bar.c
@@ -29,6 +29,10 @@
#include <gdk/gdkkeysyms.h>
#include <gtkhtml/gtkhtml-search.h>
+#define E_SEARCH_BAR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SEARCH_BAR, ESearchBarPrivate))
+
struct _ESearchBarPrivate {
EWebView *web_view;
GtkWidget *entry;
@@ -316,7 +320,7 @@ search_bar_dispose (GObject *object)
{
ESearchBarPrivate *priv;
- priv = E_SEARCH_BAR (object)->priv;
+ priv = E_SEARCH_BAR_GET_PRIVATE (object);
if (priv->web_view != NULL) {
g_object_unref (priv->web_view);
@@ -362,7 +366,7 @@ search_bar_finalize (GObject *object)
{
ESearchBarPrivate *priv;
- priv = E_SEARCH_BAR (object)->priv;
+ priv = E_SEARCH_BAR_GET_PRIVATE (object);
g_free (priv->active_search);
@@ -375,7 +379,7 @@ search_bar_constructed (GObject *object)
{
ESearchBarPrivate *priv;
- priv = E_SEARCH_BAR (object)->priv;
+ priv = E_SEARCH_BAR_GET_PRIVATE (object);
g_object_bind_property (
object, "case-sensitive",
@@ -537,8 +541,7 @@ e_search_bar_init (ESearchBar *search_bar)
GtkWidget *widget;
GtkWidget *container;
- search_bar->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- search_bar, E_TYPE_SEARCH_BAR, ESearchBarPrivate);
+ search_bar->priv = E_SEARCH_BAR_GET_PRIVATE (search_bar);
search_bar->priv->tokenizer = e_searching_tokenizer_new ();
g_signal_connect_swapped (
diff --git a/widgets/misc/e-searching-tokenizer.c b/widgets/misc/e-searching-tokenizer.c
index c3a7dfff2e..878efa1654 100644
--- a/widgets/misc/e-searching-tokenizer.c
+++ b/widgets/misc/e-searching-tokenizer.c
@@ -37,6 +37,10 @@
#define d(x)
+#define E_SEARCHING_TOKENIZER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SEARCHING_TOKENIZER, ESearchingTokenizerPrivate))
+
enum {
MATCH_SIGNAL,
LAST_SIGNAL
@@ -969,7 +973,7 @@ searching_tokenizer_finalize (GObject *object)
{
ESearchingTokenizerPrivate *priv;
- priv = E_SEARCHING_TOKENIZER (object)->priv;
+ priv = E_SEARCHING_TOKENIZER_GET_PRIVATE (object);
search_info_free (priv->primary);
search_info_free (priv->secondary);
@@ -987,7 +991,7 @@ searching_tokenizer_begin (HTMLTokenizer *tokenizer,
{
ESearchingTokenizerPrivate *priv;
- priv = E_SEARCHING_TOKENIZER (tokenizer)->priv;
+ priv = E_SEARCHING_TOKENIZER_GET_PRIVATE (tokenizer);
/* reset search */
if (priv->engine != NULL) {
@@ -1011,7 +1015,7 @@ searching_tokenizer_peek_token (HTMLTokenizer *tokenizer)
{
ESearchingTokenizerPrivate *priv;
- priv = E_SEARCHING_TOKENIZER (tokenizer)->priv;
+ priv = E_SEARCHING_TOKENIZER_GET_PRIVATE (tokenizer);
if (priv->engine != NULL)
return searcher_peek_token (priv->engine);
@@ -1028,7 +1032,7 @@ searching_tokenizer_next_token (HTMLTokenizer *tokenizer)
gint oldmatched;
gchar *token;
- priv = E_SEARCHING_TOKENIZER (tokenizer)->priv;
+ priv = E_SEARCHING_TOKENIZER_GET_PRIVATE (tokenizer);
/* If no search is active, just use the default method. */
if (priv->engine == NULL)
@@ -1054,7 +1058,7 @@ searching_tokenizer_has_more (HTMLTokenizer *tokenizer)
{
ESearchingTokenizerPrivate *priv;
- priv = E_SEARCHING_TOKENIZER (tokenizer)->priv;
+ priv = E_SEARCHING_TOKENIZER_GET_PRIVATE (tokenizer);
return (priv->engine != NULL && searcher_pending (priv->engine)) ||
HTML_TOKENIZER_CLASS (e_searching_tokenizer_parent_class)->
@@ -1112,9 +1116,7 @@ e_searching_tokenizer_class_init (ESearchingTokenizerClass *class)
static void
e_searching_tokenizer_init (ESearchingTokenizer *tokenizer)
{
- tokenizer->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- tokenizer, E_TYPE_SEARCHING_TOKENIZER,
- ESearchingTokenizerPrivate);
+ tokenizer->priv = E_SEARCHING_TOKENIZER_GET_PRIVATE (tokenizer);
tokenizer->priv->primary = search_info_new ();
search_info_set_flags (
diff --git a/widgets/misc/e-selection-model-array.c b/widgets/misc/e-selection-model-array.c
index d744111bb4..71990f1bd3 100644
--- a/widgets/misc/e-selection-model-array.c
+++ b/widgets/misc/e-selection-model-array.c
@@ -588,13 +588,13 @@ e_selection_model_array_init (ESelectionModelArray *esma)
}
static void
-e_selection_model_array_class_init (ESelectionModelArrayClass *klass)
+e_selection_model_array_class_init (ESelectionModelArrayClass *class)
{
GObjectClass *object_class;
ESelectionModelClass *esm_class;
- object_class = G_OBJECT_CLASS (klass);
- esm_class = E_SELECTION_MODEL_CLASS (klass);
+ object_class = G_OBJECT_CLASS (class);
+ esm_class = E_SELECTION_MODEL_CLASS (class);
object_class->dispose = esma_dispose;
object_class->get_property = esma_get_property;
@@ -618,7 +618,7 @@ e_selection_model_array_class_init (ESelectionModelArrayClass *klass)
esm_class->move_selection_end = esma_move_selection_end;
esm_class->set_selection_end = esma_set_selection_end;
- klass->get_row_count = NULL;
+ class->get_row_count = NULL;
g_object_class_install_property (object_class, PROP_CURSOR_ROW,
g_param_spec_int ("cursor_row",
diff --git a/widgets/misc/e-send-options.c b/widgets/misc/e-send-options.c
index 2af95a4080..54507d22e5 100644
--- a/widgets/misc/e-send-options.c
+++ b/widgets/misc/e-send-options.c
@@ -36,6 +36,10 @@
#include "e-dateedit.h"
#include "e-send-options.h"
+#define E_SEND_OPTIONS_DIALOG_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SEND_OPTIONS_DIALOG, ESendOptionsDialogPrivate))
+
struct _ESendOptionsDialogPrivate {
GtkBuilder *builder;
@@ -404,16 +408,30 @@ init_widgets (ESendOptionsDialog *sod)
priv = sod->priv;
- g_signal_connect (priv->expiration, "toggled", G_CALLBACK (expiration_toggled_cb), sod);
- g_signal_connect (priv->reply_request, "toggled", G_CALLBACK (reply_request_toggled_cb), sod);
- g_signal_connect (priv->delay_delivery, "toggled", G_CALLBACK (delay_delivery_toggled_cb), sod);
- g_signal_connect (priv->create_sent, "toggled", G_CALLBACK (sent_item_toggled_cb), sod);
-
- g_signal_connect (GTK_DIALOG (priv->main), "response", G_CALLBACK(e_send_options_cb), sod);
- g_signal_connect (priv->delay_until, "changed", G_CALLBACK (delay_until_date_changed_cb), sod);
+ g_signal_connect (
+ priv->expiration, "toggled",
+ G_CALLBACK (expiration_toggled_cb), sod);
+ g_signal_connect (
+ priv->reply_request, "toggled",
+ G_CALLBACK (reply_request_toggled_cb), sod);
+ g_signal_connect (
+ priv->delay_delivery, "toggled",
+ G_CALLBACK (delay_delivery_toggled_cb), sod);
+ g_signal_connect (
+ priv->create_sent, "toggled",
+ G_CALLBACK (sent_item_toggled_cb), sod);
+
+ g_signal_connect (
+ priv->main, "response",
+ G_CALLBACK (e_send_options_cb), sod);
+ g_signal_connect (
+ priv->delay_until, "changed",
+ G_CALLBACK (delay_until_date_changed_cb), sod);
if (priv->global)
- g_signal_connect (priv->notebook, "switch-page", G_CALLBACK (page_changed_cb), sod);
+ g_signal_connect (
+ priv->notebook, "switch-page",
+ G_CALLBACK (page_changed_cb), sod);
}
@@ -571,7 +589,7 @@ e_send_options_dialog_new (void)
{
ESendOptionsDialog *sod;
- sod = g_object_new (E_TYPE_SENDOPTIONS_DIALOG, NULL);
+ sod = g_object_new (E_TYPE_SEND_OPTIONS_DIALOG, NULL);
return sod;
}
@@ -580,7 +598,7 @@ void
e_send_options_set_need_general_options (ESendOptionsDialog *sod,
gboolean needed)
{
- g_return_if_fail (E_IS_SENDOPTIONS_DIALOG (sod));
+ g_return_if_fail (E_IS_SEND_OPTIONS_DIALOG (sod));
sod->priv->gopts_needed = needed;
}
@@ -588,7 +606,7 @@ e_send_options_set_need_general_options (ESendOptionsDialog *sod,
gboolean
e_send_options_get_need_general_options (ESendOptionsDialog *sod)
{
- g_return_val_if_fail (E_IS_SENDOPTIONS_DIALOG (sod), FALSE);
+ g_return_val_if_fail (E_IS_SEND_OPTIONS_DIALOG (sod), FALSE);
return sod->priv->gopts_needed;
}
@@ -597,7 +615,7 @@ gboolean
e_send_options_set_global (ESendOptionsDialog *sod,
gboolean set)
{
- g_return_val_if_fail (E_IS_SENDOPTIONS_DIALOG (sod), FALSE);
+ g_return_val_if_fail (E_IS_SEND_OPTIONS_DIALOG (sod), FALSE);
sod->priv->global = set;
@@ -641,7 +659,7 @@ e_send_options_dialog_run (ESendOptionsDialog *sod,
ESendOptionsDialogPrivate *priv;
GtkWidget *toplevel;
- g_return_val_if_fail (sod != NULL || E_IS_SENDOPTIONS_DIALOG (sod), FALSE);
+ g_return_val_if_fail (sod != NULL || E_IS_SEND_OPTIONS_DIALOG (sod), FALSE);
priv = sod->priv;
@@ -683,59 +701,30 @@ e_send_options_dialog_run (ESendOptionsDialog *sod,
static void
e_send_options_dialog_finalize (GObject *object)
{
- ESendOptionsDialog *sod = (ESendOptionsDialog *) object;
- ESendOptionsDialogPrivate *priv;
+ ESendOptionsDialog *sod;
- g_return_if_fail (E_IS_SENDOPTIONS_DIALOG (sod));
- priv = sod->priv;
+ sod = E_SEND_OPTIONS_DIALOG (object);
- g_free (priv->help_section);
+ g_free (sod->priv->help_section);
- if (sod->data->gopts) {
- g_free (sod->data->gopts);
- sod->data->gopts = NULL;
- }
+ g_free (sod->data->gopts);
- if (!priv->global && sod->data->sopts) {
+ if (!sod->priv->global)
g_free (sod->data->sopts);
- sod->data->sopts = NULL;
- }
- if (sod->data->mopts) {
- g_free (sod->data->mopts);
- sod->data->mopts = NULL;
- }
-
- if (sod->data->copts) {
- g_free (sod->data->copts);
- sod->data->copts = NULL;
- }
-
- if (sod->data->topts) {
- g_free (sod->data->topts);
- sod->data->topts = NULL;
- }
-
- if (sod->data) {
- g_free (sod->data);
- sod->data = NULL;
- }
-
- if (sod->priv) {
- g_free (sod->priv);
- sod->priv = NULL;
- }
+ g_free (sod->data->mopts);
+ g_free (sod->data->copts);
+ g_free (sod->data->topts);
+ g_free (sod->data);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_send_options_dialog_parent_class)->finalize (object);
-
}
/* Object initialization function for the task page */
static void
e_send_options_dialog_init (ESendOptionsDialog *sod)
{
- ESendOptionsDialogPrivate *priv;
ESendOptionsData *new;
new = g_new0 (ESendOptionsData, 1);
@@ -744,45 +733,14 @@ e_send_options_dialog_init (ESendOptionsDialog *sod)
new->mopts = g_new0 (ESendOptionsStatusTracking, 1);
new->copts = g_new0 (ESendOptionsStatusTracking, 1);
new->topts = g_new0 (ESendOptionsStatusTracking, 1);
- priv = g_new0 (ESendOptionsDialogPrivate, 1);
- sod->priv = priv;
+ sod->priv = E_SEND_OPTIONS_DIALOG_GET_PRIVATE (sod);
+
sod->data = new;
sod->data->initialized = FALSE;
sod->data->gopts->security = 0;
- priv->gopts_needed = TRUE;
- priv->builder = NULL;
-
- priv->main = NULL;
- priv->notebook = NULL;
- priv->priority = NULL;
- priv->status = NULL;
- priv->security = NULL;
- priv->reply_request = NULL;
- priv->reply_convenient = NULL;
- priv->within_days = NULL;
- priv->delay_delivery = NULL;
- priv->delay_until = NULL;
- priv->expiration = NULL;
- priv->expire_after = NULL;
- priv->create_sent = NULL;
- priv->delivered =NULL;
- priv->delivered_opened = NULL;
- priv->global = FALSE;
- priv->all_info = NULL;
- priv->when_opened = NULL;
- priv->when_declined = NULL;
- priv->when_accepted = NULL;
- priv->when_completed = NULL;
- priv->security_label = NULL;
- priv->priority_label = NULL;
- priv->opened_label = NULL;
- priv->gopts_label = NULL;
- priv-> declined_label = NULL;
- priv->accepted_label = NULL;
- priv->completed_label = NULL;
-
+ sod->priv->gopts_needed = TRUE;
}
/* Class initialization function for the Send Options */
@@ -791,16 +749,19 @@ e_send_options_dialog_class_init (ESendOptionsDialogClass *class)
{
GObjectClass *object_class;
+ g_type_class_add_private (class, sizeof (ESendOptionsDialogPrivate));
+
object_class = G_OBJECT_CLASS (class);
object_class->finalize = e_send_options_dialog_finalize;
- signals[SOD_RESPONSE] = g_signal_new ("sod_response",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ESendOptionsDialogClass, sod_response),
- NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1,
- G_TYPE_INT);
+ signals[SOD_RESPONSE] = g_signal_new (
+ "sod_response",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (ESendOptionsDialogClass, sod_response),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1,
+ G_TYPE_INT);
}
diff --git a/widgets/misc/e-send-options.h b/widgets/misc/e-send-options.h
index 2e25974dc3..2e8ef1d381 100644
--- a/widgets/misc/e-send-options.h
+++ b/widgets/misc/e-send-options.h
@@ -21,17 +21,17 @@
*
*/
-#ifndef __E_SENDOPTIONS_DIALOG_H__
-#define __E_SENDOPTIONS_DIALOG_H__
+#ifndef __E_SEND_OPTIONS_DIALOG_H__
+#define __E_SEND_OPTIONS_DIALOG_H__
#include <gtk/gtk.h>
#include <time.h>
-#define E_TYPE_SENDOPTIONS_DIALOG (e_send_options_dialog_get_type ())
-#define E_SENDOPTIONS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SENDOPTIONS_DIALOG, ESendOptionsDialog))
-#define E_SENDOPTIONS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SENDOPTIONS_DIALOG, ESendOptionsDialogClass))
-#define E_IS_SENDOPTIONS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SENDOPTIONS_DIALOG))
-#define E_IS_SENDOPTIONS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_SENDOPTIONS_DIALOG))
+#define E_TYPE_SEND_OPTIONS_DIALOG (e_send_options_dialog_get_type ())
+#define E_SEND_OPTIONS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SEND_OPTIONS_DIALOG, ESendOptionsDialog))
+#define E_SEND_OPTIONS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SEND_OPTIONS_DIALOG, ESendOptionsDialogClass))
+#define E_IS_SEND_OPTIONS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SEND_OPTIONS_DIALOG))
+#define E_IS_SEND_OPTIONS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_SEND_OPTIONS_DIALOG))
typedef struct _ESendOptionsDialog ESendOptionsDialog;
typedef struct _ESendOptionsDialogClass ESendOptionsDialogClass;
diff --git a/widgets/misc/e-signature-combo-box.c b/widgets/misc/e-signature-combo-box.c
index 9f3b6d9f99..e24cb14b7a 100644
--- a/widgets/misc/e-signature-combo-box.c
+++ b/widgets/misc/e-signature-combo-box.c
@@ -27,6 +27,10 @@
#include <glib/gi18n-lib.h>
+#define E_SIGNATURE_COMBO_BOX_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SIGNATURE_COMBO_BOX, ESignatureComboBoxPrivate))
+
enum {
COLUMN_STRING,
COLUMN_SIGNATURE
@@ -158,7 +162,7 @@ signature_combo_box_dispose (GObject *object)
{
ESignatureComboBoxPrivate *priv;
- priv = E_SIGNATURE_COMBO_BOX (object)->priv;
+ priv = E_SIGNATURE_COMBO_BOX_GET_PRIVATE (object);
if (priv->signature_list != NULL) {
g_signal_handlers_disconnect_by_func (
@@ -179,7 +183,7 @@ signature_combo_box_finalize (GObject *object)
{
ESignatureComboBoxPrivate *priv;
- priv = E_SIGNATURE_COMBO_BOX (object)->priv;
+ priv = E_SIGNATURE_COMBO_BOX_GET_PRIVATE (object);
g_hash_table_destroy (priv->index);
@@ -219,9 +223,7 @@ e_signature_combo_box_init (ESignatureComboBox *combo_box)
(GDestroyNotify) g_object_unref,
(GDestroyNotify) gtk_tree_row_reference_free);
- combo_box->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- combo_box, E_TYPE_SIGNATURE_COMBO_BOX,
- ESignatureComboBoxPrivate);
+ combo_box->priv = E_SIGNATURE_COMBO_BOX_GET_PRIVATE (combo_box);
combo_box->priv->index = index;
}
@@ -250,7 +252,7 @@ e_signature_combo_box_set_signature_list (ESignatureComboBox *combo_box,
if (signature_list != NULL)
g_return_if_fail (E_IS_SIGNATURE_LIST (signature_list));
- priv = combo_box->priv;
+ priv = E_SIGNATURE_COMBO_BOX_GET_PRIVATE (combo_box);
if (priv->signature_list != NULL) {
g_signal_handlers_disconnect_by_func (
diff --git a/widgets/misc/e-signature-editor.c b/widgets/misc/e-signature-editor.c
index d968debe8f..ef5466d1d1 100644
--- a/widgets/misc/e-signature-editor.c
+++ b/widgets/misc/e-signature-editor.c
@@ -33,6 +33,10 @@
#include <libemail-utils/e-signature-utils.h>
#include <misc/e-web-view.h>
+#define E_SIGNATURE_EDITOR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SIGNATURE_EDITOR, ESignatureEditorPrivate))
+
enum {
PROP_0,
PROP_FOCUS_TRACKER,
@@ -283,7 +287,7 @@ signature_editor_dispose (GObject *object)
{
ESignatureEditorPrivate *priv;
- priv = E_SIGNATURE_EDITOR (object)->priv;
+ priv = E_SIGNATURE_EDITOR_GET_PRIVATE (object);
if (priv->action_group != NULL) {
g_object_unref (priv->action_group);
@@ -314,7 +318,7 @@ signature_editor_finalize (GObject *object)
{
ESignatureEditorPrivate *priv;
- priv = E_SIGNATURE_EDITOR (object)->priv;
+ priv = E_SIGNATURE_EDITOR_GET_PRIVATE (object);
g_free (priv->original_name);
@@ -400,8 +404,7 @@ e_signature_editor_init (ESignatureEditor *editor)
GtkWidget *vbox;
GError *error = NULL;
- editor->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- editor, E_TYPE_SIGNATURE_EDITOR, ESignatureEditorPrivate);
+ editor->priv = E_SIGNATURE_EDITOR_GET_PRIVATE (editor);
vbox = GTKHTML_EDITOR (editor)->vbox;
gtkhtml_editor = GTKHTML_EDITOR (editor);
diff --git a/widgets/misc/e-signature-manager.c b/widgets/misc/e-signature-manager.c
index 9e62c02d6c..eb68dd251d 100644
--- a/widgets/misc/e-signature-manager.c
+++ b/widgets/misc/e-signature-manager.c
@@ -31,6 +31,10 @@
#include "e-signature-tree-view.h"
#include "e-signature-script-dialog.h"
+#define E_SIGNATURE_MANAGER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SIGNATURE_MANAGER, ESignatureManagerPrivate))
+
struct _ESignatureManagerPrivate {
ESignatureList *signature_list;
@@ -234,7 +238,7 @@ signature_manager_dispose (GObject *object)
{
ESignatureManagerPrivate *priv;
- priv = E_SIGNATURE_MANAGER (object)->priv;
+ priv = E_SIGNATURE_MANAGER_GET_PRIVATE (object);
if (priv->signature_list != NULL) {
g_object_unref (priv->signature_list);
@@ -526,8 +530,7 @@ e_signature_manager_init (ESignatureManager *manager)
GtkWidget *container;
GtkWidget *widget;
- manager->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- manager, E_TYPE_SIGNATURE_MANAGER, ESignatureManagerPrivate);
+ manager->priv = E_SIGNATURE_MANAGER_GET_PRIVATE (manager);
gtk_table_resize (GTK_TABLE (manager), 1, 2);
gtk_table_set_col_spacings (GTK_TABLE (manager), 6);
diff --git a/widgets/misc/e-signature-preview.c b/widgets/misc/e-signature-preview.c
index 6de03c0881..75b19328c0 100644
--- a/widgets/misc/e-signature-preview.c
+++ b/widgets/misc/e-signature-preview.c
@@ -32,6 +32,10 @@
#include <libemail-utils/e-signature-utils.h>
+#define E_SIGNATURE_PREVIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SIGNATURE_PREVIEW, ESignaturePreviewPrivate))
+
enum {
PROP_0,
PROP_DISABLE_COMMAND_LINE,
@@ -108,7 +112,7 @@ signature_preview_dispose (GObject *object)
{
ESignaturePreviewPrivate *priv;
- priv = E_SIGNATURE_PREVIEW (object)->priv;
+ priv = E_SIGNATURE_PREVIEW_GET_PRIVATE (object);
if (priv->signature != NULL) {
g_object_unref (priv->signature);
@@ -239,8 +243,7 @@ e_signature_preview_class_init (ESignaturePreviewClass *class)
static void
e_signature_preview_init (ESignaturePreview *preview)
{
- preview->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- preview, E_TYPE_SIGNATURE_PREVIEW, ESignaturePreviewPrivate);
+ preview->priv = E_SIGNATURE_PREVIEW_GET_PRIVATE (preview);
}
GtkWidget *
diff --git a/widgets/misc/e-signature-script-dialog.c b/widgets/misc/e-signature-script-dialog.c
index f864f823c6..20eef7ec15 100644
--- a/widgets/misc/e-signature-script-dialog.c
+++ b/widgets/misc/e-signature-script-dialog.c
@@ -27,6 +27,10 @@
#include <glib/gi18n.h>
+#define E_SIGNATURE_SCRIPT_DIALOG_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SIGNATURE_SCRIPT_DIALOG, ESignatureScriptDialogPrivate))
+
struct _ESignatureScriptDialogPrivate {
GtkWidget *entry;
GtkWidget *file_chooser;
@@ -144,7 +148,7 @@ signature_script_dialog_dispose (GObject *object)
{
ESignatureScriptDialogPrivate *priv;
- priv = E_SIGNATURE_SCRIPT_DIALOG (object)->priv;
+ priv = E_SIGNATURE_SCRIPT_DIALOG_GET_PRIVATE (object);
if (priv->entry != NULL) {
g_object_unref (priv->entry);
@@ -230,9 +234,7 @@ e_signature_script_dialog_init (ESignatureScriptDialog *dialog)
GtkWidget *widget;
gchar *markup;
- dialog->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- dialog, E_TYPE_SIGNATURE_SCRIPT_DIALOG,
- ESignatureScriptDialogPrivate);
+ dialog->priv = E_SIGNATURE_SCRIPT_DIALOG_GET_PRIVATE (dialog);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
diff --git a/widgets/misc/e-signature-tree-view.c b/widgets/misc/e-signature-tree-view.c
index 62a923d8b9..5631c62949 100644
--- a/widgets/misc/e-signature-tree-view.c
+++ b/widgets/misc/e-signature-tree-view.c
@@ -25,6 +25,10 @@
#include "e-signature-tree-view.h"
+#define E_SIGNATURE_TREE_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SIGNATURE_TREE_VIEW, ESignatureTreeViewPrivate))
+
enum {
COLUMN_STRING,
COLUMN_SIGNATURE
@@ -217,7 +221,7 @@ signature_tree_view_dispose (GObject *object)
{
ESignatureTreeViewPrivate *priv;
- priv = E_SIGNATURE_TREE_VIEW (object)->priv;
+ priv = E_SIGNATURE_TREE_VIEW_GET_PRIVATE (object);
if (priv->signature_list != NULL) {
g_signal_handlers_disconnect_by_func (
@@ -238,7 +242,7 @@ signature_tree_view_finalize (GObject *object)
{
ESignatureTreeViewPrivate *priv;
- priv = E_SIGNATURE_TREE_VIEW (object)->priv;
+ priv = E_SIGNATURE_TREE_VIEW_GET_PRIVATE (object);
g_hash_table_destroy (priv->index);
@@ -302,9 +306,7 @@ e_signature_tree_view_init (ESignatureTreeView *tree_view)
(GDestroyNotify) g_object_unref,
(GDestroyNotify) gtk_tree_row_reference_free);
- tree_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- tree_view, E_TYPE_SIGNATURE_TREE_VIEW,
- ESignatureTreeViewPrivate);
+ tree_view->priv = E_SIGNATURE_TREE_VIEW_GET_PRIVATE (tree_view);
tree_view->priv->index = index;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
@@ -340,7 +342,7 @@ e_signature_tree_view_set_signature_list (ESignatureTreeView *tree_view,
if (signature_list != NULL)
g_return_if_fail (E_IS_SIGNATURE_LIST (signature_list));
- priv = tree_view->priv;
+ priv = E_SIGNATURE_TREE_VIEW_GET_PRIVATE (tree_view);
if (priv->signature_list != NULL) {
g_signal_handlers_disconnect_by_func (
diff --git a/widgets/misc/e-url-entry.c b/widgets/misc/e-url-entry.c
index c59cf0739c..68b8a8fac0 100644
--- a/widgets/misc/e-url-entry.c
+++ b/widgets/misc/e-url-entry.c
@@ -29,13 +29,15 @@
#include "e-url-entry.h"
#include "e-util/e-util.h"
+#define E_URL_ENTRY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_URL_ENTRY, EUrlEntryPrivate))
+
struct _EUrlEntryPrivate {
GtkWidget *entry;
GtkWidget *button;
};
-static void finalize (GObject *object);
-
static void button_clicked_cb (GtkWidget *widget, gpointer data);
static void entry_changed_cb (GtkEditable *editable, gpointer data);
@@ -49,11 +51,9 @@ G_DEFINE_TYPE (
static void
e_url_entry_class_init (EUrlEntryClass *class)
{
- GObjectClass *object_class;
GtkWidgetClass *widget_class;
- object_class = G_OBJECT_CLASS (class);
- object_class->finalize = finalize;
+ g_type_class_add_private (class, sizeof (EUrlEntryPrivate));
widget_class = GTK_WIDGET_CLASS (class);
widget_class->mnemonic_activate = mnemonic_activate;
@@ -62,46 +62,33 @@ e_url_entry_class_init (EUrlEntryClass *class)
static void
e_url_entry_init (EUrlEntry *url_entry)
{
- EUrlEntryPrivate *priv;
GtkWidget *pixmap;
- priv = g_new0 (EUrlEntryPrivate, 1);
- url_entry->priv = priv;
+ url_entry->priv = E_URL_ENTRY_GET_PRIVATE (url_entry);
- priv->entry = gtk_entry_new ();
- gtk_box_pack_start (GTK_BOX (url_entry), priv->entry, TRUE, TRUE, 0);
- priv->button = gtk_button_new ();
- gtk_widget_set_sensitive (priv->button, FALSE);
- gtk_box_pack_start (GTK_BOX (url_entry), priv->button, FALSE, FALSE, 0);
+ url_entry->priv->entry = gtk_entry_new ();
+ gtk_box_pack_start (
+ GTK_BOX (url_entry), url_entry->priv->entry, TRUE, TRUE, 0);
+ url_entry->priv->button = gtk_button_new ();
+ gtk_widget_set_sensitive (url_entry->priv->button, FALSE);
+ gtk_box_pack_start (
+ GTK_BOX (url_entry), url_entry->priv->button, FALSE, FALSE, 0);
atk_object_set_name (
- gtk_widget_get_accessible (priv->button),
+ gtk_widget_get_accessible (url_entry->priv->button),
_("Click here to go to URL"));
pixmap = gtk_image_new_from_icon_name ("go-jump", GTK_ICON_SIZE_BUTTON);
- gtk_container_add (GTK_CONTAINER (priv->button), pixmap);
+ gtk_container_add (GTK_CONTAINER (url_entry->priv->button), pixmap);
gtk_widget_show (pixmap);
- gtk_widget_show (priv->button);
- gtk_widget_show (priv->entry);
-
- g_signal_connect (priv->button, "clicked",
- G_CALLBACK (button_clicked_cb), url_entry);
- g_signal_connect (priv->entry, "changed",
- G_CALLBACK (entry_changed_cb), url_entry);
-}
-
-static void
-finalize (GObject *object)
-{
- EUrlEntry *url_entry;
-
- url_entry = E_URL_ENTRY (object);
- if (url_entry->priv) {
- g_free (url_entry->priv);
- url_entry->priv = NULL;
- }
+ gtk_widget_show (url_entry->priv->button);
+ gtk_widget_show (url_entry->priv->entry);
- /* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (e_url_entry_parent_class)->finalize (object);
+ g_signal_connect (
+ url_entry->priv->button, "clicked",
+ G_CALLBACK (button_clicked_cb), url_entry);
+ g_signal_connect (
+ url_entry->priv->entry, "changed",
+ G_CALLBACK (entry_changed_cb), url_entry);
}
/* GtkWidget::mnemonic_activate() handler for the EUrlEntry */
diff --git a/widgets/misc/e-web-view-preview.c b/widgets/misc/e-web-view-preview.c
index 12270da0b7..b75814fa83 100644
--- a/widgets/misc/e-web-view-preview.c
+++ b/widgets/misc/e-web-view-preview.c
@@ -28,6 +28,10 @@
#include <string.h>
#include <glib/gi18n-lib.h>
+#define E_WEB_VIEW_PREVIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_WEB_VIEW_PREVIEW, EWebViewPreviewPrivate))
+
struct _EWebViewPreviewPrivate {
gboolean escape_values;
GString *updating_content; /* is NULL when not between begin_update/end_update */
@@ -96,7 +100,7 @@ web_view_preview_dispose (GObject *object)
{
EWebViewPreviewPrivate *priv;
- priv = E_WEB_VIEW_PREVIEW (object)->priv;
+ priv = E_WEB_VIEW_PREVIEW_GET_PRIVATE (object);
if (priv->updating_content != NULL) {
g_string_free (priv->updating_content, TRUE);
@@ -172,8 +176,7 @@ e_web_view_preview_init (EWebViewPreview *preview)
{
GtkWidget *tree_view_sw, *web_view_sw;
- preview->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- preview, E_TYPE_WEB_VIEW_PREVIEW, EWebViewPreviewPrivate);
+ preview->priv = E_WEB_VIEW_PREVIEW_GET_PRIVATE (preview);
preview->priv->escape_values = TRUE;
tree_view_sw = in_scrolled_window (gtk_tree_view_new ());
diff --git a/widgets/misc/ea-calendar-item.c b/widgets/misc/ea-calendar-item.c
index 98a715eacf..a483460226 100644
--- a/widgets/misc/ea-calendar-item.c
+++ b/widgets/misc/ea-calendar-item.c
@@ -38,7 +38,7 @@
#define EA_CALENDAR_COLUMN_NUM E_CALENDAR_COLS_PER_MONTH
/* EaCalendarItem */
-static void ea_calendar_item_class_init (EaCalendarItemClass *klass);
+static void ea_calendar_item_class_init (EaCalendarItemClass *class);
static void ea_calendar_item_finalize (GObject *object);
static const gchar * ea_calendar_item_get_name (AtkObject *accessible);
@@ -240,12 +240,12 @@ ea_calendar_item_new (GObject *obj)
n_ea_calendar_item_created);
#endif
/* connect signal handlers */
- g_signal_connect (obj, "selection_preview_changed",
- G_CALLBACK (selection_preview_change_cb),
- atk_object);
- g_signal_connect (obj, "date_range_changed",
- G_CALLBACK (date_range_changed_cb),
- atk_object);
+ g_signal_connect (
+ obj, "selection_preview_changed",
+ G_CALLBACK (selection_preview_change_cb), atk_object);
+ g_signal_connect (
+ obj, "date_range_changed",
+ G_CALLBACK (date_range_changed_cb), atk_object);
return atk_object;
}
diff --git a/widgets/misc/test-calendar.c b/widgets/misc/test-calendar.c
index 7a4d2f8954..c6d1a8eee6 100644
--- a/widgets/misc/test-calendar.c
+++ b/widgets/misc/test-calendar.c
@@ -69,18 +69,21 @@ main (gint argc,
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
- g_signal_connect (window, "delete_event",
- G_CALLBACK (delete_event_cb), NULL);
+ g_signal_connect (
+ window, "delete_event",
+ G_CALLBACK (delete_event_cb), NULL);
cal = e_calendar_new ();
e_calendar_set_minimum_size (E_CALENDAR (cal), 1, 1);
calitem = E_CALENDAR (cal)->calitem;
gtk_widget_show (cal);
- g_signal_connect (calitem, "date_range_changed",
- G_CALLBACK (on_date_range_changed), NULL);
- g_signal_connect (calitem, "selection_changed",
- G_CALLBACK (on_selection_changed), NULL);
+ g_signal_connect (
+ calitem, "date_range_changed",
+ G_CALLBACK (on_date_range_changed), NULL);
+ g_signal_connect (
+ calitem, "selection_changed",
+ G_CALLBACK (on_selection_changed), NULL);
gtk_drag_dest_set (cal,
GTK_DEST_DEFAULT_ALL,
diff --git a/widgets/misc/test-dateedit.c b/widgets/misc/test-dateedit.c
index 2629fad4e0..46c853cea6 100644
--- a/widgets/misc/test-dateedit.c
+++ b/widgets/misc/test-dateedit.c
@@ -65,8 +65,9 @@ main (gint argc,
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
- g_signal_connect (window, "delete_event",
- G_CALLBACK (delete_event_cb), window);
+ g_signal_connect (
+ window, "delete_event",
+ G_CALLBACK (delete_event_cb), window);
table = gtk_table_new (3, 3, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
@@ -82,21 +83,25 @@ main (gint argc,
gtk_widget_show (GTK_WIDGET (dedit));
#if 0
- g_signal_connect (dedit, "date_changed",
- G_CALLBACK (on_date_changed), (gpointer) "1");
- g_signal_connect (dedit, "time_changed",
- G_CALLBACK (on_time_changed), (gpointer) "1");
+ g_signal_connect (
+ dedit, "date_changed",
+ G_CALLBACK (on_date_changed), (gpointer) "1");
+ g_signal_connect (
+ dedit, "time_changed",
+ G_CALLBACK (on_time_changed), (gpointer) "1");
#else
- g_signal_connect (dedit, "changed",
- G_CALLBACK (on_changed), (gpointer) "1");
+ g_signal_connect (
+ dedit, "changed",
+ G_CALLBACK (on_changed), (gpointer) "1");
#endif
button = gtk_button_new_with_label ("Print Date");
gtk_table_attach (GTK_TABLE (table), button,
1, 2, 0, 1, 0, 0, 0, 0);
gtk_widget_show (button);
- g_signal_connect ((button), "clicked",
- G_CALLBACK (on_get_date_clicked), dedit);
+ g_signal_connect (
+ button, "clicked",
+ G_CALLBACK (on_get_date_clicked), dedit);
/* EDateEdit 2. */
dedit = E_DATE_EDIT (e_date_edit_new ());
@@ -110,21 +115,25 @@ main (gint argc,
e_date_edit_set_show_time (dedit, FALSE);
#if 0
- g_signal_connect (dedit, "date_changed",
- G_CALLBACK (on_date_changed), (gpointer) "2");
- g_signal_connect (dedit, "time_changed",
- G_CALLBACK (on_time_changed), (gpointer) "2");
+ g_signal_connect (
+ dedit, "date_changed",
+ G_CALLBACK (on_date_changed), (gpointer) "2");
+ g_signal_connect (
+ dedit, "time_changed",
+ G_CALLBACK (on_time_changed), (gpointer) "2");
#else
- g_signal_connect (dedit, "changed",
- G_CALLBACK (on_changed), (gpointer) "2");
+ g_signal_connect (
+ dedit, "changed",
+ G_CALLBACK (on_changed), (gpointer) "2");
#endif
button = gtk_button_new_with_label ("Print Date");
gtk_table_attach (GTK_TABLE (table), button,
1, 2, 1, 2, 0, 0, 0, 0);
gtk_widget_show (button);
- g_signal_connect (button, "clicked",
- G_CALLBACK (on_get_date_clicked), dedit);
+ g_signal_connect (
+ button, "clicked",
+ G_CALLBACK (on_get_date_clicked), dedit);
/* EDateEdit 3. */
dedit = E_DATE_EDIT (e_date_edit_new ());
@@ -138,28 +147,33 @@ main (gint argc,
e_date_edit_set_allow_no_date_set (dedit, TRUE);
#if 0
- g_signal_connect (dedit, "date_changed",
- G_CALLBACK (on_date_changed), (gpointer) "3");
- g_signal_connect (dedit, "time_changed",
- G_CALLBACK (on_time_changed), (gpointer) "3");
+ g_signal_connect (
+ dedit, "date_changed",
+ G_CALLBACK (on_date_changed), (gpointer) "3");
+ g_signal_connect (
+ dedit, "time_changed",
+ G_CALLBACK (on_time_changed), (gpointer) "3");
#else
- g_signal_connect (dedit, "changed",
- G_CALLBACK (on_changed), (gpointer) "3");
+ g_signal_connect (
+ dedit, "changed",
+ G_CALLBACK (on_changed), (gpointer) "3");
#endif
button = gtk_button_new_with_label ("Print Date");
gtk_table_attach (GTK_TABLE (table), button,
1, 2, 2, 3, 0, 0, 0, 0);
gtk_widget_show (button);
- g_signal_connect (button, "clicked",
- G_CALLBACK (on_get_date_clicked), dedit);
+ g_signal_connect (
+ button, "clicked",
+ G_CALLBACK (on_get_date_clicked), dedit);
button = gtk_button_new_with_label ("Toggle 24-hour");
gtk_table_attach (GTK_TABLE (table), button,
2, 3, 2, 3, 0, 0, 0, 0);
gtk_widget_show (button);
- g_signal_connect (button, "clicked",
- G_CALLBACK (on_toggle_24_hour_clicked), dedit);
+ g_signal_connect (
+ button, "clicked",
+ G_CALLBACK (on_toggle_24_hour_clicked), dedit);
gtk_widget_show (window);
diff --git a/widgets/table/e-cell-combo.c b/widgets/table/e-cell-combo.c
index 2617cfafdf..20a19165be 100644
--- a/widgets/table/e-cell-combo.c
+++ b/widgets/table/e-cell-combo.c
@@ -259,34 +259,44 @@ e_cell_combo_do_popup (ECellPopup *ecp,
gint view_col)
{
ECellCombo *ecc = E_CELL_COMBO (ecp);
+ GtkTreeSelection *selection;
+ GdkWindow *window;
guint32 time;
gint error_code;
- GtkTreeSelection *selection;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ecc->popup_tree_view));
+ selection = gtk_tree_view_get_selection (
+ GTK_TREE_VIEW (ecc->popup_tree_view));
+
+ g_signal_handlers_block_by_func (
+ selection, e_cell_combo_selection_changed, ecc);
- g_signal_handlers_block_by_func (selection, e_cell_combo_selection_changed, ecc);
e_cell_combo_show_popup (ecc, row, view_col);
e_cell_combo_select_matching_item (ecc);
- g_signal_handlers_unblock_by_func (selection, e_cell_combo_selection_changed, ecc);
- if (event->type == GDK_BUTTON_PRESS) {
+ g_signal_handlers_unblock_by_func (
+ selection, e_cell_combo_selection_changed, ecc);
+
+ if (event->type == GDK_BUTTON_PRESS)
time = event->button.time;
- } else {
+ else
time = event->key.time;
- }
- error_code = gdk_pointer_grab (gtk_widget_get_window (ecc->popup_tree_view), TRUE,
- GDK_ENTER_NOTIFY_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_HINT_MASK |
- GDK_BUTTON1_MOTION_MASK,
- NULL, NULL, time);
+ window = gtk_widget_get_window (ecc->popup_tree_view);
+
+ error_code = gdk_pointer_grab (
+ window, TRUE,
+ GDK_ENTER_NOTIFY_MASK |
+ GDK_BUTTON_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK |
+ GDK_POINTER_MOTION_HINT_MASK |
+ GDK_BUTTON1_MOTION_MASK,
+ NULL, NULL, time);
+
if (error_code != 0)
g_warning ("Failed to get pointer grab (%i)", error_code);
+
gtk_grab_add (ecc->popup_window);
- gdk_keyboard_grab (gtk_widget_get_window (ecc->popup_tree_view), TRUE, time);
+ gdk_keyboard_grab (window, TRUE, time);
return TRUE;
}
@@ -297,7 +307,7 @@ e_cell_combo_select_matching_item (ECellCombo *ecc)
ECellPopup *ecp = E_CELL_POPUP (ecc);
ECellView *ecv = (ECellView *) ecp->popup_cell_view;
ECellText *ecell_text = E_CELL_TEXT (ecp->child);
- ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
+ ETableItem *eti;
ETableCol *ecol;
gboolean found = FALSE;
gchar *cell_text;
@@ -306,6 +316,8 @@ e_cell_combo_select_matching_item (ECellCombo *ecc)
GtkTreeIter iter;
GtkTreeModel *model;
+ eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
+
ecol = e_table_header_get_column (eti->header, ecp->popup_view_col);
cell_text = e_cell_text_get_text (ecell_text, ecv->e_table_model,
ecol->col_idx, ecp->popup_row);
@@ -390,8 +402,8 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc,
gint *width)
{
ECellPopup *ecp = E_CELL_POPUP (ecc);
- ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
- GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas);
+ ETableItem *eti;
+ GtkWidget *canvas;
GtkWidget *widget;
GtkWidget *popwin_child;
GtkWidget *popup_child;
@@ -408,6 +420,9 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc,
gdouble x1, y1;
gdouble wx, wy;
+ eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
+ canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas);
+
/* This code is practically copied from GtkCombo. */
popup = GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window);
popwin = GTK_BIN (ecc->popup_window);
@@ -503,7 +518,7 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc,
if (show_hscroll)
work_height +=
requisition.height +
- GTK_SCROLLED_WINDOW_CLASS (G_OBJECT_GET_CLASS (popup))->scrollbar_spacing;
+ GTK_SCROLLED_WINDOW_GET_CLASS (popup)->scrollbar_spacing;
/* Check if it fits in the available height. */
if (work_height + list_requisition.height > avail_height) {
diff --git a/widgets/table/e-cell-date-edit.c b/widgets/table/e-cell-date-edit.c
index 3035652116..bee042cb2a 100644
--- a/widgets/table/e-cell-date-edit.c
+++ b/widgets/table/e-cell-date-edit.c
@@ -299,43 +299,42 @@ e_cell_date_edit_init (ECellDateEdit *ecde)
now_button = gtk_button_new_with_label (_("Now"));
gtk_container_add (GTK_CONTAINER (bbox), now_button);
gtk_widget_show (now_button);
- g_signal_connect ((now_button), "clicked",
- G_CALLBACK (e_cell_date_edit_on_now_clicked),
- ecde);
+ g_signal_connect (
+ now_button, "clicked",
+ G_CALLBACK (e_cell_date_edit_on_now_clicked), ecde);
ecde->now_button = now_button;
today_button = gtk_button_new_with_label (_("Today"));
gtk_container_add (GTK_CONTAINER (bbox), today_button);
gtk_widget_show (today_button);
- g_signal_connect ((today_button), "clicked",
- G_CALLBACK (e_cell_date_edit_on_today_clicked),
- ecde);
+ g_signal_connect (
+ today_button, "clicked",
+ G_CALLBACK (e_cell_date_edit_on_today_clicked), ecde);
ecde->today_button = today_button;
- /* Translators: "None" as a label of a button to unset date in a date table cell */
+ /* Translators: "None" as a label of a button to unset date in a
+ * date table cell. */
none_button = gtk_button_new_with_label (C_("table-date", "None"));
gtk_container_add (GTK_CONTAINER (bbox), none_button);
gtk_widget_show (none_button);
- g_signal_connect ((none_button), "clicked",
- G_CALLBACK (e_cell_date_edit_on_none_clicked),
- ecde);
+ g_signal_connect (
+ none_button, "clicked",
+ G_CALLBACK (e_cell_date_edit_on_none_clicked), ecde);
ecde->none_button = none_button;
ok_button = gtk_button_new_with_label (_("OK"));
gtk_container_add (GTK_CONTAINER (bbox), ok_button);
gtk_widget_show (ok_button);
- g_signal_connect ((ok_button), "clicked",
- G_CALLBACK (e_cell_date_edit_on_ok_clicked),
- ecde);
-
- g_signal_connect ((ecde->popup_window),
- "key_press_event",
- G_CALLBACK (e_cell_date_edit_key_press),
- ecde);
- g_signal_connect ((ecde->popup_window),
- "button_press_event",
- G_CALLBACK (e_cell_date_edit_button_press),
- ecde);
+ g_signal_connect (
+ ok_button, "clicked",
+ G_CALLBACK (e_cell_date_edit_on_ok_clicked), ecde);
+
+ g_signal_connect (
+ ecde->popup_window, "key_press_event",
+ G_CALLBACK (e_cell_date_edit_key_press), ecde);
+ g_signal_connect (
+ ecde->popup_window, "button_press_event",
+ G_CALLBACK (e_cell_date_edit_button_press), ecde);
}
/**
@@ -504,7 +503,7 @@ e_cell_date_edit_set_popup_values (ECellDateEdit *ecde)
ECellPopup *ecp = E_CELL_POPUP (ecde);
ECellText *ecell_text = E_CELL_TEXT (ecp->child);
ECellView *ecv = (ECellView *) ecp->popup_cell_view;
- ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
+ ETableItem *eti;
ETableCol *ecol;
gchar *cell_text;
ETimeParseStatus status;
@@ -514,9 +513,12 @@ e_cell_date_edit_set_popup_values (ECellDateEdit *ecde)
gchar buffer[64];
gboolean is_date = TRUE;
+ eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
ecol = e_table_header_get_column (eti->header, ecp->popup_view_col);
- cell_text = e_cell_text_get_text (ecell_text, ecv->e_table_model,
- ecol->col_idx, ecp->popup_row);
+
+ cell_text = e_cell_text_get_text (
+ ecell_text, ecv->e_table_model,
+ ecol->col_idx, ecp->popup_row);
/* Try to parse just a date first. If the value is only a date, we
* use a DATE value. */
@@ -640,8 +642,8 @@ e_cell_date_edit_get_popup_pos (ECellDateEdit *ecde,
gint *width)
{
ECellPopup *ecp = E_CELL_POPUP (ecde);
- ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
- GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas);
+ ETableItem *eti;
+ GtkWidget *canvas;
GtkRequisition popup_requisition;
GtkAdjustment *adjustment;
GtkScrollable *scrollable;
@@ -650,6 +652,9 @@ e_cell_date_edit_get_popup_pos (ECellDateEdit *ecde,
gdouble x1, y1, wx, wy;
gint value;
+ eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
+ canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas);
+
window = gtk_widget_get_window (canvas);
gdk_window_get_origin (window, x, y);
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index 7e391c3ba9..54998bc8b9 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -1148,10 +1148,22 @@ ect_enter_edit (ECellView *ecell_view,
if (edit->im_context) {
gtk_im_context_reset (edit->im_context);
if (!edit->im_context_signals_registered) {
- g_signal_connect (edit->im_context, "preedit_changed", G_CALLBACK (e_cell_text_preedit_changed_cb), text_view);
- g_signal_connect (edit->im_context, "commit", G_CALLBACK (e_cell_text_commit_cb), text_view);
- g_signal_connect (edit->im_context, "retrieve_surrounding", G_CALLBACK (e_cell_text_retrieve_surrounding_cb), text_view);
- g_signal_connect (edit->im_context, "delete_surrounding", G_CALLBACK (e_cell_text_delete_surrounding_cb), text_view);
+ g_signal_connect (
+ edit->im_context, "preedit_changed",
+ G_CALLBACK (e_cell_text_preedit_changed_cb),
+ text_view);
+ g_signal_connect (
+ edit->im_context, "commit",
+ G_CALLBACK (e_cell_text_commit_cb),
+ text_view);
+ g_signal_connect (
+ edit->im_context, "retrieve_surrounding",
+ G_CALLBACK (e_cell_text_retrieve_surrounding_cb),
+ text_view);
+ g_signal_connect (
+ edit->im_context, "delete_surrounding",
+ G_CALLBACK (e_cell_text_delete_surrounding_cb),
+ text_view);
edit->im_context_signals_registered = TRUE;
}
@@ -2519,10 +2531,9 @@ _get_tep (CellEdit *edit)
{
if (!edit->tep) {
edit->tep = e_text_event_processor_emacs_like_new ();
- g_signal_connect (edit->tep,
- "command",
- G_CALLBACK (e_cell_text_view_command),
- (gpointer) edit);
+ g_signal_connect (
+ edit->tep, "command",
+ G_CALLBACK (e_cell_text_view_command), edit);
}
}
diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c
index bec9f5d005..cf5db5858a 100644
--- a/widgets/table/e-cell-toggle.c
+++ b/widgets/table/e-cell-toggle.c
@@ -39,6 +39,10 @@
#include "e-cell-toggle.h"
#include "e-table-item.h"
+#define E_CELL_TOGGLE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CELL_TOGGLE, ECellTogglePrivate))
+
struct _ECellTogglePrivate {
gchar **icon_names;
guint n_icon_names;
@@ -97,7 +101,7 @@ cell_toggle_dispose (GObject *object)
{
ECellTogglePrivate *priv;
- priv = E_CELL_TOGGLE (object)->priv;
+ priv = E_CELL_TOGGLE_GET_PRIVATE (object);
if (priv->empty != NULL) {
g_object_unref (priv->empty);
@@ -117,7 +121,7 @@ cell_toggle_finalize (GObject *object)
ECellTogglePrivate *priv;
guint ii;
- priv = E_CELL_TOGGLE (object)->priv;
+ priv = E_CELL_TOGGLE_GET_PRIVATE (object);
/* The array is not NULL-terminated,
* so g_strfreev() will not work. */
@@ -184,7 +188,7 @@ cell_toggle_draw (ECellView *ecell_view,
const gint value = GPOINTER_TO_INT (
e_table_model_value_at (ecell_view->e_table_model, model_col, row));
- priv = E_CELL_TOGGLE (ecell_view->ecell)->priv;
+ priv = E_CELL_TOGGLE_GET_PRIVATE (ecell_view->ecell);
if (value < 0 || value >= priv->pixbufs->len)
return;
@@ -216,7 +220,7 @@ etog_set_value (ECellToggleView *toggle_view,
{
ECellTogglePrivate *priv;
- priv = E_CELL_TOGGLE (toggle_view->cell_view.ecell)->priv;
+ priv = E_CELL_TOGGLE_GET_PRIVATE (toggle_view->cell_view.ecell);
if (value >= priv->pixbufs->len)
value = 0;
@@ -268,7 +272,7 @@ cell_toggle_height (ECellView *ecell_view,
{
ECellTogglePrivate *priv;
- priv = E_CELL_TOGGLE (ecell_view->ecell)->priv;
+ priv = E_CELL_TOGGLE_GET_PRIVATE (ecell_view->ecell);
return priv->height;
}
@@ -290,7 +294,7 @@ cell_toggle_print (ECellView *ecell_view,
cairo_t *cr;
- priv = E_CELL_TOGGLE (ecell_view->ecell)->priv;
+ priv = E_CELL_TOGGLE_GET_PRIVATE (ecell_view->ecell);
if (value >= priv->pixbufs->len)
return;
@@ -323,7 +327,7 @@ cell_toggle_print_height (ECellView *ecell_view,
{
ECellTogglePrivate *priv;
- priv = E_CELL_TOGGLE (ecell_view->ecell)->priv;
+ priv = E_CELL_TOGGLE_GET_PRIVATE (ecell_view->ecell);
return priv->height;
}
@@ -338,7 +342,7 @@ cell_toggle_max_width (ECellView *ecell_view,
gint number_of_rows;
gint row;
- priv = E_CELL_TOGGLE (ecell_view->ecell)->priv;
+ priv = E_CELL_TOGGLE_GET_PRIVATE (ecell_view->ecell);
number_of_rows = e_table_model_row_count (ecell_view->e_table_model);
for (row = 0; row < number_of_rows; row++) {
@@ -385,8 +389,7 @@ e_cell_toggle_class_init (ECellToggleClass *class)
static void
e_cell_toggle_init (ECellToggle *cell_toggle)
{
- cell_toggle->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- cell_toggle, E_TYPE_CELL_TOGGLE, ECellTogglePrivate);
+ cell_toggle->priv = E_CELL_TOGGLE_GET_PRIVATE (cell_toggle);
cell_toggle->priv->empty =
gdk_pixbuf_new_from_xpm_data (empty_xpm);
diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c
index 88762f6a7a..b9b96eecb0 100644
--- a/widgets/table/e-cell.c
+++ b/widgets/table/e-cell.c
@@ -33,8 +33,6 @@
G_DEFINE_TYPE (ECell, e_cell, G_TYPE_OBJECT)
-#define ECVIEW_EC_CLASS(v) (E_CELL_GET_CLASS (v->ecell))
-
static ECellView *
ec_new_view (ECell *ecell,
ETableModel *table_model,
@@ -210,7 +208,8 @@ e_cell_init (ECell *cell)
* @view_col: the column in the view
* @row: the row
* @flags: flags about the current state
- * @actions: A second return value in case the cell wants to take some action (specifically grabbing & ungrabbing)
+ * @actions: a second return value in case the cell wants to take some action
+ * (specifically grabbing & ungrabbing)
*
* Dispatches the event @event to the @ecell_view for.
*
@@ -225,24 +224,31 @@ e_cell_event (ECellView *ecell_view,
ECellFlags flags,
ECellActions *actions)
{
- return ECVIEW_EC_CLASS (ecell_view)->event (
- ecell_view, event, model_col, view_col, row, flags, actions);
+ ECellClass *class;
+
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+
+ return class->event (
+ ecell_view, event, model_col,
+ view_col, row, flags, actions);
}
/**
* e_cell_new_view:
* @ecell: the Ecell that will create the new view
* @table_model: the table model the ecell is bound to
- * @e_table_item_view: An ETableItem object (the CanvasItem that reprensents the view of the table)
+ * @e_table_item_view: an ETableItem object (the CanvasItem that
+ * reprensents the view of the table)
*
* ECell renderers new to be bound to a table_model and to the actual view
* during their life time to actually render the data. This method is invoked
* by the ETableItem canvas item to instatiate a new view of the ECell.
*
- * This is invoked when the ETableModel is attached to the ETableItem (a CanvasItem
- * that can render ETableModels in the screen).
+ * This is invoked when the ETableModel is attached to the ETableItem
+ * (a CanvasItem that can render ETableModels in the screen).
*
- * Returns: a new ECellView for this @ecell on the @table_model displayed on the @e_table_item_view.
+ * Returns: a new ECellView for this @ecell on the @table_model displayed
+ * on the @e_table_item_view.
*/
ECellView *
e_cell_new_view (ECell *ecell,
@@ -264,7 +270,12 @@ e_cell_new_view (ECell *ecell,
void
e_cell_realize (ECellView *ecell_view)
{
- ECVIEW_EC_CLASS (ecell_view)->realize (ecell_view);
+ ECellClass *class;
+
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+ g_return_if_fail (class->realize != NULL);
+
+ class->realize (ecell_view);
}
/**
@@ -276,7 +287,12 @@ e_cell_realize (ECellView *ecell_view)
void
e_cell_kill_view (ECellView *ecell_view)
{
- ECVIEW_EC_CLASS (ecell_view)->kill_view (ecell_view);
+ ECellClass *class;
+
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+ g_return_if_fail (class->kill_view != NULL);
+
+ class->kill_view (ecell_view);
}
/**
@@ -290,7 +306,12 @@ e_cell_kill_view (ECellView *ecell_view)
void
e_cell_unrealize (ECellView *ecell_view)
{
- ECVIEW_EC_CLASS (ecell_view)->unrealize (ecell_view);
+ ECellClass *class;
+
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+ g_return_if_fail (class->unrealize != NULL);
+
+ class->unrealize (ecell_view);
}
/**
@@ -324,13 +345,21 @@ e_cell_draw (ECellView *ecell_view,
gint x2,
gint y2)
{
+ ECellClass *class;
+
g_return_if_fail (ecell_view != NULL);
g_return_if_fail (row >= 0);
g_return_if_fail (row < e_table_model_row_count (ecell_view->e_table_model));
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+ g_return_if_fail (class->draw != NULL);
+
cairo_save (cr);
- ECVIEW_EC_CLASS (ecell_view)->draw (ecell_view, cr, model_col, view_col, row, flags, x1, y1, x2, y2);
+ class->draw (
+ ecell_view, cr,
+ model_col, view_col,
+ row, flags, x1, y1, x2, y2);
cairo_restore (cr);
}
@@ -356,8 +385,15 @@ e_cell_print (ECellView *ecell_view,
gdouble width,
gdouble height)
{
- if (ECVIEW_EC_CLASS (ecell_view)->print)
- ECVIEW_EC_CLASS (ecell_view)->print (ecell_view, context, model_col, view_col, row, width, height);
+ ECellClass *class;
+
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+
+ if (class->print != NULL)
+ class->print (
+ ecell_view, context,
+ model_col, view_col,
+ row, width, height);
}
/**
@@ -373,11 +409,17 @@ e_cell_print_height (ECellView *ecell_view,
gint row,
gdouble width)
{
- if (ECVIEW_EC_CLASS (ecell_view)->print_height)
- return ECVIEW_EC_CLASS (ecell_view)->print_height
- (ecell_view, context, model_col, view_col, row, width);
- else
+ ECellClass *class;
+
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+
+ if (class->print_height == NULL)
return 0.0;
+
+ return class->print_height (
+ ecell_view, context,
+ model_col, view_col,
+ row, width);
}
/**
@@ -396,7 +438,12 @@ e_cell_height (ECellView *ecell_view,
gint view_col,
gint row)
{
- return ECVIEW_EC_CLASS (ecell_view)->height (ecell_view, model_col, view_col, row);
+ ECellClass *class;
+
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+ g_return_val_if_fail (class->height != NULL, 0);
+
+ return class->height (ecell_view, model_col, view_col, row);
}
/**
@@ -415,7 +462,12 @@ e_cell_enter_edit (ECellView *ecell_view,
gint view_col,
gint row)
{
- return ECVIEW_EC_CLASS (ecell_view)->enter_edit (ecell_view, model_col, view_col, row);
+ ECellClass *class;
+
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+ g_return_val_if_fail (class->enter_edit != NULL, NULL);
+
+ return class->enter_edit (ecell_view, model_col, view_col, row);
}
/**
@@ -436,7 +488,12 @@ e_cell_leave_edit (ECellView *ecell_view,
gint row,
gpointer edit_context)
{
- ECVIEW_EC_CLASS (ecell_view)->leave_edit (ecell_view, model_col, view_col, row, edit_context);
+ ECellClass *class;
+
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+ g_return_if_fail (class->leave_edit != NULL);
+
+ class->leave_edit (ecell_view, model_col, view_col, row, edit_context);
}
/**
@@ -460,10 +517,15 @@ e_cell_save_state (ECellView *ecell_view,
gint row,
gpointer edit_context)
{
- if (ECVIEW_EC_CLASS (ecell_view)->save_state)
- return ECVIEW_EC_CLASS (ecell_view)->save_state (ecell_view, model_col, view_col, row, edit_context);
- else
+ ECellClass *class;
+
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+
+ if (class->save_state == NULL)
return NULL;
+
+ return class->save_state (
+ ecell_view, model_col, view_col, row, edit_context);
}
/**
@@ -485,12 +547,18 @@ e_cell_load_state (ECellView *ecell_view,
gpointer edit_context,
gpointer save_state)
{
- if (ECVIEW_EC_CLASS (ecell_view)->load_state)
- ECVIEW_EC_CLASS (ecell_view)->load_state (ecell_view, model_col, view_col, row, edit_context, save_state);
+ ECellClass *class;
+
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+
+ if (class->load_state != NULL)
+ class->load_state (
+ ecell_view, model_col, view_col,
+ row, edit_context, save_state);
}
/**
- * e_cell_load_state:
+ * e_cell_free_state:
* @ecell_view: the ECellView
* @model_col: the column in the model
* @view_col: the column in the view
@@ -507,8 +575,13 @@ e_cell_free_state (ECellView *ecell_view,
gint row,
gpointer save_state)
{
- if (ECVIEW_EC_CLASS (ecell_view)->free_state)
- ECVIEW_EC_CLASS (ecell_view)->free_state (ecell_view, model_col, view_col, row, save_state);
+ ECellClass *class;
+
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+
+ if (class->free_state != NULL)
+ class->free_state (
+ ecell_view, model_col, view_col, row, save_state);
}
/**
@@ -525,8 +598,12 @@ e_cell_max_width (ECellView *ecell_view,
gint model_col,
gint view_col)
{
- return ECVIEW_EC_CLASS (ecell_view)->max_width
- (ecell_view, model_col, view_col);
+ ECellClass *class;
+
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+ g_return_val_if_fail (class->max_width != NULL, 0);
+
+ return class->max_width (ecell_view, model_col, view_col);
}
/**
@@ -545,11 +622,14 @@ e_cell_max_width_by_row (ECellView *ecell_view,
gint view_col,
gint row)
{
- if (ECVIEW_EC_CLASS (ecell_view)->max_width_by_row)
- return ECVIEW_EC_CLASS (ecell_view)->max_width_by_row
- (ecell_view, model_col, view_col, row);
- else
+ ECellClass *class;
+
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+
+ if (class->max_width_by_row == NULL)
return e_cell_max_width (ecell_view, model_col, view_col);
+
+ return class->max_width_by_row (ecell_view, model_col, view_col, row);
}
/**
@@ -565,24 +645,36 @@ e_cell_max_width_by_row (ECellView *ecell_view,
gboolean
e_cell_max_width_by_row_implemented (ECellView *ecell_view)
{
- return (ECVIEW_EC_CLASS (ecell_view)->max_width_by_row != NULL);
+ ECellClass *class;
+
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+
+ return (class->max_width_by_row != NULL);
}
gchar *
e_cell_get_bg_color (ECellView *ecell_view,
gint row)
{
- if (ECVIEW_EC_CLASS (ecell_view)->get_bg_color)
- return ECVIEW_EC_CLASS (ecell_view)->get_bg_color (ecell_view, row);
- else
+ ECellClass *class;
+
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+
+ if (class->get_bg_color == NULL)
return NULL;
+
+ return class->get_bg_color (ecell_view, row);
}
void
e_cell_style_set (ECellView *ecell_view,
GtkStyle *previous_style)
{
- if (ECVIEW_EC_CLASS (ecell_view)->style_set)
- ECVIEW_EC_CLASS (ecell_view)->style_set (ecell_view, previous_style);
+ ECellClass *class;
+
+ class = E_CELL_GET_CLASS (ecell_view->ecell);
+
+ if (class->style_set != NULL)
+ class->style_set (ecell_view, previous_style);
}
diff --git a/widgets/table/e-popup-menu.c b/widgets/table/e-popup-menu.c
index a4cfec07e9..faffd9d1a0 100644
--- a/widgets/table/e-popup-menu.c
+++ b/widgets/table/e-popup-menu.c
@@ -94,9 +94,10 @@ e_popup_menu_create_with_domain (EPopupMenu *menu_list,
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
if (menu_list[i].fn)
- g_signal_connect (item, "activate",
- G_CALLBACK (menu_list[i].fn),
- default_closure);
+ g_signal_connect (
+ item, "activate",
+ G_CALLBACK (menu_list[i].fn),
+ default_closure);
if (menu_list[i].disable_mask & disable_mask)
gtk_widget_set_sensitive (item, FALSE);
diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c
index 8defc2c479..8cb7d060a9 100644
--- a/widgets/table/e-table-click-to-add.c
+++ b/widgets/table/e-table-click-to-add.c
@@ -387,8 +387,9 @@ finish_editing (ETableClickToAdd *etcta)
"cursor_mode", E_CURSOR_SPREADSHEET,
NULL);
- g_signal_connect (etcta->row, "key_press",
- G_CALLBACK (item_key_press), etcta);
+ g_signal_connect (
+ etcta->row, "key_press",
+ G_CALLBACK (item_key_press), etcta);
set_initial_selection (etcta);
}
@@ -436,8 +437,9 @@ etcta_event (GnomeCanvasItem *item,
"cursor_mode", E_CURSOR_SPREADSHEET,
NULL);
- g_signal_connect (etcta->row, "key_press",
- G_CALLBACK (item_key_press), etcta);
+ g_signal_connect (
+ etcta->row, "key_press",
+ G_CALLBACK (item_key_press), etcta);
e_canvas_item_grab_focus (GNOME_CANVAS_ITEM (etcta->row), TRUE);
@@ -596,8 +598,9 @@ etcta_init (ETableClickToAdd *etcta)
etcta->height = 6;
etcta->selection = e_table_selection_model_new ();
- g_signal_connect (etcta->selection, "cursor_changed",
- G_CALLBACK (etcta_cursor_change), etcta);
+ g_signal_connect (
+ etcta->selection, "cursor_changed",
+ G_CALLBACK (etcta_cursor_change), etcta);
e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM (etcta), etcta_reflow);
diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c
index 4e9fe81117..728616db3b 100644
--- a/widgets/table/e-table-config.c
+++ b/widgets/table/e-table-config.c
@@ -1197,13 +1197,15 @@ config_button_down (GtkWidget *widget,
if (columns == NULL)
return;
- new_shown = g_new (int, config->temp_state->col_count);
- new_expansions = g_new (double, config->temp_state->col_count);
+ new_shown = g_new (gint, config->temp_state->col_count);
+ new_expansions = g_new (gdouble, config->temp_state->col_count);
column = columns;
- next_col = config->temp_state->columns[config->temp_state->col_count - 1];
- next_expansion = config->temp_state->expansions[config->temp_state->col_count - 1];
+ next_col =
+ config->temp_state->columns[config->temp_state->col_count - 1];
+ next_expansion =
+ config->temp_state->expansions[config->temp_state->col_count - 1];
for (i = config->temp_state->col_count - 1; i > 0; i--) {
if (column && (GPOINTER_TO_INT (column->data) == i - 1)) {
@@ -1352,8 +1354,9 @@ setup_gui (ETableConfig *config)
g_object_weak_ref (G_OBJECT (config->dialog_toplevel),
dialog_destroyed, config);
- g_signal_connect (config->dialog_toplevel, "response",
- G_CALLBACK (dialog_response), config);
+ g_signal_connect (
+ config->dialog_toplevel, "response",
+ G_CALLBACK (dialog_response), config);
g_object_unref (builder);
}
diff --git a/widgets/table/e-table-extras.c b/widgets/table/e-table-extras.c
index f3e55cf8cf..d39677bbc8 100644
--- a/widgets/table/e-table-extras.c
+++ b/widgets/table/e-table-extras.c
@@ -43,6 +43,10 @@
#include "e-table-extras.h"
#include "e-table-sorting-utils.h"
+#define E_TABLE_EXTRAS_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TABLE_EXTRAS, ETableExtrasPrivate))
+
struct _ETableExtrasPrivate {
GHashTable *cells;
GHashTable *compares;
@@ -59,7 +63,7 @@ ete_finalize (GObject *object)
{
ETableExtrasPrivate *priv;
- priv = E_TABLE_EXTRAS (object)->priv;
+ priv = E_TABLE_EXTRAS_GET_PRIVATE (object);
if (priv->cells) {
g_hash_table_destroy (priv->cells);
@@ -237,8 +241,7 @@ ete_init (ETableExtras *extras)
{
ECell *cell, *sub_cell;
- extras->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- extras, E_TYPE_TABLE_EXTRAS, ETableExtrasPrivate);
+ extras->priv = E_TABLE_EXTRAS_GET_PRIVATE (extras);
extras->priv->cells = g_hash_table_new_full (
g_str_hash, g_str_equal,
diff --git a/widgets/table/e-table-field-chooser-dialog.c b/widgets/table/e-table-field-chooser-dialog.c
index 354095b0c8..5b99c3a79f 100644
--- a/widgets/table/e-table-field-chooser-dialog.c
+++ b/widgets/table/e-table-field-chooser-dialog.c
@@ -32,12 +32,6 @@
#include "e-table-field-chooser-dialog.h"
-static void e_table_field_chooser_dialog_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
-static void e_table_field_chooser_dialog_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
-static void e_table_field_chooser_dialog_dispose (GObject *object);
-static void e_table_field_chooser_dialog_response (GtkDialog *dialog, gint id);
-
-/* The arguments we take */
enum {
PROP_0,
PROP_DND_CODE,
@@ -45,105 +39,10 @@ enum {
PROP_HEADER
};
-G_DEFINE_TYPE (ETableFieldChooserDialog, e_table_field_chooser_dialog, GTK_TYPE_DIALOG)
-
-static void
-e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *class)
-{
- GObjectClass *object_class;
- GtkDialogClass *dialog_class;
-
- object_class = (GObjectClass *) class;
- dialog_class = GTK_DIALOG_CLASS (class);
-
- object_class->dispose = e_table_field_chooser_dialog_dispose;
- object_class->set_property = e_table_field_chooser_dialog_set_property;
- object_class->get_property = e_table_field_chooser_dialog_get_property;
-
- dialog_class->response = e_table_field_chooser_dialog_response;
-
- g_object_class_install_property (object_class, PROP_DND_CODE,
- g_param_spec_string ("dnd_code",
- "DnD code",
- NULL,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FULL_HEADER,
- g_param_spec_object ("full_header",
- "Full Header",
- NULL,
- E_TYPE_TABLE_HEADER,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_HEADER,
- g_param_spec_object ("header",
- "Header",
- NULL,
- E_TYPE_TABLE_HEADER,
- G_PARAM_READWRITE));
-}
-
-static void
-e_table_field_chooser_dialog_init (ETableFieldChooserDialog *e_table_field_chooser_dialog)
-{
- GtkDialog *dialog;
- GtkWidget *content_area;
- GtkWidget *widget;
-
- dialog = GTK_DIALOG (e_table_field_chooser_dialog);
-
- e_table_field_chooser_dialog->etfc = NULL;
- e_table_field_chooser_dialog->dnd_code = g_strdup("");
- e_table_field_chooser_dialog->full_header = NULL;
- e_table_field_chooser_dialog->header = NULL;
-
- gtk_dialog_add_button (dialog, GTK_STOCK_CLOSE, GTK_RESPONSE_OK);
-
- gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
-
- widget = e_table_field_chooser_new ();
- e_table_field_chooser_dialog->etfc = E_TABLE_FIELD_CHOOSER (widget);
-
- g_object_set (widget,
- "dnd_code", e_table_field_chooser_dialog->dnd_code,
- "full_header", e_table_field_chooser_dialog->full_header,
- "header", e_table_field_chooser_dialog->header,
- NULL);
-
- content_area = gtk_dialog_get_content_area (dialog);
- gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
-
- gtk_widget_show (GTK_WIDGET (widget));
-
- gtk_window_set_title (GTK_WINDOW (dialog), _("Add a Column"));
-}
-
-GtkWidget *
-e_table_field_chooser_dialog_new (void)
-{
- return g_object_new (E_TYPE_TABLE_FIELD_CHOOSER_DIALOG, NULL);
-}
-
-static void
-e_table_field_chooser_dialog_dispose (GObject *object)
-{
- ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG (object);
-
- if (etfcd->dnd_code)
- g_free (etfcd->dnd_code);
- etfcd->dnd_code = NULL;
-
- if (etfcd->full_header)
- g_object_unref (etfcd->full_header);
- etfcd->full_header = NULL;
-
- if (etfcd->header)
- g_object_unref (etfcd->header);
- etfcd->header = NULL;
-
- G_OBJECT_CLASS (e_table_field_chooser_dialog_parent_class)->dispose (object);
-}
+G_DEFINE_TYPE (
+ ETableFieldChooserDialog,
+ e_table_field_chooser_dialog,
+ GTK_TYPE_DIALOG)
static void
e_table_field_chooser_dialog_set_property (GObject *object,
@@ -218,9 +117,116 @@ e_table_field_chooser_dialog_get_property (GObject *object,
}
static void
+e_table_field_chooser_dialog_dispose (GObject *object)
+{
+ ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG (object);
+
+ if (etfcd->dnd_code)
+ g_free (etfcd->dnd_code);
+ etfcd->dnd_code = NULL;
+
+ if (etfcd->full_header)
+ g_object_unref (etfcd->full_header);
+ etfcd->full_header = NULL;
+
+ if (etfcd->header)
+ g_object_unref (etfcd->header);
+ etfcd->header = NULL;
+
+ G_OBJECT_CLASS (e_table_field_chooser_dialog_parent_class)->dispose (object);
+}
+
+static void
e_table_field_chooser_dialog_response (GtkDialog *dialog,
gint id)
{
if (id == GTK_RESPONSE_OK)
gtk_widget_destroy (GTK_WIDGET (dialog));
}
+
+static void
+e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *class)
+{
+ GObjectClass *object_class;
+ GtkDialogClass *dialog_class;
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = e_table_field_chooser_dialog_set_property;
+ object_class->get_property = e_table_field_chooser_dialog_get_property;
+ object_class->dispose = e_table_field_chooser_dialog_dispose;
+
+ dialog_class = GTK_DIALOG_CLASS (class);
+ dialog_class->response = e_table_field_chooser_dialog_response;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_DND_CODE,
+ g_param_spec_string (
+ "dnd_code",
+ "DnD code",
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FULL_HEADER,
+ g_param_spec_object (
+ "full_header",
+ "Full Header",
+ NULL,
+ E_TYPE_TABLE_HEADER,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_HEADER,
+ g_param_spec_object (
+ "header",
+ "Header",
+ NULL,
+ E_TYPE_TABLE_HEADER,
+ G_PARAM_READWRITE));
+}
+
+static void
+e_table_field_chooser_dialog_init (ETableFieldChooserDialog *e_table_field_chooser_dialog)
+{
+ GtkDialog *dialog;
+ GtkWidget *content_area;
+ GtkWidget *widget;
+
+ dialog = GTK_DIALOG (e_table_field_chooser_dialog);
+
+ e_table_field_chooser_dialog->etfc = NULL;
+ e_table_field_chooser_dialog->dnd_code = g_strdup("");
+ e_table_field_chooser_dialog->full_header = NULL;
+ e_table_field_chooser_dialog->header = NULL;
+
+ gtk_dialog_add_button (dialog, GTK_STOCK_CLOSE, GTK_RESPONSE_OK);
+
+ gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
+
+ widget = e_table_field_chooser_new ();
+ e_table_field_chooser_dialog->etfc = E_TABLE_FIELD_CHOOSER (widget);
+
+ g_object_set (widget,
+ "dnd_code", e_table_field_chooser_dialog->dnd_code,
+ "full_header", e_table_field_chooser_dialog->full_header,
+ "header", e_table_field_chooser_dialog->header,
+ NULL);
+
+ content_area = gtk_dialog_get_content_area (dialog);
+ gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
+
+ gtk_widget_show (GTK_WIDGET (widget));
+
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Add a Column"));
+}
+
+GtkWidget *
+e_table_field_chooser_dialog_new (void)
+{
+ return g_object_new (E_TYPE_TABLE_FIELD_CHOOSER_DIALOG, NULL);
+}
+
diff --git a/widgets/table/e-table-field-chooser-item.c b/widgets/table/e-table-field-chooser-item.c
index 4dd1caab07..45881d4c03 100644
--- a/widgets/table/e-table-field-chooser-item.c
+++ b/widgets/table/e-table-field-chooser-item.c
@@ -301,9 +301,11 @@ etfci_drop_table_header (ETableFieldChooserItem *etfci)
header = G_OBJECT (etfci->header);
if (etfci->table_header_structure_change_id)
- g_signal_handler_disconnect (header, etfci->table_header_structure_change_id);
+ g_signal_handler_disconnect (
+ header, etfci->table_header_structure_change_id);
if (etfci->table_header_dimension_change_id)
- g_signal_handler_disconnect (header, etfci->table_header_dimension_change_id);
+ g_signal_handler_disconnect (
+ header, etfci->table_header_dimension_change_id);
etfci->table_header_structure_change_id = 0;
etfci->table_header_dimension_change_id = 0;
diff --git a/widgets/table/e-table-field-chooser.c b/widgets/table/e-table-field-chooser.c
index 5e2cb13880..6c1a9ab365 100644
--- a/widgets/table/e-table-field-chooser.c
+++ b/widgets/table/e-table-field-chooser.c
@@ -202,18 +202,18 @@ e_table_field_chooser_init (ETableFieldChooser *etfc)
"dnd_code", etfc->dnd_code,
NULL );
- g_signal_connect ( etfc->canvas, "reflow",
- G_CALLBACK ( resize ),
- etfc);
+ g_signal_connect (
+ etfc->canvas, "reflow",
+ G_CALLBACK (resize), etfc);
- gnome_canvas_set_scroll_region ( GNOME_CANVAS ( etfc->canvas ),
- 0, 0,
- 100, 100 );
+ gnome_canvas_set_scroll_region (
+ GNOME_CANVAS (etfc->canvas),
+ 0, 0, 100, 100 );
/* Connect the signals */
- g_signal_connect (etfc->canvas, "size_allocate",
- G_CALLBACK (allocate_callback),
- etfc);
+ g_signal_connect (
+ etfc->canvas, "size_allocate",
+ G_CALLBACK (allocate_callback), etfc);
gtk_widget_show_all (widget);
}
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c
index 7d04eda9d9..2649f9bf79 100644
--- a/widgets/table/e-table-group-container.c
+++ b/widgets/table/e-table-group-container.c
@@ -481,20 +481,27 @@ create_child_node (ETableGroupContainer *etgc,
"minimum_width", etgc->minimum_width - GROUP_INDENT,
NULL);
- g_signal_connect (child, "cursor_change",
- G_CALLBACK (child_cursor_change), etgc);
- g_signal_connect (child, "cursor_activated",
- G_CALLBACK (child_cursor_activated), etgc);
- g_signal_connect (child, "double_click",
- G_CALLBACK (child_double_click), etgc);
- g_signal_connect (child, "right_click",
- G_CALLBACK (child_right_click), etgc);
- g_signal_connect (child, "click",
- G_CALLBACK (child_click), etgc);
- g_signal_connect (child, "key_press",
- G_CALLBACK (child_key_press), etgc);
- g_signal_connect (child, "start_drag",
- G_CALLBACK (child_start_drag), etgc);
+ g_signal_connect (
+ child, "cursor_change",
+ G_CALLBACK (child_cursor_change), etgc);
+ g_signal_connect (
+ child, "cursor_activated",
+ G_CALLBACK (child_cursor_activated), etgc);
+ g_signal_connect (
+ child, "double_click",
+ G_CALLBACK (child_double_click), etgc);
+ g_signal_connect (
+ child, "right_click",
+ G_CALLBACK (child_right_click), etgc);
+ g_signal_connect (
+ child, "click",
+ G_CALLBACK (child_click), etgc);
+ g_signal_connect (
+ child, "key_press",
+ G_CALLBACK (child_key_press), etgc);
+ g_signal_connect (
+ child, "start_drag",
+ G_CALLBACK (child_start_drag), etgc);
child_node->child = child;
child_node->key = e_table_model_duplicate_value (etg->model, etgc->ecol->col_idx, val);
child_node->string = e_table_model_value_to_string (etg->model, etgc->ecol->col_idx, val);
@@ -1560,29 +1567,30 @@ etgc_get_printable (ETableGroup *etg)
groupcontext->child = etgc->children;
groupcontext->child_printable = NULL;
- g_signal_connect (printable,
- "print_page",
- G_CALLBACK (e_table_group_container_print_page),
- groupcontext);
- g_signal_connect (printable,
- "data_left",
- G_CALLBACK (e_table_group_container_data_left),
- groupcontext);
- g_signal_connect (printable,
- "reset",
- G_CALLBACK (e_table_group_container_reset),
- groupcontext);
- g_signal_connect (printable,
- "height",
- G_CALLBACK (e_table_group_container_height),
- groupcontext);
- g_signal_connect (printable,
- "will_fit",
- G_CALLBACK (e_table_group_container_will_fit),
- groupcontext);
- g_object_weak_ref (G_OBJECT (printable),
- e_table_group_container_printable_destroy,
- groupcontext);
+ g_signal_connect (
+ printable, "print_page",
+ G_CALLBACK (e_table_group_container_print_page),
+ groupcontext);
+ g_signal_connect (
+ printable, "data_left",
+ G_CALLBACK (e_table_group_container_data_left),
+ groupcontext);
+ g_signal_connect (
+ printable, "reset",
+ G_CALLBACK (e_table_group_container_reset),
+ groupcontext);
+ g_signal_connect (
+ printable, "height",
+ G_CALLBACK (e_table_group_container_height),
+ groupcontext);
+ g_signal_connect (
+ printable, "will_fit",
+ G_CALLBACK (e_table_group_container_will_fit),
+ groupcontext);
+ g_object_weak_ref (
+ G_OBJECT (printable),
+ e_table_group_container_printable_destroy,
+ groupcontext);
return printable;
}
diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c
index 27a62bbb16..aface8e697 100644
--- a/widgets/table/e-table-group-leaf.c
+++ b/widgets/table/e-table-group-leaf.c
@@ -297,35 +297,33 @@ etgl_realize (GnomeCanvasItem *item)
"uniform_row_height", etgl->uniform_row_height,
NULL));
- etgl->etgl_cursor_change_id = g_signal_connect (etgl->item,
- "cursor_change",
- G_CALLBACK (etgl_cursor_change),
- etgl);
- etgl->etgl_cursor_activated_id = g_signal_connect (etgl->item,
- "cursor_activated",
- G_CALLBACK (etgl_cursor_activated),
- etgl);
- etgl->etgl_double_click_id = g_signal_connect (etgl->item,
- "double_click",
- G_CALLBACK (etgl_double_click),
- etgl);
-
- etgl->etgl_right_click_id = g_signal_connect (etgl->item,
- "right_click",
- G_CALLBACK (etgl_right_click),
- etgl);
- etgl->etgl_click_id = g_signal_connect (etgl->item,
- "click",
- G_CALLBACK (etgl_click),
- etgl);
- etgl->etgl_key_press_id = g_signal_connect (etgl->item,
- "key_press",
- G_CALLBACK (etgl_key_press),
- etgl);
- etgl->etgl_start_drag_id = g_signal_connect (etgl->item,
- "start_drag",
- G_CALLBACK (etgl_start_drag),
- etgl);
+ etgl->etgl_cursor_change_id = g_signal_connect (
+ etgl->item, "cursor_change",
+ G_CALLBACK (etgl_cursor_change), etgl);
+
+ etgl->etgl_cursor_activated_id = g_signal_connect (
+ etgl->item, "cursor_activated",
+ G_CALLBACK (etgl_cursor_activated), etgl);
+
+ etgl->etgl_double_click_id = g_signal_connect (
+ etgl->item, "double_click",
+ G_CALLBACK (etgl_double_click), etgl);
+
+ etgl->etgl_right_click_id = g_signal_connect (
+ etgl->item, "right_click",
+ G_CALLBACK (etgl_right_click), etgl);
+
+ etgl->etgl_click_id = g_signal_connect (
+ etgl->item, "click",
+ G_CALLBACK (etgl_click), etgl);
+
+ etgl->etgl_key_press_id = g_signal_connect (
+ etgl->item, "key_press",
+ G_CALLBACK (etgl_key_press), etgl);
+
+ etgl->etgl_start_drag_id = g_signal_connect (
+ etgl->item, "start_drag",
+ G_CALLBACK (etgl_start_drag), etgl);
e_canvas_item_request_reflow (item);
}
@@ -647,89 +645,127 @@ etgl_class_init (ETableGroupLeafClass *class)
e_group_class->get_mouse_over = etgl_get_mouse_over;
e_group_class->get_cell_geometry = etgl_get_cell_geometry;
- g_object_class_install_property (object_class, PROP_TABLE_ALTERNATING_ROW_COLORS,
- g_param_spec_boolean ("alternating_row_colors",
- "Alternating Row Colors",
- "Alternating Row Colors",
- FALSE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_TABLE_HORIZONTAL_DRAW_GRID,
- g_param_spec_boolean ("horizontal_draw_grid",
- "Horizontal Draw Grid",
- "Horizontal Draw Grid",
- FALSE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_TABLE_VERTICAL_DRAW_GRID,
- g_param_spec_boolean ("vertical_draw_grid",
- "Vertical Draw Grid",
- "Vertical Draw Grid",
- FALSE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_TABLE_DRAW_FOCUS,
- g_param_spec_boolean ("drawfocus",
- "Draw focus",
- "Draw focus",
- FALSE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_CURSOR_MODE,
- g_param_spec_int ("cursor_mode",
- "Cursor mode",
- "Cursor mode",
- E_CURSOR_LINE, E_CURSOR_SPREADSHEET, E_CURSOR_LINE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_LENGTH_THRESHOLD,
- g_param_spec_int ("length_threshold",
- "Length Threshold",
- "Length Threshold",
- -1, G_MAXINT, 0,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_SELECTION_MODEL,
- g_param_spec_object ("selection_model",
- "Selection model",
- "Selection model",
- E_TYPE_SELECTION_MODEL,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_HEIGHT,
- g_param_spec_double ("height",
- "Height",
- "Height",
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READABLE));
-
- g_object_class_install_property (object_class, PROP_WIDTH,
- g_param_spec_double ("width",
- "Width",
- "Width",
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- 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_FROZEN,
- g_param_spec_boolean ("frozen",
- "Frozen",
- "Frozen",
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_UNIFORM_ROW_HEIGHT,
- g_param_spec_boolean ("uniform_row_height",
- "Uniform row height",
- "Uniform row height",
- FALSE,
- G_PARAM_READWRITE));
+ g_object_class_install_property (
+ object_class,
+ PROP_TABLE_ALTERNATING_ROW_COLORS,
+ g_param_spec_boolean (
+ "alternating_row_colors",
+ "Alternating Row Colors",
+ "Alternating Row Colors",
+ FALSE,
+ G_PARAM_WRITABLE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_TABLE_HORIZONTAL_DRAW_GRID,
+ g_param_spec_boolean (
+ "horizontal_draw_grid",
+ "Horizontal Draw Grid",
+ "Horizontal Draw Grid",
+ FALSE,
+ G_PARAM_WRITABLE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_TABLE_VERTICAL_DRAW_GRID,
+ g_param_spec_boolean (
+ "vertical_draw_grid",
+ "Vertical Draw Grid",
+ "Vertical Draw Grid",
+ FALSE,
+ G_PARAM_WRITABLE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_TABLE_DRAW_FOCUS,
+ g_param_spec_boolean (
+ "drawfocus",
+ "Draw focus",
+ "Draw focus",
+ FALSE,
+ G_PARAM_WRITABLE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CURSOR_MODE,
+ g_param_spec_int (
+ "cursor_mode",
+ "Cursor mode",
+ "Cursor mode",
+ E_CURSOR_LINE,
+ E_CURSOR_SPREADSHEET,
+ E_CURSOR_LINE,
+ G_PARAM_WRITABLE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_LENGTH_THRESHOLD,
+ g_param_spec_int (
+ "length_threshold",
+ "Length Threshold",
+ "Length Threshold",
+ -1, G_MAXINT, 0,
+ G_PARAM_WRITABLE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SELECTION_MODEL,
+ g_param_spec_object (
+ "selection_model",
+ "Selection model",
+ "Selection model",
+ E_TYPE_SELECTION_MODEL,
+ G_PARAM_WRITABLE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_HEIGHT,
+ g_param_spec_double (
+ "height",
+ "Height",
+ "Height",
+ 0.0, G_MAXDOUBLE, 0.0,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_WIDTH,
+ g_param_spec_double (
+ "width",
+ "Width",
+ "Width",
+ 0.0, G_MAXDOUBLE, 0.0,
+ G_PARAM_READWRITE));
+
+ 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_FROZEN,
+ g_param_spec_boolean (
+ "frozen",
+ "Frozen",
+ "Frozen",
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_UNIFORM_ROW_HEIGHT,
+ g_param_spec_boolean (
+ "uniform_row_height",
+ "Uniform row height",
+ "Uniform row height",
+ FALSE,
+ G_PARAM_READWRITE));
}
static void
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index 43871a278a..780720e1aa 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -121,9 +121,11 @@ ethi_dispose (GObject *object)
if (ethi->sort_info) {
if (ethi->sort_info_changed_id)
- g_signal_handler_disconnect (ethi->sort_info, ethi->sort_info_changed_id);
+ g_signal_handler_disconnect (
+ ethi->sort_info, ethi->sort_info_changed_id);
if (ethi->group_info_changed_id)
- g_signal_handler_disconnect (ethi->sort_info, ethi->group_info_changed_id);
+ g_signal_handler_disconnect (
+ ethi->sort_info, ethi->group_info_changed_id);
g_object_unref (ethi->sort_info);
ethi->sort_info = NULL;
}
@@ -205,22 +207,18 @@ ethi_update (GnomeCanvasItem *item,
if (item->x1 != x1 ||
item->y1 != y1 ||
item->x2 != x2 ||
- item->y2 != y2)
- {
- gnome_canvas_request_redraw (
- item->canvas,
- item->x1, item->y1,
- item->x2, item->y2);
- item->x1 = x1;
- item->y1 = y1;
- item->x2 = x2;
- item->y2 = y2;
-/* FIXME: Group Child bounds !? (FOO BAA) */
-#if 0
- 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);
+ item->y2 != y2) {
+ gnome_canvas_request_redraw (
+ item->canvas,
+ item->x1, item->y1,
+ item->x2, item->y2);
+ item->x1 = x1;
+ item->y1 = y1;
+ item->x2 = x2;
+ item->y2 = y2;
+ }
+ gnome_canvas_request_redraw (
+ item->canvas, item->x1, item->y1, item->x2, item->y2);
}
static void
@@ -835,9 +833,15 @@ ethi_drag_data_received (GtkWidget *canvas,
if (!found) {
count = e_table_header_count (ethi->full_header);
for (i = 0; i < count; i++) {
- ETableCol *ecol = e_table_header_get_column (ethi->full_header, i);
+ ETableCol *ecol;
+
+ ecol = e_table_header_get_column (
+ ethi->full_header, i);
+
if (ecol->col_idx == column) {
- e_table_header_add_column (ethi->eth, ecol, drop_col);
+ e_table_header_add_column (
+ ethi->eth, ecol,
+ drop_col);
break;
}
}
@@ -893,7 +897,10 @@ ethi_drag_drop (GtkWidget *canvas,
gchar *target = g_strdup_printf (
"%s-%s", TARGET_ETABLE_COL_TYPE, ethi->dnd_code);
d(g_print ("ethi - %s\n", target));
- gtk_drag_get_data (canvas, context, gdk_atom_intern (target, FALSE), time);
+ gtk_drag_get_data (
+ canvas, context,
+ gdk_atom_intern (target, FALSE),
+ time);
g_free (target);
}
}
@@ -941,20 +948,26 @@ ethi_realize (GnomeCanvasItem *item)
g_free ((gpointer) ethi_drop_types[0].target);
/* Drop signals */
- ethi->drag_motion_id = g_signal_connect (item->canvas, "drag_motion",
- G_CALLBACK (ethi_drag_motion), ethi);
- ethi->drag_leave_id = g_signal_connect (item->canvas, "drag_leave",
- G_CALLBACK (ethi_drag_leave), ethi);
- ethi->drag_drop_id = g_signal_connect (item->canvas, "drag_drop",
- G_CALLBACK (ethi_drag_drop), ethi);
- ethi->drag_data_received_id = g_signal_connect (item->canvas, "drag_data_received",
- G_CALLBACK (ethi_drag_data_received), ethi);
+ ethi->drag_motion_id = g_signal_connect (
+ item->canvas, "drag_motion",
+ G_CALLBACK (ethi_drag_motion), ethi);
+ ethi->drag_leave_id = g_signal_connect (
+ item->canvas, "drag_leave",
+ G_CALLBACK (ethi_drag_leave), ethi);
+ ethi->drag_drop_id = g_signal_connect (
+ item->canvas, "drag_drop",
+ G_CALLBACK (ethi_drag_drop), ethi);
+ ethi->drag_data_received_id = g_signal_connect (
+ item->canvas, "drag_data_received",
+ G_CALLBACK (ethi_drag_data_received), ethi);
/* Drag signals */
- ethi->drag_end_id = g_signal_connect (item->canvas, "drag_end",
- G_CALLBACK (ethi_drag_end), ethi);
- ethi->drag_data_get_id = g_signal_connect (item->canvas, "drag_data_get",
- G_CALLBACK (ethi_drag_data_get), ethi);
+ ethi->drag_end_id = g_signal_connect (
+ item->canvas, "drag_end",
+ G_CALLBACK (ethi_drag_end), ethi);
+ ethi->drag_data_get_id = g_signal_connect (
+ item->canvas, "drag_data_get",
+ G_CALLBACK (ethi_drag_data_get), ethi);
}
@@ -1699,7 +1712,9 @@ ethi_header_context_menu (ETableHeaderItem *ethi,
if (sort_col == -1)
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE);
gtk_check_menu_item_set_draw_as_radio (GTK_CHECK_MENU_ITEM (menu_item), TRUE);
- g_signal_connect (menu_item, "activate", G_CALLBACK (popup_custom), info);
+ g_signal_connect (
+ menu_item, "activate",
+ G_CALLBACK (popup_custom), info);
/* Show a seperator */
menu_item = gtk_separator_menu_item_new ();
@@ -1729,15 +1744,22 @@ ethi_header_context_menu (ETableHeaderItem *ethi,
gtk_menu_shell_prepend (GTK_MENU_SHELL (sub_menu), menu_item);
if (ncol == sort_col)
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE);
- gtk_check_menu_item_set_draw_as_radio (GTK_CHECK_MENU_ITEM (menu_item), TRUE);
- g_object_set_data (G_OBJECT (menu_item), "col-number", GINT_TO_POINTER (ncol));
- g_signal_connect (menu_item, "activate", G_CALLBACK (sort_by_id), ethi);
+ gtk_check_menu_item_set_active (
+ GTK_CHECK_MENU_ITEM (menu_item), TRUE);
+ gtk_check_menu_item_set_draw_as_radio (
+ GTK_CHECK_MENU_ITEM (menu_item), TRUE);
+ g_object_set_data (
+ G_OBJECT (menu_item), "col-number",
+ GINT_TO_POINTER (ncol));
+ g_signal_connect (
+ menu_item, "activate",
+ G_CALLBACK (sort_by_id), ethi);
}
g_object_ref_sink (popup);
- g_signal_connect (popup, "selection-done",
- G_CALLBACK (free_popup_info), info);
+ g_signal_connect (
+ popup, "selection-done",
+ G_CALLBACK (free_popup_info), info);
gtk_menu_popup (
GTK_MENU (popup),
@@ -1806,15 +1828,18 @@ ethi_change_sort_state (ETableHeaderItem *ethi,
for (j = i + 1; j < length; j++)
e_table_sort_info_sorting_set_nth (
ethi->sort_info, j - 1,
- e_table_sort_info_sorting_get_nth (ethi->sort_info, j));
+ e_table_sort_info_sorting_get_nth (
+ ethi->sort_info, j));
- e_table_sort_info_sorting_truncate (ethi->sort_info, length - 1);
+ e_table_sort_info_sorting_truncate (
+ ethi->sort_info, length - 1);
length--;
i--;
} else {
ascending = !ascending;
column.ascending = ascending;
- e_table_sort_info_sorting_set_nth (ethi->sort_info, i, column);
+ e_table_sort_info_sorting_set_nth (
+ ethi->sort_info, i, column);
}
found = TRUE;
if (model_col != -1)
@@ -1891,7 +1916,8 @@ ethi_event (GnomeCanvasItem *item,
convert (canvas, e->button.x, e->button.y, &x, &y);
- if (is_pointer_on_division (ethi, x, &start, &col) && e->button.button == 1) {
+ if (is_pointer_on_division (ethi, x, &start, &col) &&
+ e->button.button == 1) {
ETableCol *ecol;
/*
@@ -1991,8 +2017,9 @@ ethi_event (GnomeCanvasItem *item,
ethi->sort_info)) ? 0 : 16) +
128, info, GETTEXT_PACKAGE);
g_object_ref_sink (popup);
- g_signal_connect (popup, "selection-done",
- G_CALLBACK (free_popup_info), info);
+ g_signal_connect (
+ popup, "selection-done",
+ G_CALLBACK (free_popup_info), info);
gtk_menu_popup (
GTK_MENU (popup),
NULL, NULL, NULL, NULL,
diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c
index df5ee66b56..038a44a938 100644
--- a/widgets/table/e-table-header-utils.c
+++ b/widgets/table/e-table-header-utils.c
@@ -162,8 +162,12 @@ e_table_header_draw_button (cairo_t *cr,
/* Inside area */
- inner_width = button_width - (padding.left + padding.right + 2 * HEADER_PADDING);
- inner_height = button_height - (padding.top + padding.bottom + 2 * HEADER_PADDING);
+ inner_width =
+ button_width -
+ (padding.left + padding.right + 2 * HEADER_PADDING);
+ inner_height =
+ button_height -
+ (padding.top + padding.bottom + 2 * HEADER_PADDING);
if (inner_width < 1 || inner_height < 1) {
return; /* nothing fits */
diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c
index aab0971518..2045896532 100644
--- a/widgets/table/e-table-header.c
+++ b/widgets/table/e-table-header.c
@@ -902,7 +902,8 @@ eth_calc_widths (ETableHeader *eth)
widths[i] = eth->columns[i]->min_width + eth->width_extras;
}
if (eth->sort_info)
- extra -= e_table_sort_info_grouping_get_count (eth->sort_info) * GROUP_INDENT;
+ extra -= e_table_sort_info_grouping_get_count (eth->sort_info)
+ * GROUP_INDENT;
if (expansion != 0 && extra > 0) {
for (i = 0; i < last_resizable; i++) {
next_position +=
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 25ea433a66..7fb6bec9e1 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -1760,7 +1760,9 @@ eti_realize (GnomeCanvasItem *item)
eti->rows = e_table_model_row_count (eti->table_model);
- g_signal_connect (GTK_LAYOUT(item->canvas), "scroll_event", G_CALLBACK (eti_tree_unfreeze), eti);
+ g_signal_connect (
+ item->canvas, "scroll_event",
+ G_CALLBACK (eti_tree_unfreeze), eti);
if (eti->cell_views == NULL)
eti_attach_cell_views (eti);
@@ -3780,29 +3782,25 @@ e_table_item_get_printable (ETableItem *item)
g_object_ref (item);
itemcontext->rows_printed = 0;
- g_signal_connect (printable,
- "print_page",
- G_CALLBACK (e_table_item_print_page),
- itemcontext);
- g_signal_connect (printable,
- "data_left",
- G_CALLBACK (e_table_item_data_left),
- itemcontext);
- g_signal_connect (printable,
- "reset",
- G_CALLBACK (e_table_item_reset),
- itemcontext);
- g_signal_connect (printable,
- "height",
- G_CALLBACK (e_table_item_height),
- itemcontext);
- g_signal_connect (printable,
- "will_fit",
- G_CALLBACK (e_table_item_will_fit),
- itemcontext);
- g_object_weak_ref (G_OBJECT (printable),
- e_table_item_printable_destroy,
- itemcontext);
+ g_signal_connect (
+ printable, "print_page",
+ G_CALLBACK (e_table_item_print_page), itemcontext);
+ g_signal_connect (
+ printable, "data_left",
+ G_CALLBACK (e_table_item_data_left), itemcontext);
+ g_signal_connect (
+ printable, "reset",
+ G_CALLBACK (e_table_item_reset), itemcontext);
+ g_signal_connect (
+ printable, "height",
+ G_CALLBACK (e_table_item_height), itemcontext);
+ g_signal_connect (
+ printable, "will_fit",
+ G_CALLBACK (e_table_item_will_fit), itemcontext);
+
+ g_object_weak_ref (
+ G_OBJECT (printable),
+ e_table_item_printable_destroy, itemcontext);
return printable;
}
diff --git a/widgets/table/e-table-memory-store.c b/widgets/table/e-table-memory-store.c
index 55f96f5862..56c1dee33b 100644
--- a/widgets/table/e-table-memory-store.c
+++ b/widgets/table/e-table-memory-store.c
@@ -30,6 +30,10 @@
#include "e-table-memory-store.h"
+#define E_TABLE_MEMORY_STORE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TABLE_MEMORY_STORE, ETableMemoryStorePrivate))
+
#define STORE_LOCATOR(etms, col, row) (*((etms)->priv->store + (row) * (etms)->priv->col_count + (col)))
struct _ETableMemoryStorePrivate {
@@ -250,7 +254,7 @@ etms_finalize (GObject *object)
{
ETableMemoryStorePrivate *priv;
- priv = E_TABLE_MEMORY_STORE (object)->priv;
+ priv = E_TABLE_MEMORY_STORE_GET_PRIVATE (object);
e_table_memory_store_clear (E_TABLE_MEMORY_STORE (object));
@@ -264,8 +268,7 @@ etms_finalize (GObject *object)
static void
e_table_memory_store_init (ETableMemoryStore *etms)
{
- etms->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- etms, E_TYPE_TABLE_MEMORY_STORE, ETableMemoryStorePrivate);
+ etms->priv = E_TABLE_MEMORY_STORE_GET_PRIVATE (etms);
}
static void
diff --git a/widgets/table/e-table-memory.c b/widgets/table/e-table-memory.c
index 6fe853e6bb..e14997c92b 100644
--- a/widgets/table/e-table-memory.c
+++ b/widgets/table/e-table-memory.c
@@ -39,6 +39,10 @@
#include "e-table-memory.h"
+#define E_TABLE_MEMORY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TABLE_MEMORY, ETableMemoryPrivate))
+
G_DEFINE_TYPE (ETableMemory, e_table_memory, E_TYPE_TABLE_MODEL)
struct _ETableMemoryPrivate {
@@ -52,7 +56,7 @@ etmm_finalize (GObject *object)
{
ETableMemoryPrivate *priv;
- priv = E_TABLE_MEMORY (object)->priv;
+ priv = E_TABLE_MEMORY_GET_PRIVATE (object);
g_free (priv->data);
@@ -86,8 +90,7 @@ e_table_memory_class_init (ETableMemoryClass *class)
static void
e_table_memory_init (ETableMemory *etmm)
{
- etmm->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- etmm, E_TYPE_TABLE_MEMORY, ETableMemoryPrivate);
+ etmm->priv = E_TABLE_MEMORY_GET_PRIVATE (etmm);
}
/**
diff --git a/widgets/table/e-table-model.c b/widgets/table/e-table-model.c
index 6f44379858..15b5286eb7 100644
--- a/widgets/table/e-table-model.c
+++ b/widgets/table/e-table-model.c
@@ -29,8 +29,8 @@
#include "e-table-model.h"
-#define ETM_CLASS(e) (E_TABLE_MODEL_GET_CLASS (e))
-#define ETM_FROZEN(e) (GPOINTER_TO_INT (g_object_get_data (G_OBJECT(e), "frozen")) != 0)
+#define ETM_FROZEN(e) \
+ (GPOINTER_TO_INT (g_object_get_data (G_OBJECT(e), "frozen")) != 0)
#define d(x)
@@ -50,7 +50,7 @@ enum {
LAST_SIGNAL
};
-static guint e_table_model_signals[LAST_SIGNAL] = { 0, };
+static guint signals[LAST_SIGNAL] = { 0, };
/**
* e_table_model_column_count:
@@ -61,10 +61,14 @@ static guint e_table_model_signals[LAST_SIGNAL] = { 0, };
gint
e_table_model_column_count (ETableModel *e_table_model)
{
- g_return_val_if_fail (e_table_model != NULL, 0);
+ ETableModelClass *class;
+
g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), 0);
- return ETM_CLASS (e_table_model)->column_count (e_table_model);
+ class = E_TABLE_MODEL_GET_CLASS (e_table_model);
+ g_return_val_if_fail (class->column_count != NULL, 0);
+
+ return class->column_count (e_table_model);
}
/**
@@ -76,10 +80,14 @@ e_table_model_column_count (ETableModel *e_table_model)
gint
e_table_model_row_count (ETableModel *e_table_model)
{
- g_return_val_if_fail (e_table_model != NULL, 0);
+ ETableModelClass *class;
+
g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), 0);
- return ETM_CLASS (e_table_model)->row_count (e_table_model);
+ class = E_TABLE_MODEL_GET_CLASS (e_table_model);
+ g_return_val_if_fail (class->row_count != NULL, 0);
+
+ return class->row_count (e_table_model);
}
/**
@@ -94,11 +102,14 @@ e_table_model_append_row (ETableModel *e_table_model,
ETableModel *source,
gint row)
{
- g_return_if_fail (e_table_model != NULL);
+ ETableModelClass *class;
+
g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
- if (ETM_CLASS (e_table_model)->append_row)
- ETM_CLASS (e_table_model)->append_row (e_table_model, source, row);
+ class = E_TABLE_MODEL_GET_CLASS (e_table_model);
+
+ if (class->append_row != NULL)
+ class->append_row (e_table_model, source, row);
}
/**
@@ -125,10 +136,14 @@ e_table_model_value_at (ETableModel *e_table_model,
gint col,
gint row)
{
- g_return_val_if_fail (e_table_model != NULL, NULL);
+ ETableModelClass *class;
+
g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL);
- return ETM_CLASS (e_table_model)->value_at (e_table_model, col, row);
+ class = E_TABLE_MODEL_GET_CLASS (e_table_model);
+ g_return_val_if_fail (class->value_at != NULL, NULL);
+
+ return class->value_at (e_table_model, col, row);
}
/**
@@ -152,10 +167,14 @@ e_table_model_set_value_at (ETableModel *e_table_model,
gint row,
gconstpointer value)
{
- g_return_if_fail (e_table_model != NULL);
+ ETableModelClass *class;
+
g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
- ETM_CLASS (e_table_model)->set_value_at (e_table_model, col, row, value);
+ class = E_TABLE_MODEL_GET_CLASS (e_table_model);
+ g_return_if_fail (class->set_value_at != NULL);
+
+ class->set_value_at (e_table_model, col, row, value);
}
/**
@@ -172,10 +191,14 @@ e_table_model_is_cell_editable (ETableModel *e_table_model,
gint col,
gint row)
{
- g_return_val_if_fail (e_table_model != NULL, FALSE);
+ ETableModelClass *class;
+
g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), FALSE);
- return ETM_CLASS (e_table_model)->is_cell_editable (e_table_model, col, row);
+ class = E_TABLE_MODEL_GET_CLASS (e_table_model);
+ g_return_val_if_fail (class->is_cell_editable != NULL, FALSE);
+
+ return class->is_cell_editable (e_table_model, col, row);
}
gpointer
@@ -183,13 +206,16 @@ e_table_model_duplicate_value (ETableModel *e_table_model,
gint col,
gconstpointer value)
{
- g_return_val_if_fail (e_table_model != NULL, NULL);
+ ETableModelClass *class;
+
g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL);
- if (ETM_CLASS (e_table_model)->duplicate_value)
- return ETM_CLASS (e_table_model)->duplicate_value (e_table_model, col, value);
- else
+ class = E_TABLE_MODEL_GET_CLASS (e_table_model);
+
+ if (class->duplicate_value == NULL)
return NULL;
+
+ return class->duplicate_value (e_table_model, col, value);
}
void
@@ -197,61 +223,76 @@ e_table_model_free_value (ETableModel *e_table_model,
gint col,
gpointer value)
{
- g_return_if_fail (e_table_model != NULL);
+ ETableModelClass *class;
+
g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
- if (ETM_CLASS (e_table_model)->free_value)
- ETM_CLASS (e_table_model)->free_value (e_table_model, col, value);
+ class = E_TABLE_MODEL_GET_CLASS (e_table_model);
+
+ if (class->free_value != NULL)
+ class->free_value (e_table_model, col, value);
}
gboolean
e_table_model_has_save_id (ETableModel *e_table_model)
{
- g_return_val_if_fail (e_table_model != NULL, FALSE);
+ ETableModelClass *class;
+
g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), FALSE);
- if (ETM_CLASS (e_table_model)->has_save_id)
- return ETM_CLASS (e_table_model)->has_save_id (e_table_model);
- else
+ class = E_TABLE_MODEL_GET_CLASS (e_table_model);
+
+ if (class->has_save_id == NULL)
return FALSE;
+
+ return class->has_save_id (e_table_model);
}
gchar *
e_table_model_get_save_id (ETableModel *e_table_model,
gint row)
{
- g_return_val_if_fail (e_table_model != NULL, NULL);
+ ETableModelClass *class;
+
g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL);
- if (ETM_CLASS (e_table_model)->get_save_id)
- return ETM_CLASS (e_table_model)->get_save_id (e_table_model, row);
- else
+ class = E_TABLE_MODEL_GET_CLASS (e_table_model);
+
+ if (class->get_save_id == NULL)
return NULL;
+
+ return class->get_save_id (e_table_model, row);
}
gboolean
e_table_model_has_change_pending (ETableModel *e_table_model)
{
- g_return_val_if_fail (e_table_model != NULL, FALSE);
+ ETableModelClass *class;
+
g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), FALSE);
- if (ETM_CLASS (e_table_model)->has_change_pending)
- return ETM_CLASS (e_table_model)->has_change_pending (e_table_model);
- else
+ class = E_TABLE_MODEL_GET_CLASS (e_table_model);
+
+ if (class->has_change_pending == NULL)
return FALSE;
+
+ return class->has_change_pending (e_table_model);
}
gpointer
e_table_model_initialize_value (ETableModel *e_table_model,
gint col)
{
- g_return_val_if_fail (e_table_model != NULL, NULL);
+ ETableModelClass *class;
+
g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL);
- if (ETM_CLASS (e_table_model)->initialize_value)
- return ETM_CLASS (e_table_model)->initialize_value (e_table_model, col);
- else
+ class = E_TABLE_MODEL_GET_CLASS (e_table_model);
+
+ if (class->initialize_value == NULL)
return NULL;
+
+ return class->initialize_value (e_table_model, col);
}
gboolean
@@ -259,13 +300,16 @@ e_table_model_value_is_empty (ETableModel *e_table_model,
gint col,
gconstpointer value)
{
- g_return_val_if_fail (e_table_model != NULL, FALSE);
+ ETableModelClass *class;
+
g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), FALSE);
- if (ETM_CLASS (e_table_model)->value_is_empty)
- return ETM_CLASS (e_table_model)->value_is_empty (e_table_model, col, value);
- else
+ class = E_TABLE_MODEL_GET_CLASS (e_table_model);
+
+ if (class->value_is_empty == NULL)
return FALSE;
+
+ return class->value_is_empty (e_table_model, col, value);
}
gchar *
@@ -273,13 +317,16 @@ e_table_model_value_to_string (ETableModel *e_table_model,
gint col,
gconstpointer value)
{
- g_return_val_if_fail (e_table_model != NULL, NULL);
+ ETableModelClass *class;
+
g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL);
- if (ETM_CLASS (e_table_model)->value_to_string)
- return ETM_CLASS (e_table_model)->value_to_string (e_table_model, col, value);
- else
- return g_strdup("");
+ class = E_TABLE_MODEL_GET_CLASS (e_table_model);
+
+ if (class->value_to_string == NULL)
+ return g_strdup ("");
+
+ return class->value_to_string (e_table_model, col, value);
}
static void
@@ -287,68 +334,75 @@ e_table_model_class_init (ETableModelClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- e_table_model_signals[MODEL_NO_CHANGE] =
- g_signal_new ("model_no_change",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableModelClass, model_no_change),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- e_table_model_signals[MODEL_CHANGED] =
- g_signal_new ("model_changed",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableModelClass, model_changed),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- e_table_model_signals[MODEL_PRE_CHANGE] =
- g_signal_new ("model_pre_change",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableModelClass, model_pre_change),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- e_table_model_signals[MODEL_ROW_CHANGED] =
- g_signal_new ("model_row_changed",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableModelClass, model_row_changed),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- e_table_model_signals[MODEL_CELL_CHANGED] =
- g_signal_new ("model_cell_changed",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableModelClass, model_cell_changed),
- (GSignalAccumulator) NULL, NULL,
- e_marshal_VOID__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
-
- e_table_model_signals[MODEL_ROWS_INSERTED] =
- g_signal_new ("model_rows_inserted",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableModelClass, model_rows_inserted),
- (GSignalAccumulator) NULL, NULL,
- e_marshal_VOID__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
-
- e_table_model_signals[MODEL_ROWS_DELETED] =
- g_signal_new ("model_rows_deleted",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableModelClass, model_rows_deleted),
- (GSignalAccumulator) NULL, NULL,
- e_marshal_VOID__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
+ signals[MODEL_NO_CHANGE] = g_signal_new (
+ "model_no_change",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableModelClass, model_no_change),
+ (GSignalAccumulator) NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[MODEL_CHANGED] = g_signal_new (
+ "model_changed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableModelClass, model_changed),
+ (GSignalAccumulator) NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[MODEL_PRE_CHANGE] = g_signal_new (
+ "model_pre_change",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableModelClass, model_pre_change),
+ (GSignalAccumulator) NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[MODEL_ROW_CHANGED] = g_signal_new (
+ "model_row_changed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableModelClass, model_row_changed),
+ (GSignalAccumulator) NULL, NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1,
+ G_TYPE_INT);
+
+ signals[MODEL_CELL_CHANGED] = g_signal_new (
+ "model_cell_changed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableModelClass, model_cell_changed),
+ (GSignalAccumulator) NULL, NULL,
+ e_marshal_VOID__INT_INT,
+ G_TYPE_NONE, 2,
+ G_TYPE_INT,
+ G_TYPE_INT);
+
+ signals[MODEL_ROWS_INSERTED] = g_signal_new (
+ "model_rows_inserted",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableModelClass, model_rows_inserted),
+ (GSignalAccumulator) NULL, NULL,
+ e_marshal_VOID__INT_INT,
+ G_TYPE_NONE, 2,
+ G_TYPE_INT,
+ G_TYPE_INT);
+
+ signals[MODEL_ROWS_DELETED] = g_signal_new (
+ "model_rows_deleted",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableModelClass, model_rows_deleted),
+ (GSignalAccumulator) NULL, NULL,
+ e_marshal_VOID__INT_INT,
+ G_TYPE_NONE, 2,
+ G_TYPE_INT,
+ G_TYPE_INT);
class->column_count = NULL;
class->row_count = NULL;
@@ -396,17 +450,15 @@ print_tabs (void)
void
e_table_model_pre_change (ETableModel *e_table_model)
{
- g_return_if_fail (e_table_model != NULL);
g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
if (ETM_FROZEN (e_table_model))
return;
d (print_tabs ());
- d(g_print("Emitting pre_change on model 0x%p, a %s.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->class->type)));
d (depth++);
g_signal_emit (G_OBJECT (e_table_model),
- e_table_model_signals[MODEL_PRE_CHANGE], 0);
+ signals[MODEL_PRE_CHANGE], 0);
d (depth--);
}
@@ -426,17 +478,15 @@ e_table_model_pre_change (ETableModel *e_table_model)
void
e_table_model_no_change (ETableModel *e_table_model)
{
- g_return_if_fail (e_table_model != NULL);
g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
if (ETM_FROZEN (e_table_model))
return;
d (print_tabs ());
- d(g_print("Emitting model_no_change on model 0x%p, a %s.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->class->type)));
d (depth++);
g_signal_emit (G_OBJECT (e_table_model),
- e_table_model_signals[MODEL_NO_CHANGE], 0);
+ signals[MODEL_NO_CHANGE], 0);
d (depth--);
}
@@ -456,17 +506,15 @@ e_table_model_no_change (ETableModel *e_table_model)
void
e_table_model_changed (ETableModel *e_table_model)
{
- g_return_if_fail (e_table_model != NULL);
g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
if (ETM_FROZEN (e_table_model))
return;
d (print_tabs ());
- d(g_print("Emitting model_changed on model 0x%p, a %s.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->class->type)));
d (depth++);
g_signal_emit (G_OBJECT (e_table_model),
- e_table_model_signals[MODEL_CHANGED], 0);
+ signals[MODEL_CHANGED], 0);
d (depth--);
}
@@ -484,17 +532,15 @@ void
e_table_model_row_changed (ETableModel *e_table_model,
gint row)
{
- g_return_if_fail (e_table_model != NULL);
g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
if (ETM_FROZEN (e_table_model))
return;
d (print_tabs ());
- d(g_print("Emitting row_changed on model 0x%p, a %s, row %d.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->class->type), row));
d (depth++);
g_signal_emit (G_OBJECT (e_table_model),
- e_table_model_signals[MODEL_ROW_CHANGED], 0, row);
+ signals[MODEL_ROW_CHANGED], 0, row);
d (depth--);
}
@@ -514,17 +560,15 @@ e_table_model_cell_changed (ETableModel *e_table_model,
gint col,
gint row)
{
- g_return_if_fail (e_table_model != NULL);
g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
if (ETM_FROZEN (e_table_model))
return;
d (print_tabs ());
- d(g_print("Emitting cell_changed on model 0x%p, a %s, row %d, col %d.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->class->type), row, col));
d (depth++);
g_signal_emit (G_OBJECT (e_table_model),
- e_table_model_signals[MODEL_CELL_CHANGED], 0, col, row);
+ signals[MODEL_CELL_CHANGED], 0, col, row);
d (depth--);
}
@@ -544,17 +588,15 @@ e_table_model_rows_inserted (ETableModel *e_table_model,
gint row,
gint count)
{
- g_return_if_fail (e_table_model != NULL);
g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
if (ETM_FROZEN (e_table_model))
return;
d (print_tabs ());
- d(g_print("Emitting row_inserted on model 0x%p, a %s, row %d.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->class->type), row));
d (depth++);
g_signal_emit (G_OBJECT (e_table_model),
- e_table_model_signals[MODEL_ROWS_INSERTED], 0, row, count);
+ signals[MODEL_ROWS_INSERTED], 0, row, count);
d (depth--);
}
@@ -590,17 +632,15 @@ e_table_model_rows_deleted (ETableModel *e_table_model,
gint row,
gint count)
{
- g_return_if_fail (e_table_model != NULL);
g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
if (ETM_FROZEN (e_table_model))
return;
d (print_tabs ());
- d(g_print("Emitting row_deleted on model 0x%p, a %s, row %d.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->class->type), row));
d (depth++);
- g_signal_emit (G_OBJECT (e_table_model),
- e_table_model_signals[MODEL_ROWS_DELETED], 0, row, count);
+ g_signal_emit (
+ e_table_model, signals[MODEL_ROWS_DELETED], 0, row, count);
d (depth--);
}
@@ -624,13 +664,23 @@ void
e_table_model_freeze (ETableModel *e_table_model)
{
e_table_model_pre_change (e_table_model);
- g_object_set_data (G_OBJECT (e_table_model), "frozen", GINT_TO_POINTER (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (e_table_model), "frozen")) + 1));
+
+ /* FIXME This expression is awesome! */
+ g_object_set_data (
+ G_OBJECT (e_table_model), "frozen",
+ GINT_TO_POINTER (GPOINTER_TO_INT (
+ g_object_get_data (G_OBJECT (e_table_model), "frozen")) + 1));
}
void
e_table_model_thaw (ETableModel *e_table_model)
{
- g_object_set_data (G_OBJECT (e_table_model), "frozen", GINT_TO_POINTER (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (e_table_model), "frozen")) - 1));
+ /* FIXME This expression is awesome! */
+ g_object_set_data (
+ G_OBJECT (e_table_model), "frozen",
+ GINT_TO_POINTER (GPOINTER_TO_INT (
+ g_object_get_data (G_OBJECT (e_table_model), "frozen")) - 1));
+
e_table_model_changed (e_table_model);
}
diff --git a/widgets/table/e-table-search.c b/widgets/table/e-table-search.c
index 99f282c76f..99a0d7b9ab 100644
--- a/widgets/table/e-table-search.c
+++ b/widgets/table/e-table-search.c
@@ -47,6 +47,10 @@ enum {
LAST_SIGNAL
};
+#define E_TABLE_SEARCH_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TABLE_SEARCH, ETableSearchPrivate))
+
d (static gint depth = 0)
static guint e_table_search_signals[LAST_SIGNAL] = { 0, };
@@ -110,7 +114,7 @@ e_table_search_finalize (GObject *object)
{
ETableSearchPrivate *priv;
- priv = E_TABLE_SEARCH (object)->priv;
+ priv = E_TABLE_SEARCH_GET_PRIVATE (object);
drop_timeout (E_TABLE_SEARCH (object));
@@ -155,8 +159,7 @@ e_table_search_class_init (ETableSearchClass *class)
static void
e_table_search_init (ETableSearch *ets)
{
- ets->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- ets, E_TYPE_TABLE_SEARCH, ETableSearchPrivate);
+ ets->priv = E_TABLE_SEARCH_GET_PRIVATE (ets);
ets->priv->search_string = g_strdup ("");
}
diff --git a/widgets/table/e-table-sorter.c b/widgets/table/e-table-sorter.c
index 418ce3a5e8..0e6b4623a3 100644
--- a/widgets/table/e-table-sorter.c
+++ b/widgets/table/e-table-sorter.c
@@ -134,10 +134,12 @@ ets_set_property (GObject *object,
ets->sort_info = E_TABLE_SORT_INFO (g_value_get_object (value));
g_object_ref (ets->sort_info);
- ets->sort_info_changed_id = g_signal_connect (ets->sort_info, "sort_info_changed",
- G_CALLBACK (ets_sort_info_changed), ets);
- ets->group_info_changed_id = g_signal_connect (ets->sort_info, "group_info_changed",
- G_CALLBACK (ets_sort_info_changed), ets);
+ ets->sort_info_changed_id = g_signal_connect (
+ ets->sort_info, "sort_info_changed",
+ G_CALLBACK (ets_sort_info_changed), ets);
+ ets->group_info_changed_id = g_signal_connect (
+ ets->sort_info, "group_info_changed",
+ G_CALLBACK (ets_sort_info_changed), ets);
ets_clean (ets);
break;
@@ -216,20 +218,33 @@ e_table_sorter_new (ETableModel *source,
ets->source = source;
g_object_ref (ets->source);
- ets->table_model_changed_id = g_signal_connect (source, "model_changed",
- G_CALLBACK (ets_model_changed), ets);
- ets->table_model_row_changed_id = g_signal_connect (source, "model_row_changed",
- G_CALLBACK (ets_model_row_changed), ets);
- ets->table_model_cell_changed_id = g_signal_connect (source, "model_cell_changed",
- G_CALLBACK (ets_model_cell_changed), ets);
- ets->table_model_rows_inserted_id = g_signal_connect (source, "model_rows_inserted",
- G_CALLBACK (ets_model_rows_inserted), ets);
- ets->table_model_rows_deleted_id = g_signal_connect (source, "model_rows_deleted",
- G_CALLBACK (ets_model_rows_deleted), ets);
- ets->sort_info_changed_id = g_signal_connect (sort_info, "sort_info_changed",
- G_CALLBACK (ets_sort_info_changed), ets);
- ets->group_info_changed_id = g_signal_connect (sort_info, "group_info_changed",
- G_CALLBACK (ets_sort_info_changed), ets);
+ ets->table_model_changed_id = g_signal_connect (
+ source, "model_changed",
+ G_CALLBACK (ets_model_changed), ets);
+
+ ets->table_model_row_changed_id = g_signal_connect (
+ source, "model_row_changed",
+ G_CALLBACK (ets_model_row_changed), ets);
+
+ ets->table_model_cell_changed_id = g_signal_connect (
+ source, "model_cell_changed",
+ G_CALLBACK (ets_model_cell_changed), ets);
+
+ ets->table_model_rows_inserted_id = g_signal_connect (
+ source, "model_rows_inserted",
+ G_CALLBACK (ets_model_rows_inserted), ets);
+
+ ets->table_model_rows_deleted_id = g_signal_connect (
+ source, "model_rows_deleted",
+ G_CALLBACK (ets_model_rows_deleted), ets);
+
+ ets->sort_info_changed_id = g_signal_connect (
+ sort_info, "sort_info_changed",
+ G_CALLBACK (ets_sort_info_changed), ets);
+
+ ets->group_info_changed_id = g_signal_connect (
+ sort_info, "group_info_changed",
+ G_CALLBACK (ets_sort_info_changed), ets);
return ets;
}
diff --git a/widgets/table/e-table-subset.c b/widgets/table/e-table-subset.c
index 9a26020296..0d5cd1ae63 100644
--- a/widgets/table/e-table-subset.c
+++ b/widgets/table/e-table-subset.c
@@ -32,13 +32,32 @@
#include "e-table-subset.h"
-static void etss_proxy_model_pre_change_real (ETableSubset *etss, ETableModel *etm);
-static void etss_proxy_model_no_change_real (ETableSubset *etss, ETableModel *etm);
-static void etss_proxy_model_changed_real (ETableSubset *etss, ETableModel *etm);
-static void etss_proxy_model_row_changed_real (ETableSubset *etss, ETableModel *etm, gint row);
-static void etss_proxy_model_cell_changed_real (ETableSubset *etss, ETableModel *etm, gint col, gint row);
-static void etss_proxy_model_rows_inserted_real (ETableSubset *etss, ETableModel *etm, gint row, gint count);
-static void etss_proxy_model_rows_deleted_real (ETableSubset *etss, ETableModel *etm, gint row, gint count);
+static void etss_proxy_model_pre_change_real
+ (ETableSubset *etss,
+ ETableModel *etm);
+static void etss_proxy_model_no_change_real (ETableSubset *etss,
+ ETableModel *etm);
+static void etss_proxy_model_changed_real (ETableSubset *etss,
+ ETableModel *etm);
+static void etss_proxy_model_row_changed_real
+ (ETableSubset *etss,
+ ETableModel *etm,
+ gint row);
+static void etss_proxy_model_cell_changed_real
+ (ETableSubset *etss,
+ ETableModel *etm,
+ gint col,
+ gint row);
+static void etss_proxy_model_rows_inserted_real
+ (ETableSubset *etss,
+ ETableModel *etm,
+ gint row,
+ gint count);
+static void etss_proxy_model_rows_deleted_real
+ (ETableSubset *etss,
+ ETableModel *etm,
+ gint row,
+ gint count);
#define d(x)
diff --git a/widgets/table/e-table-utils.c b/widgets/table/e-table-utils.c
index a534f22f07..da886295b6 100644
--- a/widgets/table/e-table-utils.c
+++ b/widgets/table/e-table-utils.c
@@ -182,9 +182,13 @@ e_table_util_calculate_current_search_col (ETableHeader *header,
gint i;
gint count;
ETableCol *col = NULL;
+
count = e_table_sort_info_grouping_get_count (sort_info);
+
for (i = 0; i < count; i++) {
- ETableSortColumn column = e_table_sort_info_grouping_get_nth (sort_info, i);
+ ETableSortColumn column;
+
+ column = e_table_sort_info_grouping_get_nth (sort_info, i);
col = e_table_header_get_column (full_header, column.column);
@@ -197,7 +201,9 @@ e_table_util_calculate_current_search_col (ETableHeader *header,
if (col == NULL) {
count = e_table_sort_info_sorting_get_count (sort_info);
for (i = 0; i < count; i++) {
- ETableSortColumn column = e_table_sort_info_sorting_get_nth (sort_info, i);
+ ETableSortColumn column;
+
+ column = e_table_sort_info_sorting_get_nth (sort_info, i);
col = e_table_header_get_column (full_header, column.column);
diff --git a/widgets/table/e-table-without.c b/widgets/table/e-table-without.c
index 785feb456b..6fba6cbe12 100644
--- a/widgets/table/e-table-without.c
+++ b/widgets/table/e-table-without.c
@@ -32,6 +32,10 @@
#include "e-table-without.h"
+#define E_TABLE_WITHOUT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TABLE_WITHOUT, ETableWithoutPrivate))
+
/* workaround for avoiding API breakage */
#define etw_get_type e_table_without_get_type
G_DEFINE_TYPE (ETableWithout, etw, E_TYPE_TABLE_SUBSET)
@@ -145,7 +149,7 @@ etw_dispose (GObject *object)
{
ETableWithoutPrivate *priv;
- priv = E_TABLE_WITHOUT (object)->priv;
+ priv = E_TABLE_WITHOUT_GET_PRIVATE (object);
if (priv->hash != NULL) {
g_hash_table_foreach (priv->hash, delete_hash_element, object);
@@ -258,8 +262,7 @@ etw_class_init (ETableWithoutClass *class)
static void
etw_init (ETableWithout *etw)
{
- etw->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- etw, E_TYPE_TABLE_WITHOUT, ETableWithoutPrivate);
+ etw->priv = E_TABLE_WITHOUT_GET_PRIVATE (etw);
}
ETableModel *
@@ -285,7 +288,8 @@ e_table_without_construct (ETableWithout *etw,
etw->priv->free_duplicated_key_func = free_duplicated_key_func;
etw->priv->closure = closure;
- etw->priv->hash = g_hash_table_new (etw->priv->hash_func, etw->priv->compare_func);
+ etw->priv->hash = g_hash_table_new (
+ etw->priv->hash_func, etw->priv->compare_func);
return E_TABLE_MODEL (etw);
}
@@ -394,7 +398,8 @@ e_table_without_show_all (ETableWithout *etw)
g_hash_table_destroy (etw->priv->hash);
etw->priv->hash = NULL;
}
- etw->priv->hash = g_hash_table_new (etw->priv->hash_func, etw->priv->compare_func);
+ etw->priv->hash = g_hash_table_new (
+ etw->priv->hash_func, etw->priv->compare_func);
row_count = e_table_model_row_count (E_TABLE_MODEL (etss->source));
g_free (etss->map_table);
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index e81dc6b23c..50751c8889 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -178,20 +178,20 @@ et_disconnect_model (ETable *et)
return;
if (et->table_model_change_id != 0)
- g_signal_handler_disconnect (G_OBJECT (et->model),
- et->table_model_change_id);
+ g_signal_handler_disconnect (
+ et->model, et->table_model_change_id);
if (et->table_row_change_id != 0)
- g_signal_handler_disconnect (G_OBJECT (et->model),
- et->table_row_change_id);
+ g_signal_handler_disconnect (
+ et->model, et->table_row_change_id);
if (et->table_cell_change_id != 0)
- g_signal_handler_disconnect (G_OBJECT (et->model),
- et->table_cell_change_id);
+ g_signal_handler_disconnect (
+ et->model, et->table_cell_change_id);
if (et->table_rows_inserted_id != 0)
- g_signal_handler_disconnect (G_OBJECT (et->model),
- et->table_rows_inserted_id);
+ g_signal_handler_disconnect (
+ et->model, et->table_rows_inserted_id);
if (et->table_rows_deleted_id != 0)
- g_signal_handler_disconnect (G_OBJECT (et->model),
- et->table_rows_deleted_id);
+ g_signal_handler_disconnect (
+ et->model, et->table_rows_deleted_id);
et->table_model_change_id = 0;
et->table_row_change_id = 0;
@@ -206,7 +206,7 @@ e_table_state_change (ETable *et)
if (et->state_change_freeze)
et->state_changed = TRUE;
else
- g_signal_emit (G_OBJECT (et), et_signals[STATE_CHANGE], 0);
+ g_signal_emit (et, et_signals[STATE_CHANGE], 0);
}
#define CHECK_HORIZONTAL(et) \
@@ -300,14 +300,14 @@ disconnect_header (ETable *e_table)
return;
if (e_table->structure_change_id)
- g_signal_handler_disconnect (G_OBJECT (e_table->header),
- e_table->structure_change_id);
+ g_signal_handler_disconnect (
+ e_table->header, e_table->structure_change_id);
if (e_table->expansion_change_id)
- g_signal_handler_disconnect (G_OBJECT (e_table->header),
- e_table->expansion_change_id);
+ g_signal_handler_disconnect (
+ e_table->header, e_table->expansion_change_id);
if (e_table->dimension_change_id)
- g_signal_handler_disconnect (G_OBJECT (e_table->header),
- e_table->dimension_change_id);
+ g_signal_handler_disconnect (
+ e_table->header, e_table->dimension_change_id);
g_object_unref (e_table->header);
e_table->header = NULL;
@@ -343,24 +343,24 @@ et_dispose (GObject *object)
if (et->search) {
if (et->search_search_id)
- g_signal_handler_disconnect (G_OBJECT (et->search),
- et->search_search_id);
+ g_signal_handler_disconnect (
+ et->search, et->search_search_id);
if (et->search_accept_id)
- g_signal_handler_disconnect (G_OBJECT (et->search),
- et->search_accept_id);
+ g_signal_handler_disconnect (
+ et->search, et->search_accept_id);
g_object_unref (et->search);
et->search = NULL;
}
if (et->group_info_change_id) {
- g_signal_handler_disconnect (G_OBJECT (et->sort_info),
- et->group_info_change_id);
+ g_signal_handler_disconnect (
+ et->sort_info, et->group_info_change_id);
et->group_info_change_id = 0;
}
if (et->sort_info_change_id) {
- g_signal_handler_disconnect (G_OBJECT (et->sort_info),
- et->sort_info_change_id);
+ g_signal_handler_disconnect (
+ et->sort_info, et->sort_info_change_id);
et->sort_info_change_id = 0;
}
@@ -429,7 +429,7 @@ et_dispose (GObject *object)
g_free (et->domain);
et->domain = NULL;
- (*G_OBJECT_CLASS (e_table_parent_class)->dispose)(object);
+ G_OBJECT_CLASS (e_table_parent_class)->dispose (object);
}
static void
@@ -552,6 +552,7 @@ et_finalize (GObject *object)
g_free (et->domain);
et->domain = NULL;
+
G_OBJECT_CLASS (e_table_parent_class)->finalize (object);
}
@@ -734,7 +735,7 @@ e_table_setup_header (ETable *e_table)
g_free (pointer);
g_signal_connect (
- G_OBJECT (e_table->header_canvas), "size_allocate",
+ e_table->header_canvas, "size_allocate",
G_CALLBACK (header_canvas_size_allocate), e_table);
g_object_set (
@@ -835,7 +836,7 @@ group_cursor_change (ETableGroup *etg,
old_cursor_loc = et->cursor_loc;
et->cursor_loc = E_TABLE_CURSOR_LOC_TABLE;
- g_signal_emit (G_OBJECT (et), et_signals[CURSOR_CHANGE], 0, row);
+ g_signal_emit (et, et_signals[CURSOR_CHANGE], 0, row);
if (old_cursor_loc == E_TABLE_CURSOR_LOC_ETCTA && et->click_to_add)
e_table_click_to_add_commit (E_TABLE_CLICK_TO_ADD (et->click_to_add));
@@ -846,7 +847,7 @@ group_cursor_activated (ETableGroup *etg,
gint row,
ETable *et)
{
- g_signal_emit (G_OBJECT (et), et_signals[CURSOR_ACTIVATED], 0, row);
+ g_signal_emit (et, et_signals[CURSOR_ACTIVATED], 0, row);
}
static void
@@ -856,7 +857,7 @@ group_double_click (ETableGroup *etg,
GdkEvent *event,
ETable *et)
{
- g_signal_emit (G_OBJECT (et), et_signals[DOUBLE_CLICK], 0, row, col, event);
+ g_signal_emit (et, et_signals[DOUBLE_CLICK], 0, row, col, event);
}
static gboolean
@@ -883,7 +884,11 @@ group_click (ETableGroup *etg,
ETable *et)
{
gboolean return_val = 0;
- g_signal_emit (G_OBJECT (et), et_signals[CLICK], 0, row, col, event, &return_val);
+
+ g_signal_emit (
+ et, et_signals[CLICK], 0,
+ row, col, event, &return_val);
+
return return_val;
}
@@ -961,8 +966,9 @@ group_key_press (ETableGroup *etg,
(key->keyval >= GDK_KEY_A && key->keyval <= GDK_KEY_Z) ||
(key->keyval >= GDK_KEY_0 && key->keyval <= GDK_KEY_9)))
e_table_search_input_character (et->search, key->keyval);
- g_signal_emit (G_OBJECT (et), et_signals[KEY_PRESS], 0,
- row, col, event, &return_val);
+ g_signal_emit (
+ et, et_signals[KEY_PRESS], 0,
+ row, col, event, &return_val);
break;
}
return return_val;
@@ -976,8 +982,11 @@ group_start_drag (ETableGroup *etg,
ETable *et)
{
gboolean return_val = TRUE;
- g_signal_emit (G_OBJECT (et), et_signals[START_DRAG], 0,
- row, col, event, &return_val);
+
+ g_signal_emit (
+ et, et_signals[START_DRAG], 0,
+ row, col, event, &return_val);
+
return return_val;
}
@@ -1195,8 +1204,11 @@ white_item_event (GnomeCanvasItem *white_item,
ETable *e_table)
{
gboolean return_val = 0;
- g_signal_emit (G_OBJECT (e_table), et_signals[WHITE_SPACE_EVENT], 0,
- event, &return_val);
+
+ g_signal_emit (
+ e_table, et_signals[WHITE_SPACE_EVENT], 0,
+ event, &return_val);
+
return return_val;
}
@@ -1442,7 +1454,7 @@ e_table_setup_table (ETable *e_table,
NULL);
g_signal_connect (
- G_OBJECT (e_table->canvas_vbox), "event",
+ e_table->canvas_vbox, "event",
G_CALLBACK (canvas_vbox_event), e_table);
et_build_groups (e_table);
@@ -1466,10 +1478,10 @@ e_table_setup_table (ETable *e_table,
e_table->click_to_add);
g_signal_connect (
- G_OBJECT (e_table->click_to_add), "event",
+ e_table->click_to_add, "event",
G_CALLBACK (click_to_add_event), e_table);
g_signal_connect (
- G_OBJECT (e_table->click_to_add), "cursor_change",
+ e_table->click_to_add, "cursor_change",
G_CALLBACK (click_to_add_cursor_change), e_table);
}
}
@@ -1512,16 +1524,19 @@ e_table_set_state_object (ETable *e_table,
if (e_table->sort_info) {
if (e_table->group_info_change_id)
- g_signal_handler_disconnect (G_OBJECT (e_table->sort_info),
- e_table->group_info_change_id);
+ g_signal_handler_disconnect (
+ e_table->sort_info,
+ e_table->group_info_change_id);
if (e_table->sort_info_change_id)
- g_signal_handler_disconnect (G_OBJECT (e_table->sort_info),
- e_table->sort_info_change_id);
+ g_signal_handler_disconnect (
+ e_table->sort_info,
+ e_table->sort_info_change_id);
g_object_unref (e_table->sort_info);
}
if (state->sort_info) {
e_table->sort_info = e_table_sort_info_duplicate (state->sort_info);
- e_table_sort_info_set_can_group (e_table->sort_info, e_table->allow_grouping);
+ e_table_sort_info_set_can_group (
+ e_table->sort_info, e_table->allow_grouping);
e_table->group_info_change_id = g_signal_connect (
e_table->sort_info, "group_info_changed",
G_CALLBACK (group_info_changed), e_table);
@@ -1568,7 +1583,6 @@ e_table_set_state (ETable *e_table,
{
ETableState *state;
- g_return_if_fail (e_table != NULL);
g_return_if_fail (E_IS_TABLE (e_table));
g_return_if_fail (state_str != NULL);
@@ -1595,7 +1609,6 @@ e_table_load_state (ETable *e_table,
{
ETableState *state;
- g_return_if_fail (e_table != NULL);
g_return_if_fail (E_IS_TABLE (e_table));
g_return_if_fail (filename != NULL);
@@ -1695,7 +1708,7 @@ static void
et_selection_model_selection_changed (ETableGroup *etg,
ETable *et)
{
- g_signal_emit (G_OBJECT (et), et_signals[SELECTION_CHANGE], 0);
+ g_signal_emit (et, et_signals[SELECTION_CHANGE], 0);
}
static void
@@ -1703,7 +1716,7 @@ et_selection_model_selection_row_changed (ETableGroup *etg,
gint row,
ETable *et)
{
- g_signal_emit (G_OBJECT (et), et_signals[SELECTION_CHANGE], 0);
+ g_signal_emit (et, et_signals[SELECTION_CHANGE], 0);
}
static ETable *
@@ -1855,9 +1868,7 @@ e_table_construct (ETable *e_table,
ETableSpecification *specification;
ETableState *state;
- g_return_val_if_fail (e_table != NULL, NULL);
g_return_val_if_fail (E_IS_TABLE (e_table), NULL);
- g_return_val_if_fail (etm != NULL, NULL);
g_return_val_if_fail (E_IS_TABLE_MODEL (etm), NULL);
g_return_val_if_fail (ete == NULL || E_IS_TABLE_EXTRAS (ete), NULL);
g_return_val_if_fail (spec_str != NULL, NULL);
@@ -1918,9 +1929,7 @@ e_table_construct_from_spec_file (ETable *e_table,
ETableSpecification *specification;
ETableState *state;
- g_return_val_if_fail (e_table != NULL, NULL);
g_return_val_if_fail (E_IS_TABLE (e_table), NULL);
- g_return_val_if_fail (etm != NULL, NULL);
g_return_val_if_fail (E_IS_TABLE_MODEL (etm), NULL);
g_return_val_if_fail (ete == NULL || E_IS_TABLE_EXTRAS (ete), NULL);
g_return_val_if_fail (spec_fn != NULL, NULL);
@@ -1985,7 +1994,6 @@ e_table_new (ETableModel *etm,
{
ETable *e_table;
- g_return_val_if_fail (etm != NULL, NULL);
g_return_val_if_fail (E_IS_TABLE_MODEL (etm), NULL);
g_return_val_if_fail (ete == NULL || E_IS_TABLE_EXTRAS (ete), NULL);
g_return_val_if_fail (spec != NULL, NULL);
@@ -2025,7 +2033,6 @@ e_table_new_from_spec_file (ETableModel *etm,
{
ETable *e_table;
- g_return_val_if_fail (etm != NULL, NULL);
g_return_val_if_fail (E_IS_TABLE_MODEL (etm), NULL);
g_return_val_if_fail (ete == NULL || E_IS_TABLE_EXTRAS (ete), NULL);
g_return_val_if_fail (spec_fn != NULL, NULL);
@@ -2037,158 +2044,6 @@ e_table_new_from_spec_file (ETableModel *etm,
return GTK_WIDGET (e_table);
}
-#if 0
-static xmlNode *
-et_build_column_spec (ETable *e_table)
-{
- xmlNode *columns_shown;
- gint i;
- gint col_count;
-
- columns_shown = xmlNewNode (NULL, "columns-shown");
-
- col_count = e_table_header_count (e_table->header);
- for (i = 0; i < col_count; i++) {
- gchar *text = g_strdup_printf ("%d", e_table_header_index(e_table->header, i));
- xmlNewChild (columns_shown, NULL, "column", text);
- g_free (text);
- }
-
- return columns_shown;
-}
-
-static xmlNode *
-et_build_grouping_spec (ETable *e_table)
-{
- xmlNode *node;
- xmlNode *grouping;
- gint i;
- const gint sort_count = e_table_sort_info_sorting_get_count (e_table->sort_info);
- const gint group_count = e_table_sort_info_grouping_get_count (e_table->sort_info);
-
- grouping = xmlNewNode (NULL, "grouping");
- node = grouping;
-
- for (i = 0; i < group_count; i++) {
- ETableSortColumn column =
- e_table_sort_info_grouping_get_nth (e_table->sort_info, i);
- xmlNode *new_node = xmlNewChild(node, NULL, "group", NULL);
-
- e_xml_set_integer_prop_by_name (new_node, "column", column.column);
- e_xml_set_integer_prop_by_name (new_node, "ascending", column.ascending);
- node = new_node;
- }
-
- for (i = 0; i < sort_count; i++) {
- ETableSortColumn column =
- e_table_sort_info_sorting_get_nth (e_table->sort_info, i);
- xmlNode *new_node = xmlNewChild(node, NULL, "leaf", NULL);
-
- e_xml_set_integer_prop_by_name (new_node, "column", column.column);
- e_xml_set_integer_prop_by_name (new_node, "ascending", column.ascending);
- node = new_node;
- }
-
- return grouping;
-}
-
-static xmlDoc *
-et_build_tree (ETable *e_table)
-{
- xmlDoc *doc;
- xmlNode *root;
-
- doc = xmlNewDoc ("1.0");
- if (doc == NULL)
- return NULL;
-
- root = xmlNewDocNode (doc, NULL, "ETableSpecification", NULL);
- xmlDocSetRootElement (doc, root);
- xmlAddChild (root, et_build_column_spec (e_table));
- xmlAddChild (root, et_build_grouping_spec (e_table));
-
- return doc;
-}
-
-gchar *
-e_table_get_specification (ETable *e_table)
-{
- xmlDoc *doc;
- xmlChar *buffer;
- gint size;
-
- g_return_val_if_fail (e_table != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE (e_table), NULL);
-
- doc = et_build_tree (e_table);
- xmlDocDumpMemory (doc, &buffer, &size);
- xmlFreeDoc (doc);
-
- return buffer;
-}
-
-gint
-e_table_set_specification (ETable *e_table,
- const gchar *spec)
-{
- xmlDoc *xmlSpec;
- gint ret;
-
- g_return_val_if_fail (e_table != NULL, -1);
- g_return_val_if_fail (E_IS_TABLE (e_table), -1);
- g_return_val_if_fail (spec != NULL, -1);
-
- /* doesn't work yet, sigh */
- xmlSpec = xmlParseMemory ((gchar *) spec, strlen (spec));
- ret = et_real_set_specification (e_table, xmlSpec);
- xmlFreeDoc (xmlSpec);
-
- return ret;
-}
-
-void
-e_table_save_specification (ETable *e_table,
- const gchar *filename)
-{
- xmlDoc *doc = et_build_tree (e_table);
-
- g_return_if_fail (e_table != NULL);
- g_return_if_fail (E_IS_TABLE (e_table));
- g_return_if_fail (filename != NULL);
-
- e_xml_save_file (filename, doc);
-
- xmlFreeDoc (doc);
-}
-
-gint
-e_table_load_specification (ETable *e_table,
- gchar *filename)
-{
- xmlDoc *xmlSpec;
- gint ret;
-
- g_return_val_if_fail (e_table != NULL, -1);
- g_return_val_if_fail (E_IS_TABLE (e_table), -1);
- g_return_val_if_fail (filename != NULL, -1);
-
- /* doesn't work yet, yay */
-#ifdef G_OS_WIN32
- {
- gchar *locale_filename = g_win32_locale_filename_from_utf8 (filename);
- xmlSpec = xmlParseFile (locale_filename);
- g_free (locale_filename);
- }
-#else
- xmlSpec = xmlParseFile (filename);
-#endif
- ret = et_real_set_specification (e_table, xmlSpec);
- xmlFreeDoc (xmlSpec);
-
- return ret;
-}
-#endif
-
/**
* e_table_set_cursor_row:
* @e_table: The #ETable to set the cursor row of
@@ -2200,7 +2055,6 @@ void
e_table_set_cursor_row (ETable *e_table,
gint row)
{
- g_return_if_fail (e_table != NULL);
g_return_if_fail (E_IS_TABLE (e_table));
g_return_if_fail (row >= 0);
@@ -2222,7 +2076,6 @@ gint
e_table_get_cursor_row (ETable *e_table)
{
gint row;
- g_return_val_if_fail (e_table != NULL, -1);
g_return_val_if_fail (E_IS_TABLE (e_table), -1);
g_object_get (e_table->selection,
@@ -2249,7 +2102,6 @@ e_table_selected_row_foreach (ETable *e_table,
EForeachFunc callback,
gpointer closure)
{
- g_return_if_fail (e_table != NULL);
g_return_if_fail (E_IS_TABLE (e_table));
e_selection_model_foreach (E_SELECTION_MODEL (e_table->selection),
@@ -2269,7 +2121,6 @@ e_table_selected_row_foreach (ETable *e_table,
gint
e_table_selected_count (ETable *e_table)
{
- g_return_val_if_fail (e_table != NULL, -1);
g_return_val_if_fail (E_IS_TABLE (e_table), -1);
return e_selection_model_selected_count (E_SELECTION_MODEL (e_table->selection));
@@ -2284,7 +2135,6 @@ e_table_selected_count (ETable *e_table)
void
e_table_select_all (ETable *table)
{
- g_return_if_fail (table != NULL);
g_return_if_fail (E_IS_TABLE (table));
e_selection_model_select_all (E_SELECTION_MODEL (table->selection));
@@ -2299,7 +2149,6 @@ e_table_select_all (ETable *table)
void
e_table_invert_selection (ETable *table)
{
- g_return_if_fail (table != NULL);
g_return_if_fail (E_IS_TABLE (table));
e_selection_model_invert_selection (E_SELECTION_MODEL (table->selection));
@@ -2317,7 +2166,6 @@ e_table_invert_selection (ETable *table)
EPrintable *
e_table_get_printable (ETable *e_table)
{
- g_return_val_if_fail (e_table != NULL, NULL);
g_return_val_if_fail (E_IS_TABLE (e_table), NULL);
return e_table_group_get_printable (e_table->group);
@@ -2526,7 +2374,6 @@ gint
e_table_get_next_row (ETable *e_table,
gint model_row)
{
- g_return_val_if_fail (e_table != NULL, -1);
g_return_val_if_fail (E_IS_TABLE (e_table), -1);
if (e_table->sorter) {
@@ -2560,7 +2407,6 @@ gint
e_table_get_prev_row (ETable *e_table,
gint model_row)
{
- g_return_val_if_fail (e_table != NULL, -1);
g_return_val_if_fail (E_IS_TABLE (e_table), -1);
if (e_table->sorter) {
@@ -2589,7 +2435,6 @@ gint
e_table_model_to_view_row (ETable *e_table,
gint model_row)
{
- g_return_val_if_fail (e_table != NULL, -1);
g_return_val_if_fail (E_IS_TABLE (e_table), -1);
if (e_table->sorter)
@@ -2612,7 +2457,6 @@ gint
e_table_view_to_model_row (ETable *e_table,
gint view_row)
{
- g_return_val_if_fail (e_table != NULL, -1);
g_return_val_if_fail (E_IS_TABLE (e_table), -1);
if (e_table->sorter)
@@ -2728,7 +2572,6 @@ e_table_get_mouse_over_cell (ETable *table,
gint *row,
gint *col)
{
- g_return_if_fail (table != NULL);
g_return_if_fail (E_IS_TABLE (table));
if (!table->group)
@@ -2750,7 +2593,6 @@ e_table_get_mouse_over_cell (ETable *table,
ESelectionModel *
e_table_get_selection_model (ETable *table)
{
- g_return_val_if_fail (table != NULL, NULL);
g_return_val_if_fail (E_IS_TABLE (table), NULL);
return E_SELECTION_MODEL (table->selection);
@@ -2843,7 +2685,6 @@ e_table_drag_get_data (ETable *table,
GdkAtom target,
guint32 time)
{
- g_return_if_fail (table != NULL);
g_return_if_fail (E_IS_TABLE (table));
gtk_drag_get_data (GTK_WIDGET (table),
@@ -2923,7 +2764,6 @@ e_table_drag_highlight (ETable *table,
void
e_table_drag_unhighlight (ETable *table)
{
- g_return_if_fail (table != NULL);
g_return_if_fail (E_IS_TABLE (table));
if (table->drop_highlight) {
@@ -2932,34 +2772,29 @@ e_table_drag_unhighlight (ETable *table)
}
}
-void e_table_drag_dest_set (ETable *table,
- GtkDestDefaults flags,
- const GtkTargetEntry *targets,
- gint n_targets,
- GdkDragAction actions)
+void
+e_table_drag_dest_set (ETable *table,
+ GtkDestDefaults flags,
+ const GtkTargetEntry *targets,
+ gint n_targets,
+ GdkDragAction actions)
{
- g_return_if_fail (table != NULL);
g_return_if_fail (E_IS_TABLE (table));
- gtk_drag_dest_set (GTK_WIDGET (table),
- flags,
- targets,
- n_targets,
- actions);
+ gtk_drag_dest_set (
+ GTK_WIDGET (table), flags, targets, n_targets, actions);
}
-void e_table_drag_dest_set_proxy (ETable *table,
- GdkWindow *proxy_window,
- GdkDragProtocol protocol,
- gboolean use_coordinates)
+void
+e_table_drag_dest_set_proxy (ETable *table,
+ GdkWindow *proxy_window,
+ GdkDragProtocol protocol,
+ gboolean use_coordinates)
{
- g_return_if_fail (table != NULL);
g_return_if_fail (E_IS_TABLE (table));
- gtk_drag_dest_set_proxy (GTK_WIDGET (table),
- proxy_window,
- protocol,
- use_coordinates);
+ gtk_drag_dest_set_proxy (
+ GTK_WIDGET (table), proxy_window, protocol, use_coordinates);
}
/*
@@ -2970,7 +2805,6 @@ void e_table_drag_dest_set_proxy (ETable *table,
void
e_table_drag_dest_unset (GtkWidget *widget)
{
- g_return_if_fail (widget != NULL);
g_return_if_fail (E_IS_TABLE (widget));
gtk_drag_dest_unset (widget);
@@ -3034,7 +2868,6 @@ e_table_drag_source_set (ETable *table,
ETableDragSourceSite *site;
GtkWidget *canvas;
- g_return_if_fail (table != NULL);
g_return_if_fail (E_IS_TABLE (table));
canvas = GTK_WIDGET (table->table_canvas);
@@ -3076,7 +2909,6 @@ e_table_drag_source_unset (ETable *table)
{
ETableDragSourceSite *site;
- g_return_if_fail (table != NULL);
g_return_if_fail (E_IS_TABLE (table));
site = table->site;
@@ -3118,17 +2950,13 @@ e_table_drag_begin (ETable *table,
gint button,
GdkEvent *event)
{
- g_return_val_if_fail (table != NULL, NULL);
g_return_val_if_fail (E_IS_TABLE (table), NULL);
table->drag_row = row;
table->drag_col = col;
- return gtk_drag_begin (GTK_WIDGET (table),
- targets,
- actions,
- button,
- event);
+ return gtk_drag_begin (
+ GTK_WIDGET (table), targets, actions, button, event);
}
static void
@@ -3136,8 +2964,9 @@ et_drag_begin (GtkWidget *widget,
GdkDragContext *context,
ETable *et)
{
- g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_BEGIN], 0,
- et->drag_row, et->drag_col, context);
+ g_signal_emit (
+ et, et_signals[TABLE_DRAG_BEGIN], 0,
+ et->drag_row, et->drag_col, context);
}
static void
@@ -3145,8 +2974,9 @@ et_drag_end (GtkWidget *widget,
GdkDragContext *context,
ETable *et)
{
- g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_END], 0,
- et->drag_row, et->drag_col, context);
+ g_signal_emit (
+ et, et_signals[TABLE_DRAG_END], 0,
+ et->drag_row, et->drag_col, context);
}
static void
@@ -3157,9 +2987,10 @@ et_drag_data_get (GtkWidget *widget,
guint time,
ETable *et)
{
- g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_DATA_GET], 0,
- et->drag_row, et->drag_col, context, selection_data,
- info, time);
+ g_signal_emit (
+ et, et_signals[TABLE_DRAG_DATA_GET], 0,
+ et->drag_row, et->drag_col, context, selection_data,
+ info, time);
}
static void
@@ -3167,8 +2998,9 @@ et_drag_data_delete (GtkWidget *widget,
GdkDragContext *context,
ETable *et)
{
- g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_DATA_DELETE], 0,
- et->drag_row, et->drag_col, context);
+ g_signal_emit (
+ et, et_signals[TABLE_DRAG_DATA_DELETE], 0,
+ et->drag_row, et->drag_col, context);
}
static gboolean
@@ -3184,13 +3016,17 @@ do_drag_motion (ETable *et,
e_table_get_cell_at (et, x, y, &row, &col);
if (row != et->drop_row && col != et->drop_row) {
- g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_LEAVE], 0,
- et->drop_row, et->drop_col, context, time);
+ g_signal_emit (
+ et, et_signals[TABLE_DRAG_LEAVE], 0,
+ et->drop_row, et->drop_col, context, time);
}
+
et->drop_row = row;
et->drop_col = col;
- g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_MOTION], 0,
- et->drop_row, et->drop_col, context, x, y, time, &ret_val);
+
+ g_signal_emit (
+ et, et_signals[TABLE_DRAG_MOTION], 0,
+ et->drop_row, et->drop_col, context, x, y, time, &ret_val);
return ret_val;
}
@@ -3308,8 +3144,10 @@ et_drag_leave (GtkWidget *widget,
guint time,
ETable *et)
{
- g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_LEAVE], 0,
- et->drop_row, et->drop_col, context, time);
+ g_signal_emit (
+ et, et_signals[TABLE_DRAG_LEAVE], 0,
+ et->drop_row, et->drop_col, context, time);
+
et->drop_row = -1;
et->drop_col = -1;
@@ -3369,15 +3207,18 @@ et_drag_drop (GtkWidget *widget,
e_table_get_cell_at (et, x, y, &row, &col);
if (row != et->drop_row && col != et->drop_row) {
- g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_LEAVE], 0,
- et->drop_row, et->drop_col, context, time);
- g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_MOTION], 0,
- row, col, context, x, y, time, &ret_val);
+ g_signal_emit (
+ et, et_signals[TABLE_DRAG_LEAVE], 0,
+ et->drop_row, et->drop_col, context, time);
+ g_signal_emit (
+ et, et_signals[TABLE_DRAG_MOTION], 0,
+ row, col, context, x, y, time, &ret_val);
}
et->drop_row = row;
et->drop_col = col;
- g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_DROP], 0,
- et->drop_row, et->drop_col, context, x, y, time, &ret_val);
+ g_signal_emit (
+ et, et_signals[TABLE_DRAG_DROP], 0,
+ et->drop_row, et->drop_col, context, x, y, time, &ret_val);
et->drop_row = -1;
et->drop_col = -1;
@@ -3400,8 +3241,9 @@ et_drag_data_received (GtkWidget *widget,
e_table_get_cell_at (et, x, y, &row, &col);
- g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_DATA_RECEIVED], 0,
- row, col, context, x, y, selection_data, info, time);
+ g_signal_emit (
+ et, et_signals[TABLE_DRAG_DATA_RECEIVED], 0,
+ row, col, context, x, y, selection_data, info, time);
}
static void
@@ -3446,251 +3288,272 @@ e_table_class_init (ETableClass *class)
class->table_drag_drop = NULL;
class->table_drag_data_received = NULL;
- et_signals[CURSOR_CHANGE] =
- g_signal_new ("cursor_change",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, cursor_change),
- NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- et_signals[CURSOR_ACTIVATED] =
- g_signal_new ("cursor_activated",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, cursor_activated),
- NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- et_signals[SELECTION_CHANGE] =
- g_signal_new ("selection_change",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, selection_change),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- et_signals[DOUBLE_CLICK] =
- g_signal_new ("double_click",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, double_click),
- NULL, NULL,
- e_marshal_NONE__INT_INT_BOXED,
- G_TYPE_NONE, 3,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
-
- et_signals[RIGHT_CLICK] =
- g_signal_new ("right_click",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, right_click),
- g_signal_accumulator_true_handled, NULL,
- e_marshal_BOOLEAN__INT_INT_BOXED,
- G_TYPE_BOOLEAN, 3,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
-
- et_signals[CLICK] =
- g_signal_new ("click",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, click),
- g_signal_accumulator_true_handled, NULL,
- e_marshal_BOOLEAN__INT_INT_BOXED,
- G_TYPE_BOOLEAN, 3,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
-
- et_signals[KEY_PRESS] =
- g_signal_new ("key_press",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, key_press),
- g_signal_accumulator_true_handled, NULL,
- e_marshal_BOOLEAN__INT_INT_BOXED,
- G_TYPE_BOOLEAN, 3,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
-
- et_signals[START_DRAG] =
- g_signal_new ("start_drag",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, start_drag),
- g_signal_accumulator_true_handled, NULL,
- e_marshal_BOOLEAN__INT_INT_BOXED,
- G_TYPE_BOOLEAN, 3,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
-
- et_signals[STATE_CHANGE] =
- g_signal_new ("state_change",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, state_change),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- et_signals[WHITE_SPACE_EVENT] =
- g_signal_new ("white_space_event",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, white_space_event),
- g_signal_accumulator_true_handled, NULL,
- e_marshal_BOOLEAN__BOXED,
- G_TYPE_BOOLEAN, 1,
- GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
-
- et_signals[TABLE_DRAG_BEGIN] =
- g_signal_new ("table_drag_begin",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, table_drag_begin),
- NULL, NULL,
- e_marshal_NONE__INT_INT_OBJECT,
- G_TYPE_NONE, 3,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT);
- et_signals[TABLE_DRAG_END] =
- g_signal_new ("table_drag_end",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, table_drag_end),
- NULL, NULL,
- e_marshal_NONE__INT_INT_OBJECT,
- G_TYPE_NONE, 3,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT);
- et_signals[TABLE_DRAG_DATA_GET] =
- g_signal_new ("table_drag_data_get",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, table_drag_data_get),
- NULL, NULL,
- e_marshal_NONE__INT_INT_OBJECT_BOXED_UINT_UINT,
- G_TYPE_NONE, 6,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT,
- GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE,
- G_TYPE_UINT,
- G_TYPE_UINT);
- et_signals[TABLE_DRAG_DATA_DELETE] =
- g_signal_new ("table_drag_data_delete",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, table_drag_data_delete),
- NULL, NULL,
- e_marshal_NONE__INT_INT_OBJECT,
- G_TYPE_NONE, 3,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT);
-
- et_signals[TABLE_DRAG_LEAVE] =
- g_signal_new ("table_drag_leave",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, table_drag_leave),
- NULL, NULL,
- e_marshal_NONE__INT_INT_OBJECT_UINT,
- G_TYPE_NONE, 4,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT,
- G_TYPE_UINT);
- et_signals[TABLE_DRAG_MOTION] =
- g_signal_new ("table_drag_motion",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, table_drag_motion),
- NULL, NULL,
- e_marshal_BOOLEAN__INT_INT_OBJECT_INT_INT_UINT,
- G_TYPE_BOOLEAN, 6,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT,
- G_TYPE_INT,
- G_TYPE_INT,
- G_TYPE_UINT);
- et_signals[TABLE_DRAG_DROP] =
- g_signal_new ("table_drag_drop",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, table_drag_drop),
- NULL, NULL,
- e_marshal_BOOLEAN__INT_INT_OBJECT_INT_INT_UINT,
- G_TYPE_BOOLEAN, 6,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT,
- G_TYPE_INT,
- G_TYPE_INT,
- G_TYPE_UINT);
- et_signals[TABLE_DRAG_DATA_RECEIVED] =
- g_signal_new ("table_drag_data_received",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, table_drag_data_received),
- NULL, NULL,
- e_marshal_NONE__INT_INT_OBJECT_INT_INT_BOXED_UINT_UINT,
- G_TYPE_NONE, 8,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT,
- G_TYPE_INT,
- G_TYPE_INT,
- GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE,
- G_TYPE_UINT,
- G_TYPE_UINT);
-
- g_object_class_install_property (object_class, PROP_LENGTH_THRESHOLD,
- g_param_spec_int ("length_threshold",
- "Length Threshold",
- NULL,
- 0, G_MAXINT, 0,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_UNIFORM_ROW_HEIGHT,
- g_param_spec_boolean ("uniform_row_height",
- "Uniform row height",
- NULL,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_ALWAYS_SEARCH,
- g_param_spec_boolean ("always_search",
- "Always search",
- NULL,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_USE_CLICK_TO_ADD,
- g_param_spec_boolean ("use_click_to_add",
- "Use click to add",
- NULL,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_MODEL,
- g_param_spec_object ("model",
- "Model",
- NULL,
- E_TYPE_TABLE_MODEL,
- G_PARAM_READABLE));
+ et_signals[CURSOR_CHANGE] = g_signal_new (
+ "cursor_change",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, cursor_change),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1, G_TYPE_INT);
+
+ et_signals[CURSOR_ACTIVATED] = g_signal_new (
+ "cursor_activated",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, cursor_activated),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1, G_TYPE_INT);
+
+ et_signals[SELECTION_CHANGE] = g_signal_new (
+ "selection_change",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, selection_change),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ et_signals[DOUBLE_CLICK] = g_signal_new (
+ "double_click",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, double_click),
+ NULL, NULL,
+ e_marshal_NONE__INT_INT_BOXED,
+ G_TYPE_NONE, 3,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
+ et_signals[RIGHT_CLICK] = g_signal_new (
+ "right_click",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, right_click),
+ g_signal_accumulator_true_handled, NULL,
+ e_marshal_BOOLEAN__INT_INT_BOXED,
+ G_TYPE_BOOLEAN, 3,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
+ et_signals[CLICK] = g_signal_new (
+ "click",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, click),
+ g_signal_accumulator_true_handled, NULL,
+ e_marshal_BOOLEAN__INT_INT_BOXED,
+ G_TYPE_BOOLEAN, 3,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
+ et_signals[KEY_PRESS] = g_signal_new (
+ "key_press",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, key_press),
+ g_signal_accumulator_true_handled, NULL,
+ e_marshal_BOOLEAN__INT_INT_BOXED,
+ G_TYPE_BOOLEAN, 3,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
+ et_signals[START_DRAG] = g_signal_new (
+ "start_drag",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, start_drag),
+ g_signal_accumulator_true_handled, NULL,
+ e_marshal_BOOLEAN__INT_INT_BOXED,
+ G_TYPE_BOOLEAN, 3,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
+ et_signals[STATE_CHANGE] = g_signal_new (
+ "state_change",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, state_change),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ et_signals[WHITE_SPACE_EVENT] = g_signal_new (
+ "white_space_event",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, white_space_event),
+ g_signal_accumulator_true_handled, NULL,
+ e_marshal_BOOLEAN__BOXED,
+ G_TYPE_BOOLEAN, 1,
+ GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
+ et_signals[TABLE_DRAG_BEGIN] = g_signal_new (
+ "table_drag_begin",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, table_drag_begin),
+ NULL, NULL,
+ e_marshal_NONE__INT_INT_OBJECT,
+ G_TYPE_NONE, 3,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ GDK_TYPE_DRAG_CONTEXT);
+
+ et_signals[TABLE_DRAG_END] = g_signal_new (
+ "table_drag_end",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, table_drag_end),
+ NULL, NULL,
+ e_marshal_NONE__INT_INT_OBJECT,
+ G_TYPE_NONE, 3,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ GDK_TYPE_DRAG_CONTEXT);
+
+ et_signals[TABLE_DRAG_DATA_GET] = g_signal_new (
+ "table_drag_data_get",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, table_drag_data_get),
+ NULL, NULL,
+ e_marshal_NONE__INT_INT_OBJECT_BOXED_UINT_UINT,
+ G_TYPE_NONE, 6,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ GDK_TYPE_DRAG_CONTEXT,
+ GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE,
+ G_TYPE_UINT,
+ G_TYPE_UINT);
+
+ et_signals[TABLE_DRAG_DATA_DELETE] = g_signal_new (
+ "table_drag_data_delete",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, table_drag_data_delete),
+ NULL, NULL,
+ e_marshal_NONE__INT_INT_OBJECT,
+ G_TYPE_NONE, 3,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ GDK_TYPE_DRAG_CONTEXT);
+
+ et_signals[TABLE_DRAG_LEAVE] = g_signal_new (
+ "table_drag_leave",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, table_drag_leave),
+ NULL, NULL,
+ e_marshal_NONE__INT_INT_OBJECT_UINT,
+ G_TYPE_NONE, 4,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ GDK_TYPE_DRAG_CONTEXT,
+ G_TYPE_UINT);
+
+ et_signals[TABLE_DRAG_MOTION] = g_signal_new (
+ "table_drag_motion",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, table_drag_motion),
+ NULL, NULL,
+ e_marshal_BOOLEAN__INT_INT_OBJECT_INT_INT_UINT,
+ G_TYPE_BOOLEAN, 6,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ GDK_TYPE_DRAG_CONTEXT,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ G_TYPE_UINT);
+
+ et_signals[TABLE_DRAG_DROP] = g_signal_new (
+ "table_drag_drop",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, table_drag_drop),
+ NULL, NULL,
+ e_marshal_BOOLEAN__INT_INT_OBJECT_INT_INT_UINT,
+ G_TYPE_BOOLEAN, 6,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ GDK_TYPE_DRAG_CONTEXT,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ G_TYPE_UINT);
+
+ et_signals[TABLE_DRAG_DATA_RECEIVED] = g_signal_new (
+ "table_drag_data_received",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, table_drag_data_received),
+ NULL, NULL,
+ e_marshal_NONE__INT_INT_OBJECT_INT_INT_BOXED_UINT_UINT,
+ G_TYPE_NONE, 8,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ GDK_TYPE_DRAG_CONTEXT,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE,
+ G_TYPE_UINT,
+ G_TYPE_UINT);
+
+ g_object_class_install_property (
+ object_class,
+ PROP_LENGTH_THRESHOLD,
+ g_param_spec_int (
+ "length_threshold",
+ "Length Threshold",
+ NULL,
+ 0, G_MAXINT, 0,
+ G_PARAM_WRITABLE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_UNIFORM_ROW_HEIGHT,
+ g_param_spec_boolean (
+ "uniform_row_height",
+ "Uniform row height",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_ALWAYS_SEARCH,
+ g_param_spec_boolean (
+ "always_search",
+ "Always search",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_USE_CLICK_TO_ADD,
+ g_param_spec_boolean (
+ "use_click_to_add",
+ "Use click to add",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_MODEL,
+ g_param_spec_object (
+ "model",
+ "Model",
+ NULL,
+ E_TYPE_TABLE_MODEL,
+ G_PARAM_READABLE));
gtk_widget_class_install_style_property (
widget_class,
diff --git a/widgets/table/e-tree-memory.c b/widgets/table/e-tree-memory.c
index 4f279aabb9..1b1bb9b2ba 100644
--- a/widgets/table/e-tree-memory.c
+++ b/widgets/table/e-tree-memory.c
@@ -39,6 +39,10 @@
#include "e-tree-memory.h"
+#define E_TREE_MEMORY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TREE_MEMORY, ETreeMemoryPrivate))
+
G_DEFINE_TYPE (ETreeMemory, e_tree_memory, E_TYPE_TREE_MODEL)
enum {
@@ -216,7 +220,7 @@ etmm_dispose (GObject *object)
{
ETreeMemoryPrivate *priv;
- priv = E_TREE_MEMORY (object)->priv;
+ priv = E_TREE_MEMORY_GET_PRIVATE (object);
if (priv->root)
e_tree_memory_node_remove (
@@ -401,8 +405,7 @@ e_tree_memory_class_init (ETreeMemoryClass *class)
static void
e_tree_memory_init (ETreeMemory *etmm)
{
- etmm->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- etmm, E_TYPE_TREE_MEMORY, ETreeMemoryPrivate);
+ etmm->priv = E_TREE_MEMORY_GET_PRIVATE (etmm);
}
/**
diff --git a/widgets/table/e-tree-model.c b/widgets/table/e-tree-model.c
index 24221418c0..9bed842a35 100644
--- a/widgets/table/e-tree-model.c
+++ b/widgets/table/e-tree-model.c
@@ -59,14 +59,14 @@ enum {
LAST_SIGNAL
};
-static guint e_tree_model_signals[LAST_SIGNAL] = {0, };
+static guint signals[LAST_SIGNAL] = {0, };
static void
e_tree_model_class_init (ETreeModelClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- e_tree_model_signals[PRE_CHANGE] =
+ signals[PRE_CHANGE] =
g_signal_new ("pre_change",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@@ -75,7 +75,7 @@ e_tree_model_class_init (ETreeModelClass *class)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- e_tree_model_signals[NO_CHANGE] =
+ signals[NO_CHANGE] =
g_signal_new ("no_change",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@@ -84,7 +84,7 @@ e_tree_model_class_init (ETreeModelClass *class)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- e_tree_model_signals[REBUILT] =
+ signals[REBUILT] =
g_signal_new ("rebuilt",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@@ -93,7 +93,7 @@ e_tree_model_class_init (ETreeModelClass *class)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- e_tree_model_signals[NODE_CHANGED] =
+ signals[NODE_CHANGED] =
g_signal_new ("node_changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@@ -102,7 +102,7 @@ e_tree_model_class_init (ETreeModelClass *class)
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
- e_tree_model_signals[NODE_DATA_CHANGED] =
+ signals[NODE_DATA_CHANGED] =
g_signal_new ("node_data_changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@@ -111,7 +111,7 @@ e_tree_model_class_init (ETreeModelClass *class)
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
- e_tree_model_signals[NODE_COL_CHANGED] =
+ signals[NODE_COL_CHANGED] =
g_signal_new ("node_col_changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@@ -120,7 +120,7 @@ e_tree_model_class_init (ETreeModelClass *class)
e_marshal_VOID__POINTER_INT,
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_INT);
- e_tree_model_signals[NODE_INSERTED] =
+ signals[NODE_INSERTED] =
g_signal_new ("node_inserted",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@@ -129,7 +129,7 @@ e_tree_model_class_init (ETreeModelClass *class)
e_marshal_VOID__POINTER_POINTER,
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
- e_tree_model_signals[NODE_REMOVED] =
+ signals[NODE_REMOVED] =
g_signal_new ("node_removed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@@ -138,7 +138,7 @@ e_tree_model_class_init (ETreeModelClass *class)
e_marshal_VOID__POINTER_POINTER_INT,
G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_INT);
- e_tree_model_signals[NODE_DELETED] =
+ signals[NODE_DELETED] =
g_signal_new ("node_deleted",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@@ -147,7 +147,7 @@ e_tree_model_class_init (ETreeModelClass *class)
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
- e_tree_model_signals[NODE_REQUEST_COLLAPSE] =
+ signals[NODE_REQUEST_COLLAPSE] =
g_signal_new ("node_request_collapse",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@@ -224,12 +224,9 @@ e_tree_model_init (ETreeModel *tree_model)
void
e_tree_model_pre_change (ETreeModel *tree_model)
{
- g_return_if_fail (tree_model != NULL);
g_return_if_fail (E_IS_TREE_MODEL (tree_model));
- d(g_print("Emitting pre_change on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[PRE_CHANGE], 0);
+ g_signal_emit (tree_model, signals[PRE_CHANGE], 0);
}
/**
@@ -244,12 +241,9 @@ e_tree_model_pre_change (ETreeModel *tree_model)
void
e_tree_model_no_change (ETreeModel *tree_model)
{
- g_return_if_fail (tree_model != NULL);
g_return_if_fail (E_IS_TREE_MODEL (tree_model));
- d(g_print("Emitting no_change on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NO_CHANGE], 0);
+ g_signal_emit (tree_model, signals[NO_CHANGE], 0);
}
/**
@@ -264,12 +258,9 @@ e_tree_model_no_change (ETreeModel *tree_model)
void
e_tree_model_rebuilt (ETreeModel *tree_model)
{
- g_return_if_fail (tree_model != NULL);
g_return_if_fail (E_IS_TREE_MODEL (tree_model));
- d(g_print("Emitting rebuilt on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[REBUILT], 0);
+ g_signal_emit (tree_model, signals[REBUILT], 0);
}
/**
* e_tree_model_node_changed:
@@ -284,12 +275,9 @@ void
e_tree_model_node_changed (ETreeModel *tree_model,
ETreePath node)
{
- g_return_if_fail (tree_model != NULL);
g_return_if_fail (E_IS_TREE_MODEL (tree_model));
- d(g_print("Emitting node_changed on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_CHANGED], 0, node);
+ g_signal_emit (tree_model, signals[NODE_CHANGED], 0, node);
}
/**
@@ -305,12 +293,9 @@ void
e_tree_model_node_data_changed (ETreeModel *tree_model,
ETreePath node)
{
- g_return_if_fail (tree_model != NULL);
g_return_if_fail (E_IS_TREE_MODEL (tree_model));
- d(g_print("Emitting node_data_changed on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_DATA_CHANGED], 0, node);
+ g_signal_emit (tree_model, signals[NODE_DATA_CHANGED], 0, node);
}
/**
@@ -327,12 +312,9 @@ e_tree_model_node_col_changed (ETreeModel *tree_model,
ETreePath node,
gint col)
{
- g_return_if_fail (tree_model != NULL);
g_return_if_fail (E_IS_TREE_MODEL (tree_model));
- d(g_print("Emitting node_col_changed on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_COL_CHANGED], 0, node, col);
+ g_signal_emit (tree_model, signals[NODE_COL_CHANGED], 0, node, col);
}
/**
@@ -348,13 +330,11 @@ e_tree_model_node_inserted (ETreeModel *tree_model,
ETreePath parent_node,
ETreePath inserted_node)
{
- g_return_if_fail (tree_model != NULL);
g_return_if_fail (E_IS_TREE_MODEL (tree_model));
- d(g_print("Emitting node_inserted on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_INSERTED], 0,
- parent_node, inserted_node);
+ g_signal_emit (
+ tree_model, signals[NODE_INSERTED], 0,
+ parent_node, inserted_node);
}
/**
@@ -371,13 +351,11 @@ e_tree_model_node_removed (ETreeModel *tree_model,
ETreePath removed_node,
gint old_position)
{
- g_return_if_fail (tree_model != NULL);
g_return_if_fail (E_IS_TREE_MODEL (tree_model));
- d(g_print("Emitting node_removed on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_REMOVED], 0,
- parent_node, removed_node, old_position);
+ g_signal_emit (
+ tree_model, signals[NODE_REMOVED], 0,
+ parent_node, removed_node, old_position);
}
/**
@@ -391,12 +369,9 @@ void
e_tree_model_node_deleted (ETreeModel *tree_model,
ETreePath deleted_node)
{
- g_return_if_fail (tree_model != NULL);
g_return_if_fail (E_IS_TREE_MODEL (tree_model));
- d(g_print("Emitting node_deleted on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_DELETED], 0, deleted_node);
+ g_signal_emit (tree_model, signals[NODE_DELETED], 0, deleted_node);
}
/**
@@ -410,12 +385,9 @@ void
e_tree_model_node_request_collapse (ETreeModel *tree_model,
ETreePath collapsed_node)
{
- g_return_if_fail (tree_model != NULL);
g_return_if_fail (E_IS_TREE_MODEL (tree_model));
- d(g_print("Emitting node_request_collapse on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_REQUEST_COLLAPSE], 0, collapsed_node);
+ g_signal_emit (tree_model, signals[NODE_REQUEST_COLLAPSE], 0, collapsed_node);
}
/**
@@ -442,7 +414,6 @@ e_tree_model_new (void)
ETreePath
e_tree_model_get_root (ETreeModel *etree)
{
- g_return_val_if_fail (etree != NULL, NULL);
g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
if (ETM_CLASS (etree)->get_root)
@@ -464,7 +435,8 @@ ETreePath
e_tree_model_node_get_parent (ETreeModel *etree,
ETreePath node)
{
- g_return_val_if_fail (etree != NULL, NULL);
+ g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
+
if (ETM_CLASS (etree)->get_parent)
return ETM_CLASS (etree)->get_parent (etree, node);
else
@@ -484,7 +456,6 @@ ETreePath
e_tree_model_node_get_first_child (ETreeModel *etree,
ETreePath node)
{
- g_return_val_if_fail (etree != NULL, NULL);
g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
if (ETM_CLASS (etree)->get_first_child)
@@ -506,7 +477,6 @@ ETreePath
e_tree_model_node_get_last_child (ETreeModel *etree,
ETreePath node)
{
- g_return_val_if_fail (etree != NULL, NULL);
g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
if (ETM_CLASS (etree)->get_last_child)
@@ -528,7 +498,6 @@ ETreePath
e_tree_model_node_get_next (ETreeModel *etree,
ETreePath node)
{
- g_return_val_if_fail (etree != NULL, NULL);
g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
if (ETM_CLASS (etree)->get_next)
@@ -550,7 +519,6 @@ ETreePath
e_tree_model_node_get_prev (ETreeModel *etree,
ETreePath node)
{
- g_return_val_if_fail (etree != NULL, NULL);
g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
if (ETM_CLASS (etree)->get_prev)
@@ -627,7 +595,6 @@ guint
e_tree_model_node_depth (ETreeModel *etree,
ETreePath node)
{
- g_return_val_if_fail (etree != NULL, 0);
g_return_val_if_fail (E_IS_TREE_MODEL (etree), 0);
if (ETM_CLASS (etree)->depth)
@@ -649,7 +616,6 @@ GdkPixbuf *
e_tree_model_icon_at (ETreeModel *etree,
ETreePath node)
{
- g_return_val_if_fail (etree != NULL, NULL);
g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
if (ETM_CLASS (etree)->icon_at)
@@ -669,7 +635,6 @@ e_tree_model_icon_at (ETreeModel *etree,
gboolean
e_tree_model_get_expanded_default (ETreeModel *etree)
{
- g_return_val_if_fail (etree != NULL, FALSE);
g_return_val_if_fail (E_IS_TREE_MODEL (etree), FALSE);
if (ETM_CLASS (etree)->get_expanded_default)
@@ -689,7 +654,6 @@ e_tree_model_get_expanded_default (ETreeModel *etree)
gint
e_tree_model_column_count (ETreeModel *etree)
{
- g_return_val_if_fail (etree != NULL, 0);
g_return_val_if_fail (E_IS_TREE_MODEL (etree), 0);
if (ETM_CLASS (etree)->column_count)
@@ -709,7 +673,6 @@ e_tree_model_column_count (ETreeModel *etree)
gboolean
e_tree_model_has_save_id (ETreeModel *etree)
{
- g_return_val_if_fail (etree != NULL, FALSE);
g_return_val_if_fail (E_IS_TREE_MODEL (etree), FALSE);
if (ETM_CLASS (etree)->has_save_id)
@@ -731,7 +694,6 @@ gchar *
e_tree_model_get_save_id (ETreeModel *etree,
ETreePath node)
{
- g_return_val_if_fail (etree != NULL, NULL);
g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
if (ETM_CLASS (etree)->get_save_id)
@@ -751,7 +713,6 @@ e_tree_model_get_save_id (ETreeModel *etree,
gboolean
e_tree_model_has_get_node_by_id (ETreeModel *etree)
{
- g_return_val_if_fail (etree != NULL, FALSE);
g_return_val_if_fail (E_IS_TREE_MODEL (etree), FALSE);
if (ETM_CLASS (etree)->has_get_node_by_id)
@@ -776,7 +737,6 @@ ETreePath
e_tree_model_get_node_by_id (ETreeModel *etree,
const gchar *save_id)
{
- g_return_val_if_fail (etree != NULL, NULL);
g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
if (ETM_CLASS (etree)->get_node_by_id)
@@ -796,7 +756,6 @@ e_tree_model_get_node_by_id (ETreeModel *etree,
gboolean
e_tree_model_has_change_pending (ETreeModel *etree)
{
- g_return_val_if_fail (etree != NULL, FALSE);
g_return_val_if_fail (E_IS_TREE_MODEL (etree), FALSE);
if (ETM_CLASS (etree)->has_change_pending)
@@ -830,7 +789,6 @@ e_tree_model_sort_value_at (ETreeModel *etree,
ETreePath node,
gint col)
{
- g_return_val_if_fail (etree != NULL, NULL);
g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
if (ETM_CLASS (etree)->sort_value_at)
@@ -863,7 +821,6 @@ e_tree_model_value_at (ETreeModel *etree,
ETreePath node,
gint col)
{
- g_return_val_if_fail (etree != NULL, NULL);
g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
if (ETM_CLASS (etree)->value_at)
@@ -878,7 +835,6 @@ e_tree_model_set_value_at (ETreeModel *etree,
gint col,
gconstpointer val)
{
- g_return_if_fail (etree != NULL);
g_return_if_fail (E_IS_TREE_MODEL (etree));
if (ETM_CLASS (etree)->set_value_at)
@@ -1031,7 +987,6 @@ e_tree_model_node_traverse (ETreeModel *model,
{
ETreePath child;
- g_return_if_fail (model != NULL);
g_return_if_fail (E_IS_TREE_MODEL (model));
g_return_if_fail (path != NULL);
@@ -1066,7 +1021,6 @@ e_tree_model_node_traverse_preorder (ETreeModel *model,
{
ETreePath child;
- g_return_if_fail (model != NULL);
g_return_if_fail (E_IS_TREE_MODEL (model));
g_return_if_fail (path != NULL);
@@ -1104,7 +1058,6 @@ e_tree_model_node_real_traverse (ETreeModel *model,
{
ETreePath child;
- g_return_val_if_fail (model != NULL, NULL);
g_return_val_if_fail (E_IS_TREE_MODEL (model), NULL);
g_return_val_if_fail (path != NULL, NULL);
@@ -1119,7 +1072,9 @@ e_tree_model_node_real_traverse (ETreeModel *model,
if (forward_direction && (child == end_path || func (model, child, data)))
return child;
- if ((result = e_tree_model_node_real_traverse (model, child, end_path, forward_direction, func, data)))
+ if ((result = e_tree_model_node_real_traverse (
+ model, child, end_path,
+ forward_direction, func, data)))
return result;
if (!forward_direction && (child == end_path || func (model, child, data)))
@@ -1153,7 +1108,6 @@ e_tree_model_node_find (ETreeModel *model,
ETreePath result;
ETreePath next;
- g_return_val_if_fail (model != NULL, NULL);
g_return_val_if_fail (E_IS_TREE_MODEL (model), NULL);
/* Just search the whole tree in this case. */
@@ -1164,7 +1118,9 @@ e_tree_model_node_find (ETreeModel *model,
if (forward_direction && (end_path == root || func (model, root, data)))
return root;
- if ((result = e_tree_model_node_real_traverse (model, root, end_path, forward_direction, func, data)))
+ result = e_tree_model_node_real_traverse (
+ model, root, end_path, forward_direction, func, data);
+ if (result)
return result;
if (!forward_direction && (end_path == root || func (model, root, data)))
@@ -1176,12 +1132,16 @@ e_tree_model_node_find (ETreeModel *model,
while (1) {
if (forward_direction) {
- if ((result = e_tree_model_node_real_traverse (model, path, end_path, forward_direction, func, data)))
+ if ((result = e_tree_model_node_real_traverse (
+ model, path, end_path,
+ forward_direction, func, data)))
return result;
next = e_tree_model_node_get_next (model, path);
} else {
next = e_tree_model_node_get_prev (model, path);
- if (next && (result = e_tree_model_node_real_traverse (model, next, end_path, forward_direction, func, data)))
+ if (next && (result = e_tree_model_node_real_traverse (
+ model, next, end_path,
+ forward_direction, func, data)))
return result;
}
diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c
index 9d04086b2f..33e4ab0780 100644
--- a/widgets/table/e-tree-selection-model.c
+++ b/widgets/table/e-tree-selection-model.c
@@ -31,6 +31,10 @@
#include "e-tree-selection-model.h"
+#define E_TREE_SELECTION_MODEL_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TREE_SELECTION_MODEL, ETreeSelectionModelPrivate))
+
G_DEFINE_TYPE (
ETreeSelectionModel, e_tree_selection_model, E_TYPE_SELECTION_MODEL)
@@ -66,7 +70,8 @@ static gint
get_cursor_row (ETreeSelectionModel *etsm)
{
if (etsm->priv->cursor_path)
- return e_tree_table_adapter_row_of_node (etsm->priv->etta, etsm->priv->cursor_path);
+ return e_tree_table_adapter_row_of_node (
+ etsm->priv->etta, etsm->priv->cursor_path);
return -1;
}
@@ -137,7 +142,8 @@ restore_cursor (ETreeSelectionModel *etsm,
etsm->priv->cursor_path = NULL;
if (etsm->priv->cursor_save_id) {
- etsm->priv->cursor_path = e_tree_model_get_node_by_id (etm, etsm->priv->cursor_save_id);
+ etsm->priv->cursor_path = e_tree_model_get_node_by_id (
+ etm, etsm->priv->cursor_save_id);
if (etsm->priv->cursor_path != NULL && etsm->priv->cursor_col == -1)
etsm->priv->cursor_col = 0;
@@ -148,10 +154,14 @@ restore_cursor (ETreeSelectionModel *etsm,
if (etsm->priv->cursor_path) {
gint cursor_row = get_cursor_row (etsm);
- e_selection_model_cursor_changed (E_SELECTION_MODEL (etsm), cursor_row, etsm->priv->cursor_col);
+ e_selection_model_cursor_changed (
+ E_SELECTION_MODEL (etsm),
+ cursor_row, etsm->priv->cursor_col);
} else {
- e_selection_model_cursor_changed (E_SELECTION_MODEL (etsm), -1, -1);
- e_selection_model_cursor_activated (E_SELECTION_MODEL (etsm), -1, -1);
+ e_selection_model_cursor_changed (
+ E_SELECTION_MODEL (etsm), -1, -1);
+ e_selection_model_cursor_activated (
+ E_SELECTION_MODEL (etsm), -1, -1);
}
@@ -165,8 +175,11 @@ etsm_pre_change (ETreeModel *etm,
g_free (etsm->priv->cursor_save_id);
etsm->priv->cursor_save_id = NULL;
- if (e_tree_model_has_get_node_by_id (etm) && e_tree_model_has_save_id (etm) && etsm->priv->cursor_path) {
- etsm->priv->cursor_save_id = e_tree_model_get_save_id (etm, etsm->priv->cursor_path);
+ if (e_tree_model_has_get_node_by_id (etm) &&
+ e_tree_model_has_save_id (etm) &&
+ etsm->priv->cursor_path) {
+ etsm->priv->cursor_save_id = e_tree_model_get_save_id (
+ etm, etsm->priv->cursor_path);
}
}
@@ -241,22 +254,38 @@ add_model (ETreeSelectionModel *etsm,
return;
g_object_ref (priv->model);
- priv->tree_model_pre_change_id = g_signal_connect_after (G_OBJECT (priv->model), "pre_change",
- G_CALLBACK (etsm_pre_change), etsm);
- priv->tree_model_no_change_id = g_signal_connect_after (G_OBJECT (priv->model), "no_change",
- G_CALLBACK (etsm_no_change), etsm);
- priv->tree_model_node_changed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_changed",
- G_CALLBACK (etsm_node_changed), etsm);
- priv->tree_model_node_data_changed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_data_changed",
- G_CALLBACK (etsm_node_data_changed), etsm);
- priv->tree_model_node_col_changed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_col_changed",
- G_CALLBACK (etsm_node_col_changed), etsm);
- priv->tree_model_node_inserted_id = g_signal_connect_after (G_OBJECT (priv->model), "node_inserted",
- G_CALLBACK (etsm_node_inserted), etsm);
- priv->tree_model_node_removed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_removed",
- G_CALLBACK (etsm_node_removed), etsm);
- priv->tree_model_node_deleted_id = g_signal_connect_after (G_OBJECT (priv->model), "node_deleted",
- G_CALLBACK (etsm_node_deleted), etsm);
+
+ priv->tree_model_pre_change_id = g_signal_connect_after (
+ priv->model, "pre_change",
+ G_CALLBACK (etsm_pre_change), etsm);
+
+ priv->tree_model_no_change_id = g_signal_connect_after (
+ priv->model, "no_change",
+ G_CALLBACK (etsm_no_change), etsm);
+
+ priv->tree_model_node_changed_id = g_signal_connect_after (
+ priv->model, "node_changed",
+ G_CALLBACK (etsm_node_changed), etsm);
+
+ priv->tree_model_node_data_changed_id = g_signal_connect_after (
+ priv->model, "node_data_changed",
+ G_CALLBACK (etsm_node_data_changed), etsm);
+
+ priv->tree_model_node_col_changed_id = g_signal_connect_after (
+ priv->model, "node_col_changed",
+ G_CALLBACK (etsm_node_col_changed), etsm);
+
+ priv->tree_model_node_inserted_id = g_signal_connect_after (
+ priv->model, "node_inserted",
+ G_CALLBACK (etsm_node_inserted), etsm);
+
+ priv->tree_model_node_removed_id = g_signal_connect_after (
+ priv->model, "node_removed",
+ G_CALLBACK (etsm_node_removed), etsm);
+
+ priv->tree_model_node_deleted_id = g_signal_connect_after (
+ priv->model, "node_deleted",
+ G_CALLBACK (etsm_node_deleted), etsm);
}
static void
@@ -267,22 +296,22 @@ drop_model (ETreeSelectionModel *etsm)
if (!priv->model)
return;
- g_signal_handler_disconnect (G_OBJECT (priv->model),
- priv->tree_model_pre_change_id);
- g_signal_handler_disconnect (G_OBJECT (priv->model),
- priv->tree_model_no_change_id);
- g_signal_handler_disconnect (G_OBJECT (priv->model),
- priv->tree_model_node_changed_id);
- g_signal_handler_disconnect (G_OBJECT (priv->model),
- priv->tree_model_node_data_changed_id);
- g_signal_handler_disconnect (G_OBJECT (priv->model),
- priv->tree_model_node_col_changed_id);
- g_signal_handler_disconnect (G_OBJECT (priv->model),
- priv->tree_model_node_inserted_id);
- g_signal_handler_disconnect (G_OBJECT (priv->model),
- priv->tree_model_node_removed_id);
- g_signal_handler_disconnect (G_OBJECT (priv->model),
- priv->tree_model_node_deleted_id);
+ g_signal_handler_disconnect (
+ priv->model, priv->tree_model_pre_change_id);
+ g_signal_handler_disconnect (
+ priv->model, priv->tree_model_no_change_id);
+ g_signal_handler_disconnect (
+ priv->model, priv->tree_model_node_changed_id);
+ g_signal_handler_disconnect (
+ priv->model, priv->tree_model_node_data_changed_id);
+ g_signal_handler_disconnect (
+ priv->model, priv->tree_model_node_col_changed_id);
+ g_signal_handler_disconnect (
+ priv->model, priv->tree_model_node_inserted_id);
+ g_signal_handler_disconnect (
+ priv->model, priv->tree_model_node_removed_id);
+ g_signal_handler_disconnect (
+ priv->model, priv->tree_model_node_deleted_id);
g_object_unref (priv->model);
priv->model = NULL;
@@ -313,7 +342,7 @@ etsm_finalize (GObject *object)
{
ETreeSelectionModelPrivate *priv;
- priv = E_TREE_SELECTION_MODEL (object)->priv;
+ priv = E_TREE_SELECTION_MODEL_GET_PRIVATE (object);
clear_selection (E_TREE_SELECTION_MODEL (object));
g_hash_table_destroy (priv->paths);
@@ -360,11 +389,15 @@ etsm_set_property (GObject *object,
switch (property_id) {
case PROP_CURSOR_ROW:
- e_selection_model_do_something (esm, g_value_get_int (value), etsm->priv->cursor_col, 0);
+ e_selection_model_do_something (
+ esm, g_value_get_int (value),
+ etsm->priv->cursor_col, 0);
break;
case PROP_CURSOR_COL:
- e_selection_model_do_something (esm, get_cursor_row (etsm), g_value_get_int (value), 0);
+ e_selection_model_do_something (
+ esm, get_cursor_row (etsm),
+ g_value_get_int (value), 0);
break;
case PROP_MODEL:
@@ -373,7 +406,8 @@ etsm_set_property (GObject *object,
break;
case PROP_ETTA:
- etsm->priv->etta = E_TREE_TABLE_ADAPTER (g_value_get_object (value));
+ etsm->priv->etta =
+ E_TREE_TABLE_ADAPTER (g_value_get_object (value));
break;
}
}
@@ -404,7 +438,9 @@ etsm_is_row_selected (ESelectionModel *selection,
ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (selection);
ETreePath path;
- g_return_val_if_fail (row < e_table_model_row_count (E_TABLE_MODEL (etsm->priv->etta)), FALSE);
+ g_return_val_if_fail (
+ row < e_table_model_row_count (
+ E_TABLE_MODEL (etsm->priv->etta)), FALSE);
g_return_val_if_fail (row >= 0, FALSE);
g_return_val_if_fail (etsm != NULL, FALSE);
@@ -425,7 +461,8 @@ etsm_row_foreach_cb (gpointer key,
{
ETreePath path = key;
ModelAndCallback *mac = user_data;
- gint row = e_tree_table_adapter_row_of_node (mac->etsm->priv->etta, path);
+ gint row = e_tree_table_adapter_row_of_node (
+ mac->etsm->priv->etta, path);
if (row >= 0)
mac->callback (row, mac->closure);
}
@@ -516,10 +553,14 @@ etsm_select_all (ESelectionModel *selection)
select_range (etsm, 0, etsm_row_count (selection) - 1);
if (etsm->priv->cursor_path == NULL)
- etsm->priv->cursor_path = e_tree_table_adapter_node_at_row (etsm->priv->etta, 0);
+ etsm->priv->cursor_path = e_tree_table_adapter_node_at_row (
+ etsm->priv->etta, 0);
e_selection_model_selection_changed (E_SELECTION_MODEL (etsm));
- e_selection_model_cursor_changed (E_SELECTION_MODEL (etsm), get_cursor_row (etsm), etsm->priv->cursor_col);
+
+ e_selection_model_cursor_changed (
+ E_SELECTION_MODEL (etsm),
+ get_cursor_row (etsm), etsm->priv->cursor_col);
}
/**
@@ -537,7 +578,9 @@ etsm_invert_selection (ESelectionModel *selection)
gint i;
for (i = 0; i < count; i++) {
- ETreePath path = e_tree_table_adapter_node_at_row (etsm->priv->etta, i);
+ ETreePath path;
+
+ path = e_tree_table_adapter_node_at_row (etsm->priv->etta, i);
if (!path)
continue;
if (g_hash_table_lookup (etsm->priv->paths, path))
@@ -561,7 +604,9 @@ etsm_change_one_row (ESelectionModel *selection,
ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (selection);
ETreePath path;
- g_return_if_fail (row < e_table_model_row_count (E_TABLE_MODEL (etsm->priv->etta)));
+ g_return_if_fail (
+ row < e_table_model_row_count (
+ E_TABLE_MODEL (etsm->priv->etta)));
g_return_if_fail (row >= 0);
g_return_if_fail (selection != NULL);
@@ -588,7 +633,9 @@ etsm_change_cursor (ESelectionModel *selection,
if (row == -1) {
etsm->priv->cursor_path = NULL;
} else {
- etsm->priv->cursor_path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row);
+ etsm->priv->cursor_path =
+ e_tree_table_adapter_node_at_row (
+ etsm->priv->etta, row);
}
etsm->priv->cursor_col = col;
}
@@ -621,9 +668,10 @@ etsm_select_single_row (ESelectionModel *selection,
gint row)
{
ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (selection);
- ETreePath path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row);
+ ETreePath path;
gint rows[5], *rowp = NULL, size;
+ path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row);
g_return_if_fail (path != NULL);
/* we really only care about the size=1 case (cursor changed),
@@ -643,9 +691,11 @@ etsm_select_single_row (ESelectionModel *selection,
gint *p = rows;
while (p < rowp)
- e_selection_model_selection_row_changed ((ESelectionModel *) etsm, *p++);
+ e_selection_model_selection_row_changed (
+ (ESelectionModel *) etsm, *p++);
}
- e_selection_model_selection_row_changed ((ESelectionModel *) etsm, row);
+ e_selection_model_selection_row_changed (
+ (ESelectionModel *) etsm, row);
}
}
@@ -654,8 +704,9 @@ etsm_toggle_single_row (ESelectionModel *selection,
gint row)
{
ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (selection);
- ETreePath path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row);
+ ETreePath path;
+ path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row);
g_return_if_fail (path);
if (g_hash_table_lookup (etsm->priv->paths, path))
@@ -672,12 +723,14 @@ static void
etsm_real_move_selection_end (ETreeSelectionModel *etsm,
gint row)
{
- ETreePath end_path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row);
+ ETreePath end_path;
gint start;
+ end_path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row);
g_return_if_fail (end_path);
- start = e_tree_table_adapter_row_of_node (etsm->priv->etta, etsm->priv->start_path);
+ start = e_tree_table_adapter_row_of_node (
+ etsm->priv->etta, etsm->priv->start_path);
clear_selection (etsm);
select_range (etsm, start, row);
}
@@ -782,8 +835,10 @@ e_tree_selection_model_change_cursor (ETreeSelectionModel *etsm,
E_SELECTION_MODEL (etsm)->old_selection = -1;
- e_selection_model_cursor_changed (E_SELECTION_MODEL (etsm), row, etsm->priv->cursor_col);
- e_selection_model_cursor_activated (E_SELECTION_MODEL (etsm), row, etsm->priv->cursor_col);
+ e_selection_model_cursor_changed (
+ E_SELECTION_MODEL (etsm), row, etsm->priv->cursor_col);
+ e_selection_model_cursor_activated (
+ E_SELECTION_MODEL (etsm), row, etsm->priv->cursor_col);
}
ETreePath
@@ -795,8 +850,7 @@ e_tree_selection_model_get_cursor (ETreeSelectionModel *etsm)
static void
e_tree_selection_model_init (ETreeSelectionModel *etsm)
{
- etsm->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- etsm, E_TYPE_TREE_SELECTION_MODEL, ETreeSelectionModelPrivate);
+ etsm->priv = E_TREE_SELECTION_MODEL_GET_PRIVATE (etsm);
etsm->priv->paths = g_hash_table_new (NULL, NULL);
etsm->priv->cursor_col = -1;
@@ -835,33 +889,45 @@ e_tree_selection_model_class_init (ETreeSelectionModelClass *class)
esm_class->move_selection_end = etsm_move_selection_end;
esm_class->set_selection_end = etsm_set_selection_end;
- g_object_class_install_property (object_class, PROP_CURSOR_ROW,
- g_param_spec_int ("cursor_row",
- "Cursor Row",
- NULL,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_CURSOR_COL,
- g_param_spec_int ("cursor_col",
- "Cursor Column",
- NULL,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_MODEL,
- g_param_spec_object ("model",
- "Model",
- NULL,
- E_TYPE_TREE_MODEL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_ETTA,
- g_param_spec_object ("etta",
- "ETTA",
- NULL,
- E_TYPE_TREE_TABLE_ADAPTER,
- G_PARAM_READWRITE));
+ g_object_class_install_property (
+ object_class,
+ PROP_CURSOR_ROW,
+ g_param_spec_int (
+ "cursor_row",
+ "Cursor Row",
+ NULL,
+ 0, G_MAXINT, 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CURSOR_COL,
+ g_param_spec_int (
+ "cursor_col",
+ "Cursor Column",
+ NULL,
+ 0, G_MAXINT, 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_MODEL,
+ g_param_spec_object (
+ "model",
+ "Model",
+ NULL,
+ E_TYPE_TREE_MODEL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_ETTA,
+ g_param_spec_object (
+ "etta",
+ "ETTA",
+ NULL,
+ E_TYPE_TREE_TABLE_ADAPTER,
+ G_PARAM_READWRITE));
}
diff --git a/widgets/table/e-tree-sorted.c b/widgets/table/e-tree-sorted.c
index 4d95fcc74b..eee9414d2a 100644
--- a/widgets/table/e-tree-sorted.c
+++ b/widgets/table/e-tree-sorted.c
@@ -50,6 +50,10 @@
#define d(x)
+#define E_TREE_SORTED_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TREE_SORTED, ETreeSortedPrivate))
+
G_DEFINE_TYPE (ETreeSorted, e_tree_sorted, E_TYPE_TREE_MODEL)
enum {
@@ -600,7 +604,7 @@ ets_dispose (GObject *object)
{
ETreeSortedPrivate *priv;
- priv = E_TREE_SORTED (object)->priv;
+ priv = E_TREE_SORTED_GET_PRIVATE (object);
if (priv->source) {
g_signal_handler_disconnect (
@@ -666,7 +670,7 @@ ets_finalize (GObject *object)
{
ETreeSortedPrivate *priv;
- priv = E_TREE_SORTED (object)->priv;
+ priv = E_TREE_SORTED_GET_PRIVATE (object);
if (priv->root)
free_path (priv->root);
@@ -1267,8 +1271,7 @@ e_tree_sorted_class_init (ETreeSortedClass *class)
static void
e_tree_sorted_init (ETreeSorted *ets)
{
- ets->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- ets, E_TYPE_TREE_SORTED, ETreeSortedPrivate);
+ ets->priv = E_TREE_SORTED_GET_PRIVATE (ets);
}
/**
diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c
index 1b87211c7b..dd7c1e7705 100644
--- a/widgets/table/e-tree-table-adapter.c
+++ b/widgets/table/e-tree-table-adapter.c
@@ -39,6 +39,10 @@
#include "e-table-sorting-utils.h"
#include "e-tree-table-adapter.h"
+#define E_TREE_TABLE_ADAPTER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TREE_TABLE_ADAPTER, ETreeTableAdapterPrivate))
+
/* workaround for avoiding API breakage */
#define etta_get_type e_tree_table_adapter_get_type
G_DEFINE_TYPE (ETreeTableAdapter, etta, E_TYPE_TABLE_MODEL)
@@ -535,7 +539,7 @@ etta_finalize (GObject *object)
{
ETreeTableAdapterPrivate *priv;
- priv = E_TREE_TABLE_ADAPTER (object)->priv;
+ priv = E_TREE_TABLE_ADAPTER_GET_PRIVATE (object);
if (priv->resort_idle_id) {
g_source_remove (priv->resort_idle_id);
@@ -560,7 +564,7 @@ etta_dispose (GObject *object)
{
ETreeTableAdapterPrivate *priv;
- priv = E_TREE_TABLE_ADAPTER (object)->priv;
+ priv = E_TREE_TABLE_ADAPTER_GET_PRIVATE (object);
if (priv->sort_info) {
g_signal_handler_disconnect (
@@ -787,8 +791,7 @@ etta_class_init (ETreeTableAdapterClass *class)
static void
etta_init (ETreeTableAdapter *etta)
{
- etta->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- etta, E_TYPE_TREE_TABLE_ADAPTER, ETreeTableAdapterPrivate);
+ etta->priv = E_TREE_TABLE_ADAPTER_GET_PRIVATE (etta);
etta->priv->root_visible = TRUE;
etta->priv->remap_needed = TRUE;
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
index ffcca22457..f78a477643 100644
--- a/widgets/table/e-tree.c
+++ b/widgets/table/e-tree.c
@@ -58,6 +58,10 @@
#define d(x)
+#define E_TREE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TREE, ETreePrivate))
+
enum {
CURSOR_CHANGE,
CURSOR_ACTIVATED,
@@ -396,7 +400,7 @@ et_dispose (GObject *object)
{
ETreePrivate *priv;
- priv = E_TREE (object)->priv;
+ priv = E_TREE_GET_PRIVATE (object);
if (priv->search != NULL) {
g_signal_handler_disconnect (
@@ -602,8 +606,7 @@ e_tree_init (ETree *e_tree)
gtk_table_set_homogeneous (GTK_TABLE (e_tree), FALSE);
- e_tree->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- e_tree, E_TYPE_TREE, ETreePrivate);
+ e_tree->priv = E_TREE_GET_PRIVATE (e_tree);
e_tree->priv->alternating_row_colors = 1;
e_tree->priv->horizontal_draw_grid = 1;
@@ -669,7 +672,8 @@ et_focus (GtkWidget *container,
return FALSE;
}
- return gtk_widget_child_focus (GTK_WIDGET (e_tree->priv->table_canvas), direction);
+ return gtk_widget_child_focus (
+ GTK_WIDGET (e_tree->priv->table_canvas), direction);
}
static void
@@ -681,17 +685,19 @@ set_header_canvas_width (ETree *e_tree)
e_tree->priv->header_canvas && e_tree->priv->table_canvas))
return;
- gnome_canvas_get_scroll_region (GNOME_CANVAS (e_tree->priv->table_canvas),
- NULL, NULL, &width, NULL);
- gnome_canvas_get_scroll_region (GNOME_CANVAS (e_tree->priv->header_canvas),
- NULL, NULL, &oldwidth, &oldheight);
+ gnome_canvas_get_scroll_region (
+ GNOME_CANVAS (e_tree->priv->table_canvas),
+ NULL, NULL, &width, NULL);
+ gnome_canvas_get_scroll_region (
+ GNOME_CANVAS (e_tree->priv->header_canvas),
+ NULL, NULL, &oldwidth, &oldheight);
if (oldwidth != width ||
oldheight != E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height - 1)
gnome_canvas_set_scroll_region (
- GNOME_CANVAS (e_tree->priv->header_canvas),
- 0, 0, width, /* COLUMN_HEADER_HEIGHT - 1 */
- E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height - 1);
+ GNOME_CANVAS (e_tree->priv->header_canvas),
+ 0, 0, width, /* COLUMN_HEADER_HEIGHT - 1 */
+ E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height - 1);
}
@@ -966,7 +972,8 @@ item_key_press (ETableItem *eti,
e_tree_get_cell_at (et, 30, y, &row_local, &col_local);
if (row_local == -1)
- row_local = e_table_model_row_count (E_TABLE_MODEL (et->priv->etta)) - 1;
+ 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 (
@@ -984,7 +991,8 @@ item_key_press (ETableItem *eti,
e_tree_get_cell_at (et, 30, y, &row_local, &col_local);
if (row_local == -1)
- row_local = e_table_model_row_count (E_TABLE_MODEL (et->priv->etta)) - 1;
+ 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 (
@@ -1005,9 +1013,11 @@ item_key_press (ETableItem *eti,
GDK_MOD1_MASK)) != GDK_SHIFT_MASK)
break;
if (row != -1) {
- path = e_tree_table_adapter_node_at_row (et->priv->etta, row);
+ path = e_tree_table_adapter_node_at_row (
+ et->priv->etta, row);
if (path)
- e_tree_table_adapter_node_set_expanded (et->priv->etta, path, TRUE);
+ e_tree_table_adapter_node_set_expanded (
+ et->priv->etta, path, TRUE);
}
return_val = 1;
break;
@@ -1021,9 +1031,11 @@ item_key_press (ETableItem *eti,
GDK_MOD1_MASK)) != GDK_SHIFT_MASK)
break;
if (row != -1) {
- path = e_tree_table_adapter_node_at_row (et->priv->etta, row);
+ path = e_tree_table_adapter_node_at_row (
+ et->priv->etta, row);
if (path)
- e_tree_table_adapter_node_set_expanded (et->priv->etta, path, FALSE);
+ e_tree_table_adapter_node_set_expanded (
+ et->priv->etta, path, FALSE);
}
return_val = 1;
break;
@@ -1102,20 +1114,27 @@ et_build_item (ETree *et)
"uniform_row_height", et->priv->uniform_row_height,
NULL);
- g_signal_connect (et->priv->item, "cursor_change",
- G_CALLBACK (item_cursor_change), et);
- g_signal_connect (et->priv->item, "cursor_activated",
- G_CALLBACK (item_cursor_activated), et);
- g_signal_connect (et->priv->item, "double_click",
- G_CALLBACK (item_double_click), et);
- g_signal_connect (et->priv->item, "right_click",
- G_CALLBACK (item_right_click), et);
- g_signal_connect (et->priv->item, "click",
- G_CALLBACK (item_click), et);
- g_signal_connect (et->priv->item, "key_press",
- G_CALLBACK (item_key_press), et);
- g_signal_connect (et->priv->item, "start_drag",
- G_CALLBACK (item_start_drag), et);
+ g_signal_connect (
+ et->priv->item, "cursor_change",
+ G_CALLBACK (item_cursor_change), et);
+ g_signal_connect (
+ et->priv->item, "cursor_activated",
+ G_CALLBACK (item_cursor_activated), et);
+ g_signal_connect (
+ et->priv->item, "double_click",
+ G_CALLBACK (item_double_click), et);
+ g_signal_connect (
+ et->priv->item, "right_click",
+ G_CALLBACK (item_right_click), et);
+ g_signal_connect (
+ et->priv->item, "click",
+ G_CALLBACK (item_click), et);
+ g_signal_connect (
+ et->priv->item, "key_press",
+ G_CALLBACK (item_key_press), et);
+ g_signal_connect (
+ et->priv->item, "start_drag",
+ G_CALLBACK (item_start_drag), et);
}
static void
@@ -1241,8 +1260,9 @@ e_tree_setup_table (ETree *e_tree)
e_tree, "drag_data_received",
G_CALLBACK (et_drag_data_received), e_tree);
- g_signal_connect (e_tree->priv->table_canvas, "reflow",
- G_CALLBACK (tree_canvas_reflow), e_tree);
+ g_signal_connect (
+ e_tree->priv->table_canvas, "reflow",
+ G_CALLBACK (tree_canvas_reflow), e_tree);
widget = GTK_WIDGET (e_tree->priv->table_canvas);
style = gtk_widget_get_style (widget);
@@ -1601,10 +1621,12 @@ et_real_construct (ETree *e_tree,
"cursor_mode", specification->cursor_mode,
NULL);
- g_signal_connect (e_tree->priv->selection, "selection_changed",
- G_CALLBACK (et_selection_model_selection_changed), e_tree);
- g_signal_connect (e_tree->priv->selection, "selection_row_changed",
- G_CALLBACK (et_selection_model_selection_row_changed), e_tree);
+ g_signal_connect (
+ e_tree->priv->selection, "selection_changed",
+ G_CALLBACK (et_selection_model_selection_changed), e_tree);
+ g_signal_connect (
+ e_tree->priv->selection, "selection_row_changed",
+ G_CALLBACK (et_selection_model_selection_row_changed), e_tree);
if (!specification->no_headers) {
e_tree_setup_header (e_tree);
@@ -1623,17 +1645,22 @@ et_real_construct (ETree *e_tree,
/*
* The header
*/
- gtk_table_attach (GTK_TABLE (e_tree), GTK_WIDGET (e_tree->priv->header_canvas),
- 0, 1, 0 + row, 1 + row,
- GTK_FILL | GTK_EXPAND,
- GTK_FILL, 0, 0);
+ gtk_table_attach (
+ GTK_TABLE (e_tree),
+ GTK_WIDGET (e_tree->priv->header_canvas),
+ 0, 1, 0 + row, 1 + row,
+ GTK_FILL | GTK_EXPAND,
+ GTK_FILL, 0, 0);
row++;
}
- gtk_table_attach (GTK_TABLE (e_tree), GTK_WIDGET (e_tree->priv->table_canvas),
- 0, 1, 0 + row, 1 + row,
- GTK_FILL | GTK_EXPAND,
- GTK_FILL | GTK_EXPAND,
- 0, 0);
+
+ gtk_table_attach (
+ GTK_TABLE (e_tree),
+ GTK_WIDGET (e_tree->priv->table_canvas),
+ 0, 1, 0 + row, 1 + row,
+ GTK_FILL | GTK_EXPAND,
+ GTK_FILL | GTK_EXPAND,
+ 0, 0);
g_object_unref (ete);
@@ -2001,12 +2028,15 @@ et_get_property (GObject *object,
case PROP_ETTA:
g_value_set_object (value, etree->priv->etta);
break;
+
case PROP_UNIFORM_ROW_HEIGHT:
g_value_set_boolean (value, etree->priv->uniform_row_height);
break;
+
case PROP_ALWAYS_SEARCH:
g_value_set_boolean (value, etree->priv->always_search);
break;
+
case PROP_HADJUSTMENT:
if (etree->priv->table_canvas)
g_object_get_property (
@@ -2015,6 +2045,7 @@ et_get_property (GObject *object,
else
g_value_set_object (value, NULL);
break;
+
case PROP_VADJUSTMENT:
if (etree->priv->table_canvas)
g_object_get_property (
@@ -2023,6 +2054,7 @@ et_get_property (GObject *object,
else
g_value_set_object (value, NULL);
break;
+
case PROP_HSCROLL_POLICY:
if (etree->priv->table_canvas)
g_object_get_property (
@@ -2031,6 +2063,7 @@ et_get_property (GObject *object,
else
g_value_set_enum (value, 0);
break;
+
case PROP_VSCROLL_POLICY:
if (etree->priv->table_canvas)
g_object_get_property (
@@ -2039,6 +2072,7 @@ et_get_property (GObject *object,
else
g_value_set_enum (value, 0);
break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -2062,45 +2096,55 @@ et_set_property (GObject *object,
case PROP_LENGTH_THRESHOLD:
etree->priv->length_threshold = g_value_get_int (value);
if (etree->priv->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (etree->priv->item),
- "length_threshold", etree->priv->length_threshold,
- NULL);
+ gnome_canvas_item_set (
+ GNOME_CANVAS_ITEM (etree->priv->item),
+ "length_threshold",
+ etree->priv->length_threshold,
+ NULL);
}
break;
case PROP_HORIZONTAL_DRAW_GRID:
etree->priv->horizontal_draw_grid = g_value_get_boolean (value);
if (etree->priv->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (etree->priv->item),
- "horizontal_draw_grid", etree->priv->horizontal_draw_grid,
- NULL);
+ gnome_canvas_item_set (
+ GNOME_CANVAS_ITEM (etree->priv->item),
+ "horizontal_draw_grid",
+ etree->priv->horizontal_draw_grid,
+ NULL);
}
break;
case PROP_VERTICAL_DRAW_GRID:
etree->priv->vertical_draw_grid = g_value_get_boolean (value);
if (etree->priv->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (etree->priv->item),
- "vertical_draw_grid", etree->priv->vertical_draw_grid,
- NULL);
+ gnome_canvas_item_set (
+ GNOME_CANVAS_ITEM (etree->priv->item),
+ "vertical_draw_grid",
+ etree->priv->vertical_draw_grid,
+ NULL);
}
break;
case PROP_DRAW_FOCUS:
etree->priv->draw_focus = g_value_get_boolean (value);
if (etree->priv->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (etree->priv->item),
- "drawfocus", etree->priv->draw_focus,
- NULL);
+ gnome_canvas_item_set (
+ GNOME_CANVAS_ITEM (etree->priv->item),
+ "drawfocus",
+ etree->priv->draw_focus,
+ NULL);
}
break;
case PROP_UNIFORM_ROW_HEIGHT:
etree->priv->uniform_row_height = g_value_get_boolean (value);
if (etree->priv->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (etree->priv->item),
- "uniform_row_height", etree->priv->uniform_row_height,
- NULL);
+ gnome_canvas_item_set (
+ GNOME_CANVAS_ITEM (etree->priv->item),
+ "uniform_row_height",
+ etree->priv->uniform_row_height,
+ NULL);
}
break;
@@ -2117,18 +2161,21 @@ et_set_property (GObject *object,
G_OBJECT (etree->priv->table_canvas),
"hadjustment", value);
break;
+
case PROP_VADJUSTMENT:
if (etree->priv->table_canvas)
g_object_set_property (
G_OBJECT (etree->priv->table_canvas),
"vadjustment", value);
break;
+
case PROP_HSCROLL_POLICY:
if (etree->priv->table_canvas)
g_object_set_property (
G_OBJECT (etree->priv->table_canvas),
"hscroll-policy", value);
break;
+
case PROP_VSCROLL_POLICY:
if (etree->priv->table_canvas)
g_object_set_property (
diff --git a/widgets/table/gal-a11y-e-cell-registry.c b/widgets/table/gal-a11y-e-cell-registry.c
index ce533882ab..db05ac05c1 100644
--- a/widgets/table/gal-a11y-e-cell-registry.c
+++ b/widgets/table/gal-a11y-e-cell-registry.c
@@ -93,7 +93,8 @@ gal_a11y_e_cell_registry_get_type (void)
NULL /* value_cell */
};
- type = g_type_register_static (PARENT_TYPE, "GalA11yECellRegistry", &info, 0);
+ type = g_type_register_static (
+ PARENT_TYPE, "GalA11yECellRegistry", &info, 0);
}
return type;
@@ -130,10 +131,10 @@ gal_a11y_e_cell_registry_get_object (GalA11yECellRegistry *registry,
type = g_type_parent (type);
}
- if (func)
- return func (item, cell_view, parent, model_col, view_col, row);
- else
- return gal_a11y_e_cell_new (item, cell_view, parent, model_col, view_col, row);
+ if (func == NULL)
+ func = gal_a11y_e_cell_new;
+
+ return func (item, cell_view, parent, model_col, view_col, row);
}
void
diff --git a/widgets/table/gal-a11y-e-cell-toggle.c b/widgets/table/gal-a11y-e-cell-toggle.c
index 991d3c0721..ca6fdfc14d 100644
--- a/widgets/table/gal-a11y-e-cell-toggle.c
+++ b/widgets/table/gal-a11y-e-cell-toggle.c
@@ -179,10 +179,9 @@ gal_a11y_e_cell_toggle_new (ETableItem *item,
NULL, /* action keybinding */
toggle_cell_action);
- toggle_cell->model_id = g_signal_connect (item->table_model,
- "model_cell_changed",
- (GCallback) model_change_cb,
- a11y);
+ toggle_cell->model_id = g_signal_connect (
+ item->table_model, "model_cell_changed",
+ (GCallback) model_change_cb, a11y);
value = GPOINTER_TO_INT (
e_table_model_value_at (cell->cell_view->e_table_model,
diff --git a/widgets/table/gal-a11y-e-cell-tree.c b/widgets/table/gal-a11y-e-cell-tree.c
index 148731d4b8..a1653698a2 100644
--- a/widgets/table/gal-a11y-e-cell-tree.c
+++ b/widgets/table/gal-a11y-e-cell-tree.c
@@ -246,10 +246,9 @@ gal_a11y_e_cell_tree_new (ETableItem *item,
model_col,
view_col,
row);
- a11y->model_row_changed_id =
- g_signal_connect (item->table_model, "model_row_changed",
- G_CALLBACK (ectr_model_row_changed_cb),
- subcell_a11y);
+ a11y->model_row_changed_id = g_signal_connect (
+ item->table_model, "model_row_changed",
+ G_CALLBACK (ectr_model_row_changed_cb), subcell_a11y);
if (subcell_a11y && subcell_view)
{
diff --git a/widgets/table/gal-a11y-e-table-click-to-add.c b/widgets/table/gal-a11y-e-table-click-to-add.c
index e4b5255e4c..1f116ee6b3 100644
--- a/widgets/table/gal-a11y-e-table-click-to-add.c
+++ b/widgets/table/gal-a11y-e-table-click-to-add.c
@@ -335,11 +335,13 @@ gal_a11y_e_table_click_to_add_new (GObject *widget)
priv->rect = etcta->rect;
priv->row = etcta->row;
- g_signal_connect_after (G_OBJECT(widget), "event",
- G_CALLBACK (etcta_event), a11y);
+ g_signal_connect_after (
+ widget, "event",
+ G_CALLBACK (etcta_event), a11y);
- g_signal_connect (etcta->selection, "cursor_changed",
- G_CALLBACK (etcta_selection_cursor_changed), a11y);
+ g_signal_connect (
+ etcta->selection, "cursor_changed",
+ G_CALLBACK (etcta_selection_cursor_changed), a11y);
return ATK_OBJECT (a11y);
}
@@ -348,9 +350,9 @@ void
gal_a11y_e_table_click_to_add_init (void)
{
if (atk_get_root ())
- atk_registry_set_factory_type (atk_get_default_registry (),
- E_TYPE_TABLE_CLICK_TO_ADD,
- gal_a11y_e_table_click_to_add_factory_get_type ());
-
+ atk_registry_set_factory_type (
+ atk_get_default_registry (),
+ E_TYPE_TABLE_CLICK_TO_ADD,
+ gal_a11y_e_table_click_to_add_factory_get_type ());
}
diff --git a/widgets/table/gal-a11y-e-table-column-header.c b/widgets/table/gal-a11y-e-table-column-header.c
index 8e13fd6865..05a99e381b 100644
--- a/widgets/table/gal-a11y-e-table-column-header.c
+++ b/widgets/table/gal-a11y-e-table-column-header.c
@@ -123,14 +123,17 @@ gal_a11y_e_table_column_header_do_action (AtkAction *action,
switch (i) {
case 0:
a11y = GAL_A11Y_E_TABLE_COLUMN_HEADER (action);
- col = E_TABLE_COL (etch_a11y_get_gobject (ATK_GOBJECT_ACCESSIBLE (a11y)));
+ col = E_TABLE_COL (etch_a11y_get_gobject (
+ ATK_GOBJECT_ACCESSIBLE (a11y)));
item = GET_PRIVATE (a11y)->item;
widget = gtk_widget_get_parent (GTK_WIDGET (item->parent.canvas));
if (E_IS_TREE (widget)) {
- ethi = E_TABLE_HEADER_ITEM (e_tree_get_header_item (E_TREE (widget)));
+ ethi = E_TABLE_HEADER_ITEM (
+ e_tree_get_header_item (E_TREE (widget)));
}
else if (E_IS_TABLE (widget))
- ethi = E_TABLE_HEADER_ITEM (E_TABLE (widget)->header_item);
+ ethi = E_TABLE_HEADER_ITEM (
+ E_TABLE (widget)->header_item);
else
break;
ethi_change_sort_state (ethi, col);
diff --git a/widgets/table/gal-a11y-e-table-factory.c b/widgets/table/gal-a11y-e-table-factory.c
index 2270cbaa5b..a3905ab393 100644
--- a/widgets/table/gal-a11y-e-table-factory.c
+++ b/widgets/table/gal-a11y-e-table-factory.c
@@ -93,7 +93,8 @@ gal_a11y_e_table_factory_get_type (void)
NULL /* value_table */
};
- type = g_type_register_static (PARENT_TYPE, "GalA11yETableFactory", &info, 0);
+ type = g_type_register_static (
+ PARENT_TYPE, "GalA11yETableFactory", &info, 0);
}
return type;
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");