documented necessary changes for 1.4 transition.

Fri May 12 17:13:32 2000  Tim Janik  <timj@gtk.org>

	* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.

	* gtk/gtktext.c: made the adjustments no-construct args, simply
	provide default adjustments.
	(gtk_text_destroy): release adjustments.

	* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
	adjustment argument non-construct.

	* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
	instead of in finalize.
	(gtk_progress_get_text_from_value):
	(gtk_progress_get_current_text):
	(gtk_progress_set_value):
	(gtk_progress_get_percentage_from_value):
	(gtk_progress_get_current_percentage):
	(gtk_progress_set_percentage):
	(gtk_progress_configure): ensure an adjustment is present.

Thu May 11 01:24:08 2000  Tim Janik  <timj@gtk.org>

	* gtk/gtkcolorsel.[hc]:
	* gtk/gtkcolorseldialog.[hc]:
	* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
	their parent implementation, use bit fields for boolean values, don't
	create unused widgets, usage of glib types, braces go on their own
	lines, function argument alignment, #include directives etc. etc. etc..

	* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.

Wed May 10 23:29:52 2000  Tim Janik  <timj@gtk.org>

	* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.

	* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
	of NULL.

	* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
	to freed data.
	(gtk_combo_destroy): don't keep a pointer to a destroyed window.

	* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
	to NULL when the toplevel is getting destroyed.
	(gtk_menu_set_tearoff_state): same here for the tearoff_window.
	(gtk_menu_destroy):
	(gtk_menu_init): store the information of whether we have to
	readd the initial child ref_count during destruction in a new
	GtkMenu field needs_destruction_ref_count.

	* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
	here, those reading: learn from my mistake! ;)
	in order for set_?adjustment to support a default adjustemnt if
	invoked with an adjustment pointer of NULL, the code read (pseudo):
	if (v->adjustment) unref (v->adjustment);
	if (!adjustment) adjustment = adjustment_new ();
	if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
	now imagine the first unref to actually free the old adjustment and
	adjustment_new() creating a new adjustment from the very same memory
	portion. here, the latter comparision will unintendedly fail, and
	all hell breaks loose.
	(gtk_viewport_set_hadjustment):
	(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
	after unreferencing it.

	* gtk/gtkcontainer.[hc]: removed toplevel registration
	functions: gtk_container_register_toplevel(),
	gtk_container_unregister_toplevel() and
	gtk_container_get_toplevels() which had wrong semantics
	anyways: it didn't reference and copy the list.

	* gtk/gtkwindow.c: we take over the container toplevel registration
	bussiness now. windows are registered across multiple destructions,
	untill they are finalized. the initial implicit reference count
	users are holding on windows is removed with the first destruction
	though.
	(gtk_window_init): ref & sink and set has_user_ref_count, got
	rid of gtk_container_register_toplevel() call. add window to
	toplevel_list.
	(gtk_window_destroy): unref the window if has_user_ref_count
	is still set, got rid of call to
	gtk_container_unregister_toplevel().
	(gtk_window_finalize): remove window from toplevel list.
	(gtk_window_list_toplevels): new function to return a newly
	created list with referenced toplevels.
	(gtk_window_read_rcfiles): use gtk_window_list_toplevels().

	* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
	adjustment a non-construct arg.
	* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
	* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
	* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.

	* gtk/gtkrange.c: added some realized checks.
	(gtk_range_destroy): get rid of the h/v adjustments in the
	destroy handler instead of finalize. remove timer.
	(gtk_range_get_adjustment): demand create adjustment.

	* gtk/gtkviewport.c: made h/v adjustment non-construct args.
	we simply create them on demand now and get rid of them in
	the destroy handler.
	(gtk_viewport_destroy): get rid of the h/v adjustments in the
	destroy handler instead of finalize.
	(gtk_viewport_get_hadjustment):
	(gtk_viewport_get_vadjustment):
	(gtk_viewport_size_allocate): demand create h/v adjustment
	if required.

	* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
	gtk_widget_real_destroy () functionality.
	(gtk_widget_real_destroy): reinitialize with a new style, instead
	of setting widget->style to NULL.

Fri May  5 13:02:09 2000  Tim Janik  <timj@gtk.org>

	* gtk/gtkcalendar.c:
	* gtk/gtkbutton.c: ported _get_type() implementation over to
	GType, either to preserve memchunks allocation facilities,
	or because Gtk+ 1.0 GtkTypeInfo was still being used.

	* gtk/gtkobject.[hc]: derive from GObject. ported various functions
	over. prepare for ::destroy to be emitted multiple times.
	removed reference tracer magic. chain into GObjectClass.shutdown()
	to emit ::destroy signal.

	* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
	fundamental.

	* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
	cludge.

	* gtk/gtksocket.c:
	* gtk/gtkplug.c:
	* gtk/gtklayout.c:
	* gtk/gtklabel.c:
	* gtk/gtkargcollector.c:
	* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
	not being a fundamental anymore, and to work with the new
	type system (nuked fundamental type varargs clutter).

	* gtk/*.c: install finalize handlers in the GObjectClass
	part of the class structure.
	changed direct GTK_OBJECT()->klass accesses to
	GTK_*_GET_CLASS().
	changed direct object_class->type accesses to GTK_CLASS_TYPE().

	* gtktypeutils.[hc]: use the reserved fundamental ids provided by
	GType. made most of the GTK_*() type macros and Gtk* typedefs
	simple wrappers around macros and types provided by GType.
	most notably, a significant portion of the old API vanished:
	GTK_TYPE_MAKE(),
	GTK_TYPE_SEQNO(),
	GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
	GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
	GTK_TYPE_ARGS,
	GTK_TYPE_CALLBACK,
	GTK_TYPE_C_CALLBACK,
	GTK_TYPE_FOREIGN,
	GtkTypeQuery,
	gtk_type_query(),
	gtk_type_set_varargs_type(),
	gtk_type_get_varargs_type(),
	gtk_type_check_object_cast(),
	gtk_type_check_class_cast(),
	gtk_type_describe_tree(),
	gtk_type_describe_heritage(),
	gtk_type_free(),
	gtk_type_children_types(),
	gtk_type_set_chunk_alloc(),
	gtk_type_register_enum(),
	gtk_type_register_flags(),
	gtk_type_parent_class().
	replacements, where available are described in ../docs/Changes-1.4.txt.
	implemented compatibility functions for the remaining API.

	* configure.in: depend on glib 1.3.1, use gobject module.
This commit is contained in:
Tim Janik 2000-05-12 15:25:50 +00:00 committed by Tim Janik
parent 5ef1e2e970
commit 9595c55184
94 changed files with 6345 additions and 6004 deletions

178
ChangeLog
View File

@ -1,3 +1,181 @@
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
Thu May 11 12:39:50 2000 Owen Taylor <otaylor@redhat.com>
* TODO.xml: Various updates to current status.

View File

@ -1,3 +1,181 @@
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
Thu May 11 12:39:50 2000 Owen Taylor <otaylor@redhat.com>
* TODO.xml: Various updates to current status.

View File

@ -1,3 +1,181 @@
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
Thu May 11 12:39:50 2000 Owen Taylor <otaylor@redhat.com>
* TODO.xml: Various updates to current status.

View File

@ -1,3 +1,181 @@
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
Thu May 11 12:39:50 2000 Owen Taylor <otaylor@redhat.com>
* TODO.xml: Various updates to current status.

View File

@ -1,3 +1,181 @@
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
Thu May 11 12:39:50 2000 Owen Taylor <otaylor@redhat.com>
* TODO.xml: Various updates to current status.

View File

@ -1,3 +1,181 @@
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
Thu May 11 12:39:50 2000 Owen Taylor <otaylor@redhat.com>
* TODO.xml: Various updates to current status.

View File

@ -1,3 +1,181 @@
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
Thu May 11 12:39:50 2000 Owen Taylor <otaylor@redhat.com>
* TODO.xml: Various updates to current status.

View File

@ -252,16 +252,16 @@ fi
if test x$with_glib = x ; then
# Look for separately installed glib
AM_PATH_GLIB(1.3.0,,
AM_PATH_GLIB(1.3.1,,
AC_MSG_ERROR([
*** GLIB 1.3.0 or better is required. The latest version of GLIB
*** is always available from ftp://ftp.gtk.org/.]),
gmodule gthread)
gobject gmodule gthread)
# we do not want to make all gtk progs to link to thread libraries.
glib_cflags=`$GLIB_CONFIG glib gmodule --cflags`
glib_cflags=`$GLIB_CONFIG glib gobject gmodule --cflags`
glib_thread_cflags="$GLIB_CFLAGS"
glib_libs=`$GLIB_CONFIG glib gmodule --libs`
glib_libs=`$GLIB_CONFIG glib gobject gmodule --libs`
glib_thread_libs="$GLIB_LIBS"
GLIB_LIBS="$glib_libs"
GLIB_DEPLIBS="$glib_libs"

View File

@ -1,26 +1,101 @@
Incompatible Changes from GTK+-1.2 to GTK+-1.4:
- The gdk_time* functions have been removed. This functionality
* The gdk_time* functions have been removed. This functionality
has been unused since the main loop was moved into GLib
prior to 1.2.
- The signature for GtkPrintFunc (used for gtk_item_factory_dump_items)
* The signature for GtkPrintFunc (used for gtk_item_factory_dump_items)
has been changed to take a 'const gchar *' instead of 'gchar *', to
match what we do for glib, and other similar cases.
- The detail arguments in the GtkStyleClass structure are now 'const gchar *'.
* The detail arguments in the GtkStyleClass structure are now 'const gchar *'.
- gtk_paned_set_gutter_size() has been removed, since the small handle tab
* gtk_paned_set_gutter_size() has been removed, since the small handle tab
has been changed to include the entire area previously occupied by
the gutter.
- GDK no longer selects OwnerGrabButtonMask for button presses. This means
* GDK no longer selects OwnerGrabButtonMask for button presses. This means
that the automatic grab that occurs when the user presses a button
will have owner_events = FALSE, so all events are redirected to the
grab window, even events that would normally go to other windows of the
window's owner.
- The detail arguments in the GtkStyleClass structure are now 'const gchar *'.
* GtkColorSelectionDialog has now been moved into it's own set of files,
gtkcolorseldialog.c and gtkcolorseldialog.h.
- GtkColorSelectionDialog has now been moved into it's own set of files,
gtkcolorseldialog.c and gtkcolorseldialog.h.
* Type system changes:
- GTK_TYPE_OBJECT is not a fundamental type anymore. Type checks of the
style (GTK_FUNDAMENTAL_TYPE (some_type) == GTK_TYPE_OBJECT)
will not work anymore. As a replacement, (GTK_TYPE_IS_OBJECT (some_type))
can be used now.
- The following types vanished: GTK_TYPE_ARGS, GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK, GTK_TYPE_FOREIGN. With them, the corresponding GtkARg
fields and field access macros vanished as well.
- The following type aliases vanished: GTK_TYPE_FLAT_FIRST,
GTK_TYPE_FLAT_LAST, GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST.
- The type macros GTK_TYPE_MAKE() and GTK_TYPE_SEQNO() vanished, use of
GTK_FUNDAMENTAL_TYPE() is discouraged. Instead, the corresponding GType
API should be used: G_TYPE_FUNDAMENTAL(), G_TYPE_DERIVE_ID(),
G_TYPE_BRANCH_SEQNO(). Note that the GLib type system doesn't build new
type ids based on a global incremental sequential number anymore, but
numbers new type ids sequentially per fundamental type branch.
- The following type functions vanished/were replaced:
Old Function Replacement
gtk_type_query() - being investigated -
gtk_type_set_varargs_type() -
gtk_type_get_varargs_type() -
gtk_type_check_object_cast() g_type_check_instance_cast()
gtk_type_check_class_cast() g_type_check_class_cast()
gtk_type_describe_tree() -
gtk_type_describe_heritage() -
gtk_type_free() -
gtk_type_children_types() g_type_children()
gtk_type_set_chunk_alloc() GTypeInfo.n_preallocs
gtk_type_register_enum() g_enum_register_static()
gtk_type_register_flags() g_flags_register_static()
gtk_type_parent_class() g_type_parent() / g_type_class_peek_parent()
Use of g_type_class_ref() / g_type_class_unref() and g_type_class_peek()
is recommended over usage of gtk_type_class().
Use of g_type_register_static() / g_type_register_dynamic() is recommended
over usage of gtk_type_unique().
* Object system changes:
GtkObject derives from GObject, it is not the basic object type anymore.
This imposes the following source incompatible changes:
- GtkObject has no klass field anymore, an object's class can be retrived
with the object's coresponding GTK_<OBJECT>_GET_CLASS (object) macro.
- GtkObjectClass has no type field anymore, a class's type can be retrived
with the GTK_CLASS_TYPE (class) macro.
- GtkObjectClass does not introduce the finalize() or shutdown() method
anymore. While shutdown() is intended for Gtk internal use only, finalize()
is required by a variety of object implementations. GObjectClass.finalize
should be overriden here, e.g.:
static void gtk_label_finalize (GObject *gobject)
{
GtkLabel *label = GTK_LABEL (gobject);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void gtk_label_class_init (GtkLabelClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
gobject_class->finalize = gtk_label_finalize;
}
- the GtkObject::destroy signal can be emitted multiple times on an object
now. ::destroy implementations have to take this into account by
conditionalising freeing/release of assorted resources, e.g.:
if (object->foo_data)
{
g_free (object->foo_data);
object->foo_data = NULL;
}
Also, ::destroy implementations have to release peding object references,
that is, code portions commonly found in finalize implementations like:
if (object->adjustment)
{
gtk_object_unref (object->adjustment);
object->adjustment = NULL;
}
have to be moved into the ::destroy implementations.
This is required to break object reference cycles at destruction time.

View File

@ -92,6 +92,7 @@ gtk_public_h_sources = @STRIP_BEGIN@ \
gtkhscale.h \
gtkhscrollbar.h \
gtkhseparator.h \
gtkhsv.h \
gtkimage.h \
gtkinputdialog.h \
gtkinvisible.h \

View File

@ -13,11 +13,7 @@
"OBJECT"=>"gpointer",
# complex types. These need special handling.
"FOREIGN"=>"FOREIGN",
"C_CALLBACK"=>"C_CALLBACK",
"SIGNAL"=>"SIGNAL",
"ARGS"=>"ARGS",
"CALLBACK"=>"CALLBACK"
"SIGNAL"=>"SIGNAL"
);
if ($#ARGV != 2) {
@ -106,24 +102,7 @@ EOT
print OS "typedef $trans{$retval} (*GtkSignal_$funcname) (GtkObject *object, \n";
$argn = 1;
for (@params) {
if($_ eq "C_CALLBACK") {
print OS "gpointer arg".$argn."a,\n";
print OS "gpointer arg".$argn."b,\n";
$argn++;
} elsif($_ eq "SIGNAL") {
print OS "gpointer arg".$argn."a,\n";
print OS "gpointer arg".$argn."b,\n";
$argn++;
} elsif($_ eq "ARGS") {
print OS "gpointer arg".$argn."a,\n";
print OS "gpointer arg".$argn."b,\n";
$argn++;
} elsif($_ eq "CALLBACK") {
print OS "gpointer arg".$argn."a,\n";
print OS "gpointer arg".$argn."b,\n";
print OS "gpointer arg".$argn."c,\n";
$argn++;
} elsif($_ eq "FOREIGN") {
if($_ eq "SIGNAL") {
print OS "gpointer arg".$argn."a,\n";
print OS "gpointer arg".$argn."b,\n";
$argn++;
@ -153,26 +132,10 @@ EOT
print OS " (* rfunc) (object,\n";
for($i = 0; $i < (scalar @params); $i++) {
if($params[$i] eq "C_CALLBACK") {
print OS <<EOT;
GTK_VALUE_C_CALLBACK(args[$i]).func,
GTK_VALUE_C_CALLBACK(args[$i]).func_data,
EOT
} elsif ($params[$i] eq "SIGNAL") {
if ($params[$i] eq "SIGNAL") {
print OS <<EOT;
GTK_VALUE_SIGNAL(args[$i]).f,
GTK_VALUE_SIGNAL(args[$i]).d,
EOT
} elsif ($params[$i] eq "CALLBACK") {
print OS <<EOT;
GTK_VALUE_CALLBACK(args[$i]).marshal,
GTK_VALUE_CALLBACK(args[$i]).data,
GTK_VALUE_CALLBACK(args[$i]).notify,
EOT
} elsif ($params[$i] eq "FOREIGN") {
print OS <<EOT;
GTK_VALUE_FOREIGN(args[$i]).data,
GTK_VALUE_FOREIGN(args[$i]).notify,
EOT
} elsif ($params[$i] eq "NONE") {
} else {

View File

@ -685,8 +685,6 @@ EXPORTS
gtk_marshal_INT__POINTER
gtk_marshal_INT__POINTER_CHAR_CHAR
gtk_marshal_NONE__BOOL
gtk_marshal_NONE__C_CALLBACK
gtk_marshal_NONE__C_CALLBACK_C_CALLBACK
gtk_marshal_NONE__INT
gtk_marshal_NONE__INT_FLOAT
gtk_marshal_NONE__INT_FLOAT_BOOL

View File

@ -656,7 +656,7 @@ gtk_accel_group_create_add (GtkType class_type,
GtkSignalRunType signal_flags,
guint handler_offset)
{
g_return_val_if_fail (gtk_type_is_a (class_type, GTK_TYPE_OBJECT), 0);
g_return_val_if_fail (GTK_TYPE_IS_OBJECT (class_type), 0);
return gtk_signal_new ("add-accelerator",
signal_flags,
@ -676,7 +676,7 @@ gtk_accel_group_create_remove (GtkType class_type,
GtkSignalRunType signal_flags,
guint handler_offset)
{
g_return_val_if_fail (gtk_type_is_a (class_type, GTK_TYPE_OBJECT), 0);
g_return_val_if_fail (GTK_TYPE_IS_OBJECT (class_type), 0);
return gtk_signal_new ("remove-accelerator",
signal_flags,

View File

@ -48,7 +48,7 @@ static void gtk_accel_label_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_accel_label_destroy (GtkObject *object);
static void gtk_accel_label_finalize (GtkObject *object);
static void gtk_accel_label_finalize (GObject *object);
static void gtk_accel_label_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static gint gtk_accel_label_expose_event (GtkWidget *widget,
@ -87,6 +87,7 @@ gtk_accel_label_get_type (void)
static void
gtk_accel_label_class_init (GtkAccelLabelClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkMiscClass *misc_class;
@ -102,10 +103,11 @@ gtk_accel_label_class_init (GtkAccelLabelClass *class)
gtk_object_add_arg_type ("GtkAccelLabel::accel_widget", GTK_TYPE_WIDGET, GTK_ARG_READWRITE, ARG_ACCEL_WIDGET);
gobject_class->finalize = gtk_accel_label_finalize;
object_class->set_arg = gtk_accel_label_set_arg;
object_class->get_arg = gtk_accel_label_get_arg;
object_class->destroy = gtk_accel_label_destroy;
object_class->finalize = gtk_accel_label_finalize;
widget_class->size_request = gtk_accel_label_size_request;
widget_class->expose_event = gtk_accel_label_expose_event;
@ -200,18 +202,17 @@ gtk_accel_label_destroy (GtkObject *object)
}
static void
gtk_accel_label_finalize (GtkObject *object)
gtk_accel_label_finalize (GObject *object)
{
GtkAccelLabel *accel_label;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_ACCEL_LABEL (object));
accel_label = GTK_ACCEL_LABEL (object);
g_free (accel_label->accel_string);
GTK_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
guint
@ -376,7 +377,7 @@ gtk_accel_label_refetch (GtkAccelLabel *accel_label)
g_return_val_if_fail (accel_label != NULL, FALSE);
g_return_val_if_fail (GTK_IS_ACCEL_LABEL (accel_label), FALSE);
class = GTK_ACCEL_LABEL_CLASS (GTK_OBJECT (accel_label)->klass);
class = GTK_ACCEL_LABEL_GET_CLASS (accel_label);
g_free (accel_label->accel_string);
accel_label->accel_string = NULL;

View File

@ -77,14 +77,14 @@ gtk_adjustment_class_init (GtkAdjustmentClass *class)
adjustment_signals[CHANGED] =
gtk_signal_new ("changed",
GTK_RUN_FIRST | GTK_RUN_NO_RECURSE,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkAdjustmentClass, changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
adjustment_signals[VALUE_CHANGED] =
gtk_signal_new ("value_changed",
GTK_RUN_FIRST | GTK_RUN_NO_RECURSE,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkAdjustmentClass, value_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);

View File

@ -65,7 +65,7 @@ gtk_arg_type_new_static (GtkType base_class_type,
gchar *p;
g_return_val_if_fail (arg_name != NULL, NULL);
g_return_val_if_fail (GTK_FUNDAMENTAL_TYPE (base_class_type) == GTK_TYPE_OBJECT, NULL);
g_return_val_if_fail (GTK_TYPE_IS_OBJECT (base_class_type), NULL);
g_return_val_if_fail (class_n_args_offset != 0, NULL);
g_return_val_if_fail (arg_info_hash_table != NULL, NULL);
g_return_val_if_fail (arg_type > GTK_TYPE_NONE, NULL);
@ -214,7 +214,7 @@ gtk_arg_get_info (GtkType object_type,
else
{
otype = object_type;
while (!*info_p && GTK_FUNDAMENTAL_TYPE (otype) == GTK_TYPE_OBJECT)
while (!*info_p && GTK_TYPE_IS_OBJECT (otype))
{
GtkArgInfo info;
@ -440,12 +440,6 @@ gtk_arg_reset (GtkArg *arg)
g_return_if_fail (arg != NULL);
fundamental_type = GTK_FUNDAMENTAL_TYPE (arg->type);
if (fundamental_type > GTK_TYPE_FUNDAMENTAL_LAST)
{
fundamental_type = gtk_type_get_varargs_type (fundamental_type);
if (!fundamental_type)
fundamental_type = GTK_FUNDAMENTAL_TYPE (arg->type);
}
if (fundamental_type == GTK_TYPE_STRING)
{
@ -503,12 +497,6 @@ gtk_arg_values_equal (const GtkArg *arg1,
GTK_FUNDAMENTAL_TYPE (arg2->type), FALSE);
fundamental_type = GTK_FUNDAMENTAL_TYPE (arg1->type);
if (fundamental_type > GTK_TYPE_FUNDAMENTAL_LAST)
{
fundamental_type = gtk_type_get_varargs_type (fundamental_type);
if (!fundamental_type)
fundamental_type = GTK_FUNDAMENTAL_TYPE (arg1->type);
}
switch (fundamental_type)
{
@ -555,20 +543,7 @@ gtk_arg_values_equal (const GtkArg *arg1,
case GTK_TYPE_BOXED:
equal = GTK_VALUE_BOXED (*arg1) == GTK_VALUE_BOXED (*arg2);
break;
case GTK_TYPE_FOREIGN:
equal = (GTK_VALUE_FOREIGN (*arg1).data == GTK_VALUE_FOREIGN (*arg2).data &&
GTK_VALUE_FOREIGN (*arg1).notify == GTK_VALUE_FOREIGN (*arg2).notify);
break;
case GTK_TYPE_CALLBACK:
equal = (GTK_VALUE_CALLBACK (*arg1).marshal == GTK_VALUE_CALLBACK (*arg2).marshal &&
GTK_VALUE_CALLBACK (*arg1).data == GTK_VALUE_CALLBACK (*arg2).data &&
GTK_VALUE_CALLBACK (*arg1).notify == GTK_VALUE_CALLBACK (*arg2).notify);
break;
case GTK_TYPE_ARGS:
equal = (GTK_VALUE_ARGS (*arg1).n_args == GTK_VALUE_ARGS (*arg2).n_args &&
GTK_VALUE_ARGS (*arg1).args == GTK_VALUE_ARGS (*arg2).args);
break;
case GTK_TYPE_OBJECT:
case G_TYPE_OBJECT:
equal = GTK_VALUE_OBJECT (*arg1) == GTK_VALUE_OBJECT (*arg2);
break;
case GTK_TYPE_POINTER:
@ -578,10 +553,6 @@ gtk_arg_values_equal (const GtkArg *arg1,
equal = (GTK_VALUE_SIGNAL (*arg1).f == GTK_VALUE_SIGNAL (*arg2).f &&
GTK_VALUE_SIGNAL (*arg1).d == GTK_VALUE_SIGNAL (*arg2).d);
break;
case GTK_TYPE_C_CALLBACK:
equal = (GTK_VALUE_C_CALLBACK (*arg1).func == GTK_VALUE_C_CALLBACK (*arg2).func &&
GTK_VALUE_C_CALLBACK (*arg1).func_data == GTK_VALUE_C_CALLBACK (*arg2).func_data);
break;
default:
g_warning ("gtk_arg_values_equal() used with unknown type `%s'", gtk_type_name (arg1->type));
equal = FALSE;
@ -601,12 +572,6 @@ gtk_arg_to_valueloc (GtkArg *arg,
g_return_if_fail (value_pointer != NULL);
fundamental_type = GTK_FUNDAMENTAL_TYPE (arg->type);
if (fundamental_type > GTK_TYPE_FUNDAMENTAL_LAST)
{
fundamental_type = gtk_type_get_varargs_type (fundamental_type);
if (!fundamental_type)
fundamental_type = GTK_FUNDAMENTAL_TYPE (arg->type);
}
switch (fundamental_type)
{
@ -661,15 +626,11 @@ gtk_arg_to_valueloc (GtkArg *arg,
case GTK_TYPE_STRING:
case GTK_TYPE_POINTER:
case GTK_TYPE_BOXED:
case GTK_TYPE_OBJECT:
case G_TYPE_OBJECT:
p_pointer = value_pointer;
*p_pointer = GTK_VALUE_POINTER (*arg);
break;
case GTK_TYPE_SIGNAL:
case GTK_TYPE_ARGS:
case GTK_TYPE_FOREIGN:
case GTK_TYPE_CALLBACK:
case GTK_TYPE_C_CALLBACK:
case GTK_TYPE_NONE:
case GTK_TYPE_INVALID:
/* it doesn't make much sense to retrive these values,

View File

@ -38,12 +38,6 @@ G_STMT_START { \
GtkType fundamental_type; \
\
fundamental_type = GTK_FUNDAMENTAL_TYPE (arg->type); \
if (fundamental_type > GTK_TYPE_FUNDAMENTAL_LAST) \
{ \
fundamental_type = gtk_type_get_varargs_type (fundamental_type); \
if (!fundamental_type) \
fundamental_type = GTK_FUNDAMENTAL_TYPE (arg->type); \
} \
\
error_msg = NULL; \
switch (fundamental_type) \
@ -124,42 +118,25 @@ G_STMT_START { \
GTK_VALUE_SIGNAL (*arg).f = va_arg (var_args, GtkSignalFunc); \
GTK_VALUE_SIGNAL (*arg).d = va_arg (var_args, gpointer); \
break; \
case GTK_TYPE_ARGS: \
GTK_VALUE_ARGS (*arg).n_args = va_arg (var_args, gint); \
GTK_VALUE_ARGS (*arg).args = va_arg (var_args, GtkArg*); \
break; \
case GTK_TYPE_FOREIGN: \
GTK_VALUE_FOREIGN (*arg).data = va_arg (var_args, gpointer); \
GTK_VALUE_FOREIGN (*arg).notify = va_arg (var_args, GtkDestroyNotify); \
break; \
case GTK_TYPE_CALLBACK: \
GTK_VALUE_CALLBACK (*arg).marshal = va_arg (var_args, GtkCallbackMarshal); \
GTK_VALUE_CALLBACK (*arg).data = va_arg (var_args, gpointer); \
GTK_VALUE_CALLBACK (*arg).notify = va_arg (var_args, GtkDestroyNotify); \
break; \
case GTK_TYPE_C_CALLBACK: \
GTK_VALUE_C_CALLBACK (*arg).func = va_arg (var_args, GtkFunction); \
GTK_VALUE_C_CALLBACK (*arg).func_data = va_arg (var_args, gpointer); \
break; \
\
/* we do some extra sanity checking when collecting objects, \
* i.e. if the object pointer is not NULL, we check whether we \
* actually got an object pointer within the desired class branch. \
*/ \
case GTK_TYPE_OBJECT: \
case G_TYPE_OBJECT: \
GTK_VALUE_OBJECT (*arg) = va_arg (var_args, GtkObject*); \
if (GTK_VALUE_OBJECT (*arg) != NULL) \
{ \
register GtkObject *object = GTK_VALUE_OBJECT (*arg); \
\
if (object->klass == NULL) \
if (((GTypeInstance*) object)->g_class == NULL) \
error_msg = g_strconcat ("invalid unclassed object pointer for argument type `", \
gtk_type_name (arg->type), \
"'", \
NULL); \
else if (!gtk_type_is_a (GTK_OBJECT_TYPE (object), arg->type)) \
error_msg = g_strconcat ("invalid object `", \
gtk_type_name (GTK_OBJECT_TYPE (object)), \
gtk_type_name (G_OBJECT_TYPE (object)), \
"' for argument type `", \
gtk_type_name (arg->type), \
"'", \

View File

@ -458,10 +458,10 @@ gtk_binding_set_by_class (gpointer object_class)
if (binding_set)
return binding_set;
binding_set = gtk_binding_set_new (gtk_type_name (class->type));
binding_set = gtk_binding_set_new (gtk_type_name (GTK_CLASS_TYPE (class)));
gtk_binding_set_add_path (binding_set,
GTK_PATH_CLASS,
gtk_type_name (class->type),
gtk_type_name (GTK_CLASS_TYPE (class)),
GTK_PATH_PRIO_GTK);
g_dataset_id_set_data (class, key_id_class_binding_set, binding_set);

View File

@ -108,20 +108,20 @@ gtk_button_get_type (void)
if (!button_type)
{
static const GtkTypeInfo button_info =
static const GTypeInfo button_info =
{
"GtkButton",
sizeof (GtkButton),
sizeof (GtkButtonClass),
(GtkClassInitFunc) gtk_button_class_init,
(GtkObjectInitFunc) gtk_button_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_button_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GtkButton),
16, /* n_preallocs */
(GInstanceInitFunc) gtk_button_init,
};
button_type = gtk_type_unique (GTK_TYPE_BIN, &button_info);
gtk_type_set_chunk_alloc (button_type, 16);
button_type = g_type_register_static (GTK_TYPE_BIN, "GtkButton", &button_info);
}
return button_type;
@ -146,35 +146,35 @@ gtk_button_class_init (GtkButtonClass *klass)
button_signals[PRESSED] =
gtk_signal_new ("pressed",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkButtonClass, pressed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
button_signals[RELEASED] =
gtk_signal_new ("released",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkButtonClass, released),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
button_signals[CLICKED] =
gtk_signal_new ("clicked",
GTK_RUN_FIRST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkButtonClass, clicked),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
button_signals[ENTER] =
gtk_signal_new ("enter",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkButtonClass, enter),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
button_signals[LEAVE] =
gtk_signal_new ("leave",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkButtonClass, leave),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);

View File

@ -324,18 +324,20 @@ gtk_calendar_get_type (void)
if (!calendar_type)
{
static const GtkTypeInfo calendar_info =
static const GTypeInfo calendar_info =
{
"GtkCalendar",
sizeof (GtkCalendar),
sizeof (GtkCalendarClass),
(GtkClassInitFunc) gtk_calendar_class_init,
(GtkObjectInitFunc) gtk_calendar_init,
(GtkArgSetFunc) NULL,
(GtkArgGetFunc) NULL,
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_calendar_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GtkCalendar),
16, /* n_preallocs */
(GInstanceInitFunc) gtk_calendar_init,
};
calendar_type = gtk_type_unique (GTK_TYPE_WIDGET, &calendar_info);
calendar_type = g_type_register_static (GTK_TYPE_WIDGET, "GtkCalendar", &calendar_info);
}
return calendar_type;
@ -371,37 +373,37 @@ gtk_calendar_class_init (GtkCalendarClass *class)
gtk_calendar_signals[MONTH_CHANGED_SIGNAL] =
gtk_signal_new ("month_changed",
GTK_RUN_FIRST, object_class->type,
GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCalendarClass, month_changed),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
gtk_calendar_signals[DAY_SELECTED_SIGNAL] =
gtk_signal_new ("day_selected",
GTK_RUN_FIRST, object_class->type,
GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCalendarClass, day_selected),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
gtk_calendar_signals[DAY_SELECTED_DOUBLE_CLICK_SIGNAL] =
gtk_signal_new ("day_selected_double_click",
GTK_RUN_FIRST, object_class->type,
GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCalendarClass, day_selected_double_click),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
gtk_calendar_signals[PREV_MONTH_SIGNAL] =
gtk_signal_new ("prev_month",
GTK_RUN_FIRST, object_class->type,
GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCalendarClass, prev_month),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
gtk_calendar_signals[NEXT_MONTH_SIGNAL] =
gtk_signal_new ("next_month",
GTK_RUN_FIRST, object_class->type,
GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCalendarClass, next_month),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
gtk_calendar_signals[PREV_YEAR_SIGNAL] =
gtk_signal_new ("prev_year",
GTK_RUN_FIRST, object_class->type,
GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCalendarClass, prev_year),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
gtk_calendar_signals[NEXT_YEAR_SIGNAL] =
gtk_signal_new ("next_year",
GTK_RUN_FIRST, object_class->type,
GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCalendarClass, next_year),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);

View File

@ -31,8 +31,6 @@
#define INDICATOR_SIZE 10
#define INDICATOR_SPACING 2
#define CHECK_BUTTON_CLASS(w) GTK_CHECK_BUTTON_CLASS (GTK_OBJECT (w)->klass)
static void gtk_check_button_class_init (GtkCheckButtonClass *klass);
static void gtk_check_button_init (GtkCheckButton *check_button);
@ -229,11 +227,11 @@ gtk_check_button_size_request (GtkWidget *widget,
if (toggle_button->draw_indicator)
{
requisition->width += (CHECK_BUTTON_CLASS (widget)->indicator_size +
CHECK_BUTTON_CLASS (widget)->indicator_spacing * 3 + 2);
requisition->width += (GTK_CHECK_BUTTON_GET_CLASS (widget)->indicator_size +
GTK_CHECK_BUTTON_GET_CLASS (widget)->indicator_spacing * 3 + 2);
temp = (CHECK_BUTTON_CLASS (widget)->indicator_size +
CHECK_BUTTON_CLASS (widget)->indicator_spacing * 2);
temp = (GTK_CHECK_BUTTON_GET_CLASS (widget)->indicator_size +
GTK_CHECK_BUTTON_GET_CLASS (widget)->indicator_spacing * 2);
requisition->height = MAX (requisition->height, temp) + 2;
}
}
@ -267,15 +265,15 @@ gtk_check_button_size_allocate (GtkWidget *widget,
if (GTK_BIN (button)->child && GTK_WIDGET_VISIBLE (GTK_BIN (button)->child))
{
child_allocation.x = (GTK_CONTAINER (widget)->border_width +
CHECK_BUTTON_CLASS (widget)->indicator_size +
CHECK_BUTTON_CLASS (widget)->indicator_spacing * 3 + 1 +
GTK_CHECK_BUTTON_GET_CLASS (widget)->indicator_size +
GTK_CHECK_BUTTON_GET_CLASS (widget)->indicator_spacing * 3 + 1 +
widget->allocation.x);
child_allocation.y = GTK_CONTAINER (widget)->border_width + 1 +
widget->allocation.y;
child_allocation.width = MAX (1, allocation->width -
(GTK_CONTAINER (widget)->border_width +
CHECK_BUTTON_CLASS (widget)->indicator_size +
CHECK_BUTTON_CLASS (widget)->indicator_spacing * 3 + 1) -
GTK_CHECK_BUTTON_GET_CLASS (widget)->indicator_size +
GTK_CHECK_BUTTON_GET_CLASS (widget)->indicator_spacing * 3 + 1) -
GTK_CONTAINER (widget)->border_width - 1);
child_allocation.height = MAX (1, allocation->height - (GTK_CONTAINER (widget)->border_width + 1) * 2);
@ -337,7 +335,7 @@ gtk_check_button_draw_indicator (GtkCheckButton *check_button,
g_return_if_fail (check_button != NULL);
g_return_if_fail (GTK_IS_CHECK_BUTTON (check_button));
class = CHECK_BUTTON_CLASS (check_button);
class = GTK_CHECK_BUTTON_GET_CLASS (check_button);
if (class->draw_indicator)
(* class->draw_indicator) (check_button, area);
@ -387,10 +385,10 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
new_area.width, new_area.height);
}
x = widget->allocation.x + CHECK_BUTTON_CLASS (widget)->indicator_spacing + GTK_CONTAINER (widget)->border_width;
y = widget->allocation.y + (widget->allocation.height - CHECK_BUTTON_CLASS (widget)->indicator_size) / 2;
width = CHECK_BUTTON_CLASS (widget)->indicator_size;
height = CHECK_BUTTON_CLASS (widget)->indicator_size;
x = widget->allocation.x + GTK_CHECK_BUTTON_GET_CLASS (widget)->indicator_spacing + GTK_CONTAINER (widget)->border_width;
y = widget->allocation.y + (widget->allocation.height - GTK_CHECK_BUTTON_GET_CLASS (widget)->indicator_size) / 2;
width = GTK_CHECK_BUTTON_GET_CLASS (widget)->indicator_size;
height = GTK_CHECK_BUTTON_GET_CLASS (widget)->indicator_size;
if (GTK_TOGGLE_BUTTON (widget)->active)
{

View File

@ -29,8 +29,6 @@
#include "gtksignal.h"
#define CHECK_MENU_ITEM_CLASS(w) GTK_CHECK_MENU_ITEM_CLASS (GTK_OBJECT (w)->klass)
enum {
TOGGLED,
@ -106,7 +104,7 @@ gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
check_menu_item_signals[TOGGLED] =
gtk_signal_new ("toggled",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCheckMenuItemClass, toggled),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
@ -223,10 +221,10 @@ gtk_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
{
g_return_if_fail (check_menu_item != NULL);
g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
g_return_if_fail (CHECK_MENU_ITEM_CLASS (check_menu_item) != NULL);
g_return_if_fail (GTK_CHECK_MENU_ITEM_GET_CLASS (check_menu_item) != NULL);
if (CHECK_MENU_ITEM_CLASS (check_menu_item)->draw_indicator)
(* CHECK_MENU_ITEM_CLASS (check_menu_item)->draw_indicator) (check_menu_item, area);
if (GTK_CHECK_MENU_ITEM_GET_CLASS (check_menu_item)->draw_indicator)
(* GTK_CHECK_MENU_ITEM_GET_CLASS (check_menu_item)->draw_indicator) (check_menu_item, area);
}
static void

View File

@ -128,13 +128,11 @@ LIST_WIDTH (GtkCList * clist)
g_list_nth ((clist)->row_list, (row)))
#define GTK_CLIST_CLASS_FW(_widget_) GTK_CLIST_CLASS (((GtkObject*) (_widget_))->klass)
/* redraw the list if it's not frozen */
#define CLIST_UNFROZEN(clist) (((GtkCList*) (clist))->freeze_count == 0)
#define CLIST_REFRESH(clist) G_STMT_START { \
if (CLIST_UNFROZEN (clist)) \
GTK_CLIST_CLASS_FW (clist)->refresh ((GtkCList*) (clist)); \
GTK_CLIST_GET_CLASS (clist)->refresh ((GtkCList*) (clist)); \
} G_STMT_END
@ -182,7 +180,7 @@ static void gtk_clist_init (GtkCList *clist);
/* GtkObject Methods */
static void gtk_clist_destroy (GtkObject *object);
static void gtk_clist_finalize (GtkObject *object);
static void gtk_clist_finalize (GObject *object);
static void gtk_clist_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
@ -490,6 +488,7 @@ gtk_clist_get_type (void)
static void
gtk_clist_class_init (GtkCListClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
@ -501,6 +500,12 @@ gtk_clist_class_init (GtkCListClass *klass)
parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
gobject_class->finalize = gtk_clist_finalize;
object_class->set_arg = gtk_clist_set_arg;
object_class->get_arg = gtk_clist_get_arg;
object_class->destroy = gtk_clist_destroy;
gtk_object_add_arg_type ("GtkCList::n_columns",
GTK_TYPE_UINT,
GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT_ONLY,
@ -533,16 +538,11 @@ gtk_clist_class_init (GtkCListClass *klass)
GTK_TYPE_SORT_TYPE,
GTK_ARG_READWRITE,
ARG_SORT_TYPE);
object_class->set_arg = gtk_clist_set_arg;
object_class->get_arg = gtk_clist_get_arg;
object_class->destroy = gtk_clist_destroy;
object_class->finalize = gtk_clist_finalize;
widget_class->set_scroll_adjustments_signal =
gtk_signal_new ("set_scroll_adjustments",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCListClass, set_scroll_adjustments),
gtk_marshal_NONE__POINTER_POINTER,
GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
@ -550,7 +550,7 @@ gtk_clist_class_init (GtkCListClass *klass)
clist_signals[SELECT_ROW] =
gtk_signal_new ("select_row",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCListClass, select_row),
gtk_marshal_NONE__INT_INT_POINTER,
GTK_TYPE_NONE, 3,
@ -560,7 +560,7 @@ gtk_clist_class_init (GtkCListClass *klass)
clist_signals[UNSELECT_ROW] =
gtk_signal_new ("unselect_row",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCListClass, unselect_row),
gtk_marshal_NONE__INT_INT_POINTER,
GTK_TYPE_NONE, 3, GTK_TYPE_INT,
@ -568,21 +568,21 @@ gtk_clist_class_init (GtkCListClass *klass)
clist_signals[ROW_MOVE] =
gtk_signal_new ("row_move",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCListClass, row_move),
gtk_marshal_NONE__INT_INT,
GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
clist_signals[CLICK_COLUMN] =
gtk_signal_new ("click_column",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCListClass, click_column),
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1, GTK_TYPE_INT);
clist_signals[RESIZE_COLUMN] =
gtk_signal_new ("resize_column",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCListClass, resize_column),
gtk_marshal_NONE__INT_INT,
GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
@ -590,56 +590,56 @@ gtk_clist_class_init (GtkCListClass *klass)
clist_signals[TOGGLE_FOCUS_ROW] =
gtk_signal_new ("toggle_focus_row",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCListClass, toggle_focus_row),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
clist_signals[SELECT_ALL] =
gtk_signal_new ("select_all",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCListClass, select_all),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
clist_signals[UNSELECT_ALL] =
gtk_signal_new ("unselect_all",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCListClass, unselect_all),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
clist_signals[UNDO_SELECTION] =
gtk_signal_new ("undo_selection",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCListClass, undo_selection),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
clist_signals[START_SELECTION] =
gtk_signal_new ("start_selection",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCListClass, start_selection),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
clist_signals[END_SELECTION] =
gtk_signal_new ("end_selection",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCListClass, end_selection),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
clist_signals[TOGGLE_ADD_MODE] =
gtk_signal_new ("toggle_add_mode",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCListClass, toggle_add_mode),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
clist_signals[EXTEND_SELECTION] =
gtk_signal_new ("extend_selection",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCListClass, extend_selection),
gtk_marshal_NONE__ENUM_FLOAT_BOOL,
GTK_TYPE_NONE, 3,
@ -647,21 +647,21 @@ gtk_clist_class_init (GtkCListClass *klass)
clist_signals[SCROLL_VERTICAL] =
gtk_signal_new ("scroll_vertical",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCListClass, scroll_vertical),
gtk_marshal_NONE__ENUM_FLOAT,
GTK_TYPE_NONE, 2, GTK_TYPE_SCROLL_TYPE, GTK_TYPE_FLOAT);
clist_signals[SCROLL_HORIZONTAL] =
gtk_signal_new ("scroll_horizontal",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCListClass, scroll_horizontal),
gtk_marshal_NONE__ENUM_FLOAT,
GTK_TYPE_NONE, 2, GTK_TYPE_SCROLL_TYPE, GTK_TYPE_FLOAT);
clist_signals[ABORT_COLUMN_RESIZE] =
gtk_signal_new ("abort_column_resize",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCListClass, abort_column_resize),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
@ -1711,14 +1711,14 @@ gtk_clist_optimal_column_width (GtkCList *clist,
else
width = 0;
for (list = clist->row_list; list; list = list->next)
{
GTK_CLIST_CLASS_FW (clist)->cell_size_request
for (list = clist->row_list; list; list = list->next)
{
GTK_CLIST_GET_CLASS (clist)->cell_size_request
(clist, GTK_CLIST_ROW (list), column, &requisition);
width = MAX (width, requisition.width);
}
}
return width;
return width;
}
void
@ -1726,15 +1726,15 @@ gtk_clist_set_column_width (GtkCList *clist,
gint column,
gint width)
{
g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist));
g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist));
if (column < 0 || column >= clist->columns)
if (column < 0 || column >= clist->columns)
return;
gtk_signal_emit (GTK_OBJECT (clist), clist_signals[RESIZE_COLUMN],
column, width);
}
}
void
gtk_clist_set_column_min_width (GtkCList *clist,
@ -1808,7 +1808,7 @@ column_auto_resize (GtkCList *clist,
return;
if (clist_row)
GTK_CLIST_CLASS_FW (clist)->cell_size_request (clist, clist_row,
GTK_CLIST_GET_CLASS (clist)->cell_size_request (clist, clist_row,
column, &requisition);
else
requisition.width = 0;
@ -1831,7 +1831,7 @@ column_auto_resize (GtkCList *clist,
for (list = clist->row_list; list; list = list->next)
{
GTK_CLIST_CLASS_FW (clist)->cell_size_request
GTK_CLIST_GET_CLASS (clist)->cell_size_request
(clist, GTK_CLIST_ROW (list), column, &requisition);
new_width = MAX (new_width, requisition.width);
if (new_width == clist->column[column].width)
@ -2204,14 +2204,14 @@ gtk_clist_set_text (GtkCList *clist,
clist_row = ROW_ELEMENT (clist, row)->data;
/* if text is null, then the cell is empty */
GTK_CLIST_CLASS_FW (clist)->set_cell_contents
GTK_CLIST_GET_CLASS (clist)->set_cell_contents
(clist, clist_row, column, GTK_CELL_TEXT, text, 0, NULL, NULL);
/* redraw the list if it's not frozen */
if (CLIST_UNFROZEN (clist))
{
if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row);
GTK_CLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row);
}
}
@ -2265,14 +2265,14 @@ gtk_clist_set_pixmap (GtkCList *clist,
if (mask) gdk_pixmap_ref (mask);
GTK_CLIST_CLASS_FW (clist)->set_cell_contents
GTK_CLIST_GET_CLASS (clist)->set_cell_contents
(clist, clist_row, column, GTK_CELL_PIXMAP, NULL, 0, pixmap, mask);
/* redraw the list if it's not frozen */
if (CLIST_UNFROZEN (clist))
{
if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row);
GTK_CLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row);
}
}
@ -2331,14 +2331,14 @@ gtk_clist_set_pixtext (GtkCList *clist,
gdk_pixmap_ref (pixmap);
if (mask) gdk_pixmap_ref (mask);
GTK_CLIST_CLASS_FW (clist)->set_cell_contents
GTK_CLIST_GET_CLASS (clist)->set_cell_contents
(clist, clist_row, column, GTK_CELL_PIXTEXT, text, spacing, pixmap, mask);
/* redraw the list if it's not frozen */
if (CLIST_UNFROZEN (clist))
{
if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row);
GTK_CLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row);
}
}
@ -2401,7 +2401,7 @@ gtk_clist_set_shift (GtkCList *clist,
if (clist->column[column].auto_resize &&
!GTK_CLIST_AUTO_RESIZE_BLOCKED(clist))
GTK_CLIST_CLASS_FW (clist)->cell_size_request (clist, clist_row,
GTK_CLIST_GET_CLASS (clist)->cell_size_request (clist, clist_row,
column, &requisition);
clist_row->cell[column].vertical = vertical;
@ -2410,7 +2410,7 @@ gtk_clist_set_shift (GtkCList *clist,
column_auto_resize (clist, clist_row, column, requisition.width);
if (CLIST_UNFROZEN (clist) && gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row);
GTK_CLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row);
}
/* PRIVATE CELL FUNCTIONS
@ -2435,7 +2435,7 @@ set_cell_contents (GtkCList *clist,
if (clist->column[column].auto_resize &&
!GTK_CLIST_AUTO_RESIZE_BLOCKED(clist))
GTK_CLIST_CLASS_FW (clist)->cell_size_request (clist, clist_row,
GTK_CLIST_GET_CLASS (clist)->cell_size_request (clist, clist_row,
column, &requisition);
switch (clist_row->cell[column].type)
@ -2569,7 +2569,7 @@ gtk_clist_prepend (GtkCList *clist,
g_return_val_if_fail (GTK_IS_CLIST (clist), -1);
g_return_val_if_fail (text != NULL, -1);
return GTK_CLIST_CLASS_FW (clist)->insert_row (clist, 0, text);
return GTK_CLIST_GET_CLASS (clist)->insert_row (clist, 0, text);
}
gint
@ -2580,7 +2580,7 @@ gtk_clist_append (GtkCList *clist,
g_return_val_if_fail (GTK_IS_CLIST (clist), -1);
g_return_val_if_fail (text != NULL, -1);
return GTK_CLIST_CLASS_FW (clist)->insert_row (clist, clist->rows, text);
return GTK_CLIST_GET_CLASS (clist)->insert_row (clist, clist->rows, text);
}
gint
@ -2595,14 +2595,14 @@ gtk_clist_insert (GtkCList *clist,
if (row < 0 || row > clist->rows)
row = clist->rows;
return GTK_CLIST_CLASS_FW (clist)->insert_row (clist, row, text);
return GTK_CLIST_GET_CLASS (clist)->insert_row (clist, row, text);
}
void
gtk_clist_remove (GtkCList *clist,
gint row)
{
GTK_CLIST_CLASS_FW (clist)->remove_row (clist, row);
GTK_CLIST_GET_CLASS (clist)->remove_row (clist, row);
}
void
@ -2611,7 +2611,7 @@ gtk_clist_clear (GtkCList *clist)
g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist));
GTK_CLIST_CLASS_FW (clist)->clear (clist);
GTK_CLIST_GET_CLASS (clist)->clear (clist);
}
/* PRIVATE INSERT/REMOVE ROW FUNCTIONS
@ -2642,7 +2642,7 @@ real_insert_row (GtkCList *clist,
/* set the text in the row's columns */
for (i = 0; i < clist->columns; i++)
if (text[i])
GTK_CLIST_CLASS_FW (clist)->set_cell_contents
GTK_CLIST_GET_CLASS (clist)->set_cell_contents
(clist, clist_row, i, GTK_CELL_TEXT, text[i], 0, NULL ,NULL);
if (!clist->rows)
@ -3163,7 +3163,7 @@ gtk_clist_set_foreground (GtkCList *clist,
clist_row->fg_set = FALSE;
if (CLIST_UNFROZEN (clist) && gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row);
GTK_CLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row);
}
void
@ -3194,7 +3194,7 @@ gtk_clist_set_background (GtkCList *clist,
if (CLIST_UNFROZEN (clist)
&& (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE))
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row);
GTK_CLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row);
}
/* PUBLIC ROW/CELL STYLE FUNCTIONS
@ -3227,7 +3227,7 @@ gtk_clist_set_cell_style (GtkCList *clist,
if (clist->column[column].auto_resize &&
!GTK_CLIST_AUTO_RESIZE_BLOCKED(clist))
GTK_CLIST_CLASS_FW (clist)->cell_size_request (clist, clist_row,
GTK_CLIST_GET_CLASS (clist)->cell_size_request (clist, clist_row,
column, &requisition);
if (clist_row->cell[column].style)
@ -3255,7 +3255,7 @@ gtk_clist_set_cell_style (GtkCList *clist,
if (CLIST_UNFROZEN (clist))
{
if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row);
GTK_CLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row);
}
}
@ -3305,7 +3305,7 @@ gtk_clist_set_row_style (GtkCList *clist,
for (i = 0; i < clist->columns; i++)
if (clist->column[i].auto_resize)
{
GTK_CLIST_CLASS_FW (clist)->cell_size_request (clist, clist_row,
GTK_CLIST_GET_CLASS (clist)->cell_size_request (clist, clist_row,
i, &requisition);
old_width[i] = requisition.width;
}
@ -3339,7 +3339,7 @@ gtk_clist_set_row_style (GtkCList *clist,
if (CLIST_UNFROZEN (clist))
{
if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row);
GTK_CLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row);
}
}
@ -3396,7 +3396,7 @@ gtk_clist_set_selectable (GtkCList *clist,
{
clist->drag_button = 0;
remove_grab (clist);
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
}
gtk_signal_emit (GTK_OBJECT (clist), clist_signals[UNSELECT_ROW],
row, -1, NULL);
@ -3456,7 +3456,7 @@ gtk_clist_select_all (GtkCList *clist)
g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist));
GTK_CLIST_CLASS_FW (clist)->select_all (clist);
GTK_CLIST_GET_CLASS (clist)->select_all (clist);
}
void
@ -3465,7 +3465,7 @@ gtk_clist_unselect_all (GtkCList *clist)
g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist));
GTK_CLIST_CLASS_FW (clist)->unselect_all (clist);
GTK_CLIST_GET_CLASS (clist)->unselect_all (clist);
}
void
@ -3556,7 +3556,7 @@ fake_toggle_row (GtkCList *clist,
if (CLIST_UNFROZEN (clist) &&
gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row,
GTK_CLIST_GET_CLASS (clist)->draw_row (clist, NULL, row,
GTK_CLIST_ROW (work));
}
@ -3589,9 +3589,9 @@ toggle_focus_row (GtkCList *clist)
if (GTK_CLIST_ADD_MODE(clist))
fake_toggle_row (clist, clist->focus_row);
else
GTK_CLIST_CLASS_FW (clist)->fake_unselect_all (clist,clist->focus_row);
GTK_CLIST_GET_CLASS (clist)->fake_unselect_all (clist,clist->focus_row);
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
break;
default:
break;
@ -3687,7 +3687,7 @@ real_select_row (GtkCList *clist,
if (CLIST_UNFROZEN (clist)
&& (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE))
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row);
GTK_CLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row);
}
static void
@ -3719,7 +3719,7 @@ real_unselect_row (GtkCList *clist,
if (CLIST_UNFROZEN (clist)
&& (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE))
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row);
GTK_CLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row);
}
}
@ -3757,7 +3757,7 @@ real_select_all (GtkCList *clist)
clist->drag_pos = 0;
clist->undo_anchor = clist->focus_row;
update_extended_selection (clist, clist->rows);
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
return;
case GTK_SELECTION_MULTIPLE:
@ -3835,7 +3835,7 @@ fake_unselect_all (GtkCList *clist,
if (CLIST_UNFROZEN (clist) &&
gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row,
GTK_CLIST_GET_CLASS (clist)->draw_row (clist, NULL, row,
GTK_CLIST_ROW (work));
}
}
@ -3853,7 +3853,7 @@ fake_unselect_all (GtkCList *clist,
GTK_CLIST_ROW (work)->state = GTK_STATE_NORMAL;
if (CLIST_UNFROZEN (clist) &&
gtk_clist_row_is_visible (clist, i) != GTK_VISIBILITY_NONE)
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, i,
GTK_CLIST_GET_CLASS (clist)->draw_row (clist, NULL, i,
GTK_CLIST_ROW (work));
}
}
@ -3870,7 +3870,7 @@ real_undo_selection (GtkCList *clist)
clist->selection_mode != GTK_SELECTION_EXTENDED)
return;
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
if (!(clist->undo_selection || clist->undo_unselection))
{
@ -3933,7 +3933,7 @@ set_anchor (GtkCList *clist,
fake_toggle_row (clist, anchor);
else
{
GTK_CLIST_CLASS_FW (clist)->fake_unselect_all (clist, anchor);
GTK_CLIST_GET_CLASS (clist)->fake_unselect_all (clist, anchor);
clist->anchor_state = GTK_STATE_SELECTED;
}
@ -4140,7 +4140,7 @@ update_extended_selection (GtkCList *clist,
i++, list = list->next)
if (GTK_CLIST_ROW (list)->selectable)
{
if (GTK_CLIST_CLASS_FW (clist)->selection_find (clist, i, list))
if (GTK_CLIST_GET_CLASS (clist)->selection_find (clist, i, list))
GTK_CLIST_ROW (list)->state = GTK_STATE_SELECTED;
else
GTK_CLIST_ROW (list)->state = GTK_STATE_NORMAL;
@ -4236,7 +4236,7 @@ end_selection (GtkCList *clist)
if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_FOCUS(clist))
return;
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
}
static void
@ -4292,7 +4292,7 @@ sync_selection (GtkCList *clist,
clist->focus_row = clist->rows - 1;
}
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
g_list_free (clist->undo_selection);
g_list_free (clist->undo_unselection);
@ -4370,11 +4370,10 @@ gtk_clist_destroy (GtkObject *object)
}
static void
gtk_clist_finalize (GtkObject *object)
gtk_clist_finalize (GObject *object)
{
GtkCList *clist;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_CLIST (object));
clist = GTK_CLIST (object);
@ -4384,8 +4383,7 @@ gtk_clist_finalize (GtkObject *object)
g_mem_chunk_destroy (clist->cell_mem_chunk);
g_mem_chunk_destroy (clist->row_mem_chunk);
if (GTK_OBJECT_CLASS (parent_class)->finalize)
(*GTK_OBJECT_CLASS (parent_class)->finalize) (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
/* GTKWIDGET
@ -4697,7 +4695,7 @@ gtk_clist_unmap (GtkWidget *widget)
{
remove_grab (clist);
GTK_CLIST_CLASS_FW (widget)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (widget)->resync_selection (clist, NULL);
clist->click_cell.row = -1;
clist->click_cell.column = -1;
@ -5017,7 +5015,7 @@ gtk_clist_button_press (GtkWidget *widget,
if (clist->anchor != -1)
{
update_extended_selection (clist, clist->focus_row);
GTK_CLIST_CLASS_FW (clist)->resync_selection
GTK_CLIST_GET_CLASS (clist)->resync_selection
(clist, (GdkEvent *) event);
}
gtk_signal_emit (GTK_OBJECT (clist),
@ -5182,7 +5180,7 @@ gtk_clist_button_release (GtkWidget *widget,
!GTK_WIDGET_CAN_FOCUS (widget) ||
event->x < 0 || event->x >= clist->clist_window_width ||
event->y < 0 || event->y >= clist->clist_window_height)
GTK_CLIST_CLASS_FW (clist)->resync_selection
GTK_CLIST_GET_CLASS (clist)->resync_selection
(clist, (GdkEvent *) event);
break;
case GTK_SELECTION_SINGLE:
@ -5964,7 +5962,7 @@ draw_rows (GtkCList *clist,
if (i > last_row)
return;
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, area, i, clist_row);
GTK_CLIST_GET_CLASS (clist)->draw_row (clist, area, i, clist_row);
i++;
}
@ -6502,7 +6500,7 @@ row_delete (GtkCList *clist,
for (i = 0; i < clist->columns; i++)
{
GTK_CLIST_CLASS_FW (clist)->set_cell_contents
GTK_CLIST_GET_CLASS (clist)->set_cell_contents
(clist, clist_row, i, GTK_CELL_EMPTY, NULL, 0, NULL, NULL);
if (clist_row->cell[i].style)
{
@ -6698,7 +6696,7 @@ gtk_clist_focus_out (GtkWidget *widget,
clist = GTK_CLIST (widget);
GTK_CLIST_CLASS_FW (widget)->resync_selection (clist, (GdkEvent *) event);
GTK_CLIST_GET_CLASS (widget)->resync_selection (clist, (GdkEvent *) event);
return FALSE;
}
@ -7189,7 +7187,7 @@ gtk_clist_sort (GtkCList *clist)
g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist));
GTK_CLIST_CLASS_FW (clist)->sort_list (clist);
GTK_CLIST_GET_CLASS (clist)->sort_list (clist);
}
void
@ -7311,7 +7309,7 @@ real_sort_list (GtkCList *clist)
if (clist->anchor != -1 && clist->selection_mode == GTK_SELECTION_EXTENDED)
{
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
g_list_free (clist->undo_selection);
g_list_free (clist->undo_unselection);
clist->undo_selection = NULL;
@ -7515,7 +7513,7 @@ gtk_clist_drag_begin (GtkWidget *widget,
{
case GTK_SELECTION_EXTENDED:
update_extended_selection (clist, clist->focus_row);
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
break;
case GTK_SELECTION_SINGLE:
case GTK_SELECTION_MULTIPLE:
@ -7591,7 +7589,7 @@ gtk_clist_drag_leave (GtkWidget *widget,
{
if (atom == GPOINTER_TO_INT (list->data))
{
GTK_CLIST_CLASS_FW (clist)->draw_drag_highlight
GTK_CLIST_GET_CLASS (clist)->draw_drag_highlight
(clist,
g_list_nth (clist->row_list, dest_info->cell.row)->data,
dest_info->cell.row, dest_info->insert_pos);
@ -7672,7 +7670,7 @@ gtk_clist_drag_motion (GtkWidget *widget,
dest_info->insert_pos != new_info.insert_pos))
{
if (dest_info->cell.row >= 0)
GTK_CLIST_CLASS_FW (clist)->draw_drag_highlight
GTK_CLIST_GET_CLASS (clist)->draw_drag_highlight
(clist, g_list_nth (clist->row_list,
dest_info->cell.row)->data,
dest_info->cell.row, dest_info->insert_pos);
@ -7681,7 +7679,7 @@ gtk_clist_drag_motion (GtkWidget *widget,
dest_info->cell.row = new_info.cell.row;
dest_info->cell.column = new_info.cell.column;
GTK_CLIST_CLASS_FW (clist)->draw_drag_highlight
GTK_CLIST_GET_CLASS (clist)->draw_drag_highlight
(clist, g_list_nth (clist->row_list,
dest_info->cell.row)->data,
dest_info->cell.row, dest_info->insert_pos);
@ -7892,7 +7890,7 @@ gtk_clist_set_button_actions (GtkCList *clist,
clist->drag_button = 0;
}
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
clist->button_actions[button] = button_actions;
}

View File

@ -1,4 +1,4 @@
/* GTK - The GIMP Toolkit
/* GTK - The GIMP Toolkit
* Copyright (C) 2000 Red Hat, Inc.
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
@ -25,8 +25,7 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include <glib.h>
#include "gdk/gdkx.h"
#include "x11/gdkx.h"
#include "gdk/gdkkeysyms.h"
#include "gtkcolorsel.h"
#include "gtkhsv.h"
@ -72,11 +71,13 @@ typedef struct _ColorSelectionPrivate ColorSelectionPrivate;
struct _ColorSelectionPrivate
{
/* < Private > */
gboolean use_opacity;
gboolean use_palette;
gboolean changing;
gboolean default_set;
guint use_opacity : 1;
guint use_palette : 1;
guint changing : 1;
guint default_set : 1;
/* The color dropper */
guint moving_dropper : 1;
gdouble color[COLORSEL_NUM_CHANNELS];
gdouble old_color[COLORSEL_NUM_CHANNELS];
@ -95,7 +96,7 @@ struct _ColorSelectionPrivate
GtkWidget *hex_entry;
/* The Palette code */
GtkWidget *custom_palette [CUSTOM_PALETTE_WIDTH][CUSTOM_PALETTE_HEIGHT];
GtkWidget *custom_palette [GTK_CUSTOM_PALETTE_WIDTH][GTK_CUSTOM_PALETTE_HEIGHT];
GtkWidget *last_palette;
/* The color_sample stuff */
@ -103,9 +104,6 @@ struct _ColorSelectionPrivate
GtkWidget *old_sample;
GtkWidget *cur_sample;
GtkWidget *colorsel;
/* The color dropper */
gboolean moving_dropper;
};
@ -114,7 +112,7 @@ static void gtk_color_selection_class_init (GtkColorSelectionClass *klass);
static void gtk_color_selection_destroy (GtkObject *object);
static void update_color (GtkColorSelection *colorsel);
static GtkVBoxClass *parent_class = NULL;
static gpointer parent_class = NULL;
static guint color_selection_signals[LAST_SIGNAL] = { 0 };
@ -410,7 +408,6 @@ color_sample_draw_sample (GtkColorSelection *colorsel, int which)
g_free (buf);
}
@ -514,18 +511,6 @@ color_sample_new (GtkColorSelection *colorsel)
gtk_widget_show_all (priv->sample_area);
}
static void
color_sample_set_use_opacity (GtkColorSelection *colorsel)
{
ColorSelectionPrivate *priv;
g_return_if_fail (colorsel != NULL);
priv = colorsel->private;
color_sample_draw_samples (colorsel);
}
/*
*
@ -561,7 +546,9 @@ palette_get_color (GtkWidget *drawing_area, gdouble *color)
#define INTENSITY(r, g, b) ((r) * 0.30 + (g) * 0.59 + (b) * 0.11)
static void
palette_paint (GtkWidget *drawing_area, GdkRectangle *area, gpointer data)
palette_paint (GtkWidget *drawing_area,
GdkRectangle *area,
gpointer data)
{
if (drawing_area->window == NULL)
return;
@ -592,7 +579,9 @@ palette_paint (GtkWidget *drawing_area, GdkRectangle *area, gpointer data)
}
static void
palette_expose (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
palette_expose (GtkWidget *drawing_area,
GdkEventExpose *event,
gpointer data)
{
if (drawing_area->window == NULL)
return;
@ -601,7 +590,9 @@ palette_expose (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
}
static void
palette_focus_in (GtkWidget *drawing_area, GdkEventFocus *event, gpointer data)
palette_focus_in (GtkWidget *drawing_area,
GdkEventFocus *event,
gpointer data)
{
ColorSelectionPrivate *priv;
@ -616,14 +607,18 @@ palette_focus_in (GtkWidget *drawing_area, GdkEventFocus *event, gpointer data)
}
static void
palette_focus_out (GtkWidget *drawing_area, GdkEventFocus *event, gpointer data)
palette_focus_out (GtkWidget *drawing_area,
GdkEventFocus *event,
gpointer data)
{
GTK_WIDGET_UNSET_FLAGS (drawing_area, GTK_HAS_FOCUS);
gtk_widget_queue_clear_area (drawing_area, 0, 0, drawing_area->allocation.x, drawing_area->allocation.y);
}
static void
palette_press (GtkWidget *drawing_area, GdkEventButton *event, gpointer data)
palette_press (GtkWidget *drawing_area,
GdkEventButton *event,
gpointer data)
{
gtk_widget_grab_focus (drawing_area);
if (GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (drawing_area), "color_set")) != 0)
@ -635,7 +630,9 @@ palette_press (GtkWidget *drawing_area, GdkEventButton *event, gpointer data)
}
static void
palette_draw (GtkWidget *drawing_area, GdkRectangle *area, gpointer data)
palette_draw (GtkWidget *drawing_area,
GdkRectangle *area,
gpointer data)
{
palette_paint (drawing_area, area, data);
}
@ -706,7 +703,9 @@ palette_drag_handle (GtkWidget *widget,
}
static void
palette_set_color (GtkWidget *drawing_area, GtkColorSelection *colorsel, gdouble *color)
palette_set_color (GtkWidget *drawing_area,
GtkColorSelection *colorsel,
gdouble *color)
{
GtkRcStyle *rc_style;
gdouble *new_color = g_new (double, 4);
@ -798,7 +797,7 @@ palette_drop_handle (GtkWidget *widget,
gtk_color_selection_set_color (GTK_COLOR_SELECTION (data), color);
}
static int
static gint
palette_activate (GtkWidget *widget,
GdkEventKey *event,
gpointer data)
@ -815,7 +814,7 @@ palette_activate (GtkWidget *widget,
return TRUE;
}
static GtkWidget *
static GtkWidget*
palette_new (GtkColorSelection *colorsel)
{
GtkWidget *retval;
@ -857,7 +856,7 @@ palette_new (GtkColorSelection *colorsel)
*/
static void
initialize_cursor ()
initialize_cursor (void)
{
GdkColor fg, bg;
@ -881,7 +880,10 @@ initialize_cursor ()
}
static void
grab_color_at_mouse (GtkWidget *button, int x_root, int y_root, gpointer data)
grab_color_at_mouse (GtkWidget *button,
gint x_root,
gint y_root,
gpointer data)
{
GdkImage *image;
guint32 pixel;
@ -937,13 +939,17 @@ grab_color_at_mouse (GtkWidget *button, int x_root, int y_root, gpointer data)
}
static void
mouse_motion (GtkWidget *button, GdkEventMotion *event, gpointer data)
mouse_motion (GtkWidget *button,
GdkEventMotion *event,
gpointer data)
{
grab_color_at_mouse (button, event->x_root, event->y_root, data);
}
static void
mouse_release (GtkWidget *button, GdkEventButton *event, gpointer data)
mouse_release (GtkWidget *button,
GdkEventButton *event,
gpointer data)
{
GtkColorSelection *colorsel = data;
ColorSelectionPrivate *priv;
@ -958,7 +964,9 @@ mouse_release (GtkWidget *button, GdkEventButton *event, gpointer data)
/* Helper Functions */
static void
mouse_press (GtkWidget *button, GdkEventButton *event, gpointer data)
mouse_press (GtkWidget *button,
GdkEventButton *event,
gpointer data)
{
GtkColorSelection *colorsel = data;
ColorSelectionPrivate *priv;
@ -1005,7 +1013,8 @@ get_screen_color (GtkWidget *button)
}
void
hex_changed (GtkWidget *hex_entry, gpointer data)
hex_changed (GtkWidget *hex_entry,
gpointer data)
{
GtkColorSelection *colorsel;
ColorSelectionPrivate *priv;
@ -1036,7 +1045,8 @@ hex_changed (GtkWidget *hex_entry, gpointer data)
}
void
hsv_changed (GtkWidget *hsv, gpointer data)
hsv_changed (GtkWidget *hsv,
gpointer data)
{
GtkColorSelection *colorsel;
ColorSelectionPrivate *priv;
@ -1061,7 +1071,8 @@ hsv_changed (GtkWidget *hsv, gpointer data)
}
void
adjustment_changed (GtkAdjustment *adjustment, gpointer data)
adjustment_changed (GtkAdjustment *adjustment,
gpointer data)
{
GtkColorSelection *colorsel;
ColorSelectionPrivate *priv;
@ -1113,7 +1124,8 @@ adjustment_changed (GtkAdjustment *adjustment, gpointer data)
}
void
opacity_entry_changed (GtkWidget *opacity_entry, gpointer data)
opacity_entry_changed (GtkWidget *opacity_entry,
gpointer data)
{
GtkColorSelection *colorsel;
ColorSelectionPrivate *priv;
@ -1136,14 +1148,16 @@ opacity_entry_changed (GtkWidget *opacity_entry, gpointer data)
}
static void
widget_focus_in (GtkWidget *drawing_area, GdkEventFocus *event, gpointer data)
/* This signal is connected to by all of the widgets except the "Set Color" button */
/* This will let you add a color to the currently selected palette */
widget_focus_in (GtkWidget *drawing_area,
GdkEventFocus *event,
gpointer data)
{
GtkColorSelection *colorsel = GTK_COLOR_SELECTION (data);
ColorSelectionPrivate *priv;
ColorSelectionPrivate *priv = colorsel->private;
priv = colorsel->private;
/* This signal is connected to by all of the widgets except the "Set Color" button
* This will let you add a color to the currently selected palette
*/
priv->last_palette = NULL;
}
@ -1154,7 +1168,8 @@ make_label_spinbutton (GtkColorSelection *colorsel,
GtkWidget **spinbutton,
gchar *text,
GtkWidget *table,
gint i, gint j,
gint i,
gint j,
gint channel_type)
{
GtkWidget *label;
@ -1180,7 +1195,10 @@ make_label_spinbutton (GtkColorSelection *colorsel,
}
static void
make_palette_frame (GtkColorSelection *colorsel, GtkWidget *table, gint i, gint j)
make_palette_frame (GtkColorSelection *colorsel,
GtkWidget *table,
gint i,
gint j)
{
GtkWidget *frame;
ColorSelectionPrivate *priv;
@ -1201,6 +1219,7 @@ update_color (GtkColorSelection *colorsel)
gchar entryval[12];
gchar opacity_text[32];
gchar *ptr;
priv->changing = TRUE;
color_sample_draw_samples (colorsel);
@ -1246,36 +1265,42 @@ update_color (GtkColorSelection *colorsel)
}
static void
add_button_pressed (GtkWidget *button, GtkColorSelection *colorsel)
add_button_pressed (GtkWidget *button,
GtkColorSelection *colorsel)
{
gint i, j;
ColorSelectionPrivate *priv;
gint i, j;
priv = colorsel->private;
for (j = 0; j < CUSTOM_PALETTE_HEIGHT; j++)
for (j = 0; j < GTK_CUSTOM_PALETTE_HEIGHT; j++)
{
for (i = 0; i < CUSTOM_PALETTE_WIDTH; i++)
for (i = 0; i < GTK_CUSTOM_PALETTE_WIDTH; i++)
{
/* Either last_palette is set and we're on it, or it's an empty palette */
if ((priv->last_palette && priv->last_palette == priv->custom_palette[i][j]) ||
((priv->last_palette == NULL) && (GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (priv->custom_palette[i][j]),
((priv->last_palette == NULL) &&
(GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (priv->custom_palette[i][j]),
"color_set")) == 0)))
{
palette_set_color (priv->custom_palette[i][j], colorsel, priv->color);
/* forward the selection */
if ((i == CUSTOM_PALETTE_WIDTH - 1) && (j == CUSTOM_PALETTE_HEIGHT - 1))
if ((i == GTK_CUSTOM_PALETTE_WIDTH - 1) && (j == GTK_CUSTOM_PALETTE_HEIGHT - 1))
gtk_widget_grab_focus (priv->custom_palette[0][0]);
else if (i == CUSTOM_PALETTE_WIDTH - 1)
else if (i == GTK_CUSTOM_PALETTE_WIDTH - 1)
gtk_widget_grab_focus (priv->custom_palette[0][j + 1]);
else
gtk_widget_grab_focus (priv->custom_palette[i + 1][j]);
return;
}
}
}
/* the palette is totally full. Add to the first one totally arbitrarily */
palette_set_color (priv->custom_palette[0][0], colorsel, priv->color);
/* forward the selection */
gtk_widget_grab_focus (priv->custom_palette[1][0]);
}
@ -1299,7 +1324,7 @@ gtk_color_selection_get_type (void)
(GtkClassInitFunc) NULL,
};
color_selection_type = gtk_type_unique (gtk_vbox_get_type (), &color_selection_info);
color_selection_type = gtk_type_unique (GTK_TYPE_VBOX, &color_selection_info);
}
return color_selection_type;
@ -1312,12 +1337,12 @@ gtk_color_selection_class_init (GtkColorSelectionClass *klass)
object_class = (GtkObjectClass*) klass;
parent_class = gtk_type_class (gtk_vbox_get_type ());
parent_class = gtk_type_class (GTK_TYPE_VBOX);
color_selection_signals[COLOR_CHANGED] =
gtk_signal_new ("color_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkColorSelectionClass, color_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
@ -1343,7 +1368,7 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
gint i, j;
ColorSelectionPrivate *priv;
priv = colorsel->private = g_new (ColorSelectionPrivate, 1);
priv = colorsel->private = g_new0 (ColorSelectionPrivate, 1);
priv->changing = FALSE;
priv->default_set = FALSE;
priv->last_palette = NULL;
@ -1372,14 +1397,12 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
button = gtk_button_new ();
gtk_signal_connect (GTK_OBJECT (button), "focus_in_event", widget_focus_in, colorsel);
gtk_widget_set_events (button, GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK);
gtk_widget_set_events (button, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK);
gtk_object_set_data (GTK_OBJECT (button), "COLORSEL", colorsel);
gtk_signal_connect (GTK_OBJECT (button), "clicked", get_screen_color, NULL);
dropper_pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, gtk_widget_get_colormap (button), &mask, NULL, picker);
dropper_image = gtk_pixmap_new (dropper_pixmap, mask);
gtk_container_add (GTK_CONTAINER (button), dropper_image);
label = gtk_label_new (_("Color Picker"));
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
top_right_vbox = gtk_vbox_new (FALSE, 4);
@ -1422,12 +1445,12 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
gtk_table_attach_defaults (GTK_TABLE (table), priv->hex_entry, 1, 5, 5, 6);
/* Set up the palette */
table = gtk_table_new (CUSTOM_PALETTE_HEIGHT, CUSTOM_PALETTE_WIDTH, TRUE);
table = gtk_table_new (GTK_CUSTOM_PALETTE_HEIGHT, GTK_CUSTOM_PALETTE_WIDTH, TRUE);
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
gtk_table_set_col_spacings (GTK_TABLE (table), 1);
for (i = 0; i < CUSTOM_PALETTE_WIDTH; i++)
for (i = 0; i < GTK_CUSTOM_PALETTE_WIDTH; i++)
{
for (j = 0; j < CUSTOM_PALETTE_HEIGHT; j++)
for (j = 0; j < GTK_CUSTOM_PALETTE_HEIGHT; j++)
{
make_palette_frame (colorsel, table, i, j);
}
@ -1460,7 +1483,15 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
static void
gtk_color_selection_destroy (GtkObject *object)
{
g_free (GTK_COLOR_SELECTION (object)->private);
GtkColorSelection *cselection = GTK_COLOR_SELECTION (object);
if (cselection->private)
{
g_free (cselection->private);
cselection->private = NULL;
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
@ -1504,7 +1535,7 @@ gtk_color_selection_set_update_policy (GtkColorSelection *colorsel,
g_return_if_fail (colorsel != NULL);
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
/* */
g_warning ("This function is deprecated.");
g_warning (G_STRLOC ": This function is deprecated.");
}
/**
@ -1519,10 +1550,12 @@ gboolean
gtk_color_selection_get_use_opacity (GtkColorSelection *colorsel)
{
ColorSelectionPrivate *priv;
g_return_val_if_fail (colorsel != NULL, FALSE);
g_return_val_if_fail (GTK_IS_COLOR_SELECTION (colorsel), FALSE);
priv = colorsel->private;
return priv->use_opacity;
}
@ -1539,13 +1572,15 @@ gtk_color_selection_set_use_opacity (GtkColorSelection *colorsel,
gboolean use_opacity)
{
ColorSelectionPrivate *priv;
g_return_if_fail (colorsel != NULL);
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
priv = colorsel->private;
if (priv->use_opacity == use_opacity)
return;
use_opacity = use_opacity != FALSE;
if (priv->use_opacity != use_opacity)
{
priv->use_opacity = use_opacity;
if (use_opacity)
{
@ -1559,7 +1594,8 @@ gtk_color_selection_set_use_opacity (GtkColorSelection *colorsel,
gtk_widget_hide (priv->opacity_label);
gtk_widget_hide (priv->opacity_entry);
}
color_sample_set_use_opacity (colorsel);
color_sample_draw_samples (colorsel);
}
}
/**
@ -1574,10 +1610,11 @@ gboolean
gtk_color_selection_get_use_palette (GtkColorSelection *colorsel)
{
ColorSelectionPrivate *priv;
g_return_val_if_fail (colorsel != NULL, FALSE);
g_return_val_if_fail (GTK_IS_COLOR_SELECTION (colorsel), FALSE);
priv = colorsel->private;
return priv->use_palette;
}
@ -1598,14 +1635,16 @@ gtk_color_selection_set_use_palette (GtkColorSelection *colorsel,
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
priv = colorsel->private;
if (priv->use_palette == use_palette)
return;
use_palette = use_palette != FALSE;
if (priv->use_palette != use_palette)
{
priv->use_palette = use_palette;
if (use_palette)
gtk_widget_show (priv->palette_frame);
else
gtk_widget_hide (priv->palette_frame);
}
}
/**
@ -1752,7 +1791,7 @@ gtk_color_selection_set_palette_color (GtkColorSelection *colorsel,
g_return_if_fail (colorsel != NULL);
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
g_return_if_fail (x >= 0 && y >= 0 && x < CUSTOM_PALETTE_WIDTH && y < CUSTOM_PALETTE_HEIGHT);
g_return_if_fail (x >= 0 && y >= 0 && x < GTK_CUSTOM_PALETTE_WIDTH && y < GTK_CUSTOM_PALETTE_HEIGHT);
priv = colorsel->private;
palette_set_color (priv->custom_palette[x][y], colorsel, color);
@ -1781,7 +1820,7 @@ gtk_color_selection_get_palette_color (GtkColorSelection *colorsel,
g_return_val_if_fail (colorsel != NULL, FALSE);
g_return_val_if_fail (GTK_IS_COLOR_SELECTION (colorsel), FALSE);
g_return_val_if_fail (x >= 0 && y >= 0 && x < CUSTOM_PALETTE_WIDTH && y < CUSTOM_PALETTE_HEIGHT, FALSE);
g_return_val_if_fail (x >= 0 && y >= 0 && x < GTK_CUSTOM_PALETTE_WIDTH && y < GTK_CUSTOM_PALETTE_HEIGHT, FALSE);
priv = colorsel->private;
@ -1810,7 +1849,7 @@ gtk_color_selection_unset_palette_color (GtkColorSelection *colorsel,
g_return_if_fail (colorsel != NULL);
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
g_return_if_fail (x >= 0 && y >= 0 && x < CUSTOM_PALETTE_WIDTH && y < CUSTOM_PALETTE_HEIGHT);
g_return_if_fail (x >= 0 && y >= 0 && x < GTK_CUSTOM_PALETTE_WIDTH && y < GTK_CUSTOM_PALETTE_HEIGHT);
priv = colorsel->private;
palette_unset_color (priv->custom_palette[x][y]);

View File

@ -34,6 +34,7 @@
extern "C" {
#endif /* __cplusplus */
#define GTK_TYPE_COLOR_SELECTION (gtk_color_selection_get_type ())
#define GTK_COLOR_SELECTION(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_COLOR_SELECTION, GtkColorSelection))
#define GTK_COLOR_SELECTION_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_COLOR_SELECTION, GtkColorSelectionClass))
@ -43,8 +44,8 @@ extern "C" {
/* Number of elements in the custom palatte */
#define CUSTOM_PALETTE_WIDTH 10
#define CUSTOM_PALETTE_HEIGHT 2
#define GTK_CUSTOM_PALETTE_WIDTH 10
#define GTK_CUSTOM_PALETTE_HEIGHT 2
typedef struct _GtkColorSelection GtkColorSelection;
typedef struct _GtkColorSelectionClass GtkColorSelectionClass;
@ -52,7 +53,7 @@ typedef struct _GtkColorSelectionClass GtkColorSelectionClass;
struct _GtkColorSelection
{
GtkVBox parent;
GtkVBox parent_instance;
/* < private > */
gpointer private;
@ -69,7 +70,7 @@ struct _GtkColorSelectionClass
/* ColorSelection */
GtkType gtk_color_selection_get_type (void);
GtkWidget *gtk_color_selection_new (void);
GtkWidget * gtk_color_selection_new (void);
void gtk_color_selection_set_update_policy (GtkColorSelection *colorsel,
GtkUpdateType policy);
gboolean gtk_color_selection_get_use_opacity (GtkColorSelection *colorsel);
@ -101,7 +102,7 @@ gboolean gtk_color_selection_get_palette_color (GtkColorSelection *colorsel
gint x,
gint y,
gdouble *color);
void gtk_color_selection_unset_palette_color(GtkColorSelection *colorsel,
void gtk_color_selection_unset_palette_color (GtkColorSelection *colorsel,
gint x,
gint y);
gboolean gtk_color_selection_is_adjusting (GtkColorSelection *colorsel);

View File

@ -135,4 +135,3 @@ gtk_color_selection_dialog_new (const gchar *title)
return GTK_WIDGET (colorseldiag);
}

View File

@ -29,7 +29,7 @@
#include <gtk/gtkdialog.h>
#include <gtk/gtkcolorsel.h>
#include <gtk/gtkvbox.h>
#include "gtkintl.h"
#include <gtk/gtkintl.h>
#ifdef __cplusplus
extern "C" {
@ -49,7 +49,7 @@ typedef struct _GtkColorSelectionDialogClass GtkColorSelectionDialogClass;
struct _GtkColorSelectionDialog
{
GtkDialog dialog;
GtkDialog parent_instance;
GtkWidget *colorsel;
GtkWidget *ok_button;

View File

@ -110,13 +110,18 @@ gtk_combo_class_init (GtkComboClass * klass)
}
static void
gtk_combo_destroy (GtkObject * combo)
gtk_combo_destroy (GtkObject *object)
{
gtk_widget_destroy (GTK_COMBO (combo)->popwin);
gtk_widget_unref (GTK_COMBO (combo)->popwin);
GtkCombo *combo = GTK_COMBO (object);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(*GTK_OBJECT_CLASS (parent_class)->destroy) (combo);
if (combo->popwin)
{
gtk_widget_destroy (combo->popwin);
gtk_widget_unref (combo->popwin);
combo->popwin = NULL;
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static int
@ -340,9 +345,8 @@ gtk_combo_get_pos (GtkCombo * combo, gint * x, gint * y, gint * height, gint * w
if (!show_hscroll &&
alloc_width < list_requisition.width)
{
work_height += popup->hscrollbar->requisition.height +
GTK_SCROLLED_WINDOW_CLASS
(GTK_OBJECT (combo->popup)->klass)->scrollbar_spacing;
work_height += (popup->hscrollbar->requisition.height +
GTK_SCROLLED_WINDOW_GET_CLASS (combo->popup)->scrollbar_spacing);
show_hscroll = TRUE;
}
if (!show_vscroll &&
@ -354,10 +358,8 @@ gtk_combo_get_pos (GtkCombo * combo, gint * x, gint * y, gint * height, gint * w
*y -= (work_height + list_requisition.height + real_height);
break;
}
alloc_width -=
popup->vscrollbar->requisition.width +
GTK_SCROLLED_WINDOW_CLASS
(GTK_OBJECT (combo->popup)->klass)->scrollbar_spacing;
alloc_width -= (popup->vscrollbar->requisition.width +
GTK_SCROLLED_WINDOW_GET_CLASS (combo->popup)->scrollbar_spacing);
show_vscroll = TRUE;
}
} while (old_width != alloc_width || old_height != work_height);
@ -834,7 +836,10 @@ gtk_combo_item_destroy (GtkObject * object)
key = gtk_object_get_data (object, gtk_combo_string_key);
if (key)
{
gtk_object_remove_data (object, gtk_combo_string_key);
g_free (key);
}
}
void

View File

@ -173,7 +173,7 @@ gtk_container_class_init (GtkContainerClass *class)
container_signals[ADD] =
gtk_signal_new ("add",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkContainerClass, add),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
@ -181,7 +181,7 @@ gtk_container_class_init (GtkContainerClass *class)
container_signals[REMOVE] =
gtk_signal_new ("remove",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkContainerClass, remove),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
@ -189,14 +189,14 @@ gtk_container_class_init (GtkContainerClass *class)
container_signals[CHECK_RESIZE] =
gtk_signal_new ("check_resize",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkContainerClass, check_resize),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
container_signals[FOCUS] =
gtk_signal_new ("focus",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkContainerClass, focus),
gtk_marshal_ENUM__ENUM,
GTK_TYPE_DIRECTION_TYPE, 1,
@ -204,7 +204,7 @@ gtk_container_class_init (GtkContainerClass *class)
container_signals[SET_FOCUS_CHILD] =
gtk_signal_new ("set-focus-child",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkContainerClass, set_focus_child),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
@ -237,7 +237,7 @@ gtk_container_child_type (GtkContainer *container)
g_return_val_if_fail (container != NULL, 0);
g_return_val_if_fail (GTK_IS_CONTAINER (container), 0);
class = GTK_CONTAINER_CLASS (GTK_OBJECT (container)->klass);
class = GTK_CONTAINER_GET_CLASS (container);
if (class->child_type)
slot = class->child_type (container);
else
@ -1104,7 +1104,7 @@ gtk_container_forall (GtkContainer *container,
g_return_if_fail (GTK_IS_CONTAINER (container));
g_return_if_fail (callback != NULL);
class = GTK_CONTAINER_CLASS (GTK_OBJECT (container)->klass);
class = GTK_CONTAINER_GET_CLASS (container);
if (class->forall)
class->forall (container, TRUE, callback, callback_data);
@ -1121,7 +1121,7 @@ gtk_container_foreach (GtkContainer *container,
g_return_if_fail (GTK_IS_CONTAINER (container));
g_return_if_fail (callback != NULL);
class = GTK_CONTAINER_CLASS (GTK_OBJECT (container)->klass);
class = GTK_CONTAINER_GET_CLASS (container);
if (class->forall)
class->forall (container, FALSE, callback, callback_data);
@ -1144,8 +1144,8 @@ gtk_container_foreach_unmarshal (GtkWidget *child,
/* first argument */
args[0].name = NULL;
args[0].type = GTK_OBJECT(child)->klass->type;
GTK_VALUE_OBJECT(args[0]) = GTK_OBJECT (child);
args[0].type = GTK_OBJECT_TYPE (child);
GTK_VALUE_OBJECT (args[0]) = GTK_OBJECT (child);
/* location for return value */
args[1].name = NULL;
@ -1227,42 +1227,6 @@ gtk_container_children (GtkContainer *container)
return g_list_reverse (children);
}
void
gtk_container_register_toplevel (GtkContainer *container)
{
g_return_if_fail (container != NULL);
toplevel_list = g_list_prepend (toplevel_list, container);
gtk_widget_ref (GTK_WIDGET (container));
gtk_object_sink (GTK_OBJECT (container));
}
void
gtk_container_unregister_toplevel (GtkContainer *container)
{
GList *node;
g_return_if_fail (container != NULL);
node = g_list_find (toplevel_list, container);
g_return_if_fail (node != NULL);
toplevel_list = g_list_remove_link (toplevel_list, node);
g_list_free_1 (node);
gtk_widget_unref (GTK_WIDGET (container));
}
GList*
gtk_container_get_toplevels (void)
{
/* XXX: fixme we should ref all these widgets and duplicate
* the list.
*/
return toplevel_list;
}
static void
gtk_container_child_position_callback (GtkWidget *widget,
gpointer client_data)
@ -1327,7 +1291,7 @@ gtk_container_child_composite_name (GtkContainer *container,
{
GtkContainerClass *class;
class = GTK_CONTAINER_CLASS (GTK_OBJECT (container)->klass);
class = GTK_CONTAINER_GET_CLASS (container);
if (class->composite_name)
name = class->composite_name (container, child);
}

View File

@ -141,9 +141,6 @@ void gtk_container_set_focus_vadjustment (GtkContainer *container,
GtkAdjustment *adjustment);
void gtk_container_set_focus_hadjustment (GtkContainer *container,
GtkAdjustment *adjustment);
void gtk_container_register_toplevel (GtkContainer *container);
void gtk_container_unregister_toplevel (GtkContainer *container);
GList* gtk_container_get_toplevels (void);
void gtk_container_resize_children (GtkContainer *container);

View File

@ -71,11 +71,10 @@ COLUMN_FROM_XPIXEL (GtkCList * clist,
return -1;
}
#define GTK_CLIST_CLASS_FW(_widget_) GTK_CLIST_CLASS (((GtkObject*) (_widget_))->klass)
#define CLIST_UNFROZEN(clist) (((GtkCList*) (clist))->freeze_count == 0)
#define CLIST_REFRESH(clist) G_STMT_START { \
if (CLIST_UNFROZEN (clist)) \
GTK_CLIST_CLASS_FW (clist)->refresh ((GtkCList*) (clist)); \
GTK_CLIST_GET_CLASS (clist)->refresh ((GtkCList*) (clist)); \
} G_STMT_END
@ -390,35 +389,35 @@ gtk_ctree_class_init (GtkCTreeClass *klass)
ctree_signals[TREE_SELECT_ROW] =
gtk_signal_new ("tree_select_row",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCTreeClass, tree_select_row),
gtk_marshal_NONE__POINTER_INT,
GTK_TYPE_NONE, 2, GTK_TYPE_CTREE_NODE, GTK_TYPE_INT);
ctree_signals[TREE_UNSELECT_ROW] =
gtk_signal_new ("tree_unselect_row",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCTreeClass, tree_unselect_row),
gtk_marshal_NONE__POINTER_INT,
GTK_TYPE_NONE, 2, GTK_TYPE_CTREE_NODE, GTK_TYPE_INT);
ctree_signals[TREE_EXPAND] =
gtk_signal_new ("tree_expand",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCTreeClass, tree_expand),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1, GTK_TYPE_CTREE_NODE);
ctree_signals[TREE_COLLAPSE] =
gtk_signal_new ("tree_collapse",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCTreeClass, tree_collapse),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1, GTK_TYPE_CTREE_NODE);
ctree_signals[TREE_MOVE] =
gtk_signal_new ("tree_move",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCTreeClass, tree_move),
gtk_marshal_NONE__POINTER_POINTER_POINTER,
GTK_TYPE_NONE, 3, GTK_TYPE_CTREE_NODE,
@ -426,7 +425,7 @@ gtk_ctree_class_init (GtkCTreeClass *klass)
ctree_signals[CHANGE_FOCUS_ROW_EXPANSION] =
gtk_signal_new ("change_focus_row_expansion",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCTreeClass,
change_focus_row_expansion),
gtk_marshal_NONE__ENUM,
@ -2006,7 +2005,7 @@ tree_draw_node (GtkCTree *ctree,
num++;
}
if (work && gtk_clist_row_is_visible (clist, num) != GTK_VISIBILITY_NONE)
GTK_CLIST_CLASS_FW (clist)->draw_row
GTK_CLIST_GET_CLASS (clist)->draw_row
(clist, NULL, num, GTK_CLIST_ROW ((GList *) node));
}
}
@ -2055,7 +2054,7 @@ gtk_ctree_link (GtkCTree *ctree,
if (update_focus_row && clist->selection_mode == GTK_SELECTION_EXTENDED)
{
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
g_list_free (clist->undo_selection);
g_list_free (clist->undo_unselection);
@ -2200,7 +2199,7 @@ gtk_ctree_unlink (GtkCTree *ctree,
if (update_focus_row && clist->selection_mode == GTK_SELECTION_EXTENDED)
{
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
g_list_free (clist->undo_selection);
g_list_free (clist->undo_unselection);
@ -2382,7 +2381,7 @@ real_tree_move (GtkCTree *ctree,
if (clist->selection_mode == GTK_SELECTION_EXTENDED)
{
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
g_list_free (clist->undo_selection);
g_list_free (clist->undo_unselection);
@ -2498,7 +2497,7 @@ real_tree_expand (GtkCTree *ctree,
clist = GTK_CLIST (ctree);
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
GTK_CTREE_ROW (node)->expanded = TRUE;
level = GTK_CTREE_ROW (node)->level;
@ -2507,7 +2506,7 @@ real_tree_expand (GtkCTree *ctree,
/* get cell width if tree_column is auto resized */
if (visible && clist->column[ctree->tree_column].auto_resize &&
!GTK_CLIST_AUTO_RESIZE_BLOCKED (clist))
GTK_CLIST_CLASS_FW (clist)->cell_size_request
GTK_CLIST_GET_CLASS (clist)->cell_size_request
(clist, &GTK_CTREE_ROW (node)->row, ctree->tree_column, &requisition);
/* unref/unset closed pixmap */
@ -2567,7 +2566,7 @@ real_tree_expand (GtkCTree *ctree,
for (i = 0; i < clist->columns; i++)
if (clist->column[i].auto_resize)
{
GTK_CLIST_CLASS_FW (clist)->cell_size_request
GTK_CLIST_GET_CLASS (clist)->cell_size_request
(clist, &GTK_CTREE_ROW (work)->row, i, &requisition);
cell_width[i] = MAX (requisition.width, cell_width[i]);
}
@ -2643,7 +2642,7 @@ real_tree_collapse (GtkCTree *ctree,
clist = GTK_CLIST (ctree);
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
GTK_CTREE_ROW (node)->expanded = FALSE;
level = GTK_CTREE_ROW (node)->level;
@ -2652,7 +2651,7 @@ real_tree_collapse (GtkCTree *ctree,
/* get cell width if tree_column is auto resized */
if (visible && clist->column[ctree->tree_column].auto_resize &&
!GTK_CLIST_AUTO_RESIZE_BLOCKED (clist))
GTK_CLIST_CLASS_FW (clist)->cell_size_request
GTK_CLIST_GET_CLASS (clist)->cell_size_request
(clist, &GTK_CTREE_ROW (node)->row, ctree->tree_column, &requisition);
/* unref/unset opened pixmap */
@ -2753,7 +2752,7 @@ column_auto_resize (GtkCList *clist,
return;
if (clist_row)
GTK_CLIST_CLASS_FW (clist)->cell_size_request (clist, clist_row,
GTK_CLIST_GET_CLASS (clist)->cell_size_request (clist, clist_row,
column, &requisition);
else
requisition.width = 0;
@ -2776,7 +2775,7 @@ column_auto_resize (GtkCList *clist,
for (list = clist->row_list; list; list = list->next)
{
GTK_CLIST_CLASS_FW (clist)->cell_size_request
GTK_CLIST_GET_CLASS (clist)->cell_size_request
(clist, GTK_CLIST_ROW (list), column, &requisition);
new_width = MAX (new_width, requisition.width);
if (new_width == clist->column[column].width)
@ -2910,7 +2909,7 @@ set_cell_contents (GtkCList *clist,
gtk_ctree_is_viewable (ctree, parent)))
{
visible = TRUE;
GTK_CLIST_CLASS_FW (clist)->cell_size_request (clist, clist_row,
GTK_CLIST_GET_CLASS (clist)->cell_size_request (clist, clist_row,
column, &requisition);
}
}
@ -3211,7 +3210,7 @@ row_delete (GtkCTree *ctree,
for (i = 0; i < clist->columns; i++)
{
GTK_CLIST_CLASS_FW (clist)->set_cell_contents
GTK_CLIST_GET_CLASS (clist)->set_cell_contents
(clist, &(ctree_row->row), i, GTK_CELL_EMPTY, NULL, 0, NULL, NULL);
if (ctree_row->row.cell[i].style)
{
@ -3656,7 +3655,7 @@ gtk_ctree_insert_node (GtkCTree *ctree,
if (text)
for (i = 0; i < clist->columns; i++)
if (text[i] && i != ctree->tree_column)
GTK_CLIST_CLASS_FW (clist)->set_cell_contents
GTK_CLIST_GET_CLASS (clist)->set_cell_contents
(clist, &(new_row->row), i, GTK_CELL_TEXT, text[i], 0, NULL, NULL);
set_node_info (ctree, node, text ?
@ -4574,7 +4573,7 @@ gtk_ctree_real_select_recursive (GtkCTree *ctree,
if (clist->selection_mode == GTK_SELECTION_EXTENDED)
{
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
g_list_free (clist->undo_selection);
g_list_free (clist->undo_unselection);
@ -4616,7 +4615,7 @@ gtk_ctree_node_set_text (GtkCTree *ctree,
clist = GTK_CLIST (ctree);
GTK_CLIST_CLASS_FW (clist)->set_cell_contents
GTK_CLIST_GET_CLASS (clist)->set_cell_contents
(clist, &(GTK_CTREE_ROW(node)->row), column, GTK_CELL_TEXT,
text, 0, NULL, NULL);
@ -4646,7 +4645,7 @@ gtk_ctree_node_set_pixmap (GtkCTree *ctree,
clist = GTK_CLIST (ctree);
GTK_CLIST_CLASS_FW (clist)->set_cell_contents
GTK_CLIST_GET_CLASS (clist)->set_cell_contents
(clist, &(GTK_CTREE_ROW (node)->row), column, GTK_CELL_PIXMAP,
NULL, 0, pixmap, mask);
@ -4681,7 +4680,7 @@ gtk_ctree_node_set_pixtext (GtkCTree *ctree,
gdk_pixmap_ref (mask);
}
GTK_CLIST_CLASS_FW (clist)->set_cell_contents
GTK_CLIST_GET_CLASS (clist)->set_cell_contents
(clist, &(GTK_CTREE_ROW (node)->row), column, GTK_CELL_PIXTEXT,
text, spacing, pixmap, mask);
@ -4766,7 +4765,7 @@ gtk_ctree_node_set_shift (GtkCTree *ctree,
{
visible = gtk_ctree_is_viewable (ctree, node);
if (visible)
GTK_CLIST_CLASS_FW (clist)->cell_size_request
GTK_CLIST_GET_CLASS (clist)->cell_size_request
(clist, &GTK_CTREE_ROW (node)->row, column, &requisition);
}
@ -4828,7 +4827,7 @@ gtk_ctree_node_set_selectable (GtkCTree *ctree,
clist->drag_button = 0;
remove_grab (clist);
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
}
gtk_ctree_unselect (ctree, node);
}
@ -5003,7 +5002,7 @@ gtk_ctree_node_set_cell_style (GtkCTree *ctree,
{
visible = gtk_ctree_is_viewable (ctree, node);
if (visible)
GTK_CLIST_CLASS_FW (clist)->cell_size_request
GTK_CLIST_GET_CLASS (clist)->cell_size_request
(clist, &GTK_CTREE_ROW (node)->row, column, &requisition);
}
@ -5075,7 +5074,7 @@ gtk_ctree_node_set_row_style (GtkCTree *ctree,
for (i = 0; i < clist->columns; i++)
if (clist->column[i].auto_resize)
{
GTK_CLIST_CLASS_FW (clist)->cell_size_request
GTK_CLIST_GET_CLASS (clist)->cell_size_request
(clist, &GTK_CTREE_ROW (node)->row, i, &requisition);
old_width[i] = requisition.width;
}
@ -5321,7 +5320,7 @@ gtk_ctree_set_show_stub (GtkCTree *ctree,
if (CLIST_UNFROZEN (clist) && clist->rows &&
gtk_clist_row_is_visible (clist, 0) != GTK_VISIBILITY_NONE)
GTK_CLIST_CLASS_FW (clist)->draw_row
GTK_CLIST_GET_CLASS (clist)->draw_row
(clist, NULL, 0, GTK_CLIST_ROW (clist->row_list));
}
}
@ -5512,7 +5511,7 @@ gtk_ctree_sort_recursive (GtkCTree *ctree,
if (clist->selection_mode == GTK_SELECTION_EXTENDED)
{
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
g_list_free (clist->undo_selection);
g_list_free (clist->undo_unselection);
@ -5560,7 +5559,7 @@ gtk_ctree_sort_node (GtkCTree *ctree,
if (clist->selection_mode == GTK_SELECTION_EXTENDED)
{
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
g_list_free (clist->undo_selection);
g_list_free (clist->undo_unselection);
@ -5601,7 +5600,7 @@ fake_unselect_all (GtkCList *clist,
if (CLIST_UNFROZEN (clist) &&
gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row,
GTK_CLIST_GET_CLASS (clist)->draw_row (clist, NULL, row,
GTK_CLIST_ROW (focus_node));
}
}
@ -6043,7 +6042,7 @@ gtk_ctree_drag_motion (GtkWidget *widget,
dest_info->insert_pos != new_info.insert_pos))
{
if (dest_info->cell.row >= 0)
GTK_CLIST_CLASS_FW (clist)->draw_drag_highlight
GTK_CLIST_GET_CLASS (clist)->draw_drag_highlight
(clist,
g_list_nth (clist->row_list, dest_info->cell.row)->data,
dest_info->cell.row, dest_info->insert_pos);
@ -6052,7 +6051,7 @@ gtk_ctree_drag_motion (GtkWidget *widget,
dest_info->cell.row = new_info.cell.row;
dest_info->cell.column = new_info.cell.column;
GTK_CLIST_CLASS_FW (clist)->draw_drag_highlight
GTK_CLIST_GET_CLASS (clist)->draw_drag_highlight
(clist,
g_list_nth (clist->row_list, dest_info->cell.row)->data,
dest_info->cell.row, dest_info->insert_pos);

View File

@ -68,7 +68,7 @@ static void gtk_curve_set_arg (GtkObject *object,
static void gtk_curve_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_curve_finalize (GtkObject *object);
static void gtk_curve_finalize (GObject *object);
static gint gtk_curve_graph_events (GtkWidget *widget,
GdkEvent *event,
GtkCurve *c);
@ -101,18 +101,18 @@ gtk_curve_get_type (void)
static void
gtk_curve_class_init (GtkCurveClass *class)
{
GtkObjectClass *object_class;
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (class);
parent_class = gtk_type_class (GTK_TYPE_DRAWING_AREA);
object_class = (GtkObjectClass *) class;
gobject_class->finalize = gtk_curve_finalize;
object_class->set_arg = gtk_curve_set_arg;
object_class->get_arg = gtk_curve_get_arg;
object_class->finalize = gtk_curve_finalize;
curve_type_changed_signal =
gtk_signal_new ("curve_type_changed", GTK_RUN_FIRST, object_class->type,
gtk_signal_new ("curve_type_changed", GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCurveClass, curve_type_changed),
gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, &curve_type_changed_signal, 1);
@ -942,7 +942,7 @@ gtk_curve_new (void)
}
static void
gtk_curve_finalize (GtkObject *object)
gtk_curve_finalize (GObject *object)
{
GtkCurve *curve;
@ -957,5 +957,5 @@ gtk_curve_finalize (GtkObject *object)
if (curve->ctlpoint)
g_free (curve->ctlpoint);
(*GTK_OBJECT_CLASS (parent_class)->finalize) (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -75,7 +75,7 @@ gtk_data_class_init (GtkDataClass *class)
data_signals[DISCONNECT] =
gtk_signal_new ("disconnect",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkDataClass, disconnect),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);

View File

@ -148,7 +148,7 @@ gtk_editable_class_init (GtkEditableClass *class)
editable_signals[CHANGED] =
gtk_signal_new ("changed",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkEditableClass, changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
@ -156,7 +156,7 @@ gtk_editable_class_init (GtkEditableClass *class)
editable_signals[INSERT_TEXT] =
gtk_signal_new ("insert_text",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkEditableClass, insert_text),
gtk_marshal_NONE__POINTER_INT_POINTER,
GTK_TYPE_NONE,
@ -168,7 +168,7 @@ gtk_editable_class_init (GtkEditableClass *class)
editable_signals[DELETE_TEXT] =
gtk_signal_new ("delete_text",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkEditableClass, delete_text),
gtk_marshal_NONE__INT_INT,
GTK_TYPE_NONE,
@ -179,7 +179,7 @@ gtk_editable_class_init (GtkEditableClass *class)
editable_signals[ACTIVATE] =
gtk_signal_new ("activate",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkEditableClass, activate),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
@ -188,7 +188,7 @@ gtk_editable_class_init (GtkEditableClass *class)
editable_signals[SET_EDITABLE] =
gtk_signal_new ("set-editable",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkEditableClass, set_editable),
gtk_marshal_NONE__BOOL,
GTK_TYPE_NONE, 1,
@ -197,7 +197,7 @@ gtk_editable_class_init (GtkEditableClass *class)
editable_signals[MOVE_CURSOR] =
gtk_signal_new ("move_cursor",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkEditableClass, move_cursor),
gtk_marshal_NONE__INT_INT,
GTK_TYPE_NONE, 2,
@ -207,7 +207,7 @@ gtk_editable_class_init (GtkEditableClass *class)
editable_signals[MOVE_WORD] =
gtk_signal_new ("move_word",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkEditableClass, move_word),
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1,
@ -216,7 +216,7 @@ gtk_editable_class_init (GtkEditableClass *class)
editable_signals[MOVE_PAGE] =
gtk_signal_new ("move_page",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkEditableClass, move_page),
gtk_marshal_NONE__INT_INT,
GTK_TYPE_NONE, 2,
@ -226,7 +226,7 @@ gtk_editable_class_init (GtkEditableClass *class)
editable_signals[MOVE_TO_ROW] =
gtk_signal_new ("move_to_row",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkEditableClass, move_to_row),
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1,
@ -235,7 +235,7 @@ gtk_editable_class_init (GtkEditableClass *class)
editable_signals[MOVE_TO_COLUMN] =
gtk_signal_new ("move_to_column",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkEditableClass, move_to_column),
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1,
@ -244,7 +244,7 @@ gtk_editable_class_init (GtkEditableClass *class)
editable_signals[KILL_CHAR] =
gtk_signal_new ("kill_char",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkEditableClass, kill_char),
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1,
@ -253,7 +253,7 @@ gtk_editable_class_init (GtkEditableClass *class)
editable_signals[KILL_WORD] =
gtk_signal_new ("kill_word",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkEditableClass, kill_word),
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1,
@ -262,7 +262,7 @@ gtk_editable_class_init (GtkEditableClass *class)
editable_signals[KILL_LINE] =
gtk_signal_new ("kill_line",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkEditableClass, kill_line),
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1,
@ -271,7 +271,7 @@ gtk_editable_class_init (GtkEditableClass *class)
editable_signals[CUT_CLIPBOARD] =
gtk_signal_new ("cut_clipboard",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkEditableClass, cut_clipboard),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
@ -279,7 +279,7 @@ gtk_editable_class_init (GtkEditableClass *class)
editable_signals[COPY_CLIPBOARD] =
gtk_signal_new ("copy_clipboard",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkEditableClass, copy_clipboard),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
@ -287,7 +287,7 @@ gtk_editable_class_init (GtkEditableClass *class)
editable_signals[PASTE_CLIPBOARD] =
gtk_signal_new ("paste_clipboard",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkEditableClass, paste_clipboard),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
@ -422,7 +422,7 @@ gtk_editable_insert_text (GtkEditable *editable,
gtk_widget_ref (GTK_WIDGET (editable));
klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
klass = GTK_EDITABLE_GET_CLASS (editable);
if (new_text_length <= 64)
text = buf;
@ -452,7 +452,7 @@ gtk_editable_delete_text (GtkEditable *editable,
gtk_widget_ref (GTK_WIDGET (editable));
klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
klass = GTK_EDITABLE_GET_CLASS (editable);
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[DELETE_TEXT], start_pos, end_pos);
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[CHANGED]);
@ -470,7 +470,7 @@ gtk_editable_update_text (GtkEditable *editable,
g_return_if_fail (editable != NULL);
g_return_if_fail (GTK_IS_EDITABLE (editable));
klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
klass = GTK_EDITABLE_GET_CLASS (editable);
klass->update_text (editable, start_pos, end_pos);
}
@ -485,7 +485,7 @@ gtk_editable_get_chars (GtkEditable *editable,
g_return_val_if_fail (editable != NULL, NULL);
g_return_val_if_fail (GTK_IS_EDITABLE (editable), NULL);
klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
klass = GTK_EDITABLE_GET_CLASS (editable);
return klass->get_chars (editable, start, end);
}
@ -529,7 +529,7 @@ gtk_editable_set_selection (GtkEditable *editable,
g_return_if_fail (editable != NULL);
g_return_if_fail (GTK_IS_EDITABLE (editable));
klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
klass = GTK_EDITABLE_GET_CLASS (editable);
klass->set_selection (editable, start_pos, end_pos);
}
@ -543,7 +543,7 @@ gtk_editable_set_position (GtkEditable *editable,
g_return_if_fail (editable != NULL);
g_return_if_fail (GTK_IS_EDITABLE (editable));
klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
klass = GTK_EDITABLE_GET_CLASS (editable);
klass->set_position (editable, position);
}

View File

@ -55,7 +55,7 @@ static void gtk_entry_set_arg (GtkObject *object,
static void gtk_entry_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_entry_finalize (GtkObject *object);
static void gtk_entry_finalize (GObject *object);
static void gtk_entry_realize (GtkWidget *widget);
static void gtk_entry_unrealize (GtkWidget *widget);
static void gtk_entry_draw_focus (GtkWidget *widget);
@ -249,6 +249,7 @@ gtk_entry_get_type (void)
static void
gtk_entry_class_init (GtkEntryClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkEditableClass *editable_class;
@ -258,12 +259,13 @@ gtk_entry_class_init (GtkEntryClass *class)
editable_class = (GtkEditableClass*) class;
parent_class = gtk_type_class (GTK_TYPE_EDITABLE);
gobject_class->finalize = gtk_entry_finalize;
gtk_object_add_arg_type ("GtkEntry::max_length", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_MAX_LENGTH);
gtk_object_add_arg_type ("GtkEntry::visibility", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_VISIBILITY);
object_class->set_arg = gtk_entry_set_arg;
object_class->get_arg = gtk_entry_get_arg;
object_class->finalize = gtk_entry_finalize;
widget_class->realize = gtk_entry_realize;
widget_class->unrealize = gtk_entry_unrealize;
@ -513,11 +515,10 @@ gtk_entry_get_text (GtkEntry *entry)
}
static void
gtk_entry_finalize (GtkObject *object)
gtk_entry_finalize (GObject *object)
{
GtkEntry *entry;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_ENTRY (object));
entry = GTK_ENTRY (object);
@ -540,7 +541,7 @@ gtk_entry_finalize (GtkObject *object)
if (entry->backing_pixmap)
gdk_pixmap_unref (entry->backing_pixmap);
(* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void

View File

@ -673,10 +673,7 @@ gtk_file_selection_hide_fileop_buttons (GtkFileSelection *filesel)
g_return_if_fail (GTK_IS_FILE_SELECTION (filesel));
if (filesel->fileop_ren_file)
{
gtk_widget_destroy (filesel->fileop_ren_file);
filesel->fileop_ren_file = NULL;
}
if (filesel->fileop_del_file)
{
@ -771,13 +768,15 @@ gtk_file_selection_destroy (GtkObject *object)
GList *list;
HistoryCallbackArg *callback_arg;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_FILE_SELECTION (object));
filesel = GTK_FILE_SELECTION (object);
if (filesel->fileop_dialog)
{
gtk_widget_destroy (filesel->fileop_dialog);
filesel->fileop_dialog = NULL;
}
if (filesel->history_list)
{
@ -793,11 +792,13 @@ gtk_file_selection_destroy (GtkObject *object)
filesel->history_list = NULL;
}
if (filesel->cmpl_state)
{
cmpl_free_state (filesel->cmpl_state);
filesel->cmpl_state = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
/* Begin file operations callbacks */
@ -913,7 +914,8 @@ gtk_file_selection_create_dir (GtkWidget *widget, gpointer data)
return;
/* main dialog */
fs->fileop_dialog = dialog = gtk_dialog_new ();
dialog = gtk_dialog_new ();
fs->fileop_dialog = dialog;
gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
(GtkSignalFunc) gtk_file_selection_fileop_destroy,
(gpointer) fs);
@ -1818,6 +1820,8 @@ cmpl_free_dir_sent_list(GList* dp0)
static void
cmpl_free_state (CompletionState* cmpl_state)
{
g_return_if_fail (cmpl_state != NULL);
cmpl_free_dir_list (cmpl_state->directory_storage);
cmpl_free_dir_sent_list (cmpl_state->directory_sent_storage);

View File

@ -44,7 +44,7 @@ static void gtk_frame_set_arg (GtkObject *object,
static void gtk_frame_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_frame_finalize (GtkObject *object);
static void gtk_frame_finalize (GObject *object);
static void gtk_frame_paint (GtkWidget *widget,
GdkRectangle *area);
static void gtk_frame_draw (GtkWidget *widget,
@ -90,6 +90,7 @@ gtk_frame_get_type (void)
static void
gtk_frame_class_init (GtkFrameClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
@ -98,6 +99,8 @@ gtk_frame_class_init (GtkFrameClass *class)
parent_class = gtk_type_class (gtk_bin_get_type ());
gobject_class->finalize = gtk_frame_finalize;
gtk_object_add_arg_type ("GtkFrame::label", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_LABEL);
gtk_object_add_arg_type ("GtkFrame::label_xalign", GTK_TYPE_FLOAT, GTK_ARG_READWRITE, ARG_LABEL_XALIGN);
gtk_object_add_arg_type ("GtkFrame::label_yalign", GTK_TYPE_FLOAT, GTK_ARG_READWRITE, ARG_LABEL_YALIGN);
@ -105,7 +108,6 @@ gtk_frame_class_init (GtkFrameClass *class)
object_class->set_arg = gtk_frame_set_arg;
object_class->get_arg = gtk_frame_get_arg;
object_class->finalize = gtk_frame_finalize;
widget_class->draw = gtk_frame_draw;
widget_class->expose_event = gtk_frame_expose;
@ -314,11 +316,10 @@ gtk_frame_set_shadow_type (GtkFrame *frame,
static void
gtk_frame_finalize (GtkObject *object)
gtk_frame_finalize (GObject *object)
{
GtkFrame *frame;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_FRAME (object));
frame = GTK_FRAME (object);
@ -326,7 +327,7 @@ gtk_frame_finalize (GtkObject *object)
if (frame->label)
g_free (frame->label);
(* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void

View File

@ -181,7 +181,7 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class)
handle_box_signals[SIGNAL_CHILD_ATTACHED] =
gtk_signal_new ("child_attached",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkHandleBoxClass, child_attached),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
@ -189,7 +189,7 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class)
handle_box_signals[SIGNAL_CHILD_DETACHED] =
gtk_signal_new ("child_detached",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkHandleBoxClass, child_detached),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,

View File

@ -30,8 +30,8 @@
#include "gdk/gdkkeysyms.h"
#define SCALE_CLASS(w) GTK_SCALE_CLASS (GTK_OBJECT (w)->klass)
#define RANGE_CLASS(w) GTK_RANGE_CLASS (GTK_OBJECT (w)->klass)
#define SCALE_CLASS(w) GTK_SCALE_GET_CLASS (w)
#define RANGE_CLASS(w) GTK_RANGE_GET_CLASS (w)
enum {
ARG_0,
@ -111,7 +111,7 @@ gtk_hscale_class_init (GtkHScaleClass *class)
gtk_object_add_arg_type ("GtkHScale::adjustment",
GTK_TYPE_ADJUSTMENT,
GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
GTK_ARG_READWRITE,
ARG_ADJUSTMENT);
object_class->set_arg = gtk_hscale_set_arg;

View File

@ -31,7 +31,7 @@
#define EPSILON 0.01
#define RANGE_CLASS(w) GTK_RANGE_CLASS (GTK_OBJECT (w)->klass)
#define RANGE_CLASS(w) GTK_RANGE_GET_CLASS (w)
enum {
ARG_0,
@ -97,7 +97,7 @@ gtk_hscrollbar_class_init (GtkHScrollbarClass *class)
gtk_object_add_arg_type ("GtkHScrollbar::adjustment",
GTK_TYPE_ADJUSTMENT,
GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
GTK_ARG_READWRITE,
ARG_ADJUSTMENT);
object_class->set_arg = gtk_hscrollbar_set_arg;

View File

@ -26,7 +26,12 @@
#include "gtksignal.h"
#include "gtkhsv.h"
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
/* Default width/height */
#define DEFAULT_SIZE 100
@ -34,7 +39,6 @@
/* Default ring width */
#define DEFAULT_RING_WIDTH 10
/* Dragging modes */
typedef enum {
@ -76,23 +80,26 @@ enum {
static void gtk_hsv_class_init (GtkHSVClass *class);
static void gtk_hsv_init (GtkHSV *hsv);
static void gtk_hsv_destroy (GtkObject *object);
static void gtk_hsv_map (GtkWidget *widget);
static void gtk_hsv_unmap (GtkWidget *widget);
static void gtk_hsv_realize (GtkWidget *widget);
static void gtk_hsv_unrealize (GtkWidget *widget);
static void gtk_hsv_size_request (GtkWidget *widget, GtkRequisition *requisition);
static void gtk_hsv_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
static gint gtk_hsv_button_press (GtkWidget *widget, GdkEventButton *event);
static gint gtk_hsv_button_release (GtkWidget *widget, GdkEventButton *event);
static gint gtk_hsv_motion (GtkWidget *widget, GdkEventMotion *event);
static gint gtk_hsv_expose (GtkWidget *widget, GdkEventExpose *event);
static void gtk_hsv_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_hsv_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static gint gtk_hsv_button_press (GtkWidget *widget,
GdkEventButton *event);
static gint gtk_hsv_button_release (GtkWidget *widget,
GdkEventButton *event);
static gint gtk_hsv_motion (GtkWidget *widget,
GdkEventMotion *event);
static gint gtk_hsv_expose (GtkWidget *widget,
GdkEventExpose *event);
static guint hsv_signals[LAST_SIGNAL];
static GtkWidgetClass *parent_class;
/**
* gtk_hsv_get_type:
@ -120,7 +127,7 @@ gtk_hsv_get_type (void)
(GtkClassInitFunc) NULL
};
hsv_type = gtk_type_unique (gtk_widget_get_type (), &hsv_info);
hsv_type = gtk_type_unique (GTK_TYPE_WIDGET, &hsv_info);
}
return hsv_type;
@ -136,16 +143,15 @@ gtk_hsv_class_init (GtkHSVClass *class)
object_class = (GtkObjectClass *) class;
widget_class = (GtkWidgetClass *) class;
parent_class = gtk_type_class (gtk_widget_get_type ());
parent_class = gtk_type_class (GTK_TYPE_WIDGET);
hsv_signals[CHANGED] =
gtk_signal_new ("changed",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkHSVClass, changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, hsv_signals, LAST_SIGNAL);
object_class->destroy = gtk_hsv_destroy;
@ -186,22 +192,20 @@ static void
gtk_hsv_destroy (GtkObject *object)
{
GtkHSV *hsv;
HSVPrivate *priv;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_HSV (object));
hsv = GTK_HSV (object);
priv = hsv->priv;
g_free (priv);
if (hsv->priv)
{
g_free (hsv->priv);
hsv->priv = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
/* Default signal handlers */
/* Map handler for the HSV color selector */
@ -303,12 +307,13 @@ gtk_hsv_unrealize (GtkWidget *widget)
priv->gc = NULL;
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
}
/* Size_request handler for the HSV color selector */
static void
gtk_hsv_size_request (GtkWidget *widget, GtkRequisition *requisition)
gtk_hsv_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
GtkHSV *hsv;
HSVPrivate *priv;
@ -322,7 +327,8 @@ gtk_hsv_size_request (GtkWidget *widget, GtkRequisition *requisition)
/* Size_allocate handler for the HSV color selector */
static void
gtk_hsv_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
gtk_hsv_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkHSV *hsv;
HSVPrivate *priv;
@ -340,7 +346,6 @@ gtk_hsv_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
allocation->height);
}
/* Utility functions */
@ -348,16 +353,21 @@ gtk_hsv_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
/* Converts from HSV to RGB */
static void
hsv_to_rgb (double *h, double *s, double *v)
hsv_to_rgb (gdouble *h,
gdouble *s,
gdouble *v)
{
double hue, saturation, value;
double f, p, q, t;
gdouble hue, saturation, value;
gdouble f, p, q, t;
if (*s == 0.0) {
if (*s == 0.0)
{
*h = *v;
*s = *v;
*v = *v; /* heh */
} else {
}
else
{
hue = *h * 6.0;
saturation = *s;
value = *v;
@ -370,7 +380,8 @@ hsv_to_rgb (double *h, double *s, double *v)
q = value * (1.0 - saturation * f);
t = value * (1.0 - saturation * (1.0 - f));
switch ((int) hue) {
switch ((int) hue)
{
case 0:
*h = value;
*s = t;
@ -415,12 +426,14 @@ hsv_to_rgb (double *h, double *s, double *v)
/* Converts from RGB to HSV */
static void
rgb_to_hsv (double *r, double *g, double *b)
rgb_to_hsv (gdouble *r,
gdouble *g,
gdouble *b)
{
double red, green, blue;
double h, s, v;
double min, max;
double delta;
gdouble red, green, blue;
gdouble h, s, v;
gdouble min, max;
gdouble delta;
red = *r;
green = *g;
@ -428,7 +441,8 @@ rgb_to_hsv (double *r, double *g, double *b)
h = 0.0;
if (red > green) {
if (red > green)
{
if (red > blue)
max = red;
else
@ -438,7 +452,9 @@ rgb_to_hsv (double *r, double *g, double *b)
min = green;
else
min = blue;
} else {
}
else
{
if (green > blue)
max = green;
else
@ -459,7 +475,8 @@ rgb_to_hsv (double *r, double *g, double *b)
if (s == 0.0)
h = 0.0;
else {
else
{
delta = max - min;
if (red == max)
@ -484,12 +501,18 @@ rgb_to_hsv (double *r, double *g, double *b)
/* Computes the vertices of the saturation/value triangle */
static void
compute_triangle (GtkHSV *hsv, int *hx, int *hy, int *sx, int *sy, int *vx, int *vy)
compute_triangle (GtkHSV *hsv,
gint *hx,
gint *hy,
gint *sx,
gint *sy,
gint *vx,
gint *vy)
{
HSVPrivate *priv;
double center;
double inner, outer;
double angle;
gdouble center;
gdouble inner, outer;
gdouble angle;
priv = hsv->priv;
@ -508,11 +531,13 @@ compute_triangle (GtkHSV *hsv, int *hx, int *hy, int *sx, int *sy, int *vx, int
/* Computes whether a point is inside the hue ring */
static gboolean
is_in_ring (GtkHSV *hsv, double x, double y)
is_in_ring (GtkHSV *hsv,
gdouble x,
gdouble y)
{
HSVPrivate *priv;
double dx, dy, dist;
double center, inner, outer;
gdouble dx, dy, dist;
gdouble center, inner, outer;
priv = hsv->priv;
@ -529,7 +554,11 @@ is_in_ring (GtkHSV *hsv, double x, double y)
/* Computes a saturation/value pair based on the mouse coordinates */
static void
compute_sv (GtkHSV *hsv, double x, double y, double *s, double *v)
compute_sv (GtkHSV *hsv,
gdouble x,
gdouble y,
gdouble *s,
gdouble *v)
{
HSVPrivate *priv;
int ihx, ihy, isx, isy, ivx, ivy;
@ -549,7 +578,8 @@ compute_sv (GtkHSV *hsv, double x, double y, double *s, double *v)
x -= center;
y = center - y;
if (vx * (x - sx) + vy * (y - sy) < 0.0) {
if (vx * (x - sx) + vy * (y - sy) < 0.0)
{
*s = 1.0;
*v = (((x - sx) * (hx - sx) + (y - sy) * (hy-sy))
/ ((hx - sx) * (hx - sx) + (hy - sy) * (hy - sy)));
@ -558,7 +588,9 @@ compute_sv (GtkHSV *hsv, double x, double y, double *s, double *v)
*v = 0.0;
else if (*v > 1.0)
*v = 1.0;
} else if (hx * (x - sx) + hy * (y - sy) < 0.0) {
}
else if (hx * (x - sx) + hy * (y - sy) < 0.0)
{
*s = 0.0;
*v = (((x - sx) * (vx - sx) + (y - sy) * (vy - sy))
/ ((vx - sx) * (vx - sx) + (vy - sy) * (vy - sy)));
@ -567,7 +599,9 @@ compute_sv (GtkHSV *hsv, double x, double y, double *s, double *v)
*v = 0.0;
else if (*v > 1.0)
*v = 1.0;
} else if (sx * (x - hx) + sy * (y - hy) < 0.0) {
}
else if (sx * (x - hx) + sy * (y - hy) < 0.0)
{
*v = 1.0;
*s = (((x - vx) * (hx - vx) + (y - vy) * (hy - vy)) /
((hx - vx) * (hx - vx) + (hy - vy) * (hy - vy)));
@ -576,14 +610,19 @@ compute_sv (GtkHSV *hsv, double x, double y, double *s, double *v)
*s = 0.0;
else if (*s > 1.0)
*s = 1.0;
} else {
}
else
{
*v = (((x - sx) * (hy - vy) - (y - sy) * (hx - vx))
/ ((vx - sx) * (hy - vy) - (vy - sy) * (hx - vx)));
if (*v<= 0.0) {
if (*v<= 0.0)
{
*v = 0.0;
*s = 0.0;
} else {
}
else
{
if (*v > 1.0)
*v = 1.0;
@ -598,7 +637,9 @@ compute_sv (GtkHSV *hsv, double x, double y, double *s, double *v)
/* Computes whether a point is inside the saturation/value triangle */
static gboolean
is_in_triangle (GtkHSV *hsv, double x, double y)
is_in_triangle (GtkHSV *hsv,
gdouble x,
gdouble y)
{
int hx, hy, sx, sy, vx, vy;
double det, s, v;
@ -615,7 +656,9 @@ is_in_triangle (GtkHSV *hsv, double x, double y)
/* Computes a value based on the mouse coordinates */
static double
compute_v (GtkHSV *hsv, double x, double y)
compute_v (GtkHSV *hsv,
gdouble x,
gdouble y)
{
HSVPrivate *priv;
double center;
@ -635,12 +678,11 @@ compute_v (GtkHSV *hsv, double x, double y)
return angle / (2.0 * M_PI);
}
/* Event handlers */
static void
set_cross_grab (GtkHSV *hsv, guint32 time)
set_cross_grab (GtkHSV *hsv,
guint32 time)
{
HSVPrivate *priv;
GdkCursor *cursor;
@ -656,12 +698,12 @@ set_cross_grab (GtkHSV *hsv, guint32 time)
cursor,
time);
gdk_cursor_destroy (cursor);
}
/* Button_press_event handler for the HSV color selector */
static gint
gtk_hsv_button_press (GtkWidget *widget, GdkEventButton *event)
gtk_hsv_button_press (GtkWidget *widget,
GdkEventButton *event)
{
GtkHSV *hsv;
HSVPrivate *priv;
@ -676,7 +718,8 @@ gtk_hsv_button_press (GtkWidget *widget, GdkEventButton *event)
x = event->x;
y = event->y;
if (is_in_ring (hsv, x, y)) {
if (is_in_ring (hsv, x, y))
{
priv->mode = DRAG_H;
set_cross_grab (hsv, event->time);
@ -688,8 +731,9 @@ gtk_hsv_button_press (GtkWidget *widget, GdkEventButton *event)
return TRUE;
}
if (is_in_triangle (hsv, x, y)) {
double s, v;
if (is_in_triangle (hsv, x, y))
{
gdouble s, v;
priv->mode = DRAG_SV;
set_cross_grab (hsv, event->time);
@ -704,12 +748,13 @@ gtk_hsv_button_press (GtkWidget *widget, GdkEventButton *event)
/* Button_release_event handler for the HSV color selector */
static gint
gtk_hsv_button_release (GtkWidget *widget, GdkEventButton *event)
gtk_hsv_button_release (GtkWidget *widget,
GdkEventButton *event)
{
GtkHSV *hsv;
HSVPrivate *priv;
DragMode mode;
double x, y;
gdouble x, y;
hsv = GTK_HSV (widget);
priv = hsv->priv;
@ -744,7 +789,8 @@ gtk_hsv_button_release (GtkWidget *widget, GdkEventButton *event)
/* Motion_notify_event handler for the HSV color selector */
static gint
gtk_hsv_motion (GtkWidget *widget, GdkEventMotion *event)
gtk_hsv_motion (GtkWidget *widget,
GdkEventMotion *event)
{
GtkHSV *hsv;
HSVPrivate *priv;
@ -758,19 +804,25 @@ gtk_hsv_motion (GtkWidget *widget, GdkEventMotion *event)
if (priv->mode == DRAG_NONE)
return FALSE;
if (event->is_hint) {
if (event->is_hint)
{
gdk_window_get_pointer (priv->window, &ix, &iy, &mods);
x = ix;
y = iy;
} else {
}
else
{
x = event->x;
y = event->y;
}
if (priv->mode == DRAG_H) {
if (priv->mode == DRAG_H)
{
gtk_hsv_set_color (hsv, compute_v (hsv, x, y), priv->s, priv->v);
return TRUE;
} else if (priv->mode == DRAG_SV) {
}
else if (priv->mode == DRAG_SV)
{
double s, v;
compute_sv (hsv, x, y, &s, &v);
@ -782,23 +834,27 @@ gtk_hsv_motion (GtkWidget *widget, GdkEventMotion *event)
return FALSE;
}
/* Redrawing */
/* Paints the hue ring */
static void
paint_ring (GtkHSV *hsv, GdkDrawable *drawable, int x, int y, int width, int height)
paint_ring (GtkHSV *hsv,
GdkDrawable *drawable,
gint x,
gint y,
gint width,
gint height)
{
HSVPrivate *priv;
int xx, yy;
double dx, dy, dist;
double center;
double inner, outer;
gdouble dx, dy, dist;
gdouble center;
gdouble inner, outer;
guchar *buf, *p;
double angle;
double hue;
double r, g, b;
gdouble angle;
gdouble hue;
gdouble r, g, b;
GdkBitmap *mask;
GdkGC *gc;
GdkColor color;
@ -814,16 +870,19 @@ paint_ring (GtkHSV *hsv, GdkDrawable *drawable, int x, int y, int width, int hei
buf = g_new (guchar, width * height * 3);
for (yy = 0; yy < height; yy++) {
for (yy = 0; yy < height; yy++)
{
p = buf + yy * width * 3;
dy = -(yy + y - center);
for (xx = 0; xx < width; xx++) {
for (xx = 0; xx < width; xx++)
{
dx = xx + x - center;
dist = dx * dx + dy * dy;
if (dist < (inner * inner) || dist > (outer * outer)) {
if (dist < (inner * inner) || dist > (outer * outer))
{
*p++ = 0;
*p++ = 0;
*p++ = 0;
@ -923,7 +982,12 @@ paint_ring (GtkHSV *hsv, GdkDrawable *drawable, int x, int y, int width, int hei
/* Converts an HSV triplet to an integer RGB triplet */
static void
get_color (double h, double s, double v, int *r, int *g, int *b)
get_color (gdouble h,
gdouble s,
gdouble v,
gint *r,
gint *g,
gint *b)
{
hsv_to_rgb (&h, &s, &v);
@ -940,22 +1004,27 @@ get_color (double h, double s, double v, int *r, int *g, int *b)
/* Paints the HSV triangle */
static void
paint_triangle (GtkHSV *hsv, GdkDrawable *drawable, int x, int y, int width, int height)
paint_triangle (GtkHSV *hsv,
GdkDrawable *drawable,
gint x,
gint y,
gint width,
gint height)
{
HSVPrivate *priv;
int hx, hy, sx, sy, vx, vy; /* HSV vertices */
int x1, y1, r1, g1, b1; /* First vertex in scanline order */
int x2, y2, r2, g2, b2; /* Second vertex */
int x3, y3, r3, g3, b3; /* Third vertex */
int t;
gint hx, hy, sx, sy, vx, vy; /* HSV vertices */
gint x1, y1, r1, g1, b1; /* First vertex in scanline order */
gint x2, y2, r2, g2, b2; /* Second vertex */
gint x3, y3, r3, g3, b3; /* Third vertex */
gint t;
guchar *buf, *p;
int xl, xr, rl, rr, gl, gr, bl, br; /* Scanline data */
int xx, yy;
gint xl, xr, rl, rr, gl, gr, bl, br; /* Scanline data */
gint xx, yy;
GdkBitmap *mask;
GdkGC *gc;
GdkColor color;
GdkPoint points[3];
double r, g, b;
gdouble r, g, b;
priv = hsv->priv;
@ -975,7 +1044,8 @@ paint_triangle (GtkHSV *hsv, GdkDrawable *drawable, int x, int y, int width, int
y3 = vy;
get_color (priv->h, 0.0, 1.0, &r3, &g3, &b3);
if (y2 > y3) {
if (y2 > y3)
{
SWAP (x2, x3, t);
SWAP (y2, y3, t);
SWAP (r2, r3, t);
@ -983,7 +1053,8 @@ paint_triangle (GtkHSV *hsv, GdkDrawable *drawable, int x, int y, int width, int
SWAP (b2, b3, t);
}
if (y1 > y3) {
if (y1 > y3)
{
SWAP (x1, x3, t);
SWAP (y1, y3, t);
SWAP (r1, r3, t);
@ -991,7 +1062,8 @@ paint_triangle (GtkHSV *hsv, GdkDrawable *drawable, int x, int y, int width, int
SWAP (b1, b3, t);
}
if (y1 > y2) {
if (y1 > y2)
{
SWAP (x1, x2, t);
SWAP (y1, y2, t);
SWAP (r1, r2, t);
@ -1003,23 +1075,28 @@ paint_triangle (GtkHSV *hsv, GdkDrawable *drawable, int x, int y, int width, int
buf = g_new (guchar, width * height * 3);
for (yy = 0; yy < height; yy++) {
for (yy = 0; yy < height; yy++)
{
p = buf + yy * width * 3;
if (yy + y < y1 || yy + y > y3)
for (xx = 0; xx < width; xx++) {
for (xx = 0; xx < width; xx++)
{
*p++ = 0;
*p++ = 0;
*p++ = 0;
}
else {
if (yy + y < y2) {
if (yy + y < y2)
{
xl = LERP (x1, x2, y1, y2, yy + y);
rl = LERP (r1, r2, y1, y2, yy + y);
gl = LERP (g1, g2, y1, y2, yy + y);
bl = LERP (b1, b2, y1, y2, yy + y);
} else {
}
else
{
xl = LERP (x2, x3, y2, y3, yy + y);
rl = LERP (r2, r3, y2, y3, yy + y);
@ -1033,19 +1110,24 @@ paint_triangle (GtkHSV *hsv, GdkDrawable *drawable, int x, int y, int width, int
gr = LERP (g1, g3, y1, y3, yy + y);
br = LERP (b1, b3, y1, y3, yy + y);
if (xl > xr) {
if (xl > xr)
{
SWAP (xl, xr, t);
SWAP (rl, rr, t);
SWAP (gl, gr, t);
SWAP (bl, br, t);
}
for (xx = 0; xx < width; xx++) {
if (xx + x < xl || xx + x > xr) {
for (xx = 0; xx < width; xx++)
{
if (xx + x < xl || xx + x > xr)
{
*p++ = 0;
*p++ = 0;
*p++ = 0;
} else {
}
else
{
*p++ = LERP (rl, rr, xl, xr, xx + x);
*p++ = LERP (gl, gr, xl, xr, xx + x);
*p++ = LERP (bl, br, xl, xr, xx + x);
@ -1126,7 +1208,12 @@ paint_triangle (GtkHSV *hsv, GdkDrawable *drawable, int x, int y, int width, int
/* Paints the contents of the HSV color selector */
static void
paint (GtkHSV *hsv, GdkDrawable *drawable, int x, int y, int width, int height)
paint (GtkHSV *hsv,
GdkDrawable *drawable,
gint x,
gint y,
gint width,
gint height)
{
paint_ring (hsv, drawable, x, y, width, height);
paint_triangle (hsv, drawable, x, y, width, height);
@ -1134,7 +1221,8 @@ paint (GtkHSV *hsv, GdkDrawable *drawable, int x, int y, int width, int height)
/* Expose_event handler for the HSV color selector */
static gint
gtk_hsv_expose (GtkWidget *widget, GdkEventExpose *event)
gtk_hsv_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkHSV *hsv;
HSVPrivate *priv;
@ -1183,7 +1271,6 @@ gtk_hsv_expose (GtkWidget *widget, GdkEventExpose *event)
return FALSE;
}
/**
* gtk_hsv_new:
@ -1193,10 +1280,10 @@ gtk_hsv_expose (GtkWidget *widget, GdkEventExpose *event)
*
* Return value: A newly-created HSV color selector.
**/
GtkWidget *
GtkWidget*
gtk_hsv_new (void)
{
return GTK_WIDGET (gtk_type_new (gtk_hsv_get_type ()));
return GTK_WIDGET (gtk_type_new (GTK_TYPE_HSV));
}
/**
@ -1210,7 +1297,10 @@ gtk_hsv_new (void)
* be in the [0.0, 1.0] range.
**/
void
gtk_hsv_set_color (GtkHSV *hsv, double h, double s, double v)
gtk_hsv_set_color (GtkHSV *hsv,
gdouble h,
gdouble s,
gdouble v)
{
HSVPrivate *priv;
@ -1270,7 +1360,9 @@ gtk_hsv_get_color (GtkHSV *hsv, double *h, double *s, double *v)
* Sets the size and ring width of an HSV color selector.
**/
void
gtk_hsv_set_metrics (GtkHSV *hsv, int size, int ring_width)
gtk_hsv_set_metrics (GtkHSV *hsv,
gint size,
gint ring_width)
{
HSVPrivate *priv;
int same_size;
@ -1303,7 +1395,9 @@ gtk_hsv_set_metrics (GtkHSV *hsv, int size, int ring_width)
* Queries the size and ring width of an HSV color selector.
**/
void
gtk_hsv_get_metrics (GtkHSV *hsv, int *size, int *ring_width)
gtk_hsv_get_metrics (GtkHSV *hsv,
gint *size,
gint *ring_width)
{
HSVPrivate *priv;
@ -1341,7 +1435,8 @@ gtk_hsv_is_adjusting (GtkHSV *hsv)
g_return_val_if_fail (GTK_IS_HSV (hsv), FALSE);
priv = hsv->priv;
return (priv->mode != DRAG_NONE);
return priv->mode != DRAG_NONE;
}
/**
@ -1357,7 +1452,12 @@ gtk_hsv_is_adjusting (GtkHSV *hsv)
* [0.0, 1.0] range; output values will be in the same range.
**/
void
gtk_hsv_to_rgb (double h, double s, double v, double *r, double *g, double *b)
gtk_hsv_to_rgb (gdouble h,
gdouble s,
gdouble v,
gdouble *r,
gdouble *g,
gdouble *b)
{
g_return_if_fail (h >= 0.0 && h <= 1.0);
g_return_if_fail (s >= 0.0 && s <= 1.0);
@ -1388,7 +1488,12 @@ gtk_hsv_to_rgb (double h, double s, double v, double *r, double *g, double *b)
* [0.0, 1.0] range; output values will be in the same range.
**/
void
gtk_rgb_to_hsv (double r, double g, double b, double *h, double *s, double *v)
gtk_rgb_to_hsv (gdouble r,
gdouble g,
gdouble b,
gdouble *h,
gdouble *s,
gdouble *v)
{
g_return_if_fail (r >= 0.0 && r <= 1.0);
g_return_if_fail (g >= 0.0 && g <= 1.0);

View File

@ -21,63 +21,86 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GTK_HSV_H__
#define __GTK_HSV_H__
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <gtk/gtkwidget.h>
#define GTK_TYPE_HSV (gtk_hsv_get_type ())
#define GTK_HSV(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_HSV, GtkHSV))
#define GTK_HSV_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_HSV, GtkHSV))
#define GTK_IS_HSV(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_HSV))
#define GTK_IS_HSV_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HSV))
#define GTK_HSV_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_HSV, GtkHSVClass))
typedef struct _GtkHSV GtkHSV;
typedef struct _GtkHSVClass GtkHSVClass;
struct _GtkHSV {
GtkWidget widget;
struct _GtkHSV
{
GtkWidget parent_instance;
/* Private data */
gpointer priv;
};
struct _GtkHSVClass {
struct _GtkHSVClass
{
GtkWidgetClass parent_class;
/* Notification signals */
void (* changed) (GtkHSV *hsv);
void (*changed) (GtkHSV *hsv);
};
GtkType gtk_hsv_get_type (void);
GtkWidget *gtk_hsv_new (void);
void gtk_hsv_set_color (GtkHSV *hsv, double h, double s, double v);
void gtk_hsv_get_color (GtkHSV *hsv, double *h, double *s, double *v);
void gtk_hsv_set_metrics (GtkHSV *hsv, int size, int ring_width);
void gtk_hsv_get_metrics (GtkHSV *hsv, int *size, int *ring_width);
GtkWidget* gtk_hsv_new (void);
void gtk_hsv_set_color (GtkHSV *hsv,
double h,
double s,
double v);
void gtk_hsv_get_color (GtkHSV *hsv,
gdouble *h,
gdouble *s,
gdouble *v);
void gtk_hsv_set_metrics (GtkHSV *hsv,
gint size,
gint ring_width);
void gtk_hsv_get_metrics (GtkHSV *hsv,
gint *size,
gint *ring_width);
gboolean gtk_hsv_is_adjusting (GtkHSV *hsv);
void gtk_hsv_to_rgb (gdouble h,
gdouble s,
gdouble v,
gdouble *r,
gdouble *g,
gdouble *b);
void gtk_rgb_to_hsv (gdouble r,
gdouble g,
gdouble b,
gdouble *h,
gdouble *s,
gdouble *v);
void gtk_hsv_to_rgb (double h, double s, double v, double *r, double *g, double *b);
void gtk_rgb_to_hsv (double r, double g, double b, double *h, double *s, double *v);
#ifdef __cplusplus
}
#endif
#endif
#endif /* __GTK_HSV_H__ */

View File

@ -81,7 +81,6 @@ static void gtk_input_dialog_class_init (GtkInputDialogClass *klass);
static void gtk_input_dialog_init (GtkInputDialog *inputd);
static GdkDeviceInfo *gtk_input_dialog_get_device_info(guint32 deviceid);
static void gtk_input_dialog_set_device(GtkWidget *widget, gpointer data);
static void gtk_input_dialog_finalize (GtkObject *object);
static void gtk_input_dialog_set_mapping_mode(GtkWidget *w,
gpointer data);
static void gtk_input_dialog_set_axis(GtkWidget *widget, gpointer data);
@ -155,7 +154,7 @@ gtk_input_dialog_class_init (GtkInputDialogClass *klass)
input_dialog_signals[ENABLE_DEVICE] =
gtk_signal_new ("enable_device",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkInputDialogClass, enable_device),
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1, GTK_TYPE_INT);
@ -163,7 +162,7 @@ gtk_input_dialog_class_init (GtkInputDialogClass *klass)
input_dialog_signals[DISABLE_DEVICE] =
gtk_signal_new ("disable_device",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkInputDialogClass, disable_device),
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1, GTK_TYPE_INT);
@ -172,7 +171,6 @@ gtk_input_dialog_class_init (GtkInputDialogClass *klass)
LAST_SIGNAL);
object_class->finalize = gtk_input_dialog_finalize;
klass->enable_device = NULL;
klass->disable_device = NULL;
}
@ -392,16 +390,6 @@ gtk_input_dialog_set_device(GtkWidget *widget, gpointer data)
info->mode);
}
static void
gtk_input_dialog_finalize (GtkObject *object)
{
/* GtkInputDialog *inputd = GTK_INPUT_DIALOG (object); */
/* Clean up ? */
(* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
}
static void
gtk_input_dialog_set_mapping_mode(GtkWidget *w,
gpointer data)

View File

@ -87,21 +87,21 @@ gtk_item_class_init (GtkItemClass *class)
item_signals[SELECT] =
gtk_signal_new ("select",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkItemClass, select),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
item_signals[DESELECT] =
gtk_signal_new ("deselect",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkItemClass, deselect),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
item_signals[TOGGLE] =
gtk_signal_new ("toggle",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkItemClass, toggle),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);

View File

@ -85,12 +85,12 @@ struct _GtkIFDumpData
static void gtk_item_factory_class_init (GtkItemFactoryClass *klass);
static void gtk_item_factory_init (GtkItemFactory *ifactory);
static void gtk_item_factory_destroy (GtkObject *object);
static void gtk_item_factory_finalize (GtkObject *object);
static void gtk_item_factory_finalize (GObject *object);
/* --- static variables --- */
static GtkItemFactoryClass *gtk_item_factory_class = NULL;
static GtkObjectClass *parent_class = NULL;
static gpointer parent_class = NULL;
static const gchar *item_factory_string = "Gtk-<ItemFactory>";
static GMemChunk *ifactory_item_chunks = NULL;
static GMemChunk *ifactory_cb_data_chunks = NULL;
@ -181,6 +181,7 @@ gtk_item_factory_get_type (void)
static void
gtk_item_factory_class_init (GtkItemFactoryClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkObjectClass *object_class;
gtk_item_factory_class = class;
@ -189,8 +190,9 @@ gtk_item_factory_class_init (GtkItemFactoryClass *class)
object_class = (GtkObjectClass*) class;
gobject_class->finalize = gtk_item_factory_finalize;
object_class->destroy = gtk_item_factory_destroy;
object_class->finalize = gtk_item_factory_finalize;
class->cpair_comment_single = g_strdup (";\n");
@ -511,7 +513,7 @@ gtk_item_factory_add_item (GtkItemFactory *ifactory,
g_return_if_fail (widget != NULL);
g_return_if_fail (item_type != NULL);
class = GTK_ITEM_FACTORY_CLASS (GTK_OBJECT (ifactory)->klass);
class = GTK_ITEM_FACTORY_GET_CLASS (ifactory);
/* set accelerator group on menu widgets
*/
@ -681,11 +683,11 @@ gtk_item_factory_destroy (GtkObject *object)
g_slist_free (ifactory->items);
ifactory->items = NULL;
parent_class->destroy (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gtk_item_factory_finalize (GtkObject *object)
gtk_item_factory_finalize (GObject *object)
{
GtkItemFactory *ifactory;
@ -701,7 +703,7 @@ gtk_item_factory_finalize (GtkObject *object)
if (ifactory->translate_notify)
ifactory->translate_notify (ifactory->translate_data);
parent_class->finalize (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
GtkItemFactory*
@ -859,7 +861,7 @@ gtk_item_factory_get_widget (GtkItemFactory *ifactory,
g_return_val_if_fail (GTK_IS_ITEM_FACTORY (ifactory), NULL);
g_return_val_if_fail (path != NULL, NULL);
class = GTK_ITEM_FACTORY_CLASS (GTK_OBJECT (ifactory)->klass);
class = GTK_ITEM_FACTORY_GET_CLASS (ifactory);
if (path[0] == '<')
item = g_hash_table_lookup (class->item_ht, (gpointer) path);
@ -1323,7 +1325,7 @@ gtk_item_factory_delete_item (GtkItemFactory *ifactory,
g_return_if_fail (GTK_IS_ITEM_FACTORY (ifactory));
g_return_if_fail (path != NULL);
class = GTK_ITEM_FACTORY_CLASS (GTK_OBJECT (ifactory)->klass);
class = GTK_ITEM_FACTORY_GET_CLASS (ifactory);
fpath = g_strconcat (ifactory->path, path, NULL);
item = g_hash_table_lookup (class->item_ht, fpath);

View File

@ -74,7 +74,7 @@ static void gtk_label_set_arg (GtkObject *object,
static void gtk_label_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_label_finalize (GtkObject *object);
static void gtk_label_finalize (GObject *object);
static void gtk_label_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_label_style_set (GtkWidget *widget,
@ -101,20 +101,20 @@ gtk_label_get_type (void)
if (!label_type)
{
static const GtkTypeInfo label_info =
static const GTypeInfo label_info =
{
"GtkLabel",
sizeof (GtkLabel),
sizeof (GtkLabelClass),
(GtkClassInitFunc) gtk_label_class_init,
(GtkObjectInitFunc) gtk_label_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_label_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GtkLabel),
32, /* n_preallocs */
(GInstanceInitFunc) gtk_label_init,
};
label_type = gtk_type_unique (GTK_TYPE_MISC, &label_info);
gtk_type_set_chunk_alloc (label_type, 32);
label_type = g_type_register_static (GTK_TYPE_MISC, "GtkLabel", &label_info);
}
return label_type;
@ -123,6 +123,7 @@ gtk_label_get_type (void)
static void
gtk_label_class_init (GtkLabelClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
@ -136,9 +137,10 @@ gtk_label_class_init (GtkLabelClass *class)
gtk_object_add_arg_type ("GtkLabel::justify", GTK_TYPE_JUSTIFICATION, GTK_ARG_READWRITE, ARG_JUSTIFY);
gtk_object_add_arg_type ("GtkLabel::wrap", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_WRAP);
gobject_class->finalize = gtk_label_finalize;
object_class->set_arg = gtk_label_set_arg;
object_class->get_arg = gtk_label_get_arg;
object_class->finalize = gtk_label_finalize;
widget_class->size_request = gtk_label_size_request;
widget_class->style_set = gtk_label_style_set;
@ -347,11 +349,10 @@ gtk_label_get_text (GtkLabel *label)
}
static void
gtk_label_finalize (GtkObject *object)
gtk_label_finalize (GObject *object)
{
GtkLabel *label;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_LABEL (object));
label = GTK_LABEL (object);
@ -362,7 +363,7 @@ gtk_label_finalize (GtkObject *object)
gtk_label_free_words (label);
GTK_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static GtkLabelULine*

View File

@ -45,7 +45,7 @@ struct _GtkLayoutChild {
static void gtk_layout_class_init (GtkLayoutClass *class);
static void gtk_layout_init (GtkLayout *layout);
static void gtk_layout_finalize (GtkObject *object);
static void gtk_layout_finalize (GObject *object);
static void gtk_layout_realize (GtkWidget *widget);
static void gtk_layout_unrealize (GtkWidget *widget);
static void gtk_layout_map (GtkWidget *widget);
@ -170,14 +170,14 @@ gtk_layout_set_adjustments (GtkLayout *layout,
}
static void
gtk_layout_finalize (GtkObject *object)
gtk_layout_finalize (GObject *object)
{
GtkLayout *layout = GTK_LAYOUT (object);
gtk_object_unref (GTK_OBJECT (layout->hadjustment));
gtk_object_unref (GTK_OBJECT (layout->vadjustment));
GTK_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
void
@ -320,18 +320,20 @@ gtk_layout_get_type (void)
if (!layout_type)
{
static const GtkTypeInfo layout_info =
static const GTypeInfo layout_info =
{
"GtkLayout",
sizeof (GtkLayout),
sizeof (GtkLayoutClass),
(GtkClassInitFunc) gtk_layout_class_init,
(GtkObjectInitFunc) gtk_layout_init,
(GtkArgSetFunc) NULL,
(GtkArgGetFunc) NULL,
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_layout_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GtkLayout),
16, /* n_preallocs */
(GInstanceInitFunc) gtk_layout_init,
};
layout_type = gtk_type_unique (GTK_TYPE_CONTAINER, &layout_info);
layout_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkLayout", &layout_info);
}
return layout_type;
@ -340,6 +342,7 @@ gtk_layout_get_type (void)
static void
gtk_layout_class_init (GtkLayoutClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
@ -350,7 +353,7 @@ gtk_layout_class_init (GtkLayoutClass *class)
parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
object_class->finalize = gtk_layout_finalize;
gobject_class->finalize = gtk_layout_finalize;
widget_class->realize = gtk_layout_realize;
widget_class->unrealize = gtk_layout_unrealize;
@ -368,7 +371,7 @@ gtk_layout_class_init (GtkLayoutClass *class)
widget_class->set_scroll_adjustments_signal =
gtk_signal_new ("set_scroll_adjustments",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkLayoutClass, set_scroll_adjustments),
gtk_marshal_NONE__POINTER_POINTER,
GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);

View File

@ -54,7 +54,7 @@ static void gtk_list_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
/** GtkObject Methods **/
static void gtk_list_shutdown (GtkObject *object);
static void gtk_list_shutdown (GObject *object);
/** GtkWidget Methods **/
static void gtk_list_size_request (GtkWidget *widget,
@ -200,6 +200,7 @@ gtk_list_get_type (void)
static void
gtk_list_class_init (GtkListClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
@ -213,17 +214,19 @@ gtk_list_class_init (GtkListClass *class)
vadjustment_key_id = g_quark_from_static_string (vadjustment_key);
hadjustment_key_id = g_quark_from_static_string (hadjustment_key);
gobject_class->shutdown = gtk_list_shutdown;
list_signals[SELECTION_CHANGED] =
gtk_signal_new ("selection_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkListClass, selection_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
list_signals[SELECT_CHILD] =
gtk_signal_new ("select_child",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkListClass, select_child),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
@ -231,7 +234,7 @@ gtk_list_class_init (GtkListClass *class)
list_signals[UNSELECT_CHILD] =
gtk_signal_new ("unselect_child",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkListClass, unselect_child),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
@ -239,7 +242,6 @@ gtk_list_class_init (GtkListClass *class)
gtk_object_class_add_signals (object_class, list_signals, LAST_SIGNAL);
object_class->shutdown = gtk_list_shutdown;
object_class->set_arg = gtk_list_set_arg;
object_class->get_arg = gtk_list_get_arg;
@ -341,10 +343,11 @@ gtk_list_new (void)
* gtk_list_shutdown
*/
static void
gtk_list_shutdown (GtkObject *object)
gtk_list_shutdown (GObject *object)
{
gtk_list_clear_items (GTK_LIST (object), 0, -1);
GTK_OBJECT_CLASS (parent_class)->shutdown (object);
G_OBJECT_CLASS (parent_class)->shutdown (object);
}

View File

@ -118,56 +118,56 @@ gtk_list_item_class_init (GtkListItemClass *class)
list_item_signals[TOGGLE_FOCUS_ROW] =
gtk_signal_new ("toggle_focus_row",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkListItemClass, toggle_focus_row),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
list_item_signals[SELECT_ALL] =
gtk_signal_new ("select_all",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkListItemClass, select_all),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
list_item_signals[UNSELECT_ALL] =
gtk_signal_new ("unselect_all",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkListItemClass, unselect_all),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
list_item_signals[UNDO_SELECTION] =
gtk_signal_new ("undo_selection",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkListItemClass, undo_selection),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
list_item_signals[START_SELECTION] =
gtk_signal_new ("start_selection",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkListItemClass, start_selection),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
list_item_signals[END_SELECTION] =
gtk_signal_new ("end_selection",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkListItemClass, end_selection),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
list_item_signals[TOGGLE_ADD_MODE] =
gtk_signal_new ("toggle_add_mode",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkListItemClass, toggle_add_mode),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
list_item_signals[EXTEND_SELECTION] =
gtk_signal_new ("extend_selection",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkListItemClass, extend_selection),
gtk_marshal_NONE__ENUM_FLOAT_BOOL,
GTK_TYPE_NONE, 3,
@ -175,14 +175,14 @@ gtk_list_item_class_init (GtkListItemClass *class)
list_item_signals[SCROLL_VERTICAL] =
gtk_signal_new ("scroll_vertical",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkListItemClass, scroll_vertical),
gtk_marshal_NONE__ENUM_FLOAT,
GTK_TYPE_NONE, 2, GTK_TYPE_ENUM, GTK_TYPE_FLOAT);
list_item_signals[SCROLL_HORIZONTAL] =
gtk_signal_new ("scroll_horizontal",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkListItemClass, scroll_horizontal),
gtk_marshal_NONE__ENUM_FLOAT,
GTK_TYPE_NONE, 2, GTK_TYPE_ENUM, GTK_TYPE_FLOAT);

View File

@ -197,7 +197,6 @@ gboolean
gtk_init_check (int *argc,
char ***argv)
{
extern void gtk_object_post_arg_parsing_init (void);
GSList *gtk_modules = NULL;
GSList *slist;
gchar *env_string = NULL;
@ -422,7 +421,6 @@ gtk_init_check (int *argc,
gtk_colormap = gdk_colormap_get_system ();
gtk_type_init ();
gtk_object_post_arg_parsing_init ();
gtk_signal_init ();
gtk_rc_init ();

View File

@ -9,8 +9,6 @@ INT:POINTER
INT:POINTER,CHAR,CHAR
NONE:BOOL
NONE:BOXED
NONE:C_CALLBACK
NONE:C_CALLBACK,C_CALLBACK
NONE:ENUM
NONE:ENUM,FLOAT
NONE:ENUM,FLOAT,BOOL

View File

@ -9,8 +9,6 @@ INT:POINTER
INT:POINTER,CHAR,CHAR
NONE:BOOL
NONE:BOXED
NONE:C_CALLBACK
NONE:C_CALLBACK,C_CALLBACK
NONE:ENUM
NONE:ENUM,FLOAT
NONE:ENUM,FLOAT,BOOL

View File

@ -35,7 +35,7 @@
#include "gtkwindow.h"
#define MENU_ITEM_CLASS(w) GTK_MENU_ITEM_CLASS (GTK_OBJECT (w)->klass)
#define MENU_ITEM_CLASS(w) GTK_MENU_ITEM_GET_CLASS (w)
#define MENU_NEEDS_RESIZE(m) GTK_MENU_SHELL (m)->menu_flag
typedef struct _GtkMenuAttachData GtkMenuAttachData;
@ -192,20 +192,20 @@ gtk_menu_init (GtkMenu *menu)
menu->position_func = NULL;
menu->position_func_data = NULL;
menu->toplevel = gtk_window_new (GTK_WINDOW_POPUP);
gtk_signal_connect (GTK_OBJECT (menu->toplevel),
"event",
GTK_SIGNAL_FUNC (gtk_menu_window_event),
GTK_OBJECT (menu));
menu->toplevel = gtk_widget_new (GTK_TYPE_WINDOW,
"type", GTK_WINDOW_POPUP,
"signal::event", gtk_menu_window_event, menu,
"signal::destroy", gtk_widget_destroyed, &menu->toplevel,
"child", menu,
NULL);
gtk_window_set_policy (GTK_WINDOW (menu->toplevel),
FALSE, FALSE, TRUE);
gtk_container_add (GTK_CONTAINER (menu->toplevel), GTK_WIDGET (menu));
/* Refloat the menu, so that reference counting for the menu isn't
* affected by it being a child of the toplevel
*/
GTK_WIDGET_SET_FLAGS (menu, GTK_FLOATING);
menu->needs_destruction_ref_count = TRUE;
menu->tearoff_window = NULL;
menu->torn_off = FALSE;
@ -219,13 +219,10 @@ gtk_menu_destroy (GtkObject *object)
GtkMenu *menu;
GtkMenuAttachData *data;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_MENU (object));
menu = GTK_MENU (object);
gtk_object_ref (object);
data = gtk_object_get_data (object, attach_data_key);
if (data)
gtk_menu_detach (menu);
@ -239,16 +236,18 @@ gtk_menu_destroy (GtkObject *object)
}
/* Add back the reference count for being a child */
if (menu->needs_destruction_ref_count)
{
menu->needs_destruction_ref_count = FALSE;
gtk_object_ref (object);
}
if (menu->toplevel)
gtk_widget_destroy (menu->toplevel);
if (menu->tearoff_window)
gtk_widget_destroy (menu->tearoff_window);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
gtk_object_unref (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
@ -708,7 +707,10 @@ gtk_menu_set_tearoff_state (GtkMenu *menu,
GtkWidget *attach_widget;
gchar *title;
menu->tearoff_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
menu->tearoff_window = gtk_widget_new (GTK_TYPE_WINDOW,
"type", GTK_WINDOW_TOPLEVEL,
"signal::destroy", gtk_widget_destroyed, &menu->tearoff_window,
NULL);
gtk_widget_set_app_paintable (menu->tearoff_window, TRUE);
gtk_signal_connect (GTK_OBJECT (menu->tearoff_window),
"event",

View File

@ -74,6 +74,7 @@ struct _GtkMenu
GtkWidget *toplevel;
GtkWidget *tearoff_window;
guint needs_destruction_ref_count : 1;
guint torn_off : 1;
};

View File

@ -88,20 +88,20 @@ gtk_menu_item_get_type (void)
if (!menu_item_type)
{
static const GtkTypeInfo menu_item_info =
static const GTypeInfo menu_item_info =
{
"GtkMenuItem",
sizeof (GtkMenuItem),
sizeof (GtkMenuItemClass),
(GtkClassInitFunc) gtk_menu_item_class_init,
(GtkObjectInitFunc) gtk_menu_item_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_menu_item_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GtkMenuItem),
16, /* n_preallocs */
(GInstanceInitFunc) gtk_menu_item_init,
};
menu_item_type = gtk_type_unique (gtk_item_get_type (), &menu_item_info);
gtk_type_set_chunk_alloc (menu_item_type, 16);
menu_item_type = g_type_register_static (GTK_TYPE_ITEM, "GtkMenuItem", &menu_item_info);
}
return menu_item_type;
@ -125,7 +125,7 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
menu_item_signals[ACTIVATE] =
gtk_signal_new ("activate",
GTK_RUN_FIRST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkMenuItemClass, activate),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
@ -133,7 +133,7 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
menu_item_signals[ACTIVATE_ITEM] =
gtk_signal_new ("activate_item",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkMenuItemClass, activate_item),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);

View File

@ -34,7 +34,6 @@
#define MENU_SHELL_TIMEOUT 500
#define MENU_SHELL_CLASS(w) GTK_MENU_SHELL_CLASS (GTK_OBJECT (w)->klass)
enum {
@ -191,21 +190,21 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
menu_shell_signals[DEACTIVATE] =
gtk_signal_new ("deactivate",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkMenuShellClass, deactivate),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
menu_shell_signals[SELECTION_DONE] =
gtk_signal_new ("selection-done",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkMenuShellClass, selection_done),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
menu_shell_signals[MOVE_CURRENT] =
gtk_signal_new ("move_current",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkMenuShellClass, move_current),
gtk_marshal_NONE__ENUM,
GTK_TYPE_NONE, 1,
@ -213,7 +212,7 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
menu_shell_signals[ACTIVATE_CURRENT] =
gtk_signal_new ("activate_current",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkMenuShellClass, activate_current),
gtk_marshal_NONE__BOOL,
GTK_TYPE_NONE, 1,
@ -221,7 +220,7 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
menu_shell_signals[CANCEL] =
gtk_signal_new ("cancel",
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkMenuShellClass, cancel),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
@ -786,7 +785,7 @@ gtk_menu_shell_select_item (GtkMenuShell *menu_shell,
menu_shell->active_menu_item = menu_item;
gtk_menu_item_set_placement (GTK_MENU_ITEM (menu_shell->active_menu_item),
MENU_SHELL_CLASS (menu_shell)->submenu_placement);
GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement);
gtk_menu_item_select (GTK_MENU_ITEM (menu_shell->active_menu_item));
/* This allows the bizarre radio buttons-with-submenus-display-history
@ -822,7 +821,7 @@ gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
if (!deactivate)
deactivate = GTK_MENU_ITEM_CLASS (GTK_OBJECT (menu_item)->klass)->hide_on_activate;
deactivate = GTK_MENU_ITEM_GET_CLASS (menu_item)->hide_on_activate;
gtk_widget_ref (GTK_WIDGET (menu_shell));
@ -936,8 +935,8 @@ gtk_real_menu_shell_move_current (GtkMenuShell *menu_shell,
case GTK_MENU_DIR_PARENT:
if (parent_menu_shell)
{
if (GTK_MENU_SHELL_CLASS (GTK_OBJECT (parent_menu_shell)->klass)->submenu_placement ==
GTK_MENU_SHELL_CLASS (GTK_OBJECT (menu_shell)->klass)->submenu_placement)
if (GTK_MENU_SHELL_GET_CLASS (parent_menu_shell)->submenu_placement ==
GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement)
gtk_menu_shell_deselect (menu_shell);
else
{
@ -960,8 +959,8 @@ gtk_real_menu_shell_move_current (GtkMenuShell *menu_shell,
{
/* Try to find a menu running the opposite direction */
while (parent_menu_shell &&
(GTK_MENU_SHELL_CLASS (GTK_OBJECT (parent_menu_shell)->klass)->submenu_placement ==
GTK_MENU_SHELL_CLASS (GTK_OBJECT (menu_shell)->klass)->submenu_placement))
(GTK_MENU_SHELL_GET_CLASS (parent_menu_shell)->submenu_placement ==
GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement))
parent_menu_shell = GTK_MENU_SHELL (parent_menu_shell->parent_menu_shell);
if (parent_menu_shell)

View File

@ -271,7 +271,7 @@ gtk_notebook_class_init (GtkNotebookClass *class)
notebook_signals[SWITCH_PAGE] =
gtk_signal_new ("switch_page",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkNotebookClass, switch_page),
gtk_marshal_NONE__POINTER_UINT,
GTK_TYPE_NONE, 2,

View File

@ -45,8 +45,9 @@ enum {
};
void gtk_object_init_type (void);
static void gtk_object_base_class_init (GtkObjectClass *klass);
extern void gtk_object_init_type (void); /* for gtktypeutils.h */
static void gtk_object_base_class_init (GtkObjectClass *class);
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);
@ -56,84 +57,48 @@ static void gtk_object_set_arg (GtkObject *object,
static void gtk_object_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_object_shutdown (GtkObject *object);
static void gtk_object_shutdown (GObject *object);
static void gtk_object_real_destroy (GtkObject *object);
static void gtk_object_finalize (GtkObject *object);
static void gtk_object_finalize (GObject *object);
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;
#ifdef G_ENABLE_DEBUG
static guint obj_count = 0;
static GHashTable *living_objs_ht = NULL;
static void
gtk_object_debug_foreach (gpointer key, gpointer value, gpointer user_data)
{
GtkObject *object;
object = (GtkObject*) value;
g_message ("[%p] %s\tref_count=%d%s%s",
object,
gtk_type_name (GTK_OBJECT_TYPE (object)),
object->ref_count,
GTK_OBJECT_FLOATING (object) ? " (floating)" : "",
GTK_OBJECT_DESTROYED (object) ? " (destroyed)" : "");
}
static void
gtk_object_debug (void)
{
if (living_objs_ht)
g_hash_table_foreach (living_objs_ht, gtk_object_debug_foreach, NULL);
g_message ("living objects count = %d", obj_count);
}
#endif /* G_ENABLE_DEBUG */
void
gtk_object_post_arg_parsing_init (void)
{
#ifdef G_ENABLE_DEBUG
if (gtk_debug_flags & GTK_DEBUG_OBJECTS)
g_atexit (gtk_object_debug);
#endif /* G_ENABLE_DEBUG */
}
/****************************************************
* GtkObject type, class and instance initialization
*
****************************************************/
void
gtk_object_init_type (void)
{
static const GtkTypeInfo object_info =
{
"GtkObject",
sizeof (GtkObject),
sizeof (GtkObjectClass),
(GtkClassInitFunc) gtk_object_class_init,
(GtkObjectInitFunc) gtk_object_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) gtk_object_base_class_init,
};
GtkType object_type;
object_type = gtk_type_unique (0, &object_info);
g_assert (object_type == GTK_TYPE_OBJECT);
}
GtkType
gtk_object_get_type (void)
{
return GTK_TYPE_OBJECT;
static GtkType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GtkObjectClass),
(GBaseInitFunc) gtk_object_base_class_init,
(GBaseFinalizeFunc) gtk_object_base_class_finalize,
(GClassInitFunc) gtk_object_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GtkObject),
16, /* n_preallocs */
(GInstanceInitFunc) gtk_object_init,
};
object_type = g_type_register_static (G_TYPE_OBJECT, "GtkObject", &object_info);
}
return object_type;
}
static void
@ -150,9 +115,27 @@ gtk_object_base_class_init (GtkObjectClass *class)
class->set_arg = NULL;
}
static void
gtk_object_base_class_finalize (GtkObjectClass *class)
{
g_free (class->signals);
g_return_if_fail (class->construct_args == NULL);
}
static void
gtk_object_class_init (GtkObjectClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
parent_class = g_type_class_ref (G_TYPE_OBJECT);
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",
@ -179,18 +162,12 @@ gtk_object_class_init (GtkObjectClass *class)
object_signals[DESTROY] =
gtk_signal_new ("destroy",
GTK_RUN_LAST | GTK_RUN_NO_HOOKS,
class->type,
GTK_CLASS_TYPE (class),
GTK_SIGNAL_OFFSET (GtkObjectClass, destroy),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (class, object_signals, LAST_SIGNAL);
class->get_arg = gtk_object_get_arg;
class->set_arg = gtk_object_set_arg;
class->shutdown = gtk_object_shutdown;
class->destroy = gtk_object_real_destroy;
class->finalize = gtk_object_finalize;
}
static void
@ -203,26 +180,11 @@ gtk_object_init (GtkObject *object,
do
{
needs_construction |= klass->construct_args != NULL;
klass = gtk_type_parent_class (klass->type);
klass = g_type_class_peek_parent (klass);
}
while (klass && !needs_construction);
if (!needs_construction)
GTK_OBJECT_FLAGS (object) |= GTK_CONSTRUCTED;
object->ref_count = 1;
g_datalist_init (&object->object_data);
#ifdef G_ENABLE_DEBUG
if (gtk_debug_flags & GTK_DEBUG_OBJECTS)
{
obj_count++;
if (!living_objs_ht)
living_objs_ht = g_hash_table_new (g_direct_hash, NULL);
g_hash_table_insert (living_objs_ht, object, object);
}
#endif /* G_ENABLE_DEBUG */
}
/********************************************
@ -238,21 +200,26 @@ gtk_object_destroy (GtkObject *object)
if (!GTK_OBJECT_DESTROYED (object))
{
/* we will hold a reference on the object in this place, so
* to ease all classes shutdown and destroy implementations.
* i.e. they don't have to bother about referencing at all.
/* need to hold a reference count around all class method
* invocations. we guard against reinvocations during
* destruction with the GTK_DESTROYED flag.
*/
gtk_object_ref (object);
object->klass->shutdown (object);
GTK_OBJECT_SET_FLAGS (object, GTK_DESTROYED);
G_OBJECT_GET_CLASS (object)->shutdown (G_OBJECT (object));
GTK_OBJECT_UNSET_FLAGS (object, GTK_DESTROYED);
gtk_object_unref (object);
}
}
static void
gtk_object_shutdown (GtkObject *object)
gtk_object_shutdown (GObject *gobject)
{
GTK_OBJECT_SET_FLAGS (object, GTK_DESTROYED);
GtkObject *object = GTK_OBJECT (gobject);
gtk_signal_emit (object, object_signals[DESTROY]);
G_OBJECT_CLASS (parent_class)->shutdown (gobject);
}
static void
@ -263,13 +230,13 @@ gtk_object_real_destroy (GtkObject *object)
}
static void
gtk_object_finalize (GtkObject *object)
gtk_object_finalize (GObject *gobject)
{
GtkObject *object = GTK_OBJECT (gobject);
gtk_object_notify_weaks (object);
g_datalist_clear (&object->object_data);
gtk_type_free (GTK_OBJECT_TYPE (object), object);
G_OBJECT_CLASS (parent_class)->finalize (gobject);
}
/*****************************************
@ -396,7 +363,7 @@ gtk_object_class_user_signal_new (GtkObjectClass *class,
signal_id = gtk_signal_newv (name,
signal_flags,
class->type,
GTK_CLASS_TYPE (class),
0,
marshaller,
return_val,
@ -429,7 +396,7 @@ gtk_object_class_user_signal_newv (GtkObjectClass *class,
signal_id = gtk_signal_newv (name,
signal_flags,
class->type,
GTK_CLASS_TYPE (class),
0,
marshaller,
return_val,
@ -576,7 +543,7 @@ gtk_object_new (GtkType object_type,
GSList *info_list = NULL;
gchar *error;
g_return_val_if_fail (GTK_FUNDAMENTAL_TYPE (object_type) == GTK_TYPE_OBJECT, NULL);
g_return_val_if_fail (GTK_TYPE_IS_OBJECT (object_type), NULL);
object = gtk_type_new (object_type);
@ -623,7 +590,7 @@ gtk_object_newv (GtkType object_type,
GtkObject *object;
GtkArg *max_args;
g_return_val_if_fail (GTK_FUNDAMENTAL_TYPE (object_type) == GTK_TYPE_OBJECT, NULL);
g_return_val_if_fail (GTK_TYPE_IS_OBJECT (object_type), NULL);
if (n_args)
g_return_val_if_fail (args != NULL, NULL);
@ -872,7 +839,7 @@ gtk_object_default_construct (GtkObject *object)
if (!GTK_OBJECT_CONSTRUCTED (object))
{
for (slist = object->klass->construct_args;
for (slist = GTK_OBJECT_GET_CLASS (object)->construct_args;
slist && !GTK_OBJECT_CONSTRUCTED (object);
slist = slist->next)
{
@ -888,7 +855,7 @@ gtk_object_default_construct (GtkObject *object)
/* default application */
arg.type = info->type;
arg.name = info->name;
switch (gtk_type_get_varargs_type (arg.type))
switch (G_TYPE_FUNDAMENTAL (arg.type))
{
case GTK_TYPE_FLOAT:
GTK_VALUE_FLOAT (arg) = 0.0;
@ -899,7 +866,7 @@ gtk_object_default_construct (GtkObject *object)
case GTK_TYPE_BOXED:
case GTK_TYPE_STRING:
case GTK_TYPE_POINTER:
case GTK_TYPE_OBJECT:
case G_TYPE_OBJECT:
GTK_VALUE_POINTER (arg) = NULL;
break;
default:
@ -1004,7 +971,7 @@ gtk_object_query_args (GtkType class_type,
{
g_return_val_if_fail (n_args != NULL, NULL);
*n_args = 0;
g_return_val_if_fail (GTK_FUNDAMENTAL_TYPE (class_type) == GTK_TYPE_OBJECT, NULL);
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);
}
@ -1019,10 +986,9 @@ gtk_object_set_data_by_id (GtkObject *object,
GQuark data_id,
gpointer data)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
g_datalist_id_set_data (&object->object_data, data_id, data);
g_datalist_id_set_data (&G_OBJECT (object)->qdata, data_id, data);
}
void
@ -1030,11 +996,10 @@ gtk_object_set_data (GtkObject *object,
const gchar *key,
gpointer data)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
g_return_if_fail (key != NULL);
g_datalist_set_data (&object->object_data, key, data);
g_datalist_set_data (&G_OBJECT (object)->qdata, key, data);
}
void
@ -1043,10 +1008,9 @@ gtk_object_set_data_by_id_full (GtkObject *object,
gpointer data,
GtkDestroyNotify destroy)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
g_datalist_id_set_data_full (&object->object_data, data_id, data, destroy);
g_datalist_id_set_data_full (&G_OBJECT (object)->qdata, data_id, data, destroy);
}
void
@ -1055,186 +1019,101 @@ gtk_object_set_data_full (GtkObject *object,
gpointer data,
GtkDestroyNotify destroy)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
g_return_if_fail (key != NULL);
g_datalist_set_data_full (&object->object_data, key, data, destroy);
g_datalist_set_data_full (&G_OBJECT (object)->qdata, key, data, destroy);
}
gpointer
gtk_object_get_data_by_id (GtkObject *object,
GQuark data_id)
{
g_return_val_if_fail (object != NULL, NULL);
g_return_val_if_fail (GTK_IS_OBJECT (object), NULL);
return g_datalist_id_get_data (&object->object_data, data_id);
return g_datalist_id_get_data (&G_OBJECT (object)->qdata, data_id);
}
gpointer
gtk_object_get_data (GtkObject *object,
const gchar *key)
{
g_return_val_if_fail (object != NULL, NULL);
g_return_val_if_fail (GTK_IS_OBJECT (object), NULL);
g_return_val_if_fail (key != NULL, NULL);
return g_datalist_get_data (&object->object_data, key);
return g_datalist_get_data (&G_OBJECT (object)->qdata, key);
}
void
gtk_object_remove_data_by_id (GtkObject *object,
GQuark data_id)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
g_datalist_id_remove_data (&object->object_data, data_id);
g_datalist_id_remove_data (&G_OBJECT (object)->qdata, data_id);
}
void
gtk_object_remove_data (GtkObject *object,
const gchar *key)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
g_return_if_fail (key != NULL);
g_datalist_remove_data (&object->object_data, key);
g_datalist_remove_data (&G_OBJECT (object)->qdata, key);
}
void
gtk_object_remove_no_notify_by_id (GtkObject *object,
GQuark key_id)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
g_datalist_id_remove_no_notify (&object->object_data, key_id);
g_datalist_id_remove_no_notify (&G_OBJECT (object)->qdata, key_id);
}
void
gtk_object_remove_no_notify (GtkObject *object,
const gchar *key)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
g_return_if_fail (key != NULL);
g_datalist_remove_no_notify (&object->object_data, key);
g_datalist_remove_no_notify (&G_OBJECT (object)->qdata, key);
}
void
gtk_object_set_user_data (GtkObject *object,
gpointer data)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
if (!quark_user_data)
quark_user_data = g_quark_from_static_string ("user_data");
g_datalist_id_set_data (&object->object_data, quark_user_data, data);
g_datalist_id_set_data (&G_OBJECT (object)->qdata, quark_user_data, data);
}
gpointer
gtk_object_get_user_data (GtkObject *object)
{
g_return_val_if_fail (object != NULL, NULL);
g_return_val_if_fail (GTK_IS_OBJECT (object), NULL);
return g_datalist_id_get_data (&object->object_data, quark_user_data);
return g_datalist_id_get_data (&G_OBJECT (object)->qdata, quark_user_data);
}
/*******************************************
* GtkObject referencing and unreferencing
*
*******************************************/
#undef gtk_object_ref
#undef gtk_object_unref
void
GtkObject*
gtk_object_ref (GtkObject *object)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
g_return_if_fail (object->ref_count > 0);
g_return_val_if_fail (GTK_IS_OBJECT (object), NULL);
object->ref_count += 1;
return (GtkObject*) g_object_ref ((GObject*) object);
}
void
gtk_object_unref (GtkObject *object)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
g_return_if_fail (object->ref_count > 0);
if (object->ref_count == 1)
{
gtk_object_destroy (object);
g_return_if_fail (object->ref_count > 0);
}
object->ref_count -= 1;
if (object->ref_count == 0)
{
#ifdef G_ENABLE_DEBUG
if (gtk_debug_flags & GTK_DEBUG_OBJECTS)
{
g_assert (g_hash_table_lookup (living_objs_ht, object) == object);
g_hash_table_remove (living_objs_ht, object);
obj_count--;
}
#endif /* G_ENABLE_DEBUG */
object->klass->finalize (object);
}
}
static GtkObject *gtk_trace_object = NULL;
void
gtk_trace_referencing (GtkObject *object,
const gchar *func,
guint dummy,
guint line,
gboolean do_ref)
{
if (gtk_debug_flags & GTK_DEBUG_OBJECTS)
{
gboolean exists = TRUE;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
#ifdef G_ENABLE_DEBUG
exists = g_hash_table_lookup (living_objs_ht, object) != NULL;
#endif /* G_ENABLE_DEBUG */
if (exists &&
(object == gtk_trace_object ||
gtk_trace_object == (void*)42))
fprintf (stdout, "trace: object_%s: (%s:%p)->ref_count=%d %s (%s:%d)\n",
do_ref ? "ref" : "unref",
gtk_type_name (GTK_OBJECT_TYPE (object)),
object,
object->ref_count,
do_ref ? "+ 1" : "- 1",
func,
line);
else if (!exists)
fprintf (stdout, "trace: object_%s(%p): no such object! (%s:%d)\n",
do_ref ? "ref" : "unref",
object,
func,
line);
}
if (do_ref)
gtk_object_ref (object);
else
gtk_object_unref (object);
g_object_unref ((GObject*) object);
}

View File

@ -39,38 +39,21 @@ extern "C" {
#endif /* __cplusplus */
/* Macro for casting a pointer to a GtkObject or GtkObjectClass pointer.
* The second portion of the ?: statments are just in place to offer
* descriptive warning message.
/* macros for casting a pointer to a GtkObject or GtkObjectClass pointer,
* and to test whether `object' and `klass' are of type GTK_TYPE_OBJECT.
* these are the standard macros for all GtkObject-derived classes.
*/
#define GTK_OBJECT(object) ( \
GTK_IS_OBJECT (object) ? \
(GtkObject*) (object) : \
(GtkObject*) gtk_type_check_object_cast ((GtkTypeObject*) (object), GTK_TYPE_OBJECT) \
)
#define GTK_OBJECT_CLASS(klass) ( \
GTK_IS_OBJECT_CLASS (klass) ? \
(GtkObjectClass*) (klass) : \
(GtkObjectClass*) gtk_type_check_class_cast ((GtkTypeClass*) (klass), GTK_TYPE_OBJECT) \
)
/* Macro for testing whether `object' and `klass' are of type GTK_TYPE_OBJECT.
*/
#define GTK_IS_OBJECT(object) ( \
(object) != NULL && \
GTK_IS_OBJECT_CLASS (((GtkObject*) (object))->klass) \
)
#define GTK_IS_OBJECT_CLASS(klass) ( \
(klass) != NULL && \
GTK_FUNDAMENTAL_TYPE (((GtkObjectClass*) (klass))->type) == GTK_TYPE_OBJECT \
)
#define GTK_TYPE_OBJECT (gtk_object_get_type ())
#define GTK_OBJECT(object) (GTK_CHECK_CAST ((object), GTK_TYPE_OBJECT, GtkObject))
#define GTK_OBJECT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_OBJECT, GtkObjectClass))
#define GTK_IS_OBJECT(object) (GTK_CHECK_TYPE ((object), GTK_TYPE_OBJECT))
#define GTK_IS_OBJECT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_OBJECT))
#define GTK_OBJECT_GET_CLASS(object) (GTK_CHECK_GET_CLASS ((object), GTK_TYPE_OBJECT, GtkObjectClass))
/* Macros for extracting various fields from GtkObject and GtkObjectClass.
*/
#define GTK_OBJECT_TYPE(obj) (GTK_OBJECT (obj)->klass->type)
#define GTK_OBJECT_SIGNALS(obj) (GTK_OBJECT (obj)->klass->signals)
#define GTK_OBJECT_NSIGNALS(obj) (GTK_OBJECT (obj)->klass->nsignals)
#define GTK_OBJECT_TYPE(object) (G_TYPE_FROM_INSTANCE (object))
#define GTK_OBJECT_TYPE_NAME(object) (g_type_name (GTK_OBJECT_TYPE (object)))
/* GtkObject only uses the first 4 bits of the flags field.
* Derived objects may use the remaining bits. Though this
@ -124,9 +107,7 @@ typedef struct _GtkObjectClass GtkObjectClass;
*/
struct _GtkObject
{
/* GtkTypeObject related fields: */
GtkObjectClass *klass;
GObject parent_instance;
/* 32 bits of flags. GtkObject only uses 4 of these bits and
* GtkWidget uses the rest. This is done because structs are
@ -134,16 +115,6 @@ struct _GtkObject
* used in GtkWidget much space would be wasted.
*/
guint32 flags;
/* reference count.
* refer to the file docs/refcounting.txt on this issue.
*/
guint ref_count;
/* A list of keyed data pointers, used for e.g. the list of signal
* handlers or an object's user_data.
*/
GData *object_data;
};
/* The GtkObjectClass is the base of the Gtk+ objects classes hierarchy,
@ -155,9 +126,7 @@ struct _GtkObject
*/
struct _GtkObjectClass
{
/* GtkTypeClass fields: */
GtkType type;
GObjectClass parent_class;
/* The signals this object class handles. "signals" is an
* array of signal ID's.
@ -181,7 +150,7 @@ struct _GtkObjectClass
GtkArg *arg,
guint arg_id);
/* The functions that will end an objects life time. In one way ore
/* The function that will end an objects life time. In one way ore
* another all three of them are defined for all objects. If an
* object class overrides one of the methods in order to perform class
* specific destruction then it must still invoke its superclass'
@ -189,10 +158,7 @@ struct _GtkObjectClass
* own cleanup. (See the destroy function for GtkWidget for
* an example of how to do this).
*/
void (* shutdown) (GtkObject *object);
void (* destroy) (GtkObject *object);
void (* finalize) (GtkObject *object);
};
@ -222,11 +188,11 @@ GtkObject* gtk_object_new (GtkType type,
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_ref (GtkObject *object);
void gtk_object_unref (GtkObject *object);
void gtk_object_weakref (GtkObject *object,
GtkDestroyNotify notify,
gpointer data);
@ -358,16 +324,6 @@ gchar* gtk_object_args_collect (GtkType object_type,
gchar* gtk_object_arg_get_info (GtkType object_type,
const gchar *arg_name,
GtkArgInfo **info_p);
void gtk_trace_referencing (GtkObject *object,
const gchar *func,
guint dummy,
guint line,
gboolean do_ref);
#if G_ENABLE_DEBUG
# define gtk_object_ref(o) G_STMT_START{gtk_trace_referencing((o),G_GNUC_PRETTY_FUNCTION,0,__LINE__,1);}G_STMT_END
# define gtk_object_unref(o) G_STMT_START{gtk_trace_referencing((o),G_GNUC_PRETTY_FUNCTION,0,__LINE__,0);}G_STMT_END
#endif /* G_ENABLE_DEBUG */

View File

@ -35,7 +35,7 @@ static void gtk_pixmap_class_init (GtkPixmapClass *klass);
static void gtk_pixmap_init (GtkPixmap *pixmap);
static gint gtk_pixmap_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_pixmap_finalize (GtkObject *object);
static void gtk_pixmap_finalize (GObject *object);
static void build_insensitive_pixmap (GtkPixmap *gtkpixmap);
static GtkWidgetClass *parent_class;
@ -68,6 +68,7 @@ gtk_pixmap_get_type (void)
static void
gtk_pixmap_class_init (GtkPixmapClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
@ -75,7 +76,8 @@ gtk_pixmap_class_init (GtkPixmapClass *class)
widget_class = (GtkWidgetClass*) class;
parent_class = gtk_type_class (gtk_widget_get_type ());
object_class->finalize = gtk_pixmap_finalize;
gobject_class->finalize = gtk_pixmap_finalize;
widget_class->expose_event = gtk_pixmap_expose;
}
@ -105,10 +107,11 @@ gtk_pixmap_new (GdkPixmap *val,
}
static void
gtk_pixmap_finalize (GtkObject *object)
gtk_pixmap_finalize (GObject *object)
{
gtk_pixmap_set (GTK_PIXMAP (object), NULL, NULL);
(* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
void

View File

@ -64,18 +64,20 @@ gtk_plug_get_type ()
if (!plug_type)
{
static const GtkTypeInfo plug_info =
static const GTypeInfo plug_info =
{
"GtkPlug",
sizeof (GtkPlug),
sizeof (GtkPlugClass),
(GtkClassInitFunc) gtk_plug_class_init,
(GtkObjectInitFunc) gtk_plug_init,
(GtkArgSetFunc) NULL,
(GtkArgGetFunc) NULL
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_plug_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GtkPlug),
16, /* n_preallocs */
(GInstanceInitFunc) gtk_plug_init,
};
plug_type = gtk_type_unique (GTK_TYPE_WINDOW, &plug_info);
plug_type = g_type_register_static (GTK_TYPE_WINDOW, "GtkPlug", &plug_info);
}
return plug_type;

View File

@ -53,7 +53,7 @@ static void gtk_preview_set_arg (GtkObject *object,
static void gtk_preview_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_preview_finalize (GtkObject *object);
static void gtk_preview_finalize (GObject *object);
static void gtk_preview_realize (GtkWidget *widget);
static void gtk_preview_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
@ -95,6 +95,7 @@ gtk_preview_get_type (void)
static void
gtk_preview_class_init (GtkPreviewClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
@ -104,9 +105,10 @@ gtk_preview_class_init (GtkPreviewClass *klass)
parent_class = gtk_type_class (GTK_TYPE_WIDGET);
preview_class = klass;
gobject_class->finalize = gtk_preview_finalize;
object_class->set_arg = gtk_preview_set_arg;
object_class->get_arg = gtk_preview_get_arg;
object_class->finalize = gtk_preview_finalize;
widget_class->realize = gtk_preview_realize;
widget_class->size_allocate = gtk_preview_size_allocate;
@ -438,11 +440,10 @@ gtk_preview_get_info (void)
static void
gtk_preview_finalize (GtkObject *object)
gtk_preview_finalize (GObject *object)
{
GtkPreview *preview;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_PREVIEW (object));
preview = GTK_PREVIEW (object);
@ -450,7 +451,7 @@ gtk_preview_finalize (GtkObject *object)
g_free (preview->buffer);
preview->type = (GtkPreviewType) -1;
(* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void

View File

@ -50,7 +50,7 @@ static void gtk_progress_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_progress_destroy (GtkObject *object);
static void gtk_progress_finalize (GtkObject *object);
static void gtk_progress_finalize (GObject *object);
static void gtk_progress_realize (GtkWidget *widget);
static gint gtk_progress_expose (GtkWidget *widget,
GdkEventExpose *event);
@ -90,6 +90,7 @@ gtk_progress_get_type (void)
static void
gtk_progress_class_init (GtkProgressClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
@ -97,6 +98,21 @@ gtk_progress_class_init (GtkProgressClass *class)
widget_class = (GtkWidgetClass *) class;
parent_class = gtk_type_class (GTK_TYPE_WIDGET);
gobject_class->finalize = gtk_progress_finalize;
object_class->set_arg = gtk_progress_set_arg;
object_class->get_arg = gtk_progress_get_arg;
object_class->destroy = gtk_progress_destroy;
widget_class->realize = gtk_progress_realize;
widget_class->expose_event = gtk_progress_expose;
widget_class->size_allocate = gtk_progress_size_allocate;
/* to be overridden */
class->paint = NULL;
class->update = NULL;
class->act_mode_enter = NULL;
gtk_object_add_arg_type ("GtkProgress::activity_mode",
GTK_TYPE_BOOL,
GTK_ARG_READWRITE,
@ -113,20 +129,6 @@ gtk_progress_class_init (GtkProgressClass *class)
GTK_TYPE_FLOAT,
GTK_ARG_READWRITE,
ARG_TEXT_YALIGN);
object_class->set_arg = gtk_progress_set_arg;
object_class->get_arg = gtk_progress_get_arg;
object_class->destroy = gtk_progress_destroy;
object_class->finalize = gtk_progress_finalize;
widget_class->realize = gtk_progress_realize;
widget_class->expose_event = gtk_progress_expose;
widget_class->size_allocate = gtk_progress_size_allocate;
/* to be overridden */
class->paint = NULL;
class->update = NULL;
class->act_mode_enter = NULL;
}
static void
@ -245,32 +247,32 @@ gtk_progress_destroy (GtkObject *object)
progress = GTK_PROGRESS (object);
if (progress->adjustment)
{
gtk_signal_disconnect_by_data (GTK_OBJECT (progress->adjustment),
progress);
gtk_object_unref (GTK_OBJECT (progress->adjustment));
progress->adjustment = NULL;
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gtk_progress_finalize (GtkObject *object)
gtk_progress_finalize (GObject *object)
{
GtkProgress *progress;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_PROGRESS (object));
progress = GTK_PROGRESS (object);
if (progress->adjustment)
gtk_object_unref (GTK_OBJECT (GTK_PROGRESS (object)->adjustment));
if (progress->offscreen_pixmap)
gdk_pixmap_unref (progress->offscreen_pixmap);
if (progress->format)
g_free (progress->format);
GTK_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gint
@ -332,7 +334,7 @@ gtk_progress_create_pixmap (GtkProgress *progress)
widget->allocation.width,
widget->allocation.height,
-1);
GTK_PROGRESS_CLASS (GTK_OBJECT (progress)->klass)->paint (progress);
GTK_PROGRESS_GET_CLASS (progress)->paint (progress);
}
}
@ -340,7 +342,7 @@ static void
gtk_progress_value_changed (GtkAdjustment *adjustment,
GtkProgress *progress)
{
GTK_PROGRESS_CLASS (GTK_OBJECT (progress)->klass)->update (progress);
GTK_PROGRESS_GET_CLASS (progress)->update (progress);
}
static gchar *
@ -495,6 +497,8 @@ gtk_progress_configure (GtkProgress *progress,
g_return_if_fail (min <= max);
g_return_if_fail (value >= min && value <= max);
if (!progress->adjustment)
gtk_progress_set_adjustment (progress, NULL);
adj = progress->adjustment;
if (fabs (adj->lower - min) > EPSILON || fabs (adj->upper - max) > EPSILON)
@ -517,6 +521,8 @@ gtk_progress_set_percentage (GtkProgress *progress,
g_return_if_fail (GTK_IS_PROGRESS (progress));
g_return_if_fail (percentage >= 0 && percentage <= 1.0);
if (!progress->adjustment)
gtk_progress_set_adjustment (progress, NULL);
gtk_progress_set_value (progress, progress->adjustment->lower + percentage *
(progress->adjustment->upper - progress->adjustment->lower));
}
@ -527,8 +533,11 @@ gtk_progress_get_current_percentage (GtkProgress *progress)
g_return_val_if_fail (progress != NULL, 0);
g_return_val_if_fail (GTK_IS_PROGRESS (progress), 0);
return (progress->adjustment->value - progress->adjustment->lower) /
(progress->adjustment->upper - progress->adjustment->lower);
if (!progress->adjustment)
gtk_progress_set_adjustment (progress, NULL);
return ((progress->adjustment->value - progress->adjustment->lower) /
(progress->adjustment->upper - progress->adjustment->lower));
}
gfloat
@ -538,6 +547,9 @@ gtk_progress_get_percentage_from_value (GtkProgress *progress,
g_return_val_if_fail (progress != NULL, 0);
g_return_val_if_fail (GTK_IS_PROGRESS (progress), 0);
if (!progress->adjustment)
gtk_progress_set_adjustment (progress, NULL);
if (value >= progress->adjustment->lower &&
value <= progress->adjustment->upper)
return (value - progress->adjustment->lower) /
@ -553,6 +565,9 @@ gtk_progress_set_value (GtkProgress *progress,
g_return_if_fail (progress != NULL);
g_return_if_fail (GTK_IS_PROGRESS (progress));
if (!progress->adjustment)
gtk_progress_set_adjustment (progress, NULL);
if (fabs (progress->adjustment->value - value) > EPSILON)
gtk_adjustment_set_value (progress->adjustment, value);
}
@ -563,7 +578,7 @@ gtk_progress_get_value (GtkProgress *progress)
g_return_val_if_fail (progress != NULL, 0);
g_return_val_if_fail (GTK_IS_PROGRESS (progress), 0);
return progress->adjustment->value;
return progress->adjustment ? progress->adjustment->value : 0;
}
void
@ -626,6 +641,9 @@ gtk_progress_get_current_text (GtkProgress *progress)
g_return_val_if_fail (progress != NULL, 0);
g_return_val_if_fail (GTK_IS_PROGRESS (progress), 0);
if (!progress->adjustment)
gtk_progress_set_adjustment (progress, NULL);
return gtk_progress_build_string (progress, progress->adjustment->value,
gtk_progress_get_current_percentage (progress));
}
@ -637,6 +655,9 @@ gtk_progress_get_text_from_value (GtkProgress *progress,
g_return_val_if_fail (progress != NULL, 0);
g_return_val_if_fail (GTK_IS_PROGRESS (progress), 0);
if (!progress->adjustment)
gtk_progress_set_adjustment (progress, NULL);
return gtk_progress_build_string (progress, value,
gtk_progress_get_percentage_from_value (progress, value));
}
@ -653,8 +674,7 @@ gtk_progress_set_activity_mode (GtkProgress *progress,
progress->activity_mode = (activity_mode != 0);
if (progress->activity_mode)
GTK_PROGRESS_CLASS
(GTK_OBJECT (progress)->klass)->act_mode_enter (progress);
GTK_PROGRESS_GET_CLASS (progress)->act_mode_enter (progress);
if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (progress)))
gtk_widget_queue_resize (GTK_WIDGET (progress));

View File

@ -108,7 +108,7 @@ gtk_progress_bar_class_init (GtkProgressBarClass *class)
gtk_object_add_arg_type ("GtkProgressBar::adjustment",
GTK_TYPE_ADJUSTMENT,
GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
GTK_ARG_READWRITE,
ARG_ADJUSTMENT);
gtk_object_add_arg_type ("GtkProgressBar::orientation",
GTK_TYPE_PROGRESS_BAR_ORIENTATION,

View File

@ -34,8 +34,6 @@ enum {
ARG_GROUP
};
#define CHECK_BUTTON_CLASS(w) GTK_CHECK_BUTTON_CLASS (GTK_OBJECT (w)->klass)
static void gtk_radio_button_class_init (GtkRadioButtonClass *klass);
static void gtk_radio_button_init (GtkRadioButton *radio_button);
@ -409,10 +407,10 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
new_area.width, new_area.height);
}
x = widget->allocation.x + CHECK_BUTTON_CLASS (widget)->indicator_spacing + GTK_CONTAINER (widget)->border_width;
y = widget->allocation.y + (widget->allocation.height - CHECK_BUTTON_CLASS (widget)->indicator_size) / 2;
width = CHECK_BUTTON_CLASS (widget)->indicator_size;
height = CHECK_BUTTON_CLASS (widget)->indicator_size;
x = widget->allocation.x + GTK_CHECK_BUTTON_GET_CLASS (widget)->indicator_spacing + GTK_CONTAINER (widget)->border_width;
y = widget->allocation.y + (widget->allocation.height - GTK_CHECK_BUTTON_GET_CLASS (widget)->indicator_size) / 2;
width = GTK_CHECK_BUTTON_GET_CLASS (widget)->indicator_size;
height = GTK_CHECK_BUTTON_GET_CLASS (widget)->indicator_size;
if (GTK_TOGGLE_BUTTON (widget)->active)
shadow_type = GTK_SHADOW_IN;

View File

@ -34,7 +34,7 @@
#define SCROLL_INITIAL_DELAY 100
#define SCROLL_DELAY_LENGTH 300
#define RANGE_CLASS(w) GTK_RANGE_CLASS (GTK_OBJECT (w)->klass)
#define RANGE_CLASS(w) GTK_RANGE_GET_CLASS (w)
enum {
ARG_0,
@ -50,7 +50,6 @@ static void gtk_range_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_range_destroy (GtkObject *object);
static void gtk_range_finalize (GtkObject *object);
static void gtk_range_draw (GtkWidget *widget,
GdkRectangle *area);
static void gtk_range_draw_focus (GtkWidget *widget);
@ -138,15 +137,9 @@ gtk_range_class_init (GtkRangeClass *class)
parent_class = gtk_type_class (GTK_TYPE_WIDGET);
gtk_object_add_arg_type ("GtkRange::update_policy",
GTK_TYPE_UPDATE_TYPE,
GTK_ARG_READWRITE,
ARG_UPDATE_POLICY);
object_class->set_arg = gtk_range_set_arg;
object_class->get_arg = gtk_range_get_arg;
object_class->destroy = gtk_range_destroy;
object_class->finalize = gtk_range_finalize;
widget_class->draw = gtk_range_draw;
widget_class->draw_focus = gtk_range_draw_focus;
@ -181,6 +174,11 @@ gtk_range_class_init (GtkRangeClass *class)
class->trough_keys = NULL;
class->motion = NULL;
class->timer = gtk_real_range_timer;
gtk_object_add_arg_type ("GtkRange::update_policy",
GTK_TYPE_UPDATE_TYPE,
GTK_ARG_READWRITE,
ARG_UPDATE_POLICY);
}
static void
@ -253,6 +251,9 @@ gtk_range_get_adjustment (GtkRange *range)
g_return_val_if_fail (range != NULL, NULL);
g_return_val_if_fail (GTK_IS_RANGE (range), NULL);
if (!range->adjustment)
gtk_range_set_adjustment (range, NULL);
return range->adjustment;
}
@ -573,8 +574,8 @@ gtk_range_default_hmotion (GtkRange *range,
gint slider_x, slider_y;
gint new_pos;
g_return_if_fail (range != NULL);
g_return_if_fail (GTK_IS_RANGE (range));
g_return_if_fail (GTK_WIDGET_REALIZED (range));
range = GTK_RANGE (range);
@ -638,8 +639,8 @@ gtk_range_default_vmotion (GtkRange *range,
gint slider_x, slider_y;
gint new_pos;
g_return_if_fail (range != NULL);
g_return_if_fail (GTK_IS_RANGE (range));
g_return_if_fail (GTK_WIDGET_REALIZED (range));
range = GTK_RANGE (range);
@ -704,29 +705,19 @@ gtk_range_destroy (GtkObject *object)
range = GTK_RANGE (object);
gtk_range_remove_timer (range);
if (range->adjustment)
{
if (range->adjustment)
gtk_signal_disconnect_by_data (GTK_OBJECT (range->adjustment),
(gpointer) range);
gtk_object_unref (GTK_OBJECT (range->adjustment));
range->adjustment = NULL;
}
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
gtk_range_finalize (GtkObject *object)
{
GtkRange *range;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_RANGE (object));
range = GTK_RANGE (object);
if (range->adjustment)
gtk_object_unref (GTK_OBJECT (range->adjustment));
(* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
}
static void
gtk_range_draw (GtkWidget *widget,
GdkRectangle *area)
@ -737,7 +728,7 @@ gtk_range_draw (GtkWidget *widget,
g_return_if_fail (GTK_IS_RANGE (widget));
g_return_if_fail (area != NULL);
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
if (GTK_WIDGET_DRAWABLE (widget))
{
range = GTK_RANGE (widget);
@ -844,7 +835,6 @@ gtk_range_button_press (GtkWidget *widget,
gint trough_part;
gfloat jump_perc;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
@ -919,7 +909,6 @@ gtk_range_button_release (GtkWidget *widget,
{
GtkRange *range;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
@ -976,13 +965,13 @@ gtk_range_scroll_event (GtkWidget *widget,
{
GtkRange *range;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
range = GTK_RANGE (widget);
if (GTK_WIDGET_VISIBLE (range)) {
if (GTK_WIDGET_REALIZED (range))
{
GtkAdjustment *adj = GTK_RANGE (range)->adjustment;
gfloat new_value = adj->value + ((event->direction == GDK_SCROLL_UP) ?
-adj->page_increment / 2:
@ -1002,7 +991,6 @@ gtk_range_motion_notify (GtkWidget *widget,
GdkModifierType mods;
gint x, y, mask;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
@ -1053,7 +1041,6 @@ gtk_range_key_press (GtkWidget *widget,
GtkScrollType scroll = GTK_SCROLL_NONE;
GtkTroughType pos = GTK_TROUGH_NONE;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
@ -1110,7 +1097,6 @@ gtk_range_enter_notify (GtkWidget *widget,
{
GtkRange *range;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
@ -1154,7 +1140,6 @@ gtk_range_leave_notify (GtkWidget *widget,
{
GtkRange *range;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
@ -1191,7 +1176,6 @@ static gint
gtk_range_focus_in (GtkWidget *widget,
GdkEventFocus *event)
{
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
@ -1205,7 +1189,6 @@ static gint
gtk_range_focus_out (GtkWidget *widget,
GdkEventFocus *event)
{
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
@ -1218,7 +1201,6 @@ gtk_range_focus_out (GtkWidget *widget,
static void
gtk_real_range_draw_trough (GtkRange *range)
{
g_return_if_fail (range != NULL);
g_return_if_fail (GTK_IS_RANGE (range));
if (range->trough)
@ -1240,7 +1222,6 @@ gtk_real_range_draw_slider (GtkRange *range)
{
GtkStateType state_type;
g_return_if_fail (range != NULL);
g_return_if_fail (GTK_IS_RANGE (range));
if (range->slider)
@ -1324,7 +1305,6 @@ gtk_range_scroll (GtkRange *range,
gfloat new_value;
gint return_val;
g_return_val_if_fail (range != NULL, FALSE);
g_return_val_if_fail (GTK_IS_RANGE (range), FALSE);
new_value = range->adjustment->value;
@ -1408,7 +1388,6 @@ gtk_range_scroll (GtkRange *range,
static void
gtk_range_add_timer (GtkRange *range)
{
g_return_if_fail (range != NULL);
g_return_if_fail (GTK_IS_RANGE (range));
if (!range->timer)
@ -1423,7 +1402,6 @@ gtk_range_add_timer (GtkRange *range)
static void
gtk_range_remove_timer (GtkRange *range)
{
g_return_if_fail (range != NULL);
g_return_if_fail (GTK_IS_RANGE (range));
if (range->timer)

View File

@ -226,8 +226,8 @@ gtk_ruler_draw_ticks (GtkRuler *ruler)
g_return_if_fail (ruler != NULL);
g_return_if_fail (GTK_IS_RULER (ruler));
if (GTK_RULER_CLASS (GTK_OBJECT (ruler)->klass)->draw_ticks)
(* GTK_RULER_CLASS (GTK_OBJECT (ruler)->klass)->draw_ticks) (ruler);
if (GTK_RULER_GET_CLASS (ruler)->draw_ticks)
GTK_RULER_GET_CLASS (ruler)->draw_ticks (ruler);
}
void
@ -236,8 +236,8 @@ gtk_ruler_draw_pos (GtkRuler *ruler)
g_return_if_fail (ruler != NULL);
g_return_if_fail (GTK_IS_RULER (ruler));
if (GTK_RULER_CLASS (GTK_OBJECT (ruler)->klass)->draw_pos)
(* GTK_RULER_CLASS (GTK_OBJECT (ruler)->klass)->draw_pos) (ruler);
if (GTK_RULER_GET_CLASS (ruler)->draw_pos)
GTK_RULER_GET_CLASS (ruler)->draw_pos (ruler);
}

View File

@ -29,8 +29,6 @@
#include "gtkscale.h"
#define SCALE_CLASS(w) GTK_SCALE_CLASS (GTK_OBJECT (w)->klass)
enum {
ARG_0,
ARG_DIGITS,
@ -330,8 +328,8 @@ gtk_scale_draw_value (GtkScale *scale)
g_return_if_fail (scale != NULL);
g_return_if_fail (GTK_IS_SCALE (scale));
if (SCALE_CLASS (scale)->draw_value)
(* SCALE_CLASS (scale)->draw_value) (scale);
if (GTK_SCALE_GET_CLASS (scale)->draw_value)
GTK_SCALE_GET_CLASS (scale)->draw_value (scale);
}

View File

@ -63,7 +63,7 @@
* under A) at least correspond to the space taken up by its scrollbars.
*/
#define SCROLLBAR_SPACING(w) (GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT (w)->klass)->scrollbar_spacing)
#define SCROLLBAR_SPACING(w) (GTK_SCROLLED_WINDOW_GET_CLASS (w)->scrollbar_spacing)
#define DEFAULT_SCROLLBAR_SPACING 3
@ -86,7 +86,7 @@ static void gtk_scrolled_window_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_scrolled_window_destroy (GtkObject *object);
static void gtk_scrolled_window_finalize (GtkObject *object);
static void gtk_scrolled_window_finalize (GObject *object);
static void gtk_scrolled_window_map (GtkWidget *widget);
static void gtk_scrolled_window_unmap (GtkWidget *widget);
static void gtk_scrolled_window_draw (GtkWidget *widget,
@ -141,6 +141,7 @@ gtk_scrolled_window_get_type (void)
static void
gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
@ -150,6 +151,25 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
container_class = (GtkContainerClass*) class;
parent_class = gtk_type_class (GTK_TYPE_BIN);
gobject_class->finalize = gtk_scrolled_window_finalize;
object_class->set_arg = gtk_scrolled_window_set_arg;
object_class->get_arg = gtk_scrolled_window_get_arg;
object_class->destroy = gtk_scrolled_window_destroy;
widget_class->map = gtk_scrolled_window_map;
widget_class->unmap = gtk_scrolled_window_unmap;
widget_class->draw = gtk_scrolled_window_draw;
widget_class->size_request = gtk_scrolled_window_size_request;
widget_class->size_allocate = gtk_scrolled_window_size_allocate;
widget_class->scroll_event = gtk_scrolled_window_scroll_event;
container_class->add = gtk_scrolled_window_add;
container_class->remove = gtk_scrolled_window_remove;
container_class->forall = gtk_scrolled_window_forall;
class->scrollbar_spacing = DEFAULT_SCROLLBAR_SPACING;
gtk_object_add_arg_type ("GtkScrolledWindow::hadjustment",
GTK_TYPE_ADJUSTMENT,
GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
@ -170,24 +190,6 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
GTK_TYPE_CORNER_TYPE,
GTK_ARG_READWRITE,
ARG_WINDOW_PLACEMENT);
object_class->set_arg = gtk_scrolled_window_set_arg;
object_class->get_arg = gtk_scrolled_window_get_arg;
object_class->destroy = gtk_scrolled_window_destroy;
object_class->finalize = gtk_scrolled_window_finalize;
widget_class->map = gtk_scrolled_window_map;
widget_class->unmap = gtk_scrolled_window_unmap;
widget_class->draw = gtk_scrolled_window_draw;
widget_class->size_request = gtk_scrolled_window_size_request;
widget_class->size_allocate = gtk_scrolled_window_size_allocate;
widget_class->scroll_event = gtk_scrolled_window_scroll_event;
container_class->add = gtk_scrolled_window_add;
container_class->remove = gtk_scrolled_window_remove;
container_class->forall = gtk_scrolled_window_forall;
class->scrollbar_spacing = DEFAULT_SCROLLBAR_SPACING;
}
static void
@ -475,16 +477,14 @@ gtk_scrolled_window_destroy (GtkObject *object)
}
static void
gtk_scrolled_window_finalize (GtkObject *object)
gtk_scrolled_window_finalize (GObject *object)
{
GtkScrolledWindow *scrolled_window;
scrolled_window = GTK_SCROLLED_WINDOW (object);
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (object);
gtk_widget_unref (scrolled_window->hscrollbar);
gtk_widget_unref (scrolled_window->vscrollbar);
GTK_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void

View File

@ -435,7 +435,7 @@ gtk_signal_lookup (const gchar *name,
gpointer class = NULL;
g_return_val_if_fail (name != NULL, 0);
g_return_val_if_fail (gtk_type_is_a (object_type, GTK_TYPE_OBJECT), 0);
g_return_val_if_fail (GTK_TYPE_IS_OBJECT (object_type), 0);
relookup:
@ -1393,7 +1393,7 @@ gtk_signal_real_emit (GtkObject *object,
*/
signal = *LOOKUP_SIGNAL_ID (signal_id);
if (signal.function_offset)
signal_func = G_STRUCT_MEMBER (GtkSignalFunc, object->klass, signal.function_offset);
signal_func = G_STRUCT_MEMBER (GtkSignalFunc, ((GTypeInstance*) object)->g_class, signal.function_offset);
else
signal_func = NULL;
@ -1723,8 +1723,7 @@ gtk_signal_connect_by_type (GtkObject *object,
gint found_it;
GtkSignal *signal;
g_return_val_if_fail (object != NULL, 0);
g_return_val_if_fail (object->klass != NULL, 0);
g_return_val_if_fail (GTK_IS_OBJECT (object), 0);
signal = LOOKUP_SIGNAL_ID (signal_id);
@ -1737,7 +1736,7 @@ gtk_signal_connect_by_type (GtkObject *object,
* return correct signal ids per class-branch.
*/
found_it = FALSE;
class = object->klass;
class = GTK_OBJECT_GET_CLASS (object);
while (class)
{
GtkType parent;
@ -1755,9 +1754,9 @@ gtk_signal_connect_by_type (GtkObject *object,
break;
}
parent = gtk_type_parent (class->type);
if (parent)
class = gtk_type_class (parent);
parent = g_type_parent (GTK_CLASS_TYPE (class));
if (GTK_TYPE_IS_OBJECT (parent))
class = g_type_class_peek (parent);
else
class = NULL;
}
@ -1766,7 +1765,7 @@ gtk_signal_connect_by_type (GtkObject *object,
{
g_warning ("gtk_signal_connect_by_type(): could not find signal id (%u) in the `%s' class ancestry",
signal_id,
gtk_type_name (object->klass->type));
GTK_OBJECT_TYPE_NAME (object));
return 0;
}
@ -1987,9 +1986,7 @@ gtk_signal_collect_params (GtkArg *params,
return_type = GTK_FUNDAMENTAL_TYPE (return_type);
if (return_type != GTK_TYPE_NONE)
{
if ((return_type >= GTK_TYPE_FLAT_FIRST &&
return_type <= GTK_TYPE_FLAT_LAST) ||
(return_type == GTK_TYPE_OBJECT))
if (return_type != 0) // FIXME: check for IS_PARAM
{
GTK_VALUE_POINTER (*params) = va_arg (var_args, gpointer);

View File

@ -77,18 +77,20 @@ gtk_socket_get_type (void)
if (!socket_type)
{
static const GtkTypeInfo socket_info =
static const GTypeInfo socket_info =
{
"GtkSocket",
sizeof (GtkSocket),
sizeof (GtkSocketClass),
(GtkClassInitFunc) gtk_socket_class_init,
(GtkObjectInitFunc) gtk_socket_init,
(GtkArgSetFunc) NULL,
(GtkArgGetFunc) NULL
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_socket_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GtkSocket),
16, /* n_preallocs */
(GInstanceInitFunc) gtk_socket_init,
};
socket_type = gtk_type_unique (GTK_TYPE_CONTAINER, &socket_info);
socket_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkSocket", &socket_info);
}
return socket_type;

View File

@ -69,7 +69,7 @@ enum
static void gtk_spin_button_class_init (GtkSpinButtonClass *klass);
static void gtk_spin_button_init (GtkSpinButton *spin_button);
static void gtk_spin_button_finalize (GtkObject *object);
static void gtk_spin_button_finalize (GObject *object);
static void gtk_spin_button_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
@ -158,6 +158,7 @@ gtk_spin_button_get_type (void)
static void
gtk_spin_button_class_init (GtkSpinButtonClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkEditableClass *editable_class;
@ -168,6 +169,35 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
parent_class = gtk_type_class (GTK_TYPE_ENTRY);
gobject_class->finalize = gtk_spin_button_finalize;
object_class->set_arg = gtk_spin_button_set_arg;
object_class->get_arg = gtk_spin_button_get_arg;
widget_class->map = gtk_spin_button_map;
widget_class->unmap = gtk_spin_button_unmap;
widget_class->realize = gtk_spin_button_realize;
widget_class->unrealize = gtk_spin_button_unrealize;
widget_class->size_request = gtk_spin_button_size_request;
widget_class->size_allocate = gtk_spin_button_size_allocate;
widget_class->draw = gtk_spin_button_draw;
widget_class->expose_event = gtk_spin_button_expose;
widget_class->scroll_event = gtk_spin_button_scroll;
widget_class->button_press_event = gtk_spin_button_button_press;
widget_class->button_release_event = gtk_spin_button_button_release;
widget_class->motion_notify_event = gtk_spin_button_motion_notify;
widget_class->key_press_event = gtk_spin_button_key_press;
widget_class->key_release_event = gtk_spin_button_key_release;
widget_class->enter_notify_event = gtk_spin_button_enter_notify;
widget_class->leave_notify_event = gtk_spin_button_leave_notify;
widget_class->focus_out_event = gtk_spin_button_focus_out;
editable_class->insert_text = gtk_spin_button_insert_text;
editable_class->activate = gtk_spin_button_activate;
class->input = NULL;
class->output = NULL;
gtk_object_add_arg_type ("GtkSpinButton::adjustment",
GTK_TYPE_ADJUSTMENT,
GTK_ARG_READWRITE,
@ -205,14 +235,10 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
GTK_ARG_READWRITE,
ARG_VALUE);
object_class->set_arg = gtk_spin_button_set_arg;
object_class->get_arg = gtk_spin_button_get_arg;
object_class->finalize = gtk_spin_button_finalize;
spinbutton_signals[INPUT] =
gtk_signal_new ("input",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkSpinButtonClass, input),
gtk_marshal_INT__POINTER,
GTK_TYPE_INT, 1, GTK_TYPE_POINTER);
@ -220,36 +246,12 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
spinbutton_signals[OUTPUT] =
gtk_signal_new ("output",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkSpinButtonClass, output),
gtk_marshal_BOOL__NONE,
GTK_TYPE_BOOL, 0);
gtk_object_class_add_signals (object_class, spinbutton_signals, LAST_SIGNAL);
widget_class->map = gtk_spin_button_map;
widget_class->unmap = gtk_spin_button_unmap;
widget_class->realize = gtk_spin_button_realize;
widget_class->unrealize = gtk_spin_button_unrealize;
widget_class->size_request = gtk_spin_button_size_request;
widget_class->size_allocate = gtk_spin_button_size_allocate;
widget_class->draw = gtk_spin_button_draw;
widget_class->expose_event = gtk_spin_button_expose;
widget_class->scroll_event = gtk_spin_button_scroll;
widget_class->button_press_event = gtk_spin_button_button_press;
widget_class->button_release_event = gtk_spin_button_button_release;
widget_class->motion_notify_event = gtk_spin_button_motion_notify;
widget_class->key_press_event = gtk_spin_button_key_press;
widget_class->key_release_event = gtk_spin_button_key_release;
widget_class->enter_notify_event = gtk_spin_button_enter_notify;
widget_class->leave_notify_event = gtk_spin_button_leave_notify;
widget_class->focus_out_event = gtk_spin_button_focus_out;
editable_class->insert_text = gtk_spin_button_insert_text;
editable_class->activate = gtk_spin_button_activate;
class->input = NULL;
class->output = NULL;
}
static void
@ -375,14 +377,13 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
}
static void
gtk_spin_button_finalize (GtkObject *object)
gtk_spin_button_finalize (GObject *object)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_SPIN_BUTTON (object));
gtk_object_unref (GTK_OBJECT (GTK_SPIN_BUTTON (object)->adjustment));
GTK_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
@ -1408,7 +1409,6 @@ void
gtk_spin_button_set_adjustment (GtkSpinButton *spin_button,
GtkAdjustment *adjustment)
{
g_return_if_fail (spin_button != NULL);
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
if (spin_button->adjustment != adjustment)

View File

@ -41,7 +41,6 @@ enum
static void gtk_statusbar_class_init (GtkStatusbarClass *class);
static void gtk_statusbar_init (GtkStatusbar *statusbar);
static void gtk_statusbar_destroy (GtkObject *object);
static void gtk_statusbar_finalize (GtkObject *object);
static void gtk_statusbar_update (GtkStatusbar *statusbar,
guint context_id,
const gchar *text);
@ -87,28 +86,7 @@ gtk_statusbar_class_init (GtkStatusbarClass *class)
parent_class = gtk_type_class (GTK_TYPE_HBOX);
statusbar_signals[SIGNAL_TEXT_PUSHED] =
gtk_signal_new ("text_pushed",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkStatusbarClass, text_pushed),
gtk_marshal_NONE__UINT_STRING,
GTK_TYPE_NONE, 2,
GTK_TYPE_UINT,
GTK_TYPE_STRING);
statusbar_signals[SIGNAL_TEXT_POPPED] =
gtk_signal_new ("text_popped",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkStatusbarClass, text_popped),
gtk_marshal_NONE__UINT_STRING,
GTK_TYPE_NONE, 2,
GTK_TYPE_UINT,
GTK_TYPE_STRING);
gtk_object_class_add_signals (object_class, statusbar_signals, SIGNAL_LAST);
object_class->destroy = gtk_statusbar_destroy;
object_class->finalize = gtk_statusbar_finalize;
class->messages_mem_chunk = g_mem_chunk_new ("GtkStatusBar messages mem chunk",
sizeof (GtkStatusbarMsg),
@ -117,6 +95,26 @@ gtk_statusbar_class_init (GtkStatusbarClass *class)
class->text_pushed = gtk_statusbar_update;
class->text_popped = gtk_statusbar_update;
statusbar_signals[SIGNAL_TEXT_PUSHED] =
gtk_signal_new ("text_pushed",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkStatusbarClass, text_pushed),
gtk_marshal_NONE__UINT_STRING,
GTK_TYPE_NONE, 2,
GTK_TYPE_UINT,
GTK_TYPE_STRING);
statusbar_signals[SIGNAL_TEXT_POPPED] =
gtk_signal_new ("text_popped",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkStatusbarClass, text_popped),
gtk_marshal_NONE__UINT_STRING,
GTK_TYPE_NONE, 2,
GTK_TYPE_UINT,
GTK_TYPE_STRING);
gtk_object_class_add_signals (object_class, statusbar_signals, SIGNAL_LAST);
}
static void
@ -206,7 +204,7 @@ gtk_statusbar_push (GtkStatusbar *statusbar,
g_return_val_if_fail (text != NULL, 0);
g_return_val_if_fail (context_id > 0, 0);
class = GTK_STATUSBAR_CLASS (GTK_OBJECT (statusbar)->klass);
class = GTK_STATUSBAR_GET_CLASS (statusbar);
msg = g_chunk_new (GtkStatusbarMsg, class->messages_mem_chunk);
msg->text = g_strdup (text);
msg->context_id = context_id;
@ -244,7 +242,7 @@ gtk_statusbar_pop (GtkStatusbar *statusbar,
{
GtkStatusbarClass *class;
class = GTK_STATUSBAR_CLASS (GTK_OBJECT (statusbar)->klass);
class = GTK_STATUSBAR_GET_CLASS (statusbar);
statusbar->messages = g_slist_remove_link (statusbar->messages,
list);
@ -298,7 +296,7 @@ gtk_statusbar_remove (GtkStatusbar *statusbar,
{
GtkStatusbarClass *class;
class = GTK_STATUSBAR_CLASS (GTK_OBJECT (statusbar)->klass);
class = GTK_STATUSBAR_GET_CLASS (statusbar);
statusbar->messages = g_slist_remove_link (statusbar->messages, list);
g_free (msg->text);
g_mem_chunk_free (class->messages_mem_chunk, msg);
@ -321,7 +319,7 @@ gtk_statusbar_destroy (GtkObject *object)
g_return_if_fail (GTK_IS_STATUSBAR (object));
statusbar = GTK_STATUSBAR (object);
class = GTK_STATUSBAR_CLASS (GTK_OBJECT (statusbar)->klass);
class = GTK_STATUSBAR_GET_CLASS (statusbar);
for (list = statusbar->messages; list; list = list->next)
{
@ -341,16 +339,3 @@ gtk_statusbar_destroy (GtkObject *object)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gtk_statusbar_finalize (GtkObject *object)
{
GtkStatusbar *statusbar;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_STATUSBAR (object));
statusbar = GTK_STATUSBAR (object);
GTK_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -52,7 +52,7 @@ enum
static void gtk_table_class_init (GtkTableClass *klass);
static void gtk_table_init (GtkTable *table);
static void gtk_table_finalize (GtkObject *object);
static void gtk_table_finalize (GObject *object);
static void gtk_table_map (GtkWidget *widget);
static void gtk_table_unmap (GtkWidget *widget);
static void gtk_table_draw (GtkWidget *widget,
@ -129,6 +129,7 @@ gtk_table_get_type (void)
static void
gtk_table_class_init (GtkTableClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
@ -139,23 +140,10 @@ gtk_table_class_init (GtkTableClass *class)
parent_class = gtk_type_class (gtk_container_get_type ());
gtk_object_add_arg_type ("GtkTable::n_rows", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_N_ROWS);
gtk_object_add_arg_type ("GtkTable::n_columns", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_N_COLUMNS);
gtk_object_add_arg_type ("GtkTable::row_spacing", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_ROW_SPACING);
gtk_object_add_arg_type ("GtkTable::column_spacing", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_COLUMN_SPACING);
gtk_object_add_arg_type ("GtkTable::homogeneous", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HOMOGENEOUS);
gtk_container_add_child_arg_type ("GtkTable::left_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_LEFT_ATTACH);
gtk_container_add_child_arg_type ("GtkTable::right_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_RIGHT_ATTACH);
gtk_container_add_child_arg_type ("GtkTable::top_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_TOP_ATTACH);
gtk_container_add_child_arg_type ("GtkTable::bottom_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_BOTTOM_ATTACH);
gtk_container_add_child_arg_type ("GtkTable::x_options", GTK_TYPE_ATTACH_OPTIONS, GTK_ARG_READWRITE, CHILD_ARG_X_OPTIONS);
gtk_container_add_child_arg_type ("GtkTable::y_options", GTK_TYPE_ATTACH_OPTIONS, GTK_ARG_READWRITE, CHILD_ARG_Y_OPTIONS);
gtk_container_add_child_arg_type ("GtkTable::x_padding", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_X_PADDING);
gtk_container_add_child_arg_type ("GtkTable::y_padding", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_Y_PADDING);
gobject_class->finalize = gtk_table_finalize;
object_class->get_arg = gtk_table_get_arg;
object_class->set_arg = gtk_table_set_arg;
object_class->finalize = gtk_table_finalize;
widget_class->map = gtk_table_map;
widget_class->unmap = gtk_table_unmap;
@ -170,6 +158,20 @@ gtk_table_class_init (GtkTableClass *class)
container_class->child_type = gtk_table_child_type;
container_class->set_child_arg = gtk_table_set_child_arg;
container_class->get_child_arg = gtk_table_get_child_arg;
gtk_object_add_arg_type ("GtkTable::n_rows", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_N_ROWS);
gtk_object_add_arg_type ("GtkTable::n_columns", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_N_COLUMNS);
gtk_object_add_arg_type ("GtkTable::row_spacing", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_ROW_SPACING);
gtk_object_add_arg_type ("GtkTable::column_spacing", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_COLUMN_SPACING);
gtk_object_add_arg_type ("GtkTable::homogeneous", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HOMOGENEOUS);
gtk_container_add_child_arg_type ("GtkTable::left_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_LEFT_ATTACH);
gtk_container_add_child_arg_type ("GtkTable::right_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_RIGHT_ATTACH);
gtk_container_add_child_arg_type ("GtkTable::top_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_TOP_ATTACH);
gtk_container_add_child_arg_type ("GtkTable::bottom_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_BOTTOM_ATTACH);
gtk_container_add_child_arg_type ("GtkTable::x_options", GTK_TYPE_ATTACH_OPTIONS, GTK_ARG_READWRITE, CHILD_ARG_X_OPTIONS);
gtk_container_add_child_arg_type ("GtkTable::y_options", GTK_TYPE_ATTACH_OPTIONS, GTK_ARG_READWRITE, CHILD_ARG_Y_OPTIONS);
gtk_container_add_child_arg_type ("GtkTable::x_padding", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_X_PADDING);
gtk_container_add_child_arg_type ("GtkTable::y_padding", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_Y_PADDING);
}
static GtkType
@ -655,11 +657,10 @@ gtk_table_set_homogeneous (GtkTable *table,
}
static void
gtk_table_finalize (GtkObject *object)
gtk_table_finalize (GObject *object)
{
GtkTable *table;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_TABLE (object));
table = GTK_TABLE (object);
@ -667,7 +668,7 @@ gtk_table_finalize (GtkObject *object)
g_free (table->rows);
g_free (table->cols);
(* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void

View File

@ -202,7 +202,7 @@ static void gtk_text_get_arg (GtkObject *object,
guint arg_id);
static void gtk_text_init (GtkText *text);
static void gtk_text_destroy (GtkObject *object);
static void gtk_text_finalize (GtkObject *object);
static void gtk_text_finalize (GObject *object);
static void gtk_text_realize (GtkWidget *widget);
static void gtk_text_unrealize (GtkWidget *widget);
static void gtk_text_style_set (GtkWidget *widget,
@ -534,6 +534,7 @@ gtk_text_get_type (void)
static void
gtk_text_class_init (GtkTextClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkEditableClass *editable_class;
@ -543,27 +544,11 @@ gtk_text_class_init (GtkTextClass *class)
editable_class = (GtkEditableClass*) class;
parent_class = gtk_type_class (GTK_TYPE_EDITABLE);
gtk_object_add_arg_type ("GtkText::hadjustment",
GTK_TYPE_ADJUSTMENT,
GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
ARG_HADJUSTMENT);
gtk_object_add_arg_type ("GtkText::vadjustment",
GTK_TYPE_ADJUSTMENT,
GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
ARG_VADJUSTMENT);
gtk_object_add_arg_type ("GtkText::line_wrap",
GTK_TYPE_BOOL,
GTK_ARG_READWRITE,
ARG_LINE_WRAP);
gtk_object_add_arg_type ("GtkText::word_wrap",
GTK_TYPE_BOOL,
GTK_ARG_READWRITE,
ARG_WORD_WRAP);
gobject_class->finalize = gtk_text_finalize;
object_class->set_arg = gtk_text_set_arg;
object_class->get_arg = gtk_text_get_arg;
object_class->destroy = gtk_text_destroy;
object_class->finalize = gtk_text_finalize;
widget_class->realize = gtk_text_realize;
widget_class->unrealize = gtk_text_unrealize;
@ -581,14 +566,6 @@ gtk_text_class_init (GtkTextClass *class)
widget_class->focus_in_event = gtk_text_focus_in;
widget_class->focus_out_event = gtk_text_focus_out;
widget_class->set_scroll_adjustments_signal =
gtk_signal_new ("set_scroll_adjustments",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkTextClass, set_scroll_adjustments),
gtk_marshal_NONE__POINTER_POINTER,
GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
editable_class->set_editable = gtk_text_real_set_editable;
editable_class->insert_text = gtk_text_insert_text;
editable_class->delete_text = gtk_text_delete_text;
@ -609,6 +586,31 @@ gtk_text_class_init (GtkTextClass *class)
editable_class->set_position = gtk_text_set_position;
class->set_scroll_adjustments = gtk_text_set_adjustments;
gtk_object_add_arg_type ("GtkText::hadjustment",
GTK_TYPE_ADJUSTMENT,
GTK_ARG_READWRITE,
ARG_HADJUSTMENT);
gtk_object_add_arg_type ("GtkText::vadjustment",
GTK_TYPE_ADJUSTMENT,
GTK_ARG_READWRITE,
ARG_VADJUSTMENT);
gtk_object_add_arg_type ("GtkText::line_wrap",
GTK_TYPE_BOOL,
GTK_ARG_READWRITE,
ARG_LINE_WRAP);
gtk_object_add_arg_type ("GtkText::word_wrap",
GTK_TYPE_BOOL,
GTK_ARG_READWRITE,
ARG_WORD_WRAP);
widget_class->set_scroll_adjustments_signal =
gtk_signal_new ("set_scroll_adjustments",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkTextClass, set_scroll_adjustments),
gtk_marshal_NONE__POINTER_POINTER,
GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
}
static void
@ -721,6 +723,7 @@ gtk_text_init (GtkText *text)
GTK_EDITABLE (text)->editable = FALSE;
gtk_text_set_adjustments (text, NULL, NULL);
gtk_editable_set_position (GTK_EDITABLE (text), 0);
}
@ -1200,13 +1203,22 @@ gtk_text_destroy (GtkObject *object)
{
GtkText *text;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_TEXT (object));
text = (GtkText*) object;
text = GTK_TEXT (object);
if (text->hadj)
{
gtk_signal_disconnect_by_data (GTK_OBJECT (text->hadj), text);
gtk_object_unref (GTK_OBJECT (text->hadj));
text->hadj = NULL;
}
if (text->vadj)
{
gtk_signal_disconnect_by_data (GTK_OBJECT (text->vadj), text);
gtk_object_unref (GTK_OBJECT (text->vadj));
text->vadj = NULL;
}
if (text->timer)
{
@ -1218,18 +1230,14 @@ gtk_text_destroy (GtkObject *object)
}
static void
gtk_text_finalize (GtkObject *object)
gtk_text_finalize (GObject *object)
{
GtkText *text;
GList *tmp_list;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_TEXT (object));
text = (GtkText *)object;
gtk_object_unref (GTK_OBJECT (text->hadj));
gtk_object_unref (GTK_OBJECT (text->vadj));
text = GTK_TEXT (object);
/* Clean up the internal structures */
if (text->use_wchar)
@ -1262,7 +1270,7 @@ gtk_text_finalize (GtkObject *object)
g_list_free (text->tab_stops);
GTK_OBJECT_CLASS(parent_class)->finalize (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void

View File

@ -125,21 +125,21 @@ gtk_tips_query_class_init (GtkTipsQueryClass *class)
tips_query_signals[SIGNAL_START_QUERY] =
gtk_signal_new ("start_query",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkTipsQueryClass, start_query),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
tips_query_signals[SIGNAL_STOP_QUERY] =
gtk_signal_new ("stop_query",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkTipsQueryClass, stop_query),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
tips_query_signals[SIGNAL_WIDGET_ENTERED] =
gtk_signal_new ("widget_entered",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkTipsQueryClass, widget_entered),
gtk_marshal_NONE__POINTER_STRING_STRING,
GTK_TYPE_NONE, 3,
@ -149,7 +149,7 @@ gtk_tips_query_class_init (GtkTipsQueryClass *class)
tips_query_signals[SIGNAL_WIDGET_SELECTED] =
gtk_signal_new ("widget_selected",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkTipsQueryClass, widget_selected),
gtk_marshal_BOOL__POINTER_STRING_STRING_POINTER,
GTK_TYPE_BOOL, 4,

View File

@ -122,7 +122,7 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class)
toggle_button_signals[TOGGLED] =
gtk_signal_new ("toggled",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkToggleButtonClass, toggled),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);

View File

@ -143,7 +143,7 @@ gtk_toolbar_class_init (GtkToolbarClass *class)
toolbar_signals[ORIENTATION_CHANGED] =
gtk_signal_new ("orientation_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkToolbarClass, orientation_changed),
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1,
@ -151,7 +151,7 @@ gtk_toolbar_class_init (GtkToolbarClass *class)
toolbar_signals[STYLE_CHANGED] =
gtk_signal_new ("style_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkToolbarClass, style_changed),
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1,
@ -290,8 +290,11 @@ gtk_toolbar_destroy (GtkObject *object)
toolbar = GTK_TOOLBAR (object);
if (toolbar->tooltips)
{
gtk_object_unref (GTK_OBJECT (toolbar->tooltips));
toolbar->tooltips = NULL;
}
for (children = toolbar->children; children; children = children->next)
{
@ -309,12 +312,10 @@ gtk_toolbar_destroy (GtkObject *object)
g_free (child);
}
g_list_free (toolbar->children);
toolbar->children = NULL;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void

View File

@ -115,14 +115,14 @@ gtk_tree_class_init (GtkTreeClass *class)
tree_signals[SELECTION_CHANGED] =
gtk_signal_new ("selection_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkTreeClass, selection_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
tree_signals[SELECT_CHILD] =
gtk_signal_new ("select_child",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkTreeClass, select_child),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
@ -130,7 +130,7 @@ gtk_tree_class_init (GtkTreeClass *class)
tree_signals[UNSELECT_CHILD] =
gtk_signal_new ("unselect_child",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkTreeClass, unselect_child),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,

View File

@ -145,14 +145,14 @@ gtk_tree_item_class_init (GtkTreeItemClass *class)
tree_item_signals[EXPAND_TREE] =
gtk_signal_new ("expand",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkTreeItemClass, expand),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
tree_item_signals[COLLAPSE_TREE] =
gtk_signal_new ("collapse",
GTK_RUN_FIRST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkTreeItemClass, collapse),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@
*/
/*
* Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
@ -28,7 +28,7 @@
#define __GTK_TYPE_UTILS_H__
#include <glib.h>
#include <glib-object.h>
#ifdef __cplusplus
@ -37,168 +37,91 @@ extern "C" {
/* Fundamental Types
* many of these are just aliases for GLib types to maintain
* compatibility
*/
typedef enum
typedef enum /*< skip >*/
{
GTK_TYPE_INVALID,
GTK_TYPE_NONE,
GTK_TYPE_INVALID = G_TYPE_INVALID,
GTK_TYPE_NONE = G_TYPE_NONE,
GTK_TYPE_ENUM = G_TYPE_ENUM,
GTK_TYPE_FLAGS = G_TYPE_FLAGS,
/* flat types */
GTK_TYPE_CHAR,
GTK_TYPE_UCHAR,
GTK_TYPE_BOOL,
GTK_TYPE_INT,
GTK_TYPE_UINT,
GTK_TYPE_LONG,
GTK_TYPE_ULONG,
GTK_TYPE_FLOAT,
GTK_TYPE_DOUBLE,
GTK_TYPE_STRING,
GTK_TYPE_ENUM,
GTK_TYPE_FLAGS,
GTK_TYPE_BOXED,
GTK_TYPE_POINTER,
/* structured types */
GTK_TYPE_SIGNAL,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
/* base type node of the object system */
GTK_TYPE_OBJECT
/* GtkArg types */
GTK_TYPE_CHAR = G_TYPE_GTK_CHAR,
GTK_TYPE_UCHAR = G_TYPE_GTK_UCHAR,
GTK_TYPE_BOOL = G_TYPE_GTK_BOOL,
GTK_TYPE_INT = G_TYPE_GTK_INT,
GTK_TYPE_UINT = G_TYPE_GTK_UINT,
GTK_TYPE_LONG = G_TYPE_GTK_LONG,
GTK_TYPE_ULONG = G_TYPE_GTK_ULONG,
GTK_TYPE_FLOAT = G_TYPE_GTK_FLOAT,
GTK_TYPE_DOUBLE = G_TYPE_GTK_DOUBLE,
GTK_TYPE_STRING = G_TYPE_GTK_STRING,
GTK_TYPE_BOXED = G_TYPE_GTK_BOXED,
GTK_TYPE_POINTER = G_TYPE_GTK_POINTER,
GTK_TYPE_SIGNAL = G_TYPE_GTK_SIGNAL
} GtkFundamentalType;
/* bounds definitions for type sets, these are provided to distinct
* between fundamental types with if() statements, and to build
* up foreign fundamentals
/* --- type macros --- */
#define GTK_CLASS_NAME(class) (g_type_name (G_TYPE_FROM_CLASS (class)))
#define GTK_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class))
#define GTK_TYPE_IS_OBJECT(type) (g_type_is_a ((type), GTK_TYPE_OBJECT))
/* outdated macros that really shouldn't e used anymore,
* use the GLib type system instead
*/
#define GTK_TYPE_FLAT_FIRST GTK_TYPE_CHAR
#define GTK_TYPE_FLAT_LAST GTK_TYPE_POINTER
#define GTK_TYPE_STRUCTURED_FIRST GTK_TYPE_SIGNAL
#define GTK_TYPE_STRUCTURED_LAST GTK_TYPE_FOREIGN
#define GTK_TYPE_FUNDAMENTAL_LAST GTK_TYPE_OBJECT
#define GTK_TYPE_FUNDAMENTAL_MAX (32)
#ifndef GTK_DISABLE_COMPAT_H
#define GTK_TYPE_FUNDAMENTAL_LAST (G_TYPE_LAST_RESERVED_FUNDAMENTAL - 1)
#define GTK_TYPE_FUNDAMENTAL_MAX (G_TYPE_FUNDAMENTAL_MAX)
#endif /* GTK_DISABLE_COMPAT_H */
/* glib macro wrappers (compatibility) */
#define GTK_STRUCT_OFFSET G_STRUCT_OFFSET
#define GTK_CHECK_CAST G_TYPE_CHECK_INSTANCE_CAST
#define GTK_CHECK_CLASS_CAST G_TYPE_CHECK_CLASS_CAST
#define GTK_CHECK_GET_CLASS G_TYPE_INSTANCE_GET_CLASS
#define GTK_CHECK_TYPE G_TYPE_CHECK_INSTANCE_TYPE
#define GTK_CHECK_CLASS_TYPE G_TYPE_CHECK_CLASS_TYPE
#define GTK_FUNDAMENTAL_TYPE G_TYPE_FUNDAMENTAL
/* retrive a structure offset */
#ifdef offsetof
#define GTK_STRUCT_OFFSET(struct, field) ((gint) offsetof (struct, field))
#else /* !offsetof */
#define GTK_STRUCT_OFFSET(struct, field) ((gint) ((gchar*) &((struct*) 0)->field))
#endif /* !offsetof */
/* The debugging versions of the casting macros make sure the cast is "ok"
* before proceeding, but they are definately slower than their less
* careful counterparts as they involve extra ``is a'' checks.
*/
#ifdef GTK_NO_CHECK_CASTS
# define GTK_CHECK_CAST(tobj, cast_type, cast) ((cast*) (tobj))
# define GTK_CHECK_CLASS_CAST(tclass,cast_type,cast) ((cast*) (tclass))
#else /* !GTK_NO_CHECK_CASTS */
# define GTK_CHECK_CAST(tobj, cast_type, cast) \
((cast*) gtk_type_check_object_cast ((GtkTypeObject*) (tobj), (cast_type)))
# define GTK_CHECK_CLASS_CAST(tclass,cast_type,cast) \
((cast*) gtk_type_check_class_cast ((GtkTypeClass*) (tclass), (cast_type)))
#endif /* GTK_NO_CHECK_CASTS */
#define GTK_CHECK_GET_CLASS(obj,type,klass) ((klass*) (((GtkTypeObject*) (obj))->klass))
/* Determines whether `type_object' and `type_class' are a type of `otype'.
*/
#define GTK_CHECK_TYPE(type_object, otype) ( \
((GtkTypeObject*) (type_object)) != NULL && \
GTK_CHECK_CLASS_TYPE (((GtkTypeObject*) (type_object))->klass, (otype)) \
)
#define GTK_CHECK_CLASS_TYPE(type_class, otype) ( \
((GtkTypeClass*) (type_class)) != NULL && \
gtk_type_is_a (((GtkTypeClass*) (type_class))->type, (otype)) \
)
/* A GtkType holds a unique type id
*/
typedef guint GtkType;
typedef struct _GtkTypeObject GtkTypeObject;
typedef struct _GtkTypeClass GtkTypeClass;
/* glib type wrappers (compatibility) */
typedef GType GtkType;
typedef GTypeInstance GtkTypeObject;
typedef GTypeClass GtkTypeClass;
typedef GBaseInitFunc GtkClassInitFunc;
typedef GInstanceInitFunc GtkObjectInitFunc;
/* Builtin Types
*/
#include <gtk/gtktypebuiltins.h>
#define GTK_TYPE_IDENTIFIER (gtk_identifier_get_type ())
GtkType gtk_identifier_get_type (void);
/* Macros
/* --- typedefs --- */
/* here we come with some necessary forward declarations for structures and
* provide some fundamental function signatures
*/
#define GTK_TYPE_MAKE(parent_t, seqno) (((seqno) << 8) | GTK_FUNDAMENTAL_TYPE (parent_t))
#define GTK_FUNDAMENTAL_TYPE(type) ((GtkFundamentalType) ((type) & 0xFF))
#define GTK_TYPE_SEQNO(type) ((type) > 0xFF ? (type) >> 8 : (type))
typedef struct _GtkArg GtkArg;
typedef struct _GtkObject GtkObject; /* forward declaration of object type */
typedef struct _GtkObject GtkObject; /* object forward declaration */
typedef struct _GtkTypeInfo GtkTypeInfo;
typedef struct _GtkTypeQuery GtkTypeQuery;
typedef struct _GtkEnumValue GtkEnumValue;
typedef struct _GtkEnumValue GtkFlagValue;
#define GTK_SIGNAL_FUNC(f) ((GtkSignalFunc) f)
typedef void (*GtkClassInitFunc) (gpointer klass);
typedef void (*GtkObjectInitFunc) (gpointer object,
gpointer klass);
typedef void (*GtkSignalFunc) ();
typedef gint (*GtkFunction) (gpointer data);
typedef void (*GtkDestroyNotify) (gpointer data);
typedef void (*GtkCallbackMarshal) (GtkObject *object,
gpointer data,
guint n_args,
GtkArg *args);
typedef void (*GtkSignalFunc) ();
typedef void (*GtkSignalMarshaller) (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
/* deprecated */
typedef void (*GtkArgGetFunc) (GtkObject*, GtkArg*, guint);
typedef void (*GtkArgSetFunc) (GtkObject*, GtkArg*, guint);
/* A GtkTypeObject defines the minimum structure requirements
* for type instances. Type instances returned from gtk_type_new ()
* and initialized through a GtkObjectInitFunc need to directly inherit
* from this structure or at least copy its fields one by one.
*/
struct _GtkTypeObject
{
/* A pointer to the objects class. This will actually point to
* the derived objects class struct (which will be derived from
* GtkTypeClass).
*/
GtkTypeClass *klass;
};
/* A GtkTypeClass defines the minimum structure requirements for
* a types class. Classes returned from gtk_type_class () and
* initialized through a GtkClassInitFunc need to directly inherit
* from this structure or at least copy its fields one by one.
*/
struct _GtkTypeClass
{
/* The type identifier for the objects class. There is
* one unique identifier per class.
*/
GtkType type;
};
#define GTK_SIGNAL_FUNC(f) ((GtkSignalFunc) (f))
/* GtkArg, used to hold differently typed values */
struct _GtkArg
{
GtkType type;
@ -222,31 +145,14 @@ struct _GtkArg
gfloat float_data;
gdouble double_data;
gchar *string_data;
gpointer pointer_data;
GtkObject *object_data;
gpointer pointer_data;
/* structured values */
struct {
GtkSignalFunc f;
gpointer d;
} signal_data;
struct {
gint n_args;
GtkArg *args;
} args_data;
struct {
GtkCallbackMarshal marshal;
gpointer data;
GtkDestroyNotify notify;
} callback_data;
struct {
GtkFunction func;
gpointer func_data;
} c_callback_data;
struct {
gpointer data;
GtkDestroyNotify notify;
} foreign_data;
} d;
};
@ -254,8 +160,6 @@ struct _GtkArg
* to allow the usage of these macros in combination with the
* adress operator, e.g. &GTK_VALUE_CHAR (*arg)
*/
/* flat values */
#define GTK_VALUE_CHAR(a) ((a).d.char_data)
#define GTK_VALUE_UCHAR(a) ((a).d.uchar_data)
#define GTK_VALUE_BOOL(a) ((a).d.bool_data)
@ -269,22 +173,14 @@ struct _GtkArg
#define GTK_VALUE_ENUM(a) ((a).d.int_data)
#define GTK_VALUE_FLAGS(a) ((a).d.uint_data)
#define GTK_VALUE_BOXED(a) ((a).d.pointer_data)
#define GTK_VALUE_POINTER(a) ((a).d.pointer_data)
#define GTK_VALUE_OBJECT(a) ((a).d.object_data)
/* structured values */
#define GTK_VALUE_POINTER(a) ((a).d.pointer_data)
#define GTK_VALUE_SIGNAL(a) ((a).d.signal_data)
#define GTK_VALUE_ARGS(a) ((a).d.args_data)
#define GTK_VALUE_CALLBACK(a) ((a).d.callback_data)
#define GTK_VALUE_C_CALLBACK(a) ((a).d.c_callback_data)
#define GTK_VALUE_FOREIGN(a) ((a).d.foreign_data)
/* return location macros, these all narow down to
* pointer types, because return values need to be
* passed by reference
*/
/* flat values */
#define GTK_RETLOC_CHAR(a) ((gchar*) (a).d.pointer_data)
#define GTK_RETLOC_UCHAR(a) ((guchar*) (a).d.pointer_data)
#define GTK_RETLOC_BOOL(a) ((gboolean*) (a).d.pointer_data)
@ -298,9 +194,14 @@ struct _GtkArg
#define GTK_RETLOC_ENUM(a) ((gint*) (a).d.pointer_data)
#define GTK_RETLOC_FLAGS(a) ((guint*) (a).d.pointer_data)
#define GTK_RETLOC_BOXED(a) ((gpointer*) (a).d.pointer_data)
#define GTK_RETLOC_POINTER(a) ((gpointer*) (a).d.pointer_data)
#define GTK_RETLOC_OBJECT(a) ((GtkObject**) (a).d.pointer_data)
#define GTK_RETLOC_POINTER(a) ((gpointer*) (a).d.pointer_data)
/* GTK_RETLOC_SIGNAL() - no such thing */
/* type registration, it is recommended to use
* g_type_register_static() or
* g_type_register_dynamic() instead
*/
struct _GtkTypeInfo
{
gchar *type_name;
@ -312,66 +213,37 @@ struct _GtkTypeInfo
gpointer reserved_2;
GtkClassInitFunc base_class_init_func;
};
struct _GtkTypeQuery
{
GtkType type;
const gchar *type_name;
guint object_size;
guint class_size;
};
struct _GtkEnumValue
{
guint value;
gchar *value_name;
gchar *value_nick;
};
void gtk_type_init (void);
GtkType gtk_type_unique (GtkType parent_type,
const GtkTypeInfo *type_info);
void gtk_type_set_chunk_alloc (GtkType type,
guint n_chunks);
gchar* gtk_type_name (GtkType type);
GtkType gtk_type_from_name (const gchar *name);
GtkType gtk_type_parent (GtkType type);
const GtkTypeInfo *gtkinfo);
gpointer gtk_type_class (GtkType type);
gpointer gtk_type_parent_class (GtkType type);
GList* gtk_type_children_types (GtkType type);
gpointer gtk_type_new (GtkType type);
void gtk_type_free (GtkType type,
gpointer mem);
void gtk_type_describe_heritage (GtkType type);
void gtk_type_describe_tree (GtkType type,
gboolean show_size);
gboolean gtk_type_is_a (GtkType type,
GtkType is_a_type);
GtkTypeObject* gtk_type_check_object_cast (GtkTypeObject *type_object,
GtkType cast_type);
GtkTypeClass* gtk_type_check_class_cast (GtkTypeClass *klass,
GtkType cast_type);
GtkType gtk_type_register_enum (const gchar *type_name,
GtkEnumValue *values);
GtkType gtk_type_register_flags (const gchar *type_name,
GtkFlagValue *values);
/* --- initialize the type system --- */
void gtk_type_init (void);
/* --- compatibility defines --- */
#define gtk_type_name g_type_name
#define gtk_type_from_name g_type_from_name
#define gtk_type_parent g_type_parent
#define gtk_type_is_a g_type_is_a
/* enum/flags compatibility functions, we strongly
* recommend to use the glib enum/flags classes directly
*/
typedef GEnumValue GtkEnumValue;
typedef GFlagsValue GtkFlagValue;
GtkEnumValue* gtk_type_enum_get_values (GtkType enum_type);
GtkFlagValue* gtk_type_flags_get_values (GtkType flags_type);
GtkEnumValue* gtk_type_enum_find_value (GtkType enum_type,
const gchar *value_name);
GtkFlagValue* gtk_type_flags_find_value (GtkType flag_type,
GtkFlagValue* gtk_type_flags_find_value (GtkType flags_type,
const gchar *value_name);
/* set the argument collector alias for foreign fundamentals */
void gtk_type_set_varargs_type (GtkType foreign_type,
GtkType varargs_type);
GtkType gtk_type_get_varargs_type (GtkType foreign_type);
/* Report internal information about a type. The caller has the
* responsibility to invoke a subsequent g_free (returned_data); but
* must not modify data pointed to by the members of GtkTypeQuery
*/
GtkTypeQuery* gtk_type_query (GtkType type);
/* urg */
extern GType GTK_TYPE_IDENTIFIER;
#ifdef __cplusplus

View File

@ -38,7 +38,6 @@ enum {
static void gtk_viewport_class_init (GtkViewportClass *klass);
static void gtk_viewport_init (GtkViewport *viewport);
static void gtk_viewport_destroy (GtkObject *object);
static void gtk_viewport_finalize (GtkObject *object);
static void gtk_viewport_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
@ -110,23 +109,9 @@ gtk_viewport_class_init (GtkViewportClass *class)
container_class = (GtkContainerClass*) class;
parent_class = (GtkBinClass*) gtk_type_class (GTK_TYPE_BIN);
gtk_object_add_arg_type ("GtkViewport::hadjustment",
GTK_TYPE_ADJUSTMENT,
GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
ARG_HADJUSTMENT);
gtk_object_add_arg_type ("GtkViewport::vadjustment",
GTK_TYPE_ADJUSTMENT,
GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
ARG_VADJUSTMENT);
gtk_object_add_arg_type ("GtkViewport::shadow_type",
GTK_TYPE_SHADOW_TYPE,
GTK_ARG_READWRITE,
ARG_SHADOW_TYPE);
object_class->set_arg = gtk_viewport_set_arg;
object_class->get_arg = gtk_viewport_get_arg;
object_class->destroy = gtk_viewport_destroy;
object_class->finalize = gtk_viewport_finalize;
widget_class->map = gtk_viewport_map;
widget_class->unmap = gtk_viewport_unmap;
@ -138,17 +123,30 @@ gtk_viewport_class_init (GtkViewportClass *class)
widget_class->size_allocate = gtk_viewport_size_allocate;
widget_class->style_set = gtk_viewport_style_set;
widget_class->set_scroll_adjustments_signal =
gtk_signal_new ("set_scroll_adjustments",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkViewportClass, set_scroll_adjustments),
gtk_marshal_NONE__POINTER_POINTER,
GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
container_class->add = gtk_viewport_add;
class->set_scroll_adjustments = gtk_viewport_set_scroll_adjustments;
gtk_object_add_arg_type ("GtkViewport::hadjustment",
GTK_TYPE_ADJUSTMENT,
GTK_ARG_READWRITE,
ARG_HADJUSTMENT);
gtk_object_add_arg_type ("GtkViewport::vadjustment",
GTK_TYPE_ADJUSTMENT,
GTK_ARG_READWRITE,
ARG_VADJUSTMENT);
gtk_object_add_arg_type ("GtkViewport::shadow_type",
GTK_TYPE_SHADOW_TYPE,
GTK_ARG_READWRITE,
ARG_SHADOW_TYPE);
widget_class->set_scroll_adjustments_signal =
gtk_signal_new ("set_scroll_adjustments",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkViewportClass, set_scroll_adjustments),
gtk_marshal_NONE__POINTER_POINTER,
GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
}
static void
@ -236,24 +234,19 @@ gtk_viewport_destroy (GtkObject *object)
GtkViewport *viewport = GTK_VIEWPORT (object);
if (viewport->hadjustment)
gtk_signal_disconnect_by_data (GTK_OBJECT (viewport->hadjustment),
viewport);
if (viewport->vadjustment)
gtk_signal_disconnect_by_data (GTK_OBJECT (viewport->vadjustment),
viewport);
GTK_OBJECT_CLASS(parent_class)->destroy (object);
}
static void
gtk_viewport_finalize (GtkObject *object)
{
GtkViewport *viewport = GTK_VIEWPORT (object);
{
gtk_signal_disconnect_by_data (GTK_OBJECT (viewport->hadjustment), viewport);
gtk_object_unref (GTK_OBJECT (viewport->hadjustment));
viewport->hadjustment = NULL;
}
if (viewport->vadjustment)
{
gtk_signal_disconnect_by_data (GTK_OBJECT (viewport->vadjustment), viewport);
gtk_object_unref (GTK_OBJECT (viewport->vadjustment));
viewport->vadjustment = NULL;
}
GTK_OBJECT_CLASS(parent_class)->finalize (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
GtkAdjustment*
@ -262,6 +255,9 @@ gtk_viewport_get_hadjustment (GtkViewport *viewport)
g_return_val_if_fail (viewport != NULL, NULL);
g_return_val_if_fail (GTK_IS_VIEWPORT (viewport), NULL);
if (!viewport->hadjustment)
gtk_viewport_set_hadjustment (viewport, NULL);
return viewport->hadjustment;
}
@ -271,6 +267,9 @@ gtk_viewport_get_vadjustment (GtkViewport *viewport)
g_return_val_if_fail (viewport != NULL, NULL);
g_return_val_if_fail (GTK_IS_VIEWPORT (viewport), NULL);
if (!viewport->vadjustment)
gtk_viewport_set_vadjustment (viewport, NULL);
return viewport->vadjustment;
}
@ -285,9 +284,9 @@ gtk_viewport_set_hadjustment (GtkViewport *viewport,
if (viewport->hadjustment && viewport->hadjustment != adjustment)
{
gtk_signal_disconnect_by_data (GTK_OBJECT (viewport->hadjustment),
(gpointer) viewport);
gtk_signal_disconnect_by_data (GTK_OBJECT (viewport->hadjustment), viewport);
gtk_object_unref (GTK_OBJECT (viewport->hadjustment));
viewport->hadjustment = NULL;
}
if (!adjustment)
@ -322,9 +321,9 @@ gtk_viewport_set_vadjustment (GtkViewport *viewport,
if (viewport->vadjustment && viewport->vadjustment != adjustment)
{
gtk_signal_disconnect_by_data (GTK_OBJECT (viewport->vadjustment),
(gpointer) viewport);
gtk_signal_disconnect_by_data (GTK_OBJECT (viewport->vadjustment), viewport);
gtk_object_unref (GTK_OBJECT (viewport->vadjustment));
viewport->vadjustment = NULL;
}
if (!adjustment)
@ -686,6 +685,12 @@ gtk_viewport_size_allocate (GtkWidget *widget,
viewport = GTK_VIEWPORT (widget);
bin = GTK_BIN (widget);
/* demand creation */
if (!viewport->hadjustment)
gtk_viewport_set_hadjustment (viewport, NULL);
if (!viewport->vadjustment)
gtk_viewport_set_hadjustment (viewport, NULL);
border_width = GTK_CONTAINER (widget)->border_width;
child_allocation.x = 0;

View File

@ -30,8 +30,8 @@
#include "gdk/gdkkeysyms.h"
#define SCALE_CLASS(w) GTK_SCALE_CLASS (GTK_OBJECT (w)->klass)
#define RANGE_CLASS(w) GTK_RANGE_CLASS (GTK_OBJECT (w)->klass)
#define SCALE_CLASS(w) GTK_SCALE_GET_CLASS (w)
#define RANGE_CLASS(w) GTK_RANGE_GET_CLASS (w)
enum {
ARG_0,
@ -111,7 +111,7 @@ gtk_vscale_class_init (GtkVScaleClass *class)
gtk_object_add_arg_type ("GtkVScale::adjustment",
GTK_TYPE_ADJUSTMENT,
GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
GTK_ARG_READWRITE,
ARG_ADJUSTMENT);
object_class->set_arg = gtk_vscale_set_arg;

View File

@ -31,7 +31,7 @@
#define EPSILON 0.01
#define RANGE_CLASS(w) GTK_RANGE_CLASS (GTK_OBJECT (w)->klass)
#define RANGE_CLASS(w) GTK_RANGE_GET_CLASS (w)
enum {
ARG_0,
@ -97,7 +97,7 @@ gtk_vscrollbar_class_init (GtkVScrollbarClass *class)
gtk_object_add_arg_type ("GtkVScrollbar::adjustment",
GTK_TYPE_ADJUSTMENT,
GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
GTK_ARG_READWRITE,
ARG_ADJUSTMENT);
object_class->set_arg = gtk_vscrollbar_set_arg;

File diff suppressed because it is too large Load Diff

View File

@ -409,7 +409,7 @@ GtkWidget* gtk_widget_new (GtkType type,
GtkWidget* gtk_widget_newv (GtkType type,
guint nargs,
GtkArg *args);
void gtk_widget_ref (GtkWidget *widget);
GtkWidget* gtk_widget_ref (GtkWidget *widget);
void gtk_widget_unref (GtkWidget *widget);
void gtk_widget_destroy (GtkWidget *widget);
void gtk_widget_destroyed (GtkWidget *widget,

View File

@ -93,9 +93,9 @@ static void gtk_window_set_arg (GtkObject *object,
static void gtk_window_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_window_shutdown (GtkObject *object);
static void gtk_window_shutdown (GObject *object);
static void gtk_window_destroy (GtkObject *object);
static void gtk_window_finalize (GtkObject *object);
static void gtk_window_finalize (GObject *object);
static void gtk_window_show (GtkWidget *widget);
static void gtk_window_hide (GtkWidget *widget);
static void gtk_window_map (GtkWidget *widget);
@ -167,6 +167,7 @@ static GtkWindowGeometryInfo* gtk_window_get_geometry_info (GtkWindow *window,
gboolean create);
static void gtk_window_geometry_destroy (GtkWindowGeometryInfo *info);
static GSList *toplevel_list = NULL;
static GtkBinClass *parent_class = NULL;
static guint window_signals[LAST_SIGNAL] = { 0 };
@ -199,6 +200,7 @@ gtk_window_get_type (void)
static void
gtk_window_class_init (GtkWindowClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
@ -209,6 +211,9 @@ gtk_window_class_init (GtkWindowClass *klass)
parent_class = gtk_type_class (gtk_bin_get_type ());
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);
@ -222,7 +227,7 @@ gtk_window_class_init (GtkWindowClass *klass)
window_signals[SET_FOCUS] =
gtk_signal_new ("set_focus",
GTK_RUN_LAST,
object_class->type,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkWindowClass, set_focus),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
@ -232,9 +237,7 @@ gtk_window_class_init (GtkWindowClass *klass)
object_class->set_arg = gtk_window_set_arg;
object_class->get_arg = gtk_window_get_arg;
object_class->shutdown = gtk_window_shutdown;
object_class->destroy = gtk_window_destroy;
object_class->finalize = gtk_window_finalize;
widget_class->show = gtk_window_show;
widget_class->hide = gtk_window_hide;
@ -283,7 +286,10 @@ gtk_window_init (GtkWindow *window)
window->use_uposition = TRUE;
window->modal = FALSE;
gtk_container_register_toplevel (GTK_CONTAINER (window));
gtk_widget_ref (GTK_WIDGET (window));
gtk_object_sink (GTK_OBJECT (window));
window->has_user_ref_count = TRUE;
toplevel_list = g_slist_prepend (toplevel_list, window);
}
static void
@ -572,6 +578,18 @@ gtk_window_set_modal (GtkWindow *window,
gtk_grab_remove (GTK_WIDGET (window));
}
GList*
gtk_window_list_toplevels (void)
{
GList *list = NULL;
GSList *slist;
for (slist = toplevel_list; slist; slist = slist->next)
list = g_list_prepend (list, gtk_widget_ref (slist->data));
return list;
}
void
gtk_window_add_embedded_xid (GtkWindow *window, guint xid)
{
@ -649,11 +667,10 @@ gtk_window_reposition (GtkWindow *window,
}
static void
gtk_window_shutdown (GtkObject *object)
gtk_window_shutdown (GObject *object)
{
GtkWindow *window;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_WINDOW (object));
window = GTK_WINDOW (object);
@ -661,7 +678,7 @@ gtk_window_shutdown (GtkObject *object)
gtk_window_set_focus (window, NULL);
gtk_window_set_default (window, NULL);
GTK_OBJECT_CLASS (parent_class)->shutdown (object);
G_OBJECT_CLASS (parent_class)->shutdown (object);
}
static void
@ -831,33 +848,38 @@ gtk_window_destroy (GtkObject *object)
{
GtkWindow *window;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_WINDOW (object));
window = GTK_WINDOW (object);
gtk_container_unregister_toplevel (GTK_CONTAINER (object));
if (window->transient_parent)
gtk_window_unset_transient_for (window);
if (window->has_user_ref_count)
{
window->has_user_ref_count = FALSE;
gtk_widget_unref (GTK_WIDGET (window));
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gtk_window_finalize (GtkObject *object)
gtk_window_finalize (GObject *object)
{
GtkWindow *window;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_WINDOW (object));
window = GTK_WINDOW (object);
toplevel_list = g_slist_remove (toplevel_list, window);
g_free (window->title);
g_free (window->wmclass_name);
g_free (window->wmclass_class);
GTK_OBJECT_CLASS(parent_class)->finalize (object);
G_OBJECT_CLASS(parent_class)->finalize (object);
}
static void
@ -1406,14 +1428,14 @@ gtk_window_read_rcfiles (GtkWidget *widget,
* then, the RC file will up to date, so we have to tell
* them now.
*/
GList *toplevels;
GList *list, *toplevels = gtk_window_list_toplevels ();
toplevels = gtk_container_get_toplevels();
while (toplevels)
for (list = toplevels; list; list = list->next)
{
gtk_widget_reset_rc_styles (toplevels->data);
toplevels = toplevels->next;
gtk_widget_reset_rc_styles (list->data);
gtk_widget_unref (list->data);
}
g_list_free (toplevels);
}
}

View File

@ -64,6 +64,7 @@ struct _GtkWindow
GtkWindow *transient_parent;
gushort resize_count;
guint has_user_ref_count : 1;
guint allow_shrink : 1;
guint allow_grow : 1;
guint auto_shrink : 1;
@ -126,6 +127,8 @@ void gtk_window_set_default_size (GtkWindow *window,
/* If window is set modal, input will be grabbed when show and released when hide */
void gtk_window_set_modal (GtkWindow *window,
gboolean modal);
GList* gtk_window_list_toplevels (void);
/* --- internal functions --- */
void gtk_window_set_focus (GtkWindow *window,

View File

@ -124,5 +124,5 @@ function generate (generate_1)
END {
if (gen_macros)
printf("\n#define\tGTK_TYPE_NUM_BUILTINS\t(%u)\n", type_counter);
printf("\n#define\tGTK_TYPE_N_BUILTINS\t(%u)\n", type_counter);
}

View File

@ -311,9 +311,9 @@ target_drag_motion (GtkWidget *widget,
}
source_widget = gtk_drag_get_source_widget (context);
g_print("motion, source %s\n", source_widget ?
gtk_type_name (GTK_OBJECT (source_widget)->klass->type) :
"unknown");
g_print ("motion, source %s\n", source_widget ?
GTK_OBJECT_TYPE_NAME (source_widget) :
"NULL");
gdk_drag_status (context, context->suggested_action, time);
return TRUE;

View File

@ -3290,7 +3290,7 @@ set_cursor (GtkWidget *spinner,
guint c;
GdkCursor *cursor;
GtkWidget *label;
GtkFlagValue *vals;
GtkEnumValue *vals;
c = CLAMP (gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spinner)), 0, 152);
c &= 0xfe;
@ -5660,11 +5660,9 @@ create_rulers (void)
gtk_ruler_set_metric (GTK_RULER (ruler), GTK_CENTIMETERS);
gtk_ruler_set_range (GTK_RULER (ruler), 100, 0, 0, 20);
gtk_signal_connect_object (
GTK_OBJECT (window),
gtk_signal_connect_object (GTK_OBJECT (window),
"motion_notify_event",
GTK_SIGNAL_FUNC(
GTK_WIDGET_CLASS (GTK_OBJECT (ruler)->klass)->motion_notify_event),
GTK_SIGNAL_FUNC (GTK_WIDGET_GET_CLASS (ruler)->motion_notify_event),
GTK_OBJECT (ruler));
gtk_table_attach (GTK_TABLE (table), ruler, 1, 2, 0, 1,
@ -5675,10 +5673,9 @@ create_rulers (void)
ruler = gtk_vruler_new ();
gtk_ruler_set_range (GTK_RULER (ruler), 5, 15, 0, 20);
gtk_signal_connect_object (
GTK_OBJECT (window),
gtk_signal_connect_object (GTK_OBJECT (window),
"motion_notify_event",
GTK_SIGNAL_FUNC (GTK_WIDGET_CLASS (GTK_OBJECT (ruler)->klass)->motion_notify_event),
GTK_SIGNAL_FUNC (GTK_WIDGET_GET_CLASS (ruler)->motion_notify_event),
GTK_OBJECT (ruler));
gtk_table_attach (GTK_TABLE (table), ruler, 0, 1, 1, 2,

View File

@ -311,9 +311,9 @@ target_drag_motion (GtkWidget *widget,
}
source_widget = gtk_drag_get_source_widget (context);
g_print("motion, source %s\n", source_widget ?
gtk_type_name (GTK_OBJECT (source_widget)->klass->type) :
"unknown");
g_print ("motion, source %s\n", source_widget ?
GTK_OBJECT_TYPE_NAME (source_widget) :
"NULL");
gdk_drag_status (context, context->suggested_action, time);
return TRUE;

View File

@ -3290,7 +3290,7 @@ set_cursor (GtkWidget *spinner,
guint c;
GdkCursor *cursor;
GtkWidget *label;
GtkFlagValue *vals;
GtkEnumValue *vals;
c = CLAMP (gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spinner)), 0, 152);
c &= 0xfe;
@ -5660,11 +5660,9 @@ create_rulers (void)
gtk_ruler_set_metric (GTK_RULER (ruler), GTK_CENTIMETERS);
gtk_ruler_set_range (GTK_RULER (ruler), 100, 0, 0, 20);
gtk_signal_connect_object (
GTK_OBJECT (window),
gtk_signal_connect_object (GTK_OBJECT (window),
"motion_notify_event",
GTK_SIGNAL_FUNC(
GTK_WIDGET_CLASS (GTK_OBJECT (ruler)->klass)->motion_notify_event),
GTK_SIGNAL_FUNC (GTK_WIDGET_GET_CLASS (ruler)->motion_notify_event),
GTK_OBJECT (ruler));
gtk_table_attach (GTK_TABLE (table), ruler, 1, 2, 0, 1,
@ -5675,10 +5673,9 @@ create_rulers (void)
ruler = gtk_vruler_new ();
gtk_ruler_set_range (GTK_RULER (ruler), 5, 15, 0, 20);
gtk_signal_connect_object (
GTK_OBJECT (window),
gtk_signal_connect_object (GTK_OBJECT (window),
"motion_notify_event",
GTK_SIGNAL_FUNC (GTK_WIDGET_CLASS (GTK_OBJECT (ruler)->klass)->motion_notify_event),
GTK_SIGNAL_FUNC (GTK_WIDGET_GET_CLASS (ruler)->motion_notify_event),
GTK_OBJECT (ruler));
gtk_table_attach (GTK_TABLE (table), ruler, 0, 1, 1, 2,