diff options
author | Chris Toshok <toshok@ximian.com> | 2002-11-15 10:22:00 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2002-11-15 10:22:00 +0800 |
commit | b9b2089527b62590f70625208d7d68579a51124d (patch) | |
tree | 3a38bcfda28e8f488c0d404ea009767092077534 | |
parent | 555aa35da24b6977073379c71f1bbb27ac36d86c (diff) | |
download | gsoc2013-evolution-b9b2089527b62590f70625208d7d68579a51124d.tar gsoc2013-evolution-b9b2089527b62590f70625208d7d68579a51124d.tar.gz gsoc2013-evolution-b9b2089527b62590f70625208d7d68579a51124d.tar.bz2 gsoc2013-evolution-b9b2089527b62590f70625208d7d68579a51124d.tar.lz gsoc2013-evolution-b9b2089527b62590f70625208d7d68579a51124d.tar.xz gsoc2013-evolution-b9b2089527b62590f70625208d7d68579a51124d.tar.zst gsoc2013-evolution-b9b2089527b62590f70625208d7d68579a51124d.zip |
deal with ESelectionModel no longer deriving from GtkObject.
2002-11-14 Chris Toshok <toshok@ximian.com>
* e-table-item.c: deal with ESelectionModel no longer deriving
from GtkObject.
* e-table.c: same.
* e-tree.c: same.
* e-table-config.c (do_fields_config_dialog): use GtkDialog's
reponse instead of GnomeDialog's button.
* e-table-click-to-add.[ch]: GObjectify this.
* e-table-selection-model.[ch]: this derives from GObject now.
* e-tree-selection-model.[ch]: same.
svn path=/trunk/; revision=18773
-rw-r--r-- | widgets/table/e-table-click-to-add.c | 230 | ||||
-rw-r--r-- | widgets/table/e-table-click-to-add.h | 10 | ||||
-rw-r--r-- | widgets/table/e-table-config.c | 13 | ||||
-rw-r--r-- | widgets/table/e-table-item.c | 182 | ||||
-rw-r--r-- | widgets/table/e-table-selection-model.c | 83 | ||||
-rw-r--r-- | widgets/table/e-table-selection-model.h | 10 | ||||
-rw-r--r-- | widgets/table/e-table.c | 54 | ||||
-rw-r--r-- | widgets/table/e-tree-selection-model.c | 133 | ||||
-rw-r--r-- | widgets/table/e-tree-selection-model.h | 10 | ||||
-rw-r--r-- | widgets/table/e-tree.c | 28 |
10 files changed, 394 insertions, 359 deletions
diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c index 7630e62bb7..4f423c0af4 100644 --- a/widgets/table/e-table-click-to-add.c +++ b/widgets/table/e-table-click-to-add.c @@ -37,6 +37,8 @@ #include "gal/widgets/e-canvas.h" #include "gal/widgets/e-canvas-utils.h" #include "gal/util/e-util.h" +#include "gal/util/e-i18n.h" +#include "gal/util/e-marshal.h" enum { CURSOR_CHANGE, @@ -52,20 +54,20 @@ static guint etcta_signals [LAST_SIGNAL] = { 0 }; static GnomeCanvasGroupClass *etcta_parent_class; enum { - ARG_0, - ARG_HEADER, - ARG_MODEL, - ARG_MESSAGE, - ARG_WIDTH, - ARG_HEIGHT + PROP_0, + PROP_HEADER, + PROP_MODEL, + PROP_MESSAGE, + PROP_WIDTH, + PROP_HEIGHT }; static void etcta_cursor_change (GtkObject *object, gint row, gint col, ETableClickToAdd *etcta) { - gtk_signal_emit (GTK_OBJECT (etcta), - etcta_signals [CURSOR_CHANGE], - row, col); + g_signal_emit (etcta, + etcta_signals [CURSOR_CHANGE], 0, + row, col); } static void @@ -83,14 +85,10 @@ etcta_add_table_header (ETableClickToAdd *etcta, ETableHeader *header) static void etcta_drop_table_header (ETableClickToAdd *etcta) { - GtkObject *header; - if (!etcta->eth) return; - header = GTK_OBJECT (etcta->eth); - - g_object_unref (header); + g_object_unref (etcta->eth); etcta->eth = NULL; } @@ -104,9 +102,9 @@ etcta_add_one (ETableClickToAdd *etcta, ETableModel *one) gnome_canvas_item_set(GNOME_CANVAS_ITEM(etcta->row), "ETableModel", one, NULL); - gtk_object_set(GTK_OBJECT(etcta->selection), - "model", one, - NULL); + g_object_set(etcta->selection, + "model", one, + NULL); } static void @@ -116,9 +114,9 @@ etcta_drop_one (ETableClickToAdd *etcta) return; g_object_unref (etcta->one); etcta->one = NULL; - gtk_object_set(GTK_OBJECT(etcta->selection), - "model", NULL, - NULL); + g_object_set(etcta->selection, + "model", NULL, + NULL); } static void @@ -154,7 +152,7 @@ etcta_drop_message (ETableClickToAdd *etcta) static void -etcta_destroy (GtkObject *object) +etcta_dispose (GObject *object) { ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (object); @@ -165,34 +163,34 @@ etcta_destroy (GtkObject *object) g_object_unref (etcta->selection); etcta->selection = NULL; - if (GTK_OBJECT_CLASS (etcta_parent_class)->destroy) - (*GTK_OBJECT_CLASS (etcta_parent_class)->destroy) (object); + if (G_OBJECT_CLASS (etcta_parent_class)->dispose) + (*G_OBJECT_CLASS (etcta_parent_class)->dispose) (object); } static void -etcta_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) +etcta_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GnomeCanvasItem *item; ETableClickToAdd *etcta; - item = GNOME_CANVAS_ITEM (o); - etcta = E_TABLE_CLICK_TO_ADD (o); + item = GNOME_CANVAS_ITEM (object); + etcta = E_TABLE_CLICK_TO_ADD (object); - switch (arg_id){ - case ARG_HEADER: + switch (prop_id){ + case PROP_HEADER: etcta_drop_table_header (etcta); - etcta_add_table_header (etcta, E_TABLE_HEADER(GTK_VALUE_OBJECT (*arg))); + etcta_add_table_header (etcta, E_TABLE_HEADER(g_value_get_object (value))); break; - case ARG_MODEL: + case PROP_MODEL: etcta_drop_model (etcta); - etcta_add_model (etcta, E_TABLE_MODEL(GTK_VALUE_OBJECT (*arg))); + etcta_add_model (etcta, E_TABLE_MODEL(g_value_get_object (value))); break; - case ARG_MESSAGE: + case PROP_MESSAGE: etcta_drop_message (etcta); - etcta_add_message (etcta, GTK_VALUE_STRING (*arg)); + etcta_add_message (etcta, (char*)g_value_get_string (value)); break; - case ARG_WIDTH: - etcta->width = GTK_VALUE_DOUBLE (*arg); + case PROP_WIDTH: + etcta->width = g_value_get_double (value); if (etcta->row) gnome_canvas_item_set(etcta->row, "minimum_width", etcta->width, @@ -206,35 +204,39 @@ etcta_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) "x2", etcta->width - 1, NULL); break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + return; + } gnome_canvas_item_request_update(item); } static void -etcta_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) +etcta_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { ETableClickToAdd *etcta; - etcta = E_TABLE_CLICK_TO_ADD (o); + etcta = E_TABLE_CLICK_TO_ADD (object); - switch (arg_id){ - case ARG_HEADER: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etcta->eth); + switch (prop_id){ + case PROP_HEADER: + g_value_set_object (value, etcta->eth); break; - case ARG_MODEL: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etcta->model); + case PROP_MODEL: + g_value_set_object (value, etcta->model); break; - case ARG_MESSAGE: - GTK_VALUE_STRING (*arg) = g_strdup(etcta->message); + case PROP_MESSAGE: + g_value_set_string (value, g_strdup(etcta->message)); break; - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = etcta->width; + case PROP_WIDTH: + g_value_set_double (value, etcta->width); break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = etcta->height; + case PROP_HEIGHT: + g_value_set_double (value, etcta->height); break; default: - arg->type = GTK_TYPE_INVALID; + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } @@ -307,7 +309,7 @@ finish_editing (ETableClickToAdd *etcta) e_table_item_leave_edit (E_TABLE_ITEM (etcta->row)); e_table_one_commit(E_TABLE_ONE(etcta->one)); etcta_drop_one (etcta); - gtk_object_destroy(GTK_OBJECT(etcta->row)); + g_object_unref(etcta->row); etcta->row = NULL; one = e_table_one_new(etcta->model); @@ -327,8 +329,8 @@ finish_editing (ETableClickToAdd *etcta) "cursor_mode", E_CURSOR_SPREADSHEET, NULL); - gtk_signal_connect(GTK_OBJECT(etcta->row), "key_press", - GTK_SIGNAL_FUNC(item_key_press), etcta); + g_signal_connect(etcta->row, "key_press", + G_CALLBACK(item_key_press), etcta); set_initial_selection (etcta); } @@ -345,11 +347,11 @@ etcta_event (GnomeCanvasItem *item, GdkEvent *e) switch (e->type){ case GDK_BUTTON_PRESS: if (etcta->text) { - gtk_object_destroy(GTK_OBJECT(etcta->text)); + g_object_unref(etcta->text); etcta->text = NULL; } if (etcta->rect) { - gtk_object_destroy(GTK_OBJECT(etcta->rect)); + g_object_unref(etcta->rect); etcta->rect = NULL; } if (!etcta->row) { @@ -372,8 +374,8 @@ etcta_event (GnomeCanvasItem *item, GdkEvent *e) "cursor_mode", E_CURSOR_SPREADSHEET, NULL); - gtk_signal_connect(GTK_OBJECT(etcta->row), "key_press", - GTK_SIGNAL_FUNC(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); @@ -408,21 +410,21 @@ etcta_reflow (GnomeCanvasItem *item, int flags) double old_height = etcta->height; if (etcta->text) { - gtk_object_get(GTK_OBJECT(etcta->text), - "height", &etcta->height, - NULL); + g_object_get(etcta->text, + "height", &etcta->height, + NULL); etcta->height += 6; } if (etcta->row) { - gtk_object_get(GTK_OBJECT(etcta->row), - "height", &etcta->height, - NULL); + g_object_get(etcta->row, + "height", &etcta->height, + NULL); } if (etcta->rect) { - gtk_object_set(GTK_OBJECT(etcta->rect), - "y2", etcta->height - 1, - NULL); + g_object_set(etcta->rect, + "y2", etcta->height - 1, + NULL); } if (old_height != etcta->height) e_canvas_item_request_parent_reflow(item); @@ -432,40 +434,63 @@ static void etcta_class_init (ETableClickToAddClass *klass) { GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS(klass); - GtkObjectClass *object_class = GTK_OBJECT_CLASS(klass); + GObjectClass *object_class = G_OBJECT_CLASS(klass); - etcta_parent_class = gtk_type_class (PARENT_OBJECT_TYPE); + etcta_parent_class = g_type_class_ref (PARENT_OBJECT_TYPE); klass->cursor_change = NULL; - object_class->destroy = etcta_destroy; - object_class->set_arg = etcta_set_arg; - object_class->get_arg = etcta_get_arg; + object_class->dispose = etcta_dispose; + object_class->set_property = etcta_set_property; + object_class->get_property = etcta_get_property; item_class->realize = etcta_realize; item_class->unrealize = etcta_unrealize; item_class->event = etcta_event; - gtk_object_add_arg_type ("ETableClickToAdd::header", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_HEADER); - gtk_object_add_arg_type ("ETableClickToAdd::model", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_MODEL); - gtk_object_add_arg_type ("ETableClickToAdd::message", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_MESSAGE); - gtk_object_add_arg_type ("ETableClickToAdd::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("ETableClickToAdd::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); + g_object_class_install_property (object_class, PROP_HEADER, + g_param_spec_object ("header", + _("Header"), + /*_( */"XXX blurb" /*)*/, + E_TABLE_HEADER_TYPE, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, PROP_MODEL, + g_param_spec_object ("model", + _("Model"), + /*_( */"XXX blurb" /*)*/, + E_TABLE_MODEL_TYPE, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, PROP_MESSAGE, + g_param_spec_string ("message", + _("Message"), + /*_( */"XXX blurb" /*)*/, + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, PROP_WIDTH, + g_param_spec_double ("width", + _("Width"), + /*_( */"XXX blurb" /*)*/, + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READWRITE | G_PARAM_LAX_VALIDATION)); + + g_object_class_install_property (object_class, PROP_HEIGHT, + g_param_spec_double ("height", + _("Height"), + /*_( */"XXX blurb" /*)*/, + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READABLE | G_PARAM_LAX_VALIDATION)); etcta_signals [CURSOR_CHANGE] = - gtk_signal_new ("cursor_change", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (ETableClickToAddClass, cursor_change), - gtk_marshal_NONE__INT_INT, - GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT); - - E_OBJECT_CLASS_ADD_SIGNALS (object_class, etcta_signals, LAST_SIGNAL); + g_signal_new ("cursor_change", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClickToAddClass, cursor_change), + NULL, NULL, + e_marshal_VOID__INT_INT, + G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); } static void @@ -484,34 +509,13 @@ etcta_init (GnomeCanvasItem *item) etcta->rect = NULL; etcta->selection = e_table_selection_model_new(); - gtk_signal_connect(GTK_OBJECT(etcta->selection), "cursor_changed", - GTK_SIGNAL_FUNC(etcta_cursor_change), etcta); + g_signal_connect(etcta->selection, "cursor_changed", + G_CALLBACK (etcta_cursor_change), etcta); e_canvas_item_set_reflow_callback(item, etcta_reflow); } -GtkType -e_table_click_to_add_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "ETableClickToAdd", - sizeof (ETableClickToAdd), - sizeof (ETableClickToAddClass), - (GtkClassInitFunc) etcta_class_init, - (GtkObjectInitFunc) etcta_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_OBJECT_TYPE, &info); - } - - return type; -} +E_MAKE_TYPE(e_table_click_to_add, "ETableClickToAdd", ETableClickToAdd, etcta_class_init, etcta_init, PARENT_OBJECT_TYPE) /* The colors in this need to be themefied. */ @@ -528,7 +532,7 @@ e_table_click_to_add_commit (ETableClickToAdd *etcta) if (etcta->row) { e_table_one_commit(E_TABLE_ONE(etcta->one)); etcta_drop_one (etcta); - gtk_object_destroy(GTK_OBJECT(etcta->row)); + g_object_unref(etcta->row); etcta->row = NULL; } if (!etcta->rect) { diff --git a/widgets/table/e-table-click-to-add.h b/widgets/table/e-table-click-to-add.h index 39371150e4..f5417e23f9 100644 --- a/widgets/table/e-table-click-to-add.h +++ b/widgets/table/e-table-click-to-add.h @@ -34,10 +34,10 @@ G_BEGIN_DECLS #define E_TABLE_CLICK_TO_ADD_TYPE (e_table_click_to_add_get_type ()) -#define E_TABLE_CLICK_TO_ADD(o) (GTK_CHECK_CAST ((o), E_TABLE_CLICK_TO_ADD_TYPE, ETableClickToAdd)) -#define E_TABLE_CLICK_TO_ADD_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_CLICK_TO_ADD_TYPE, ETableClickToAddClass)) -#define E_IS_TABLE_CLICK_TO_ADD(o) (GTK_CHECK_TYPE ((o), E_TABLE_CLICK_TO_ADD_TYPE)) -#define E_IS_TABLE_CLICK_TO_ADD_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_CLICK_TO_ADD_TYPE)) +#define E_TABLE_CLICK_TO_ADD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_CLICK_TO_ADD_TYPE, ETableClickToAdd)) +#define E_TABLE_CLICK_TO_ADD_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_CLICK_TO_ADD_TYPE, ETableClickToAddClass)) +#define E_IS_TABLE_CLICK_TO_ADD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_CLICK_TO_ADD_TYPE)) +#define E_IS_TABLE_CLICK_TO_ADD_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_CLICK_TO_ADD_TYPE)) typedef struct { GnomeCanvasGroup parent; @@ -68,7 +68,7 @@ typedef struct { void (*cursor_change) (ETableClickToAdd *etcta, gint row, gint col); } ETableClickToAddClass; -GtkType e_table_click_to_add_get_type (void); +GType e_table_click_to_add_get_type (void); void e_table_click_to_add_commit (ETableClickToAdd *etcta); diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index f1a8f791af..b487613b86 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -33,11 +33,11 @@ #include <stdlib.h> #include <string.h> +#include <gtk/gtkdialog.h> #include <gtk/gtkentry.h> #include <gtk/gtklabel.h> #include <gtk/gtknotebook.h> #include <gtk/gtktogglebutton.h> -#include <libgnomeui/gnome-dialog.h> #include <libgnomeui/gnome-propertybox.h> #include <glade/glade.h> #include "gal/util/e-util.h" @@ -428,17 +428,16 @@ do_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort) static void do_fields_config_dialog (ETableConfig *config) { - int button, running = 1; + int response, running = 1; config->temp_state = e_table_state_duplicate (config->state); setup_fields (config); do { - button = gnome_dialog_run (GNOME_DIALOG(config->dialog_show_fields)); - switch (button){ - /* OK */ - case 0: + response = gtk_dialog_run (GTK_DIALOG(config->dialog_show_fields)); + switch (response){ + case GTK_RESPONSE_OK: g_object_unref (config->state); config->state = config->temp_state; config->temp_state = 0; @@ -448,7 +447,7 @@ do_fields_config_dialog (ETableConfig *config) break; /* CANCEL */ - case 1: + case GTK_RESPONSE_CANCEL: g_object_unref (config->temp_state); config->temp_state = 0; running = 0; diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 0bb5ccd3b3..a8c9259d2d 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -539,14 +539,14 @@ eti_remove_selection_model (ETableItem *eti) if (!eti->selection) return; - gtk_signal_disconnect (GTK_OBJECT (eti->selection), - eti->selection_change_id); - gtk_signal_disconnect (GTK_OBJECT (eti->selection), - eti->selection_row_change_id); - gtk_signal_disconnect (GTK_OBJECT (eti->selection), - eti->cursor_change_id); - gtk_signal_disconnect (GTK_OBJECT (eti->selection), - eti->cursor_activated_id); + g_signal_handler_disconnect (eti->selection, + eti->selection_change_id); + g_signal_handler_disconnect (eti->selection, + eti->selection_row_change_id); + g_signal_handler_disconnect (eti->selection, + eti->cursor_change_id); + g_signal_handler_disconnect (eti->selection, + eti->cursor_activated_id); g_object_unref (eti->selection); eti->selection_change_id = 0; @@ -897,9 +897,9 @@ eti_show_cursor (ETableItem *eti, int delay) return; } - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &cursor_row, - NULL); + g_object_get(eti->selection, + "cursor_row", &cursor_row, + NULL); d(g_print ("%s: cursor row: %d\n", __FUNCTION__, cursor_row)); @@ -949,9 +949,9 @@ eti_check_cursor_bounds (ETableItem *eti) return; } - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &cursor_row, - NULL); + g_object_get(eti->selection, + "cursor_row", &cursor_row, + NULL); if (cursor_row == -1) { eti->cursor_x1 = -1; @@ -1207,10 +1207,10 @@ e_table_item_redraw_range (ETableItem *eti, g_return_if_fail (eti != NULL); g_return_if_fail (E_IS_TABLE_ITEM (eti)); - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_col", &cursor_col, - "cursor_row", &cursor_row, - NULL); + g_object_get(eti->selection, + "cursor_col", &cursor_col, + "cursor_row", &cursor_row, + NULL); if ((start_col == cursor_col) || (end_col == cursor_col) || @@ -1292,21 +1292,21 @@ eti_add_selection_model (ETableItem *eti, ESelectionModel *selection) eti->selection = selection; g_object_ref (eti->selection); - eti->selection_change_id = gtk_signal_connect ( - GTK_OBJECT (selection), "selection_changed", - GTK_SIGNAL_FUNC (eti_selection_change), eti); + eti->selection_change_id = g_signal_connect ( + selection, "selection_changed", + G_CALLBACK (eti_selection_change), eti); - eti->selection_row_change_id = gtk_signal_connect ( - GTK_OBJECT (selection), "selection_row_changed", - GTK_SIGNAL_FUNC (eti_selection_row_change), eti); + eti->selection_row_change_id = g_signal_connect ( + selection, "selection_row_changed", + G_CALLBACK (eti_selection_row_change), eti); - eti->cursor_change_id = gtk_signal_connect ( - GTK_OBJECT (selection), "cursor_changed", - GTK_SIGNAL_FUNC (eti_cursor_change), eti); + eti->cursor_change_id = g_signal_connect ( + selection, "cursor_changed", + G_CALLBACK (eti_cursor_change), eti); - eti->cursor_activated_id = gtk_signal_connect ( - GTK_OBJECT (selection), "cursor_activated", - GTK_SIGNAL_FUNC (eti_cursor_activated), eti); + eti->cursor_activated_id = g_signal_connect ( + selection, "cursor_activated", + G_CALLBACK (eti_cursor_activated), eti); eti_selection_change(selection, eti); } @@ -1488,9 +1488,9 @@ eti_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) eti->minimum_width = GTK_VALUE_DOUBLE (*arg); break; case ARG_CURSOR_ROW: - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_col", &cursor_col, - NULL); + g_object_get(eti->selection, + "cursor_col", &cursor_col, + NULL); e_table_item_focus (eti, cursor_col != -1 ? cursor_col : 0, view_to_model_row(eti, GTK_VALUE_INT (*arg)), 0); break; @@ -1532,9 +1532,9 @@ eti_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) GTK_VALUE_DOUBLE (*arg) = eti->minimum_width; break; case ARG_CURSOR_ROW: - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &row, - NULL); + g_object_get(eti->selection, + "cursor_row", &row, + NULL); GTK_VALUE_INT (*arg) = model_to_view_row(eti, row); break; case ARG_UNIFORM_ROW_HEIGHT: @@ -1896,10 +1896,10 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, selected = e_selection_model_is_row_selected(E_SELECTION_MODEL (eti->selection), view_to_model_row(eti,row)); - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_col", &cursor_col, - "cursor_row", &cursor_row, - NULL); + g_object_get(eti->selection, + "cursor_col", &cursor_col, + "cursor_row", &cursor_row, + NULL); for (col = first_col; col < last_col; col++){ ETableCol *ecol = e_table_header_get_column (eti->header, col); @@ -2105,10 +2105,10 @@ static void eti_cursor_move_left (ETableItem *eti) { int cursor_col, cursor_row; - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_col", &cursor_col, - "cursor_row", &cursor_row, - NULL); + g_object_get(eti->selection, + "cursor_col", &cursor_col, + "cursor_row", &cursor_row, + NULL); eti_cursor_move (eti, model_to_view_row(eti, cursor_row), model_to_view_col(eti, cursor_col) - 1); } @@ -2117,10 +2117,10 @@ static void eti_cursor_move_right (ETableItem *eti) { int cursor_col, cursor_row; - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_col", &cursor_col, - "cursor_row", &cursor_row, - NULL); + g_object_get(eti->selection, + "cursor_col", &cursor_col, + "cursor_row", &cursor_row, + NULL); eti_cursor_move (eti, model_to_view_row(eti, cursor_row), model_to_view_col(eti, cursor_col) + 1); } @@ -2159,10 +2159,10 @@ _do_tooltip (ETableItem *eti) case E_CURSOR_SPREADSHEET: ecol = e_table_header_get_column (eti->header, eti->tooltip->col); - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &cursor_row, - "cursor_col", &cursor_col, - NULL); + g_object_get(eti->selection, + "cursor_row", &cursor_row, + "cursor_col", &cursor_col, + NULL); if (cursor_col == ecol->col_idx && cursor_row == view_to_model_row(eti, eti->tooltip->row)) selected = !selected; @@ -2263,10 +2263,10 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) button.x = x1; button.y = y1; - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &cursor_row, - "cursor_col", &cursor_col, - NULL); + g_object_get(eti->selection, + "cursor_row", &cursor_row, + "cursor_col", &cursor_col, + NULL); if (cursor_col == view_to_model_col (eti, col) && cursor_row == view_to_model_row(eti, row)) { flags = E_CELL_CURSOR; @@ -2286,17 +2286,17 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) return TRUE; } - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &cursor_row, - "cursor_col", &cursor_col, - NULL); + g_object_get(eti->selection, + "cursor_row", &cursor_row, + "cursor_col", &cursor_col, + NULL); eti->maybe_did_something = e_selection_model_maybe_do_something(E_SELECTION_MODEL (eti->selection), view_to_model_row(eti, row), view_to_model_col(eti, col), button.state); - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &new_cursor_row, - "cursor_col", &new_cursor_col, - NULL); + g_object_get(eti->selection, + "cursor_row", &new_cursor_row, + "cursor_col", &new_cursor_col, + NULL); if (cursor_row != new_cursor_row || cursor_col != new_cursor_col) { eti->click_count = 1; @@ -2401,10 +2401,10 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1)) return TRUE; - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &cursor_row, - "cursor_col", &cursor_col, - NULL); + g_object_get(eti->selection, + "cursor_row", &cursor_row, + "cursor_col", &cursor_col, + NULL); d(g_print("%s: GDK_BUTTON_RELEASE received, button %d, line: %d\n" @@ -2467,10 +2467,10 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) return TRUE; #endif - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &model_row, - "cursor_col", &model_col, - NULL); + g_object_get(eti->selection, + "cursor_row", &model_row, + "cursor_col", &model_col, + NULL); e->button.x -= e_table_header_col_diff (eti->header, 0, model_to_view_col (eti, model_col)); e->button.y -= e_table_item_row_diff (eti, 0, model_to_view_row (eti, model_row)); @@ -2526,10 +2526,10 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) if (!find_cell (eti, e->motion.x, e->motion.y, &col, &row, &x1, &y1)) return TRUE; - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &cursor_row, - "cursor_col", &cursor_col, - NULL); + g_object_get(eti->selection, + "cursor_row", &cursor_row, + "cursor_col", &cursor_col, + NULL); e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(eti)->canvas)); @@ -2566,10 +2566,10 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) d(g_print("%s: GDK_KEY_PRESS received, keyval: %d\n", __FUNCTION__, (int) e->key.keyval)); - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &cursor_row, - "cursor_col", &cursor_col, - NULL); + g_object_get(eti->selection, + "cursor_row", &cursor_row, + "cursor_col", &cursor_col, + NULL); if (eti->tooltip->timer) { gtk_timeout_remove (eti->tooltip->timer); @@ -2653,10 +2653,10 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) else return_val = FALSE; } - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &cursor_row, - "cursor_col", &cursor_col, - NULL); + g_object_get(eti->selection, + "cursor_row", &cursor_row, + "cursor_col", &cursor_col, + NULL); if (cursor_col >= 0 && cursor_row >= 0 && return_val && (!eti_editing(eti)) && e_table_model_is_cell_editable(eti->table_model, cursor_col, model_to_view_row (eti, cursor_row))) { @@ -2748,10 +2748,10 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) d(g_print("%s: GDK_KEY_RELEASE received, keyval: %d\n", __FUNCTION__, (int) e->key.keyval)); - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &cursor_row, - "cursor_col", &cursor_col, - NULL); + g_object_get(eti->selection, + "cursor_row", &cursor_row, + "cursor_col", &cursor_col, + NULL); if (cursor_col == -1) return FALSE; @@ -3035,9 +3035,9 @@ e_table_item_get_focused_column (ETableItem *eti) g_return_val_if_fail (eti != NULL, -1); g_return_val_if_fail (E_IS_TABLE_ITEM (eti), -1); - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_col", &cursor_col, - NULL); + g_object_get(eti->selection, + "cursor_col", &cursor_col, + NULL); return cursor_col; } diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c index 0781c6332e..14edf3d6de 100644 --- a/widgets/table/e-table-selection-model.c +++ b/widgets/table/e-table-selection-model.c @@ -27,10 +27,9 @@ #include <string.h> #include <gdk/gdkkeysyms.h> +#include "gal/util/e-i18n.h" #include "gal/util/e-util.h" -#define ETSM_CLASS(e) ((ETableSelectionModelClass *)((GtkObject *)e)->klass) - #define PARENT_TYPE e_selection_model_array_get_type () static ESelectionModelArray *parent_class; @@ -38,9 +37,9 @@ static ESelectionModelArray *parent_class; static gint etsm_get_row_count (ESelectionModelArray *esm); enum { - ARG_0, - ARG_MODEL, - ARG_HEADER + PROP_0, + PROP_MODEL, + PROP_HEADER }; static void @@ -66,7 +65,8 @@ free_hash(ETableSelectionModel *etsm) g_hash_table_destroy(etsm->hash); etsm->hash = NULL; } - g_free(etsm->cursor_id); + if (etsm->cursor_id) + g_free(etsm->cursor_id); etsm->cursor_id = NULL; } @@ -81,9 +81,9 @@ model_pre_change (ETableModel *etm, ETableSelectionModel *etsm) etsm->hash = g_hash_table_new(g_str_hash, g_str_equal); e_selection_model_foreach(E_SELECTION_MODEL(etsm), save_to_hash, etsm); - gtk_object_get(GTK_OBJECT(etsm), - "cursor_row", &cursor_row, - NULL); + g_object_get(etsm, + "cursor_row", &cursor_row, + NULL); g_free (etsm->cursor_id); if (cursor_row != -1) etsm->cursor_id = e_table_model_get_save_id(etm, cursor_row); @@ -229,7 +229,7 @@ drop_model(ETableSelectionModel *etsm) } static void -etsm_destroy (GtkObject *object) +etsm_dispose (GObject *object) { ETableSelectionModel *etsm; @@ -242,37 +242,37 @@ etsm_destroy (GtkObject *object) drop_model(etsm); free_hash(etsm); - 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 -etsm_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) +etsm_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - ETableSelectionModel *etsm = E_TABLE_SELECTION_MODEL (o); + ETableSelectionModel *etsm = E_TABLE_SELECTION_MODEL (object); - switch (arg_id){ - case ARG_MODEL: - GTK_VALUE_POINTER (*arg) = GTK_OBJECT(etsm->model); + switch (prop_id){ + case PROP_MODEL: + g_value_set_object (value, etsm->model); break; - case ARG_HEADER: - GTK_VALUE_POINTER (*arg) = (GtkObject *)etsm->eth; + case PROP_HEADER: + g_value_set_object (value, etsm->eth); break; } } static void -etsm_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) +etsm_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - ETableSelectionModel *etsm = E_TABLE_SELECTION_MODEL (o); + ETableSelectionModel *etsm = E_TABLE_SELECTION_MODEL (object); - switch (arg_id){ - case ARG_MODEL: + switch (prop_id){ + case PROP_MODEL: drop_model(etsm); - add_model(etsm, GTK_VALUE_POINTER (*arg) ? E_TABLE_MODEL(GTK_VALUE_POINTER (*arg)) : NULL); + add_model(etsm, g_value_get_object (value) ? E_TABLE_MODEL(g_value_get_object (value)) : NULL); break; - case ARG_HEADER: - etsm->eth = (ETableHeader *)GTK_VALUE_POINTER (*arg); + case PROP_HEADER: + etsm->eth = E_TABLE_HEADER (g_value_get_object (value)); break; } } @@ -290,24 +290,33 @@ e_table_selection_model_init (ETableSelectionModel *selection) static void e_table_selection_model_class_init (ETableSelectionModelClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class; ESelectionModelArrayClass *esma_class; - parent_class = gtk_type_class (PARENT_TYPE); + parent_class = g_type_class_ref (PARENT_TYPE); - object_class = GTK_OBJECT_CLASS(klass); + object_class = G_OBJECT_CLASS(klass); esma_class = E_SELECTION_MODEL_ARRAY_CLASS(klass); - object_class->destroy = etsm_destroy; - object_class->get_arg = etsm_get_arg; - object_class->set_arg = etsm_set_arg; + object_class->dispose = etsm_dispose; + object_class->get_property = etsm_get_property; + object_class->set_property = etsm_set_property; esma_class->get_row_count = etsm_get_row_count; - gtk_object_add_arg_type ("ETableSelectionModel::model", GTK_TYPE_POINTER, - GTK_ARG_READWRITE, ARG_MODEL); - gtk_object_add_arg_type ("ETableSelectionModel::header", E_TABLE_HEADER_TYPE, - GTK_ARG_READWRITE, ARG_HEADER); + g_object_class_install_property (object_class, PROP_MODEL, + g_param_spec_object ("model", + _("Model"), + /*_( */"XXX blurb" /*)*/, + E_TABLE_MODEL_TYPE, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, PROP_HEADER, + g_param_spec_object ("header", + _("Header"), + /*_( */"XXX blurb" /*)*/, + E_TABLE_HEADER_TYPE, + G_PARAM_READWRITE)); } E_MAKE_TYPE(e_table_selection_model, "ETableSelectionModel", ETableSelectionModel, @@ -323,7 +332,7 @@ E_MAKE_TYPE(e_table_selection_model, "ETableSelectionModel", ETableSelectionMode ETableSelectionModel * e_table_selection_model_new (void) { - return gtk_type_new (e_table_selection_model_get_type ()); + return g_object_new (E_TABLE_SELECTION_MODEL_TYPE, NULL); } static gint diff --git a/widgets/table/e-table-selection-model.h b/widgets/table/e-table-selection-model.h index 93cd6df94e..f3889d6f1b 100644 --- a/widgets/table/e-table-selection-model.h +++ b/widgets/table/e-table-selection-model.h @@ -34,10 +34,10 @@ extern "C" { #endif /* __cplusplus */ #define E_TABLE_SELECTION_MODEL_TYPE (e_table_selection_model_get_type ()) -#define E_TABLE_SELECTION_MODEL(o) (GTK_CHECK_CAST ((o), E_TABLE_SELECTION_MODEL_TYPE, ETableSelectionModel)) -#define E_TABLE_SELECTION_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SELECTION_MODEL_TYPE, ETableSelectionModelClass)) -#define E_IS_TABLE_SELECTION_MODEL(o) (GTK_CHECK_TYPE ((o), E_TABLE_SELECTION_MODEL_TYPE)) -#define E_IS_TABLE_SELECTION_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SELECTION_MODEL_TYPE)) +#define E_TABLE_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SELECTION_MODEL_TYPE, ETableSelectionModel)) +#define E_TABLE_SELECTION_MODEL_CLASS(k) (G_TYPE-CHECK_CLASS_CAST((k), E_TABLE_SELECTION_MODEL_TYPE, ETableSelectionModelClass)) +#define E_IS_TABLE_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SELECTION_MODEL_TYPE)) +#define E_IS_TABLE_SELECTION_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SELECTION_MODEL_TYPE)) typedef struct { ESelectionModelArray base; @@ -65,7 +65,7 @@ typedef struct { ESelectionModelArrayClass parent_class; } ETableSelectionModelClass; -GtkType e_table_selection_model_get_type (void); +GType e_table_selection_model_get_type (void); ETableSelectionModel *e_table_selection_model_new (void); #ifdef __cplusplus diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index df415cf012..37499a1a40 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -430,9 +430,9 @@ et_search_search (ETableSearch *search, char *string, ETableSearchFlags flags, E rows = e_table_model_row_count (et->model); - gtk_object_get(GTK_OBJECT(et->selection), - "cursor_row", &cursor, - NULL); + g_object_get(et->selection, + "cursor_row", &cursor, + NULL); if ((flags & E_TABLE_SEARCH_FLAGS_CHECK_CURSOR_FIRST) && cursor < rows && cursor >= 0 && check_row (et, cursor, col->col_idx, col->search, string)) return TRUE; @@ -470,9 +470,9 @@ et_search_accept (ETableSearch *search, ETable *et) if (col == NULL) return; - gtk_object_get(GTK_OBJECT(et->selection), - "cursor_row", &cursor, - NULL); + g_object_get(et->selection, + "cursor_row", &cursor, + NULL); e_selection_model_select_as_key_press(E_SELECTION_MODEL (et->selection), cursor, col->col_idx, 0); } @@ -1496,17 +1496,17 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, g_object_ref (e_table->sorter); gtk_object_sink (GTK_OBJECT (e_table->sorter)); - gtk_object_set (GTK_OBJECT (e_table->selection), - "model", etm, - "selection_mode", specification->selection_mode, - "cursor_mode", specification->cursor_mode, - "sorter", e_table->sorter, - "header", e_table->header, - NULL); + g_object_set (e_table->selection, + "model", etm, + "selection_mode", specification->selection_mode, + "cursor_mode", specification->cursor_mode, + "sorter", e_table->sorter, + "header", e_table->header, + NULL); - g_signal_connect(G_OBJECT(e_table->selection), "selection_changed", + g_signal_connect(e_table->selection, "selection_changed", G_CALLBACK (et_selection_model_selection_changed), e_table); - g_signal_connect(G_OBJECT(e_table->selection), "selection_row_changed", + g_signal_connect(e_table->selection, "selection_row_changed", G_CALLBACK (et_selection_model_selection_row_changed), e_table); if (!specification->no_headers) { @@ -1890,9 +1890,9 @@ e_table_set_cursor_row (ETable *e_table, int row) g_return_if_fail(E_IS_TABLE(e_table)); g_return_if_fail(row >= 0); - gtk_object_set(GTK_OBJECT(e_table->selection), - "cursor_row", row, - NULL); + g_object_set(e_table->selection, + "cursor_row", row, + NULL); } /** @@ -1911,9 +1911,9 @@ e_table_get_cursor_row (ETable *e_table) g_return_val_if_fail(e_table != NULL, -1); g_return_val_if_fail(E_IS_TABLE(e_table), -1); - gtk_object_get(GTK_OBJECT(e_table->selection), - "cursor_row", &row, - NULL); + g_object_get(e_table->selection, + "cursor_row", &row, + NULL); return row; } @@ -3152,14 +3152,14 @@ e_table_class_init (ETableClass *class) G_TYPE_UINT); et_signals[TABLE_DRAG_DATA_DELETE] = g_signal_new ("table_drag_data_delete", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (ETableClass, 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, - GTK_TYPE_NONE, 3, - GTK_TYPE_INT, - GTK_TYPE_INT, + G_TYPE_NONE, 3, + G_TYPE_INT, + G_TYPE_INT, GDK_TYPE_DRAG_CONTEXT); et_signals[TABLE_DRAG_LEAVE] = diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c index f922603f05..cbd47bcdec 100644 --- a/widgets/table/e-tree-selection-model.c +++ b/widgets/table/e-tree-selection-model.c @@ -27,24 +27,23 @@ #include "e-tree-selection-model.h" #include <gal/util/e-bit-array.h> #include <gal/util/e-sorter.h> +#include <gal/util/e-i18n.h> #include <gal/util/e-util.h> #include <gdk/gdkkeysyms.h> #include <gal/e-table/e-tree-sorted.h> #include <gal/e-table/e-tree-table-adapter.h> -#define ETSM_CLASS(e) ((ETreeSelectionModelClass *)((GtkObject *)e)->klass) - #define PARENT_TYPE e_selection_model_get_type () static ESelectionModelClass *parent_class; enum { - ARG_0, - ARG_CURSOR_ROW, - ARG_CURSOR_COL, - ARG_MODEL, - ARG_ETTA, - ARG_ETS + PROP_0, + PROP_CURSOR_ROW, + PROP_CURSOR_COL, + PROP_MODEL, + PROP_ETTA, + PROP_ETS }; typedef struct ETreeSelectionModelNode { @@ -629,7 +628,7 @@ drop_ets(ETreeSelectionModel *etsm) /* Virtual functions */ static void -etsm_destroy (GtkObject *object) +etsm_dispose (GObject *object) { ETreeSelectionModel *etsm; @@ -649,65 +648,65 @@ etsm_destroy (GtkObject *object) etsm->priv = 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 -etsm_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) +etsm_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (o); + ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (object); - switch (arg_id){ - case ARG_CURSOR_ROW: - GTK_VALUE_INT(*arg) = etsm_cursor_row_real(etsm); + switch (prop_id){ + case PROP_CURSOR_ROW: + g_value_set_int (value, etsm_cursor_row_real(etsm)); break; - case ARG_CURSOR_COL: - GTK_VALUE_INT(*arg) = etsm->priv->cursor_col; + case PROP_CURSOR_COL: + g_value_set_int (value, etsm->priv->cursor_col); break; - case ARG_MODEL: - GTK_VALUE_OBJECT(*arg) = (GtkObject *) etsm->priv->model; + case PROP_MODEL: + g_value_set_object (value, etsm->priv->model); break; - case ARG_ETTA: - GTK_VALUE_OBJECT(*arg) = (GtkObject *) etsm->priv->etta; + case PROP_ETTA: + g_value_set_object (value, etsm->priv->etta); break; - case ARG_ETS: - GTK_VALUE_OBJECT(*arg) = (GtkObject *) etsm->priv->ets; + case PROP_ETS: + g_value_set_object (value, etsm->priv->ets); break; } } static void -etsm_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) +etsm_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - ESelectionModel *esm = E_SELECTION_MODEL (o); - ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (o); + ESelectionModel *esm = E_SELECTION_MODEL (object); + ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (object); - switch (arg_id){ - case ARG_CURSOR_ROW: - e_selection_model_do_something(esm, GTK_VALUE_INT(*arg), etsm->priv->cursor_col, 0); + switch (prop_id){ + case PROP_CURSOR_ROW: + e_selection_model_do_something(esm, g_value_get_int (value), etsm->priv->cursor_col, 0); break; - case ARG_CURSOR_COL: - e_selection_model_do_something(esm, etsm_cursor_row_real(etsm), GTK_VALUE_INT(*arg), 0); + case PROP_CURSOR_COL: + e_selection_model_do_something(esm, etsm_cursor_row_real(etsm), g_value_get_int(value), 0); break; - case ARG_MODEL: + case PROP_MODEL: drop_model(etsm); - add_model(etsm, (ETreeModel *) GTK_VALUE_OBJECT(*arg)); + add_model(etsm, E_TREE_MODEL (g_value_get_object(value))); break; - case ARG_ETTA: - etsm->priv->etta = (ETreeTableAdapter *) GTK_VALUE_OBJECT(*arg); + case PROP_ETTA: + etsm->priv->etta = E_TREE_TABLE_ADAPTER (g_value_get_object (value)); break; - case ARG_ETS: + case PROP_ETS: drop_ets(etsm); - add_ets(etsm, (ETreeSorted *) GTK_VALUE_OBJECT(*arg)); + add_ets(etsm, E_TREE_SORTED (g_value_get_object (value))); break; } } @@ -1350,17 +1349,17 @@ e_tree_selection_model_init (ETreeSelectionModel *etsm) static void e_tree_selection_model_class_init (ETreeSelectionModelClass *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 = etsm_destroy; - object_class->get_arg = etsm_get_arg; - object_class->set_arg = etsm_set_arg; + object_class->dispose = etsm_dispose; + object_class->get_property = etsm_get_property; + object_class->set_property = etsm_set_property; esm_class->is_row_selected = etsm_is_row_selected ; esm_class->foreach = etsm_foreach ; @@ -1380,22 +1379,46 @@ e_tree_selection_model_class_init (ETreeSelectionModelClass *klass) esm_class->move_selection_end = etsm_move_selection_end ; esm_class->set_selection_end = etsm_set_selection_end ; - gtk_object_add_arg_type ("ETreeSelectionModel::cursor_row", GTK_TYPE_INT, - GTK_ARG_READWRITE, ARG_CURSOR_ROW); - gtk_object_add_arg_type ("ETreeSelectionModel::cursor_col", GTK_TYPE_INT, - GTK_ARG_READWRITE, ARG_CURSOR_COL); - gtk_object_add_arg_type ("ETreeSelectionModel::model", E_TREE_MODEL_TYPE, - GTK_ARG_READWRITE, ARG_MODEL); - gtk_object_add_arg_type ("ETreeSelectionModel::etta", E_TREE_TABLE_ADAPTER_TYPE, - GTK_ARG_READWRITE, ARG_ETTA); - gtk_object_add_arg_type ("ETreeSelectionModel::ets", E_TREE_SORTED_TYPE, - GTK_ARG_READWRITE, ARG_ETS); + 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)); + + g_object_class_install_property (object_class, PROP_MODEL, + g_param_spec_object ("model", + _("Model"), + /*_( */"XXX blurb" /*)*/, + E_TREE_MODEL_TYPE, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, PROP_ETTA, + g_param_spec_object ("etta", + _("ETTA"), + /*_( */"XXX blurb" /*)*/, + E_TREE_TABLE_ADAPTER_TYPE, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, PROP_ETS, + g_param_spec_object ("ets", + _("ETS"), + /*_( */"XXX blurb" /*)*/, + E_TREE_SORTED_TYPE, + G_PARAM_READWRITE)); } ESelectionModel * e_tree_selection_model_new (void) { - return gtk_type_new(e_tree_selection_model_get_type()); + return g_object_new (E_TREE_SELECTION_MODEL_TYPE, NULL); } E_MAKE_TYPE(e_tree_selection_model, "ETreeSelectionModel", ETreeSelectionModel, diff --git a/widgets/table/e-tree-selection-model.h b/widgets/table/e-tree-selection-model.h index ef396c237c..0d3305b93d 100644 --- a/widgets/table/e-tree-selection-model.h +++ b/widgets/table/e-tree-selection-model.h @@ -40,10 +40,10 @@ typedef void (*ETreeForeachFunc) (ETreePath path, typedef struct ETreeSelectionModelPriv ETreeSelectionModelPriv; #define E_TREE_SELECTION_MODEL_TYPE (e_tree_selection_model_get_type ()) -#define E_TREE_SELECTION_MODEL(o) (GTK_CHECK_CAST ((o), E_TREE_SELECTION_MODEL_TYPE, ETreeSelectionModel)) -#define E_TREE_SELECTION_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_SELECTION_MODEL_TYPE, ETreeSelectionModelClass)) -#define E_IS_TREE_SELECTION_MODEL(o) (GTK_CHECK_TYPE ((o), E_TREE_SELECTION_MODEL_TYPE)) -#define E_IS_TREE_SELECTION_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_SELECTION_MODEL_TYPE)) +#define E_TREE_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_SELECTION_MODEL_TYPE, ETreeSelectionModel)) +#define E_TREE_SELECTION_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_SELECTION_MODEL_TYPE, ETreeSelectionModelClass)) +#define E_IS_TREE_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_SELECTION_MODEL_TYPE)) +#define E_IS_TREE_SELECTION_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_SELECTION_MODEL_TYPE)) typedef struct { ESelectionModel base; @@ -56,7 +56,7 @@ typedef struct { } ETreeSelectionModelClass; -GtkType e_tree_selection_model_get_type (void); +GType e_tree_selection_model_get_type (void); ESelectionModel *e_tree_selection_model_new (void); void e_tree_selection_model_foreach (ETreeSelectionModel *etsm, ETreeForeachFunc callback, diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index 3e7158fec1..4b6f78f4d0 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -1404,23 +1404,23 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, e_tree->priv->sorter = e_sorter_new(); - gtk_object_set (GTK_OBJECT (e_tree->priv->selection), - "sorter", e_tree->priv->sorter, + g_object_set (e_tree->priv->selection, + "sorter", e_tree->priv->sorter, #ifdef E_TREE_USE_TREE_SELECTION - "model", e_tree->priv->model, - "ets", e_tree->priv->sorted, - "etta", e_tree->priv->etta, + "model", e_tree->priv->model, + "ets", e_tree->priv->sorted, + "etta", e_tree->priv->etta, #else - "model", e_tree->priv->etta, + "model", e_tree->priv->etta, #endif - "selection_mode", specification->selection_mode, - "cursor_mode", specification->cursor_mode, - NULL); - - gtk_signal_connect(GTK_OBJECT(e_tree->priv->selection), "selection_changed", - GTK_SIGNAL_FUNC(et_selection_model_selection_changed), e_tree); - gtk_signal_connect(GTK_OBJECT(e_tree->priv->selection), "selection_row_changed", - GTK_SIGNAL_FUNC(et_selection_model_selection_row_changed), e_tree); + "selection_mode", specification->selection_mode, + "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); if (!specification->no_headers) { e_tree_setup_header (e_tree); |