aboutsummaryrefslogtreecommitdiff
path: root/lib/ibus-menu.vala
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ibus-menu.vala')
-rw-r--r--lib/ibus-menu.vala26
1 files changed, 11 insertions, 15 deletions
diff --git a/lib/ibus-menu.vala b/lib/ibus-menu.vala
index c0862ac3..a240f00b 100644
--- a/lib/ibus-menu.vala
+++ b/lib/ibus-menu.vala
@@ -128,10 +128,6 @@ public class Indicator.Keyboard.IBusMenu : MenuModel {
var state = new Variant.boolean (property.state == IBus.PropState.CHECKED);
var action = new SimpleAction.stateful (name, null, state);
- action.activate.connect ((parameter) => {
- action.change_state (new Variant.boolean (!action.get_state ().get_boolean ()));
- });
-
action.change_state.connect ((value) => {
if (value != null) {
action.set_state ((!) value);
@@ -154,26 +150,26 @@ 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 (""));
- ((!) 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 +191,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);
}
@@ -295,7 +291,7 @@ public class Indicator.Keyboard.IBusMenu : MenuModel {
return menu.get_item_link (item_index, link);
}
- public override void get_item_links (int item_index, out HashTable<string, MenuModel>? links) {
+ public override void get_item_links (int item_index, out HashTable<string, MenuModel> links) {
menu.get_item_links (item_index, out links);
}