Commit 175c57eb authored by Matthias Clasen's avatar Matthias Clasen

Small optimization

We can use the fact that all involved strings are interned; also
deprecate gtk_binding_set_add_path() in the headers, too.
parent f67ab808
......@@ -736,15 +736,28 @@ gtk_binding_set_by_class (gpointer object_class)
return binding_set;
binding_set = gtk_binding_set_new (g_type_name (G_OBJECT_CLASS_TYPE (class)));
gtk_binding_set_add_path (binding_set,
GTK_PATH_CLASS,
g_type_name (G_OBJECT_CLASS_TYPE (class)),
GTK_PATH_PRIO_GTK);
g_dataset_id_set_data (class, key_id_class_binding_set, binding_set);
return binding_set;
}
static GtkBindingSet*
gtk_binding_set_find_interned (const gchar *set_name)
{
GSList *slist;
for (slist = binding_set_list; slist; slist = slist->next)
{
GtkBindingSet *binding_set;
binding_set = slist->data;
if (binding_set->set_name == set_name)
return binding_set;
}
return NULL;
}
/**
* gtk_binding_set_find:
* @set_name: unique binding set name
......@@ -759,19 +772,9 @@ gtk_binding_set_by_class (gpointer object_class)
GtkBindingSet*
gtk_binding_set_find (const gchar *set_name)
{
GSList *slist;
g_return_val_if_fail (set_name != NULL, NULL);
for (slist = binding_set_list; slist; slist = slist->next)
{
GtkBindingSet *binding_set;
binding_set = slist->data;
if (g_str_equal (binding_set->set_name, (gpointer) set_name))
return binding_set;
}
return NULL;
return gtk_binding_set_find_interned (g_intern_string (set_name));
}
/**
......@@ -1406,8 +1409,10 @@ gtk_binding_entry_add_signal_from_string (GtkBindingSet *binding_set,
* @path_pattern: the actual match pattern
* @priority: binding priority
*
* This function is used internally by the GtkRC parsing mechanism to
* assign match patterns to #GtkBindingSet structures.
* This function was used internally by the GtkRC parsing mechanism
* to assign match patterns to #GtkBindingSet structures.
*
* In GTK+ 3, these match patterns are unused.
*
* Deprecated: 3.0
*/
......@@ -1572,7 +1577,7 @@ gtk_bindings_activate_list (GObject *object,
while (class_type && !handled)
{
binding_set = gtk_binding_set_find (g_type_name (class_type));
binding_set = gtk_binding_set_find_interned (g_type_name (class_type));
class_type = g_type_parent (class_type);
if (!binding_set)
......
......@@ -180,10 +180,12 @@ void gtk_binding_entry_remove (GtkBindingSet *binding_set,
guint keyval,
GdkModifierType modifiers);
#ifndef GTK_DISABLE_DEPRECATED
void gtk_binding_set_add_path (GtkBindingSet *binding_set,
GtkPathType path_type,
const gchar *path_pattern,
GtkPathPriorityType priority);
#endif
G_END_DECLS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment