diff options
author | Tim Janik <timj@gtk.org> | 2000-12-13 01:34:41 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 2000-12-13 01:34:41 +0000 |
commit | 2c9eb3a5725420394322ecedb1556d59b5b4bcaa (patch) | |
tree | 20b8260cee065e2f83ff7bb4f15788f28acfa26a /gtk | |
parent | 90461d7def6e605e410713d954307864285e8776 (diff) | |
download | gdk-pixbuf-2c9eb3a5725420394322ecedb1556d59b5b4bcaa.tar.gz |
doh, this was broken beyond believe.
Tue Dec 12 23:46:44 2000 Tim Janik <timj@gtk.org>
* gtk/stock-icons/Makefile.am: doh, this was broken beyond believe.
* gtk/gtkbox.c: change property types from (u)long to (u)int for
::position and ::padding.
* gtk/gtkcontainer.c: make ::border_width an INT property.
* gtk/gtkpacker.c: make ::position an INT property.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_adjustment_changed):
guard against NULL h/v scrollbars, since this is used at construction
time.
* gtk/gtkclist.[hc]: nuked gtk_clist_construct(), implemented
internal gtk_clist_constructor().
* gtk/gtkctree.[hc]: nuked gtk_ctree_construct(), implemented
gtk_ctree_constructor().
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): property
::pulse_step should use ARG_PULSE_STEP, not ARG_FRACTION.
* docs/reference/Makefile.am: fun stuff, disabled docs generation
again, gtk-scan.c needs to introspec paramspecs, not GtkAgs.
* gtk/gtkwidget.[hc]:
removed gtk_widget_setv(), gtk_widget_getv(), gtk_widget_newv()
and gtk_widget_get().
(gtk_widget_new): use g_object_new_valist().
(gtk_widget_set): use g_object_set_valist().
* gtk/gtkobject.[hc]:
removed gtk_object_arg_get_info(), gtk_object_getv(),
gtk_object_query_args(), gtk_object_newv(),
gtk_object_class_add_signals(),
gtk_object_class_user_signal_new(),
gtk_object_class_user_signal_newv(),
gtk_object_arg_set(), gtk_object_arg_get(),
gtk_object_args_collect(),
gtk_object_default_construct(),
gtk_object_constructed(),
GTK_CONSTRUCTED and GTK_OBJECT_CONSTRUCTED().
removed nsignals, signals and n_args members from GtkObjectClass.
(gtk_object_new): use g_object_new_valist().
(gtk_object_set): use g_object_set_valist().
(gtk_object_get): use g_object_get_valist().
* gtk/gtkcompat.h: define gtk_object_default_construct().
* gtk/gtktypeutils.c (gtk_type_new): create constructed objects via
g_object_new().
* gtk/*.c: removed gtk_object_class_add_signals() from class_init()
fucntions, cleaned up method assignments (make sure your structures
are setup properly before calling out). removed all GTK_CONSTRUCTED
hacks ;)
Diffstat (limited to 'gtk')
56 files changed, 998 insertions, 1702 deletions
diff --git a/gtk/gdk-pixbuf-loader.c b/gtk/gdk-pixbuf-loader.c index 22d7ba107..06f2e1df3 100644 --- a/gtk/gdk-pixbuf-loader.c +++ b/gtk/gdk-pixbuf-loader.c @@ -110,6 +110,9 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class) parent_class = gtk_type_class (GTK_TYPE_OBJECT); + object_class->destroy = gdk_pixbuf_loader_destroy; + gobject_class->finalize = gdk_pixbuf_loader_finalize; + pixbuf_loader_signals[AREA_PREPARED] = gtk_signal_new ("area_prepared", GTK_RUN_LAST, @@ -154,11 +157,6 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class) GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, closed), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, pixbuf_loader_signals, LAST_SIGNAL); - - object_class->destroy = gdk_pixbuf_loader_destroy; - gobject_class->finalize = gdk_pixbuf_loader_finalize; } static void diff --git a/gtk/gtkadjustment.c b/gtk/gtkadjustment.c index 084a5ef50..a23aa3e80 100644 --- a/gtk/gtkadjustment.c +++ b/gtk/gtkadjustment.c @@ -74,6 +74,9 @@ gtk_adjustment_class_init (GtkAdjustmentClass *class) object_class = (GtkObjectClass*) class; + class->changed = NULL; + class->value_changed = NULL; + adjustment_signals[CHANGED] = gtk_signal_new ("changed", GTK_RUN_FIRST | GTK_RUN_NO_RECURSE, @@ -88,11 +91,6 @@ gtk_adjustment_class_init (GtkAdjustmentClass *class) GTK_SIGNAL_OFFSET (GtkAdjustmentClass, value_changed), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, adjustment_signals, LAST_SIGNAL); - - class->changed = NULL; - class->value_changed = NULL; } static void diff --git a/gtk/gtkarg.h b/gtk/gtkarg.h index 621cc71b9..b3aacc2c9 100644 --- a/gtk/gtkarg.h +++ b/gtk/gtkarg.h @@ -58,6 +58,8 @@ struct _GtkArgInfo /* Non-public methods */ +#define GTK_ARG_MASK 0x1f + GtkArg* gtk_arg_new (GtkType arg_type); GtkArg* gtk_arg_copy (GtkArg *src_arg, GtkArg *dest_arg); diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index 32ab748c1..96fad211c 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -117,9 +117,9 @@ gtk_box_class_init (GtkBoxClass *class) gtk_object_add_arg_type ("GtkBox::homogeneous", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HOMOGENEOUS); gtk_container_add_child_arg_type ("GtkBox::expand", GTK_TYPE_BOOL, GTK_ARG_READWRITE, CHILD_ARG_EXPAND); gtk_container_add_child_arg_type ("GtkBox::fill", GTK_TYPE_BOOL, GTK_ARG_READWRITE, CHILD_ARG_FILL); - gtk_container_add_child_arg_type ("GtkBox::padding", GTK_TYPE_ULONG, GTK_ARG_READWRITE, CHILD_ARG_PADDING); + gtk_container_add_child_arg_type ("GtkBox::padding", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_PADDING); gtk_container_add_child_arg_type ("GtkBox::pack_type", GTK_TYPE_PACK_TYPE, GTK_ARG_READWRITE, CHILD_ARG_PACK_TYPE); - gtk_container_add_child_arg_type ("GtkBox::position", GTK_TYPE_LONG, GTK_ARG_READWRITE, CHILD_ARG_POSITION); + gtk_container_add_child_arg_type ("GtkBox::position", GTK_TYPE_INT, GTK_ARG_READWRITE, CHILD_ARG_POSITION); object_class->set_arg = gtk_box_set_arg; object_class->get_arg = gtk_box_get_arg; @@ -239,7 +239,7 @@ gtk_box_set_child_arg (GtkContainer *container, child, expand, fill, - GTK_VALUE_ULONG (*arg), + GTK_VALUE_UINT (*arg), pack_type); break; case CHILD_ARG_PACK_TYPE: @@ -253,7 +253,7 @@ gtk_box_set_child_arg (GtkContainer *container, case CHILD_ARG_POSITION: gtk_box_reorder_child (GTK_BOX (container), child, - GTK_VALUE_LONG (*arg)); + GTK_VALUE_INT (*arg)); break; default: break; @@ -289,13 +289,13 @@ gtk_box_get_child_arg (GtkContainer *container, GTK_VALUE_BOOL (*arg) = fill; break; case CHILD_ARG_PADDING: - GTK_VALUE_ULONG (*arg) = padding; + GTK_VALUE_UINT (*arg) = padding; break; case CHILD_ARG_PACK_TYPE: GTK_VALUE_ENUM (*arg) = pack_type; break; case CHILD_ARG_POSITION: - GTK_VALUE_LONG (*arg) = 0; + GTK_VALUE_INT (*arg) = 0; for (list = GTK_BOX (container)->children; list; list = list->next) { GtkBoxChild *child_entry; @@ -303,10 +303,10 @@ gtk_box_get_child_arg (GtkContainer *container, child_entry = list->data; if (child_entry->widget == child) break; - GTK_VALUE_LONG (*arg)++; + GTK_VALUE_INT (*arg)++; } if (!list) - GTK_VALUE_LONG (*arg) = -1; + GTK_VALUE_INT (*arg) = -1; break; default: arg->type = GTK_TYPE_INVALID; diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 639edbca1..a66403269 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -142,6 +142,33 @@ gtk_button_class_init (GtkButtonClass *klass) parent_class = gtk_type_class (GTK_TYPE_BIN); + + object_class->set_arg = gtk_button_set_arg; + object_class->get_arg = gtk_button_get_arg; + + widget_class->realize = gtk_button_realize; + widget_class->draw_focus = gtk_button_draw_focus; + widget_class->draw_default = gtk_button_draw_default; + widget_class->size_request = gtk_button_size_request; + widget_class->size_allocate = gtk_button_size_allocate; + widget_class->expose_event = gtk_button_expose; + widget_class->button_press_event = gtk_button_button_press; + widget_class->button_release_event = gtk_button_button_release; + widget_class->enter_notify_event = gtk_button_enter_notify; + widget_class->leave_notify_event = gtk_button_leave_notify; + widget_class->focus_in_event = gtk_button_focus_in; + widget_class->focus_out_event = gtk_button_focus_out; + + container_class->add = gtk_button_add; + container_class->remove = gtk_button_remove; + container_class->child_type = gtk_button_child_type; + + klass->pressed = gtk_real_button_pressed; + klass->released = gtk_real_button_released; + klass->clicked = NULL; + klass->enter = gtk_real_button_enter; + klass->leave = gtk_real_button_leave; + gtk_object_add_arg_type ("GtkButton::label", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_LABEL); gtk_object_add_arg_type ("GtkButton::relief", GTK_TYPE_RELIEF_STYLE, GTK_ARG_READWRITE, ARG_RELIEF); @@ -166,6 +193,7 @@ gtk_button_class_init (GtkButtonClass *klass) GTK_SIGNAL_OFFSET (GtkButtonClass, clicked), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); + widget_class->activate_signal = button_signals[CLICKED]; button_signals[ENTER] = gtk_signal_new ("enter", GTK_RUN_FIRST, @@ -180,35 +208,6 @@ gtk_button_class_init (GtkButtonClass *klass) GTK_SIGNAL_OFFSET (GtkButtonClass, leave), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, button_signals, LAST_SIGNAL); - - object_class->set_arg = gtk_button_set_arg; - object_class->get_arg = gtk_button_get_arg; - - widget_class->activate_signal = button_signals[CLICKED]; - widget_class->realize = gtk_button_realize; - widget_class->draw_focus = gtk_button_draw_focus; - widget_class->draw_default = gtk_button_draw_default; - widget_class->size_request = gtk_button_size_request; - widget_class->size_allocate = gtk_button_size_allocate; - widget_class->expose_event = gtk_button_expose; - widget_class->button_press_event = gtk_button_button_press; - widget_class->button_release_event = gtk_button_button_release; - widget_class->enter_notify_event = gtk_button_enter_notify; - widget_class->leave_notify_event = gtk_button_leave_notify; - widget_class->focus_in_event = gtk_button_focus_in; - widget_class->focus_out_event = gtk_button_focus_out; - - container_class->add = gtk_button_add; - container_class->remove = gtk_button_remove; - container_class->child_type = gtk_button_child_type; - - klass->pressed = gtk_real_button_pressed; - klass->released = gtk_real_button_released; - klass->clicked = NULL; - klass->enter = gtk_real_button_enter; - klass->leave = gtk_real_button_leave; } static void diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index cde5e8cf6..499ff582d 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -353,6 +353,8 @@ gtk_calendar_class_init (GtkCalendarClass *class) parent_class = gtk_type_class (GTK_TYPE_WIDGET); + object_class->destroy = gtk_calendar_destroy; + widget_class->realize = gtk_calendar_realize; widget_class->unrealize = gtk_calendar_unrealize; widget_class->expose_event = gtk_calendar_expose; @@ -368,8 +370,15 @@ gtk_calendar_class_init (GtkCalendarClass *class) widget_class->focus_out_event = gtk_calendar_focus_out; widget_class->style_set = gtk_calendar_style_set; widget_class->state_changed = gtk_calendar_state_changed; - object_class->destroy = gtk_calendar_destroy; + class->month_changed = NULL; + class->day_selected = NULL; + class->day_selected_double_click = NULL; + class->prev_month = NULL; + class->next_month = NULL; + class->prev_year = NULL; + class->next_year = NULL; + gtk_calendar_signals[MONTH_CHANGED_SIGNAL] = gtk_signal_new ("month_changed", GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class), @@ -405,16 +414,6 @@ gtk_calendar_class_init (GtkCalendarClass *class) GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (GtkCalendarClass, next_year), gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, gtk_calendar_signals, LAST_SIGNAL); - - class->month_changed = NULL; - class->day_selected = NULL; - class->day_selected_double_click = NULL; - class->prev_month = NULL; - class->next_month = NULL; - class->prev_year = NULL; - class->next_year = NULL; } static void diff --git a/gtk/gtkcellrenderertoggle.c b/gtk/gtkcellrenderertoggle.c index 6007a304c..c17a1170e 100644 --- a/gtk/gtkcellrenderertoggle.c +++ b/gtk/gtkcellrenderertoggle.c @@ -150,8 +150,6 @@ gtk_cell_renderer_toggle_class_init (GtkCellRendererToggleClass *class) gtk_marshal_VOID__POINTER, GTK_TYPE_NONE, 1, GTK_TYPE_POINTER); - - gtk_object_class_add_signals (GTK_OBJECT_CLASS (object_class), toggle_cell_signals, LAST_SIGNAL); } static void diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c index 728b63443..f0ad209b1 100644 --- a/gtk/gtkcheckmenuitem.c +++ b/gtk/gtkcheckmenuitem.c @@ -107,7 +107,6 @@ gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass) GTK_SIGNAL_OFFSET (GtkCheckMenuItemClass, toggled), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - gtk_object_class_add_signals (object_class, check_menu_item_signals, LAST_SIGNAL); } GtkWidget* diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index f79eac7c9..0ab00b0ab 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -175,8 +175,11 @@ enum { }; /* GtkCList Methods */ -static void gtk_clist_class_init (GtkCListClass *klass); -static void gtk_clist_init (GtkCList *clist); +static void gtk_clist_class_init (GtkCListClass *klass); +static void gtk_clist_init (GtkCList *clist); +static GObject* gtk_clist_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_params); /* GtkObject Methods */ static void gtk_clist_destroy (GtkObject *object); @@ -493,6 +496,8 @@ gtk_clist_class_init (GtkCListClass *klass) GtkContainerClass *container_class; GtkBindingSet *binding_set; + gobject_class->constructor = gtk_clist_constructor; + object_class = (GtkObjectClass *) klass; widget_class = (GtkWidgetClass *) klass; container_class = (GtkContainerClass *) klass; @@ -505,6 +510,66 @@ gtk_clist_class_init (GtkCListClass *klass) object_class->get_arg = gtk_clist_get_arg; object_class->destroy = gtk_clist_destroy; + + widget_class->realize = gtk_clist_realize; + widget_class->unrealize = gtk_clist_unrealize; + widget_class->map = gtk_clist_map; + widget_class->unmap = gtk_clist_unmap; + widget_class->button_press_event = gtk_clist_button_press; + widget_class->button_release_event = gtk_clist_button_release; + widget_class->motion_notify_event = gtk_clist_motion; + widget_class->expose_event = gtk_clist_expose; + widget_class->size_request = gtk_clist_size_request; + widget_class->size_allocate = gtk_clist_size_allocate; + widget_class->focus_in_event = gtk_clist_focus_in; + widget_class->focus_out_event = gtk_clist_focus_out; + widget_class->draw_focus = gtk_clist_draw_focus; + widget_class->style_set = gtk_clist_style_set; + widget_class->drag_begin = gtk_clist_drag_begin; + widget_class->drag_end = gtk_clist_drag_end; + widget_class->drag_motion = gtk_clist_drag_motion; + widget_class->drag_leave = gtk_clist_drag_leave; + widget_class->drag_drop = gtk_clist_drag_drop; + widget_class->drag_data_get = gtk_clist_drag_data_get; + widget_class->drag_data_received = gtk_clist_drag_data_received; + + /* container_class->add = NULL; use the default GtkContainerClass warning */ + /* container_class->remove=NULL; use the default GtkContainerClass warning */ + + container_class->forall = gtk_clist_forall; + container_class->focus = gtk_clist_focus; + container_class->set_focus_child = gtk_clist_set_focus_child; + + klass->set_scroll_adjustments = gtk_clist_set_scroll_adjustments; + klass->refresh = clist_refresh; + klass->select_row = real_select_row; + klass->unselect_row = real_unselect_row; + klass->row_move = real_row_move; + klass->undo_selection = real_undo_selection; + klass->resync_selection = resync_selection; + klass->selection_find = selection_find; + klass->click_column = NULL; + klass->resize_column = real_resize_column; + klass->draw_row = draw_row; + klass->draw_drag_highlight = draw_drag_highlight; + klass->insert_row = real_insert_row; + klass->remove_row = real_remove_row; + klass->clear = real_clear; + klass->sort_list = real_sort_list; + klass->select_all = real_select_all; + klass->unselect_all = real_unselect_all; + klass->fake_unselect_all = fake_unselect_all; + klass->scroll_horizontal = scroll_horizontal; + klass->scroll_vertical = scroll_vertical; + klass->extend_selection = extend_selection; + klass->toggle_focus_row = toggle_focus_row; + klass->toggle_add_mode = toggle_add_mode; + klass->start_selection = start_selection; + klass->end_selection = end_selection; + klass->abort_column_resize = abort_column_resize; + klass->set_cell_contents = set_cell_contents; + klass->cell_size_request = cell_size_request; + gtk_object_add_arg_type ("GtkCList::n_columns", GTK_TYPE_UINT, GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT_ONLY, @@ -664,66 +729,6 @@ gtk_clist_class_init (GtkCListClass *klass) GTK_SIGNAL_OFFSET (GtkCListClass, abort_column_resize), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - gtk_object_class_add_signals (object_class, clist_signals, LAST_SIGNAL); - - widget_class->realize = gtk_clist_realize; - widget_class->unrealize = gtk_clist_unrealize; - widget_class->map = gtk_clist_map; - widget_class->unmap = gtk_clist_unmap; - widget_class->button_press_event = gtk_clist_button_press; - widget_class->button_release_event = gtk_clist_button_release; - widget_class->motion_notify_event = gtk_clist_motion; - widget_class->expose_event = gtk_clist_expose; - widget_class->size_request = gtk_clist_size_request; - widget_class->size_allocate = gtk_clist_size_allocate; - widget_class->focus_in_event = gtk_clist_focus_in; - widget_class->focus_out_event = gtk_clist_focus_out; - widget_class->draw_focus = gtk_clist_draw_focus; - widget_class->style_set = gtk_clist_style_set; - widget_class->drag_begin = gtk_clist_drag_begin; - widget_class->drag_end = gtk_clist_drag_end; - widget_class->drag_motion = gtk_clist_drag_motion; - widget_class->drag_leave = gtk_clist_drag_leave; - widget_class->drag_drop = gtk_clist_drag_drop; - widget_class->drag_data_get = gtk_clist_drag_data_get; - widget_class->drag_data_received = gtk_clist_drag_data_received; - - /* container_class->add = NULL; use the default GtkContainerClass warning */ - /* container_class->remove=NULL; use the default GtkContainerClass warning */ - - container_class->forall = gtk_clist_forall; - container_class->focus = gtk_clist_focus; - container_class->set_focus_child = gtk_clist_set_focus_child; - - klass->set_scroll_adjustments = gtk_clist_set_scroll_adjustments; - klass->refresh = clist_refresh; - klass->select_row = real_select_row; - klass->unselect_row = real_unselect_row; - klass->row_move = real_row_move; - klass->undo_selection = real_undo_selection; - klass->resync_selection = resync_selection; - klass->selection_find = selection_find; - klass->click_column = NULL; - klass->resize_column = real_resize_column; - klass->draw_row = draw_row; - klass->draw_drag_highlight = draw_drag_highlight; - klass->insert_row = real_insert_row; - klass->remove_row = real_remove_row; - klass->clear = real_clear; - klass->sort_list = real_sort_list; - klass->select_all = real_select_all; - klass->unselect_all = real_unselect_all; - klass->fake_unselect_all = fake_unselect_all; - klass->scroll_horizontal = scroll_horizontal; - klass->scroll_vertical = scroll_vertical; - klass->extend_selection = extend_selection; - klass->toggle_focus_row = toggle_focus_row; - klass->toggle_add_mode = toggle_add_mode; - klass->start_selection = start_selection; - klass->end_selection = end_selection; - klass->abort_column_resize = abort_column_resize; - klass->set_cell_contents = set_cell_contents; - klass->cell_size_request = cell_size_request; binding_set = gtk_binding_set_by_class (klass); gtk_binding_entry_add_signal (binding_set, GDK_Up, 0, @@ -834,8 +839,8 @@ gtk_clist_set_arg (GtkObject *object, switch (arg_id) { - case ARG_N_COLUMNS: /* construct-only arg, only set when !GTK_CONSTRUCTED */ - gtk_clist_construct (clist, MAX (1, GTK_VALUE_UINT (*arg)), NULL); + case ARG_N_COLUMNS: /* only set at construction time */ + clist->columns = MAX (1, GTK_VALUE_UINT (*arg)); break; case ARG_SHADOW_TYPE: gtk_clist_set_shadow_type (clist, GTK_VALUE_ENUM (*arg)); @@ -989,20 +994,17 @@ gtk_clist_init (GtkCList *clist) clist->sort_column = 0; } -/* Constructors */ -void -gtk_clist_construct (GtkCList *clist, - gint columns, - gchar *titles[]) +/* Constructor */ +static GObject* +gtk_clist_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) { - g_return_if_fail (clist != NULL); - g_return_if_fail (GTK_IS_CLIST (clist)); - g_return_if_fail (columns > 0); - g_return_if_fail (GTK_OBJECT_CONSTRUCTED (clist) == FALSE); - - /* mark the object as constructed */ - gtk_object_constructed (GTK_OBJECT (clist)); - + GObject *object = G_OBJECT_CLASS (parent_class)->constructor (type, + n_construct_properties, + construct_properties); + GtkCList *clist = GTK_CLIST (object); + /* initalize memory chunks, if this has not been done by any * possibly derived widget */ @@ -1012,35 +1014,24 @@ gtk_clist_construct (GtkCList *clist, sizeof (GtkCListRow) * CLIST_OPTIMUM_SIZE, G_ALLOC_AND_FREE); - + if (!clist->cell_mem_chunk) clist->cell_mem_chunk = g_mem_chunk_new ("clist cell mem chunk", - sizeof (GtkCell) * columns, - sizeof (GtkCell) * columns * + sizeof (GtkCell) * clist->columns, + sizeof (GtkCell) * clist->columns * CLIST_OPTIMUM_SIZE, G_ALLOC_AND_FREE); - - /* set number of columns, allocate memory */ - clist->columns = columns; + + /* allocate memory for columns */ clist->column = columns_new (clist); - + /* there needs to be at least one column button * because there is alot of code that will break if it - * isn't there*/ + * isn't there + */ column_button_create (clist, 0); - - if (titles) - { - guint i; - - GTK_CLIST_SET_FLAG (clist, CLIST_SHOW_TITLES); - for (i = 0; i < columns; i++) - gtk_clist_set_column_title (clist, i, titles[i]); - } - else - { - GTK_CLIST_UNSET_FLAG (clist, CLIST_SHOW_TITLES); - } + + return object; } /* GTKCLIST PUBLIC INTERFACE @@ -1065,12 +1056,23 @@ GtkWidget* gtk_clist_new_with_titles (gint columns, gchar *titles[]) { - GtkWidget *widget; + GtkCList *clist; - widget = gtk_type_new (GTK_TYPE_CLIST); - gtk_clist_construct (GTK_CLIST (widget), columns, titles); + clist = g_object_new (GTK_TYPE_CLIST, + "n_columns", columns, + NULL); + if (titles) + { + guint i; - return widget; + for (i = 0; i < clist->columns; i++) + gtk_clist_set_column_title (clist, i, titles[i]); + gtk_clist_column_titles_show (clist); + } + else + gtk_clist_column_titles_hide (clist); + + return GTK_WIDGET (clist); } void diff --git a/gtk/gtkclist.h b/gtk/gtkclist.h index 8de30f692..3c41ed98e 100644 --- a/gtk/gtkclist.h +++ b/gtk/gtkclist.h @@ -439,11 +439,6 @@ struct _GtkCell GtkType gtk_clist_get_type (void) G_GNUC_CONST; -/* constructors useful for gtk-- wrappers */ -void gtk_clist_construct (GtkCList *clist, - gint columns, - gchar *titles[]); - /* create a new GtkCList */ GtkWidget* gtk_clist_new (gint columns); GtkWidget* gtk_clist_new_with_titles (gint columns, diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c index 4bcce9934..f8893ca93 100644 --- a/gtk/gtkcolorsel.c +++ b/gtk/gtkcolorsel.c @@ -1337,6 +1337,8 @@ gtk_color_selection_class_init (GtkColorSelectionClass *klass) parent_class = gtk_type_class (GTK_TYPE_VBOX); + object_class->destroy = gtk_color_selection_destroy; + color_selection_signals[COLOR_CHANGED] = gtk_signal_new ("color_changed", GTK_RUN_FIRST, @@ -1344,11 +1346,6 @@ gtk_color_selection_class_init (GtkColorSelectionClass *klass) GTK_SIGNAL_OFFSET (GtkColorSelectionClass, color_changed), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - - - gtk_object_class_add_signals (object_class, color_selection_signals, LAST_SIGNAL); - - object_class->destroy = gtk_color_selection_destroy; } /* widget functions */ diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index d3ee4fbff..5f04910f9 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -165,7 +165,24 @@ gtk_container_class_init (GtkContainerClass *class) vadjustment_key_id = g_quark_from_static_string (vadjustment_key); hadjustment_key_id = g_quark_from_static_string (hadjustment_key); - gtk_object_add_arg_type ("GtkContainer::border_width", GTK_TYPE_ULONG, GTK_ARG_READWRITE, ARG_BORDER_WIDTH); + + object_class->get_arg = gtk_container_get_arg; + object_class->set_arg = gtk_container_set_arg; + object_class->destroy = gtk_container_destroy; + + widget_class->show_all = gtk_container_show_all; + widget_class->hide_all = gtk_container_hide_all; + + class->add = gtk_container_add_unimplemented; + class->remove = gtk_container_remove_unimplemented; + class->check_resize = gtk_container_real_check_resize; + class->forall = NULL; + class->focus = gtk_container_real_focus; + class->set_focus_child = gtk_container_real_set_focus_child; + class->child_type = NULL; + class->composite_name = gtk_container_child_default_composite_name; + + gtk_object_add_arg_type ("GtkContainer::border_width", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_BORDER_WIDTH); gtk_object_add_arg_type ("GtkContainer::resize_mode", GTK_TYPE_RESIZE_MODE, GTK_ARG_READWRITE, ARG_RESIZE_MODE); gtk_object_add_arg_type ("GtkContainer::child", GTK_TYPE_WIDGET, GTK_ARG_WRITABLE, ARG_CHILD); gtk_object_add_arg_type ("GtkContainer::reallocate_redraws", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_REALLOCATE_REDRAWS); @@ -209,23 +226,6 @@ gtk_container_class_init (GtkContainerClass *class) gtk_marshal_VOID__POINTER, GTK_TYPE_NONE, 1, GTK_TYPE_WIDGET); - gtk_object_class_add_signals (object_class, container_signals, LAST_SIGNAL); - - object_class->get_arg = gtk_container_get_arg; - object_class->set_arg = gtk_container_set_arg; - object_class->destroy = gtk_container_destroy; - - widget_class->show_all = gtk_container_show_all; - widget_class->hide_all = gtk_container_hide_all; - - class->add = gtk_container_add_unimplemented; - class->remove = gtk_container_remove_unimplemented; - class->check_resize = gtk_container_real_check_resize; - class->forall = NULL; - class->focus = gtk_container_real_focus; - class->set_focus_child = gtk_container_real_set_focus_child; - class->child_type = NULL; - class->composite_name = gtk_container_child_default_composite_name; } GtkType @@ -266,8 +266,6 @@ gtk_container_add_with_args (GtkContainer *container, gtk_widget_ref (GTK_WIDGET (container)); gtk_widget_ref (widget); - if (!GTK_OBJECT_CONSTRUCTED (widget)) - gtk_object_default_construct (GTK_OBJECT (widget)); gtk_signal_emit (GTK_OBJECT (container), container_signals[ADD], widget); if (widget->parent) @@ -326,8 +324,6 @@ gtk_container_addv (GtkContainer *container, gtk_widget_ref (GTK_WIDGET (container)); gtk_widget_ref (widget); - if (!GTK_OBJECT_CONSTRUCTED (widget)) - gtk_object_default_construct (GTK_OBJECT (widget)); gtk_signal_emit (GTK_OBJECT (container), container_signals[ADD], widget); if (widget->parent) @@ -646,7 +642,7 @@ gtk_container_set_arg (GtkObject *object, switch (arg_id) { case ARG_BORDER_WIDTH: - gtk_container_set_border_width (container, GTK_VALUE_ULONG (*arg)); + gtk_container_set_border_width (container, GTK_VALUE_UINT (*arg)); break; case ARG_RESIZE_MODE: gtk_container_set_resize_mode (container, GTK_VALUE_ENUM (*arg)); @@ -674,7 +670,7 @@ gtk_container_get_arg (GtkObject *object, switch (arg_id) { case ARG_BORDER_WIDTH: - GTK_VALUE_ULONG (*arg) = container->border_width; + GTK_VALUE_UINT (*arg) = container->border_width; break; case ARG_RESIZE_MODE: GTK_VALUE_ENUM (*arg) = container->resize_mode; @@ -714,8 +710,6 @@ gtk_container_add (GtkContainer *container, g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (widget->parent == NULL); - if (!GTK_OBJECT_CONSTRUCTED (widget)) - gtk_object_default_construct (GTK_OBJECT (widget)); gtk_signal_emit (GTK_OBJECT (container), container_signals[ADD], widget); } diff --git a/gtk/gtkctree.c b/gtk/gtkctree.c index a928959c0..3ead47c46 100644 --- a/gtk/gtkctree.c +++ b/gtk/gtkctree.c @@ -90,8 +90,11 @@ enum { }; -static void gtk_ctree_class_init (GtkCTreeClass *klass); -static void gtk_ctree_init (GtkCTree *ctree); +static void gtk_ctree_class_init (GtkCTreeClass *klass); +static void gtk_ctree_init (GtkCTree *ctree); +static GObject* gtk_ctree_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_params); static void gtk_ctree_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); @@ -342,11 +345,14 @@ gtk_ctree_get_type (void) static void gtk_ctree_class_init (GtkCTreeClass *klass) { + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkCListClass *clist_class; GtkBindingSet *binding_set; + gobject_class->constructor = gtk_ctree_constructor; + object_class = (GtkObjectClass *) klass; widget_class = (GtkWidgetClass *) klass; container_class = (GtkContainerClass *) klass; @@ -355,7 +361,44 @@ gtk_ctree_class_init (GtkCTreeClass *klass) parent_class = gtk_type_class (GTK_TYPE_CLIST); container_class = gtk_type_class (GTK_TYPE_CONTAINER); - gtk_object_add_arg_type ("GtkCTree::n_columns", + object_class->set_arg = gtk_ctree_set_arg; + object_class->get_arg = gtk_ctree_get_arg; + + widget_class->realize = gtk_ctree_realize; + widget_class->unrealize = gtk_ctree_unrealize; + widget_class->button_press_event = gtk_ctree_button_press; + + widget_class->drag_begin = gtk_ctree_drag_begin; + widget_class->drag_motion = gtk_ctree_drag_motion; + widget_class->drag_data_received = gtk_ctree_drag_data_received; + + clist_class->select_row = real_select_row; + clist_class->unselect_row = real_unselect_row; + clist_class->row_move = real_row_move; + clist_class->undo_selection = real_undo_selection; + clist_class->resync_selection = resync_selection; + clist_class->selection_find = selection_find; + clist_class->click_column = NULL; + clist_class->draw_row = draw_row; + clist_class->draw_drag_highlight = draw_drag_highlight; + clist_class->clear = real_clear; + clist_class->select_all = real_select_all; + clist_class->unselect_all = real_unselect_all; + clist_class->fake_unselect_all = fake_unselect_all; + clist_class->insert_row = real_insert_row; + clist_class->remove_row = real_remove_row; + clist_class->sort_list = real_sort_list; + clist_class->set_cell_contents = set_cell_contents; + clist_class->cell_size_request = cell_size_request; + + klass->tree_select_row = real_tree_select; + klass->tree_unselect_row = real_tree_unselect; + klass->tree_expand = real_tree_expand; + klass->tree_collapse = real_tree_collapse; + klass->tree_move = real_tree_move; + klass->change_focus_row_expansion = change_focus_row_expansion; + + gtk_object_add_arg_type ("GtkCTree::n_columns", /* overrides GtkCList::n_columns!! */ GTK_TYPE_UINT, GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT_ONLY, ARG_N_COLUMNS); @@ -383,8 +426,6 @@ gtk_ctree_class_init (GtkCTreeClass *klass) GTK_TYPE_CTREE_EXPANDER_STYLE, GTK_ARG_READWRITE, ARG_EXPANDER_STYLE); - object_class->set_arg = gtk_ctree_set_arg; - object_class->get_arg = gtk_ctree_get_arg; ctree_signals[TREE_SELECT_ROW] = gtk_signal_new ("tree_select_row", @@ -430,41 +471,6 @@ gtk_ctree_class_init (GtkCTreeClass *klass) change_focus_row_expansion), gtk_marshal_VOID__ENUM, GTK_TYPE_NONE, 1, GTK_TYPE_CTREE_EXPANSION_TYPE); - gtk_object_class_add_signals (object_class, ctree_signals, LAST_SIGNAL); - - widget_class->realize = gtk_ctree_realize; - widget_class->unrealize = gtk_ctree_unrealize; - widget_class->button_press_event = gtk_ctree_button_press; - - widget_class->drag_begin = gtk_ctree_drag_begin; - widget_class->drag_motion = gtk_ctree_drag_motion; - widget_class->drag_data_received = gtk_ctree_drag_data_received; - - clist_class->select_row = real_select_row; - clist_class->unselect_row = real_unselect_row; - clist_class->row_move = real_row_move; - clist_class->undo_selection = real_undo_selection; - clist_class->resync_selection = resync_selection; - clist_class->selection_find = selection_find; - clist_class->click_column = NULL; - clist_class->draw_row = draw_row; - clist_class->draw_drag_highlight = draw_drag_highlight; - clist_class->clear = real_clear; - clist_class->select_all = real_select_all; - clist_class->unselect_all = real_unselect_all; - clist_class->fake_unselect_all = fake_unselect_all; - clist_class->insert_row = real_insert_row; - clist_class->remove_row = real_remove_row; - clist_class->sort_list = real_sort_list; - clist_class->set_cell_contents = set_cell_contents; - clist_class->cell_size_request = cell_size_request; - - klass->tree_select_row = real_tree_select; - klass->tree_unselect_row = real_tree_unselect; - klass->tree_expand = real_tree_expand; - klass->tree_collapse = real_tree_collapse; - klass->tree_move = real_tree_move; - klass->change_focus_row_expansion = change_focus_row_expansion; binding_set = gtk_binding_set_by_class (klass); gtk_binding_entry_add_signal (binding_set, @@ -514,27 +520,32 @@ gtk_ctree_set_arg (GtkObject *object, guint arg_id) { GtkCTree *ctree; + GtkCList *clist; ctree = GTK_CTREE (object); + clist = GTK_CLIST (ctree); switch (arg_id) { - case ARG_N_COLUMNS: /* construct-only arg, only set when !GTK_CONSTRUCTED */ - if (ctree->tree_column) - gtk_ctree_construct (ctree, - MAX (1, GTK_VALUE_UINT (*arg)), - ctree->tree_column, NULL); - else - GTK_CLIST (ctree)->columns = MAX (1, GTK_VALUE_UINT (*arg)); + case ARG_N_COLUMNS: /* construct-only arg, only set at construction time */ + g_return_if_fail (clist->row_mem_chunk == NULL); + clist->columns = MAX (1, GTK_VALUE_UINT (*arg)); + clist->row_mem_chunk = g_mem_chunk_new ("ctree row mem chunk", + sizeof (GtkCTreeRow), + sizeof (GtkCTreeRow) + * CLIST_OPTIMUM_SIZE, + G_ALLOC_AND_FREE); + clist->cell_mem_chunk = g_mem_chunk_new ("ctree cell mem chunk", + sizeof (GtkCell) * clist->columns, + sizeof (GtkCell) * clist->columns + * CLIST_OPTIMUM_SIZE, + G_ALLOC_AND_FREE); + ctree->tree_column = CLAMP (ctree->tree_column, 0, clist->columns); break; - case ARG_TREE_COLUMN: /* construct-only arg, only set when !GTK_CONSTRUCTED */ - if (GTK_CLIST (ctree)->columns) - gtk_ctree_construct (ctree, - GTK_CLIST (ctree)->columns, - MAX (1, GTK_VALUE_UINT (*arg)), - NULL); - else - ctree->tree_column = MAX (1, GTK_VALUE_UINT (*arg)); + case ARG_TREE_COLUMN: /* construct-only arg, only set at construction time */ + ctree->tree_column = GTK_VALUE_UINT (*arg); + if (clist->row_mem_chunk) + ctree->tree_column = CLAMP (ctree->tree_column, 0, clist->columns); break; case ARG_INDENT: gtk_ctree_set_indent (ctree, GTK_VALUE_UINT (*arg)); @@ -3539,38 +3550,19 @@ ctree_is_hot_spot (GtkCTree *ctree, * Creation, insertion, deletion * ***********************************************************/ -void -gtk_ctree_construct (GtkCTree *ctree, - gint columns, - gint tree_column, - gchar *titles[]) +static GObject* +gtk_ctree_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) { - GtkCList *clist; + GObject *object = G_OBJECT_CLASS (parent_class)->constructor (type, + n_construct_properties, + construct_properties); - g_return_if_fail (ctree != NULL); - g_return_if_fail (GTK_IS_CTREE (ctree)); - g_return_if_fail (GTK_OBJECT_CONSTRUCTED (ctree) == FALSE); - - clist = GTK_CLIST (ctree); - - clist->row_mem_chunk = g_mem_chunk_new ("ctree row mem chunk", - sizeof (GtkCTreeRow), - sizeof (GtkCTreeRow) - * CLIST_OPTIMUM_SIZE, - G_ALLOC_AND_FREE); - - clist->cell_mem_chunk = g_mem_chunk_new ("ctree cell mem chunk", - sizeof (GtkCell) * columns, - sizeof (GtkCell) * columns - * CLIST_OPTIMUM_SIZE, - G_ALLOC_AND_FREE); - - ctree->tree_column = tree_column; - - gtk_clist_construct (clist, columns, titles); + return object; } -GtkWidget * +GtkWidget* gtk_ctree_new_with_titles (gint columns, gint tree_column, gchar *titles[]) @@ -3580,8 +3572,19 @@ gtk_ctree_new_with_titles (gint columns, g_return_val_if_fail (columns > 0, NULL); g_return_val_if_fail (tree_column >= 0 && tree_column < columns, NULL); - widget = gtk_type_new (GTK_TYPE_CTREE); - gtk_ctree_construct (GTK_CTREE (widget), columns, tree_column, titles); + widget = gtk_widget_new (GTK_TYPE_CTREE, + "n_columns", columns, + "tree_column", tree_column, + NULL); + if (titles) + { + GtkCList *clist = GTK_CLIST (widget); + guint i; + + for (i = 0; i < columns; i++) + gtk_clist_set_column_title (clist, i, titles[i]); + gtk_clist_column_titles_show (clist); + } return widget; } diff --git a/gtk/gtkctree.h b/gtk/gtkctree.h index 96ada2997..b2dd4f39a 100644 --- a/gtk/gtkctree.h +++ b/gtk/gtkctree.h @@ -171,10 +171,6 @@ struct _GtkCTreeNode { ***********************************************************/ GtkType gtk_ctree_get_type (void) G_GNUC_CONST; -void gtk_ctree_construct (GtkCTree *ctree, - gint columns, - gint tree_column, - gchar *titles[]); GtkWidget * gtk_ctree_new_with_titles (gint columns, gint tree_column, gchar *titles[]); diff --git a/gtk/gtkcurve.c b/gtk/gtkcurve.c index 76e5c3091..26d7864e1 100644 --- a/gtk/gtkcurve.c +++ b/gtk/gtkcurve.c @@ -115,7 +115,6 @@ gtk_curve_class_init (GtkCurveClass *class) gtk_signal_new ("curve_type_changed", GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (GtkCurveClass, curve_type_changed), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - gtk_object_class_add_signals (object_class, &curve_type_changed_signal, 1); gtk_object_add_arg_type ("GtkCurve::curve_type", GTK_TYPE_CURVE_TYPE, GTK_ARG_READWRITE, ARG_CURVE_TYPE); diff --git a/gtk/gtkdata.c b/gtk/gtkdata.c index 752017802..1b7d67799 100644 --- a/gtk/gtkdata.c +++ b/gtk/gtkdata.c @@ -79,7 +79,5 @@ gtk_data_class_init (GtkDataClass *class) GTK_SIGNAL_OFFSET (GtkDataClass, disconnect), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, data_signals, LAST_SIGNAL); } diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c index 2c5488111..491e3ae17 100644 --- a/gtk/gtkdialog.c +++ b/gtk/gtkdialog.c @@ -91,6 +91,8 @@ gtk_dialog_class_init (GtkDialogClass *class) parent_class = g_type_class_peek_parent (class); + widget_class->key_press_event = gtk_dialog_key_press; + dialog_signals[RESPONSE] = gtk_signal_new ("response", GTK_RUN_LAST, @@ -99,10 +101,6 @@ gtk_dialog_class_init (GtkDialogClass *class) gtk_marshal_NONE__INT, GTK_TYPE_NONE, 1, GTK_TYPE_INT); - - gtk_object_class_add_signals (object_class, dialog_signals, LAST_SIGNAL); - - widget_class->key_press_event = gtk_dialog_key_press; } static void diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 766b99973..59c15cf05 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -271,7 +271,6 @@ gtk_entry_class_init (GtkEntryClass *class) GObjectClass *gobject_class = G_OBJECT_CLASS (class); GtkObjectClass *object_class; GtkWidgetClass *widget_class; - GtkBindingSet *binding_set; object_class = (GtkObjectClass*) class; @@ -279,6 +278,35 @@ gtk_entry_class_init (GtkEntryClass *class) parent_class = gtk_type_class (GTK_TYPE_WIDGET); gobject_class->finalize = gtk_entry_finalize; + + object_class->set_arg = gtk_entry_set_arg; + object_class->get_arg = gtk_entry_get_arg; + + widget_class->realize = gtk_entry_realize; + widget_class->unrealize = gtk_entry_unrealize; + widget_class->draw_focus = gtk_entry_draw_focus; + widget_class->size_request = gtk_entry_size_request; + widget_class->size_allocate = gtk_entry_size_allocate; + widget_class->expose_event = gtk_entry_expose; + widget_class->button_press_event = gtk_entry_button_press; + widget_class->button_release_event = gtk_entry_button_release; + widget_class->motion_notify_event = gtk_entry_motion_notify; + widget_class->key_press_event = gtk_entry_key_press; + widget_class->focus_in_event = gtk_entry_focus_in; + widget_class->focus_out_event = gtk_entry_focus_out; + widget_class->style_set = gtk_entry_style_set; + widget_class->direction_changed = gtk_entry_direction_changed; + widget_class->state_changed = gtk_entry_state_changed; + + class->insert_text = gtk_entry_real_insert_text; + class->delete_text = gtk_entry_real_delete_text; + class->move_cursor = gtk_entry_move_cursor; + class->insert_at_cursor = gtk_entry_insert_at_cursor; + class->delete_from_cursor = gtk_entry_delete_from_cursor; + class->cut_clipboard = gtk_entry_cut_clipboard; + class->copy_clipboard = gtk_entry_copy_clipboard; + class->paste_clipboard = gtk_entry_paste_clipboard; + class->toggle_overwrite = gtk_entry_toggle_overwrite; gtk_object_add_arg_type ("GtkEntry::text_position", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_TEXT_POSITION); gtk_object_add_arg_type ("GtkEntry::editable", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE); @@ -326,7 +354,6 @@ gtk_entry_class_init (GtkEntryClass *class) GTK_SIGNAL_OFFSET (GtkEntryClass, activate), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - widget_class->activate_signal = signals[ACTIVATE]; signals[MOVE_CURSOR] = @@ -385,8 +412,6 @@ gtk_entry_class_init (GtkEntryClass *class) gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - /* * Key bindings */ @@ -510,35 +535,6 @@ gtk_entry_class_init (GtkEntryClass *class) /* Overwrite */ gtk_binding_entry_add_signal (binding_set, GDK_Insert, 0, "toggle_overwrite", 0); - - object_class->set_arg = gtk_entry_set_arg; - object_class->get_arg = gtk_entry_get_arg; - - widget_class->realize = gtk_entry_realize; - widget_class->unrealize = gtk_entry_unrealize; - widget_class->draw_focus = gtk_entry_draw_focus; - widget_class->size_request = gtk_entry_size_request; - widget_class->size_allocate = gtk_entry_size_allocate; - widget_class->expose_event = gtk_entry_expose; - widget_class->button_press_event = gtk_entry_button_press; - widget_class->button_release_event = gtk_entry_button_release; - widget_class->motion_notify_event = gtk_entry_motion_notify; - widget_class->key_press_event = gtk_entry_key_press; - widget_class->focus_in_event = gtk_entry_focus_in; - widget_class->focus_out_event = gtk_entry_focus_out; - widget_class->style_set = gtk_entry_style_set; - widget_class->direction_changed = gtk_entry_direction_changed; - widget_class->state_changed = gtk_entry_state_changed; - - class->insert_text = gtk_entry_real_insert_text; - class->delete_text = gtk_entry_real_delete_text; - class->move_cursor = gtk_entry_move_cursor; - class->insert_at_cursor = gtk_entry_insert_at_cursor; - class->delete_from_cursor = gtk_entry_delete_from_cursor; - class->cut_clipboard = gtk_entry_cut_clipboard; - class->copy_clipboard = gtk_entry_copy_clipboard; - class->paste_clipboard = gtk_entry_paste_clipboard; - class->toggle_overwrite = gtk_entry_toggle_overwrite; } static void diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c index a7ef0415d..c834ef459 100644 --- a/gtk/gtkhandlebox.c +++ b/gtk/gtkhandlebox.c @@ -176,23 +176,6 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class) object_class->set_arg = gtk_handle_box_set_arg; object_class->get_arg = gtk_handle_box_get_arg; - handle_box_signals[SIGNAL_CHILD_ATTACHED] = - gtk_signal_new ("child_attached", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkHandleBoxClass, child_attached), - gtk_marshal_VOID__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_WIDGET); - handle_box_signals[SIGNAL_CHILD_DETACHED] = - gtk_signal_new ("child_detached", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkHandleBoxClass, child_detached), - gtk_marshal_VOID__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_WIDGET); - gtk_object_class_add_signals (object_class, handle_box_signals, SIGNAL_LAST); object_class->destroy = gtk_handle_box_destroy; @@ -214,6 +197,23 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class) class->child_attached = NULL; class->child_detached = NULL; + + handle_box_signals[SIGNAL_CHILD_ATTACHED] = + gtk_signal_new ("child_attached", + GTK_RUN_FIRST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GtkHandleBoxClass, child_attached), + gtk_marshal_VOID__POINTER, + GTK_TYPE_NONE, 1, + GTK_TYPE_WIDGET); + handle_box_signals[SIGNAL_CHILD_DETACHED] = + gtk_signal_new ("child_detached", + GTK_RUN_FIRST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GtkHandleBoxClass, child_detached), + gtk_marshal_VOID__POINTER, + GTK_TYPE_NONE, 1, + GTK_TYPE_WIDGET); } static void diff --git a/gtk/gtkhsv.c b/gtk/gtkhsv.c index 7b1af385e..e4d0bcc85 100644 --- a/gtk/gtkhsv.c +++ b/gtk/gtkhsv.c @@ -145,14 +145,6 @@ gtk_hsv_class_init (GtkHSVClass *class) parent_class = gtk_type_class (GTK_TYPE_WIDGET); - hsv_signals[CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkHSVClass, changed), - gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); - gtk_object_class_add_signals (object_class, hsv_signals, LAST_SIGNAL); object_class->destroy = gtk_hsv_destroy; @@ -166,6 +158,14 @@ gtk_hsv_class_init (GtkHSVClass *class) widget_class->button_release_event = gtk_hsv_button_release; widget_class->motion_notify_event = gtk_hsv_motion; widget_class->expose_event = gtk_hsv_expose; + + hsv_signals[CHANGED] = + gtk_signal_new ("changed", + GTK_RUN_FIRST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GtkHSVClass, changed), + gtk_marshal_VOID__VOID, + GTK_TYPE_NONE, 0); } /* Object initialization function for the HSV color selector */ diff --git a/gtk/gtkimcontext.c b/gtk/gtkimcontext.c index 6d619470c..9475d0505 100644 --- a/gtk/gtkimcontext.c +++ b/gtk/gtkimcontext.c @@ -72,6 +72,9 @@ gtk_im_context_class_init (GtkIMContextClass *klass) object_class = (GtkObjectClass*) klass; + klass->get_preedit_string = gtk_im_context_real_get_preedit_string; + klass->filter_keypress = gtk_im_context_real_filter_keypress; + im_context_signals[PREEDIT_START] = gtk_signal_new ("preedit_start", GTK_RUN_LAST, @@ -104,11 +107,6 @@ gtk_im_context_class_init (GtkIMContextClass *klass) gtk_marshal_VOID__POINTER, GTK_TYPE_NONE, 1, GTK_TYPE_STRING); - - klass->get_preedit_string = gtk_im_context_real_get_preedit_string; - klass->filter_keypress = gtk_im_context_real_filter_keypress; - - gtk_object_class_add_signals (object_class, im_context_signals, LAST_SIGNAL); } static void diff --git a/gtk/gtkinputdialog.c b/gtk/gtkinputdialog.c index 873292189..e150f66d7 100644 --- a/gtk/gtkinputdialog.c +++ b/gtk/gtkinputdialog.c @@ -138,6 +138,9 @@ gtk_input_dialog_class_init (GtkInputDialogClass *klass) parent_class = gtk_type_class (GTK_TYPE_DIALOG); + klass->enable_device = NULL; + klass->disable_device = NULL; + input_dialog_signals[ENABLE_DEVICE] = gtk_signal_new ("enable_device", GTK_RUN_LAST, @@ -153,13 +156,6 @@ gtk_input_dialog_class_init (GtkInputDialogClass *klass) GTK_SIGNAL_OFFSET (GtkInputDialogClass, disable_device), gtk_marshal_VOID__POINTER, GTK_TYPE_NONE, 1, GTK_TYPE_POINTER); - - gtk_object_class_add_signals (object_class, input_dialog_signals, - LAST_SIGNAL); - - - klass->enable_device = NULL; - klass->disable_device = NULL; } static void diff --git a/gtk/gtkitem.c b/gtk/gtkitem.c index b3b7e0a5e..b8d6c7f3c 100644 --- a/gtk/gtkitem.c +++ b/gtk/gtkitem.c @@ -84,6 +84,17 @@ gtk_item_class_init (GtkItemClass *class) object_class = (GtkObjectClass*) class; widget_class = (GtkWidgetClass*) class; + + widget_class->map = gtk_item_map; + widget_class->unmap = gtk_item_unmap; + widget_class->realize = gtk_item_realize; + widget_class->enter_notify_event = gtk_item_enter; + widget_class->leave_notify_event = gtk_item_leave; + + class->select = NULL; + class->deselect = NULL; + class->toggle = NULL; + item_signals[SELECT] = gtk_signal_new ("select", GTK_RUN_FIRST, @@ -105,19 +116,7 @@ gtk_item_class_init (GtkItemClass *class) GTK_SIGNAL_OFFSET (GtkItemClass, toggle), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, item_signals, LAST_SIGNAL); - widget_class->activate_signal = item_signals[TOGGLE]; - widget_class->map = gtk_item_map; - widget_class->unmap = gtk_item_unmap; - widget_class->realize = gtk_item_realize; - widget_class->enter_notify_event = gtk_item_enter; - widget_class->leave_notify_event = gtk_item_leave; - - class->select = NULL; - class->deselect = NULL; - class->toggle = NULL; } static void diff --git a/gtk/gtklist.c b/gtk/gtklist.c index ced05ccda..8698b1303 100644 --- a/gtk/gtklist.c +++ b/gtk/gtklist.c @@ -214,31 +214,6 @@ gtk_list_class_init (GtkListClass *class) gobject_class->shutdown = gtk_list_shutdown; - list_signals[SELECTION_CHANGED] = - gtk_signal_new ("selection_changed", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkListClass, selection_changed), - gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); - list_signals[SELECT_CHILD] = - gtk_signal_new ("select_child", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkListClass, select_child), - gtk_marshal_VOID__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_WIDGET); - list_signals[UNSELECT_CHILD] = - gtk_signal_new ("unselect_child", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkListClass, unselect_child), - gtk_marshal_VOID__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_WIDGET); - - gtk_object_class_add_signals (object_class, list_signals, LAST_SIGNAL); object_class->set_arg = gtk_list_set_arg; object_class->get_arg = gtk_list_get_arg; @@ -265,6 +240,30 @@ gtk_list_class_init (GtkListClass *class) class->selection_changed = NULL; class->select_child = gtk_real_list_select_child; class->unselect_child = gtk_real_list_unselect_child; + + list_signals[SELECTION_CHANGED] = + gtk_signal_new ("selection_changed", + GTK_RUN_FIRST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GtkListClass, selection_changed), + gtk_marshal_VOID__VOID, + GTK_TYPE_NONE, 0); + list_signals[SELECT_CHILD] = + gtk_signal_new ("select_child", + GTK_RUN_FIRST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GtkListClass, select_child), + gtk_marshal_VOID__POINTER, + GTK_TYPE_NONE, 1, + GTK_TYPE_WIDGET); + list_signals[UNSELECT_CHILD] = + gtk_signal_new ("unselect_child", + GTK_RUN_FIRST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GtkListClass, unselect_child), + gtk_marshal_VOID__POINTER, + GTK_TYPE_NONE, 1, + GTK_TYPE_WIDGET); gtk_object_add_arg_type ("GtkList::selection_mode", GTK_TYPE_SELECTION_MODE, GTK_ARG_READWRITE, diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c index 9ca79f538..2deb15d2b 100644 --- a/gtk/gtklistitem.c +++ b/gtk/gtklistitem.c @@ -113,6 +113,31 @@ gtk_list_item_class_init (GtkListItemClass *class) parent_class = gtk_type_class (gtk_item_get_type ()); + widget_class->realize = gtk_list_item_realize; + widget_class->size_request = gtk_list_item_size_request; + widget_class->size_allocate = gtk_list_item_size_allocate; + widget_class->style_set = gtk_list_item_style_set; + widget_class->draw_focus = gtk_list_item_draw_focus; + widget_class->button_press_event = gtk_list_item_button_press; + widget_class->expose_event = gtk_list_item_expose; + widget_class->focus_in_event = gtk_list_item_focus_in; + widget_class->focus_out_event = gtk_list_item_focus_out; + + item_class->select = gtk_real_list_item_select; + item_class->deselect = gtk_real_list_item_deselect; + item_class->toggle = gtk_real_list_item_toggle; + + class->toggle_focus_row = NULL; + class->select_all = NULL; + class->unselect_all = NULL; + class->undo_selection = NULL; + class->start_selection = NULL; + class->end_selection = NULL; + class->extend_selection = NULL; + class->scroll_horizontal = NULL; + class->scroll_vertical = NULL; + class->toggle_add_mode = NULL; + list_item_signals[TOGGLE_FOCUS_ROW] = gtk_signal_new ("toggle_focus_row", GTK_RUN_LAST | GTK_RUN_ACTION, @@ -185,34 +210,6 @@ gtk_list_item_class_init (GtkListItemClass *class) gtk_marshal_VOID__ENUM_FLOAT, GTK_TYPE_NONE, 2, GTK_TYPE_SCROLL_TYPE, GTK_TYPE_FLOAT); - gtk_object_class_add_signals (object_class, list_item_signals, LAST_SIGNAL); - - widget_class->realize = gtk_list_item_realize; - widget_class->size_request = gtk_list_item_size_request; - widget_class->size_allocate = gtk_list_item_size_allocate; - widget_class->style_set = gtk_list_item_style_set; - widget_class->draw_focus = gtk_list_item_draw_focus; - widget_class->button_press_event = gtk_list_item_button_press; - widget_class->expose_event = gtk_list_item_expose; - widget_class->focus_in_event = gtk_list_item_focus_in; - widget_class->focus_out_event = gtk_list_item_focus_out; - - item_class->select = gtk_real_list_item_select; - item_class->deselect = gtk_real_list_item_deselect; - item_class->toggle = gtk_real_list_item_toggle; - - class->toggle_focus_row = NULL; - class->select_all = NULL; - class->unselect_all = NULL; - class->undo_selection = NULL; - class->start_selection = NULL; - class->end_selection = NULL; - class->extend_selection = NULL; - class->scroll_horizontal = NULL; - class->scroll_vertical = NULL; - class->toggle_add_mode = NULL; - - binding_set = gtk_binding_set_by_class (class); gtk_binding_entry_add_signal (binding_set, GDK_Up, 0, "scroll_vertical", 2, diff --git a/gtk/gtkliststore.c b/gtk/gtkliststore.c index 063a844b5..8a90656a7 100644 --- a/gtk/gtkliststore.c +++ b/gtk/gtkliststore.c @@ -147,9 +147,6 @@ gtk_list_store_class_init (GtkListStoreClass *class) gtk_marshal_VOID__BOXED, G_TYPE_NONE, 1, GTK_TYPE_TREE_PATH); - - - gtk_object_class_add_signals (object_class, list_store_signals, LAST_SIGNAL); } static void diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c index 7069af9c3..5f2458528 100644 --- a/gtk/gtkmenuitem.c +++ b/gtk/gtkmenuitem.c @@ -129,6 +129,27 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass) parent_class = gtk_type_class (gtk_item_get_type ()); + + object_class->destroy = gtk_menu_item_destroy; + + widget_class->size_request = gtk_menu_item_size_request; + widget_class->size_allocate = gtk_menu_item_size_allocate; + widget_class->expose_event = gtk_menu_item_expose; + widget_class->show_all = gtk_menu_item_show_all; + widget_class->hide_all = gtk_menu_item_hide_all; + + container_class->forall = gtk_menu_item_forall; + + item_class->select = gtk_real_menu_item_select; + item_class->deselect = gtk_real_menu_item_deselect; + + klass->activate = NULL; + klass->activate_item = gtk_real_menu_item_activate_item; + klass->toggle_size_request = gtk_real_menu_item_toggle_size_request; + klass->toggle_size_allocate = gtk_real_menu_item_toggle_size_allocate; + + klass->hide_on_activate = TRUE; + menu_item_signals[ACTIVATE] = gtk_signal_new ("activate", GTK_RUN_FIRST | GTK_RUN_ACTION, @@ -136,6 +157,7 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass) GTK_SIGNAL_OFFSET (GtkMenuItemClass, activate), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); + widget_class->activate_signal = menu_item_signals[ACTIVATE]; menu_item_signals[ACTIVATE_ITEM] = gtk_signal_new ("activate_item", @@ -162,29 +184,6 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass) gtk_marshal_NONE__UINT, GTK_TYPE_NONE, 1, GTK_TYPE_UINT); - - gtk_object_class_add_signals (object_class, menu_item_signals, LAST_SIGNAL); - - object_class->destroy = gtk_menu_item_destroy; - - widget_class->activate_signal = menu_item_signals[ACTIVATE]; - widget_class->size_request = gtk_menu_item_size_request; - widget_class->size_allocate = gtk_menu_item_size_allocate; - widget_class->expose_event = gtk_menu_item_expose; - widget_class->show_all = gtk_menu_item_show_all; - widget_class->hide_all = gtk_menu_item_hide_all; - - container_class->forall = gtk_menu_item_forall; - - item_class->select = gtk_real_menu_item_select; - item_class->deselect = gtk_real_menu_item_deselect; - - klass->activate = NULL; - klass->activate_item = gtk_real_menu_item_activate_item; - klass->toggle_size_request = gtk_real_menu_item_toggle_size_request; - klass->toggle_size_allocate = gtk_real_menu_item_toggle_size_allocate; - - klass->hide_on_activate = TRUE; } static void diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c index bb3e7f789..145b7b752 100644 --- a/gtk/gtkmenushell.c +++ b/gtk/gtkmenushell.c @@ -192,6 +192,28 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass) parent_class = gtk_type_class (gtk_container_get_type ()); + widget_class->map = gtk_menu_shell_map; + widget_class->realize = gtk_menu_shell_realize; + widget_class->button_press_event = gtk_menu_shell_button_press; + widget_class->button_release_event = gtk_menu_shell_button_release; + widget_class->key_press_event = gtk_menu_shell_key_press; + widget_class->enter_notify_event = gtk_menu_shell_enter_notify; + widget_class->leave_notify_event = gtk_menu_shell_leave_notify; + + container_class->add = gtk_menu_shell_add; + container_class->remove = gtk_menu_shell_remove; + container_class->forall = gtk_menu_shell_forall; + container_class->child_type = gtk_menu_shell_child_type; + + klass->submenu_placement = GTK_TOP_BOTTOM; + klass->deactivate = gtk_real_menu_shell_deactivate; + klass->selection_done = NULL; + klass->move_current = gtk_real_menu_shell_move_current; + klass->activate_current = gtk_real_menu_shell_activate_current; + klass->cancel = gtk_real_menu_shell_cancel; + klass->select_item = gtk_menu_shell_real_select_item; + klass->insert = gtk_menu_shell_real_insert; + menu_shell_signals[DEACTIVATE] = gtk_signal_new ("deactivate", GTK_RUN_FIRST, @@ -229,30 +251,6 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass) GTK_SIGNAL_OFFSET (GtkMenuShellClass, cancel), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, menu_shell_signals, LAST_SIGNAL); - - widget_class->map = gtk_menu_shell_map; - widget_class->realize = gtk_menu_shell_realize; - widget_class->button_press_event = gtk_menu_shell_button_press; - widget_class->button_release_event = gtk_menu_shell_button_release; - widget_class->key_press_event = gtk_menu_shell_key_press; - widget_class->enter_notify_event = gtk_menu_shell_enter_notify; - widget_class->leave_notify_event = gtk_menu_shell_leave_notify; - - container_class->add = gtk_menu_shell_add; - container_class->remove = gtk_menu_shell_remove; - container_class->forall = gtk_menu_shell_forall; - container_class->child_type = gtk_menu_shell_child_type; - - klass->submenu_placement = GTK_TOP_BOTTOM; - klass->deactivate = gtk_real_menu_shell_deactivate; - klass->selection_done = NULL; - klass->move_current = gtk_real_menu_shell_move_current; - klass->activate_current = gtk_real_menu_shell_activate_current; - klass->cancel = gtk_real_menu_shell_cancel; - klass->select_item = gtk_menu_shell_real_select_item; - klass->insert = gtk_menu_shell_real_insert; binding_set = gtk_binding_set_by_class (klass); gtk_binding_entry_add_signal (binding_set, diff --git a/gtk/gtkmodelsimple.c b/gtk/gtkmodelsimple.c index 13ab8f232..c69ece96f 100644 --- a/gtk/gtkmodelsimple.c +++ b/gtk/gtkmodelsimple.c @@ -260,8 +260,6 @@ gtk_model_simple_class_init (GtkModelSimpleClass *class) G_TYPE_BOOLEAN, 2, GTK_TYPE_TREE_ITER, GTK_TYPE_TREE_ITER); - - gtk_object_class_add_signals (object_class, model_simple_signals, LAST_SIGNAL); } static void diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 424fd869d..fecef3b6b 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -280,34 +280,6 @@ gtk_notebook_class_init (GtkNotebookClass *class) container_class = (GtkContainerClass*) class; parent_class = gtk_type_class (gtk_container_get_type ()); - gtk_object_add_arg_type ("GtkNotebook::page", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_PAGE); - gtk_object_add_arg_type ("GtkNotebook::tab_pos", GTK_TYPE_POSITION_TYPE, GTK_ARG_READWRITE, ARG_TAB_POS); - gtk_object_add_arg_type ("GtkNotebook::tab_border", GTK_TYPE_UINT, GTK_ARG_WRITABLE, ARG_TAB_BORDER); - gtk_object_add_arg_type ("GtkNotebook::tab_hborder", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_TAB_HBORDER); - gtk_object_add_arg_type ("GtkNotebook::tab_vborder", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_TAB_VBORDER); - gtk_object_add_arg_type ("GtkNotebook::show_tabs", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_SHOW_TABS); - gtk_object_add_arg_type ("GtkNotebook::show_border", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_SHOW_BORDER); - gtk_object_add_arg_type ("GtkNotebook::scrollable", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_SCROLLABLE); - gtk_object_add_arg_type ("GtkNotebook::enable_popup", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ENABLE_POPUP); - gtk_object_add_arg_type ("GtkNotebook::homogeneous", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HOMOGENEOUS); - - gtk_container_add_child_arg_type ("GtkNotebook::tab_label", GTK_TYPE_STRING, GTK_ARG_READWRITE, CHILD_ARG_TAB_LABEL); - gtk_container_add_child_arg_type ("GtkNotebook::menu_label", GTK_TYPE_STRING, GTK_ARG_READWRITE, CHILD_ARG_MENU_LABEL); - gtk_container_add_child_arg_type ("GtkNotebook::position", GTK_TYPE_INT, GTK_ARG_READWRITE, CHILD_ARG_POSITION); - gtk_container_add_child_arg_type ("GtkNotebook::tab_fill", GTK_TYPE_BOOL, GTK_ARG_READWRITE, CHILD_ARG_TAB_FILL); - gtk_container_add_child_arg_type ("GtkNotebook::tab_pack", GTK_TYPE_BOOL, GTK_ARG_READWRITE, CHILD_ARG_TAB_PACK); - - notebook_signals[SWITCH_PAGE] = - gtk_signal_new ("switch_page", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkNotebookClass, switch_page), - gtk_marshal_VOID__POINTER_UINT, - GTK_TYPE_NONE, 2, - GTK_TYPE_POINTER, - GTK_TYPE_UINT); - - gtk_object_class_add_signals (object_class, notebook_signals, LAST_SIGNAL); object_class->set_arg = gtk_notebook_set_arg; object_class->get_arg = gtk_notebook_get_arg; @@ -341,6 +313,33 @@ gtk_notebook_class_init (GtkNotebookClass *class) container_class->child_type = gtk_notebook_child_type; class->switch_page = gtk_notebook_real_switch_page; + + gtk_object_add_arg_type ("GtkNotebook::page", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_PAGE); + gtk_object_add_arg_type ("GtkNotebook::tab_pos", GTK_TYPE_POSITION_TYPE, GTK_ARG_READWRITE, ARG_TAB_POS); + gtk_object_add_arg_type ("GtkNotebook::tab_border", GTK_TYPE_UINT, GTK_ARG_WRITABLE, ARG_TAB_BORDER); + gtk_object_add_arg_type ("GtkNotebook::tab_hborder", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_TAB_HBORDER); + gtk_object_add_arg_type ("GtkNotebook::tab_vborder", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_TAB_VBORDER); + gtk_object_add_arg_type ("GtkNotebook::show_tabs", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_SHOW_TABS); + gtk_object_add_arg_type ("GtkNotebook::show_border", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_SHOW_BORDER); + gtk_object_add_arg_type ("GtkNotebook::scrollable", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_SCROLLABLE); + gtk_object_add_arg_type ("GtkNotebook::enable_popup", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ENABLE_POPUP); + gtk_object_add_arg_type ("GtkNotebook::homogeneous", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HOMOGENEOUS); + + gtk_container_add_child_arg_type ("GtkNotebook::tab_label", GTK_TYPE_STRING, GTK_ARG_READWRITE, CHILD_ARG_TAB_LABEL); + gtk_container_add_child_arg_type ("GtkNotebook::menu_label", GTK_TYPE_STRING, GTK_ARG_READWRITE, CHILD_ARG_MENU_LABEL); + gtk_container_add_child_arg_type ("GtkNotebook::position", GTK_TYPE_INT, GTK_ARG_READWRITE, CHILD_ARG_POSITION); + gtk_container_add_child_arg_type ("GtkNotebook::tab_fill", GTK_TYPE_BOOL, GTK_ARG_READWRITE, CHILD_ARG_TAB_FILL); + gtk_container_add_child_arg_type ("GtkNotebook::tab_pack", GTK_TYPE_BOOL, GTK_ARG_READWRITE, CHILD_ARG_TAB_PACK); + + notebook_signals[SWITCH_PAGE] = + gtk_signal_new ("switch_page", + GTK_RUN_LAST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GtkNotebookClass, switch_page), + gtk_marshal_VOID__POINTER_UINT, + GTK_TYPE_NONE, 2, + GTK_TYPE_POINTER, + GTK_TYPE_UINT); } static void diff --git a/gtk/gtkobject.c b/gtk/gtkobject.c index c1df707cb..ff9c08173 100644 --- a/gtk/gtkobject.c +++ b/gtk/gtkobject.c @@ -36,12 +36,8 @@ enum { LAST_SIGNAL }; enum { - ARG_0, - ARG_USER_DATA, - ARG_SIGNAL, - ARG_SIGNAL_AFTER, - ARG_OBJECT_SIGNAL, - ARG_OBJECT_SIGNAL_AFTER + PROP_0, + PROP_USER_DATA, }; @@ -51,12 +47,16 @@ static void gtk_object_base_class_finalize (GtkObjectClass *class); static void gtk_object_class_init (GtkObjectClass *klass); static void gtk_object_init (GtkObject *object, GtkObjectClass *klass); -static void gtk_object_set_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); -static void gtk_object_get_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); +static void gtk_object_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec, + const gchar *trailer); +static void gtk_object_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec, + const gchar *trailer); static void gtk_object_shutdown (GObject *object); static void gtk_object_real_destroy (GtkObject *object); static void gtk_object_finalize (GObject *object); @@ -64,10 +64,8 @@ static void gtk_object_notify_weaks (GtkObject *object); static gpointer parent_class = NULL; static guint object_signals[LAST_SIGNAL] = { 0 }; -static GHashTable *object_arg_info_ht = NULL; static GQuark quark_user_data = 0; static GQuark quark_weakrefs = 0; -static GQuark quark_carg_history = 0; /**************************************************** @@ -104,12 +102,6 @@ gtk_object_get_type (void) static void gtk_object_base_class_init (GtkObjectClass *class) { - /* reset instance specific fields that don't get inherited */ - class->signals = NULL; - class->nsignals = 0; - class->n_args = 0; - class->construct_args = NULL; - /* reset instance specifc methods that don't get inherited */ class->get_arg = NULL; class->set_arg = NULL; @@ -118,8 +110,201 @@ gtk_object_base_class_init (GtkObjectClass *class) static void gtk_object_base_class_finalize (GtkObjectClass *class) { - g_free (class->signals); - g_return_if_fail (class->construct_args == NULL); +} + +static inline gboolean +gtk_arg_set_from_value (GtkArg *arg, + const GValue *value, + gboolean copy_string) +{ + switch (G_TYPE_FUNDAMENTAL (arg->type)) + { + case G_TYPE_CHAR: GTK_VALUE_CHAR (*arg) = g_value_get_char (value); break; + case G_TYPE_UCHAR: GTK_VALUE_UCHAR (*arg) = g_value_get_uchar (value); break; + case G_TYPE_BOOLEAN: GTK_VALUE_BOOL (*arg) = g_value_get_boolean (value); break; + case G_TYPE_INT: GTK_VALUE_INT (*arg) = g_value_get_int (value); break; + case G_TYPE_UINT: GTK_VALUE_UINT (*arg) = g_value_get_uint (value); break; + case G_TYPE_LONG: GTK_VALUE_LONG (*arg) = g_value_get_long (value); break; + case G_TYPE_ULONG: GTK_VALUE_ULONG (*arg) = g_value_get_ulong (value); break; + case G_TYPE_ENUM: GTK_VALUE_ENUM (*arg) = g_value_get_enum (value); break; + case G_TYPE_FLAGS: GTK_VALUE_FLAGS (*arg) = g_value_get_flags (value); break; + case G_TYPE_FLOAT: GTK_VALUE_FLOAT (*arg) = g_value_get_float (value); break; + case G_TYPE_DOUBLE: GTK_VALUE_DOUBLE (*arg) = g_value_get_double (value); break; + case G_TYPE_BOXED: GTK_VALUE_BOXED (*arg) = g_value_get_boxed (value); break; + case G_TYPE_POINTER: GTK_VALUE_POINTER (*arg) = g_value_get_pointer (value); break; + case G_TYPE_OBJECT: GTK_VALUE_POINTER (*arg) = g_value_get_object (value); break; + case G_TYPE_STRING: if (copy_string) + GTK_VALUE_STRING (*arg) = g_value_dup_string (value); + else + GTK_VALUE_STRING (*arg) = g_value_get_string (value); + break; + default: + return FALSE; + } + return TRUE; +} + +static inline gboolean +gtk_arg_to_value (GtkArg *arg, + GValue *value) +{ + switch (G_TYPE_FUNDAMENTAL (arg->type)) + { + case G_TYPE_CHAR: g_value_set_char (value, GTK_VALUE_CHAR (*arg)); break; + case G_TYPE_UCHAR: g_value_set_uchar (value, GTK_VALUE_UCHAR (*arg)); break; + case G_TYPE_BOOLEAN: g_value_set_boolean (value, GTK_VALUE_BOOL (*arg)); break; + case G_TYPE_INT: g_value_set_int (value, GTK_VALUE_INT (*arg)); break; + case G_TYPE_UINT: g_value_set_uint (value, GTK_VALUE_UINT (*arg)); break; + case G_TYPE_LONG: g_value_set_long (value, GTK_VALUE_LONG (*arg)); break; + case G_TYPE_ULONG: g_value_set_ulong (value, GTK_VALUE_ULONG (*arg)); break; + case G_TYPE_ENUM: g_value_set_enum (value, GTK_VALUE_ENUM (*arg)); break; + case G_TYPE_FLAGS: g_value_set_flags (value, GTK_VALUE_FLAGS (*arg)); break; + case G_TYPE_FLOAT: g_value_set_float (value, GTK_VALUE_FLOAT (*arg)); break; + case G_TYPE_DOUBLE: g_value_set_double (value, GTK_VALUE_DOUBLE (*arg)); break; + case G_TYPE_STRING: g_value_set_string (value, GTK_VALUE_STRING (*arg)); break; + case G_TYPE_BOXED: g_value_set_boxed (value, GTK_VALUE_BOXED (*arg)); break; + case G_TYPE_POINTER: g_value_set_pointer (value, GTK_VALUE_POINTER (*arg)); break; + case G_TYPE_OBJECT: g_value_set_object (value, GTK_VALUE_POINTER (*arg)); break; + default: + return FALSE; + } + return TRUE; +} + +static void +gtk_arg_proxy_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec, + const gchar *trailer) +{ + GtkObjectClass *class = g_type_class_peek (pspec->owner_type); + GtkArg arg = { 0, }; + + g_return_if_fail (class->set_arg != NULL); + + arg.type = G_VALUE_TYPE (value); + gtk_arg_set_from_value (&arg, value, FALSE); + arg.name = pspec->name; + class->set_arg (GTK_OBJECT (object), &arg, property_id); +} + +static void +gtk_arg_proxy_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec, + const gchar *trailer) +{ + GtkObjectClass *class = g_type_class_peek (pspec->owner_type); + GtkArg arg = { 0, }; + + g_return_if_fail (class->get_arg != NULL); + + arg.type = G_VALUE_TYPE (value); + arg.name = pspec->name; + class->get_arg (GTK_OBJECT (object), &arg, property_id); + gtk_arg_to_value (&arg, value); +} + +void +gtk_object_add_arg_type (const gchar *arg_name, + GtkType arg_type, + guint arg_flags, + guint arg_id) +{ + GObjectClass *oclass; + GParamSpec *pspec; + gchar *type_name, *pname; + GType type; + + g_return_if_fail (arg_name != NULL); + g_return_if_fail (arg_type > G_TYPE_NONE); + g_return_if_fail (arg_id > 0); + g_return_if_fail (arg_flags & GTK_ARG_READWRITE); + if (arg_flags & G_PARAM_CONSTRUCT) + g_return_if_fail ((arg_flags & G_PARAM_CONSTRUCT_ONLY) == 0); + if (arg_flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY)) + g_return_if_fail (arg_flags & G_PARAM_WRITABLE); + g_return_if_fail ((arg_flags & ~(GTK_ARG_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY)) == 0); + + pname = strchr (arg_name, ':'); + g_return_if_fail (pname && pname[1] == ':'); + + type_name = g_strndup (arg_name, pname - arg_name); + pname += 2; + type = g_type_from_name (type_name); + g_free (type_name); + g_return_if_fail (G_TYPE_IS_OBJECT (type)); + + oclass = gtk_type_class (type); + if (arg_flags & GTK_ARG_READABLE) + { + if (oclass->get_property && oclass->get_property != gtk_arg_proxy_get_property) + { + g_warning (G_STRLOC ": GtkArg compatibility code can't be mixed with customized %s.get_property() implementation", + g_type_name (type)); + return; + } + oclass->get_property = gtk_arg_proxy_get_property; + } + if (arg_flags & GTK_ARG_WRITABLE) + { + if (oclass->set_property && oclass->set_property != gtk_arg_proxy_set_property) + { + g_warning (G_STRLOC ": GtkArg compatibility code can't be mixed with customized %s.set_property() implementation", + g_type_name (type)); + return; + } + oclass->set_property = gtk_arg_proxy_set_property; + } + switch (G_TYPE_FUNDAMENTAL (arg_type)) + { + case G_TYPE_ENUM: + pspec = g_param_spec_enum (pname, NULL, NULL, arg_type, 0, arg_flags); + break; + case G_TYPE_FLAGS: + pspec = g_param_spec_flags (pname, NULL, NULL, arg_type, 0, arg_flags); + break; + case G_TYPE_CHAR: + pspec = g_param_spec_char (pname, NULL, NULL, -128, 127, 0, arg_flags); + break; + case G_TYPE_UCHAR: + pspec = g_param_spec_uchar (pname, NULL, NULL, 0, 255, 0, arg_flags); + break; + case G_TYPE_BOOLEAN: + pspec = g_param_spec_boolean (pname, NULL, NULL, FALSE, arg_flags); + break; + case G_TYPE_INT: + pspec = g_param_spec_int (pname, NULL, NULL, -2147483647, 2147483647, 0, arg_flags); + break; + case G_TYPE_UINT: + pspec = g_param_spec_uint (pname, NULL, NULL, 0, 4294967295U, 0, arg_flags); + break; + case G_TYPE_FLOAT: + pspec = g_param_spec_float (pname, NULL, NULL, -1E+37, 1E+37, 0, arg_flags); + break; + case G_TYPE_DOUBLE: + pspec = g_param_spec_double (pname, NULL, NULL, -1E+307, 1E+307, 0, arg_flags); + break; + case G_TYPE_STRING: + pspec = g_param_spec_string (pname, NULL, NULL, NULL, arg_flags); + break; + case G_TYPE_OBJECT: + pspec = g_param_spec_object (pname, NULL, NULL, arg_type, arg_flags); + break; + case G_TYPE_BOXED: + if (!G_TYPE_IS_FUNDAMENTAL (arg_type)) + { + pspec = g_param_spec_boxed (pname, NULL, NULL, arg_type, arg_flags); + break; + } + default: + g_warning (G_STRLOC ": Property type `%s' is not supported by the GtkArg compatibility code", + g_type_name (arg_type)); + return; + } + g_object_class_install_property (oclass, arg_id, pspec); } static void @@ -129,36 +314,18 @@ gtk_object_class_init (GtkObjectClass *class) parent_class = g_type_class_ref (G_TYPE_OBJECT); + gobject_class->set_property = gtk_object_set_property; + gobject_class->get_property = gtk_object_get_property; gobject_class->shutdown = gtk_object_shutdown; gobject_class->finalize = gtk_object_finalize; - class->get_arg = gtk_object_get_arg; - class->set_arg = gtk_object_set_arg; class->destroy = gtk_object_real_destroy; - quark_carg_history = g_quark_from_static_string ("gtk-construct-arg-history"); - - gtk_object_add_arg_type ("GtkObject::user_data", - GTK_TYPE_POINTER, - GTK_ARG_READWRITE, - ARG_USER_DATA); - gtk_object_add_arg_type ("GtkObject::signal", - GTK_TYPE_SIGNAL, - GTK_ARG_WRITABLE, - ARG_SIGNAL); - gtk_object_add_arg_type ("GtkObject::signal_after", - GTK_TYPE_SIGNAL, - GTK_ARG_WRITABLE, - ARG_SIGNAL_AFTER); - gtk_object_add_arg_type ("GtkObject::object_signal", - GTK_TYPE_SIGNAL, - GTK_ARG_WRITABLE, - ARG_OBJECT_SIGNAL); - gtk_object_add_arg_type ("GtkObject::object_signal_after", - GTK_TYPE_SIGNAL, - GTK_ARG_WRITABLE, - ARG_OBJECT_SIGNAL_AFTER); - + g_object_class_install_property (gobject_class, + PROP_USER_DATA, + g_param_spec_pointer ("user_data", "User Data", + "Anonymous User Data Pointer", + G_PARAM_READABLE | G_PARAM_WRITABLE)); object_signals[DESTROY] = gtk_signal_new ("destroy", G_SIGNAL_RUN_CLEANUP | G_SIGNAL_NO_RECURSE | GTK_RUN_NO_HOOKS, @@ -166,25 +333,13 @@ gtk_object_class_init (GtkObjectClass *class) GTK_SIGNAL_OFFSET (GtkObjectClass, destroy), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (class, object_signals, LAST_SIGNAL); } static void gtk_object_init (GtkObject *object, GtkObjectClass *klass) { - gboolean needs_construction = FALSE; - GTK_OBJECT_FLAGS (object) = GTK_FLOATING; - do - { - needs_construction |= klass->construct_args != NULL; - klass = g_type_class_peek_parent (klass); - } - while (klass && GTK_IS_OBJECT_CLASS (klass) && !needs_construction); - if (!needs_construction) - GTK_OBJECT_FLAGS (object) |= GTK_CONSTRUCTED; } /******************************************** @@ -196,7 +351,6 @@ gtk_object_destroy (GtkObject *object) { g_return_if_fail (object != NULL); g_return_if_fail (GTK_IS_OBJECT (object)); - g_return_if_fail (GTK_OBJECT_CONSTRUCTED (object)); if (!GTK_OBJECT_DESTROYED (object)) { @@ -251,171 +405,44 @@ gtk_object_finalize (GObject *gobject) *****************************************/ static void -gtk_object_set_arg (GtkObject *object, - GtkArg *arg, - guint arg_id) +gtk_object_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec, + const gchar *trailer) { - guint n = 0; - - switch (arg_id) + switch (property_id) { - gchar *arg_name; - - case ARG_USER_DATA: - gtk_object_set_user_data (object, GTK_VALUE_POINTER (*arg)); - break; - case ARG_OBJECT_SIGNAL_AFTER: - n += 6; - case ARG_OBJECT_SIGNAL: - n += 1; - case ARG_SIGNAL_AFTER: - n += 6; - case ARG_SIGNAL: - n += 6; - arg_name = gtk_arg_name_strip_type (arg->name); - if (arg_name && - arg_name[n] == ':' && - arg_name[n + 1] == ':' && - arg_name[n + 2] != 0) - { - gtk_signal_connect_full (object, - arg_name + n + 2, - GTK_VALUE_SIGNAL (*arg).f, NULL, - GTK_VALUE_SIGNAL (*arg).d, - NULL, - (arg_id == ARG_OBJECT_SIGNAL || - arg_id == ARG_OBJECT_SIGNAL_AFTER), - (arg_id == ARG_OBJECT_SIGNAL_AFTER || - arg_id == ARG_SIGNAL_AFTER)); - } - else - g_warning ("gtk_object_set_arg(): invalid signal argument: \"%s\"\n", arg->name); + case PROP_USER_DATA: + gtk_object_set_user_data (GTK_OBJECT (object), g_value_get_pointer (value)); break; default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void -gtk_object_get_arg (GtkObject *object, - GtkArg *arg, - guint arg_id) +gtk_object_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec, + const gchar *trailer) { - switch (arg_id) + switch (property_id) { - case ARG_USER_DATA: - GTK_VALUE_POINTER (*arg) = gtk_object_get_user_data (object); + case PROP_USER_DATA: + g_return_if_fail (trailer != NULL); + + g_value_set_pointer (value, gtk_object_get_user_data (GTK_OBJECT (object))); break; - case ARG_SIGNAL: - case ARG_OBJECT_SIGNAL: default: - arg->type = GTK_TYPE_INVALID; + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } /***************************************** - * gtk_object_class_add_signals: - * - * arguments: - * - * results: - *****************************************/ - -void -gtk_object_class_add_signals (GtkObjectClass *class, - guint *signals, - guint nsignals) -{ - g_return_if_fail (GTK_IS_OBJECT_CLASS (class)); - if (!nsignals) - return; - g_return_if_fail (signals != NULL); - - class->signals = g_renew (guint, class->signals, class->nsignals + nsignals); - memcpy (class->signals + class->nsignals, signals, nsignals * sizeof (guint)); - class->nsignals += nsignals; -} - -guint -gtk_object_class_user_signal_new (GtkObjectClass *class, - const gchar *name, - GtkSignalRunType signal_flags, - GtkSignalMarshaller marshaller, - GtkType return_val, - guint nparams, - ...) -{ - GtkType *params; - guint i; - va_list args; - guint signal_id; - - g_return_val_if_fail (class != NULL, 0); - - if (nparams > 0) - { - params = g_new (GtkType, nparams); - - va_start (args, nparams); - - for (i = 0; i < nparams; i++) - params[i] = va_arg (args, GtkType); - - va_end (args); - } - else - params = NULL; - - signal_id = gtk_signal_newv (name, - signal_flags, - GTK_CLASS_TYPE (class), - 0, - marshaller, - return_val, - nparams, - params); - - g_free (params); - - if (signal_id) - gtk_object_class_add_signals (class, &signal_id, 1); - - return signal_id; -} - -guint -gtk_object_class_user_signal_newv (GtkObjectClass *class, - const gchar *name, - GtkSignalRunType signal_flags, - GtkSignalMarshaller marshaller, - GtkType return_val, - guint nparams, - GtkType *params) -{ - guint signal_id; - - g_return_val_if_fail (class != NULL, 0); - - if (nparams > 0) - g_return_val_if_fail (params != NULL, 0); - - signal_id = gtk_signal_newv (name, - signal_flags, - GTK_CLASS_TYPE (class), - 0, - marshaller, - return_val, - nparams, - params); - - if (signal_id) - gtk_object_class_add_signals (class, &signal_id, 1); - - return signal_id; -} - -/***************************************** * gtk_object_sink: * * arguments: @@ -533,453 +560,49 @@ gtk_object_notify_weaks (GtkObject *object) } } -/**************************************************** - * GtkObject argument mechanism and object creation - * - ****************************************************/ - GtkObject* gtk_object_new (GtkType object_type, - const gchar *first_arg_name, + const gchar *first_property_name, ...) { GtkObject *object; va_list var_args; - GSList *arg_list = NULL; - GSList *info_list = NULL; - gchar *error; g_return_val_if_fail (GTK_TYPE_IS_OBJECT (object_type), NULL); - object = gtk_type_new (object_type); - - va_start (var_args, first_arg_name); - error = gtk_object_args_collect (GTK_OBJECT_TYPE (object), - &arg_list, - &info_list, - first_arg_name, - var_args); + va_start (var_args, first_property_name); + object = g_object_new_valist (object_type, first_property_name, var_args); va_end (var_args); - - if (error) - { - g_warning ("gtk_object_new(): %s", error); - g_free (error); - } - else - { - GSList *slist_arg; - GSList *slist_info; - - slist_arg = arg_list; - slist_info = info_list; - while (slist_arg) - { - gtk_object_arg_set (object, slist_arg->data, slist_info->data); - slist_arg = slist_arg->next; - slist_info = slist_info->next; - } - gtk_args_collect_cleanup (arg_list, info_list); - } - - if (!GTK_OBJECT_CONSTRUCTED (object)) - gtk_object_default_construct (object); - - return object; -} - -GtkObject* -gtk_object_newv (GtkType object_type, - guint n_args, - GtkArg *args) -{ - GtkObject *object; - GtkArg *max_args; - - g_return_val_if_fail (GTK_TYPE_IS_OBJECT (object_type), NULL); - if (n_args) - g_return_val_if_fail (args != NULL, NULL); - - object = gtk_type_new (object_type); - - for (max_args = args + n_args; args < max_args; args++) - gtk_object_arg_set (object, args, NULL); - - if (!GTK_OBJECT_CONSTRUCTED (object)) - gtk_object_default_construct (object); return object; } void -gtk_object_setv (GtkObject *object, - guint n_args, - GtkArg *args) -{ - GtkArg *max_args; - - g_return_if_fail (object != NULL); - g_return_if_fail (GTK_IS_OBJECT (object)); - if (n_args) - g_return_if_fail (args != NULL); - - for (max_args = args + n_args; args < max_args; args++) - gtk_object_arg_set (object, args, NULL); -} - -void -gtk_object_getv (GtkObject *object, - guint n_args, - GtkArg *args) -{ - GtkArg *max_args; - - g_return_if_fail (object != NULL); - g_return_if_fail (GTK_IS_OBJECT (object)); - if (n_args) - g_return_if_fail (args != NULL); - - for (max_args = args + n_args; args < max_args; args++) - gtk_object_arg_get (object, args, NULL); -} - -void gtk_object_get (GtkObject *object, - const gchar *first_arg_name, + const gchar *first_property_name, ...) { va_list var_args; - gchar *name; g_return_if_fail (GTK_IS_OBJECT (object)); - va_start (var_args, first_arg_name); - - name = (gchar*) first_arg_name; - while (name) - { - gpointer value_pointer = va_arg (var_args, gpointer); - - if (value_pointer) - { - GtkArgInfo *info; - gchar *error; - GtkArg arg; - - error = gtk_arg_get_info (GTK_OBJECT_TYPE (object), - object_arg_info_ht, - name, - &info); - if (error) - { - g_warning ("gtk_object_get(): %s", error); - g_free (error); - return; - } - - arg.name = name; - gtk_object_arg_get (object, &arg, info); - gtk_arg_to_valueloc (&arg, value_pointer); - } - - name = va_arg (var_args, gchar*); - } + va_start (var_args, first_property_name); + g_object_get_valist (G_OBJECT (object), first_property_name, var_args); + va_end (var_args); } void -gtk_object_set (GtkObject *object, - const gchar *first_arg_name, +gtk_object_set (GtkObject *object, + const gchar *first_property_name, ...) { va_list var_args; - GSList *arg_list = NULL; - GSList *info_list = NULL; - gchar *error; - g_return_if_fail (object != NULL); g_return_if_fail (GTK_IS_OBJECT (object)); - va_start (var_args, first_arg_name); - error = gtk_object_args_collect (GTK_OBJECT_TYPE (object), - &arg_list, - &info_list, - first_arg_name, - var_args); + va_start (var_args, first_property_name); + g_object_set_valist (G_OBJECT (object), first_property_name, var_args); va_end (var_args); - - if (error) - { - g_warning ("gtk_object_set(): %s", error); - g_free (error); - } - else - { - GSList *slist_arg; - GSList *slist_info; - - slist_arg = arg_list; - slist_info = info_list; - while (slist_arg) - { - gtk_object_arg_set (object, slist_arg->data, slist_info->data); - slist_arg = slist_arg->next; - slist_info = slist_info->next; - } - gtk_args_collect_cleanup (arg_list, info_list); - } -} - -void -gtk_object_arg_set (GtkObject *object, - GtkArg *arg, - GtkArgInfo *info) -{ - GtkObjectClass *oclass; - - g_return_if_fail (object != NULL); - g_return_if_fail (GTK_IS_OBJECT (object)); - g_return_if_fail (arg != NULL); - - if (!info) - { - gchar *error; - - error = gtk_arg_get_info (GTK_OBJECT_TYPE (object), - object_arg_info_ht, - arg->name, - &info); - if (error) - { - g_warning ("gtk_object_arg_set(): %s", error); - g_free (error); - return; - } - } - - if (info->arg_flags & GTK_ARG_CONSTRUCT_ONLY && - GTK_OBJECT_CONSTRUCTED (object)) - { - g_warning ("gtk_object_arg_set(): cannot set argument \"%s\" for constructed object", - info->full_name); - return; - } - if (!(info->arg_flags & GTK_ARG_WRITABLE)) - { - g_warning ("gtk_object_arg_set(): argument \"%s\" is not writable", - info->full_name); - return; - } - if (info->type != arg->type) - { - g_warning ("gtk_object_arg_set(): argument \"%s\" has invalid type `%s'", - info->full_name, - gtk_type_name (arg->type)); - return; - } - - oclass = gtk_type_class (info->class_type); - g_assert (oclass->set_arg != NULL); - oclass->set_arg (object, arg, info->arg_id); - if (!GTK_OBJECT_CONSTRUCTED (object) && - (info->arg_flags & GTK_ARG_CONSTRUCT_ONLY || - info->arg_flags & GTK_ARG_CONSTRUCT)) - { - GSList *slist; - - slist = gtk_object_get_data_by_id (object, quark_carg_history); - gtk_object_set_data_by_id (object, - quark_carg_history, - g_slist_prepend (slist, info)); - } -} - -void -gtk_object_arg_get (GtkObject *object, - GtkArg *arg, - GtkArgInfo *info) -{ - GtkObjectClass *oclass; - - g_return_if_fail (object != NULL); - g_return_if_fail (GTK_IS_OBJECT (object)); - g_return_if_fail (arg != NULL); - - if (!info) - { - gchar *error; - - error = gtk_arg_get_info (GTK_OBJECT_TYPE (object), - object_arg_info_ht, - arg->name, - &info); - if (error) - { - g_warning ("gtk_object_arg_get(): %s", error); - g_free (error); - arg->type = GTK_TYPE_INVALID; - return; - } - } - - if (! (info->arg_flags & GTK_ARG_READABLE)) - { - g_warning ("gtk_object_arg_get(): argument \"%s\" is not readable", - info->full_name); - arg->type = GTK_TYPE_INVALID; - return; - } - - oclass = gtk_type_class (info->class_type); - g_assert (oclass->get_arg != NULL); - arg->type = info->type; - oclass->get_arg (object, arg, info->arg_id); -} - -void -gtk_object_default_construct (GtkObject *object) -{ - GSList *slist; - - g_return_if_fail (object != NULL); - g_return_if_fail (GTK_IS_OBJECT (object)); - - if (!GTK_OBJECT_CONSTRUCTED (object)) - { - for (slist = GTK_OBJECT_GET_CLASS (object)->construct_args; - slist && !GTK_OBJECT_CONSTRUCTED (object); - slist = slist->next) - { - GSList *history; - GtkArgInfo *info; - - info = slist->data; - history = gtk_object_get_data_by_id (object, quark_carg_history); - if (!g_slist_find (history, info)) - { - GtkArg arg; - - /* default application */ - arg.type = info->type; - arg.name = info->name; - switch (G_TYPE_FUNDAMENTAL (arg.type)) - { - case GTK_TYPE_FLOAT: - GTK_VALUE_FLOAT (arg) = 0.0; - break; - case GTK_TYPE_DOUBLE: - GTK_VALUE_DOUBLE (arg) = 0.0; - break; - case GTK_TYPE_BOXED: - case GTK_TYPE_STRING: - case GTK_TYPE_POINTER: - case G_TYPE_OBJECT: - GTK_VALUE_POINTER (arg) = NULL; - break; - default: - memset (&arg.d, 0, sizeof (arg.d)); - break; - } - gtk_object_arg_set (object, &arg, info); - } - } - - if (!GTK_OBJECT_CONSTRUCTED (object)) - gtk_object_constructed (object); - } -} - -void -gtk_object_constructed (GtkObject *object) -{ - g_return_if_fail (object != NULL); - g_return_if_fail (GTK_IS_OBJECT (object)); - g_return_if_fail (GTK_OBJECT_CONSTRUCTED (object) == FALSE); - - g_slist_free (gtk_object_get_data_by_id (object, quark_carg_history)); - gtk_object_set_data_by_id (object, quark_carg_history, NULL); - GTK_OBJECT_FLAGS (object) |= GTK_CONSTRUCTED; -} - -void -gtk_object_add_arg_type (const char *arg_name, - GtkType arg_type, - guint arg_flags, - guint arg_id) -{ - GtkArgInfo *info; - - g_return_if_fail (arg_name != NULL); - g_return_if_fail (arg_type > GTK_TYPE_NONE); - g_return_if_fail (arg_id > 0); - g_return_if_fail ((arg_flags & GTK_ARG_CHILD_ARG) == 0); - if (arg_flags & GTK_ARG_CONSTRUCT) - g_return_if_fail ((arg_flags & GTK_ARG_READWRITE) == GTK_ARG_READWRITE); - else - g_return_if_fail ((arg_flags & GTK_ARG_READWRITE) != 0); - if (arg_flags & GTK_ARG_CONSTRUCT_ONLY) - g_return_if_fail ((arg_flags & GTK_ARG_WRITABLE) == GTK_ARG_WRITABLE); - - if (!object_arg_info_ht) - object_arg_info_ht = g_hash_table_new (gtk_arg_info_hash, - gtk_arg_info_equal); - - info = gtk_arg_type_new_static (GTK_TYPE_OBJECT, - arg_name, - GTK_STRUCT_OFFSET (GtkObjectClass, n_args), - object_arg_info_ht, - arg_type, - arg_flags, - arg_id); - if (info && - (info->arg_flags & GTK_ARG_CONSTRUCT || - info->arg_flags & GTK_ARG_CONSTRUCT_ONLY)) - { - GtkObjectClass *class; - - class = gtk_type_class (info->class_type); - if (info->arg_flags & GTK_ARG_CONSTRUCT_ONLY) - class->construct_args = g_slist_prepend (class->construct_args, info); - else - class->construct_args = g_slist_append (class->construct_args, info); - } -} - -gchar* -gtk_object_args_collect (GtkType object_type, - GSList **arg_list_p, - GSList **info_list_p, - const gchar *first_arg_name, - va_list var_args) -{ - return gtk_args_collect (object_type, - object_arg_info_ht, - arg_list_p, - info_list_p, - first_arg_name, - var_args); -} - -gchar* -gtk_object_arg_get_info (GtkType object_type, - const gchar *arg_name, - GtkArgInfo **info_p) -{ - return gtk_arg_get_info (object_type, - object_arg_info_ht, - arg_name, - info_p); -} - -GtkArg* -gtk_object_query_args (GtkType class_type, - guint32 **arg_flags, - guint *n_args) -{ - g_return_val_if_fail (n_args != NULL, NULL); - *n_args = 0; - g_return_val_if_fail (GTK_TYPE_IS_OBJECT (class_type), NULL); - - return gtk_args_query (class_type, object_arg_info_ht, arg_flags, n_args); } /***************************************** diff --git a/gtk/gtkobject.h b/gtk/gtkobject.h index 7c819d3a4..239c21d07 100644 --- a/gtk/gtkobject.h +++ b/gtk/gtkobject.h @@ -64,8 +64,8 @@ typedef enum { GTK_DESTROYED = 1 << 0, GTK_FLOATING = 1 << 1, - GTK_RESERVED = 1 << 2, - GTK_CONSTRUCTED = 1 << 3 + GTK_RESERVED_1 = 1 << 2, + GTK_RESERVED_2 = 1 << 3 } GtkObjectFlags; /* Macros for extracting the object_flags from GtkObject. @@ -74,29 +74,12 @@ typedef enum #define GTK_OBJECT_DESTROYED(obj) ((GTK_OBJECT_FLAGS (obj) & GTK_DESTROYED) != 0) #define GTK_OBJECT_FLOATING(obj) ((GTK_OBJECT_FLAGS (obj) & GTK_FLOATING) != 0) #define GTK_OBJECT_CONNECTED(obj) ((GTK_OBJECT_FLAGS (obj) & GTK_CONNECTED) != 0) -#define GTK_OBJECT_CONSTRUCTED(obj) ((GTK_OBJECT_FLAGS (obj) & GTK_CONSTRUCTED) != 0) /* Macros for setting and clearing bits in the object_flags field of GtkObject. */ #define GTK_OBJECT_SET_FLAGS(obj,flag) G_STMT_START{ (GTK_OBJECT_FLAGS (obj) |= (flag)); }G_STMT_END #define GTK_OBJECT_UNSET_FLAGS(obj,flag) G_STMT_START{ (GTK_OBJECT_FLAGS (obj) &= ~(flag)); }G_STMT_END -/* GtkArg flag bits for gtk_object_add_arg_type - */ -typedef enum -{ - GTK_ARG_READABLE = 1 << 0, - GTK_ARG_WRITABLE = 1 << 1, - GTK_ARG_CONSTRUCT = 1 << 2, - GTK_ARG_CONSTRUCT_ONLY = 1 << 3, - GTK_ARG_CHILD_ARG = 1 << 4, - GTK_ARG_MASK = 0x1f, - - /* aliases - */ - GTK_ARG_READWRITE = GTK_ARG_READABLE | GTK_ARG_WRITABLE -} GtkArgFlags; - typedef struct _GtkObjectClass GtkObjectClass; @@ -121,27 +104,11 @@ struct _GtkObject * it ``inherits'' from the GtkTypeClass by mirroring its fields, which * must always be kept in sync completely. The GtkObjectClass defines * the basic necessities for the object inheritance mechanism to work. - * Namely, the `signals' and `nsignals' fields as well as the function - * pointers, required to end an object's lifetime. */ struct _GtkObjectClass { GObjectClass parent_class; - /* The signals this object class handles. "signals" is an - * array of signal ID's. - */ - guint *signals; - - /* The number of signals listed in "signals". - */ - guint nsignals; - - /* The number of arguments per class. - */ - guint n_args; - GSList *construct_args; - /* Non overridable class methods to set and get per class arguments */ void (*set_arg) (GtkObject *object, GtkArg *arg, @@ -158,7 +125,7 @@ struct _GtkObjectClass * own cleanup. (See the destroy function for GtkWidget for * an example of how to do this). */ - void (* destroy) (GtkObject *object); + void (*destroy) (GtkObject *object); }; @@ -167,31 +134,11 @@ struct _GtkObjectClass GtkType gtk_object_get_type (void) G_GNUC_CONST; -/* Append a user defined signal without default handler to a class. */ -guint gtk_object_class_user_signal_new (GtkObjectClass *klass, - const gchar *name, - GtkSignalRunType signal_flags, - GtkSignalMarshaller marshaller, - GtkType return_val, - guint nparams, - ...); -guint gtk_object_class_user_signal_newv (GtkObjectClass *klass, - const gchar *name, - GtkSignalRunType signal_flags, - GtkSignalMarshaller marshaller, - GtkType return_val, - guint nparams, - GtkType *params); GtkObject* gtk_object_new (GtkType type, - const gchar *first_arg_name, + const gchar *first_property_name, ...); -GtkObject* gtk_object_newv (GtkType object_type, - guint n_args, - GtkArg *args); GtkObject* gtk_object_ref (GtkObject *object); void gtk_object_unref (GtkObject *object); -void gtk_object_default_construct (GtkObject *object); -void gtk_object_constructed (GtkObject *object); void gtk_object_sink (GtkObject *object); void gtk_object_weakref (GtkObject *object, GtkDestroyNotify notify, @@ -201,46 +148,6 @@ void gtk_object_weakunref (GtkObject *object, gpointer data); void gtk_object_destroy (GtkObject *object); -/* gtk_object_getv() sets an arguments type and value, or just - * its type to GTK_TYPE_INVALID. - * if GTK_FUNDAMENTAL_TYPE (arg->type) == GTK_TYPE_STRING, it's - * the callers response to do a g_free (GTK_VALUE_STRING (arg)); - */ -void gtk_object_getv (GtkObject *object, - guint n_args, - GtkArg *args); -/* gtk_object_get() sets the variable values pointed to by the adresses - * passed after the argument names according to the arguments value. - * if GTK_FUNDAMENTAL_TYPE (arg->type) == GTK_TYPE_STRING, it's - * the callers response to do a g_free (retrived_value); - */ -void gtk_object_get (GtkObject *object, - const gchar *first_arg_name, - ...); - -/* gtk_object_set() takes a variable argument list of the form: - * (..., gchar *arg_name, ARG_VALUES, [repeatedly name/value pairs,] NULL) - * where ARG_VALUES type depend on the argument and can consist of - * more than one c-function argument. - */ -void gtk_object_set (GtkObject *object, - const gchar *first_arg_name, - ...); -void gtk_object_setv (GtkObject *object, - guint n_args, - GtkArg *args); - -/* Allocate a GtkArg array of size nargs that hold the - * names and types of the args that can be used with - * gtk_object_set/gtk_object_get. if (arg_flags!=NULL), - * (*arg_flags) will be set to point to a newly allocated - * guint array that holds the flags of the args. - * It is the callers response to do a - * g_free (returned_args); g_free (*arg_flags). - */ -GtkArg* gtk_object_query_args (GtkType class_type, - guint32 **arg_flags, - guint *n_args); /* Set 'data' to the "object_data" field of the object. The * data is indexed by the "key". If there is already data @@ -280,16 +187,6 @@ gpointer gtk_object_get_user_data (GtkObject *object); /* Object-level methods */ -/* Append "signals" to those already defined in "class". */ -void gtk_object_class_add_signals (GtkObjectClass *klass, - guint *signals, - guint nsignals); -/* the `arg_name' argument needs to be a const static string */ -void gtk_object_add_arg_type (const gchar *arg_name, - GtkType arg_type, - guint arg_flags, - guint arg_id); - /* Object data method variants that operate on key ids. */ void gtk_object_set_data_by_id (GtkObject *object, GQuark data_id, @@ -310,25 +207,28 @@ void gtk_object_remove_no_notify_by_id (GtkObject *object, /* Non-public methods */ -void gtk_object_arg_set (GtkObject *object, - GtkArg *arg, - GtkArgInfo *info); -void gtk_object_arg_get (GtkObject *object, - GtkArg *arg, - GtkArgInfo *info); -gchar* gtk_object_args_collect (GtkType object_type, - GSList **arg_list_p, - GSList **info_list_p, - const gchar *first_arg_name, - va_list var_args); -gchar* gtk_object_arg_get_info (GtkType object_type, - const gchar *arg_name, - GtkArgInfo **info_p); - - - - +/* GtkArg flag bits for gtk_object_add_arg_type + */ +typedef enum +{ + GTK_ARG_READABLE = G_PARAM_READABLE, + GTK_ARG_WRITABLE = G_PARAM_WRITABLE, + GTK_ARG_CONSTRUCT = G_PARAM_CONSTRUCT, + GTK_ARG_CONSTRUCT_ONLY = G_PARAM_CONSTRUCT_ONLY, + GTK_ARG_CHILD_ARG = 1 << 4, +} GtkArgFlags; +#define GTK_ARG_READWRITE (GTK_ARG_READABLE | GTK_ARG_WRITABLE) +void gtk_object_get (GtkObject *object, + const gchar *first_property_name, + ...); +void gtk_object_set (GtkObject *object, + const gchar *first_property_name, + ...); +void gtk_object_add_arg_type (const gchar *arg_name, + GtkType arg_type, + guint arg_flags, + guint arg_id); #ifdef __cplusplus diff --git a/gtk/gtkoldeditable.c b/gtk/gtkoldeditable.c index a085d0639..ee3bdbb79 100644 --- a/gtk/gtkoldeditable.c +++ b/gtk/gtkoldeditable.c @@ -174,6 +174,38 @@ gtk_old_editable_class_init (GtkOldEditableClass *class) widget_class = (GtkWidgetClass*) class; parent_class = gtk_type_class (GTK_TYPE_WIDGET); + + object_class->set_arg = gtk_old_editable_set_arg; + object_class->get_arg = gtk_old_editable_get_arg; + + widget_class->selection_clear_event = gtk_old_editable_selection_clear; + widget_class->selection_received = gtk_old_editable_selection_received; + widget_class->selection_get = gtk_old_editable_selection_get; + + class->insert_text = NULL; + class->delete_text = NULL; + + class->activate = NULL; + class->set_editable = gtk_old_editable_real_set_editable; + + class->move_cursor = NULL; + class->move_word = NULL; + class->move_page = NULL; + class->move_to_row = NULL; + class->move_to_column = NULL; + + class->kill_char = NULL; + class->kill_word = NULL; + class->kill_line = NULL; + + class->cut_clipboard = gtk_old_editable_real_cut_clipboard; + class->copy_clipboard = gtk_old_editable_real_copy_clipboard; + class->paste_clipboard = gtk_old_editable_real_paste_clipboard; + + class->update_text = NULL; + class->get_chars = NULL; + class->set_selection = NULL; + class->set_position = NULL; editable_signals[CHANGED] = gtk_signal_new ("changed", @@ -322,42 +354,8 @@ gtk_old_editable_class_init (GtkOldEditableClass *class) gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0); - gtk_object_class_add_signals (object_class, editable_signals, LAST_SIGNAL); - gtk_object_add_arg_type ("GtkOldEditable::text_position", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_TEXT_POSITION); gtk_object_add_arg_type ("GtkOldEditable::editable", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE); - - object_class->set_arg = gtk_old_editable_set_arg; - object_class->get_arg = gtk_old_editable_get_arg; - - widget_class->selection_clear_event = gtk_old_editable_selection_clear; - widget_class->selection_received = gtk_old_editable_selection_received; - widget_class->selection_get = gtk_old_editable_selection_get; - - class->insert_text = NULL; - class->delete_text = NULL; - - class->activate = NULL; - class->set_editable = gtk_old_editable_real_set_editable; - - class->move_cursor = NULL; - class->move_word = NULL; - class->move_page = NULL; - class->move_to_row = NULL; - class->move_to_column = NULL; - - class->kill_char = NULL; - class->kill_word = NULL; - class->kill_line = NULL; - - class->cut_clipboard = gtk_old_editable_real_cut_clipboard; - class->copy_clipboard = gtk_old_editable_real_copy_clipboard; - class->paste_clipboard = gtk_old_editable_real_paste_clipboard; - - class->update_text = NULL; - class->get_chars = NULL; - class->set_selection = NULL; - class->set_position = NULL; } static void diff --git a/gtk/gtkpacker.c b/gtk/gtkpacker.c index 3609bfeb4..243ef092e 100644 --- a/gtk/gtkpacker.c +++ b/gtk/gtkpacker.c @@ -215,7 +215,7 @@ gtk_packer_class_init (GtkPackerClass *klass) gtk_container_add_child_arg_type ("GtkPacker::pad_y", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_PAD_Y); gtk_container_add_child_arg_type ("GtkPacker::ipad_x", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_I_PAD_X); gtk_container_add_child_arg_type ("GtkPacker::ipad_y", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_I_PAD_Y); - gtk_container_add_child_arg_type ("GtkPacker::position", GTK_TYPE_LONG, GTK_ARG_READWRITE, CHILD_ARG_POSITION); + gtk_container_add_child_arg_type ("GtkPacker::position", GTK_TYPE_INT, GTK_ARG_READWRITE, CHILD_ARG_POSITION); object_class->set_arg = gtk_packer_set_arg; object_class->get_arg = gtk_packer_get_arg; @@ -398,7 +398,7 @@ gtk_packer_set_child_arg (GtkContainer *container, case CHILD_ARG_POSITION: gtk_packer_reorder_child (packer, child, - GTK_VALUE_LONG (*arg)); + GTK_VALUE_INT (*arg)); break; default: break; @@ -476,16 +476,16 @@ gtk_packer_get_child_arg (GtkContainer *container, GTK_VALUE_UINT (*arg) = child_info->i_pad_y; break; case CHILD_ARG_POSITION: - GTK_VALUE_LONG (*arg) = 0; + GTK_VALUE_INT (*arg) = 0; for (list = packer->children; list; list = list->next) { child_info = list->data; if (child_info->widget == child) break; - GTK_VALUE_LONG (*arg)++; + GTK_VALUE_INT (*arg)++; } if (!list) - GTK_VALUE_LONG (*arg) = -1; + GTK_VALUE_INT (*arg) = -1; break; default: arg->type = GTK_TYPE_INVALID; diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c index 2c9d113ed..d8f6f3265 100644 --- a/gtk/gtkprogressbar.c +++ b/gtk/gtkprogressbar.c @@ -139,7 +139,7 @@ gtk_progress_bar_class_init (GtkProgressBarClass *class) gtk_object_add_arg_type ("GtkProgressBar::pulse_step", GTK_TYPE_FLOAT, GTK_ARG_READWRITE, - ARG_FRACTION); + ARG_PULSE_STEP); object_class->set_arg = gtk_progress_bar_set_arg; object_class->get_arg = gtk_progress_bar_get_arg; diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 2c5d6abf0..5e35c9574 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -245,8 +245,6 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class) GTK_SIGNAL_OFFSET (GtkSpinButtonClass, output), gtk_marshal_BOOLEAN__VOID, GTK_TYPE_BOOL, 0); - - gtk_object_class_add_signals (object_class, spinbutton_signals, LAST_SIGNAL); } static void diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c index c5bb68b9d..1c0d34377 100644 --- a/gtk/gtkstatusbar.c +++ b/gtk/gtkstatusbar.c @@ -114,7 +114,6 @@ gtk_statusbar_class_init (GtkStatusbarClass *class) GTK_TYPE_NONE, 2, GTK_TYPE_UINT, GTK_TYPE_STRING); - gtk_object_class_add_signals (object_class, statusbar_signals, SIGNAL_LAST); } static void diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c index e6ff89e3c..d3f7f2cca 100644 --- a/gtk/gtktextbuffer.c +++ b/gtk/gtktextbuffer.c @@ -135,6 +135,14 @@ gtk_text_buffer_class_init (GtkTextBufferClass *klass) parent_class = gtk_type_class (GTK_TYPE_OBJECT); + gobject_class->finalize = gtk_text_buffer_finalize; + + klass->insert_text = gtk_text_buffer_real_insert_text; + klass->delete_text = gtk_text_buffer_real_delete_text; + klass->apply_tag = gtk_text_buffer_real_apply_tag; + klass->remove_tag = gtk_text_buffer_real_remove_tag; + klass->changed = gtk_text_buffer_real_changed; + signals[INSERT_TEXT] = gtk_signal_new ("insert_text", GTK_RUN_LAST, @@ -222,16 +230,6 @@ gtk_text_buffer_class_init (GtkTextBufferClass *klass) G_TYPE_OBJECT, GTK_TYPE_TEXT_ITER, GTK_TYPE_TEXT_ITER); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - gobject_class->finalize = gtk_text_buffer_finalize; - - klass->insert_text = gtk_text_buffer_real_insert_text; - klass->delete_text = gtk_text_buffer_real_delete_text; - klass->apply_tag = gtk_text_buffer_real_apply_tag; - klass->remove_tag = gtk_text_buffer_real_remove_tag; - klass->changed = gtk_text_buffer_real_changed; } void diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index ba758f99d..25d4b16c2 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -163,6 +163,13 @@ gtk_text_layout_class_init (GtkTextLayoutClass *klass) parent_class = gtk_type_class (GTK_TYPE_OBJECT); + object_class->destroy = gtk_text_layout_destroy; + gobject_class->finalize = gtk_text_layout_finalize; + + klass->wrap = gtk_text_layout_real_wrap; + klass->invalidate = gtk_text_layout_real_invalidate; + klass->free_line_data = gtk_text_layout_real_free_line_data; + signals[INVALIDATED] = gtk_signal_new ("invalidated", GTK_RUN_LAST, @@ -195,15 +202,6 @@ gtk_text_layout_class_init (GtkTextLayoutClass *klass) GTK_TYPE_OBJECT, GTK_TYPE_INT, GTK_TYPE_INT); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - object_class->destroy = gtk_text_layout_destroy; - gobject_class->finalize = gtk_text_layout_finalize; - - klass->wrap = gtk_text_layout_real_wrap; - klass->invalidate = gtk_text_layout_real_invalidate; - klass->free_line_data = gtk_text_layout_real_free_line_data; } void diff --git a/gtk/gtktexttag.c b/gtk/gtktexttag.c index e812b1477..f0a54326c 100644 --- a/gtk/gtktexttag.c +++ b/gtk/gtktexttag.c @@ -181,6 +181,12 @@ gtk_text_tag_class_init (GtkTextTagClass *klass) parent_class = gtk_type_class (GTK_TYPE_OBJECT); + object_class->set_arg = gtk_text_tag_set_arg; + object_class->get_arg = gtk_text_tag_get_arg; + + object_class->destroy = gtk_text_tag_destroy; + gobject_class->finalize = gtk_text_tag_finalize; + /* Construct */ gtk_object_add_arg_type ("GtkTextTag::name", GTK_TYPE_STRING, GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT_ONLY, @@ -324,14 +330,6 @@ gtk_text_tag_class_init (GtkTextTagClass *klass) G_TYPE_OBJECT, GTK_TYPE_GDK_EVENT, GTK_TYPE_TEXT_ITER); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - object_class->set_arg = gtk_text_tag_set_arg; - object_class->get_arg = gtk_text_tag_get_arg; - - object_class->destroy = gtk_text_tag_destroy; - gobject_class->finalize = gtk_text_tag_finalize; } void diff --git a/gtk/gtktexttagtable.c b/gtk/gtktexttagtable.c index 9386fd157..bf6fc6c99 100644 --- a/gtk/gtktexttagtable.c +++ b/gtk/gtktexttagtable.c @@ -58,6 +58,12 @@ gtk_text_tag_table_class_init (GtkTextTagTableClass *klass) parent_class = gtk_type_class (GTK_TYPE_OBJECT); + object_class->set_arg = gtk_text_tag_table_set_arg; + object_class->get_arg = gtk_text_tag_table_get_arg; + + object_class->destroy = gtk_text_tag_table_destroy; + gobject_class->finalize = gtk_text_tag_table_finalize; + signals[TAG_CHANGED] = gtk_signal_new ("tag_changed", GTK_RUN_LAST, @@ -88,15 +94,6 @@ gtk_text_tag_table_class_init (GtkTextTagTableClass *klass) GTK_TYPE_NONE, 1, G_TYPE_OBJECT); - - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - object_class->set_arg = gtk_text_tag_table_set_arg; - object_class->get_arg = gtk_text_tag_table_get_arg; - - object_class->destroy = gtk_text_tag_table_destroy; - gobject_class->finalize = gtk_text_tag_table_finalize; } void diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 3bb70459b..35a4747bb 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -376,6 +376,55 @@ gtk_text_view_class_init (GtkTextViewClass *klass) parent_class = gtk_type_class (GTK_TYPE_CONTAINER); + /* Default handlers and virtual methods + */ + object_class->set_arg = gtk_text_view_set_arg; + object_class->get_arg = gtk_text_view_get_arg; + + object_class->destroy = gtk_text_view_destroy; + gobject_class->finalize = gtk_text_view_finalize; + + widget_class->realize = gtk_text_view_realize; + widget_class->unrealize = gtk_text_view_unrealize; + widget_class->style_set = gtk_text_view_style_set; + widget_class->direction_changed = gtk_text_view_direction_changed; + widget_class->size_request = gtk_text_view_size_request; + widget_class->size_allocate = gtk_text_view_size_allocate; + widget_class->event = gtk_text_view_event; + widget_class->key_press_event = gtk_text_view_key_press_event; + widget_class->key_release_event = gtk_text_view_key_release_event; + widget_class->button_press_event = gtk_text_view_button_press_event; + widget_class->button_release_event = gtk_text_view_button_release_event; + widget_class->focus_in_event = gtk_text_view_focus_in_event; + widget_class->focus_out_event = gtk_text_view_focus_out_event; + widget_class->motion_notify_event = gtk_text_view_motion_event; + widget_class->expose_event = gtk_text_view_expose_event; + widget_class->draw_focus = gtk_text_view_draw_focus; + + widget_class->drag_begin = gtk_text_view_drag_begin; + widget_class->drag_end = gtk_text_view_drag_end; + widget_class->drag_data_get = gtk_text_view_drag_data_get; + widget_class->drag_data_delete = gtk_text_view_drag_data_delete; + + widget_class->drag_leave = gtk_text_view_drag_leave; + widget_class->drag_motion = gtk_text_view_drag_motion; + widget_class->drag_drop = gtk_text_view_drag_drop; + widget_class->drag_data_received = gtk_text_view_drag_data_received; + + container_class->add = gtk_text_view_add; + container_class->remove = gtk_text_view_remove; + container_class->forall = gtk_text_view_forall; + + klass->move_cursor = gtk_text_view_move_cursor; + klass->set_anchor = gtk_text_view_set_anchor; + klass->insert_at_cursor = gtk_text_view_insert_at_cursor; + klass->delete_from_cursor = gtk_text_view_delete_from_cursor; + klass->cut_clipboard = gtk_text_view_cut_clipboard; + klass->copy_clipboard = gtk_text_view_copy_clipboard; + klass->paste_clipboard = gtk_text_view_paste_clipboard; + klass->toggle_overwrite = gtk_text_view_toggle_overwrite; + klass->set_scroll_adjustments = gtk_text_view_set_scroll_adjustments; + /* * Arguments */ @@ -472,15 +521,14 @@ gtk_text_view_class_init (GtkTextViewClass *klass) gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - signals[SET_SCROLL_ADJUSTMENTS] = widget_class->set_scroll_adjustments_signal = + signals[SET_SCROLL_ADJUSTMENTS] = gtk_signal_new ("set_scroll_adjustments", GTK_RUN_LAST, GTK_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (GtkTextViewClass, set_scroll_adjustments), gtk_marshal_VOID__POINTER_POINTER, GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); + widget_class->set_scroll_adjustments_signal = signals[SET_SCROLL_ADJUSTMENTS]; /* * Key bindings @@ -629,56 +677,6 @@ gtk_text_view_class_init (GtkTextViewClass *klass) /* Overwrite */ gtk_binding_entry_add_signal (binding_set, GDK_Insert, 0, "toggle_overwrite", 0); - - /* - * Default handlers and virtual methods - */ - object_class->set_arg = gtk_text_view_set_arg; - object_class->get_arg = gtk_text_view_get_arg; - - object_class->destroy = gtk_text_view_destroy; - gobject_class->finalize = gtk_text_view_finalize; - - widget_class->realize = gtk_text_view_realize; - widget_class->unrealize = gtk_text_view_unrealize; - widget_class->style_set = gtk_text_view_style_set; - widget_class->direction_changed = gtk_text_view_direction_changed; - widget_class->size_request = gtk_text_view_size_request; - widget_class->size_allocate = gtk_text_view_size_allocate; - widget_class->event = gtk_text_view_event; - widget_class->key_press_event = gtk_text_view_key_press_event; - widget_class->key_release_event = gtk_text_view_key_release_event; - widget_class->button_press_event = gtk_text_view_button_press_event; - widget_class->button_release_event = gtk_text_view_button_release_event; - widget_class->focus_in_event = gtk_text_view_focus_in_event; - widget_class->focus_out_event = gtk_text_view_focus_out_event; - widget_class->motion_notify_event = gtk_text_view_motion_event; - widget_class->expose_event = gtk_text_view_expose_event; - widget_class->draw_focus = gtk_text_view_draw_focus; - - widget_class->drag_begin = gtk_text_view_drag_begin; - widget_class->drag_end = gtk_text_view_drag_end; - widget_class->drag_data_get = gtk_text_view_drag_data_get; - widget_class->drag_data_delete = gtk_text_view_drag_data_delete; - - widget_class->drag_leave = gtk_text_view_drag_leave; - widget_class->drag_motion = gtk_text_view_drag_motion; - widget_class->drag_drop = gtk_text_view_drag_drop; - widget_class->drag_data_received = gtk_text_view_drag_data_received; - - container_class->add = gtk_text_view_add; - container_class->remove = gtk_text_view_remove; - container_class->forall = gtk_text_view_forall; - - klass->move_cursor = gtk_text_view_move_cursor; - klass->set_anchor = gtk_text_view_set_anchor; - klass->insert_at_cursor = gtk_text_view_insert_at_cursor; - klass->delete_from_cursor = gtk_text_view_delete_from_cursor; - klass->cut_clipboard = gtk_text_view_cut_clipboard; - klass->copy_clipboard = gtk_text_view_copy_clipboard; - klass->paste_clipboard = gtk_text_view_paste_clipboard; - klass->toggle_overwrite = gtk_text_view_toggle_overwrite; - klass->set_scroll_adjustments = gtk_text_view_set_scroll_adjustments; } void diff --git a/gtk/gtktipsquery.c b/gtk/gtktipsquery.c index a07328745..92d05166f 100644 --- a/gtk/gtktipsquery.c +++ b/gtk/gtktipsquery.c @@ -117,6 +117,18 @@ gtk_tips_query_class_init (GtkTipsQueryClass *class) parent_class = gtk_type_class (gtk_label_get_type ()); + + object_class->set_arg = gtk_tips_query_set_arg; + object_class->get_arg = gtk_tips_query_get_arg; + object_class->destroy = gtk_tips_query_destroy; + + widget_class->event = gtk_tips_query_event; + + class->start_query = gtk_tips_query_real_start_query; + class->stop_query = gtk_tips_query_real_stop_query; + class->widget_entered = gtk_tips_query_widget_entered; + class->widget_selected = NULL; + gtk_object_add_arg_type ("GtkTipsQuery::emit_always", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EMIT_ALWAYS); gtk_object_add_arg_type ("GtkTipsQuery::caller", GTK_TYPE_WIDGET, GTK_ARG_READWRITE, ARG_CALLER); gtk_object_add_arg_type ("GtkTipsQuery::label_inactive", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_LABEL_INACTIVE); @@ -157,18 +169,6 @@ gtk_tips_query_class_init (GtkTipsQueryClass *class) GTK_TYPE_STRING, GTK_TYPE_STRING, GTK_TYPE_GDK_EVENT); - gtk_object_class_add_signals (object_class, tips_query_signals, SIGNAL_LAST); - - object_class->set_arg = gtk_tips_query_set_arg; - object_class->get_arg = gtk_tips_query_get_arg; - object_class->destroy = gtk_tips_query_destroy; - - widget_class->event = gtk_tips_query_event; - - class->start_query = gtk_tips_query_real_start_query; - class->stop_query = gtk_tips_query_real_stop_query; - class->widget_entered = gtk_tips_query_widget_entered; - class->widget_selected = NULL; } static void diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index d9fbee2b0..c1bb46856 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -114,18 +114,6 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class) parent_class = gtk_type_class (GTK_TYPE_BUTTON); - gtk_object_add_arg_type ("GtkToggleButton::active", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ACTIVE); - gtk_object_add_arg_type ("GtkToggleButton::draw_indicator", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_INDICATOR); - - toggle_button_signals[TOGGLED] = - gtk_signal_new ("toggled", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkToggleButtonClass, toggled), - gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, toggle_button_signals, LAST_SIGNAL); object_class->set_arg = gtk_toggle_button_set_arg; object_class->get_arg = gtk_toggle_button_get_arg; @@ -144,6 +132,17 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class) button_class->leave = gtk_toggle_button_leave; class->toggled = NULL; + + gtk_object_add_arg_type ("GtkToggleButton::active", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ACTIVE); + gtk_object_add_arg_type ("GtkToggleButton::draw_indicator", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_INDICATOR); + + toggle_button_signals[TOGGLED] = + gtk_signal_new ("toggled", + GTK_RUN_FIRST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GtkToggleButtonClass, toggled), + gtk_marshal_VOID__VOID, + GTK_TYPE_NONE, 0); } static void diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index de2dad801..d23eba5a6 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -138,25 +138,6 @@ gtk_toolbar_class_init (GtkToolbarClass *class) parent_class = gtk_type_class (gtk_container_get_type ()); - toolbar_signals[ORIENTATION_CHANGED] = - gtk_signal_new ("orientation_changed", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkToolbarClass, orientation_changed), - gtk_marshal_VOID__INT, - GTK_TYPE_NONE, 1, - GTK_TYPE_INT); - toolbar_signals[STYLE_CHANGED] = - gtk_signal_new ("style_changed", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkToolbarClass, style_changed), - gtk_marshal_VOID__INT, - GTK_TYPE_NONE, 1, - GTK_TYPE_INT); - - gtk_object_class_add_signals (object_class, toolbar_signals, LAST_SIGNAL); - object_class->destroy = gtk_toolbar_destroy; object_class->set_arg = gtk_toolbar_set_arg; object_class->get_arg = gtk_toolbar_get_arg; @@ -174,6 +155,23 @@ gtk_toolbar_class_init (GtkToolbarClass *class) class->orientation_changed = gtk_real_toolbar_orientation_changed; class->style_changed = gtk_real_toolbar_style_changed; + + toolbar_signals[ORIENTATION_CHANGED] = + gtk_signal_new ("orientation_changed", + GTK_RUN_FIRST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GtkToolbarClass, orientation_changed), + gtk_marshal_VOID__INT, + GTK_TYPE_NONE, 1, + GTK_TYPE_INT); + toolbar_signals[STYLE_CHANGED] = + gtk_signal_new ("style_changed", + GTK_RUN_FIRST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GtkToolbarClass, style_changed), + gtk_marshal_VOID__INT, + GTK_TYPE_NONE, 1, + GTK_TYPE_INT); gtk_object_add_arg_type ("GtkToolbar::orientation", GTK_TYPE_ORIENTATION, GTK_ARG_READWRITE, ARG_ORIENTATION); diff --git a/gtk/gtktree.c b/gtk/gtktree.c index c76d9da3e..2c845874f 100644 --- a/gtk/gtktree.c +++ b/gtk/gtktree.c @@ -110,6 +110,29 @@ gtk_tree_class_init (GtkTreeClass *class) parent_class = gtk_type_class (gtk_container_get_type ()); + + object_class->destroy = gtk_tree_destroy; + + widget_class->map = gtk_tree_map; + widget_class->unmap = gtk_tree_unmap; + widget_class->realize = gtk_tree_realize; + widget_class->expose_event = gtk_tree_expose; + widget_class->motion_notify_event = gtk_tree_motion_notify; + widget_class->button_press_event = gtk_tree_button_press; + widget_class->button_release_event = gtk_tree_button_release; + widget_class->size_request = gtk_tree_size_request; + widget_class->size_allocate = gtk_tree_size_allocate; + + container_class->add = gtk_tree_add; + container_class->remove = + (void (*)(GtkContainer *, GtkWidget *)) gtk_tree_remove_item; + container_class->forall = gtk_tree_forall; + container_class->child_type = gtk_tree_child_type; + + class->selection_changed = NULL; + class->select_child = gtk_real_tree_select_child; + class->unselect_child = gtk_real_tree_unselect_child; + tree_signals[SELECTION_CHANGED] = gtk_signal_new ("selection_changed", GTK_RUN_FIRST, @@ -133,30 +156,6 @@ gtk_tree_class_init (GtkTreeClass *class) gtk_marshal_VOID__POINTER, GTK_TYPE_NONE, 1, GTK_TYPE_WIDGET); - - gtk_object_class_add_signals (object_class, tree_signals, LAST_SIGNAL); - - object_class->destroy = gtk_tree_destroy; - - widget_class->map = gtk_tree_map; - widget_class->unmap = gtk_tree_unmap; - widget_class->realize = gtk_tree_realize; - widget_class->expose_event = gtk_tree_expose; - widget_class->motion_notify_event = gtk_tree_motion_notify; - widget_class->button_press_event = gtk_tree_button_press; - widget_class->button_release_event = gtk_tree_button_release; - widget_class->size_request = gtk_tree_size_request; - widget_class->size_allocate = gtk_tree_size_allocate; - - container_class->add = gtk_tree_add; - container_class->remove = - (void (*)(GtkContainer *, GtkWidget *)) gtk_tree_remove_item; - container_class->forall = gtk_tree_forall; - container_class->child_type = gtk_tree_child_type; - - class->selection_changed = NULL; - class->select_child = gtk_real_tree_select_child; - class->unselect_child = gtk_real_tree_unselect_child; } static GtkType diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c index 6f62870e6..dc4cb886e 100644 --- a/gtk/gtktreeitem.c +++ b/gtk/gtktreeitem.c @@ -133,30 +133,13 @@ gtk_tree_item_class_init (GtkTreeItemClass *class) GtkContainerClass *container_class; GtkItemClass *item_class; + parent_class = gtk_type_class (GTK_TYPE_ITEM); + object_class = (GtkObjectClass*) class; widget_class = (GtkWidgetClass*) class; item_class = (GtkItemClass*) class; container_class = (GtkContainerClass*) class; - parent_class = gtk_type_class (gtk_item_get_type ()); - - tree_item_signals[EXPAND_TREE] = - gtk_signal_new ("expand", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkTreeItemClass, expand), - gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); - tree_item_signals[COLLAPSE_TREE] = - gtk_signal_new ("collapse", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkTreeItemClass, collapse), - gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, tree_item_signals, LAST_SIGNAL); - object_class->destroy = gtk_tree_item_destroy; widget_class->realize = gtk_tree_item_realize; @@ -178,6 +161,21 @@ gtk_tree_item_class_init (GtkTreeItemClass *class) class->expand = gtk_real_tree_item_expand; class->collapse = gtk_real_tree_item_collapse; + + tree_item_signals[EXPAND_TREE] = + gtk_signal_new ("expand", + GTK_RUN_FIRST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GtkTreeItemClass, expand), + gtk_marshal_VOID__VOID, + GTK_TYPE_NONE, 0); + tree_item_signals[COLLAPSE_TREE] = + gtk_signal_new ("collapse", + GTK_RUN_FIRST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GtkTreeItemClass, collapse), + gtk_marshal_VOID__VOID, + GTK_TYPE_NONE, 0); } /* callback for event box mouse event */ diff --git a/gtk/gtktreemodelsort.c b/gtk/gtktreemodelsort.c index ca7c30526..66d122124 100644 --- a/gtk/gtktreemodelsort.c +++ b/gtk/gtktreemodelsort.c @@ -173,6 +173,8 @@ gtk_tree_model_sort_class_init (GtkTreeModelSortClass *tree_model_sort_class) object_class = (GObjectClass *) tree_model_sort_class; + object_class->finalize = gtk_tree_model_sort_finalize; + tree_model_sort_signals[CHANGED] = gtk_signal_new ("changed", GTK_RUN_FIRST, @@ -208,10 +210,6 @@ gtk_tree_model_sort_class_init (GtkTreeModelSortClass *tree_model_sort_class) gtk_marshal_VOID__POINTER, GTK_TYPE_NONE, 1, GTK_TYPE_POINTER); - - object_class->finalize = gtk_tree_model_sort_finalize; - - gtk_object_class_add_signals (GTK_OBJECT_CLASS (object_class), tree_model_sort_signals, LAST_SIGNAL); } static void diff --git a/gtk/gtktreeselection.c b/gtk/gtktreeselection.c index 4654a7de2..4487f3dc0 100644 --- a/gtk/gtktreeselection.c +++ b/gtk/gtktreeselection.c @@ -73,6 +73,8 @@ gtk_tree_selection_class_init (GtkTreeSelectionClass *class) object_class = (GtkObjectClass*) class; parent_class = g_type_class_peek_parent (class); + class->selection_changed = NULL; + tree_selection_signals[SELECTION_CHANGED] = gtk_signal_new ("selection_changed", GTK_RUN_FIRST, @@ -80,10 +82,6 @@ gtk_tree_selection_class_init (GtkTreeSelectionClass *class) GTK_SIGNAL_OFFSET (GtkTreeSelectionClass, selection_changed), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, tree_selection_signals, LAST_SIGNAL); - - class->selection_changed = NULL; } static void diff --git a/gtk/gtktreestore.c b/gtk/gtktreestore.c index b57de7082..272464f42 100644 --- a/gtk/gtktreestore.c +++ b/gtk/gtktreestore.c @@ -146,8 +146,6 @@ gtk_tree_store_class_init (GtkTreeStoreClass *tree_store_class) gtk_marshal_VOID__BOXED, G_TYPE_NONE, 1, GTK_TYPE_TREE_PATH); - - gtk_object_class_add_signals (object_class, tree_store_signals, LAST_SIGNAL); } static void diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c index ca6e06f85..be5b21374 100644 --- a/gtk/gtktreeviewcolumn.c +++ b/gtk/gtktreeviewcolumn.c @@ -76,6 +76,8 @@ gtk_tree_view_column_class_init (GtkTreeViewColumnClass *class) parent_class = g_type_class_peek_parent (class); + class->clicked = gtk_real_tree_column_clicked; + tree_column_signals[CLICKED] = gtk_signal_new ("clicked", GTK_RUN_FIRST, @@ -83,10 +85,6 @@ gtk_tree_view_column_class_init (GtkTreeViewColumnClass *class) GTK_SIGNAL_OFFSET (GtkTreeViewColumnClass, clicked), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, tree_column_signals, LAST_SIGNAL); - - class->clicked = gtk_real_tree_column_clicked; } static void diff --git a/gtk/gtktypeutils.c b/gtk/gtktypeutils.c index 235b461d9..eae0e3f18 100644 --- a/gtk/gtktypeutils.c +++ b/gtk/gtktypeutils.c @@ -94,7 +94,7 @@ gtk_type_new (GtkType type) g_return_val_if_fail (GTK_TYPE_IS_OBJECT (type), NULL); - object = g_type_create_instance (type); + object = g_object_new (type, NULL); return object; } diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 315b256d4..c0d48baed 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -783,8 +783,6 @@ gtk_widget_class_init (GtkWidgetClass *klass) gtk_marshal_VOID__POINTER, GTK_TYPE_NONE, 1, GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, widget_signals, LAST_SIGNAL); } static void @@ -1038,7 +1036,7 @@ gtk_widget_init (GtkWidget *widget) /** * gtk_widget_new: * @type: type ID of the widget to create - * @first_arg_name: name of first property to set + * @first_property_name: name of first property to set * @Varargs: value of first property, followed by more properties, NULL-terminated * * This is a convenience function for creating a widget and setting @@ -1052,192 +1050,42 @@ gtk_widget_init (GtkWidget *widget) **/ GtkWidget* gtk_widget_new (GtkType type, - const gchar *first_arg_name, + const gchar *first_property_name, ...) { - GtkObject *object; + GtkWidget *widget; va_list var_args; - GSList *arg_list = NULL; - GSList *info_list = NULL; - gchar *error; g_return_val_if_fail (gtk_type_is_a (type, GTK_TYPE_WIDGET), NULL); - object = gtk_type_new (type); - - va_start (var_args, first_arg_name); - error = gtk_object_args_collect (GTK_OBJECT_TYPE (object), - &arg_list, - &info_list, - first_arg_name, - var_args); + va_start (var_args, first_property_name); + widget = g_object_new_valist (type, first_property_name, var_args); va_end (var_args); - - if (error) - { - g_warning ("gtk_widget_new(): %s", error); - g_free (error); - } - else - { - GSList *slist_arg; - GSList *slist_info; - - slist_arg = arg_list; - slist_info = info_list; - while (slist_arg) - { - gtk_object_arg_set (object, slist_arg->data, slist_info->data); - slist_arg = slist_arg->next; - slist_info = slist_info->next; - } - gtk_args_collect_cleanup (arg_list, info_list); - } - - if (!GTK_OBJECT_CONSTRUCTED (object)) - gtk_object_default_construct (object); - - return GTK_WIDGET (object); -} - -/** - * gtk_widget_newv: - * @type: a #GtkType for the widget to create - * @nargs: number of args in @args - * @args: array of args specifying widget properties - * - * Same as gtk_widget_new(), but takes an array instead of using - * varargs. This version is only useful if you need to construct - * the args programmatically. Equivalent to gtk_object_newv(), but - * returns a #GtkWidget so you don't have to case the object yourself. - * - * Return value: a #GtkWidget - **/ -GtkWidget* -gtk_widget_newv (GtkType type, - guint nargs, - GtkArg *args) -{ - g_return_val_if_fail (gtk_type_is_a (type, GTK_TYPE_WIDGET), NULL); - - return GTK_WIDGET (gtk_object_newv (type, nargs, args)); -} - -/** - * gtk_widget_get: - * @widget: a #GtkWidget - * @arg: single #GtkArg with the argument name filled in - * - * Queries the value of @arg, storing it in @arg. - **/ -void -gtk_widget_get (GtkWidget *widget, - GtkArg *arg) -{ - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_WIDGET (widget)); - g_return_if_fail (arg != NULL); - - gtk_object_getv (GTK_OBJECT (widget), 1, arg); -} -/** - * gtk_widget_getv: - * @widget: a #GtkWidget - * @nargs: number of args in @args - * @args: array of #GtkArg - * - * Like calling gtk_widget_get() on each arg in @args. - **/ -void -gtk_widget_getv (GtkWidget *widget, - guint nargs, - GtkArg *args) -{ - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_WIDGET (widget)); - - gtk_object_getv (GTK_OBJECT (widget), nargs, args); + return widget; } /** * gtk_widget_set: * @widget: a #GtkWidget - * @first_arg_name: name of first arg to set - * @Varargs: value of first arg, then more name-value pairs, and %NULL-terminated + * @first_property_name: name of first property to set + * @Varargs: value of first property, followed by more properties, NULL-terminated * * Like gtk_object_set() - there's no reason to use this instead of * gtk_object_set(). **/ void gtk_widget_set (GtkWidget *widget, - const gchar *first_arg_name, + const gchar *first_property_name, ...) { - GtkObject *object; va_list var_args; - GSList *arg_list = NULL; - GSList *info_list = NULL; - gchar *error; - g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget)); - object = GTK_OBJECT (widget); - - va_start (var_args, first_arg_name); - error = gtk_object_args_collect (GTK_OBJECT_TYPE (object), - &arg_list, - &info_list, - first_arg_name, - var_args); + va_start (var_args, first_property_name); + g_object_set_valist (G_OBJECT (widget), first_property_name, var_args); va_end (var_args); - - if (error) - { - g_warning ("gtk_widget_set(): %s", error); - g_free (error); - } - else - { - GSList *slist_arg; - GSList *slist_info; - - slist_arg = arg_list; - slist_info = info_list; - while (slist_arg) - { - gtk_object_arg_set (object, slist_arg->data, slist_info->data); - slist_arg = slist_arg->next; - slist_info = slist_info->next; - } - gtk_args_collect_cleanup (arg_list, info_list); - } -} - -/** - * gtk_widget_setv: - * @widget: a #GtkWidget - * @nargs: args in @args - * @args: array of args to set on the widget - * - * Each arg in @args should have its name and value filled in. The - * corresponding properties will be set on the - * widget. gtk_object_set() is a more convenient version of this - * function, since it takes varargs in place of the array. You may - * need the array version to construct the list of args to set at - * runtime. - * - **/ -void -gtk_widget_setv (GtkWidget *widget, - guint nargs, - GtkArg *args) -{ - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_WIDGET (widget)); - - gtk_object_setv (GTK_OBJECT (widget), nargs, args); } static inline void @@ -1416,7 +1264,6 @@ gtk_widget_destroy (GtkWidget *widget) { g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget)); - g_return_if_fail (GTK_OBJECT_CONSTRUCTED (widget)); gtk_object_destroy ((GtkObject*) widget); } @@ -2872,7 +2719,7 @@ gtk_widget_is_focus (GtkWidget *widget) { GtkWidget *toplevel; - g_return_if_fail (GTK_IS_WIDGET (widget)); + g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); toplevel = gtk_widget_get_toplevel (widget); diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index 70bfd6b96..aa36d1572 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -398,27 +398,16 @@ struct _GtkWidgetShapeInfo GtkType gtk_widget_get_type (void) G_GNUC_CONST; GtkWidget* gtk_widget_new (GtkType type, - const gchar *first_arg_name, + const gchar *first_property_name, ...); -GtkWidget* gtk_widget_newv (GtkType type, - guint nargs, - GtkArg *args); GtkWidget* gtk_widget_ref (GtkWidget *widget); void gtk_widget_unref (GtkWidget *widget); void gtk_widget_destroy (GtkWidget *widget); void gtk_widget_destroyed (GtkWidget *widget, GtkWidget **widget_pointer); -void gtk_widget_get (GtkWidget *widget, - GtkArg *arg); -void gtk_widget_getv (GtkWidget *widget, - guint nargs, - GtkArg *args); void gtk_widget_set (GtkWidget *widget, - const gchar *first_arg_name, + const gchar *first_property_name, ...); -void gtk_widget_setv (GtkWidget *widget, - guint nargs, - GtkArg *args); void gtk_widget_unparent (GtkWidget *widget); void gtk_widget_show (GtkWidget *widget); void gtk_widget_show_now (GtkWidget *widget); @@ -658,7 +647,6 @@ void gtk_widget_class_path (GtkWidget *widget, #endif /* GTK_TRACE_OBJECTS && __GNUC__ */ - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index bea9bb646..898748dae 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -218,28 +218,6 @@ gtk_window_class_init (GtkWindowClass *klass) gobject_class->shutdown = gtk_window_shutdown; gobject_class->finalize = gtk_window_finalize; - gtk_object_add_arg_type ("GtkWindow::type", GTK_TYPE_WINDOW_TYPE, GTK_ARG_READWRITE, ARG_TYPE); - gtk_object_add_arg_type ("GtkWindow::title", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TITLE); - gtk_object_add_arg_type ("GtkWindow::auto_shrink", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_AUTO_SHRINK); - gtk_object_add_arg_type ("GtkWindow::allow_shrink", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ALLOW_SHRINK); - gtk_object_add_arg_type ("GtkWindow::allow_grow", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ALLOW_GROW); - gtk_object_add_arg_type ("GtkWindow::modal", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_MODAL); - gtk_object_add_arg_type ("GtkWindow::window_position", GTK_TYPE_WINDOW_POSITION, GTK_ARG_READWRITE, ARG_WIN_POS); - gtk_object_add_arg_type ("GtkWindow::default_width", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_DEFAULT_WIDTH); - gtk_object_add_arg_type ("GtkWindow::default_height", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_DEFAULT_HEIGHT); - gtk_object_add_arg_type ("GtkWindow::destroy_with_parent", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DESTROY_WITH_PARENT); - - window_signals[SET_FOCUS] = - gtk_signal_new ("set_focus", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkWindowClass, set_focus), - gtk_marshal_VOID__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_WIDGET); - - gtk_object_class_add_signals (object_class, window_signals, LAST_SIGNAL); - object_class->set_arg = gtk_window_set_arg; object_class->get_arg = gtk_window_get_arg; object_class->destroy = gtk_window_destroy; @@ -266,6 +244,26 @@ gtk_window_class_init (GtkWindowClass *klass) container_class->focus = gtk_window_focus; klass->set_focus = gtk_window_real_set_focus; + + gtk_object_add_arg_type ("GtkWindow::type", GTK_TYPE_WINDOW_TYPE, GTK_ARG_READWRITE, ARG_TYPE); + gtk_object_add_arg_type ("GtkWindow::title", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TITLE); + gtk_object_add_arg_type ("GtkWindow::auto_shrink", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_AUTO_SHRINK); + gtk_object_add_arg_type ("GtkWindow::allow_shrink", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ALLOW_SHRINK); + gtk_object_add_arg_type ("GtkWindow::allow_grow", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ALLOW_GROW); + gtk_object_add_arg_type ("GtkWindow::modal", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_MODAL); + gtk_object_add_arg_type ("GtkWindow::window_position", GTK_TYPE_WINDOW_POSITION, GTK_ARG_READWRITE, ARG_WIN_POS); + gtk_object_add_arg_type ("GtkWindow::default_width", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_DEFAULT_WIDTH); + gtk_object_add_arg_type ("GtkWindow::default_height", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_DEFAULT_HEIGHT); + gtk_object_add_arg_type ("GtkWindow::destroy_with_parent", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DESTROY_WITH_PARENT); + + window_signals[SET_FOCUS] = + gtk_signal_new ("set_focus", + GTK_RUN_LAST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GtkWindowClass, set_focus), + gtk_marshal_VOID__POINTER, + GTK_TYPE_NONE, 1, + GTK_TYPE_WIDGET); } static void diff --git a/gtk/stock-icons/Makefile.am b/gtk/stock-icons/Makefile.am index c11abfca2..6ea383e8c 100644 --- a/gtk/stock-icons/Makefile.am +++ b/gtk/stock-icons/Makefile.am @@ -1,8 +1,25 @@ -BUILT_SOURCES=gtkstockpixbufs.h -IMAGES= dialog_error.png dialog_info.png dialog_question.png dialog_warning.png stock_button_apply.png stock_button_cancel.png stock_button_close.png stock_button_no.png stock_button_ok.png stock_button_yes.png stock_close.png stock_exit.png stock_help.png stock_new.png stock_open.png stock_save.png +IMAGES = @STRIP_BEGIN@ \ + dialog_error.png \ + dialog_info.png \ + dialog_question.png \ + dialog_warning.png \ + stock_button_apply.png \ + stock_button_cancel.png \ + stock_button_close.png \ + stock_button_no.png \ + stock_button_ok.png \ + stock_button_yes.png \ + stock_close.png \ + stock_exit.png \ + stock_help.png \ + stock_new.png \ + stock_open.png \ + stock_save.png \ +@STRIP_END@ -VARIABLES= dialog_error dialog_error.png \ +VARIABLES = @STRIP_BEGIN@ \ + dialog_error dialog_error.png \ dialog_info dialog_info.png \ dialog_question dialog_question.png \ dialog_warning dialog_warning.png \ @@ -17,15 +34,17 @@ VARIABLES= dialog_error dialog_error.png \ stock_help stock_help.png \ stock_new stock_new.png \ stock_open stock_open.png \ - stock_save stock_save.png + stock_save stock_save.png \ +@STRIP_END@ -gtkstockpixbufs.h: $(top_builddir)/gdk-pixbuf/make-inline-pixbuf $(IMAGES) - (topdir=`cd $(top_builddir) && pwd` ; curdir=`pwd` ; \ - cd $(top_srcdir)/gtk/stock-icons && \ - GDK_PIXBUF_MODULEDIR=$$topdir/gdk-pixbuf/.libs $$topdir/gdk-pixbuf/make-inline-pixbuf $$curdir/gtkstockpixbufs.h $(VARIABLES)) +noinst_DATA = gtkstockpixbufs.h +CLEANFILES += $(noinst_DATA) -EXTRA_DIST = $(IMAGES) +pixbuf_dir = $(top_builddir)/gdk-pixbuf -# For some reason, rebuilding of this file doesn't happen in the make dist'ed version, so force it. +gtkstockpixbufs.h: $(pixbuf_dir)/make-inline-pixbuf $(IMAGES) + cd $(srcdir) \ + && GDK_PIXBUF_MODULEDIR=$(pixbuf_dir)/.libs \ + $(pixbuf_dir)/make-inline-pixbuf gtkstockpixbufs.h $(VARIABLES) -all-am: gtkstockpixbufs.h +EXTRA_DIST = $(IMAGES) |