Merge lp:~kazade/wingpanel/indicator-loading into lp:~elementary-pantheon/wingpanel/wingpanel

Proposed by Kazade
Status: Merged
Merged at revision: 29
Proposed branch: lp:~kazade/wingpanel/indicator-loading
Merge into: lp:~elementary-pantheon/wingpanel/wingpanel
Diff against target: 53 lines (+26/-3)
2 files modified
wingpanel-config.vala (+1/-1)
wingpanel-indicator-file-model.vala (+25/-2)
To merge this branch: bzr merge lp:~kazade/wingpanel/indicator-loading
Reviewer Review Type Date Requested Status
Cris Dywan (community) Approve
Review via email: mp+44556@code.launchpad.net

This proposal supersedes a proposal from 2010-12-22.

To post a comment you must log in.
Revision history for this message
Cris Dywan (kalikiana) wrote : Posted in a previous version of this proposal

Please use critical() instead of print(), since the panel is unusable in that case. And please limit the lines to ~80 columns.

review: Needs Fixing
Revision history for this message
Cris Dywan (kalikiana) wrote :

Looks good and quickly tested, thanks a lot.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'wingpanel-config.vala'
2--- wingpanel-config.vala 2010-12-20 23:12:54 +0000
3+++ wingpanel-config.vala 2010-12-23 09:14:09 +0000
4@@ -1,3 +1,3 @@
5 namespace Wingpanel.Config {
6- public const string INDICATORDIR = "/usr/lib/indicators/4/";
7+ public const string INDICATORDIR = "/usr/lib/indicators/";
8 }
9
10=== modified file 'wingpanel-indicator-file-model.vala'
11--- wingpanel-indicator-file-model.vala 2010-12-22 15:31:51 +0000
12+++ wingpanel-indicator-file-model.vala 2010-12-23 09:14:09 +0000
13@@ -95,7 +95,30 @@
14 //Gtk.IconTheme.get_default ().append_search_path (Wingpanel.Config.INDICATORICONSDIR);
15
16 /* Start loading 'em in. .so are located in INDICATORDIR*/
17- var dir = File.new_for_path (Wingpanel.Config.INDICATORDIR);
18+
19+ //Supported versions
20+ ArrayList<string> versions = new Gee.ArrayList<string>();
21+ versions.add("3");
22+ versions.add("4");
23+
24+ File dir = null;
25+ //See if any of the version directories exist in INDICATORDIR
26+ foreach(string version in versions) {
27+ var version_path = File.new_for_path (
28+ Wingpanel.Config.INDICATORDIR).get_child(version);
29+ if (version_path.query_exists()) {
30+ dir = version_path;
31+ break;
32+ }
33+ }
34+
35+ //If none exist, then print an error and return
36+ if(dir == null) {
37+ critical ("No indicatordirectory found in: %s. Check configuration.",
38+ Wingpanel.Config.INDICATORDIR);
39+ return;
40+ }
41+
42 try
43 {
44 var e = dir.enumerate_children (FILE_ATTRIBUTE_STANDARD_NAME, 0, null);
45@@ -123,7 +146,7 @@
46 sos.sort ((CompareFunc)indicator_sort_func);
47
48 foreach (string leaf in sos)
49- this.load_indicator (Wingpanel.Config.INDICATORDIR + leaf, leaf);
50+ this.load_indicator (dir.get_path() + "/" + leaf, leaf);
51 }
52 catch (Error error)
53 {

Subscribers

People subscribed via source and target branches