[gtk+] Store the buildable name in object data instead of the widget name
- From: Christian Dywan <cdywan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+] Store the buildable name in object data instead of the widget name
- Date: Thu, 3 Dec 2009 12:14:42 +0000 (UTC)
commit 46f5ee1d0c0f4601853ed57e99b1b513f1baa445
Author: Christian Dywan <christian twotoasts de>
Date: Thu Dec 3 13:10:02 2009 +0100
Store the buildable name in object data instead of the widget name
Widget names are used for theming which is why GtkBuilder should
use object data.
Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=591085
docs/reference/gtk/tmpl/gtkbuildable.sgml | 6 ++----
gtk/gtkwidget.c | 7 +++++--
2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/docs/reference/gtk/tmpl/gtkbuildable.sgml b/docs/reference/gtk/tmpl/gtkbuildable.sgml
index 16857ae..935a2c7 100644
--- a/docs/reference/gtk/tmpl/gtkbuildable.sgml
+++ b/docs/reference/gtk/tmpl/gtkbuildable.sgml
@@ -41,10 +41,8 @@ a GtkBuilder UI definition.
@g_iface: the parent class
@set_name: Stores the name attribute given in the GtkBuilder UI definition.
- #GtkWidget maps this to the #GtkWidget:name property, and
- gtk_buildable_set_name() has a fallback implementation that stores
- the name as object data. Implement this method if your object
- has some notion of "name" and it makes sense to map the XML name
+ #GtkWidget stores the name as object data. Implement this method if your
+ object has some notion of "name" and it makes sense to map the XML name
attribute to it.
@get_name: The getter corresponding to @set_name. Implement this
if you implement @set_name.
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 36bbcb4..74392eb 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -10055,6 +10055,7 @@ gtk_widget_ref_accessible (AtkImplementor *implementor)
static GQuark quark_builder_has_default = 0;
static GQuark quark_builder_has_focus = 0;
static GQuark quark_builder_atk_relations = 0;
+static GQuark quark_builder_set_name = 0;
static void
gtk_widget_buildable_interface_init (GtkBuildableIface *iface)
@@ -10062,6 +10063,7 @@ gtk_widget_buildable_interface_init (GtkBuildableIface *iface)
quark_builder_has_default = g_quark_from_static_string ("gtk-builder-has-default");
quark_builder_has_focus = g_quark_from_static_string ("gtk-builder-has-focus");
quark_builder_atk_relations = g_quark_from_static_string ("gtk-builder-atk-relations");
+ quark_builder_set_name = g_quark_from_static_string ("gtk-builder-set-name");
iface->set_name = gtk_widget_buildable_set_name;
iface->get_name = gtk_widget_buildable_get_name;
@@ -10076,13 +10078,14 @@ static void
gtk_widget_buildable_set_name (GtkBuildable *buildable,
const gchar *name)
{
- gtk_widget_set_name (GTK_WIDGET (buildable), name);
+ g_object_set_qdata_full (G_OBJECT (buildable), quark_builder_set_name,
+ g_strdup (name), g_free);
}
static const gchar *
gtk_widget_buildable_get_name (GtkBuildable *buildable)
{
- return gtk_widget_get_name (GTK_WIDGET (buildable));
+ return g_object_get_qdata (G_OBJECT (buildable), quark_builder_set_name);
}
static GObject *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]