[gdm] greeter: add user chooser and session option widget to ui file



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

    greeter: add user chooser and session option widget to ui file
    
    Before it was getting added manually from the source code.
    
    This way is a bit cleaner.

 gui/simple-greeter/gdm-greeter-login-window.c  |   33 +++++++++++------------
 gui/simple-greeter/gdm-greeter-login-window.ui |   28 ++++++++++++++++++--
 2 files changed, 41 insertions(+), 20 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-greeter-login-window.c b/gui/simple-greeter/gdm-greeter-login-window.c
index c220dc4..acfab5a 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.c
+++ b/gui/simple-greeter/gdm-greeter-login-window.c
@@ -1270,6 +1270,18 @@ create_computer_info (GdmGreeterLoginWindow *login_window)
 
 
 static void
+register_custom_types (GdmGreeterLoginWindow *login_window)
+{
+        GType types[] = { GDM_TYPE_USER_CHOOSER_WIDGET,
+                          GDM_TYPE_SESSION_OPTION_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 +1292,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 +1327,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,16 +1349,7 @@ load_theme (GdmGreeterLoginWindow *login_window)
                                  G_CALLBACK (on_user_chooser_visibility_changed),
                                  login_window);
 
-        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),
-                      "xscale", 0.0,
-                      "yscale", 0.0,
-                      "xalign", 0.0,
-                      "yalign", 1.0,
-                      NULL);
-        gtk_container_add (GTK_CONTAINER (box), login_window->priv->session_option_widget);
-        gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (box), login_window->priv->session_option_widget, TRUE);
+        login_window->priv->session_option_widget = GTK_WIDGET (gtk_builder_get_object (login_window->priv->builder, "session-option-widget"));
 
         g_signal_connect (login_window->priv->session_option_widget,
                           "activated",
diff --git a/gui/simple-greeter/gdm-greeter-login-window.ui b/gui/simple-greeter/gdm-greeter-login-window.ui
index 8409166..9c78c11 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">
@@ -235,6 +242,21 @@
                     <property name="spacing">6</property>
                     <property name="layout_style">end</property>
                     <child>
+                      <object class="GdmSessionOptionWidget" id="session-option-widget">
+                        <property name="visible">False</property>
+                        <property name="xscale">0.0</property>
+                        <property name="yscale">0.0</property>
+                        <property name="xalign">0.0</property>
+                        <property name="yalign">1.0</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                        <property name="secondary">True</property>
+                      </packing>
+                    </child>
+                    <child>
                       <object class="GtkButton" id="cancel-button">
                         <property name="label" translatable="yes">Cancel</property>
                         <property name="visible">True</property>
@@ -243,7 +265,7 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">False</property>
-                        <property name="position">0</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                     <child>
@@ -257,7 +279,7 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">False</property>
-                        <property name="position">1</property>
+                        <property name="position">2</property>
                       </packing>
                     </child>
                     <child>



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