[gdm/multi-stack: 18/45] Add a new "choosable" property to show tasks in user list



commit 5ba7fbd8fab03b01e4818f3c7b262be73582988f
Author: Ray Strode <rstrode redhat com>
Date:   Mon Feb 23 17:57:06 2009 -0500

    Add a new "choosable" property to show tasks in user list
    
    Useful for Smartcard and some future "Guest" account plugin

 gui/simple-greeter/gdm-greeter-login-window.c      |   13 ++++++++++---
 gui/simple-greeter/libgdmsimplegreeter/gdm-task.c  |    6 ++++++
 gui/simple-greeter/libgdmsimplegreeter/gdm-task.h  |    2 ++
 .../fingerprint/gdm-fingerprint-extension.c        |    7 +++++++
 .../plugins/password/gdm-password-extension.c      |    7 +++++++
 .../plugins/smartcard/gdm-smartcard-extension.c    |    7 +++++++
 6 files changed, 39 insertions(+), 3 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-greeter-login-window.c b/gui/simple-greeter/gdm-greeter-login-window.c
index 7c34c4a..19b3e5e 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.c
+++ b/gui/simple-greeter/gdm-greeter-login-window.c
@@ -2042,9 +2042,6 @@ gdm_greeter_login_window_add_extension (GdmGreeterLoginWindow *login_window,
         g_debug ("GdmGreeterLoginWindow: new extension '%s - %s' added",
                 name, description);
 
-        g_free (name);
-        g_free (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 {
@@ -2055,6 +2052,16 @@ gdm_greeter_login_window_add_extension (GdmGreeterLoginWindow *login_window,
                                 GDM_TASK (extension));
 
         service_name = gdm_conversation_get_service_name (GDM_CONVERSATION (extension));
+
+        if (gdm_task_is_choosable (GDM_TASK (extension))) {
+                gdm_chooser_widget_add_item (GDM_CHOOSER_WIDGET (login_window->priv->user_chooser),
+                                             service_name, NULL, name, description, ~0,
+                                             FALSE, TRUE);
+        }
+
+        g_free (name);
+        g_free (description);
+
         g_debug ("GdmGreeterLoginWindow: starting conversation with '%s'", service_name);
         g_signal_emit (login_window, signals[START_CONVERSATION], 0, service_name);
         g_free (service_name);
diff --git a/gui/simple-greeter/libgdmsimplegreeter/gdm-task.c b/gui/simple-greeter/libgdmsimplegreeter/gdm-task.c
index f72fa78..05fd75c 100644
--- a/gui/simple-greeter/libgdmsimplegreeter/gdm-task.c
+++ b/gui/simple-greeter/libgdmsimplegreeter/gdm-task.c
@@ -88,6 +88,12 @@ gdm_task_is_enabled (GdmTask   *task)
         return !g_object_get_data (G_OBJECT (task), "gdm-task-is-disabled");
 }
 
+gboolean
+gdm_task_is_choosable (GdmTask *task)
+{
+        return GDM_TASK_GET_IFACE (task)->is_choosable (task);
+}
+
 static void
 gdm_task_class_init (gpointer g_iface)
 {
diff --git a/gui/simple-greeter/libgdmsimplegreeter/gdm-task.h b/gui/simple-greeter/libgdmsimplegreeter/gdm-task.h
index 9894e65..c75bf29 100644
--- a/gui/simple-greeter/libgdmsimplegreeter/gdm-task.h
+++ b/gui/simple-greeter/libgdmsimplegreeter/gdm-task.h
@@ -44,6 +44,7 @@ struct _GdmTaskIface
         GIcon * (* get_icon)        (GdmTask   *task);
         char *  (* get_description) (GdmTask   *task);
         char *  (* get_name)        (GdmTask   *task);
+        gboolean  (* is_choosable)    (GdmTask   *task);
         /* signals */
         void (* enabled) (GdmTask *task);
         void (* disabled) (GdmTask *task);
@@ -57,6 +58,7 @@ char  *gdm_task_get_name        (GdmTask   *task);
 void   gdm_task_set_enabled     (GdmTask   *task,
                                  gboolean   should_enable);
 gboolean   gdm_task_is_enabled     (GdmTask   *task);
+gboolean   gdm_task_is_choosable   (GdmTask   *task);
 G_END_DECLS
 
 #endif /* __GDM_TASK_H */
diff --git a/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint-extension.c b/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint-extension.c
index b20dd65..7aa99e7 100644
--- a/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint-extension.c
+++ b/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint-extension.c
@@ -188,12 +188,19 @@ gdm_fingerprint_extension_get_description (GdmTask *task)
         return g_strdup (_("Log into session with fingerprint"));
 }
 
+gboolean
+gdm_fingerprint_extension_is_choosable (GdmTask *task)
+{
+        return FALSE;
+}
+
 static void
 gdm_task_iface_init (GdmTaskIface *iface)
 {
         iface->get_icon = gdm_fingerprint_extension_get_icon;
         iface->get_description = gdm_fingerprint_extension_get_description;
         iface->get_name = gdm_fingerprint_extension_get_name;
+        iface->is_choosable = gdm_fingerprint_extension_is_choosable;
 }
 
 static void
diff --git a/gui/simple-greeter/plugins/password/gdm-password-extension.c b/gui/simple-greeter/plugins/password/gdm-password-extension.c
index 3acab3f..4922c65 100644
--- a/gui/simple-greeter/plugins/password/gdm-password-extension.c
+++ b/gui/simple-greeter/plugins/password/gdm-password-extension.c
@@ -188,12 +188,19 @@ gdm_password_extension_get_description (GdmTask *task)
         return g_strdup (_("Log into session with username and password"));
 }
 
+gboolean
+gdm_password_extension_is_choosable (GdmTask *task)
+{
+        return FALSE;
+}
+
 static void
 gdm_task_iface_init (GdmTaskIface *iface)
 {
         iface->get_icon = gdm_password_extension_get_icon;
         iface->get_description = gdm_password_extension_get_description;
         iface->get_name = gdm_password_extension_get_name;
+        iface->is_choosable = gdm_password_extension_is_choosable;
 }
 
 static void
diff --git a/gui/simple-greeter/plugins/smartcard/gdm-smartcard-extension.c b/gui/simple-greeter/plugins/smartcard/gdm-smartcard-extension.c
index 6fa01fb..25d5de4 100644
--- a/gui/simple-greeter/plugins/smartcard/gdm-smartcard-extension.c
+++ b/gui/simple-greeter/plugins/smartcard/gdm-smartcard-extension.c
@@ -290,12 +290,19 @@ gdm_smartcard_extension_get_description (GdmTask *task)
         return g_strdup (_("Log into session with smartcard"));
 }
 
+gboolean
+gdm_smartcard_extension_is_choosable (GdmTask *task)
+{
+        return TRUE;
+}
+
 static void
 gdm_task_iface_init (GdmTaskIface *iface)
 {
         iface->get_icon = gdm_smartcard_extension_get_icon;
         iface->get_description = gdm_smartcard_extension_get_description;
         iface->get_name = gdm_smartcard_extension_get_name;
+        iface->is_choosable = gdm_smartcard_extension_is_choosable;
 }
 
 static void



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