From ab6b184e9d7b9dbb50e3571b26e32f5c1a74bdce Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Sun, 5 Nov 2000 05:08:05 +0000 Subject: [PATCH] provide a toggle button to temporarily disable position recording in the Sun Nov 5 05:32:39 2000 Tim Janik * gtk/testgtk.c (uposition_stop_configure): provide a toggle button to temporarily disable position recording in the "saved position" test. Sat Nov 4 05:37:17 2000 Tim Janik * gtk/gtkthemes.c: added compat code that temporarily implements GtkThemeEnginePlugin as a GObject exporting GTypePlugin. this is going to be revamped by owen's upcoming GtkModule patches, but untill then people want gtk to build, right? ;) --- ChangeLog | 13 +++++ ChangeLog.pre-2-0 | 13 +++++ ChangeLog.pre-2-10 | 13 +++++ ChangeLog.pre-2-2 | 13 +++++ ChangeLog.pre-2-4 | 13 +++++ ChangeLog.pre-2-6 | 13 +++++ ChangeLog.pre-2-8 | 13 +++++ gtk/gtkobject.c | 2 +- gtk/gtksignal.c | 4 +- gtk/gtkthemes.c | 131 ++++++++++++++++++++++++++++++++++----------- gtk/testgtk.c | 16 ++++++ tests/testgtk.c | 16 ++++++ 12 files changed, 226 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index d467096e98..a1d0f47ebb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Sun Nov 5 05:32:39 2000 Tim Janik + + * gtk/testgtk.c (uposition_stop_configure): provide a toggle + button to temporarily disable position recording in the + "saved position" test. + +Sat Nov 4 05:37:17 2000 Tim Janik + + * gtk/gtkthemes.c: added compat code that temporarily implements + GtkThemeEnginePlugin as a GObject exporting GTypePlugin. this is + going to be revamped by owen's upcoming GtkModule patches, but + untill then people want gtk to build, right? ;) + 2000-11-04 Havoc Pennington * gtk/gtkenums.h: remove trailing comma from GtkDeleteType member diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index d467096e98..a1d0f47ebb 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,16 @@ +Sun Nov 5 05:32:39 2000 Tim Janik + + * gtk/testgtk.c (uposition_stop_configure): provide a toggle + button to temporarily disable position recording in the + "saved position" test. + +Sat Nov 4 05:37:17 2000 Tim Janik + + * gtk/gtkthemes.c: added compat code that temporarily implements + GtkThemeEnginePlugin as a GObject exporting GTypePlugin. this is + going to be revamped by owen's upcoming GtkModule patches, but + untill then people want gtk to build, right? ;) + 2000-11-04 Havoc Pennington * gtk/gtkenums.h: remove trailing comma from GtkDeleteType member diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index d467096e98..a1d0f47ebb 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,16 @@ +Sun Nov 5 05:32:39 2000 Tim Janik + + * gtk/testgtk.c (uposition_stop_configure): provide a toggle + button to temporarily disable position recording in the + "saved position" test. + +Sat Nov 4 05:37:17 2000 Tim Janik + + * gtk/gtkthemes.c: added compat code that temporarily implements + GtkThemeEnginePlugin as a GObject exporting GTypePlugin. this is + going to be revamped by owen's upcoming GtkModule patches, but + untill then people want gtk to build, right? ;) + 2000-11-04 Havoc Pennington * gtk/gtkenums.h: remove trailing comma from GtkDeleteType member diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index d467096e98..a1d0f47ebb 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,16 @@ +Sun Nov 5 05:32:39 2000 Tim Janik + + * gtk/testgtk.c (uposition_stop_configure): provide a toggle + button to temporarily disable position recording in the + "saved position" test. + +Sat Nov 4 05:37:17 2000 Tim Janik + + * gtk/gtkthemes.c: added compat code that temporarily implements + GtkThemeEnginePlugin as a GObject exporting GTypePlugin. this is + going to be revamped by owen's upcoming GtkModule patches, but + untill then people want gtk to build, right? ;) + 2000-11-04 Havoc Pennington * gtk/gtkenums.h: remove trailing comma from GtkDeleteType member diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index d467096e98..a1d0f47ebb 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,16 @@ +Sun Nov 5 05:32:39 2000 Tim Janik + + * gtk/testgtk.c (uposition_stop_configure): provide a toggle + button to temporarily disable position recording in the + "saved position" test. + +Sat Nov 4 05:37:17 2000 Tim Janik + + * gtk/gtkthemes.c: added compat code that temporarily implements + GtkThemeEnginePlugin as a GObject exporting GTypePlugin. this is + going to be revamped by owen's upcoming GtkModule patches, but + untill then people want gtk to build, right? ;) + 2000-11-04 Havoc Pennington * gtk/gtkenums.h: remove trailing comma from GtkDeleteType member diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index d467096e98..a1d0f47ebb 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,16 @@ +Sun Nov 5 05:32:39 2000 Tim Janik + + * gtk/testgtk.c (uposition_stop_configure): provide a toggle + button to temporarily disable position recording in the + "saved position" test. + +Sat Nov 4 05:37:17 2000 Tim Janik + + * gtk/gtkthemes.c: added compat code that temporarily implements + GtkThemeEnginePlugin as a GObject exporting GTypePlugin. this is + going to be revamped by owen's upcoming GtkModule patches, but + untill then people want gtk to build, right? ;) + 2000-11-04 Havoc Pennington * gtk/gtkenums.h: remove trailing comma from GtkDeleteType member diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index d467096e98..a1d0f47ebb 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,16 @@ +Sun Nov 5 05:32:39 2000 Tim Janik + + * gtk/testgtk.c (uposition_stop_configure): provide a toggle + button to temporarily disable position recording in the + "saved position" test. + +Sat Nov 4 05:37:17 2000 Tim Janik + + * gtk/gtkthemes.c: added compat code that temporarily implements + GtkThemeEnginePlugin as a GObject exporting GTypePlugin. this is + going to be revamped by owen's upcoming GtkModule patches, but + untill then people want gtk to build, right? ;) + 2000-11-04 Havoc Pennington * gtk/gtkenums.h: remove trailing comma from GtkDeleteType member diff --git a/gtk/gtkobject.c b/gtk/gtkobject.c index 47c606de95..c1df707cb8 100644 --- a/gtk/gtkobject.c +++ b/gtk/gtkobject.c @@ -232,7 +232,7 @@ gtk_object_shutdown (GObject *gobject) static void gtk_object_real_destroy (GtkObject *object) { - _g_signal_handlers_destroy (G_OBJECT (object)); + g_signal_handlers_destroy (G_OBJECT (object)); } static void diff --git a/gtk/gtksignal.c b/gtk/gtksignal.c index 219680dc13..e399423e20 100644 --- a/gtk/gtksignal.c +++ b/gtk/gtksignal.c @@ -173,8 +173,8 @@ gtk_signal_compat_matched (GtkObject *object, } if (!n_handlers) - g_warning ("unable to find signal handler for object(%p) with func(%p) and data(%p)", - object, func, data); + g_warning ("unable to find signal handler for object(%s:%p) with func(%p) and data(%p)", + G_OBJECT_TYPE_NAME (object), object, func, data); } static inline gboolean diff --git a/gtk/gtkthemes.c b/gtk/gtkthemes.c index 61b7fc1821..dc10495400 100644 --- a/gtk/gtkthemes.c +++ b/gtk/gtkthemes.c @@ -37,7 +37,95 @@ #include "config.h" #include "gtkintl.h" +/***************************** + ***************************** + * temporary compat code, make GtkThemeEnginePlugin a GObject plus GTypePlugin interface + */ typedef struct _GtkThemeEnginePlugin GtkThemeEnginePlugin; +typedef struct _GObjectClass GtkThemeEnginePluginClass; +static void gtk_theme_engine_plugin_use (GTypePlugin *plugin); +static void gtk_theme_engine_plugin_unuse (GTypePlugin *plugin); +static void gtk_theme_engine_plugin_complete_type_info (GTypePlugin *plugin, + GType g_type, + GTypeInfo *info, + GTypeValueTable *value_table); +GType gtk_theme_engine_plugin_get_type (void); +struct _GtkThemeEnginePlugin +{ + GObject parent_instance; + + GtkThemeEngine *engine; + gchar *engine_name; + GTypeInfo info; + GType type; + GType parent_type; +}; +#define GTK_TYPE_THEME_ENGINE_PLUGIN (gtk_theme_engine_plugin_get_type ()) +#define GTK_THEME_ENGINE_PLUGIN(plugin) (G_TYPE_CHECK_INSTANCE_CAST ((plugin), GTK_TYPE_THEME_ENGINE_PLUGIN, GtkThemeEnginePlugin)) +#define GTK_THEME_ENGINE_PLUGIN_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), GTK_TYPE_THEME_ENGINE_PLUGIN, GtkThemeEnginePluginClass)) +#define GTK_IS_THEME_ENGINE_PLUGIN(plugin) (G_TYPE_CHECK_INSTANCE_TYPE ((plugin), GTK_TYPE_THEME_ENGINE_PLUGIN)) +#define GTK_IS_THEME_ENGINE_PLUGIN_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), GTK_TYPE_THEME_ENGINE_PLUGIN)) +#define GTK_THEME_ENGINE_PLUGIN_GET_CLASS(plugin) (G_TYPE_INSTANCE_GET_CLASS ((plugin), GTK_TYPE_THEME_ENGINE_PLUGIN, GtkThemeEnginePluginClass)) +static void +gtk_theme_engine_plugin_shutdown (GObject *object) +{ + GtkThemeEnginePlugin *plugin = GTK_THEME_ENGINE_PLUGIN (object); + + g_warning (G_STRLOC ": shutdown should never happen for static type plugins"); + + g_object_ref (object); + + /* chain parent class handler */ + G_OBJECT_CLASS (g_type_class_peek_parent (GTK_THEME_ENGINE_PLUGIN_GET_CLASS (plugin)))->shutdown (object); +} +static void +gtk_theme_engine_plugin_class_init (GtkThemeEnginePluginClass *class) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (class); + + gobject_class->shutdown = gtk_theme_engine_plugin_shutdown; +} +static void +theme_engine_plugin_iface_init (GTypePluginClass *iface) +{ + iface->use_plugin = gtk_theme_engine_plugin_use; + iface->unuse_plugin = gtk_theme_engine_plugin_unuse; + iface->complete_type_info = gtk_theme_engine_plugin_complete_type_info; +} +GType +gtk_theme_engine_plugin_get_type (void) +{ + static GType theme_engine_plugin_type = 0; + + if (!theme_engine_plugin_type) + { + static const GTypeInfo theme_engine_plugin_info = { + sizeof (GtkThemeEnginePluginClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_theme_engine_plugin_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkThemeEnginePlugin), + 0, /* n_preallocs */ + NULL, /* instance_init */ + }; + static const GInterfaceInfo iface_info = { + (GInterfaceInitFunc) theme_engine_plugin_iface_init, + NULL, /* interface_finalize */ + NULL, /* interface_data */ + }; + + theme_engine_plugin_type = g_type_register_static (G_TYPE_OBJECT, "GtkThemeEnginePlugin", &theme_engine_plugin_info, 0); + + g_type_add_interface_static (theme_engine_plugin_type, G_TYPE_TYPE_PLUGIN, &iface_info); + } + + return theme_engine_plugin_type; +} +/* end of GtkThemeEnginePlugin object implementation stuff + ***************************** + *****************************/ struct _GtkThemeEngine { @@ -54,17 +142,6 @@ struct _GtkThemeEngine guint refcount; }; -struct _GtkThemeEnginePlugin -{ - GTypePlugin plugin; - - GtkThemeEngine *engine; - gchar *engine_name; - GTypeInfo info; - GType type; - GType parent_type; -}; - static GHashTable *engine_hash = NULL; #ifdef __EMX__ @@ -217,9 +294,9 @@ gtk_theme_engine_create_rc_style (GtkThemeEngine *engine) } static void -gtk_theme_engine_plugin_ref (GTypePlugin *plugin) +gtk_theme_engine_plugin_use (GTypePlugin *plugin) { - GtkThemeEnginePlugin *theme_plugin = (GtkThemeEnginePlugin *)plugin; + GtkThemeEnginePlugin *theme_plugin = GTK_THEME_ENGINE_PLUGIN (plugin); if (theme_plugin->engine == NULL) { @@ -237,9 +314,9 @@ gtk_theme_engine_plugin_ref (GTypePlugin *plugin) } static void -gtk_theme_engine_plugin_unref (GTypePlugin *plugin) +gtk_theme_engine_plugin_unuse (GTypePlugin *plugin) { - GtkThemeEnginePlugin *theme_plugin = (GtkThemeEnginePlugin *)plugin; + GtkThemeEnginePlugin *theme_plugin = GTK_THEME_ENGINE_PLUGIN (plugin); g_return_if_fail (theme_plugin->engine != NULL); @@ -247,23 +324,16 @@ gtk_theme_engine_plugin_unref (GTypePlugin *plugin) } static void -gtk_theme_engine_complete_type_info (GTypePlugin *plugin, - GType g_type, - GTypeInfo *info, - GTypeValueTable *value_table) +gtk_theme_engine_plugin_complete_type_info (GTypePlugin *plugin, + GType g_type, + GTypeInfo *info, + GTypeValueTable *value_table) { - GtkThemeEnginePlugin *theme_plugin = (GtkThemeEnginePlugin *)plugin; + GtkThemeEnginePlugin *theme_plugin = GTK_THEME_ENGINE_PLUGIN (plugin); *info = theme_plugin->info; } -static GTypePluginVTable gtk_theme_engine_plugin_vtable = { - gtk_theme_engine_plugin_ref, - gtk_theme_engine_plugin_unref, - gtk_theme_engine_complete_type_info, - NULL -}; - /** * gtk_theme_engine_register_type: * @engine: a #GtkThemeEngine @@ -296,16 +366,15 @@ gtk_theme_engine_register_type (GtkThemeEngine *engine, type = g_type_from_name (type_name); if (type) - plugin = (GtkThemeEnginePlugin *)g_type_get_plugin (type); + plugin = GTK_THEME_ENGINE_PLUGIN (g_type_get_plugin (type)); else { - plugin = g_new (GtkThemeEnginePlugin, 1); + plugin = g_object_new (GTK_TYPE_THEME_ENGINE_PLUGIN, NULL); - plugin->plugin.vtable = >k_theme_engine_plugin_vtable; plugin->engine = NULL; plugin->engine_name = NULL; plugin->parent_type = parent_type; - plugin->type = g_type_register_dynamic (parent_type, type_name, (GTypePlugin *) plugin, 0); + plugin->type = g_type_register_dynamic (parent_type, type_name, G_TYPE_PLUGIN (plugin), 0); } if (plugin->engine) diff --git a/gtk/testgtk.c b/gtk/testgtk.c index b714be3690..126cf04aa1 100644 --- a/gtk/testgtk.c +++ b/gtk/testgtk.c @@ -2265,6 +2265,16 @@ uposition_configure (GtkWidget *window) return FALSE; } +static void +uposition_stop_configure (GtkToggleButton *toggle, + GtkObject *window) +{ + if (toggle->active) + gtk_signal_handler_block_by_func (window, uposition_configure, NULL); + else + gtk_signal_handler_unblock_by_func (window, uposition_configure, NULL); +} + static void create_saved_position (void) { @@ -2304,6 +2314,12 @@ create_saved_position (void) "GtkContainer::border_width", 10, "GtkWidget::parent", main_vbox, "GtkWidget::visible", TRUE, + "child", gtk_widget_new (GTK_TYPE_TOGGLE_BUTTON, + "label", "Stop Events", + "active", FALSE, + "signal::clicked", uposition_stop_configure, window, + "visible", TRUE, + NULL), NULL); hbox = gtk_hbox_new (FALSE, 0); diff --git a/tests/testgtk.c b/tests/testgtk.c index b714be3690..126cf04aa1 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -2265,6 +2265,16 @@ uposition_configure (GtkWidget *window) return FALSE; } +static void +uposition_stop_configure (GtkToggleButton *toggle, + GtkObject *window) +{ + if (toggle->active) + gtk_signal_handler_block_by_func (window, uposition_configure, NULL); + else + gtk_signal_handler_unblock_by_func (window, uposition_configure, NULL); +} + static void create_saved_position (void) { @@ -2304,6 +2314,12 @@ create_saved_position (void) "GtkContainer::border_width", 10, "GtkWidget::parent", main_vbox, "GtkWidget::visible", TRUE, + "child", gtk_widget_new (GTK_TYPE_TOGGLE_BUTTON, + "label", "Stop Events", + "active", FALSE, + "signal::clicked", uposition_stop_configure, window, + "visible", TRUE, + NULL), NULL); hbox = gtk_hbox_new (FALSE, 0);