Merge lp:~donadigo/switchboard-plug-networking/wifi-list-placeholders into lp:~elementary-pantheon/switchboard-plug-networking/trunk

Proposed by Adam Bieńkowski
Status: Rejected
Rejected by: Adam Bieńkowski
Proposed branch: lp:~donadigo/switchboard-plug-networking/wifi-list-placeholders
Merge into: lp:~elementary-pantheon/switchboard-plug-networking/trunk
Diff against target: 110 lines (+62/-3)
1 file modified
src/common/Widgets/AbstractWifiInterface.vala (+62/-3)
To merge this branch: bzr merge lp:~donadigo/switchboard-plug-networking/wifi-list-placeholders
Reviewer Review Type Date Requested Status
Adam Bieńkowski (community) Abstain
elementary Apps team Pending
Review via email: mp+266719@code.launchpad.net

Commit message

Added new placeholders that will adapt to the situation of wifi list:
* When there are no available access points
* When wireless is disabled
* When scanning for access points

Description of the change

Added new placeholders that will adapt to the situation of wifi list:
* When there are no available access points
* When wireless is disabled
* When scanning for access points

To post a comment you must log in.
125. By Adam Bieńkowski

Removed unneded line

126. By Adam Bieńkowski

Do not use request_scan_simple

127. By Adam Bieńkowski

Arrays are not updated by the gobject notify

128. By Adam Bieńkowski

Move wireless-enabled contents to update () function

129. By Adam Bieńkowski

Check if list of access points is null

130. By Adam Bieńkowski

Fixed condition

Revision history for this message
Danielle Foré (danrabbit) wrote :

Hm I think if we're following the regular alert layout, it seems like what we want is more like:

Wireless Is Disabled
Enable wireless to discover nearby wireless access points

No Access Points Available
There are no wireless access points within range

Also, see an inline comment about ellipsis

131. By Adam Bieńkowski

Use proper labels and elipsis

Revision history for this message
Danielle Foré (danrabbit) wrote :

Secondary text shouldn't be the same style as the title text. Also I forgot periods on the secondary text because it's sentence case xD So it should be:

<h2>Wireless Is Disabled</h2>
Enable wireless to discover nearby wireless access points.

<h2>No Access Points Available</h2>
There are no wireless access points within range.

132. By Adam Bieńkowski

New labels style, instead of scanning label use spinner

Revision history for this message
Adam Bieńkowski (donadigo) wrote :

As the branch was merged into xapantu's branch I am rejecting.

review: Abstain

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/common/Widgets/AbstractWifiInterface.vala'
2--- src/common/Widgets/AbstractWifiInterface.vala 2015-08-02 12:30:11 +0000
3+++ src/common/Widgets/AbstractWifiInterface.vala 2015-08-03 18:26:29 +0000
4@@ -28,6 +28,7 @@
5
6 protected WifiMenuItem? active_wifi_item = null;
7 protected WifiMenuItem? blank_item = null;
8+ protected Gtk.Stack placeholder;
9
10 public void init_wifi_interface (NM.Client nm_client, NM.RemoteSettings nm_settings, NM.Device? _device) {
11 this.nm_client = nm_client;
12@@ -36,16 +37,50 @@
13 wifi_device = device as NM.DeviceWifi;
14 blank_item = new WifiMenuItem.blank ();
15
16+ placeholder = new Gtk.Stack ();
17+ placeholder.visible = true;
18+
19+ var no_aps_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 6);
20+ no_aps_box.visible = true;
21+ no_aps_box.valign = Gtk.Align.CENTER;
22+
23+ var no_aps = construct_placeholder_label (_("No Access Points Available"), true);
24+ var no_aps_desc = construct_placeholder_label (_("There are no wireless access points within range."), false);
25+
26+ no_aps_box.add (no_aps);
27+ no_aps_box.add (no_aps_desc);
28+
29+ var wireless_off_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 6);
30+ wireless_off_box.visible = true;
31+ wireless_off_box.valign = Gtk.Align.CENTER;
32+
33+ var wireless_off = construct_placeholder_label (_("Wireless Is Disabled"), true);
34+ var wireless_off_desc = construct_placeholder_label (_("Enable wireless to discover nearby wireless access points."), false);
35+
36+ wireless_off_box.add (wireless_off);
37+ wireless_off_box.add (wireless_off_desc);
38+
39+ var spinner = new Gtk.Spinner ();
40+ spinner.visible = true;
41+ spinner.halign = spinner.valign = Gtk.Align.CENTER;
42+ spinner.start ();
43+
44+ placeholder.add_named (no_aps_box, "no-aps");
45+ placeholder.add_named (wireless_off_box, "wireless-off");
46+ placeholder.add_named (spinner, "scanning");
47+ placeholder.visible_child_name = "no-aps";
48+
49 wifi_list = new Gtk.ListBox ();
50 wifi_list.set_sort_func (sort_func);
51-
52+ wifi_list.set_placeholder (placeholder);
53+
54 /* Monitor killswitch status */
55 rfkill = new RFKillManager ();
56 rfkill.open ();
57 rfkill.device_added.connect (update);
58 rfkill.device_changed.connect (update);
59 rfkill.device_deleted.connect (update);
60-
61+
62 wifi_device.notify["active-access-point"].connect (() => { update (); });
63 wifi_device.access_point_added.connect (access_point_added_cb);
64 wifi_device.access_point_removed.connect (access_point_removed_cb);
65@@ -57,6 +92,22 @@
66 update();
67 }
68
69+ Gtk.Label construct_placeholder_label (string text, bool title) {
70+ var label = new Gtk.Label (text);
71+ label.visible = true;
72+ label.use_markup = true;
73+ label.wrap = true;
74+ label.wrap_mode = Pango.WrapMode.WORD_CHAR;
75+ label.max_width_chars = 30;
76+ label.justify = Gtk.Justification.CENTER;
77+
78+ if (title) {
79+ label.get_style_context ().add_class ("h2");
80+ }
81+
82+ return label;
83+ }
84+
85 void access_point_added_cb (Object ap_) {
86 NM.AccessPoint ap = (NM.AccessPoint)ap_;
87 WifiMenuItem? previous_wifi_item = blank_item;
88@@ -159,7 +210,9 @@
89 }
90
91 update_active_ap ();
92-
93+ if (wifi_device.get_access_points () == null || wifi_device.get_access_points ().length == 0) {
94+ placeholder.visible_child_name = "no-aps";
95+ }
96 }
97
98 Network.State strength_to_state (uint8 strength) {
99@@ -208,6 +261,12 @@
100
101 update_active_ap ();
102
103+ if (nm_client.wireless_get_enabled ()) {
104+ placeholder.visible_child_name = "scanning";
105+ } else {
106+ placeholder.visible_child_name = "wireless-off";
107+ }
108+
109 base.update ();
110 }
111

Subscribers

People subscribed via source and target branches

to all changes: