[gtk+] shortcuts: Try harder to disambiguate search items



commit 8a2812217b9fbf92bfe2ad287f188fed9fe3e1e8
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 19 23:24:44 2016 -0400

    shortcuts: Try harder to disambiguate search items
    
    I noticed that some of the gestures did not show up in the
    search results in the builder example in gtk3-demo, because
    they share the same title and don't have an accelerator to
    disambiguate. Include the shortcut type to handle this case.

 gtk/gtkshortcutswindow.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkshortcutswindow.c b/gtk/gtkshortcutswindow.c
index 3fdaf78..e106f15 100644
--- a/gtk/gtkshortcutswindow.c
+++ b/gtk/gtkshortcutswindow.c
@@ -197,6 +197,9 @@ gtk_shortcuts_window_add_search_item (GtkWidget *child, gpointer data)
 
   if (GTK_IS_SHORTCUTS_SHORTCUT (child))
     {
+      GEnumClass *class;
+      GEnumValue *value;
+
       g_object_get (child,
                     "accelerator", &accelerator,
                     "title", &title,
@@ -207,7 +210,13 @@ gtk_shortcuts_window_add_search_item (GtkWidget *child, gpointer data)
                     "action-name", &action_name,
                     NULL);
 
-      hash_key = g_strdup_printf ("%s-%s", title, accelerator);
+      class = G_ENUM_CLASS (g_type_class_ref (GTK_TYPE_SHORTCUT_TYPE));
+      value = g_enum_get_value (class, shortcut_type);
+
+      hash_key = g_strdup_printf ("%s-%s-%s", title, value->value_nick, accelerator);
+
+      g_type_class_unref (class);
+
       if (g_hash_table_contains (priv->search_items_hash, hash_key))
         {
           g_free (hash_key);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]