[gdm/multi-stack: 20/46] Only show task list if user is selected



commit a1bd5b7d82d94efbcf29b73de303c09641d1bdfe
Author: Ray Strode <rstrode redhat com>
Date:   Mon Mar 2 11:10:28 2009 -0500

    Only show task list if user is selected

 gui/simple-greeter/gdm-greeter-login-window.c |   32 ++++++++++++++----------
 gui/simple-greeter/gdm-task-list.c            |   11 +++++++-
 2 files changed, 28 insertions(+), 15 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-greeter-login-window.c b/gui/simple-greeter/gdm-greeter-login-window.c
index 342133d..a7571cc 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.c
+++ b/gui/simple-greeter/gdm-greeter-login-window.c
@@ -524,6 +524,7 @@ switch_mode (GdmGreeterLoginWindow *login_window,
 {
         const char *default_name;
         GtkWidget  *box;
+        int         number_of_tasks;
 
         /* we want to run this even if we're supposed to
            be in the mode already so that we reset everything
@@ -538,15 +539,23 @@ switch_mode (GdmGreeterLoginWindow *login_window,
 
                 show_widget (login_window, "cancel-button", FALSE);
                 show_widget (login_window, "auth-page-box", FALSE);
+                show_widget (login_window, "conversation-list", FALSE);
 
                 sensitize_widget (login_window, "disconnect-button", FALSE);
 
                 default_name = NULL;
                 break;
         case MODE_AUTHENTICATION:
+                gtk_widget_set_size_request (GTK_WIDGET (login_window),
+                                             GTK_WIDGET (login_window)->allocation.width,
+                                             -1);
                 show_widget (login_window, "cancel-button", TRUE);
                 show_widget (login_window, "disconnect-button", FALSE);
                 show_widget (login_window, "auth-page-box", TRUE);
+
+                number_of_tasks = gdm_task_list_get_number_of_tasks (GDM_TASK_LIST (login_window->priv->conversation_list));
+                show_widget (login_window, "conversation-list", number_of_tasks > 1);
+
                 default_name = "log-in-button";
                 break;
         default:
@@ -1161,11 +1170,14 @@ on_user_chooser_activated (GdmUserChooserWidget  *user_chooser,
 
         if (strcmp (item_id, GDM_USER_CHOOSER_USER_OTHER) == 0) {
                 g_debug ("GdmGreeterLoginWindow: Starting all auth conversations");
+                g_free (item_id);
+
                 gdm_task_list_foreach_task (GDM_TASK_LIST (login_window->priv->conversation_list),
                                             (GdmTaskListForeachFunc)
                                             begin_task_verification,
                                             login_window);
-                g_free (item_id);
+
+                switch_mode (login_window, MODE_AUTHENTICATION);
         } else if (strcmp (item_id, GDM_USER_CHOOSER_USER_AUTO) == 0) {
                 g_debug ("GdmGreeterLoginWindow: Starting auto login");
                 g_signal_emit (login_window, signals[BEGIN_AUTO_LOGIN], 0,
@@ -1178,6 +1190,8 @@ on_user_chooser_activated (GdmUserChooserWidget  *user_chooser,
                 set_log_in_button_mode (login_window, LOGIN_BUTTON_TIMED_LOGIN);
                 set_message (login_window, _("Select language and click Log In"));
                 g_free (item_id);
+
+                switch_mode (login_window, MODE_AUTHENTICATION);
         } else {
                 GdmTask *task;
 
@@ -1192,18 +1206,17 @@ on_user_chooser_activated (GdmUserChooserWidget  *user_chooser,
                         return;
                 }
                 g_debug ("GdmGreeterLoginWindow: Beginning auth conversation for item %s", item_id);
-
                 /* FIXME: we should probably give the plugin more say for
                  * what happens here.
                  */
                 g_signal_emit (login_window, signals[BEGIN_VERIFICATION], 0, item_id);
                 g_free (item_id);
 
-                gtk_widget_set_sensitive (login_window->priv->conversation_list, FALSE);
-        }
+                switch_mode (login_window, MODE_AUTHENTICATION);
+                gdm_task_list_set_active_task (GDM_TASK_LIST (login_window->priv->conversation_list), task);
 
-        g_debug ("GdmGreeterLoginWindow: Switching to shrunken authentication mode");
-        switch_mode (login_window, MODE_AUTHENTICATION);
+                g_object_unref (task);
+        }
 }
 
 static void
@@ -1509,7 +1522,6 @@ load_theme (GdmGreeterLoginWindow *login_window)
                                   "deactivated",
                                   G_CALLBACK (on_task_deactivated),
                                   login_window);
-        gtk_widget_show (login_window->priv->conversation_list);
 
         login_window->priv->auth_banner_label = GTK_WIDGET (gtk_builder_get_object (login_window->priv->builder, "auth-banner-label"));
         /*make_label_small_italic (login_window->priv->auth_banner_label);*/
@@ -2013,12 +2025,6 @@ gdm_greeter_login_window_add_extension (GdmGreeterLoginWindow *login_window,
         g_debug ("GdmGreeterLoginWindow: new extension '%s - %s' added",
                 name, description);
 
-        if (gdm_task_list_get_number_of_tasks (GDM_TASK_LIST (login_window->priv->conversation_list)) == 0) {
-                gtk_widget_hide (login_window->priv->conversation_list);
-        } else {
-                gtk_widget_show (login_window->priv->conversation_list);
-        }
-
         gdm_task_list_add_task (GDM_TASK_LIST (login_window->priv->conversation_list),
                                 GDM_TASK (extension));
 
diff --git a/gui/simple-greeter/gdm-task-list.c b/gui/simple-greeter/gdm-task-list.c
index 3dff10e..be50832 100644
--- a/gui/simple-greeter/gdm-task-list.c
+++ b/gui/simple-greeter/gdm-task-list.c
@@ -303,17 +303,24 @@ gdm_task_list_set_active_task (GdmTaskList *widget,
                                GdmTask     *task)
 {
         GtkWidget *button;
+        gboolean   was_sensitive;
+        gboolean   was_activated;
+
+        was_sensitive = GTK_WIDGET_SENSITIVE (widget);
+        gtk_widget_set_sensitive (GTK_WIDGET (widget), TRUE);
 
         button = GTK_WIDGET (g_object_get_data (G_OBJECT (task),
                              "gdm-task-list-button"));
 
+        was_activated = FALSE;
         if (GTK_WIDGET_IS_SENSITIVE (button)) {
                 if (gtk_widget_activate (button)) {
-                        return TRUE;
+                        was_activated = TRUE;
                 }
         }
 
-        return FALSE;
+        gtk_widget_set_sensitive (GTK_WIDGET (widget), was_sensitive);
+        return was_activated;
 }
 
 int



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