diff options
Diffstat (limited to 'widgets/misc')
-rw-r--r-- | widgets/misc/e-reflow-model.c | 106 | ||||
-rw-r--r-- | widgets/misc/e-reflow-model.h | 17 | ||||
-rw-r--r-- | widgets/misc/e-reflow.c | 96 | ||||
-rw-r--r-- | widgets/misc/e-selection-model-array.c | 78 | ||||
-rw-r--r-- | widgets/misc/e-selection-model-array.h | 11 | ||||
-rw-r--r-- | widgets/misc/e-selection-model-simple.c | 6 | ||||
-rw-r--r-- | widgets/misc/e-selection-model-simple.h | 10 | ||||
-rw-r--r-- | widgets/misc/e-selection-model.c | 267 | ||||
-rw-r--r-- | widgets/misc/e-selection-model.h | 17 |
9 files changed, 312 insertions, 296 deletions
diff --git a/widgets/misc/e-reflow-model.c b/widgets/misc/e-reflow-model.c index b217b186ce..489a18b7e1 100644 --- a/widgets/misc/e-reflow-model.c +++ b/widgets/misc/e-reflow-model.c @@ -23,19 +23,16 @@ #include <config.h> #include "e-reflow-model.h" -#include <gtk/gtksignal.h> #include "gal/util/e-util.h" -#define ERM_CLASS(e) ((EReflowModelClass *)(GTK_OBJECT_GET_CLASS (e))) - -#define PARENT_TYPE gtk_object_get_type () +#define PARENT_TYPE G_TYPE_OBJECT #define d(x) d(static gint depth = 0;) -static GtkObjectClass *e_reflow_model_parent_class; +static GObjectClass *e_reflow_model_parent_class; enum { MODEL_CHANGED, @@ -57,7 +54,7 @@ e_reflow_model_set_width (EReflowModel *e_reflow_model, int width) g_return_if_fail (e_reflow_model != NULL); g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model)); - ERM_CLASS (e_reflow_model)->set_width (e_reflow_model, width); + E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->set_width (e_reflow_model, width); } /** @@ -72,7 +69,7 @@ e_reflow_model_count (EReflowModel *e_reflow_model) g_return_val_if_fail (e_reflow_model != NULL, 0); g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), 0); - return ERM_CLASS (e_reflow_model)->count (e_reflow_model); + return E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->count (e_reflow_model); } /** @@ -89,7 +86,7 @@ e_reflow_model_height (EReflowModel *e_reflow_model, int n, GnomeCanvasGroup *pa g_return_val_if_fail (e_reflow_model != NULL, 0); g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), 0); - return ERM_CLASS (e_reflow_model)->height (e_reflow_model, n, parent); + return E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->height (e_reflow_model, n, parent); } /** @@ -108,7 +105,7 @@ e_reflow_model_incarnate (EReflowModel *e_reflow_model, int n, GnomeCanvasGroup g_return_val_if_fail (e_reflow_model != NULL, NULL); g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), NULL); - return ERM_CLASS (e_reflow_model)->incarnate (e_reflow_model, n, parent); + return E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->incarnate (e_reflow_model, n, parent); } /** @@ -129,7 +126,7 @@ e_reflow_model_compare (EReflowModel *e_reflow_model, int n1, int n2) g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), 0); #endif - return ERM_CLASS (e_reflow_model)->compare (e_reflow_model, n1, n2); + return E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->compare (e_reflow_model, n1, n2); } /** @@ -146,40 +143,41 @@ e_reflow_model_reincarnate (EReflowModel *e_reflow_model, int n, GnomeCanvasItem g_return_if_fail (e_reflow_model != NULL); g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model)); - ERM_CLASS (e_reflow_model)->reincarnate (e_reflow_model, n, item); + E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->reincarnate (e_reflow_model, n, item); } static void -e_reflow_model_class_init (GtkObjectClass *object_class) +e_reflow_model_class_init (GObjectClass *object_class) { EReflowModelClass *klass = E_REFLOW_MODEL_CLASS(object_class); - e_reflow_model_parent_class = gtk_type_class (PARENT_TYPE); + e_reflow_model_parent_class = g_type_class_ref (PARENT_TYPE); e_reflow_model_signals [MODEL_CHANGED] = - gtk_signal_new ("model_changed", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (EReflowModelClass, model_changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); + g_signal_new ("model_changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EReflowModelClass, model_changed), + NULL, NULL, + e_marshal_NONE__NONE, + G_TYPE_NONE, 0); e_reflow_model_signals [MODEL_ITEMS_INSERTED] = - gtk_signal_new ("model_items_inserted", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (EReflowModelClass, model_items_inserted), - gtk_marshal_NONE__INT_INT, - GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT); + 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] = - gtk_signal_new ("model_item_changed", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (EReflowModelClass, model_item_changed), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, GTK_TYPE_INT); - - E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_reflow_model_signals, LAST_SIGNAL); + 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, + e_marshal_NONE__INT, + G_TYPE_NONE, 1, G_TYPE_INT); klass->set_width = NULL; klass->count = NULL; @@ -192,32 +190,14 @@ e_reflow_model_class_init (GtkObjectClass *object_class) klass->model_item_changed = NULL; } - -GtkType -e_reflow_model_get_type (void) +static void +e_reflow_model_init (GObject *object) { - static guint type = 0; - - if (!type) - { - GtkTypeInfo info = - { - "EReflowModel", - sizeof (EReflowModel), - sizeof (EReflowModelClass), - (GtkClassInitFunc) e_reflow_model_class_init, - NULL, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; } +E_MAKE_TYPE(e_reflow_model, "EReflowModel", EReflowModel, + e_reflow_model_class_init, e_reflow_model_init, PARENT_TYPE) + #if d(!)0 static void print_tabs (void) @@ -250,8 +230,8 @@ 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++); - gtk_signal_emit (GTK_OBJECT (e_reflow_model), - e_reflow_model_signals [MODEL_CHANGED]); + g_signal_emit (e_reflow_model, + e_reflow_model_signals [MODEL_CHANGED], 0); d(depth--); } @@ -272,8 +252,9 @@ e_reflow_model_items_inserted (EReflowModel *e_reflow_model, int position, int c 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++); - gtk_signal_emit (GTK_OBJECT (e_reflow_model), - e_reflow_model_signals [MODEL_ITEMS_INSERTED], position, count); + g_signal_emit (e_reflow_model, + e_reflow_model_signals [MODEL_ITEMS_INSERTED], 0, + position, count); d(depth--); } @@ -297,7 +278,8 @@ e_reflow_model_item_changed (EReflowModel *e_reflow_model, int n) d(print_tabs()); d(g_print("Emitting item_changed on model 0x%p, n=%d.\n", e_reflow_model, n)); d(depth++); - gtk_signal_emit (GTK_OBJECT (e_reflow_model), - e_reflow_model_signals [MODEL_ITEM_CHANGED], n); + g_signal_emit (e_reflow_model, + e_reflow_model_signals [MODEL_ITEM_CHANGED], 0, + n); d(depth--); } diff --git a/widgets/misc/e-reflow-model.h b/widgets/misc/e-reflow-model.h index 0f479ab5ca..b755cee447 100644 --- a/widgets/misc/e-reflow-model.h +++ b/widgets/misc/e-reflow-model.h @@ -24,7 +24,7 @@ #ifndef _E_REFLOW_MODEL_H_ #define _E_REFLOW_MODEL_H_ -#include <gtk/gtkobject.h> +#include <glib-object.h> #include <libgnomecanvas/gnome-canvas.h> #ifdef __cplusplus @@ -32,17 +32,18 @@ extern "C" { #endif /* __cplusplus */ #define E_REFLOW_MODEL_TYPE (e_reflow_model_get_type ()) -#define E_REFLOW_MODEL(o) (GTK_CHECK_CAST ((o), E_REFLOW_MODEL_TYPE, EReflowModel)) -#define E_REFLOW_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_REFLOW_MODEL_TYPE, EReflowModelClass)) -#define E_IS_REFLOW_MODEL(o) (GTK_CHECK_TYPE ((o), E_REFLOW_MODEL_TYPE)) -#define E_IS_REFLOW_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_REFLOW_MODEL_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 { - GtkObject base; + GObject base; } EReflowModel; typedef struct { - GtkObjectClass parent_class; + GObjectClass parent_class; /* * Virtual methods @@ -69,7 +70,7 @@ typedef struct { void (*model_item_changed) (EReflowModel *etm, int n); } EReflowModelClass; -GtkType e_reflow_model_get_type (void); +GType e_reflow_model_get_type (void); /**/ void e_reflow_model_set_width (EReflowModel *e_reflow_model, diff --git a/widgets/misc/e-reflow.c b/widgets/misc/e-reflow.c index 6524fb2f2e..c38331dcd7 100644 --- a/widgets/misc/e-reflow.c +++ b/widgets/misc/e-reflow.c @@ -122,15 +122,15 @@ static inline void e_reflow_update_selection_row (EReflow *reflow, int row) { if (reflow->items[row]) { - gtk_object_set(GTK_OBJECT(reflow->items[row]), - "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), row), - NULL); + g_object_set(reflow->items[row], + "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), row), + NULL); } else if (e_selection_model_is_row_selected (E_SELECTION_MODEL (reflow->selection), row)) { reflow->items[row] = e_reflow_model_incarnate (reflow->model, row, GNOME_CANVAS_GROUP (reflow)); - gtk_object_set (GTK_OBJECT (reflow->items[row]), - "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), row), - "width", (double) reflow->column_width, - NULL); + g_object_set (reflow->items[row], + "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), row), + "width", (double) reflow->column_width, + NULL); } } @@ -166,9 +166,9 @@ cursor_changed (ESelectionModel *selection, int row, int col, EReflow *reflow) if (old_cursor < count && old_cursor >= 0) { if (reflow->items[old_cursor]) { - gtk_object_set (GTK_OBJECT (reflow->items[old_cursor]), - "has_cursor", FALSE, - NULL); + g_object_set (reflow->items[old_cursor], + "has_cursor", FALSE, + NULL); } } @@ -176,15 +176,15 @@ cursor_changed (ESelectionModel *selection, int row, int col, EReflow *reflow) if (row < count && row >= 0) { if (reflow->items[row]) { - gtk_object_set (GTK_OBJECT (reflow->items[row]), - "has_cursor", TRUE, - NULL); + g_object_set (reflow->items[row], + "has_cursor", TRUE, + NULL); } else { reflow->items[row] = e_reflow_model_incarnate (reflow->model, row, GNOME_CANVAS_GROUP (reflow)); - gtk_object_set (GTK_OBJECT (reflow->items[row]), - "has_cursor", TRUE, - "width", (double) reflow->column_width, - NULL); + g_object_set (reflow->items[row], + "has_cursor", TRUE, + "width", (double) reflow->column_width, + NULL); } } } @@ -224,10 +224,10 @@ incarnate (EReflow *reflow) if (reflow->items[unsorted] == NULL) { if (reflow->model) { reflow->items[unsorted] = e_reflow_model_incarnate (reflow->model, unsorted, GNOME_CANVAS_GROUP (reflow)); - gtk_object_set (GTK_OBJECT (reflow->items[unsorted]), - "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), unsorted), - "width", (double) reflow->column_width, - NULL); + g_object_set (reflow->items[unsorted], + "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), unsorted), + "width", (double) reflow->column_width, + NULL); } } } @@ -439,12 +439,12 @@ disconnect_model (EReflow *reflow) if (reflow->model == NULL) return; - gtk_signal_disconnect (GTK_OBJECT (reflow->model), - reflow->model_changed_id); - gtk_signal_disconnect (GTK_OBJECT (reflow->model), - reflow->model_items_inserted_id); - gtk_signal_disconnect (GTK_OBJECT (reflow->model), - reflow->model_item_changed_id); + g_signal_handler_disconnect (reflow->model, + reflow->model_changed_id); + g_signal_handler_disconnect (reflow->model, + reflow->model_items_inserted_id); + g_signal_handler_disconnect (reflow->model, + reflow->model_item_changed_id); g_object_unref (reflow->model); reflow->model_changed_id = 0; @@ -459,12 +459,12 @@ disconnect_selection (EReflow *reflow) if (reflow->selection == NULL) return; - gtk_signal_disconnect (GTK_OBJECT (reflow->selection), - reflow->selection_changed_id); - gtk_signal_disconnect (GTK_OBJECT (reflow->selection), - reflow->selection_row_changed_id); - gtk_signal_disconnect (GTK_OBJECT (reflow->selection), - reflow->cursor_changed_id); + g_signal_handler_disconnect (reflow->selection, + reflow->selection_changed_id); + g_signal_handler_disconnect (reflow->selection, + reflow->selection_row_changed_id); + g_signal_handler_disconnect (reflow->selection, + reflow->cursor_changed_id); g_object_unref (reflow->selection); reflow->selection_changed_id = 0; @@ -485,14 +485,14 @@ connect_model (EReflow *reflow, EReflowModel *model) reflow->model = model; g_object_ref (reflow->model); reflow->model_changed_id = - gtk_signal_connect (GTK_OBJECT (reflow->model), "model_changed", - GTK_SIGNAL_FUNC (model_changed), reflow); + g_signal_connect (reflow->model, "model_changed", + G_CALLBACK (model_changed), reflow); reflow->model_items_inserted_id = - gtk_signal_connect (GTK_OBJECT (reflow->model), "model_items_inserted", - GTK_SIGNAL_FUNC (items_inserted), reflow); + g_signal_connect (reflow->model, "model_items_inserted", + G_CALLBACK (items_inserted), reflow); reflow->model_item_changed_id = - gtk_signal_connect (GTK_OBJECT (reflow->model), "model_item_changed", - GTK_SIGNAL_FUNC (item_changed), reflow); + g_signal_connect (reflow->model, "model_item_changed", + G_CALLBACK (item_changed), reflow); model_changed (model, reflow); } @@ -1357,19 +1357,19 @@ e_reflow_init (EReflow *reflow) reflow->selection = E_SELECTION_MODEL (e_selection_model_simple_new()); reflow->sorter = e_sorter_array_new (er_compare, reflow); - gtk_object_set (GTK_OBJECT (reflow->selection), - "sorter", reflow->sorter, - NULL); + g_object_set (reflow->selection, + "sorter", reflow->sorter, + NULL); reflow->selection_changed_id = - gtk_signal_connect(GTK_OBJECT(reflow->selection), "selection_changed", - GTK_SIGNAL_FUNC(selection_changed), reflow); + g_signal_connect(reflow->selection, "selection_changed", + G_CALLBACK (selection_changed), reflow); reflow->selection_row_changed_id = - gtk_signal_connect(GTK_OBJECT(reflow->selection), "selection_row_changed", - GTK_SIGNAL_FUNC(selection_row_changed), reflow); + g_signal_connect(reflow->selection, "selection_row_changed", + G_CALLBACK (selection_row_changed), reflow); reflow->cursor_changed_id = - gtk_signal_connect(GTK_OBJECT(reflow->selection), "cursor_changed", - GTK_SIGNAL_FUNC(cursor_changed), reflow); + 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/misc/e-selection-model-array.c b/widgets/misc/e-selection-model-array.c index df254cb810..42d7da90e4 100644 --- a/widgets/misc/e-selection-model-array.c +++ b/widgets/misc/e-selection-model-array.c @@ -24,18 +24,17 @@ #include <config.h> #include <gtk/gtksignal.h> #include "e-selection-model-array.h" +#include "gal/util/e-i18n.h" #include "gal/util/e-util.h" -#define ESMA_CLASS(e) ((ESelectionModelArrayClass *)(GTK_OBJECT_GET_CLASS (e))) - #define PARENT_TYPE e_selection_model_get_type () static ESelectionModelClass *parent_class; enum { - ARG_0, - ARG_CURSOR_ROW, - ARG_CURSOR_COL + PROP_0, + PROP_CURSOR_ROW, + PROP_CURSOR_COL }; void @@ -128,7 +127,7 @@ e_selection_model_array_move_row(ESelectionModelArray *esma, int old_row, int ne } static void -esma_destroy (GtkObject *object) +esma_dispose (GObject *object) { ESelectionModelArray *esma; @@ -139,39 +138,39 @@ esma_destroy (GtkObject *object) esma->eba = NULL; } - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + if (G_OBJECT_CLASS (parent_class)->dispose) + (* G_OBJECT_CLASS (parent_class)->dispose) (object); } static void -esma_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) +esma_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY (o); + ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY (object); - switch (arg_id){ - case ARG_CURSOR_ROW: - GTK_VALUE_INT(*arg) = esma->cursor_row; + switch (prop_id){ + case PROP_CURSOR_ROW: + g_value_set_int (value, esma->cursor_row); break; - case ARG_CURSOR_COL: - GTK_VALUE_INT(*arg) = esma->cursor_col; + case PROP_CURSOR_COL: + g_value_set_int (value, esma->cursor_col); break; } } static void -esma_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) +esma_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - ESelectionModel *esm = E_SELECTION_MODEL (o); - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY (o); + ESelectionModel *esm = E_SELECTION_MODEL (object); + ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY (object); - switch (arg_id){ - case ARG_CURSOR_ROW: - e_selection_model_do_something(esm, GTK_VALUE_INT(*arg), esma->cursor_col, 0); + switch (prop_id){ + case PROP_CURSOR_ROW: + e_selection_model_do_something(esm, g_value_get_int (value), esma->cursor_col, 0); break; - case ARG_CURSOR_COL: - e_selection_model_do_something(esm, esma->cursor_row, GTK_VALUE_INT(*arg), 0); + case PROP_CURSOR_COL: + e_selection_model_do_something(esm, esma->cursor_row, g_value_get_int(value), 0); break; } } @@ -485,8 +484,8 @@ e_selection_model_array_get_row_count (ESelectionModelArray *esma) g_return_val_if_fail(esma != NULL, 0); g_return_val_if_fail(E_IS_SELECTION_MODEL_ARRAY(esma), 0); - if (ESMA_CLASS(esma)->get_row_count) - return ESMA_CLASS(esma)->get_row_count (esma); + if (E_SELECTION_MODEL_ARRAY_GET_CLASS(esma)->get_row_count) + return E_SELECTION_MODEL_ARRAY_GET_CLASS(esma)->get_row_count (esma); else return 0; } @@ -507,17 +506,17 @@ e_selection_model_array_init (ESelectionModelArray *esma) static void e_selection_model_array_class_init (ESelectionModelArrayClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class; ESelectionModelClass *esm_class; - parent_class = gtk_type_class (e_selection_model_get_type ()); + parent_class = g_type_class_ref (PARENT_TYPE); - object_class = GTK_OBJECT_CLASS(klass); + object_class = G_OBJECT_CLASS(klass); esm_class = E_SELECTION_MODEL_CLASS(klass); - object_class->destroy = esma_destroy; - object_class->get_arg = esma_get_arg; - object_class->set_arg = esma_set_arg; + object_class->dispose = esma_dispose; + object_class->get_property = esma_get_property; + object_class->set_property = esma_set_property; esm_class->is_row_selected = esma_is_row_selected ; esm_class->foreach = esma_foreach ; @@ -539,10 +538,19 @@ e_selection_model_array_class_init (ESelectionModelArrayClass *klass) klass->get_row_count = NULL ; - gtk_object_add_arg_type ("ESelectionModelArray::cursor_row", GTK_TYPE_INT, - GTK_ARG_READWRITE, ARG_CURSOR_ROW); - gtk_object_add_arg_type ("ESelectionModelArray::cursor_col", GTK_TYPE_INT, - GTK_ARG_READWRITE, ARG_CURSOR_COL); + g_object_class_install_property (object_class, PROP_CURSOR_ROW, + g_param_spec_int ("cursor_row", + _("Cursor Row"), + /*_( */"XXX blurb" /*)*/, + 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"), + /*_( */"XXX blurb" /*)*/, + 0, G_MAXINT, 0, + G_PARAM_READWRITE)); } E_MAKE_TYPE(e_selection_model_array, "ESelectionModelArray", ESelectionModelArray, diff --git a/widgets/misc/e-selection-model-array.h b/widgets/misc/e-selection-model-array.h index 805f331e88..a533030f92 100644 --- a/widgets/misc/e-selection-model-array.h +++ b/widgets/misc/e-selection-model-array.h @@ -33,10 +33,11 @@ extern "C" { #endif /* __cplusplus */ #define E_SELECTION_MODEL_ARRAY_TYPE (e_selection_model_array_get_type ()) -#define E_SELECTION_MODEL_ARRAY(o) (GTK_CHECK_CAST ((o), E_SELECTION_MODEL_ARRAY_TYPE, ESelectionModelArray)) -#define E_SELECTION_MODEL_ARRAY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_ARRAY_TYPE, ESelectionModelArrayClass)) -#define E_IS_SELECTION_MODEL_ARRAY(o) (GTK_CHECK_TYPE ((o), E_SELECTION_MODEL_ARRAY_TYPE)) -#define E_IS_SELECTION_MODEL_ARRAY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_ARRAY_TYPE)) +#define E_SELECTION_MODEL_ARRAY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_SELECTION_MODEL_ARRAY_TYPE, ESelectionModelArray)) +#define E_SELECTION_MODEL_ARRAY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_ARRAY_TYPE, ESelectionModelArrayClass)) +#define E_IS_SELECTION_MODEL_ARRAY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_SELECTION_MODEL_ARRAY_TYPE)) +#define E_IS_SELECTION_MODEL_ARRAY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_ARRAY_TYPE)) +#define E_SELECTION_MODEL_ARRAY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_SELECTION_MODEL_ARRAY_TYPE, ESelectionModelArrayClass)) typedef struct { ESelectionModel base; @@ -70,7 +71,7 @@ typedef struct { gint (*get_row_count) (ESelectionModelArray *selection); } ESelectionModelArrayClass; -GtkType e_selection_model_array_get_type (void); +GType e_selection_model_array_get_type (void); /* Protected Functions */ void e_selection_model_array_insert_rows (ESelectionModelArray *esm, diff --git a/widgets/misc/e-selection-model-simple.c b/widgets/misc/e-selection-model-simple.c index cd9a720e5c..da232d9f8c 100644 --- a/widgets/misc/e-selection-model-simple.c +++ b/widgets/misc/e-selection-model-simple.c @@ -26,8 +26,6 @@ #include "e-selection-model-array.h" #include "e-selection-model-simple.h" -#define ESMS_CLASS(e) ((ESelectionModelSimpleClass *)((GtkObject *)e)->klass) - #define PARENT_TYPE e_selection_model_array_get_type () static ESelectionModelArray *parent_class; @@ -45,7 +43,7 @@ e_selection_model_simple_class_init (ESelectionModelSimpleClass *klass) { ESelectionModelArrayClass *esma_class; - parent_class = gtk_type_class (PARENT_TYPE); + parent_class = g_type_class_ref (PARENT_TYPE); esma_class = E_SELECTION_MODEL_ARRAY_CLASS(klass); @@ -65,7 +63,7 @@ E_MAKE_TYPE(e_selection_model_simple, "ESelectionModelSimple", ESelectionModelSi ESelectionModelSimple * e_selection_model_simple_new (void) { - return gtk_type_new (e_selection_model_simple_get_type ()); + return g_object_new (E_SELECTION_MODEL_SIMPLE_TYPE, NULL); } void diff --git a/widgets/misc/e-selection-model-simple.h b/widgets/misc/e-selection-model-simple.h index 5a19685827..6b4f84b4f9 100644 --- a/widgets/misc/e-selection-model-simple.h +++ b/widgets/misc/e-selection-model-simple.h @@ -31,10 +31,10 @@ extern "C" { #endif /* __cplusplus */ #define E_SELECTION_MODEL_SIMPLE_TYPE (e_selection_model_simple_get_type ()) -#define E_SELECTION_MODEL_SIMPLE(o) (GTK_CHECK_CAST ((o), E_SELECTION_MODEL_SIMPLE_TYPE, ESelectionModelSimple)) -#define E_SELECTION_MODEL_SIMPLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_SIMPLE_TYPE, ESelectionModelSimpleClass)) -#define E_IS_SELECTION_MODEL_SIMPLE(o) (GTK_CHECK_TYPE ((o), E_SELECTION_MODEL_SIMPLE_TYPE)) -#define E_IS_SELECTION_MODEL_SIMPLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_SIMPLE_TYPE)) +#define E_SELECTION_MODEL_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_SELECTION_MODEL_SIMPLE_TYPE, ESelectionModelSimple)) +#define E_SELECTION_MODEL_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_SIMPLE_TYPE, ESelectionModelSimpleClass)) +#define E_IS_SELECTION_MODEL_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_SELECTION_MODEL_SIMPLE_TYPE)) +#define E_IS_SELECTION_MODEL_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_SIMPLE_TYPE)) typedef struct { ESelectionModelArray parent; @@ -46,7 +46,7 @@ typedef struct { ESelectionModelArrayClass parent_class; } ESelectionModelSimpleClass; -GtkType e_selection_model_simple_get_type (void); +GType e_selection_model_simple_get_type (void); ESelectionModelSimple *e_selection_model_simple_new (void); void e_selection_model_simple_insert_rows (ESelectionModelSimple *esms, diff --git a/widgets/misc/e-selection-model.c b/widgets/misc/e-selection-model.c index 60df46d2da..991fc78490 100644 --- a/widgets/misc/e-selection-model.c +++ b/widgets/misc/e-selection-model.c @@ -23,15 +23,13 @@ #include <config.h> #include <gdk/gdkkeysyms.h> -#include <gtk/gtksignal.h> #include "e-selection-model.h" +#include "gal/util/e-i18n.h" #include "gal/util/e-util.h" -#define ESM_CLASS(e) ((ESelectionModelClass *)(GTK_OBJECT_GET_CLASS (e))) +#define PARENT_TYPE G_TYPE_OBJECT -#define PARENT_TYPE gtk_object_get_type () - -static GtkObjectClass *e_selection_model_parent_class; +static GObjectClass *e_selection_model_parent_class; enum { CURSOR_CHANGED, @@ -44,10 +42,10 @@ enum { static guint e_selection_model_signals [LAST_SIGNAL] = { 0, }; enum { - ARG_0, - ARG_SORTER, - ARG_SELECTION_MODE, - ARG_CURSOR_MODE + PROP_0, + PROP_SORTER, + PROP_SELECTION_MODE, + PROP_CURSOR_MODE }; inline static void @@ -69,7 +67,7 @@ drop_sorter(ESelectionModel *esm) } static void -esm_destroy (GtkObject *object) +esm_dispose (GObject *object) { ESelectionModel *esm; @@ -77,43 +75,43 @@ esm_destroy (GtkObject *object) drop_sorter(esm); - if (e_selection_model_parent_class->destroy) - (* e_selection_model_parent_class->destroy) (object); + if (e_selection_model_parent_class->dispose) + (* e_selection_model_parent_class->dispose) (object); } static void -esm_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) +esm_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - ESelectionModel *esm = E_SELECTION_MODEL (o); + ESelectionModel *esm = E_SELECTION_MODEL (object); - switch (arg_id){ - case ARG_SORTER: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(esm->sorter); + switch (prop_id){ + case PROP_SORTER: + g_value_set_object (value, esm->sorter); break; - case ARG_SELECTION_MODE: - GTK_VALUE_INT(*arg) = esm->mode; + case PROP_SELECTION_MODE: + g_value_set_int (value, esm->mode); break; - case ARG_CURSOR_MODE: - GTK_VALUE_INT(*arg) = esm->cursor_mode; + case PROP_CURSOR_MODE: + g_value_set_int (value, esm->cursor_mode); break; } } static void -esm_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) +esm_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - ESelectionModel *esm = E_SELECTION_MODEL (o); + ESelectionModel *esm = E_SELECTION_MODEL (object); - switch (arg_id){ - case ARG_SORTER: + switch (prop_id){ + case PROP_SORTER: drop_sorter(esm); - add_sorter(esm, GTK_VALUE_OBJECT (*arg) ? E_SORTER(GTK_VALUE_OBJECT (*arg)) : NULL); + add_sorter(esm, g_value_get_object (value) ? E_SORTER(g_value_get_object(value)) : NULL); break; - case ARG_SELECTION_MODE: - esm->mode = GTK_VALUE_INT(*arg); + case PROP_SELECTION_MODE: + esm->mode = g_value_get_int (value); if (esm->mode == GTK_SELECTION_SINGLE) { int cursor_row = e_selection_model_cursor_row(esm); int cursor_col = e_selection_model_cursor_col(esm); @@ -121,8 +119,8 @@ esm_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) } break; - case ARG_CURSOR_MODE: - esm->cursor_mode = GTK_VALUE_INT(*arg); + case PROP_CURSOR_MODE: + esm->cursor_mode = g_value_get_int (value); break; } } @@ -138,47 +136,51 @@ e_selection_model_init (ESelectionModel *selection) static void e_selection_model_class_init (ESelectionModelClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class; - e_selection_model_parent_class = gtk_type_class (gtk_object_get_type ()); + e_selection_model_parent_class = g_type_class_ref (PARENT_TYPE); - object_class = GTK_OBJECT_CLASS(klass); + object_class = G_OBJECT_CLASS(klass); - object_class->destroy = esm_destroy; - object_class->get_arg = esm_get_arg; - object_class->set_arg = esm_set_arg; + object_class->dispose = esm_dispose; + object_class->get_property = esm_get_property; + object_class->set_property = esm_set_property; e_selection_model_signals [CURSOR_CHANGED] = - gtk_signal_new ("cursor_changed", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (ESelectionModelClass, cursor_changed), - gtk_marshal_NONE__INT_INT, - GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT); + g_signal_new ("cursor_changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ESelectionModelClass, cursor_changed), + NULL, NULL, + e_marshal_NONE__INT_INT, + G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); e_selection_model_signals [CURSOR_ACTIVATED] = - gtk_signal_new ("cursor_activated", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (ESelectionModelClass, cursor_activated), - gtk_marshal_NONE__INT_INT, - GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT); + g_signal_new ("cursor_activated", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ESelectionModelClass, cursor_activated), + NULL, NULL, + e_marshal_NONE__INT_INT, + G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); e_selection_model_signals [SELECTION_CHANGED] = - gtk_signal_new ("selection_changed", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (ESelectionModelClass, selection_changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); + g_signal_new ("selection_changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ESelectionModelClass, selection_changed), + NULL, NULL, + e_marshal_NONE__NONE, + G_TYPE_NONE, 0); e_selection_model_signals [SELECTION_ROW_CHANGED] = - gtk_signal_new ("selection_row_changed", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (ESelectionModelClass, selection_row_changed), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, GTK_TYPE_INT); + g_signal_new ("selection_row_changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ESelectionModelClass, selection_row_changed), + NULL, NULL, + e_marshal_NONE__INT, + G_TYPE_NONE, 1, G_TYPE_INT); klass->cursor_changed = NULL; klass->cursor_activated = NULL; @@ -203,14 +205,28 @@ e_selection_model_class_init (ESelectionModelClass *klass) klass->move_selection_end = NULL; klass->set_selection_end = NULL; - E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_selection_model_signals, LAST_SIGNAL); - - gtk_object_add_arg_type ("ESelectionModel::sorter", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_SORTER); - gtk_object_add_arg_type ("ESelectionModel::selection_mode", GTK_TYPE_INT, - GTK_ARG_READWRITE, ARG_SELECTION_MODE); - gtk_object_add_arg_type ("ESelectionModel::cursor_mode", GTK_TYPE_INT, - GTK_ARG_READWRITE, ARG_CURSOR_MODE); + g_object_class_install_property (object_class, PROP_SORTER, + g_param_spec_object ("sorter", + _("Sorter"), + /*_( */"XXX blurb" /*)*/, + E_SORTER_TYPE, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, PROP_SELECTION_MODE, + g_param_spec_int ("selection_mode", + _("Selection Mode"), + /*_( */"XXX blurb" /*)*/, + GTK_SELECTION_NONE, GTK_SELECTION_MULTIPLE, + GTK_SELECTION_SINGLE, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, PROP_CURSOR_MODE, + g_param_spec_int ("cursor_mode", + _("Cursor Mode"), + /*_( */"XXX blurb" /*)*/, + E_CURSOR_LINE, E_CURSOR_SPREADSHEET, + E_CURSOR_LINE, + G_PARAM_READWRITE)); } E_MAKE_TYPE(e_selection_model, "ESelectionModel", ESelectionModel, @@ -229,8 +245,8 @@ gboolean e_selection_model_is_row_selected (ESelectionModel *selection, gint n) { - if (ESM_CLASS(selection)->is_row_selected) - return ESM_CLASS(selection)->is_row_selected (selection, n); + if (E_SELECTION_MODEL_GET_CLASS(selection)->is_row_selected) + return E_SELECTION_MODEL_GET_CLASS(selection)->is_row_selected (selection, n); else return FALSE; } @@ -249,8 +265,8 @@ e_selection_model_foreach (ESelectionModel *selection, EForeachFunc callback, gpointer closure) { - if (ESM_CLASS(selection)->foreach) - ESM_CLASS(selection)->foreach (selection, callback, closure); + if (E_SELECTION_MODEL_GET_CLASS(selection)->foreach) + E_SELECTION_MODEL_GET_CLASS(selection)->foreach (selection, callback, closure); } /** @@ -262,8 +278,8 @@ e_selection_model_foreach (ESelectionModel *selection, void e_selection_model_clear(ESelectionModel *selection) { - if (ESM_CLASS(selection)->clear) - ESM_CLASS(selection)->clear (selection); + if (E_SELECTION_MODEL_GET_CLASS(selection)->clear) + E_SELECTION_MODEL_GET_CLASS(selection)->clear (selection); } /** @@ -277,8 +293,8 @@ e_selection_model_clear(ESelectionModel *selection) gint e_selection_model_selected_count (ESelectionModel *selection) { - if (ESM_CLASS(selection)->selected_count) - return ESM_CLASS(selection)->selected_count (selection); + if (E_SELECTION_MODEL_GET_CLASS(selection)->selected_count) + return E_SELECTION_MODEL_GET_CLASS(selection)->selected_count (selection); else return 0; } @@ -293,8 +309,8 @@ e_selection_model_selected_count (ESelectionModel *selection) void e_selection_model_select_all (ESelectionModel *selection) { - if (ESM_CLASS(selection)->select_all) - ESM_CLASS(selection)->select_all (selection); + if (E_SELECTION_MODEL_GET_CLASS(selection)->select_all) + E_SELECTION_MODEL_GET_CLASS(selection)->select_all (selection); } /** @@ -307,15 +323,15 @@ e_selection_model_select_all (ESelectionModel *selection) void e_selection_model_invert_selection (ESelectionModel *selection) { - if (ESM_CLASS(selection)->invert_selection) - ESM_CLASS(selection)->invert_selection (selection); + if (E_SELECTION_MODEL_GET_CLASS(selection)->invert_selection) + E_SELECTION_MODEL_GET_CLASS(selection)->invert_selection (selection); } int e_selection_model_row_count (ESelectionModel *selection) { - if (ESM_CLASS(selection)->row_count) - return ESM_CLASS(selection)->row_count (selection); + if (E_SELECTION_MODEL_GET_CLASS(selection)->row_count) + return E_SELECTION_MODEL_GET_CLASS(selection)->row_count (selection); else return 0; } @@ -323,22 +339,22 @@ e_selection_model_row_count (ESelectionModel *selection) void e_selection_model_change_one_row(ESelectionModel *selection, int row, gboolean grow) { - if (ESM_CLASS(selection)->change_one_row) - ESM_CLASS(selection)->change_one_row (selection, row, grow); + if (E_SELECTION_MODEL_GET_CLASS(selection)->change_one_row) + E_SELECTION_MODEL_GET_CLASS(selection)->change_one_row (selection, row, grow); } void e_selection_model_change_cursor (ESelectionModel *selection, int row, int col) { - if (ESM_CLASS(selection)->change_cursor) - ESM_CLASS(selection)->change_cursor (selection, row, col); + if (E_SELECTION_MODEL_GET_CLASS(selection)->change_cursor) + E_SELECTION_MODEL_GET_CLASS(selection)->change_cursor (selection, row, col); } int e_selection_model_cursor_row (ESelectionModel *selection) { - if (ESM_CLASS(selection)->cursor_row) - return ESM_CLASS(selection)->cursor_row (selection); + if (E_SELECTION_MODEL_GET_CLASS(selection)->cursor_row) + return E_SELECTION_MODEL_GET_CLASS(selection)->cursor_row (selection); else return -1; } @@ -346,8 +362,8 @@ e_selection_model_cursor_row (ESelectionModel *selection) int e_selection_model_cursor_col (ESelectionModel *selection) { - if (ESM_CLASS(selection)->cursor_col) - return ESM_CLASS(selection)->cursor_col (selection); + if (E_SELECTION_MODEL_GET_CLASS(selection)->cursor_col) + return E_SELECTION_MODEL_GET_CLASS(selection)->cursor_col (selection); else return -1; } @@ -355,29 +371,29 @@ e_selection_model_cursor_col (ESelectionModel *selection) void e_selection_model_select_single_row (ESelectionModel *selection, int row) { - if (ESM_CLASS(selection)->select_single_row) - ESM_CLASS(selection)->select_single_row (selection, row); + if (E_SELECTION_MODEL_GET_CLASS(selection)->select_single_row) + E_SELECTION_MODEL_GET_CLASS(selection)->select_single_row (selection, row); } void e_selection_model_toggle_single_row (ESelectionModel *selection, int row) { - if (ESM_CLASS(selection)->toggle_single_row) - ESM_CLASS(selection)->toggle_single_row (selection, row); + if (E_SELECTION_MODEL_GET_CLASS(selection)->toggle_single_row) + E_SELECTION_MODEL_GET_CLASS(selection)->toggle_single_row (selection, row); } void e_selection_model_move_selection_end (ESelectionModel *selection, int row) { - if (ESM_CLASS(selection)->move_selection_end) - ESM_CLASS(selection)->move_selection_end (selection, row); + if (E_SELECTION_MODEL_GET_CLASS(selection)->move_selection_end) + E_SELECTION_MODEL_GET_CLASS(selection)->move_selection_end (selection, row); } void e_selection_model_set_selection_end (ESelectionModel *selection, int row) { - if (ESM_CLASS(selection)->set_selection_end) - ESM_CLASS(selection)->set_selection_end (selection, row); + if (E_SELECTION_MODEL_GET_CLASS(selection)->set_selection_end) + E_SELECTION_MODEL_GET_CLASS(selection)->set_selection_end (selection, row); } /** @@ -430,10 +446,12 @@ e_selection_model_do_something (ESelectionModel *selection, break; } e_selection_model_change_cursor(selection, row, col); - gtk_signal_emit(GTK_OBJECT(selection), - e_selection_model_signals[CURSOR_CHANGED], row, col); - gtk_signal_emit(GTK_OBJECT(selection), - e_selection_model_signals[CURSOR_ACTIVATED], row, col); + g_signal_emit(selection, + e_selection_model_signals[CURSOR_CHANGED], 0, + row, col); + g_signal_emit(selection, + e_selection_model_signals[CURSOR_ACTIVATED], 0, + row, col); } } @@ -460,8 +478,9 @@ e_selection_model_maybe_do_something (ESelectionModel *selection, if (e_selection_model_is_row_selected(selection, row)) { e_selection_model_change_cursor(selection, row, col); - gtk_signal_emit(GTK_OBJECT(selection), - e_selection_model_signals[CURSOR_CHANGED], row, col); + g_signal_emit(selection, + e_selection_model_signals[CURSOR_CHANGED], 0, + row, col); return FALSE; } else { e_selection_model_do_something(selection, row, col, state); @@ -523,11 +542,13 @@ e_selection_model_select_as_key_press (ESelectionModel *selection, } if (row != -1) { e_selection_model_change_cursor(selection, row, col); - gtk_signal_emit(GTK_OBJECT(selection), - e_selection_model_signals[CURSOR_CHANGED], row, col); + g_signal_emit(selection, + e_selection_model_signals[CURSOR_CHANGED], 0, + row, col); if (cursor_activated) - gtk_signal_emit(GTK_OBJECT(selection), - e_selection_model_signals[CURSOR_ACTIVATED], row, col); + g_signal_emit(selection, + e_selection_model_signals[CURSOR_ACTIVATED], 0, + row, col); } } @@ -587,8 +608,9 @@ e_selection_model_key_press (ESelectionModel *selection, int row = e_selection_model_cursor_row(selection); int col = e_selection_model_cursor_col(selection); e_selection_model_toggle_single_row (selection, row); - gtk_signal_emit(GTK_OBJECT(selection), - e_selection_model_signals[CURSOR_ACTIVATED], row, col); + g_signal_emit(selection, + e_selection_model_signals[CURSOR_ACTIVATED], 0, + row, col); return TRUE; } break; @@ -598,8 +620,9 @@ e_selection_model_key_press (ESelectionModel *selection, int row = e_selection_model_cursor_row(selection); int col = e_selection_model_cursor_col(selection); e_selection_model_select_single_row (selection, row); - gtk_signal_emit(GTK_OBJECT(selection), - e_selection_model_signals[CURSOR_ACTIVATED], row, col); + g_signal_emit(selection, + e_selection_model_signals[CURSOR_ACTIVATED], 0, + row, col); return TRUE; } break; @@ -634,8 +657,9 @@ e_selection_model_cursor_changed (ESelectionModel *selection, int row, int col) { - gtk_signal_emit(GTK_OBJECT(selection), - e_selection_model_signals[CURSOR_CHANGED], row, col); + g_signal_emit(selection, + e_selection_model_signals[CURSOR_CHANGED], 0, + row, col); } void @@ -643,22 +667,23 @@ e_selection_model_cursor_activated (ESelectionModel *selection, int row, int col) { - gtk_signal_emit(GTK_OBJECT(selection), - e_selection_model_signals[CURSOR_ACTIVATED], row, col); + g_signal_emit(selection, + e_selection_model_signals[CURSOR_ACTIVATED], 0, + row, col); } void e_selection_model_selection_changed (ESelectionModel *selection) { - gtk_signal_emit(GTK_OBJECT(selection), - e_selection_model_signals[SELECTION_CHANGED]); + g_signal_emit(selection, + e_selection_model_signals[SELECTION_CHANGED], 0); } void e_selection_model_selection_row_changed (ESelectionModel *selection, int row) { - gtk_signal_emit(GTK_OBJECT(selection), - e_selection_model_signals[SELECTION_ROW_CHANGED], - row); + g_signal_emit(selection, + e_selection_model_signals[SELECTION_ROW_CHANGED], 0, + row); } diff --git a/widgets/misc/e-selection-model.h b/widgets/misc/e-selection-model.h index 0326aa60e5..a78bdfd9c3 100644 --- a/widgets/misc/e-selection-model.h +++ b/widgets/misc/e-selection-model.h @@ -32,11 +32,12 @@ extern "C" { #endif /* __cplusplus */ -#define E_SELECTION_MODEL_TYPE (e_selection_model_get_type ()) -#define E_SELECTION_MODEL(o) (GTK_CHECK_CAST ((o), E_SELECTION_MODEL_TYPE, ESelectionModel)) -#define E_SELECTION_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_TYPE, ESelectionModelClass)) -#define E_IS_SELECTION_MODEL(o) (GTK_CHECK_TYPE ((o), E_SELECTION_MODEL_TYPE)) -#define E_IS_SELECTION_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_TYPE)) +#define E_SELECTION_MODEL_TYPE (e_selection_model_get_type ()) +#define E_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_SELECTION_MODEL_TYPE, ESelectionModel)) +#define E_SELECTION_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_TYPE, ESelectionModelClass)) +#define E_IS_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_SELECTION_MODEL_TYPE)) +#define E_IS_SELECTION_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_TYPE)) +#define E_SELECTION_MODEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_SELECTION_MODEL_TYPE, ESelectionModelClass)) #ifndef _E_FOREACH_FUNC_H_ #define _E_FOREACH_FUNC_H_ @@ -52,7 +53,7 @@ typedef enum { } ECursorMode; typedef struct { - GtkObject base; + GObject base; ESorter *sorter; @@ -63,7 +64,7 @@ typedef struct { } ESelectionModel; typedef struct { - GtkObjectClass parent_class; + GObjectClass parent_class; /* Virtual methods */ gboolean (*is_row_selected) (ESelectionModel *esm, int row); @@ -97,7 +98,7 @@ typedef struct { } ESelectionModelClass; -GtkType e_selection_model_get_type (void); +GType e_selection_model_get_type (void); void e_selection_model_do_something (ESelectionModel *esm, guint row, guint col, |