Merge lp:~heathbar/switchboard-plug-pantheon-shell/fix-1036271 into lp:~elementary-apps/switchboard-plug-pantheon-shell/trunk

Proposed by Heath Paddock
Status: Merged
Merged at revision: 106
Proposed branch: lp:~heathbar/switchboard-plug-pantheon-shell/fix-1036271
Merge into: lp:~elementary-apps/switchboard-plug-pantheon-shell/trunk
Diff against target: 81 lines (+50/-2)
2 files modified
src/PlankSettings.vala (+15/-0)
src/desktop-plug.vala (+35/-2)
To merge this branch: bzr merge lp:~heathbar/switchboard-plug-pantheon-shell/fix-1036271
Reviewer Review Type Date Requested Status
Cody Garver (community) Approve
Review via email: mp+151350@code.launchpad.net

Description of the change

Added support for changing dock theme to fix bug #1036271

To post a comment you must log in.
Revision history for this message
Tom Beckmann (tombeckmann) wrote :

I got approval by our designers now :)
One last thing that should be done is hide the box when there is only a single entry.
Also, the extra indentation for the try-catch block seems quite unnecessary here, as the try-catch already intends it once. And it'd be better if you could add a simple "warning (e.message);" in the catch clause instead of ignoring the error, so if something goes wrong you can ask the user to get us the terminal output and get useful information.

103. By Heath Paddock

Improved error and edge-case handling for bug #1036271;

Revision history for this message
Cody Garver (codygarver) wrote :

Great work, much appreciated!

review: Approve
Revision history for this message
Rico Tzschichholz (ricotz) wrote :

Great to see this included.
Although I want to mention there are some drawbacks. It includes regular files rather than only non-hidden directories. Also there are only two directories supported ~/.local/share/plank/themes and %PREFIX%/share/plank/themes
Sorting the list alphabetically would be useful too.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/PlankSettings.vala'
--- src/PlankSettings.vala 2012-07-22 20:51:01 +0000
+++ src/PlankSettings.vala 2013-03-03 23:02:21 +0000
@@ -34,6 +34,21 @@
34 }34 }
35 }35 }
36 36
37 private string _theme;
38 public string theme {
39 get {
40 try {
41 _theme = configs.get_value ("PlankDockPreferences", "Theme");
42 return _theme;
43 } catch (Error e) { warning (e.message); }
44 return "";
45 }
46 set {
47 configs.set_string ("PlankDockPreferences", "Theme", value);
48 save ();
49 }
50 }
51
37 public int monitor {52 public int monitor {
38 get {53 get {
39 try {54 try {
4055
=== modified file 'src/desktop-plug.vala'
--- src/desktop-plug.vala 2012-12-15 05:21:14 +0000
+++ src/desktop-plug.vala 2013-03-03 23:02:21 +0000
@@ -89,6 +89,35 @@
89 hide_mode.halign = Gtk.Align.START;89 hide_mode.halign = Gtk.Align.START;
90 hide_mode.width_request = 164;90 hide_mode.width_request = 164;
91 91
92
93 var theme = new Gtk.ComboBoxText ();
94
95 int theme_index = 0;
96 try {
97
98 string name;
99 var dirs = Environment.get_system_data_dirs ();
100 dirs += Environment.get_user_data_dir ();
101
102 foreach (string dir in dirs) {
103 if (FileUtils.test (dir + "/plank/themes", FileTest.EXISTS)) {
104 var d = Dir.open(dir + "/plank/themes");
105 while ((name = d.read_name()) != null) {
106 theme.append(theme_index.to_string (), _(name));
107 if (PlankSettings.get_default ().theme.to_string () == name)
108 theme.active = theme_index;
109 theme_index++;
110 }
111 }
112 }
113 } catch (GLib.FileError e){
114 warning (e.message);
115 }
116
117 theme.changed.connect (() => PlankSettings.get_default ().theme = theme.get_active_text ());
118 theme.halign = Gtk.Align.START;
119 theme.width_request = 164;
120
92 var monitor = new Gtk.ComboBoxText ();121 var monitor = new Gtk.ComboBoxText ();
93 monitor.append ("-1", _("Primary Monitor"));122 monitor.append ("-1", _("Primary Monitor"));
94 int i = 0;123 int i = 0;
@@ -105,9 +134,13 @@
105 dock_grid.attach (icon_size, 3, 0, 1, 1);134 dock_grid.attach (icon_size, 3, 0, 1, 1);
106 dock_grid.attach (new LLabel.right (_("Hide Mode:")), 0, 1, 2, 1);135 dock_grid.attach (new LLabel.right (_("Hide Mode:")), 0, 1, 2, 1);
107 dock_grid.attach (hide_mode, 2, 1, 2, 1);136 dock_grid.attach (hide_mode, 2, 1, 2, 1);
137 if (theme_index > 1) {
138 dock_grid.attach (new LLabel.right (_("Theme:")), 0, 2, 2, 1);
139 dock_grid.attach (theme, 2, 2, 2, 1);
140 }
108 if (i > 1) {141 if (i > 1) {
109 dock_grid.attach (new LLabel.right (_("Monitor:")), 0, 2, 2, 1);142 dock_grid.attach (new LLabel.right (_("Monitor:")), 0, 3, 2, 1);
110 dock_grid.attach (monitor, 2, 2, 2, 1);143 dock_grid.attach (monitor, 2, 3, 2, 1);
111 }144 }
112 145
113 notebook.append_page (dock_grid, new Gtk.Label (_("Dock")));146 notebook.append_page (dock_grid, new Gtk.Label (_("Dock")));

Subscribers

People subscribed via source and target branches

to all changes: