Merge lp:~larsu/unity-greeter/indicator-ng into lp:unity-greeter

Proposed by Lars Karlitski
Status: Merged
Approved by: Lars Karlitski
Approved revision: 900
Merged at revision: 907
Proposed branch: lp:~larsu/unity-greeter/indicator-ng
Merge into: lp:unity-greeter
Diff against target: 212 lines (+82/-16)
6 files modified
configure.ac (+3/-0)
debian/control (+1/-0)
src/config.vapi (+1/-0)
src/indicator.vapi (+11/-4)
src/menubar.vala (+65/-12)
src/unity-greeter.vala (+1/-0)
To merge this branch: bzr merge lp:~larsu/unity-greeter/indicator-ng
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Sebastien Bacher Approve
Review via email: mp+173082@code.launchpad.net

Commit message

Support new indicator services

Indicator files are read from /usr/share/unity/indicators. They're shown in the greeter's panel if export a menu for the 'desktop_greeter' profile.

Description of the change

Support new indicator services

Indicator files are read from /usr/share/unity/indicators. They're shown in the greeter's panel if export a menu for the 'desktop_greeter' profile.

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks Lars, the code looks fine to me but:
- it seems to not work (and I built indicator-session-ng and indicator-datetime which both use gmenu and have a desktop_greeter profile)
- how does the new indicators play with the gsettings indicators list added in https://code.launchpad.net/~mterry/unity-greeter/indicator-gsettings/+merge/151573 ?

Revision history for this message
Lars Karlitski (larsu) wrote :

> Thanks Lars, the code looks fine to me but:
> - it seems to not work (and I built indicator-session-ng and indicator-
> datetime which both use gmenu and have a desktop_greeter profile)

Oops :) Fixed in r899.

> - how does the new indicators play with the gsettings indicators list added in
> https://code.launchpad.net/~mterry/unity-greeter/indicator-
> gsettings/+merge/151573 ?

Fixed in r900, as discussed on irc. I didn't test it yet, because I couldn't figure out how to change settings for the lightdm user.

Thanks for testing!

Revision history for this message
Sebastien Bacher (seb128) wrote :

> Fixed in r900, as discussed on irc. I didn't test it yet, because I couldn't figure out how to change settings for the lightdm user.

usually I just change the system default, e.g edit the schemas or add a .override and run glib-compile-schemas. If you want to edit the lightdm user config, you need to do something around the lines of "sudo su lightdm -s /bin/sh gsettings set..."

Revision history for this message
Sebastien Bacher (seb128) wrote :

I've been running that for some days and it works fine for me, code looks fine as well

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

FAILED: Autolanding.
No commit message was specified in the merge proposal. Hit 'Add commit message' on the merge proposal web page or follow the link below. You can approve the merge proposal yourself to rerun.
https://code.launchpad.net/~larsu/unity-greeter/indicator-ng/+merge/173082/+edit-commit-message

