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

Proposed by Michael Terry
Status: Merged
Approved by: Michael Terry
Approved revision: 778
Merged at revision: 778
Proposed branch: lp:~mterry/unity-greeter/dbus-interface
Merge into: lp:unity-greeter
Prerequisite: lp:~mterry/unity-greeter/indicator-gsettings
Diff against target: 103 lines (+60/-1)
2 files modified
src/greeter-list.vala (+49/-1)
src/menubar.vala (+11/-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 Approve
Robert Ancell Approve
Review via email: mp+151594@code.launchpad.net

This proposal supersedes 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 : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Terry (mterry) wrote : Posted in a previous version of this proposal

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.

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

FAILED: Continuous integration, rev:778
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mterry/unity-greeter/dbus-interface/+merge/151594/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/unity-greeter-ci/7/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-greeter-ci/./label=precise/7/console

Click here to trigger a rebuild:
http://jenkins.qa.ubuntu.com/job/unity-greeter-ci/7//rebuild/?

review: Needs Fixing (continuous-integration)
Revision history for this message
Allan LeSage (allanlesage) wrote :

Updated our Jenkins config and tested separately, appears ok--this should ameliorate PS Jenkins bot's complaints.

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 'src/greeter-list.vala'
2--- src/greeter-list.vala 2013-01-03 15:15:54 +0000
3+++ src/greeter-list.vala 2013-03-04 19:11:26 +0000
4@@ -24,6 +24,22 @@
5 return (int) (size % grid_size) / 2;
6 }
7
8+[DBus (name="com.canonical.UnityGreeter.List")]
9+public class ListDBusInterface : Object
10+{
11+ private GreeterList list;
12+
13+ public ListDBusInterface (GreeterList list)
14+ {
15+ this.list = list;
16+ }
17+
18+ public void set_active_entry (string entry_name)
19+ {
20+ list.set_active_entry (entry_name);
21+ }
22+}
23+
24 public abstract class GreeterList : FadableBox
25 {
26 public Background background { get; construct; }
27@@ -49,6 +65,7 @@
28
29 protected List<PromptBox> entries = null;
30
31+ private ListDBusInterface dbus_object;
32
33 private double scroll_target_location;
34 private double scroll_start_location;
35@@ -152,6 +169,29 @@
36
37 scroll_timer = new AnimateTimer (AnimateTimer.ease_out_quint, AnimateTimer.FAST);
38 scroll_timer.animate.connect (animate_scrolling);
39+
40+ try
41+ {
42+ Bus.get.begin (BusType.SESSION, null, on_bus_acquired);
43+ }
44+ catch (IOError e)
45+ {
46+ debug ("Error getting session bus: %s", e.message);
47+ }
48+ }
49+
50+ private void on_bus_acquired (Object? obj, AsyncResult res)
51+ {
52+ try
53+ {
54+ var conn = Bus.get.end (res);
55+ this.dbus_object = new ListDBusInterface (this);
56+ conn.register_object ("/list", this.dbus_object);
57+ }
58+ catch (IOError e)
59+ {
60+ debug ("Error registering user list dbus object: %s", e.message);
61+ }
62 }
63
64 public enum ScrollTarget
65@@ -354,7 +394,15 @@
66 {
67 var e = find_entry (name);
68 if (e != null)
69- select_entry (e, 1.0);
70+ {
71+ var direction = 1.0;
72+ if (selected_entry != null &&
73+ entries.index (selected_entry) > entries.index (e))
74+ {
75+ direction = -1.0;
76+ }
77+ select_entry (e, direction);
78+ }
79 }
80
81 public void set_active_first_entry_with_prefix (string prefix)
82
83=== modified file 'src/menubar.vala'
84--- src/menubar.vala 2013-03-04 19:11:26 +0000
85+++ src/menubar.vala 2013-03-04 19:11:26 +0000
86@@ -370,6 +370,17 @@
87 /* Hint to have gnome-settings-daemon run in greeter mode */
88 greeter_set_env ("RUNNING_UNDER_GDM", "1");
89
90+ /* Let indicators know about our unique dbus name */
91+ try
92+ {
93+ var conn = Bus.get_sync (BusType.SESSION);
94+ greeter_set_env ("UNITY_GREETER_DBUS_NAME", conn.get_unique_name ());
95+ }
96+ catch (IOError e)
97+ {
98+ debug ("Could not set DBUS_NAME: %s", e.message);
99+ }
100+
101 debug ("LANG=%s LANGUAGE=%s", Environment.get_variable ("LANG"), Environment.get_variable ("LANGUAGE"));
102
103 var indicator_list = UGSettings.get_strv(UGSettings.KEY_INDICATORS);

Subscribers

People subscribed via source and target branches