summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2017-12-20 17:08:27 +1300
committerRobert Ancell <robert.ancell@canonical.com>2017-12-20 17:08:27 +1300
commit6015bce25f241e7580c03594d846769f8236232f (patch)
tree6a0ae48b6c43c6a2e2e5e3eaef4246fc45aae562 /tests
parentee9f36a21ed661f52758a6d3badfdcac3716119c (diff)
downloadlightdm-git-6015bce25f241e7580c03594d846769f8236232f.tar.gz
Use AccountsService extension system for extended greeter information (background, messages etc)
The support for this never landed upstream in AccountsService and the extension system was added later. This allows OSs to make use of these features without a patched AccountsService.
Diffstat (limited to 'tests')
-rw-r--r--tests/src/test-runner.c44
1 files changed, 39 insertions, 5 deletions
diff --git a/tests/src/test-runner.c b/tests/src/test-runner.c
index 7a0dd75e..836e24fa 100644
--- a/tests/src/test-runner.c
+++ b/tests/src/test-runner.c
@@ -52,6 +52,7 @@ typedef struct
gchar *background;
gchar *path;
guint id;
+ guint extra_id;
gchar *language;
gchar *xsession;
gchar **layouts;
@@ -2122,8 +2123,6 @@ handle_user_get_property (GDBusConnection *connection,
return g_variant_new_string (user->home_directory);
else if (strcmp (property_name, "SystemAccount") == 0)
return g_variant_new_boolean (user->uid < 1000);
- else if (strcmp (property_name, "BackgroundFile") == 0)
- return g_variant_new_string (user->background ? user->background : "");
else if (strcmp (property_name, "Language") == 0)
return g_variant_new_string (user->language ? user->language : "");
else if (strcmp (property_name, "IconFile") == 0)
@@ -2134,6 +2133,25 @@ handle_user_get_property (GDBusConnection *connection,
return g_variant_new_uint64 (user->uid);
else if (strcmp (property_name, "XSession") == 0)
return g_variant_new_string (user->xsession ? user->xsession : "");
+
+ return NULL;
+}
+
+static GVariant *
+handle_user_get_extra_property (GDBusConnection *connection,
+ const gchar *sender,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *property_name,
+ GError **error,
+ gpointer user_data)
+{
+ AccountsUser *user = user_data;
+
+ if (strcmp (property_name, "BackgroundFile") == 0)
+ return g_variant_new_string (user->background ? user->background : "");
+ else if (strcmp (property_name, "HasMessages") == 0)
+ return g_variant_new_boolean (user->has_messages);
else if (strcmp (property_name, "XKeyboardLayouts") == 0)
{
if (user->layouts != NULL)
@@ -2141,8 +2159,6 @@ handle_user_get_property (GDBusConnection *connection,
else
return g_variant_new_strv (NULL, 0);
}
- else if (strcmp (property_name, "XHasMessages") == 0)
- return g_variant_new_boolean (user->has_messages);
return NULL;
}
@@ -2157,6 +2173,7 @@ accounts_user_set_hidden (AccountsUser *user, gboolean hidden, gboolean emit_sig
g_autoptr(GError) error = NULL;
g_dbus_connection_unregister_object (accounts_connection, user->id);
+ g_dbus_connection_unregister_object (accounts_connection, user->extra_id);
if (!g_dbus_connection_emit_signal (accounts_connection,
NULL,
"/org/freedesktop/Accounts",
@@ -2185,12 +2202,12 @@ accounts_user_set_hidden (AccountsUser *user, gboolean hidden, gboolean emit_sig
" <property name='Shell' type='s' access='read'/>"
" <property name='Uid' type='t' access='read'/>"
" <property name='XSession' type='s' access='read'/>"
- " <property name='XKeyboardLayouts' type='as' access='read'/>"
" <signal name='Changed' />"
" </interface>"
" <interface name='org.freedesktop.DisplayManager.AccountsService'>"
" <property name='BackgroundFile' type='s' access='read'/>"
" <property name='HasMessages' type='b' access='read'/>"
+ " <property name='XKeyboardLayouts' type='as' access='read'/>"
" </interface>"
"</node>";
g_autoptr(GDBusNodeInfo) user_info = NULL;
@@ -2200,6 +2217,11 @@ accounts_user_set_hidden (AccountsUser *user, gboolean hidden, gboolean emit_sig
handle_user_call,
handle_user_get_property,
};
+ static const GDBusInterfaceVTable user_extra_vtable =
+ {
+ NULL,
+ handle_user_get_extra_property,
+ };
user_info = g_dbus_node_info_new_for_xml (user_interface, &error);
if (!user_info)
@@ -2219,6 +2241,18 @@ accounts_user_set_hidden (AccountsUser *user, gboolean hidden, gboolean emit_sig
g_warning ("Failed to register user: %s", error->message);
return;
}
+ user->extra_id = g_dbus_connection_register_object (accounts_connection,
+ user->path,
+ user_info->interfaces[1],
+ &user_extra_vtable,
+ user,
+ NULL,
+ &error);
+ if (user->extra_id == 0)
+ {
+ g_warning ("Failed to register user: %s", error->message);
+ return;
+ }
if (!g_dbus_connection_emit_signal (accounts_connection,
NULL,