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
1=== modified file 'src/PlankSettings.vala'
2--- src/PlankSettings.vala 2012-07-22 20:51:01 +0000
3+++ src/PlankSettings.vala 2013-03-03 23:02:21 +0000
4@@ -34,6 +34,21 @@
5 }
6 }
7
8+ private string _theme;
9+ public string theme {
10+ get {
11+ try {
12+ _theme = configs.get_value ("PlankDockPreferences", "Theme");
13+ return _theme;
14+ } catch (Error e) { warning (e.message); }
15+ return "";
16+ }
17+ set {
18+ configs.set_string ("PlankDockPreferences", "Theme", value);
19+ save ();
20+ }
21+ }
22+
23 public int monitor {
24 get {
25 try {
26
27=== modified file 'src/desktop-plug.vala'
28--- src/desktop-plug.vala 2012-12-15 05:21:14 +0000
29+++ src/desktop-plug.vala 2013-03-03 23:02:21 +0000
30@@ -89,6 +89,35 @@
31 hide_mode.halign = Gtk.Align.START;
32 hide_mode.width_request = 164;
33
34+
35+ var theme = new Gtk.ComboBoxText ();
36+
37+ int theme_index = 0;
38+ try {
39+
40+ string name;
41+ var dirs = Environment.get_system_data_dirs ();
42+ dirs += Environment.get_user_data_dir ();
43+
44+ foreach (string dir in dirs) {
45+ if (FileUtils.test (dir + "/plank/themes", FileTest.EXISTS)) {
46+ var d = Dir.open(dir + "/plank/themes");
47+ while ((name = d.read_name()) != null) {
48+ theme.append(theme_index.to_string (), _(name));
49+ if (PlankSettings.get_default ().theme.to_string () == name)
50+ theme.active = theme_index;
51+ theme_index++;
52+ }
53+ }
54+ }
55+ } catch (GLib.FileError e){
56+ warning (e.message);
57+ }
58+
59+ theme.changed.connect (() => PlankSettings.get_default ().theme = theme.get_active_text ());
60+ theme.halign = Gtk.Align.START;
61+ theme.width_request = 164;
62+
63 var monitor = new Gtk.ComboBoxText ();
64 monitor.append ("-1", _("Primary Monitor"));
65 int i = 0;
66@@ -105,9 +134,13 @@
67 dock_grid.attach (icon_size, 3, 0, 1, 1);
68 dock_grid.attach (new LLabel.right (_("Hide Mode:")), 0, 1, 2, 1);
69 dock_grid.attach (hide_mode, 2, 1, 2, 1);
70+ if (theme_index > 1) {
71+ dock_grid.attach (new LLabel.right (_("Theme:")), 0, 2, 2, 1);
72+ dock_grid.attach (theme, 2, 2, 2, 1);
73+ }
74 if (i > 1) {
75- dock_grid.attach (new LLabel.right (_("Monitor:")), 0, 2, 2, 1);
76- dock_grid.attach (monitor, 2, 2, 2, 1);
77+ dock_grid.attach (new LLabel.right (_("Monitor:")), 0, 3, 2, 1);
78+ dock_grid.attach (monitor, 2, 3, 2, 1);
79 }
80
81 notebook.append_page (dock_grid, new Gtk.Label (_("Dock")));

Subscribers

People subscribed via source and target branches

to all changes: