diff -Nru unity-greeter-0.2.9/debian/changelog unity-greeter-0.2.9/debian/changelog --- unity-greeter-0.2.9/debian/changelog 2013-02-18 10:42:07.000000000 +0000 +++ unity-greeter-0.2.9/debian/changelog 2013-06-14 13:37:12.000000000 +0000 @@ -1,3 +1,10 @@ +unity-greeter (0.2.9-0ubuntu1.2) precise; urgency=low + + * debian/patches/user_selection.patch: + - Add custom indicator support for system administrators (LP: #1155157) + + -- Ritesh Khadgaray Mon, 15 Apr 2013 10:47:46 +0530 + unity-greeter (0.2.9-0ubuntu1.1) precise; urgency=low * debian/patches/r402_pam_text.patch.patch: diff -Nru unity-greeter-0.2.9/debian/patches/series unity-greeter-0.2.9/debian/patches/series --- unity-greeter-0.2.9/debian/patches/series 2013-02-18 10:41:48.000000000 +0000 +++ unity-greeter-0.2.9/debian/patches/series 2013-06-14 13:37:12.000000000 +0000 @@ -1 +1,2 @@ r402_pam_text.patch +user_selection.patch diff -Nru unity-greeter-0.2.9/debian/patches/user_selection.patch unity-greeter-0.2.9/debian/patches/user_selection.patch --- unity-greeter-0.2.9/debian/patches/user_selection.patch 1970-01-01 00:00:00.000000000 +0000 +++ unity-greeter-0.2.9/debian/patches/user_selection.patch 2013-06-14 13:37:13.000000000 +0000 @@ -0,0 +1,217 @@ +diff -Naurp unity-greeter-0.2.9/data/com.canonical.unity-greeter.gschema.xml unity-greeter-0.2.9.new/data/com.canonical.unity-greeter.gschema.xml +--- unity-greeter-0.2.9/data/com.canonical.unity-greeter.gschema.xml 2012-11-20 09:27:06.000000000 +0530 ++++ unity-greeter-0.2.9.new/data/com.canonical.unity-greeter.gschema.xml 2013-04-15 09:50:32.047602768 +0530 +@@ -82,5 +82,9 @@ + true + Whether to play sound when greeter is ready + ++ ++ ['ug-keyboard', 'ug-accessibility', 'session', 'datetime', 'power', 'soundmenu', 'application'] ++ Which indicators to load ++ + + +diff -Naurp unity-greeter-0.2.9/src/menubar.vala unity-greeter-0.2.9.new/src/menubar.vala +--- unity-greeter-0.2.9/src/menubar.vala 2012-11-21 03:26:53.000000000 +0530 ++++ unity-greeter-0.2.9.new/src/menubar.vala 2013-04-15 13:41:53.526560172 +0530 +@@ -297,6 +297,42 @@ public class MenuBar : Gtk.MenuBar + return keyboard_item; + } + ++ private void load_indicator (string indicator_name) ++ { ++ if (indicator_name == "ug-keyboard") ++ { ++ var keyboard_item = make_keyboard_indicator (); ++ insert (keyboard_item, (int) get_children ().length () - 1); ++ } ++ else if (indicator_name == "ug-accessibility") ++ { ++ var a11y_item = make_a11y_indicator (); ++ insert (a11y_item, (int) get_children ().length () - 1); ++ } ++ else ++ { ++ // Find file, if it exists ++ string[] names_to_try = {"lib" + indicator_name + ".so", ++ indicator_name + ".so", ++ indicator_name}; ++ foreach (var filename in names_to_try) ++ { ++ var full_path = Path.build_filename (Config.INDICATORDIR, filename); ++ var io = new Indicator.Object.from_file (full_path); ++ if (io == null) ++ continue; ++ ++ indicator_objects.append (io); ++ io.entry_added.connect (indicator_added_cb); ++ io.entry_removed.connect (indicator_removed_cb); ++ foreach (var entry in io.get_entries ()) ++ indicator_added_cb (io, entry); ++ ++ break; ++ } ++ } ++ } ++ + private void setup_indicators () + { + /* Set indicators to run with reduced functionality */ +@@ -309,29 +345,23 @@ public class MenuBar : Gtk.MenuBar + /* Hint to have gnome-settings-daemon run in greeter mode */ + greeter_set_env ("RUNNING_UNDER_GDM", "1"); + +- var keyboard_item = make_keyboard_indicator (); +- insert (keyboard_item, (int) get_children ().length () - 1); +- +- var a11y_item = make_a11y_indicator (); +- insert (a11y_item, (int) get_children ().length () - 1); +- +- debug ("LANG=%s LANGUAGE=%s", Environment.get_variable ("LANG"), Environment.get_variable ("LANGUAGE")); +- string[] filenames = {Path.build_filename (Config.INDICATORDIR, "libsession.so"), +- Path.build_filename (Config.INDICATORDIR, "libdatetime.so"), +- Path.build_filename (Config.INDICATORDIR, "libpower.so"), +- Path.build_filename (Config.INDICATORDIR, "libsoundmenu.so")}; +- foreach (var filename in filenames) ++ /* Let indicators know about our unique dbus name */ ++ try ++ { ++ var conn = Bus.get_sync (BusType.SESSION); ++ greeter_set_env ("UNITY_GREETER_DBUS_NAME", conn.get_unique_name ()); ++ } ++ catch (IOError e) + { +- var io = new Indicator.Object.from_file (filename); +- if (io == null) +- continue; +- +- indicator_objects.append (io); +- io.entry_added.connect (indicator_added_cb); +- io.entry_removed.connect (indicator_removed_cb); +- foreach (var entry in io.get_entries ()) +- indicator_added_cb (io, entry); ++ debug ("Could not set DBUS_NAME: %s", e.message); + } ++ ++ debug ("LANG=%s LANGUAGE=%s", Environment.get_variable ("LANG"), Environment.get_variable ("LANGUAGE")); ++ ++ var indicator_list = UGSettings.get_strv(UGSettings.KEY_INDICATORS); ++ foreach (var indicator in indicator_list) ++ load_indicator(indicator); ++ + debug ("LANG=%s LANGUAGE=%s", Environment.get_variable ("LANG"), Environment.get_variable ("LANGUAGE")); + } + +diff -Naurp unity-greeter-0.2.9/src/settings.vala unity-greeter-0.2.9.new/src/settings.vala +--- unity-greeter-0.2.9/src/settings.vala 2012-11-20 09:27:06.000000000 +0530 ++++ unity-greeter-0.2.9.new/src/settings.vala 2013-04-15 13:43:08.110562184 +0530 +@@ -37,6 +37,7 @@ public class UGSettings + public static const string KEY_HIGH_CONTRAST = "high-contrast"; + public static const string KEY_SCREEN_READER = "screen-reader"; + public static const string KEY_PLAY_READY_SOUND = "play-ready-sound"; ++ public static const string KEY_INDICATORS = "indicators"; + + public static bool get_boolean (string key) + { +@@ -62,5 +63,11 @@ public class UGSettings + return gsettings.set_boolean (key, value); + } + ++ public static string[] get_strv (string key) ++ { ++ var gsettings = new Settings (SCHEMA); ++ return gsettings.get_strv (key); ++ } ++ + private static const string SCHEMA = "com.canonical.unity-greeter"; + } +diff -Naurp unity-greeter-0.2.9/src/user-list.vala unity-greeter-0.2.9.new/src/user-list.vala +--- unity-greeter-0.2.9/src/user-list.vala 2013-04-15 09:32:16.000000000 +0530 ++++ unity-greeter-0.2.9.new/src/user-list.vala 2013-04-15 09:46:34.843591035 +0530 +@@ -23,6 +23,22 @@ private int get_grid_offset (int size) + return (int) (size % grid_size) / 2; + } + ++[DBus (name="com.canonical.UnityGreeter.List")] ++public class ListDBusInterface : Object ++{ ++ private UserList list; ++ ++ public ListDBusInterface (UserList list) ++ { ++ this.list = list; ++ } ++ ++ public void set_active_entry (string entry_name) ++ { ++ list.set_active_entry (entry_name); ++ } ++} ++ + public class UserEntry + { + /* Unique name for this entry */ +@@ -99,6 +115,8 @@ public class UserList : Gtk.EventBox + + private List entries = null; + ++ private ListDBusInterface dbus_object; ++ + private Gdk.Pixbuf message_pixbuf; + + private double scroll_target_location; +@@ -263,12 +281,36 @@ public class UserList : Gtk.EventBox + scroll_timer = new AnimateTimer (AnimateTimer.ease_out_quint, AnimateTimer.FAST); + scroll_timer.animate.connect (scroll_animate_cb); + ++ try ++ { ++ Bus.get.begin (BusType.SESSION, null, on_bus_acquired); ++ } ++ catch (IOError e) ++ { ++ debug ("Error getting session bus: %s", e.message); ++ } ++ + // Start with manual entry, because no users have been added yet. + // It will be auto-removed when those are added (unless we're told to + // always show a manual entry). + add_manual_entry (); + } + ++ private void on_bus_acquired (Object? obj, AsyncResult res) ++ { ++ try ++ { ++ var conn = Bus.get.end (res); ++ this.dbus_object = new ListDBusInterface (this); ++ conn.register_object ("/list", this.dbus_object); ++ } ++ catch (IOError e) ++ { ++ debug ("Error registering user list dbus object: %s", e.message); ++ } ++ ++ } ++ + public enum ScrollTarget + { + START, +@@ -535,7 +577,16 @@ public class UserList : Gtk.EventBox + { + var e = find_entry (name); + if (e != null) +- select_entry (e, 1.0); ++ { ++ var direction = 1.0; ++ if (selected_entry != null && ++ entries.index (selected_entry) > entries.index (e)) ++ { ++ direction = -1.0; ++ } ++ select_entry (e, direction); ++ } ++ + } + + public void remove_entry (string? name)