[gdm/multi-stack: 3/35] Add user chooser to ui file



commit 8723117094dc995c755fb9c194c10f011d724f01
Author: Ray Strode <rstrode redhat com>
Date:   Mon Jun 28 14:35:35 2010 -0400

    Add user chooser to ui file
    
    Before it was getting added manually from the source code.
    
    This way is a lot cleaner.

 gui/simple-greeter/gdm-greeter-login-window.c  |   23 ++++++++++++++++-------
 gui/simple-greeter/gdm-greeter-login-window.ui |    9 ++++++++-
 2 files changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-greeter-login-window.c b/gui/simple-greeter/gdm-greeter-login-window.c
index c220dc4..a64bbc2 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.c
+++ b/gui/simple-greeter/gdm-greeter-login-window.c
@@ -1270,6 +1270,17 @@ create_computer_info (GdmGreeterLoginWindow *login_window)
 
 
 static void
+register_custom_types (GdmGreeterLoginWindow *login_window)
+{
+        GType types[] = { GDM_TYPE_USER_CHOOSER_WIDGET };
+        int i;
+
+        for (i = 0; i < G_N_ELEMENTS (types); i++) {
+                g_debug ("Registering type '%s'", g_type_name (types[i]));
+        }
+}
+
+static void
 load_theme (GdmGreeterLoginWindow *login_window)
 {
         GtkWidget *entry;
@@ -1280,6 +1291,8 @@ load_theme (GdmGreeterLoginWindow *login_window)
 
         gdm_profile_start (NULL);
 
+        register_custom_types (login_window);
+
         login_window->priv->builder = gtk_builder_new ();
         if (!gtk_builder_add_from_file (login_window->priv->builder, UIDIR "/" UI_XML_FILE, &error)) {
                 g_warning ("Couldn't load builder file: %s", error->message);
@@ -1313,16 +1326,10 @@ load_theme (GdmGreeterLoginWindow *login_window)
         box = GTK_WIDGET (gtk_builder_get_object (login_window->priv->builder, "window-frame"));
         gtk_container_add (GTK_CONTAINER (login_window), box);
 
-        /* FIXME: user and session chooser should get loaded from ui file instead
-         */
-        login_window->priv->user_chooser = gdm_user_chooser_widget_new ();
-        box = GTK_WIDGET (gtk_builder_get_object (login_window->priv->builder, "selection-box"));
-        gtk_box_pack_start (GTK_BOX (box), login_window->priv->user_chooser, TRUE, TRUE, 0);
-        gtk_box_reorder_child (GTK_BOX (box), login_window->priv->user_chooser, 0);
+        login_window->priv->user_chooser = GTK_WIDGET (gtk_builder_get_object (login_window->priv->builder, "user-chooser"));
 
         gdm_user_chooser_widget_set_show_only_chosen (GDM_USER_CHOOSER_WIDGET (login_window->priv->user_chooser), TRUE);
 
-
         g_signal_connect (login_window->priv->user_chooser,
                           "loaded",
                           G_CALLBACK (on_users_loaded),
@@ -1341,6 +1348,8 @@ load_theme (GdmGreeterLoginWindow *login_window)
                                  G_CALLBACK (on_user_chooser_visibility_changed),
                                  login_window);
 
+        /* FIXME: session chooser should get loaded from ui file instead
+         */
         login_window->priv->session_option_widget = gdm_session_option_widget_new ();
         box = GTK_WIDGET (gtk_builder_get_object (login_window->priv->builder, "buttonbox"));
         g_object_set (G_OBJECT (login_window->priv->session_option_widget),
diff --git a/gui/simple-greeter/gdm-greeter-login-window.ui b/gui/simple-greeter/gdm-greeter-login-window.ui
index 8409166..7ce166b 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.ui
+++ b/gui/simple-greeter/gdm-greeter-login-window.ui
@@ -160,7 +160,14 @@
                         <property name="visible">True</property>
                         <property name="spacing">10</property>
                         <child>
-                          <placeholder/>
+                          <object class="GdmUserChooserWidget" id="user-chooser">
+                            <property name="visible">False</property>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
                         </child>
                         <child>
                           <object class="GtkHBox" id="auth-input-box">



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]