Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix property selection with keyboard shortcuts

  • Loading branch information...
commit 3a132527335a0eab714b60c52cf60e57925969c6 1 parent c8cac9d
@ueno authored
View
3  configure.ac
@@ -61,6 +61,9 @@ AC_SUBST(DATE_DISPLAY)
PKG_CHECK_MODULES(IBUS, [ibus-1.0 >= 1.4.0], ,
AC_MSG_ERROR([can't find ibus]))
+PKG_CHECK_EXISTS([ibus-1.0 >= 1.5.0], have_ibus_1_5=yes, have_ibus_1_5=no)
+AM_CONDITIONAL([IBUS_1_5], [test x$have_ibus_1_5 = xyes])
+
# check libskk
PKG_CHECK_MODULES(LIBSKK, [libskk >= 0.0.11], ,
AC_MSG_ERROR([can't find libskk]))
View
4 src/Makefile.am
@@ -39,6 +39,10 @@ ibus_engine_skk_VALAFLAGS = \
--pkg config --pkg ibus-skk \
$(VALAFLAGS)
+if IBUS_1_5
+ibus_engine_skk_VALAFLAGS += -D IBUS_1_5
+endif
+
ibus_engine_skk_CFLAGS = \
$(COMMON_CFLAGS)
View
33 src/engine.vala
@@ -229,24 +229,31 @@ class SkkEngine : IBus.Engine {
}
void update_input_mode () {
- // IBusProperty objects in input_mode_props are shared with
- // prop_list and will be used for the next
- // register_properties. So, all the input mode props have to
- // be unchecked first. Otherwise multiple radio items might
- // be selected.
- foreach (var prop in input_mode_props.values) {
- prop.set_state (IBus.PropState.UNCHECKED);
+ // Update the menu item
+ var iter = input_mode_props.map_iterator ();
+ if (iter.first ()) {
+ do {
+ var input_mode = iter.get_key ();
+ var prop = iter.get_value ();
+ if (input_mode == context.input_mode)
+ prop.set_state (IBus.PropState.CHECKED);
+ else
+ prop.set_state (IBus.PropState.UNCHECKED);
+ update_property (prop);
+ } while (iter.next ());
}
- // Update the state of menu item
- var prop = input_mode_props.get (context.input_mode);
- prop.set_state (IBus.PropState.CHECKED);
- update_property (prop);
-
- // Update the label of the menu
+ // Update the menu
var symbol = new IBus.Text.from_string (
input_mode_symbols.get (context.input_mode));
+#if IBUS_1_5
+ var label = new IBus.Text.from_string (
+ _("Input Mode (%s)").printf (symbol.text));
+ input_mode_prop.set_label (label);
+ input_mode_prop.set_symbol (symbol);
+#else
input_mode_prop.set_label (symbol);
+#endif
update_property (input_mode_prop);
}
View
1  src/ibus-1.0.vapi
@@ -447,6 +447,7 @@ namespace IBus {
public bool get_visible ();
public void set_icon (string icon);
public void set_label (IBus.Text label);
+ public void set_symbol (IBus.Text symbol);
public void set_sensitive (bool sensitive);
public void set_state (IBus.PropState state);
public void set_sub_props (IBus.PropList prop_list);

0 comments on commit 3a13252

Please sign in to comment.
Something went wrong with that request. Please try again.