diff options
author | William Hua <william.hua@canonical.com> | 2015-02-18 10:52:18 -0500 |
---|---|---|
committer | William Hua <william.hua@canonical.com> | 2015-02-18 10:52:18 -0500 |
commit | a8721bcb87bef4c18e501cf559af35926d11c0eb (patch) | |
tree | 8c2e4ea57c465e0f89618ac46e11b745159476da /lib/ibus-menu.vala | |
parent | 603fdf817fbecbc184853ca4a4a078a2e7072fde (diff) | |
download | ayatana-indicator-keyboard-a8721bcb87bef4c18e501cf559af35926d11c0eb.tar.gz ayatana-indicator-keyboard-a8721bcb87bef4c18e501cf559af35926d11c0eb.tar.bz2 ayatana-indicator-keyboard-a8721bcb87bef4c18e501cf559af35926d11c0eb.zip |
Remove (!) when possible.
Diffstat (limited to 'lib/ibus-menu.vala')
-rw-r--r-- | lib/ibus-menu.vala | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/ibus-menu.vala b/lib/ibus-menu.vala index 62bd88e8..a74782ed 100644 --- a/lib/ibus-menu.vala +++ b/lib/ibus-menu.vala @@ -154,26 +154,30 @@ public class Indicator.Keyboard.IBusMenu : MenuModel { /* Create a single action for all radio properties. */ if (action_map != null && radio_name == null) { radio_counter++; - radio_name = @"-private-radio-$radio_counter"; - radio_action = new SimpleAction.stateful ((!) radio_name, VariantType.STRING, new Variant.string ("")); - ((!) radio_action).activate.connect ((parameter) => { - ((!) radio_action).change_state (parameter); + var name = @"-private-radio-$radio_counter"; + var action = new SimpleAction.stateful (name, VariantType.STRING, new Variant.string ("")); + + action.activate.connect ((parameter) => { + action.change_state (parameter); }); - ((!) radio_action).change_state.connect ((value) => { + action.change_state.connect ((value) => { if (value != null) { var key = ((!) value).get_string (); if (radio_properties.has_key (key)) { - ((!) radio_action).set_state ((!) value); + action.set_state ((!) value); activate (radio_properties[key], IBus.PropState.CHECKED); } } }); - ((!) action_map).add_action ((!) radio_action); - names.add ((!) radio_name); + ((!) action_map).add_action (action); + names.add (name); + + radio_name = name; + radio_action = action; } radio_properties[property.key] = property; @@ -195,7 +199,7 @@ public class Indicator.Keyboard.IBusMenu : MenuModel { private void append_menu_property (IBus.Property property) { if (property.prop_type == IBus.PropType.MENU) { - var submenu = new IBusMenu (action_map, ((!) property).sub_props); + var submenu = new IBusMenu (action_map, property.sub_props); submenu.activate.connect ((property, state) => { activate (property, state); }); menu.append_submenu (get_label (property), submenu); } |