[gnome-control-center] keyboard: Add 'reverse' helpers to CcKeyboardItem
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] keyboard: Add 'reverse' helpers to CcKeyboardItem
- Date: Sun, 17 Aug 2014 18:20:42 +0000 (UTC)
commit f059f424879000318bb323b4f550a01fc1052b86
Author: Christophe Fergeau <cfergeau redhat com>
Date: Thu May 1 19:40:26 2014 +0200
keyboard: Add 'reverse' helpers to CcKeyboardItem
In order to handle shortcuts which can be reversed (for example,
super-space and shift-super-space to switch input methods
forward/backward), we are going to add new attributes to the xml files
describing the keyboard shortcuts to show in the panel.
This commit is a first step towards that and adds the notion of
'reverse' items to CcKeyboardItem.
We will then indicate in the xml description files that
'switch-input-source' is reversed by 'switch-input-source-backward' and
that 'switch-input-source-backward' reverses 'switch-input-source'.
https://bugzilla.gnome.org/show_bug.cgi?id=731618
panels/keyboard/cc-keyboard-item.c | 28 +++++++++++++++++++++++++++-
panels/keyboard/cc-keyboard-item.h | 6 ++++++
2 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-item.c b/panels/keyboard/cc-keyboard-item.c
index 778eabc..4e3817e 100644
--- a/panels/keyboard/cc-keyboard-item.c
+++ b/panels/keyboard/cc-keyboard-item.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
- * Copyright (C) 2011 Red Hat, Inc.
+ * Copyright (C) 2011, 2014 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -38,6 +38,8 @@ struct CcKeyboardItemPrivate
int foo;
/* internal */
+ CcKeyboardItem *reverse_item;
+ gboolean is_reversed;
};
enum {
@@ -469,6 +471,30 @@ cc_keyboard_item_equal (CcKeyboardItem *a,
}
+void
+cc_keyboard_item_add_reverse_item (CcKeyboardItem *item,
+ CcKeyboardItem *reverse_item,
+ gboolean is_reversed)
+{
+ g_return_if_fail (item->key != NULL);
+
+ item->priv->reverse_item = reverse_item;
+ if (reverse_item->priv->reverse_item == NULL)
+ {
+ reverse_item->priv->reverse_item = item;
+ reverse_item->priv->is_reversed = !is_reversed;
+ }
+ else
+ g_warn_if_fail (reverse_item->priv->is_reversed == !!is_reversed);
+
+ item->priv->is_reversed = !!is_reversed;
+}
+
+CcKeyboardItem *
+cc_keyboard_item_get_reverse_item (CcKeyboardItem *item)
+{
+ return item->priv->reverse_item;
+}
/*
* vim: sw=2 ts=8 cindent noai bs=2
*/
diff --git a/panels/keyboard/cc-keyboard-item.h b/panels/keyboard/cc-keyboard-item.h
index 08f4e81..1e8eb56 100644
--- a/panels/keyboard/cc-keyboard-item.h
+++ b/panels/keyboard/cc-keyboard-item.h
@@ -102,6 +102,12 @@ const char * cc_keyboard_item_get_command (CcKeyboardItem *item);
gboolean cc_keyboard_item_equal (CcKeyboardItem *a,
CcKeyboardItem *b);
+void cc_keyboard_item_add_reverse_item (CcKeyboardItem *item,
+ CcKeyboardItem *reverse_item,
+ gboolean is_reversed);
+
+CcKeyboardItem * cc_keyboard_item_get_reverse_item (CcKeyboardItem *item);
+
G_END_DECLS
#endif /* __CC_KEYBOARD_ITEM_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]