Merge lp:~donadigo/switchboard/return-to-previous-plug into lp:~elementary-pantheon/switchboard/switchboard

Proposed by Adam Bieńkowski
Status: Merged
Approved by: Danielle Foré
Approved revision: 574
Merged at revision: 567
Proposed branch: lp:~donadigo/switchboard/return-to-previous-plug
Merge into: lp:~elementary-pantheon/switchboard/switchboard
Diff against target: 66 lines (+19/-2)
1 file modified
src/Switchboard.vala (+19/-2)
To merge this branch: bzr merge lp:~donadigo/switchboard/return-to-previous-plug
Reviewer Review Type Date Requested Status
Danielle Foré Needs Fixing
Review via email: mp+271963@code.launchpad.net

Commit message

When redirected to an other plug make navigation button return to previous plug.

Description of the change

Fixes bug #1497553. When redirected to an other plug make navigation button return to previous plug. This should support multiple redicretions as previous plugs are stored in the list instead of one variable.

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

Remove unneded line

571. By Adam Bieńkowski

Fix a code a little bit

572. By Adam Bieńkowski

Missing comment

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

Works for me :)

Only thing I can see is that it looks like current code style is to put a space before <> so "Gee.ArrayList<Switchboard.Plug>" becomes "Gee.ArrayList <Switchboard.Plug>"

review: Needs Fixing
573. By Adam Bieńkowski

Small code-style fix

574. By Adam Bieńkowski

Another code-style fix

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Switchboard.vala'
--- src/Switchboard.vala 2015-04-09 08:46:22 +0000
+++ src/Switchboard.vala 2015-09-23 15:45:37 +0000
@@ -44,6 +44,7 @@
44 private Gee.LinkedList <string> loaded_plugs;44 private Gee.LinkedList <string> loaded_plugs;
45 private string all_settings_label = _("All Settings");45 private string all_settings_label = _("All Settings");
4646
47 public Gee.ArrayList <Switchboard.Plug> previous_plugs;
47 public Switchboard.Plug current_plug;48 public Switchboard.Plug current_plug;
48 public Gtk.SearchEntry search_box { public get; private set; }49 public Gtk.SearchEntry search_box { public get; private set; }
4950
@@ -150,6 +151,7 @@
150 }151 }
151152
152 loaded_plugs = new Gee.LinkedList <string> ();153 loaded_plugs = new Gee.LinkedList <string> ();
154 previous_plugs = new Gee.ArrayList <Switchboard.Plug> ();
153 Switchboard.PlugsManager.get_default ();155 Switchboard.PlugsManager.get_default ();
154 settings = new GLib.Settings ("org.pantheon.switchboard.saved-state");156 settings = new GLib.Settings ("org.pantheon.switchboard.saved-state");
155 build ();157 build ();
@@ -179,6 +181,8 @@
179 loaded_plugs.add (plug.code_name);181 loaded_plugs.add (plug.code_name);
180 }182 }
181183
184 previous_plugs.add (plug);
185
182 // Launch plug's executable186 // Launch plug's executable
183 navigation_button.set_sensitive (true);187 navigation_button.set_sensitive (true);
184 navigation_button.set_text (all_settings_label);188 navigation_button.set_text (all_settings_label);
@@ -348,8 +352,12 @@
348 switch_to_icons ();352 switch_to_icons ();
349 navigation_button.hide ();353 navigation_button.hide ();
350 } else {354 } else {
351 switch_to_plug (current_plug);355 if (previous_plugs.size > 0 && stack.get_visible_child_name () != "main") {
352 navigation_button.set_text (all_settings_label);356 load_plug (previous_plugs.@get (0));
357 previous_plugs.remove_at (0);
358 } else {
359 switch_to_plug (current_plug);
360 }
353 }361 }
354 }362 }
355363
@@ -362,6 +370,13 @@
362 stack.set_transition_type (Gtk.StackTransitionType.SLIDE_LEFT_RIGHT);370 stack.set_transition_type (Gtk.StackTransitionType.SLIDE_LEFT_RIGHT);
363 }371 }
364372
373 if (previous_plugs.size > 1 && stack.get_visible_child_name () != "main") {
374 navigation_button.set_text (previous_plugs.@get (0).display_name);
375 previous_plugs.remove_at (previous_plugs.size - 1);
376 } else {
377 navigation_button.set_text (all_settings_label);
378 }
379
365 search_box.sensitive = false;380 search_box.sensitive = false;
366 plug.shown ();381 plug.shown ();
367 stack.set_visible_child_name (plug.code_name);382 stack.set_visible_child_name (plug.code_name);
@@ -373,6 +388,8 @@
373 if (stack.transition_type == Gtk.StackTransitionType.NONE) {388 if (stack.transition_type == Gtk.StackTransitionType.NONE) {
374 stack.set_transition_type (Gtk.StackTransitionType.SLIDE_LEFT_RIGHT);389 stack.set_transition_type (Gtk.StackTransitionType.SLIDE_LEFT_RIGHT);
375 }390 }
391
392 previous_plugs.clear ();
376 category_scrolled.show ();393 category_scrolled.show ();
377 stack.set_visible_child (category_scrolled);394 stack.set_visible_child (category_scrolled);
378 current_plug.hidden ();395 current_plug.hidden ();

Subscribers

People subscribed via source and target branches

to all changes: