[libdazzle] shortcuts: add action lookup for shortcut theme
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] shortcuts: add action lookup for shortcut theme
- Date: Wed, 22 Nov 2017 02:47:11 +0000 (UTC)
commit 8b550fd60e778f383a79865e9c1c9e082fb700d3
Author: Christian Hergert <chergert redhat com>
Date: Tue Nov 21 18:43:20 2017 -0800
shortcuts: add action lookup for shortcut theme
This allows us to lookup by chord to get an action which we
might need when activating legacy paths.
src/shortcuts/dzl-shortcut-private.h | 2 ++
src/shortcuts/dzl-shortcut-theme.c | 23 +++++++++++++++++++++++
2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/shortcuts/dzl-shortcut-private.h b/src/shortcuts/dzl-shortcut-private.h
index a9d62cc..4afcad1 100644
--- a/src/shortcuts/dzl-shortcut-private.h
+++ b/src/shortcuts/dzl-shortcut-private.h
@@ -126,6 +126,8 @@ void _dzl_shortcut_theme_set_manager (DzlShortcut
DzlShortcutManager *manager);
void _dzl_shortcut_theme_set_name (DzlShortcutTheme *self,
const gchar *name);
+const gchar *_dzl_shortcut_theme_lookup_action (DzlShortcutTheme *self,
+ const DzlShortcutChord *chord);
void _dzl_shortcut_theme_merge (DzlShortcutTheme *self,
DzlShortcutTheme *layer);
DzlShortcutMatch _dzl_shortcut_theme_match (DzlShortcutTheme *self,
diff --git a/src/shortcuts/dzl-shortcut-theme.c b/src/shortcuts/dzl-shortcut-theme.c
index f32ac0b..0295133 100644
--- a/src/shortcuts/dzl-shortcut-theme.c
+++ b/src/shortcuts/dzl-shortcut-theme.c
@@ -447,6 +447,29 @@ dzl_shortcut_theme_set_parent_name (DzlShortcutTheme *self,
}
}
+const gchar *
+_dzl_shortcut_theme_lookup_action (DzlShortcutTheme *self,
+ const DzlShortcutChord *chord)
+{
+ DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
+
+ g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (self), NULL);
+ g_return_val_if_fail (chord != NULL, NULL);
+
+ if (priv->actions_table != NULL)
+ {
+ const gchar *action = NULL;
+ DzlShortcutMatch match;
+
+ match = dzl_shortcut_chord_table_lookup (priv->actions_table, chord, (gpointer *)&action);
+
+ if (match == DZL_SHORTCUT_MATCH_EQUAL)
+ return action;
+ }
+
+ return NULL;
+}
+
void
dzl_shortcut_theme_set_chord_for_action (DzlShortcutTheme *self,
const gchar *detailed_action_name,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]