replaced some gtk_object_data_force_id with g_quark_from_static_string

Fri Jun 19 03:29:04 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkaccelgroup.c:
        * gtk/gtkbindings.c:
        * gtk/gtkcontainer.c:
        * gtk/gtkitemfactory.c:
        * gtk/gtkobject.c:
        * gtk/gtksignal.c:
        * gtk/gtkwidget.c: replaced some gtk_object_data_force_id with
        g_quark_from_static_string calls to save memory.

        * gtk/gtkobject.c (gtk_object_set_data_by_id_full): invoke the destroy
        function _after_ the new data has been setup.
        minor changes to object data functions to feature the GQuark type.
This commit is contained in:
Tim Janik 1998-06-19 02:07:47 +00:00 committed by Tim Janik
parent 913831b26f
commit 3c90c2cd53
15 changed files with 230 additions and 132 deletions

View File

@ -1,3 +1,18 @@
Fri Jun 19 03:29:04 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.c:
* gtk/gtkbindings.c:
* gtk/gtkcontainer.c:
* gtk/gtkitemfactory.c:
* gtk/gtkobject.c:
* gtk/gtksignal.c:
* gtk/gtkwidget.c: replaced some gtk_object_data_force_id with
g_quark_from_static_string calls to save memory.
* gtk/gtkobject.c (gtk_object_set_data_by_id_full): invoke the destroy
function _after_ the new data has been setup.
minor changes to object data functions to feature the GQuark type.
Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag

View File

@ -1,3 +1,18 @@
Fri Jun 19 03:29:04 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.c:
* gtk/gtkbindings.c:
* gtk/gtkcontainer.c:
* gtk/gtkitemfactory.c:
* gtk/gtkobject.c:
* gtk/gtksignal.c:
* gtk/gtkwidget.c: replaced some gtk_object_data_force_id with
g_quark_from_static_string calls to save memory.
* gtk/gtkobject.c (gtk_object_set_data_by_id_full): invoke the destroy
function _after_ the new data has been setup.
minor changes to object data functions to feature the GQuark type.
Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag

View File

@ -1,3 +1,18 @@
Fri Jun 19 03:29:04 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.c:
* gtk/gtkbindings.c:
* gtk/gtkcontainer.c:
* gtk/gtkitemfactory.c:
* gtk/gtkobject.c:
* gtk/gtksignal.c:
* gtk/gtkwidget.c: replaced some gtk_object_data_force_id with
g_quark_from_static_string calls to save memory.
* gtk/gtkobject.c (gtk_object_set_data_by_id_full): invoke the destroy
function _after_ the new data has been setup.
minor changes to object data functions to feature the GQuark type.
Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag

View File

@ -1,3 +1,18 @@
Fri Jun 19 03:29:04 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.c:
* gtk/gtkbindings.c:
* gtk/gtkcontainer.c:
* gtk/gtkitemfactory.c:
* gtk/gtkobject.c:
* gtk/gtksignal.c:
* gtk/gtkwidget.c: replaced some gtk_object_data_force_id with
g_quark_from_static_string calls to save memory.
* gtk/gtkobject.c (gtk_object_set_data_by_id_full): invoke the destroy
function _after_ the new data has been setup.
minor changes to object data functions to feature the GQuark type.
Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag

View File

@ -1,3 +1,18 @@
Fri Jun 19 03:29:04 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.c:
* gtk/gtkbindings.c:
* gtk/gtkcontainer.c:
* gtk/gtkitemfactory.c:
* gtk/gtkobject.c:
* gtk/gtksignal.c:
* gtk/gtkwidget.c: replaced some gtk_object_data_force_id with
g_quark_from_static_string calls to save memory.
* gtk/gtkobject.c (gtk_object_set_data_by_id_full): invoke the destroy
function _after_ the new data has been setup.
minor changes to object data functions to feature the GQuark type.
Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag

View File

@ -1,3 +1,18 @@
Fri Jun 19 03:29:04 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.c:
* gtk/gtkbindings.c:
* gtk/gtkcontainer.c:
* gtk/gtkitemfactory.c:
* gtk/gtkobject.c:
* gtk/gtksignal.c:
* gtk/gtkwidget.c: replaced some gtk_object_data_force_id with
g_quark_from_static_string calls to save memory.
* gtk/gtkobject.c (gtk_object_set_data_by_id_full): invoke the destroy
function _after_ the new data has been setup.
minor changes to object data functions to feature the GQuark type.
Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag

