Merge lp:~tintou/switchboard/can-show into lp:~elementary-pantheon/switchboard/switchboard

Proposed by Corentin Noël
Status: Merged
Merged at revision: 717
Proposed branch: lp:~tintou/switchboard/can-show
Merge into: lp:~elementary-pantheon/switchboard/switchboard
Diff against target: 116 lines (+55/-3)
4 files modified
lib/Plug.vala (+2/-1)
src/CategoryView.vala (+48/-1)
src/Widgets/CategoryFlowBox.vala (+4/-0)
src/Widgets/CategoryIcon.vala (+1/-1)
To merge this branch: bzr merge lp:~tintou/switchboard/can-show
Reviewer Review Type Date Requested Status
elementary Pantheon team Pending
Review via email: mp+310828@code.launchpad.net

Commit message

Hide and Show settings panes when hardware devices are present/not present

Description of the change

To test: lp:switchboard-plug-bluetooth [Plug/Unplug a Bluetooth dongle]

To post a comment you must log in.
Revision history for this message
RabbitBot (rabbitbot-a) wrote :

Attempt to merge into lp:switchboard failed due to conflicts:

text conflict in src/CategoryView.vala

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/Plug.vala'
--- lib/Plug.vala 2016-11-02 00:24:55 +0000
+++ lib/Plug.vala 2016-11-15 00:05:14 +0000
@@ -75,7 +75,8 @@
75 public bool can_show { get; set; default=true; }75 public bool can_show { get; set; default=true; }
76 76
77 /**77 /**
78 * Inform the application that the plug can now be listed in the available plugs78 * Inform the application that the plug can now be listed in the available plugs.
79 * The application will also listen to the notify::can-show signal.
79 */80 */
80 public signal void visibility_changed ();81 public signal void visibility_changed ();
81 82
8283
=== modified file 'src/CategoryView.vala'
--- src/CategoryView.vala 2016-05-12 17:41:11 +0000
+++ src/CategoryView.vala 2016-11-15 00:05:14 +0000
@@ -55,6 +55,7 @@
55 var plugsmanager = Switchboard.PlugsManager.get_default ();55 var plugsmanager = Switchboard.PlugsManager.get_default ();
56 plugsmanager.plug_added.connect ((plug) => {56 plugsmanager.plug_added.connect ((plug) => {
57 plug.visibility_changed.connect (() => plug_visibility_changed (plug));57 plug.visibility_changed.connect (() => plug_visibility_changed (plug));
58 plug.notify["can-show"].connect (() => plug_visibility_changed (plug));
58 add_plug (plug);59 add_plug (plug);
59 });60 });
6061
@@ -71,8 +72,10 @@
71 }72 }
7273
73 private void plug_visibility_changed (Switchboard.Plug plug) {74 private void plug_visibility_changed (Switchboard.Plug plug) {
74 if (plug.can_show == true) {75 if (plug.can_show) {
75 add_plug (plug);76 add_plug (plug);
77 } else {
78 remove_plug (plug);
76 }79 }
77 }80 }
7881
@@ -114,6 +117,50 @@
114 }117 }
115 }118 }
116119
120 public void remove_plug (Switchboard.Plug plug) {
121 if (plug.can_show == true) {
122 return;
123 }
124
125 switch (plug.category) {
126 case Switchboard.Plug.Category.PERSONAL:
127 personal_category.get_flow_children ().foreach ((child) => {
128 if (child is Switchboard.CategoryIcon && ((Switchboard.CategoryIcon) child).plug == plug) {
129 child.destroy ();
130 }
131 });
132 break;
133 case Switchboard.Plug.Category.HARDWARE:
134 hardware_category.get_flow_children ().foreach ((child) => {
135 if (child is Switchboard.CategoryIcon && ((Switchboard.CategoryIcon) child).plug == plug) {
136 child.destroy ();
137 }
138 });
139 break;
140 case Switchboard.Plug.Category.NETWORK:
141 network_category.get_flow_children ().foreach ((child) => {
142 if (child is Switchboard.CategoryIcon && ((Switchboard.CategoryIcon) child).plug == plug) {
143 child.destroy ();
144 }
145 });
146 break;
147 case Switchboard.Plug.Category.SYSTEM:
148 system_category.get_flow_children ().foreach ((child) => {
149 if (child is Switchboard.CategoryIcon && ((Switchboard.CategoryIcon) child).plug == plug) {
150 child.destroy ();
151 }
152 });
153 break;
154 default:
155 return;
156 }
157
158#if HAVE_UNITY
159 unowned SwitchboardApp app = (SwitchboardApp) GLib.Application.get_default ();
160 app.update_libunity_quicklist ();
161#endif
162 }
163
117 public void grab_focus_first_icon_view () {164 public void grab_focus_first_icon_view () {
118 if (personal_category.has_child ()) {165 if (personal_category.has_child ()) {
119 personal_category.focus_first_child ();166 personal_category.focus_first_child ();
120167
=== modified file 'src/Widgets/CategoryFlowBox.vala'
--- src/Widgets/CategoryFlowBox.vala 2016-11-03 21:57:17 +0000
+++ src/Widgets/CategoryFlowBox.vala 2016-11-15 00:05:14 +0000
@@ -70,6 +70,10 @@
70 flowbox.add (widget);70 flowbox.add (widget);
71 }71 }
7272
73 public GLib.List<weak Gtk.Widget> get_flow_children () {
74 return flowbox.get_children ();
75 }
76
73 public void activate_first_child () {77 public void activate_first_child () {
74 foreach (unowned Gtk.Widget child in flowbox.get_children ()) {78 foreach (unowned Gtk.Widget child in flowbox.get_children ()) {
75 if (child.get_child_visible ()) {79 if (child.get_child_visible ()) {
7680
=== modified file 'src/Widgets/CategoryIcon.vala'
--- src/Widgets/CategoryIcon.vala 2016-05-12 18:08:35 +0000
+++ src/Widgets/CategoryIcon.vala 2016-11-15 00:05:14 +0000
@@ -22,7 +22,7 @@
2222
23 public class CategoryIcon : Gtk.FlowBoxChild {23 public class CategoryIcon : Gtk.FlowBoxChild {
2424
25 public Switchboard.Plug plug;25 public unowned Switchboard.Plug plug;
2626
27 public CategoryIcon (Switchboard.Plug plug_item) {27 public CategoryIcon (Switchboard.Plug plug_item) {
28 plug = plug_item;28 plug = plug_item;

Subscribers

People subscribed via source and target branches

to all changes: