Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/Indicator.vala
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,18 @@ public class Network.Indicator : Wingpanel.Indicator {
if (is_in_session) {
display_widget.button_press_event.connect ((event) => {
if (event.button == Gdk.BUTTON_MIDDLE) {
try {
popover_widget.nm_client.networking_set_enabled (!popover_widget.nm_client.networking_get_enabled ());
return true;
} catch (Error e) {
warning ("Error setting airplane mode: %s", e.message);
}
popover_widget.nm_client.dbus_set_property.begin (
NM.DBUS_PATH, NM.DBUS_INTERFACE,
"Enable", !popover_widget.nm_client.networking_get_enabled (),
-1, null, (obj, res) => {
try {
((NM.Client) obj).dbus_set_property.end (res);
} catch (Error e) {
warning ("Error setting airplane mode: %s", e.message);
}
}
);
return true;
}

return false;
Expand Down
16 changes: 11 additions & 5 deletions src/Widgets/PopoverWidget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,17 @@ public class Network.Widgets.PopoverWidget : Gtk.Grid {
other_box.add (airplane_box);

airplane_toggle.toggled.connect (() => {
try {
nm_client.networking_set_enabled (!airplane_toggle.active);
} catch (Error e) {
warning (e.message);
}
nm_client.dbus_set_property.begin (
NM.DBUS_PATH, NM.DBUS_INTERFACE,
"Enable", !airplane_toggle.active,
-1, null, (obj, res) => {
try {
((NM.Client) obj).dbus_set_property.end (res);
} catch (Error e) {
warning ("Error setting airplane mode: %s", e.message);
}
}
);
});

if (!airplane_toggle.active && !nm_client.networking_get_enabled ()) {
Expand Down
12 changes: 11 additions & 1 deletion src/Widgets/WifiInterface.vala
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,17 @@ public class Network.WifiInterface : Network.WidgetNMInterface {
var active = wifi_item.active;
if (active != !software_locked) {
rfkill.set_software_lock (RFKillDeviceType.WLAN, !active);
nm_client.wireless_set_enabled (active);
nm_client.dbus_set_property.begin (
NM.DBUS_PATH, NM.DBUS_INTERFACE,
"WirelessEnabled", active,
-1, null, (obj, res) => {
try {
((NM.Client) obj).dbus_set_property.end (res);
} catch (Error e) {
warning ("Error activating wifi item: %s", e.message);
}
}
);
}
});
}
Expand Down