review: Needs Fixing (continuous-integration)
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 'configure.ac'
2--- configure.ac 2013-06-20 18:17:28 +0000
3+++ configure.ac 2013-07-05 22:43:22 +0000
4@@ -21,6 +21,7 @@
5 gtk+-3.0
6 gdk-x11-3.0
7 indicator3-0.4
8+ libido3-0.1 >= 13.10.0
9 liblightdm-gobject-1 >= 1.4.0
10 freetype2
11 cairo-ft
12@@ -28,6 +29,8 @@
13 x11
14 ])
15
16+AC_DEFINE_UNQUOTED([INDICATOR_FILE_DIR], ["${prefix}/share/unity/indicators"], [Indicator files are searched for in this directory])
17+
18 INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator3-0.4`
19 AC_SUBST(INDICATORDIR)
20
21
22=== modified file 'debian/control'
23--- debian/control 2013-02-20 16:35:10 +0000
24+++ debian/control 2013-07-05 22:43:22 +0000
25@@ -13,6 +13,7 @@
26 libcanberra-dev,
27 libgtk-3-dev,
28 libindicator3-dev,
29+ libido3-0.1-dev (>= 13.10.0),
30 liblightdm-gobject-1-dev (>= 1.4.0),
31 valac-0.16,
32 xvfb,
33
34=== modified file 'src/config.vapi'
35--- src/config.vapi 2013-01-30 20:31:38 +0000
36+++ src/config.vapi 2013-07-05 22:43:22 +0000
37@@ -5,6 +5,7 @@
38 public const string LOCALEDIR;
39 public const string VERSION;
40 public const string CONFIG_FILE;
41+ public const string INDICATOR_FILE_DIR;
42 public const string PKGDATADIR;
43 public const string INDICATORDIR;
44 public const string GSD_BINARY;
45
46=== modified file 'src/indicator.vapi'
47--- src/indicator.vapi 2011-07-08 01:08:52 +0000
48+++ src/indicator.vapi 2013-07-05 22:43:22 +0000
49@@ -1,5 +1,3 @@
50-/* indicator3.vapi generated by vapigen, do not modify. */
51-
52 [CCode (cprefix = "Indicator", lower_case_cprefix = "indicator_")]
53 namespace Indicator {
54 [CCode (cheader_filename = "gtk/gtk.h,libindicator/indicator.h,libindicator/indicator-desktop-shortcuts.h,libindicator/indicator-image-helper.h,libindicator/indicator-object.h,libindicator/indicator-service.h,libindicator/indicator-service-manager.h")]
55@@ -38,6 +36,7 @@
56 [NoWrapper]
57 public virtual unowned string get_name_hint ();
58 public virtual bool get_show_now (Indicator.ObjectEntry entry);
59+ public virtual int get_position ();
60 [NoWrapper]
61 public virtual void reserved1 ();
62 [NoWrapper]
63@@ -48,8 +47,6 @@
64 public virtual void reserved4 ();
65 [NoWrapper]
66 public virtual void reserved5 ();
67- [NoWrapper]
68- public virtual void reserved6 ();
69 public void set_environment (string[] env);
70 public virtual signal void accessible_desc_update (Indicator.ObjectEntry entry);
71 public virtual signal void entry_added (Indicator.ObjectEntry entry);
72@@ -59,6 +56,11 @@
73 public virtual signal void menu_show (Indicator.ObjectEntry entry, uint timestamp);
74 public virtual signal void show_now_changed (Indicator.ObjectEntry entry, bool show_now_state);
75 }
76+ [CCode (cheader_filename = "libindicator/indicator-ng.h")]
77+ public class Ng : Object {
78+ [CCode (has_construct_function = false)]
79+ public Ng.for_profile (string filename, string profile) throws GLib.Error;
80+ }
81 [Compact]
82 [CCode (cheader_filename = "gtk/gtk.h,libindicator/indicator.h,libindicator/indicator-desktop-shortcuts.h,libindicator/indicator-image-helper.h,libindicator/indicator-object.h,libindicator/indicator-service.h,libindicator/indicator-service-manager.h")]
83 public class ObjectEntry {
84@@ -156,3 +158,8 @@
85 [CCode (cheader_filename = "gtk/gtk.h,libindicator/indicator.h,libindicator/indicator-desktop-shortcuts.h,libindicator/indicator-image-helper.h,libindicator/indicator-object.h,libindicator/indicator-service.h,libindicator/indicator-service-manager.h")]
86 public static void image_helper_update (Gtk.Image image, string name);
87 }
88+
89+[CCode (cheader_filename="libido/libido.h", lower_case_cprefix = "ido_")]
90+namespace Ido {
91+ public void init ();
92+}
93
94=== modified file 'src/menubar.vala'
95--- src/menubar.vala 2013-03-04 19:10:23 +0000
96+++ src/menubar.vala 2013-07-05 22:43:22 +0000
97@@ -322,6 +322,53 @@
98 return keyboard_item;
99 }
100
101+ private Indicator.Object? load_indicator_file (string indicator_name)
102+ {
103+ string dir = Config.INDICATOR_FILE_DIR;
104+ string path;
105+ Indicator.Object io;
106+
107+ /* To stay backwards compatible, use com.canonical.indicator as the default prefix */
108+ if (indicator_name.index_of_char ('.') < 0)
109+ path = @"$dir/com.canonical.indicator.$indicator_name";
110+ else
111+ path = @"$dir/$indicator_name";
112+
113+ try
114+ {
115+ io = new Indicator.Ng.for_profile (path, "desktop_greeter");
116+ }
117+ catch (FileError error)
118+ {
119+ /* the calling code handles file-not-found; don't warn here */
120+ return null;
121+ }
122+ catch (Error error)
123+ {
124+ warning ("unable to load %s: %s", indicator_name, error.message);
125+ return null;
126+ }
127+
128+ return io;
129+ }
130+
131+ private Indicator.Object? load_indicator_library (string indicator_name)
132+ {
133+ // Find file, if it exists
134+ string[] names_to_try = {"lib" + indicator_name + ".so",
135+ indicator_name + ".so",
136+ indicator_name};
137+ foreach (var filename in names_to_try)
138+ {
139+ var full_path = Path.build_filename (Config.INDICATORDIR, filename);
140+ var io = new Indicator.Object.from_file (full_path);
141+ if (io != null)
142+ return io;
143+ }
144+
145+ return null;
146+ }
147+
148 private void load_indicator (string indicator_name)
149 {
150 if (indicator_name == "ug-keyboard")
151@@ -336,24 +383,18 @@
152 }
153 else
154 {
155- // Find file, if it exists
156- string[] names_to_try = {"lib" + indicator_name + ".so",
157- indicator_name + ".so",
158- indicator_name};
159- foreach (var filename in names_to_try)
160+ var io = load_indicator_file (indicator_name);
161+
162+ if (io == null)
163+ io = load_indicator_library (indicator_name);
164+
165+ if (io != null)
166 {
167- var full_path = Path.build_filename (Config.INDICATORDIR, filename);
168- var io = new Indicator.Object.from_file (full_path);
169- if (io == null)
170- continue;
171-
172 indicator_objects.append (io);
173 io.entry_added.connect (indicator_added_cb);
174 io.entry_removed.connect (indicator_removed_cb);
175 foreach (var entry in io.get_entries ())
176 indicator_added_cb (io, entry);
177-
178- break;
179 }
180 }
181 }
182@@ -387,6 +428,18 @@
183 foreach (var indicator in indicator_list)
184 load_indicator(indicator);
185
186+ indicator_objects.sort((a, b) => {
187+ int pos_a = a.get_position ();
188+ int pos_b = b.get_position ();
189+
190+ if (pos_a < 0)
191+ pos_a = 1000;
192+ if (pos_b < 0)
193+ pos_b = 1000;
194+
195+ return pos_a - pos_b;
196+ });
197+
198 debug ("LANG=%s LANGUAGE=%s", Environment.get_variable ("LANG"), Environment.get_variable ("LANGUAGE"));
199 }
200
201
202=== modified file 'src/unity-greeter.vala'
203--- src/unity-greeter.vala 2013-02-20 16:17:42 +0000
204+++ src/unity-greeter.vala 2013-07-05 22:43:22 +0000
205@@ -434,6 +434,7 @@
206 }
207
208 Gtk.init (ref args);
209+ Ido.init ();
210
211 log_timer = new Timer ();
212 Log.set_default_handler (log_cb);

Subscribers

People subscribed via source and target branches