[libdazzle] shortcuts: keep actions and commands in sync
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] shortcuts: keep actions and commands in sync
- Date: Sun, 18 Jun 2017 01:43:45 +0000 (UTC)
commit eddeaaf0f9af341b3f32adb06847c8b648b2091c
Author: Christian Hergert <chergert redhat com>
Date: Sat Jun 17 18:42:54 2017 -0700
shortcuts: keep actions and commands in sync
src/shortcuts/dzl-shortcut-theme-load.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/shortcuts/dzl-shortcut-theme-load.c b/src/shortcuts/dzl-shortcut-theme-load.c
index fd5aefe..38d2469 100644
--- a/src/shortcuts/dzl-shortcut-theme-load.c
+++ b/src/shortcuts/dzl-shortcut-theme-load.c
@@ -135,24 +135,34 @@ load_state_add_action (LoadState *state,
const gchar *action)
{
DzlShortcutContext *context = NULL;
+ DzlShortcutTheme *theme = NULL;
const gchar *accel = NULL;
g_assert (state != NULL);
g_assert (action != NULL);
+ /* NOTE: Keep this in sync with load_state_add_command() */
+
for (LoadStateFrame *iter = state->stack; iter != NULL; iter = iter->next)
{
if (iter->type == LOAD_STATE_SHORTCUT)
accel = iter->accelerator;
else if (iter->type == LOAD_STATE_CONTEXT)
context = iter->context;
+ else if (iter->type == LOAD_STATE_THEME)
+ theme = state->self;
- if (accel && context)
+ if (accel && (context || theme))
break;
}
- if (accel && context)
- dzl_shortcut_context_add_action (context, accel, action);
+ if (accel != NULL)
+ {
+ if (context != NULL)
+ dzl_shortcut_context_add_action (context, accel, action);
+ else if (theme != NULL)
+ dzl_shortcut_theme_set_accel_for_action (theme, action, accel);
+ }
}
static void
@@ -166,6 +176,8 @@ load_state_add_command (LoadState *state,
g_assert (state != NULL);
g_assert (command != NULL);
+ /* NOTE: Keep this in sync with load_state_add_action() */
+
for (LoadStateFrame *iter = state->stack; iter != NULL; iter = iter->next)
{
if (iter->type == LOAD_STATE_SHORTCUT)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]