[gdm/initial-setup: 3/4] initial-setup: connect to slave very early on
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm/initial-setup: 3/4] initial-setup: connect to slave very early on
- Date: Wed, 18 May 2011 19:02:35 +0000 (UTC)
commit 5b6c35e2d94e475a93278026587e243ec3743598
Author: Ray Strode <rstrode redhat com>
Date: Wed May 18 14:52:25 2011 -0400
initial-setup: connect to slave very early on
This will let it start the worker in the background while
the user is filling out the forms rather than trying to bunch it
up at the end.
There's also some random fixes to the way the calls are being
made that i'm too lazy to split out.
gui/initial-setup/gdm-initial-setup.c | 60 +++++++++++++++++++++------------
1 files changed, 38 insertions(+), 22 deletions(-)
---
diff --git a/gui/initial-setup/gdm-initial-setup.c b/gui/initial-setup/gdm-initial-setup.c
index 9c15991..926e447 100644
--- a/gui/initial-setup/gdm-initial-setup.c
+++ b/gui/initial-setup/gdm-initial-setup.c
@@ -28,6 +28,8 @@ typedef struct {
GtkBuilder *builder;
GtkAssistant *assistant;
+ GDBusConnection *slave_connection;
+
/* network data */
NMClient *nm_client;
NMRemoteSettings *nm_settings;
@@ -59,6 +61,8 @@ typedef struct {
#define OBJ(type,name) ((type)gtk_builder_get_object(setup->builder,(name)))
#define WID(name) OBJ(GtkWidget*,name)
+static void connect_to_slave (SetupData *setup);
+
/* --- Welcome page --- */
static void
@@ -1383,6 +1387,7 @@ prepare_assistant (SetupData *setup)
g_signal_connect (G_OBJECT (setup->assistant), "close",
G_CALLBACK (close_cb), NULL);
+ connect_to_slave (setup);
prepare_welcome_page (setup);
prepare_network_page (setup);
prepare_account_page (setup);
@@ -1401,13 +1406,41 @@ copy_account_data (SetupData *setup)
static void
begin_autologin (SetupData *setup)
{
- const gchar *address;
- GDBusConnection *connection;
GError *error;
const gchar *username;
GVariant *ret;
+ username = act_user_get_user_name (setup->act_user);
+
+ ret = g_dbus_connection_call_sync (setup->slave_connection,
+ NULL,
+ "/org/gnome/DisplayManager/GreeterServer",
+ "org.gnome.DisplayManager.GreeterServer",
+ "BeginAutoLogin",
+ g_variant_new ("(s)", username),
+ NULL, /* no reply checking */
+ G_DBUS_CALL_FLAGS_NONE,
+ G_MAXINT,
+ NULL,
+ &error);
+ if (ret == NULL) {
+ g_warning ("Calling org.gnome.DisplayManager.GreeterServer.BeginAutoLogin failed: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ g_variant_unref (ret);
+}
+
+static void
+connect_to_slave (SetupData *setup)
+{
+ GDBusConnection *connection;
+ const gchar *address;
+ GError *error;
+
address = g_getenv ("GDM_GREETER_DBUS_ADDRESS");
+
if (address == NULL) {
g_warning ("GDM_GREETER_DBUS_ADDRESS not set; not initiating autologin");
return;
@@ -1415,7 +1448,7 @@ begin_autologin (SetupData *setup)
error = NULL;
connection = g_dbus_connection_new_for_address_sync (address,
- G_DBUS_CONNECTION_FLAGS_NONE,
+ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
NULL,
NULL,
&error);
@@ -1425,26 +1458,9 @@ begin_autologin (SetupData *setup)
return;
}
- username = act_user_get_user_name (setup->act_user);
+ g_dbus_connection_set_exit_on_close (connection, TRUE);
- ret = g_dbus_connection_call_sync (connection,
- "/org/gnome/DisplayManager/GreeterServer",
- "/",
- "org.gnome.DisplayManager.GreeterServer",
- "BeginAutoLogin",
- g_variant_new ("(s)", username),
- NULL, /* no reply checking */
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- &error);
- if (ret == NULL) {
- g_warning ("Calling org.gnome.DisplayManager.GreeterServer.BeginAutoLogin failed: %s", error->message);
- g_error_free (error);
- return;
- }
-
- g_variant_unref (ret);
+ setup->slave_connection = connection;
}
int
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]