Merge lp:~mterry/unity-greeter/dbus-interface into lp:unity-greeter

Proposed by Michael Terry
Status: Superseded
Proposed branch: lp:~mterry/unity-greeter/dbus-interface
Merge into: lp:unity-greeter
Diff against target: 212 lines (+111/-23)
4 files modified
data/com.canonical.unity-greeter.gschema.xml (+4/-0)
src/greeter-list.vala (+49/-1)
src/menubar.vala (+51/-22)
src/settings.vala (+7/-0)
To merge this branch: bzr merge lp:~mterry/unity-greeter/dbus-interface
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Unity Greeter Development Team Pending
Review via email: mp+151587@code.launchpad.net

This proposal has been superseded by a proposal from 2013-03-04.

Commit message

Expose a dbus session interface for setting active users.

Description of the change

Expose a dbus session interface for setting active users. This could be useful for custom indicators (which can only happen after https://code.launchpad.net/~mterry/unity-greeter/indicator-gsettings/+merge/151573 )

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
Michael Terry (mterry) wrote :

Wait, I'm just now realizing you said elsewhere: "there could potentially be more than one greeter running at the same time so the bus address would need to be unique"

When does LightDM spawn more than one? I can rework patch to fit.

777. By Michael Terry

Merge indicator-gsettings branch

778. By Michael Terry

Use unique dbus name, rather than claiming a global one

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/com.canonical.unity-greeter.gschema.xml'
--- data/com.canonical.unity-greeter.gschema.xml 2012-09-11 17:52:41 +0000
+++ data/com.canonical.unity-greeter.gschema.xml 2013-03-04 19:12:20 +0000
@@ -82,5 +82,9 @@
82 <default>true</default>82 <default>true</default>
83 <summary>Whether to play sound when greeter is ready</summary>83 <summary>Whether to play sound when greeter is ready</summary>
84 </key>84 </key>
85 <key name="indicators" type="as">
86 <default>['ug-keyboard', 'ug-accessibility', 'session', 'datetime', 'power', 'soundmenu', 'application']</default>
87 <summary>Which indicators to load</summary>
88 </key>
85 </schema>89 </schema>
86</schemalist>90</schemalist>
8791
=== modified file 'src/greeter-list.vala'
--- src/greeter-list.vala 2013-01-03 15:15:54 +0000
+++ src/greeter-list.vala 2013-03-04 19:12:20 +0000
@@ -24,6 +24,22 @@
24 return (int) (size % grid_size) / 2;24 return (int) (size % grid_size) / 2;
25}25}
2626
27[DBus (name="com.canonical.UnityGreeter.List")]
28public class ListDBusInterface : Object
29{
30 private GreeterList list;
31
32 public ListDBusInterface (GreeterList list)
33 {
34 this.list = list;
35 }
36
37 public void set_active_entry (string entry_name)
38 {
39 list.set_active_entry (entry_name);
40 }
41}
42
27public abstract class GreeterList : FadableBox43public abstract class GreeterList : FadableBox
28{44{
29 public Background background { get; construct; }45 public Background background { get; construct; }
@@ -49,6 +65,7 @@
4965
50 protected List<PromptBox> entries = null;66 protected List<PromptBox> entries = null;
5167
68 private ListDBusInterface dbus_object;
5269
53 private double scroll_target_location;70 private double scroll_target_location;
54 private double scroll_start_location;71 private double scroll_start_location;
@@ -152,6 +169,29 @@
152169
153 scroll_timer = new AnimateTimer (AnimateTimer.ease_out_quint, AnimateTimer.FAST);170 scroll_timer = new AnimateTimer (AnimateTimer.ease_out_quint, AnimateTimer.FAST);
154 scroll_timer.animate.connect (animate_scrolling);171 scroll_timer.animate.connect (animate_scrolling);
172
173 try
174 {
175 Bus.get.begin (BusType.SESSION, null, on_bus_acquired);
176 }
177 catch (IOError e)
178 {
179 debug ("Error getting session bus: %s", e.message);
180 }
181 }
182
183 private void on_bus_acquired (Object? obj, AsyncResult res)
184 {
185 try
186 {
187 var conn = Bus.get.end (res);
188 this.dbus_object = new ListDBusInterface (this);
189 conn.register_object ("/list", this.dbus_object);
190 }
191 catch (IOError e)
192 {
193 debug ("Error registering user list dbus object: %s", e.message);
194 }
155 }195 }
156196
157 public enum ScrollTarget197 public enum ScrollTarget
@@ -354,7 +394,15 @@
354 {394 {
355 var e = find_entry (name);395 var e = find_entry (name);
356 if (e != null)396 if (e != null)
357 select_entry (e, 1.0);397 {
398 var direction = 1.0;
399 if (selected_entry != null &&
400 entries.index (selected_entry) > entries.index (e))
401 {
402 direction = -1.0;
403 }
404 select_entry (e, direction);
405 }
358 }406 }
359407
360 public void set_active_first_entry_with_prefix (string prefix)408 public void set_active_first_entry_with_prefix (string prefix)
361409
=== modified file 'src/menubar.vala'
--- src/menubar.vala 2013-02-20 16:17:42 +0000
+++ src/menubar.vala 2013-03-04 19:12:20 +0000
@@ -322,6 +322,42 @@
322 return keyboard_item;322 return keyboard_item;
323 }323 }
324324
325 private void load_indicator (string indicator_name)
326 {
327 if (indicator_name == "ug-keyboard")
328 {
329 var keyboard_item = make_keyboard_indicator ();
330 insert (keyboard_item, (int) get_children ().length () - 1);
331 }
332 else if (indicator_name == "ug-accessibility")
333 {
334 var a11y_item = make_a11y_indicator ();
335 insert (a11y_item, (int) get_children ().length () - 1);
336 }
337 else
338 {
339 // Find file, if it exists
340 string[] names_to_try = {"lib" + indicator_name + ".so",
341 indicator_name + ".so",
342 indicator_name};
343 foreach (var filename in names_to_try)
344 {
345 var full_path = Path.build_filename (Config.INDICATORDIR, filename);
346 var io = new Indicator.Object.from_file (full_path);
347 if (io == null)
348 continue;
349
350 indicator_objects.append (io);
351 io.entry_added.connect (indicator_added_cb);
352 io.entry_removed.connect (indicator_removed_cb);
353 foreach (var entry in io.get_entries ())
354 indicator_added_cb (io, entry);
355
356 break;
357 }
358 }
359 }
360
325 private void setup_indicators ()361 private void setup_indicators ()
326 {362 {
327 /* Set indicators to run with reduced functionality */363 /* Set indicators to run with reduced functionality */
@@ -334,30 +370,23 @@
334 /* Hint to have gnome-settings-daemon run in greeter mode */370 /* Hint to have gnome-settings-daemon run in greeter mode */
335 greeter_set_env ("RUNNING_UNDER_GDM", "1");371 greeter_set_env ("RUNNING_UNDER_GDM", "1");
336372
337 var keyboard_item = make_keyboard_indicator ();373 /* Let indicators know about our unique dbus name */
338 insert (keyboard_item, (int) get_children ().length () - 1);374 try
339375 {
340 var a11y_item = make_a11y_indicator ();376 var conn = Bus.get_sync (BusType.SESSION);
341 insert (a11y_item, (int) get_children ().length () - 1);377 greeter_set_env ("UNITY_GREETER_DBUS_NAME", conn.get_unique_name ());
378 }
379 catch (IOError e)
380 {
381 debug ("Could not set DBUS_NAME: %s", e.message);
382 }
342383
343 debug ("LANG=%s LANGUAGE=%s", Environment.get_variable ("LANG"), Environment.get_variable ("LANGUAGE"));384 debug ("LANG=%s LANGUAGE=%s", Environment.get_variable ("LANG"), Environment.get_variable ("LANGUAGE"));
344 string[] filenames = { Path.build_filename (Config.INDICATORDIR, "libsession.so"),385
345 Path.build_filename (Config.INDICATORDIR, "libdatetime.so"),386 var indicator_list = UGSettings.get_strv(UGSettings.KEY_INDICATORS);
346 Path.build_filename (Config.INDICATORDIR, "libpower.so"),387 foreach (var indicator in indicator_list)
347 Path.build_filename (Config.INDICATORDIR, "libsoundmenu.so"),388 load_indicator(indicator);
348 Path.build_filename (Config.INDICATORDIR, "libapplication.so") };389
349 foreach (var filename in filenames)
350 {
351 var io = new Indicator.Object.from_file (filename);
352 if (io == null)
353 continue;
354
355 indicator_objects.append (io);
356 io.entry_added.connect (indicator_added_cb);
357 io.entry_removed.connect (indicator_removed_cb);
358 foreach (var entry in io.get_entries ())
359 indicator_added_cb (io, entry);
360 }
361 debug ("LANG=%s LANGUAGE=%s", Environment.get_variable ("LANG"), Environment.get_variable ("LANGUAGE"));390 debug ("LANG=%s LANGUAGE=%s", Environment.get_variable ("LANG"), Environment.get_variable ("LANGUAGE"));
362 }391 }
363392
364393
=== modified file 'src/settings.vala'
--- src/settings.vala 2012-09-11 17:52:41 +0000
+++ src/settings.vala 2013-03-04 19:12:20 +0000
@@ -37,6 +37,7 @@
37 public static const string KEY_HIGH_CONTRAST = "high-contrast";37 public static const string KEY_HIGH_CONTRAST = "high-contrast";
38 public static const string KEY_SCREEN_READER = "screen-reader";38 public static const string KEY_SCREEN_READER = "screen-reader";
39 public static const string KEY_PLAY_READY_SOUND = "play-ready-sound";39 public static const string KEY_PLAY_READY_SOUND = "play-ready-sound";
40 public static const string KEY_INDICATORS = "indicators";
4041
41 public static bool get_boolean (string key)42 public static bool get_boolean (string key)
42 {43 {
@@ -75,5 +76,11 @@
75 return gsettings.set_boolean (key, value);76 return gsettings.set_boolean (key, value);
76 }77 }
7778
79 public static string[] get_strv (string key)
80 {
81 var gsettings = new Settings (SCHEMA);
82 return gsettings.get_strv (key);
83 }
84
78 private static const string SCHEMA = "com.canonical.unity-greeter";85 private static const string SCHEMA = "com.canonical.unity-greeter";
79}86}

Subscribers

People subscribed via source and target branches