builder: Convert to g_object_notify_by_pspec

This avoids pspec lookup overhead in g_object_notify.
This commit is contained in:
Matthias Clasen 2015-09-06 15:04:19 -04:00
parent 2e52310d4b
commit 14c0ed8bae

View File

@ -242,8 +242,11 @@ static GType gtk_builder_real_get_type_from_name (GtkBuilder *builder,
enum { enum {
PROP_0, PROP_0,
PROP_TRANSLATION_DOMAIN, PROP_TRANSLATION_DOMAIN,
LAST_PROP
}; };
static GParamSpec *builder_props[LAST_PROP];
struct _GtkBuilderPrivate struct _GtkBuilderPrivate
{ {
gchar *domain; gchar *domain;
@ -283,13 +286,14 @@ gtk_builder_class_init (GtkBuilderClass *klass)
* *
* Since: 2.12 * Since: 2.12
*/ */
g_object_class_install_property (gobject_class, builder_props[PROP_TRANSLATION_DOMAIN] =
PROP_TRANSLATION_DOMAIN, g_param_spec_string ("translation-domain",
g_param_spec_string ("translation-domain", P_("Translation Domain"),
P_("Translation Domain"), P_("The translation domain used by gettext"),
P_("The translation domain used by gettext"), NULL,
NULL, GTK_PARAM_READWRITE);
GTK_PARAM_READWRITE));
g_object_class_install_properties (gobject_class, LAST_PROP, builder_props);
} }
static void static void
@ -1496,7 +1500,7 @@ gtk_builder_set_translation_domain (GtkBuilder *builder,
g_free (builder->priv->domain); g_free (builder->priv->domain);
builder->priv->domain = new_domain; builder->priv->domain = new_domain;
g_object_notify (G_OBJECT (builder), "translation-domain"); g_object_notify_by_pspec (G_OBJECT (builder), builder_props[PROP_TRANSLATION_DOMAIN]);
} }
/** /**