Merge lp:~mterry/unity-greeter/indicator-gsettings into lp:unity-greeter

Proposed by Michael Terry
Status: Merged
Approved by: Michael Terry
Approved revision: 776
Merged at revision: 777
Proposed branch: lp:~mterry/unity-greeter/indicator-gsettings
Merge into: lp:unity-greeter
Diff against target: 120 lines (+52/-23)
3 files modified
data/com.canonical.unity-greeter.gschema.xml (+4/-0)
src/menubar.vala (+41/-23)
src/settings.vala (+7/-0)
To merge this branch: bzr merge lp:~mterry/unity-greeter/indicator-gsettings
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Robert Ancell Approve
Review via email: mp+151573@code.launchpad.net

Commit message

Allow system administrators to specify a different list of indicators by making it customizable via gsettings.

Description of the change

Allow system administrators to specify a different list of indicators by making it customizable via gsettings.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Looks good.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/com.canonical.unity-greeter.gschema.xml'
2--- data/com.canonical.unity-greeter.gschema.xml 2012-09-11 17:52:41 +0000
3+++ data/com.canonical.unity-greeter.gschema.xml 2013-03-04 17:51:25 +0000
4@@ -82,5 +82,9 @@
5 <default>true</default>
6 <summary>Whether to play sound when greeter is ready</summary>
7 </key>
8+ <key name="indicators" type="as">
9+ <default>['ug-keyboard', 'ug-accessibility', 'session', 'datetime', 'power', 'soundmenu', 'application']</default>
10+ <summary>Which indicators to load</summary>
11+ </key>
12 </schema>
13 </schemalist>
14
15=== modified file 'src/menubar.vala'
16--- src/menubar.vala 2013-02-20 16:17:42 +0000
17+++ src/menubar.vala 2013-03-04 17:51:25 +0000
18@@ -322,6 +322,42 @@
19 return keyboard_item;
20 }
21
22+ private void load_indicator (string indicator_name)
23+ {
24+ if (indicator_name == "ug-keyboard")
25+ {
26+ var keyboard_item = make_keyboard_indicator ();
27+ insert (keyboard_item, (int) get_children ().length () - 1);
28+ }
29+ else if (indicator_name == "ug-accessibility")
30+ {
31+ var a11y_item = make_a11y_indicator ();
32+ insert (a11y_item, (int) get_children ().length () - 1);
33+ }
34+ else
35+ {
36+ // Find file, if it exists
37+ string[] names_to_try = {"lib" + indicator_name + ".so",
38+ indicator_name + ".so",
39+ indicator_name};
40+ foreach (var filename in names_to_try)
41+ {
42+ var full_path = Path.build_filename (Config.INDICATORDIR, filename);
43+ var io = new Indicator.Object.from_file (full_path);
44+ if (io == null)
45+ continue;
46+
47+ indicator_objects.append (io);
48+ io.entry_added.connect (indicator_added_cb);
49+ io.entry_removed.connect (indicator_removed_cb);
50+ foreach (var entry in io.get_entries ())
51+ indicator_added_cb (io, entry);
52+
53+ break;
54+ }
55+ }
56+ }
57+
58 private void setup_indicators ()
59 {
60 /* Set indicators to run with reduced functionality */
61@@ -334,30 +370,12 @@
62 /* Hint to have gnome-settings-daemon run in greeter mode */
63 greeter_set_env ("RUNNING_UNDER_GDM", "1");
64
65- var keyboard_item = make_keyboard_indicator ();
66- insert (keyboard_item, (int) get_children ().length () - 1);
67-
68- var a11y_item = make_a11y_indicator ();
69- insert (a11y_item, (int) get_children ().length () - 1);
70-
71 debug ("LANG=%s LANGUAGE=%s", Environment.get_variable ("LANG"), Environment.get_variable ("LANGUAGE"));
72- string[] filenames = { Path.build_filename (Config.INDICATORDIR, "libsession.so"),
73- Path.build_filename (Config.INDICATORDIR, "libdatetime.so"),
74- Path.build_filename (Config.INDICATORDIR, "libpower.so"),
75- Path.build_filename (Config.INDICATORDIR, "libsoundmenu.so"),
76- Path.build_filename (Config.INDICATORDIR, "libapplication.so") };
77- foreach (var filename in filenames)
78- {
79- var io = new Indicator.Object.from_file (filename);
80- if (io == null)
81- continue;
82-
83- indicator_objects.append (io);
84- io.entry_added.connect (indicator_added_cb);
85- io.entry_removed.connect (indicator_removed_cb);
86- foreach (var entry in io.get_entries ())
87- indicator_added_cb (io, entry);
88- }
89+
90+ var indicator_list = UGSettings.get_strv(UGSettings.KEY_INDICATORS);
91+ foreach (var indicator in indicator_list)
92+ load_indicator(indicator);
93+
94 debug ("LANG=%s LANGUAGE=%s", Environment.get_variable ("LANG"), Environment.get_variable ("LANGUAGE"));
95 }
96
97
98=== modified file 'src/settings.vala'
99--- src/settings.vala 2012-09-11 17:52:41 +0000
100+++ src/settings.vala 2013-03-04 17:51:25 +0000
101@@ -37,6 +37,7 @@
102 public static const string KEY_HIGH_CONTRAST = "high-contrast";
103 public static const string KEY_SCREEN_READER = "screen-reader";
104 public static const string KEY_PLAY_READY_SOUND = "play-ready-sound";
105+ public static const string KEY_INDICATORS = "indicators";
106
107 public static bool get_boolean (string key)
108 {
109@@ -75,5 +76,11 @@
110 return gsettings.set_boolean (key, value);
111 }
112
113+ public static string[] get_strv (string key)
114+ {
115+ var gsettings = new Settings (SCHEMA);
116+ return gsettings.get_strv (key);
117+ }
118+
119 private static const string SCHEMA = "com.canonical.unity-greeter";
120 }

Subscribers

People subscribed via source and target branches