[gdm/wip/initial-setup] Misc cleanups
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm/wip/initial-setup] Misc cleanups
- Date: Thu, 19 May 2011 02:33:50 +0000 (UTC)
commit 01ed89b300d7e680f5422b91a3623d08c2edca05
Author: Matthias Clasen <mclasen redhat com>
Date: Wed May 18 22:26:41 2011 -0400
Misc cleanups
Among other things, add a debug statement to figure out
which page we are on.
gui/initial-setup/gdm-initial-setup.c | 123 ++++++++++++++++-----------------
gui/initial-setup/setup.ui | 8 ++-
2 files changed, 68 insertions(+), 63 deletions(-)
---
diff --git a/gui/initial-setup/gdm-initial-setup.c b/gui/initial-setup/gdm-initial-setup.c
index 9d5b91e..3d45e92 100644
--- a/gui/initial-setup/gdm-initial-setup.c
+++ b/gui/initial-setup/gdm-initial-setup.c
@@ -62,10 +62,6 @@ typedef struct {
#define OBJ(type,name) ((type)gtk_builder_get_object(setup->builder,(name)))
#define WID(name) OBJ(GtkWidget*,name)
-static void copy_account_data (SetupData *setup);
-static void begin_autologin (SetupData *setup);
-static void connect_to_slave (SetupData *setup);
-
/* --- Welcome page --- */
static void
@@ -1052,7 +1048,7 @@ save_account_data (SetupData *setup)
act_user_set_real_name (setup->act_user,
gtk_entry_get_text (OBJ (GtkEntry*, "account-fullname-entry")));
act_user_set_user_name (setup->act_user,
- gtk_entry_get_text (OBJ (GtkEntry*, "account-username-entry")));
+ gtk_combo_box_text_get_active_text (OBJ (GtkComboBoxText*, "account-username-combo")));
act_user_set_account_type (setup->act_user, setup->account_type);
if (setup->password_mode == ACT_USER_PASSWORD_MODE_REGULAR) {
act_user_set_password (setup->act_user,
@@ -1324,52 +1320,44 @@ prepare_location_page (SetupData *setup)
/* --- Other setup --- */
static void
-close_cb (GtkAssistant *assi, gpointer data)
+copy_account_data (SetupData *setup)
{
- SetupData *setup = data;
-
+ /* FIXME: here is where we copy all the things we just
+ * configured, from the current users home dir to the
+ * account that was created in the first step
+ */
g_settings_sync ();
-
- copy_account_data (setup);
-
- begin_autologin (setup);
}
static void
-prepare_cb (GtkAssistant *assi, GtkWidget *page, SetupData *setup)
+connect_to_slave (SetupData *setup)
{
- if (page != WID("account-page"))
- gtk_assistant_set_page_complete (assi, page, TRUE);
- save_account_data (setup);
-}
+ GDBusConnection *connection;
+ const gchar *address;
+ GError *error;
-static void
-prepare_assistant (SetupData *setup)
-{
- setup->assistant = OBJ(GtkAssistant*, "gnome-setup-assistant");
+ address = g_getenv ("GDM_GREETER_DBUS_ADDRESS");
- /* small hack to get rid of cancel button */
- gtk_assistant_commit (setup->assistant);
+ if (address == NULL) {
+ g_warning ("GDM_GREETER_DBUS_ADDRESS not set; not initiating autologin");
+ return;
+ }
- g_signal_connect (G_OBJECT (setup->assistant), "prepare",
- G_CALLBACK (prepare_cb), setup);
- g_signal_connect (G_OBJECT (setup->assistant), "close",
- G_CALLBACK (close_cb), setup);
+ error = NULL;
+ connection = g_dbus_connection_new_for_address_sync (address,
+ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
+ NULL,
+ NULL,
+ &error);
+ if (connection == NULL) {
+ g_warning ("Failed to create D-Bus connection for address '%s' (%s); not initiating autologin", address, error->message);
+ g_error_free (error);
+ return;
+ }
- connect_to_slave (setup);
- prepare_welcome_page (setup);
- prepare_network_page (setup);
- prepare_account_page (setup);
- prepare_location_page (setup);
-}
+ g_dbus_connection_set_exit_on_close (connection, TRUE);
-static void
-copy_account_data (SetupData *setup)
-{
- /* FIXME: here is where we copy all the things we just
- * configured, from the current users home dir to the
- * account that was created in the first step
- */
+ setup->slave_connection = connection;
}
static void
@@ -1402,34 +1390,45 @@ begin_autologin (SetupData *setup)
}
static void
-connect_to_slave (SetupData *setup)
+close_cb (GtkAssistant *assi, SetupData *setup)
{
- GDBusConnection *connection;
- const gchar *address;
- GError *error;
+ begin_autologin (setup);
+}
- address = g_getenv ("GDM_GREETER_DBUS_ADDRESS");
+static void
+prepare_cb (GtkAssistant *assi, GtkWidget *page, SetupData *setup)
+{
+ g_debug ("preparing page %s", gtk_widget_get_name (page));
- if (address == NULL) {
- g_warning ("GDM_GREETER_DBUS_ADDRESS not set; not initiating autologin");
- return;
- }
+ if (page != WID("account-page"))
+ gtk_assistant_set_page_complete (assi, page, TRUE);
- error = NULL;
- connection = g_dbus_connection_new_for_address_sync (address,
- G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
- NULL,
- NULL,
- &error);
- if (connection == NULL) {
- g_warning ("Failed to create D-Bus connection for address '%s' (%s); not initiating autologin", address, error->message);
- g_error_free (error);
- return;
- }
+ save_account_data (setup);
- g_dbus_connection_set_exit_on_close (connection, TRUE);
+ if (page == WID("summary_page"))
+ copy_account_data (setup);
+}
- setup->slave_connection = connection;
+static void
+prepare_assistant (SetupData *setup)
+{
+ setup->assistant = OBJ(GtkAssistant*, "gnome-setup-assistant");
+
+ /* small hack to get rid of cancel button */
+ gtk_assistant_commit (setup->assistant);
+
+ g_signal_connect (G_OBJECT (setup->assistant), "prepare",
+ G_CALLBACK (prepare_cb), setup);
+ g_signal_connect (G_OBJECT (setup->assistant), "close",
+ G_CALLBACK (close_cb), setup);
+
+ /* connect to gdm slave */
+ connect_to_slave (setup);
+
+ prepare_welcome_page (setup);
+ prepare_network_page (setup);
+ prepare_account_page (setup);
+ prepare_location_page (setup);
}
int
diff --git a/gui/initial-setup/setup.ui b/gui/initial-setup/setup.ui
index 1c4c2aa..96c1351 100644
--- a/gui/initial-setup/setup.ui
+++ b/gui/initial-setup/setup.ui
@@ -30,6 +30,7 @@
<property name="window-position">center</property>
<child>
<object class="GtkGrid" id="welcome-page">
+ <property name="name">welcome-page</property>
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="welcome-title">
@@ -87,6 +88,7 @@
</child>
<child>
<object class="GtkGrid" id="account-page">
+ <property name="name">account-page</property>
<property name="visible">True</property>
<property name="row-spacing">6</property>
<property name="column-spacing">12</property>
@@ -272,6 +274,7 @@
</child>
<child>
<object class="GtkGrid" id="network-page">
+ <property name="name">network-page</property>
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="network-title">
@@ -403,6 +406,7 @@
</child>
<child>
<object class="GtkGrid" id="location-page">
+ <property name="name">location-page</property>
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="location-title">
@@ -525,6 +529,7 @@
</child>
<child>
<object class="GtkGrid" id="online-page">
+ <property name="name">online-page</property>
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="online-title">
@@ -588,7 +593,8 @@
</packing>
</child>
<child>
- <object class="GtkGrid" id="page6">
+ <object class="GtkGrid" id="summary-page">
+ <property name="name">summary-page</property>
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="summary-title">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]