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
This commit is contained in:
parent
10fd199b02
commit
f059f42487
2 changed files with 33 additions and 1 deletions
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Add table
Reference in a new issue