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



commit 161c403e00d61f67cc0df85bfc27a7d9aa55a5aa
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  |   20 ++++++++++++++------
 gui/simple-greeter/gdm-greeter-login-window.ui |    9 ++++++++-
 2 files changed, 22 insertions(+), 7 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-greeter-login-window.c b/gui/simple-greeter/gdm-greeter-login-window.c
index ed3168b..e37d04e 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.c
+++ b/gui/simple-greeter/gdm-greeter-login-window.c
@@ -1131,6 +1131,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;
@@ -1141,6 +1152,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);
@@ -1174,12 +1187,7 @@ 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 chooser should implement GtkBuildable and this should get dropped
-         */
-        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);
 
diff --git a/gui/simple-greeter/gdm-greeter-login-window.ui b/gui/simple-greeter/gdm-greeter-login-window.ui
index 0bf02a9..576a785 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]