]> Pileus Git - ~andy/gtk/commitdiff
Store the buildable name in object data instead of the widget name
authorChristian Dywan <christian@twotoasts.de>
Thu, 3 Dec 2009 12:10:02 +0000 (13:10 +0100)
committerChristian Dywan <christian@twotoasts.de>
Thu, 3 Dec 2009 12:10:02 +0000 (13:10 +0100)
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
gtk/gtkwidget.c

index 16857ae60ccc29ec6070de3041e8cbfea3c44677..935a2c77f665df3d4c1eba7e9c0d7dd035747c52 100644 (file)
@@ -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.
index 36bbcb4ee5ab17733151735b544957726b9cf409..74392eb0b3d5a16c4a08f4372ec50ce582023efb 100644 (file)
@@ -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 *