View File

@ -1,3 +1,18 @@
Fri Jun 19 03:29:04 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.c:
* gtk/gtkbindings.c:
* gtk/gtkcontainer.c:
* gtk/gtkitemfactory.c:
* gtk/gtkobject.c:
* gtk/gtksignal.c:
* gtk/gtkwidget.c: replaced some gtk_object_data_force_id with
g_quark_from_static_string calls to save memory.
* gtk/gtkobject.c (gtk_object_set_data_by_id_full): invoke the destroy
function _after_ the new data has been setup.
minor changes to object data functions to feature the GQuark type.
Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag

View File

@ -94,8 +94,8 @@ gtk_accel_group_new (void)
if (!accel_groups_key_id)
{
accel_groups_key_id = gtk_object_data_force_id (accel_groups_key);
accel_entries_key_id = gtk_object_data_force_id (accel_entries_key);
accel_groups_key_id = g_quark_from_static_string (accel_groups_key);
accel_entries_key_id = g_quark_from_static_string (accel_entries_key);
accel_entry_hash_table = g_hash_table_new (gtk_accel_entries_hash,
gtk_accel_entries_equal);

View File

@ -35,7 +35,7 @@
static GHashTable *binding_entry_hash_table = NULL;
static GSList *binding_set_list = NULL;
static const gchar *key_class_binding_set = "gtk-class-binding-set";
static guint key_id_class_binding_set = 0;
static GQuark key_id_class_binding_set = 0;
/* --- functions --- */
@ -424,7 +424,7 @@ gtk_binding_set_by_class (gpointer object_class)
g_return_val_if_fail (GTK_IS_OBJECT_CLASS (class), NULL);
if (!key_id_class_binding_set)
key_id_class_binding_set = g_dataset_force_id (key_class_binding_set);
key_id_class_binding_set = g_quark_from_static_string (key_class_binding_set);
binding_set = g_dataset_id_get_data (class, key_id_class_binding_set);

View File

@ -164,8 +164,8 @@ gtk_container_class_init (GtkContainerClass *class)
parent_class = gtk_type_class (gtk_widget_get_type ());
vadjustment_key_id = gtk_object_data_force_id (vadjustment_key);
hadjustment_key_id = gtk_object_data_force_id (hadjustment_key);
vadjustment_key_id = g_quark_from_static_string (vadjustment_key);
hadjustment_key_id = g_quark_from_static_string (hadjustment_key);
gtk_object_add_arg_type ("GtkContainer::border_width", GTK_TYPE_ULONG, GTK_ARG_READWRITE, ARG_BORDER_WIDTH);
gtk_object_add_arg_type ("GtkContainer::child", GTK_TYPE_WIDGET, GTK_ARG_WRITABLE, ARG_CHILD);

View File

@ -81,29 +81,29 @@ static const gchar *item_factory_string = "Gtk-<ItemFactory>";
static GMemChunk *ifactory_item_chunks = NULL;
static GMemChunk *ifactory_cb_data_chunks = NULL;
static const gchar *key_popup_data = "GtkItemFactory-popup-data";
static guint key_id_popup_data = 0;
static GQuark quark_popup_data = 0;
static const gchar *key_if_menu_pos = "GtkItemFactory-menu-position";
static guint key_id_if_menu_pos = 0;
static GQuark quark_if_menu_pos = 0;
static const gchar *key_item_factory = "GtkItemFactory";
static guint key_id_item_factory = 0;
static GQuark quark_item_factory = 0;
static const gchar *key_item_factory_path = "GtkItemFactory-path";
static guint key_id_item_factory_path = 0;
static GQuark quark_item_factory_path = 0;
static const gchar *key_type_item = "<Item>";
static guint key_id_type_item = 0;
static GQuark quark_type_item = 0;
static const gchar *key_type_title = "<Title>";
static guint key_id_type_title = 0;
static GQuark quark_type_title = 0;
static const gchar *key_type_radio_item = "<RadioItem>";
static guint key_id_type_radio_item = 0;
static GQuark quark_type_radio_item = 0;
static const gchar *key_type_check_item = "<CheckItem>";
static guint key_id_type_check_item = 0;
static GQuark quark_type_check_item = 0;
static const gchar *key_type_toggle_item = "<ToggleItem>";
static guint key_id_type_toggle_item = 0;
static GQuark quark_type_toggle_item = 0;
static const gchar *key_type_separator_item = "<Separator>";
static guint key_id_type_separator_item = 0;
static GQuark quark_type_separator_item = 0;
static const gchar *key_type_branch = "<Branch>";
static guint key_id_type_branch = 0;
static GQuark quark_type_branch = 0;
static const gchar *key_type_last_branch = "<LastBranch>";
static guint key_id_type_last_branch = 0;
static GQuark quark_type_last_branch = 0;
static GScannerConfig ifactory_scanner_config =
{
(
@ -200,18 +200,18 @@ gtk_item_factory_class_init (GtkItemFactoryClass *class)
sizeof (GtkIFCBData) * ITEM_BLOCK_SIZE,
G_ALLOC_AND_FREE);
key_id_popup_data = gtk_object_data_force_id (key_popup_data);
key_id_if_menu_pos = gtk_object_data_force_id (key_if_menu_pos);
key_id_item_factory = gtk_object_data_force_id (key_item_factory);
key_id_item_factory_path = gtk_object_data_force_id (key_item_factory_path);
key_id_type_item = gtk_object_data_force_id (key_type_item);
key_id_type_title = gtk_object_data_force_id (key_type_title);
key_id_type_radio_item = gtk_object_data_force_id (key_type_radio_item);
key_id_type_check_item = gtk_object_data_force_id (key_type_check_item);
key_id_type_toggle_item = gtk_object_data_force_id (key_type_toggle_item);
key_id_type_separator_item = gtk_object_data_force_id (key_type_separator_item);
key_id_type_branch = gtk_object_data_force_id (key_type_branch);
key_id_type_last_branch = gtk_object_data_force_id (key_type_last_branch);
quark_popup_data = g_quark_from_static_string (key_popup_data);
quark_if_menu_pos = g_quark_from_static_string (key_if_menu_pos);
quark_item_factory = g_quark_from_static_string (key_item_factory);
quark_item_factory_path = g_quark_from_static_string (key_item_factory_path);
quark_type_item = g_quark_from_static_string (key_type_item);
quark_type_title = g_quark_from_static_string (key_type_title);
quark_type_radio_item = g_quark_from_static_string (key_type_radio_item);
quark_type_check_item = g_quark_from_static_string (key_type_check_item);
quark_type_toggle_item = g_quark_from_static_string (key_type_toggle_item);
quark_type_separator_item = g_quark_from_static_string (key_type_separator_item);
quark_type_branch = g_quark_from_static_string (key_type_branch);
quark_type_last_branch = g_quark_from_static_string (key_type_last_branch);
}
static void
@ -388,8 +388,8 @@ gtk_item_factory_item_remove_widget (GtkWidget *widget,
GtkItemFactoryItem *item)
{
item->widgets = g_slist_remove (item->widgets, widget);
gtk_object_remove_data_by_id (GTK_OBJECT (widget), key_id_item_factory);
gtk_object_remove_data_by_id (GTK_OBJECT (widget), key_id_item_factory_path);
gtk_object_remove_data_by_id (GTK_OBJECT (widget), quark_item_factory);
gtk_object_remove_data_by_id (GTK_OBJECT (widget), quark_item_factory_path);
}
static void
@ -469,8 +469,8 @@ gtk_item_factory_add_item (GtkItemFactory *ifactory,
/* set back pointers for the widget
*/
gtk_object_set_data_by_id (GTK_OBJECT (widget), key_id_item_factory, ifactory);
gtk_object_set_data_by_id (GTK_OBJECT (widget), key_id_item_factory_path, item->path);
gtk_object_set_data_by_id (GTK_OBJECT (widget), quark_item_factory, ifactory);
gtk_object_set_data_by_id (GTK_OBJECT (widget), quark_item_factory_path, item->path);
gtk_widget_set_name (widget, item->path);
/* set accelerator group on menu widgets
@ -678,7 +678,7 @@ gtk_item_factory_from_widget (GtkWidget *widget)
g_return_val_if_fail (widget != NULL, NULL);
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
return gtk_object_get_data_by_id (GTK_OBJECT (widget), key_id_item_factory);
return gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_item_factory);
}
gchar*
@ -687,7 +687,7 @@ gtk_item_factory_path_from_widget (GtkWidget *widget)
g_return_val_if_fail (widget != NULL, NULL);
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
return gtk_object_get_data_by_id (GTK_OBJECT (widget), key_id_item_factory_path);
return gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_item_factory_path);
}
static void
@ -903,7 +903,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
entry->item_type[0] == 0)
{
item_type_path = (gpointer) key_type_item;
type_id = key_id_type_item;
type_id = quark_type_item;
}
else
{
@ -912,21 +912,21 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
}
radio_group = NULL;
if (type_id == key_id_type_item)
if (type_id == quark_type_item)
type = GTK_TYPE_MENU_ITEM;
else if (type_id == key_id_type_title)
else if (type_id == quark_type_title)
type = GTK_TYPE_MENU_ITEM;
else if (type_id == key_id_type_radio_item)
else if (type_id == quark_type_radio_item)
type = GTK_TYPE_RADIO_MENU_ITEM;
else if (type_id == key_id_type_check_item)
else if (type_id == quark_type_check_item)
type = GTK_TYPE_CHECK_MENU_ITEM;
else if (type_id == key_id_type_toggle_item)
else if (type_id == quark_type_toggle_item)
type = GTK_TYPE_CHECK_MENU_ITEM;
else if (type_id == key_id_type_separator_item)
else if (type_id == quark_type_separator_item)
type = GTK_TYPE_MENU_ITEM;
else if (type_id == key_id_type_branch)
else if (type_id == quark_type_branch)
type = GTK_TYPE_MENU_ITEM;
else if (type_id == key_id_type_last_branch)
else if (type_id == quark_type_last_branch)
type = GTK_TYPE_MENU_ITEM;
else
{
@ -980,8 +980,8 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
widget = gtk_widget_new (type,
"GtkWidget::visible", TRUE,
"GtkWidget::sensitive", (type_id != key_id_type_separator_item &&
type_id != key_id_type_title),
"GtkWidget::sensitive", (type_id != quark_type_separator_item &&
type_id != quark_type_title),
"GtkWidget::parent", parent,
NULL);
@ -990,7 +990,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
if (GTK_IS_CHECK_MENU_ITEM (widget))
gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (widget), TRUE);
if (type_id != key_id_type_separator_item && *p)
if (type_id != quark_type_separator_item && *p)
{
GtkWidget *label;
@ -1003,10 +1003,10 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
"GtkMisc::xalign", 0.0,
NULL);
}
if (type_id == key_id_type_branch ||
type_id == key_id_type_last_branch)
if (type_id == quark_type_branch ||
type_id == quark_type_last_branch)
{
if (type_id == key_id_type_last_branch)
if (type_id == quark_type_last_branch)
gtk_menu_item_right_justify (GTK_MENU_ITEM (widget));
parent = widget;
@ -1242,7 +1242,7 @@ gtk_item_factory_popup_data_from_widget (GtkWidget *widget)
ifactory = gtk_item_factory_from_widget (widget);
if (ifactory)
return gtk_object_get_data_by_id (GTK_OBJECT (ifactory), key_id_popup_data);
return gtk_object_get_data_by_id (GTK_OBJECT (ifactory), quark_popup_data);
return NULL;
}
@ -1253,7 +1253,7 @@ gtk_item_factory_popup_data (GtkItemFactory *ifactory)
g_return_val_if_fail (ifactory != NULL, NULL);
g_return_val_if_fail (GTK_IS_ITEM_FACTORY (ifactory), NULL);
return gtk_object_get_data_by_id (GTK_OBJECT (ifactory), key_id_popup_data);
return gtk_object_get_data_by_id (GTK_OBJECT (ifactory), quark_popup_data);
}
static void
@ -1263,7 +1263,7 @@ ifactory_delete_popup_data (GtkObject *object,
gtk_signal_disconnect_by_func (object,
GTK_SIGNAL_FUNC (ifactory_delete_popup_data),
ifactory);
gtk_object_remove_data_by_id (GTK_OBJECT (ifactory), key_id_popup_data);
gtk_object_remove_data_by_id (GTK_OBJECT (ifactory), quark_popup_data);
}
void
@ -1293,13 +1293,13 @@ gtk_item_factory_popup_with_data (GtkItemFactory *ifactory,
{
MenuPos *mpos;
mpos = gtk_object_get_data_by_id (GTK_OBJECT (ifactory->widget), key_id_if_menu_pos);
mpos = gtk_object_get_data_by_id (GTK_OBJECT (ifactory->widget), quark_if_menu_pos);
if (!mpos)
{
mpos = g_new0 (MenuPos, 1);
gtk_object_set_data_by_id_full (GTK_OBJECT (ifactory->widget),
key_id_if_menu_pos,
quark_if_menu_pos,
mpos,
g_free);
}
@ -1310,7 +1310,7 @@ gtk_item_factory_popup_with_data (GtkItemFactory *ifactory,
if (popup_data != NULL)
{
gtk_object_set_data_by_id_full (GTK_OBJECT (ifactory),
key_id_popup_data,
quark_popup_data,
popup_data,
destroy);
gtk_signal_connect (GTK_OBJECT (ifactory->widget),

View File

@ -539,7 +539,7 @@ gtk_object_weakref (GtkObject *object,
g_return_if_fail (GTK_IS_OBJECT (object));
if (!weakrefs_key_id)
weakrefs_key_id = gtk_object_data_force_id (weakrefs_key);
weakrefs_key_id = g_quark_from_static_string (weakrefs_key);
weak = g_new (GtkWeakRef, 1);
weak->next = gtk_object_get_data_by_id (object, weakrefs_key_id);
@ -1046,7 +1046,7 @@ gtk_object_get_arg_type (const gchar *arg_name)
void
gtk_object_set_data_by_id (GtkObject *object,
guint data_id,
GQuark data_id,
gpointer data)
{
g_return_if_fail (data_id > 0);
@ -1066,7 +1066,7 @@ gtk_object_set_data (GtkObject *object,
void
gtk_object_set_data_by_id_full (GtkObject *object,
guint data_id,
GQuark data_id,
gpointer data,
GtkDestroyNotify destroy)
{
@ -1093,7 +1093,7 @@ gtk_object_set_data_by_id_full (GtkObject *object,
object->object_data = odata->next;
GTK_OBJECT_DATA_DESTROY (odata);
break;
return;
}
prev = odata;
@ -1102,36 +1102,28 @@ gtk_object_set_data_by_id_full (GtkObject *object,
}
else
{
GtkObjectData *prev;
prev = NULL;
while (odata)
{
if (odata->id == data_id)
{
/* we need to be unlinked while invoking the destroy function
*/
if (odata->destroy)
{
if (prev)
prev->next = odata->next;
else
object->object_data = odata->next;
register GtkDestroyNotify dfunc;
register gpointer ddata;
odata->destroy (odata->data);
odata->next = object->object_data;
object->object_data = odata;
}
odata->data = data;
dfunc = odata->destroy;
ddata = odata->data;
odata->destroy = destroy;
odata->data = data;
/* we need to have updated all structures prior to
* invokation of the destroy function
*/
if (dfunc)
dfunc (ddata);
return;
}
prev = odata;
odata = prev->next;
odata = odata->next;
}
if (gtk_object_data_free_list)
@ -1176,7 +1168,7 @@ gtk_object_set_data_full (GtkObject *object,
gpointer
gtk_object_get_data_by_id (GtkObject *object,
guint data_id)
GQuark data_id)
{
GtkObjectData *odata;
@ -1214,7 +1206,7 @@ gtk_object_get_data (GtkObject *object,
void
gtk_object_remove_data_by_id (GtkObject *object,
guint data_id)
GQuark data_id)
{
if (data_id)
gtk_object_set_data_by_id_full (object, data_id, NULL, NULL);
@ -1246,7 +1238,7 @@ gtk_object_set_user_data (GtkObject *object,
gpointer data)
{
if (!user_data_key_id)
user_data_key_id = gtk_object_data_force_id (user_data_key);
user_data_key_id = g_quark_from_static_string (user_data_key);
gtk_object_set_data_by_id_full (object, user_data_key_id, data, NULL);
}

View File

@ -343,18 +343,18 @@ void gtk_object_remove_data (GtkObject *object,
* These functions are meant for *internal* use only.
*/
void gtk_object_set_data_by_id (GtkObject *object,
guint data_id,
GQuark data_id,
gpointer data);
void gtk_object_set_data_by_id_full (GtkObject *object,
guint data_id,
GQuark data_id,
gpointer data,
GtkDestroyNotify destroy);
gpointer gtk_object_get_data_by_id (GtkObject *object,
guint data_id);
GQuark data_id);
void gtk_object_remove_data_by_id (GtkObject *object,
guint data_id);
#define gtk_object_data_try_key g_dataset_try_key
#define gtk_object_data_force_id g_dataset_force_id
GQuark data_id);
#define gtk_object_data_try_key g_quark_try_string
#define gtk_object_data_force_id g_quark_from_string
/* Set the "user_data" object data field of "object". It should
* be noted that this is no different than calling 'gtk_object_set_data'

View File

@ -65,7 +65,7 @@ struct _GtkSignal
struct _GtkSignalHash
{
GtkType object_type;
guint name_key_id;
GQuark quark;
guint signal_id;
};
@ -172,7 +172,7 @@ static GtkSignalMarshal global_marshaller = NULL;
static GtkSignalDestroy global_destroy_notify = NULL;
static guint gtk_handler_id = 1;
static guint handler_key_id = 0;
static guint handler_quark = 0;
static GHashTable *gtk_signal_hash_table = NULL;
static GtkSignal *gtk_signals = NULL;
static guint gtk_n_signals = 0;
@ -231,14 +231,14 @@ gtk_signal_next_and_invalidate (void)
void
gtk_signal_init (void)
{
if (!handler_key_id)
if (!handler_quark)
{
GtkSignal *zero;
zero = gtk_signal_next_and_invalidate ();
g_assert (zero == NULL);
handler_key_id = gtk_object_data_force_id ("gtk-signal-handlers");
handler_quark = g_quark_from_static_string ("gtk-signal-handlers");
gtk_signal_hash_mem_chunk =
g_mem_chunk_new ("GtkSignalHash mem chunk",
@ -270,7 +270,7 @@ gtk_signal_newv (const gchar *r_name,
{
GtkSignal *signal;
GtkSignalHash *hash;
guint id;
GQuark quark;
guint i;
gchar *name;
@ -280,15 +280,15 @@ gtk_signal_newv (const gchar *r_name,
if (nparams)
g_return_val_if_fail (params != NULL, 0);
if (!handler_key_id)
if (!handler_quark)
gtk_signal_init ();
name = g_strdup (r_name);
g_strdelimit (name, NULL, '_');
id = gtk_signal_lookup (name, object_type);
if (id)
quark = gtk_signal_lookup (name, object_type);
if (quark)
{
g_warning ("gtk_signal_newv(): signal \"%s\" already exists in the `%s' class ancestry\n",
r_name,
@ -302,6 +302,7 @@ gtk_signal_newv (const gchar *r_name,
{
g_warning ("gtk_signal_newv(): signal \"%s\" with return value `%s' excludes GTK_RUN_LAST",
name, gtk_type_name (return_val));
g_free (name);
return 0;
}
@ -331,19 +332,19 @@ gtk_signal_newv (const gchar *r_name,
*/
hash = g_chunk_new (GtkSignalHash, gtk_signal_hash_mem_chunk);
hash->object_type = object_type;
hash->name_key_id = gtk_object_data_force_id (signal->name);
hash->quark = g_quark_from_string (signal->name);
hash->signal_id = signal->signal_id;
g_hash_table_insert (gtk_signal_hash_table, hash, GUINT_TO_POINTER (hash->signal_id));
/* insert "signal-name" into hash table
*/
g_strdelimit (signal->name, NULL, '-');
id = gtk_object_data_force_id (signal->name);
if (id != hash->name_key_id)
quark = g_quark_from_static_string (signal->name);
if (quark != hash->quark)
{
hash = g_chunk_new (GtkSignalHash, gtk_signal_hash_mem_chunk);
hash->object_type = object_type;
hash->name_key_id = id;
hash->quark = quark;
hash->signal_id = signal->signal_id;
g_hash_table_insert (gtk_signal_hash_table, hash, GUINT_TO_POINTER (hash->signal_id));
}
@ -405,8 +406,8 @@ gtk_signal_lookup (const gchar *name,
g_return_val_if_fail (name != NULL, 0);
g_return_val_if_fail (gtk_type_is_a (object_type, GTK_TYPE_OBJECT), 0);
hash.name_key_id = gtk_object_data_try_key (name);
if (hash.name_key_id)
hash.quark = g_quark_try_string (name);
if (hash.quark)
{
while (object_type)
{
@ -886,7 +887,7 @@ gtk_signal_disconnect (GtkObject *object,
g_return_if_fail (object != NULL);
g_return_if_fail (handler_id > 0);
handler = gtk_object_get_data_by_id (object, handler_key_id);
handler = gtk_object_get_data_by_id (object, handler_quark);
while (handler)
{
@ -915,7 +916,7 @@ gtk_signal_disconnect_by_func (GtkObject *object,
g_return_if_fail (func != NULL);
found_one = FALSE;
handler = gtk_object_get_data_by_id (object, handler_key_id);
handler = gtk_object_get_data_by_id (object, handler_quark);
while (handler)
{
@ -948,7 +949,7 @@ gtk_signal_disconnect_by_data (GtkObject *object,
g_return_if_fail (object != NULL);
found_one = FALSE;
handler = gtk_object_get_data_by_id (object, handler_key_id);
handler = gtk_object_get_data_by_id (object, handler_quark);
while (handler)
{
@ -979,7 +980,7 @@ gtk_signal_handler_block (GtkObject *object,
g_return_if_fail (object != NULL);
g_return_if_fail (handler_id > 0);
handler = gtk_object_get_data_by_id (object, handler_key_id);
handler = gtk_object_get_data_by_id (object, handler_quark);
while (handler)
{
@ -1006,7 +1007,7 @@ gtk_signal_handler_block_by_func (GtkObject *object,
g_return_if_fail (func != NULL);
found_one = FALSE;
handler = gtk_object_get_data_by_id (object, handler_key_id);
handler = gtk_object_get_data_by_id (object, handler_quark);
while (handler)
{
@ -1034,7 +1035,7 @@ gtk_signal_handler_block_by_data (GtkObject *object,
g_return_if_fail (object != NULL);
found_one = FALSE;
handler = gtk_object_get_data_by_id (object, handler_key_id);
handler = gtk_object_get_data_by_id (object, handler_quark);
while (handler)
{
@ -1060,7 +1061,7 @@ gtk_signal_handler_unblock (GtkObject *object,
g_return_if_fail (object != NULL);
g_return_if_fail (handler_id > 0);
handler = gtk_object_get_data_by_id (object, handler_key_id);
handler = gtk_object_get_data_by_id (object, handler_quark);
while (handler)
{
@ -1090,7 +1091,7 @@ gtk_signal_handler_unblock_by_func (GtkObject *object,
g_return_if_fail (func != NULL);
found_one = FALSE;
handler = gtk_object_get_data_by_id (object, handler_key_id);
handler = gtk_object_get_data_by_id (object, handler_quark);
while (handler)
{
@ -1119,7 +1120,7 @@ gtk_signal_handler_unblock_by_data (GtkObject *object,
g_return_if_fail (object != NULL);
found_one = FALSE;
handler = gtk_object_get_data_by_id (object, handler_key_id);
handler = gtk_object_get_data_by_id (object, handler_quark);
while (handler)
{
@ -1147,7 +1148,7 @@ gtk_signal_handlers_destroy (GtkObject *object)
* handler_key data on each removal
*/
handler = gtk_object_get_data_by_id (object, handler_key_id);
handler = gtk_object_get_data_by_id (object, handler_quark);
if (handler)
{
handler = handler->next;
@ -1159,7 +1160,7 @@ gtk_signal_handlers_destroy (GtkObject *object)
gtk_signal_handler_unref (handler, object);
handler = next;
}
handler = gtk_object_get_data_by_id (object, handler_key_id);
handler = gtk_object_get_data_by_id (object, handler_quark);
gtk_signal_handler_unref (handler, object);
}
}
@ -1190,7 +1191,7 @@ gtk_signal_hash (gconstpointer h)
{
register const GtkSignalHash *hash = h;
return hash->object_type ^ hash->name_key_id;
return hash->object_type ^ hash->quark;
}
static gint
@ -1200,7 +1201,7 @@ gtk_signal_compare (gconstpointer h1,
register const GtkSignalHash *hash1 = h1;
register const GtkSignalHash *hash2 = h2;
return (hash1->name_key_id == hash2->name_key_id &&
return (hash1->quark == hash2->quark &&
hash1->object_type == hash2->object_type);
}
@ -1288,11 +1289,11 @@ gtk_signal_handler_unref (GtkHandler *handler,
if (handler->prev)
handler->prev->next = handler->next;
else if (handler->next)
gtk_object_set_data_by_id (object, handler_key_id, handler->next);
gtk_object_set_data_by_id (object, handler_quark, handler->next);
else
{
GTK_OBJECT_UNSET_FLAGS (object, GTK_CONNECTED);
gtk_object_set_data_by_id (object, handler_key_id, NULL);
gtk_object_set_data_by_id (object, handler_quark, NULL);
}
if (handler->next)
handler->next->prev = handler->prev;
@ -1311,11 +1312,11 @@ gtk_signal_handler_insert (GtkObject *object,
/* FIXME: remove */ g_assert (handler->next == NULL);
/* FIXME: remove */ g_assert (handler->prev == NULL);
tmp = gtk_object_get_data_by_id (object, handler_key_id);
tmp = gtk_object_get_data_by_id (object, handler_quark);
if (!tmp)
{
GTK_OBJECT_SET_FLAGS (object, GTK_CONNECTED);
gtk_object_set_data_by_id (object, handler_key_id, handler);
gtk_object_set_data_by_id (object, handler_quark, handler);
}
else
while (tmp)
@ -1328,7 +1329,7 @@ gtk_signal_handler_insert (GtkObject *object,
handler->prev = tmp->prev;
}
else
gtk_object_set_data_by_id (object, handler_key_id, handler);
gtk_object_set_data_by_id (object, handler_quark, handler);
tmp->prev = handler;
handler->next = tmp;
break;
@ -1469,7 +1470,7 @@ gtk_signal_get_handlers (GtkObject *object,
{
GtkHandler *handlers;
handlers = gtk_object_get_data_by_id (object, handler_key_id);
handlers = gtk_object_get_data_by_id (object, handler_quark);
while (handlers)
{

View File

@ -2640,7 +2640,7 @@ gtk_widget_set_style (GtkWidget *widget,
{
gtk_style_ref (widget->style);
if (!saved_default_style_key_id)
saved_default_style_key_id = gtk_object_data_force_id (saved_default_style_key);
saved_default_style_key_id = g_quark_from_static_string (saved_default_style_key);
gtk_object_set_data_by_id (GTK_OBJECT (widget), saved_default_style_key_id, widget->style);
}
@ -2677,7 +2677,7 @@ gtk_widget_set_rc_style (GtkWidget *widget)
{
gtk_style_ref (widget->style);
if (!saved_default_style_key_id)
saved_default_style_key_id = gtk_object_data_force_id (saved_default_style_key);
saved_default_style_key_id = g_quark_from_static_string (saved_default_style_key);
gtk_object_set_data_by_id (GTK_OBJECT (widget), saved_default_style_key_id, widget->style);
}
gtk_widget_set_style_internal (widget, new_style, initial_emission);
@ -2889,7 +2889,7 @@ gtk_widget_set_parent_window (GtkWidget *widget,
if (parent_window != old_parent_window)
{
if (!parent_window_key_id)
parent_window_key_id = gtk_object_data_force_id (parent_window_key);
parent_window_key_id = g_quark_from_static_string (parent_window_key);
gtk_object_set_data_by_id (GTK_OBJECT (widget), parent_window_key_id,
parent_window);
if (old_parent_window)
@ -2946,7 +2946,7 @@ gtk_widget_set_uposition (GtkWidget *widget,
if (!aux_info)
{
if (!aux_info_key_id)
aux_info_key_id = gtk_object_data_force_id (aux_info_key);
aux_info_key_id = g_quark_from_static_string (aux_info_key);
aux_info = gtk_widget_aux_info_new ();
gtk_object_set_data_by_id (GTK_OBJECT (widget), aux_info_key_id, aux_info);
}
@ -2988,7 +2988,7 @@ gtk_widget_set_usize (GtkWidget *widget,
if (!aux_info)
{
if (!aux_info_key_id)
aux_info_key_id = gtk_object_data_force_id (aux_info_key);
aux_info_key_id = g_quark_from_static_string (aux_info_key);
aux_info = gtk_widget_aux_info_new ();
gtk_object_set_data_by_id (GTK_OBJECT (widget), aux_info_key_id, aux_info);
}
@ -3029,7 +3029,7 @@ gtk_widget_set_events (GtkWidget *widget,
*eventp = events;
if (!event_key_id)
event_key_id = gtk_object_data_force_id (event_key);
event_key_id = g_quark_from_static_string (event_key);
gtk_object_set_data_by_id (GTK_OBJECT (widget), event_key_id, eventp);
}
else if (eventp)
@ -3062,7 +3062,7 @@ gtk_widget_set_extension_events (GtkWidget *widget,
*modep = mode;
if (!extension_event_key_id)
extension_event_key_id = gtk_object_data_force_id (extension_event_key);
extension_event_key_id = g_quark_from_static_string (extension_event_key);
gtk_object_set_data_by_id (GTK_OBJECT (widget), extension_event_key_id, modep);
}