Merge lp:~parnold-x/wingpanel-indicator-ayatana/restrict_loading into lp:~wingpanel-devs/wingpanel-indicator-ayatana/trunk

Proposed by Djax
Status: Merged
Approved by: David Hewitt
Approved revision: 20
Merged at revision: 23
Proposed branch: lp:~parnold-x/wingpanel-indicator-ayatana/restrict_loading
Merge into: lp:~wingpanel-devs/wingpanel-indicator-ayatana/trunk
Diff against target: 48 lines (+5/-25)
1 file modified
src/IndicatorFactory.vala (+5/-25)
To merge this branch: bzr merge lp:~parnold-x/wingpanel-indicator-ayatana/restrict_loading
Reviewer Review Type Date Requested Status
David Hewitt code, function Approve
Review via email: mp+305409@code.launchpad.net

Commit message

restrict loading to libapplication.so

Description of the change

Restrict loading to libapplication.so
So when people install things like libappmenu and stuff these will not be loaded.

To post a comment you must log in.
Revision history for this message
David Hewitt (davidmhewitt) wrote :

libapplication.so seems to be the only one we need to concern ourselves with.

The other possible .so files that could live in that directory either duplicate functionality we have in other wingpanel indicators or break things entirely like in the case of libappmenu.so.

review: Approve (code, function)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/IndicatorFactory.vala'
2--- src/IndicatorFactory.vala 2015-05-07 20:29:38 +0000
3+++ src/IndicatorFactory.vala 2016-09-11 10:24:25 +0000
4@@ -24,40 +24,20 @@
5 public Gee.Collection<IndicatorIface> get_indicators () {
6 if (indicators == null) {
7 indicators = new Gee.LinkedList<IndicatorIface> ();
8- load_indicators ();
9+ load_indicator (File.new_for_path (Constants.AYANATAINDICATORDIR), "libapplication.so");
10 }
11
12 return indicators.read_only_view;
13 }
14
15- private void load_indicators () {
16- load_indicators_from_dir (Constants.AYANATAINDICATORDIR);
17- }
18-
19- private void load_indicators_from_dir (string dir_path) {
20- try {
21- var dir = File.new_for_path (dir_path);
22- var enumerator = dir.enumerate_children (FileAttribute.STANDARD_NAME,
23- FileQueryInfoFlags.NONE, null);
24- FileInfo file_info;
25-
26- while ((file_info = enumerator.next_file (null)) != null) {
27- string name = file_info.get_name ();
28- load_indicator (dir, name);
29- }
30- } catch (Error err) {
31- warning ("Unable to read indicators: %s", err.message);
32- }
33- }
34-
35 private void load_indicator (File parent_dir, string name) {
36 string indicator_path = parent_dir.get_child (name).get_path ();
37-
38+ if (!File.new_for_path (indicator_path).query_exists ()) {
39+ debug ("No ayatana support possible because there is no Indicator Library: %s", name);
40+ return;
41+ }
42 IndicatorAyatana.Object indicator = null;
43
44- if (!name.has_suffix (".so"))
45- return;
46-
47 debug ("Loading Indicator Library: %s", name);
48 indicator = new IndicatorAyatana.Object.from_file (indicator_path);
49

Subscribers

People subscribed via source and target branches

to all changes: