Merge lp:~cyphermox/indicator-server/null-detailed-action into lp:indicator-server

Proposed by Mathieu Trudel-Lapierre
Status: Superseded
Proposed branch: lp:~cyphermox/indicator-server/null-detailed-action
Merge into: lp:indicator-server
Diff against target: 87 lines (+44/-2)
2 files modified
network/network-action-manager.vala (+24/-2)
network/network-menu.vala (+20/-0)
To merge this branch: bzr merge lp:~cyphermox/indicator-server/null-detailed-action
Reviewer Review Type Date Requested Status
Ubuntu Phablet Team Pending
Review via email: mp+172939@code.launchpad.net

This proposal has been superseded by a proposal from 2013-07-04.

Commit message

Make the Wi-Fi and Mobile data switches have null for a detailed-action when building the menuitem rather than an empty string.

Description of the change

Make the Wi-Fi and Mobile data switches have null for a detailed-action when building the menuitem rather than an empty string.

To post a comment you must log in.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'network/network-action-manager.vala'
2--- network/network-action-manager.vala 2013-02-20 19:40:31 +0000
3+++ network/network-action-manager.vala 2013-07-04 01:51:25 +0000
4@@ -319,8 +319,17 @@
5
6 private void bootstrap_actions ()
7 {
8- //TODO: Airplane mode action
9- //TODO: Wifi enabled/disabled action
10+ var wireless_enabled = new SimpleAction.stateful ("WirelessEnabled",
11+ VariantType.BOOLEAN,
12+ new Variant.boolean (client.wireless_get_enabled()));
13+ app.add_action (wireless_enabled);
14+ wireless_enabled.change_state.connect(on_device_enabled);
15+
16+ var mobile_data_enabled = new SimpleAction.stateful ("WwanEnabled",
17+ VariantType.BOOLEAN,
18+ new Variant.boolean (client.wwan_get_enabled()));
19+ app.add_action (mobile_data_enabled);
20+ mobile_data_enabled.change_state.connect(on_device_enabled);
21
22 client.device_added.connect ((client, device) => {add_device (device);});
23 client.device_removed.connect ((client, device) => {remove_device (device);});
24@@ -337,6 +346,19 @@
25 }
26 }
27
28+ private void on_device_enabled(SimpleAction ac, Variant? val)
29+ {
30+ if (ac.name == "WirelessEnabled")
31+ {
32+ client.wireless_set_enabled (val.get_boolean());
33+ }
34+ else if (ac.name == "WwanEnabled")
35+ {
36+ client.wwan_set_enabled (val.get_boolean());
37+ }
38+ ac.set_state (val.get_boolean());
39+ }
40+
41 private void add_network_status_action ()
42 {
43 /* This is the action that represents the global status of the network.
44
45=== modified file 'network/network-menu.vala'
46--- network/network-menu.vala 2013-02-20 19:40:31 +0000
47+++ network/network-menu.vala 2013-07-04 01:51:25 +0000
48@@ -280,6 +280,7 @@
49 {
50 private Menu root_menu;
51 private MenuItem root_item;
52+ private Menu devices_switch;
53 private Menu gmenu;
54 private NM.Client client;
55 private ActionManager am;
56@@ -314,6 +315,7 @@
57 private void bootstrap_menu ()
58 {
59 root_menu = new Menu ();
60+ devices_switch = new Menu ();
61 gmenu = new Menu ();
62 am = new ActionManager (this, client);
63
64@@ -321,6 +323,24 @@
65 root_item.set_attribute (GLib.Menu.ATTRIBUTE_ACTION, "s", "network-status");
66 root_item.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.root.network");
67 root_menu.append_item (root_item);
68+
69+ // switch
70+ gmenu.insert_section(0, "Devices", devices_switch);
71+ if (client.wireless_hardware_get_enabled())
72+ {
73+ MenuItem wireless_switch = new MenuItem("Wi-Fi", null);
74+ wireless_switch.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.switch");
75+ wireless_switch.set_attribute ("action", "s", "WirelessEnabled");
76+ devices_switch.append_item (wireless_switch);
77+ }
78+
79+ if (client.wwan_hardware_get_enabled())
80+ {
81+ MenuItem mobile_data_switch = new MenuItem("Mobile data", null);
82+ mobile_data_switch.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.switch");
83+ mobile_data_switch.set_attribute ("action", "s", "WwanEnabled");
84+ devices_switch.append_item (mobile_data_switch);
85+ }
86
87 var devices = client.get_devices ();
88

Subscribers

People subscribed via source and target branches