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
1=== modified file 'src/Switchboard.vala'
2--- src/Switchboard.vala 2015-04-09 08:46:22 +0000
3+++ src/Switchboard.vala 2015-09-23 15:45:37 +0000
4@@ -44,6 +44,7 @@
5 private Gee.LinkedList <string> loaded_plugs;
6 private string all_settings_label = _("All Settings");
7
8+ public Gee.ArrayList <Switchboard.Plug> previous_plugs;
9 public Switchboard.Plug current_plug;
10 public Gtk.SearchEntry search_box { public get; private set; }
11
12@@ -150,6 +151,7 @@
13 }
14
15 loaded_plugs = new Gee.LinkedList <string> ();
16+ previous_plugs = new Gee.ArrayList <Switchboard.Plug> ();
17 Switchboard.PlugsManager.get_default ();
18 settings = new GLib.Settings ("org.pantheon.switchboard.saved-state");
19 build ();
20@@ -179,6 +181,8 @@
21 loaded_plugs.add (plug.code_name);
22 }
23
24+ previous_plugs.add (plug);
25+
26 // Launch plug's executable
27 navigation_button.set_sensitive (true);
28 navigation_button.set_text (all_settings_label);
29@@ -348,8 +352,12 @@
30 switch_to_icons ();
31 navigation_button.hide ();
32 } else {
33- switch_to_plug (current_plug);
34- navigation_button.set_text (all_settings_label);
35+ if (previous_plugs.size > 0 && stack.get_visible_child_name () != "main") {
36+ load_plug (previous_plugs.@get (0));
37+ previous_plugs.remove_at (0);
38+ } else {
39+ switch_to_plug (current_plug);
40+ }
41 }
42 }
43
44@@ -362,6 +370,13 @@
45 stack.set_transition_type (Gtk.StackTransitionType.SLIDE_LEFT_RIGHT);
46 }
47
48+ if (previous_plugs.size > 1 && stack.get_visible_child_name () != "main") {
49+ navigation_button.set_text (previous_plugs.@get (0).display_name);
50+ previous_plugs.remove_at (previous_plugs.size - 1);
51+ } else {
52+ navigation_button.set_text (all_settings_label);
53+ }
54+
55 search_box.sensitive = false;
56 plug.shown ();
57 stack.set_visible_child_name (plug.code_name);
58@@ -373,6 +388,8 @@
59 if (stack.transition_type == Gtk.StackTransitionType.NONE) {
60 stack.set_transition_type (Gtk.StackTransitionType.SLIDE_LEFT_RIGHT);
61 }
62+
63+ previous_plugs.clear ();
64 category_scrolled.show ();
65 stack.set_visible_child (category_scrolled);
66 current_plug.hidden ();

Subscribers

People subscribed via source and target branches

to all changes: