[libdazzle] shortcuts: resolve via the parent theme



commit 86163b6bb021a02d77152a4154800af86b9893b2
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jun 14 18:54:39 2017 -0700

    shortcuts: resolve via the parent theme
    
    We might need to get the shortcut from the parent theme.

 src/shortcuts/dzl-shortcut-theme.c |   30 ++++++++++++++++++++++++++----
 1 files changed, 26 insertions(+), 4 deletions(-)
---
diff --git a/src/shortcuts/dzl-shortcut-theme.c b/src/shortcuts/dzl-shortcut-theme.c
index d182b6c..4ac34d2 100644
--- a/src/shortcuts/dzl-shortcut-theme.c
+++ b/src/shortcuts/dzl-shortcut-theme.c
@@ -424,14 +424,25 @@ dzl_shortcut_theme_get_chord_for_action (DzlShortcutTheme *self,
                                          const gchar      *detailed_action_name)
 {
   DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
+  const DzlShortcutChord *ret;
 
   g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (self), NULL);
 
   if (priv->actions_table == NULL)
     return NULL;
 
-  return dzl_shortcut_chord_table_lookup_data (priv->actions_table,
-                                               (gpointer)g_intern_string (detailed_action_name));
+  ret = dzl_shortcut_chord_table_lookup_data (priv->actions_table,
+                                              (gpointer)g_intern_string (detailed_action_name));
+
+  if (ret == NULL)
+    {
+      DzlShortcutTheme *parent = dzl_shortcut_theme_get_parent (self);
+
+      if (parent != NULL)
+        ret = dzl_shortcut_theme_get_chord_for_action (parent, detailed_action_name);
+    }
+
+  return ret;
 }
 
 void
@@ -492,14 +503,25 @@ dzl_shortcut_theme_get_chord_for_command (DzlShortcutTheme *self,
                                           const gchar      *command)
 {
   DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
+  const DzlShortcutChord *ret;
 
   g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (self), NULL);
 
   if (priv->commands_table == NULL)
     return NULL;
 
-  return dzl_shortcut_chord_table_lookup_data (priv->commands_table,
-                                               (gpointer)g_intern_string (command));
+  ret = dzl_shortcut_chord_table_lookup_data (priv->commands_table,
+                                              (gpointer)g_intern_string (command));
+
+  if (ret == NULL)
+    {
+      DzlShortcutTheme *parent = dzl_shortcut_theme_get_parent (self);
+
+      if (parent != NULL)
+        ret = dzl_shortcut_theme_get_chord_for_command (parent, command);
+    }
+
+  return ret;
 }
 
 /**


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