diff --git a/add-session-chooser.patch b/add-session-chooser.patch new file mode 100644 index 0000000..b0e5819 --- /dev/null +++ b/add-session-chooser.patch @@ -0,0 +1,289 @@ +From 11139d9e693ecb1e5dcf6b538f0873a3e97730c8 Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Thu, 17 Feb 2011 11:09:10 -0500 +Subject: [PATCH] greeter: add session chooser to dialog + +Since we don't have it in the panel anymore, put it in the dialog. +--- + gui/simple-greeter/Makefile.am | 4 + + gui/simple-greeter/gdm-greeter-login-window.c | 78 +++++++++++++++++++++++- + gui/simple-greeter/gdm-greeter-login-window.h | 4 + + gui/simple-greeter/gdm-greeter-login-window.ui | 4 +- + gui/simple-greeter/gdm-greeter-session.c | 10 +++- + gui/simple-greeter/gdm-session-option-widget.c | 1 - + 6 files changed, 95 insertions(+), 6 deletions(-) + +diff --git a/gui/simple-greeter/Makefile.am b/gui/simple-greeter/Makefile.am +index 74edd01..aa78504 100644 +--- a/gui/simple-greeter/Makefile.am ++++ b/gui/simple-greeter/Makefile.am +@@ -75,6 +75,10 @@ test_greeter_login_window_SOURCES = \ + gdm-sessions.c \ + gdm-cell-renderer-timer.h \ + gdm-cell-renderer-timer.c \ ++ gdm-option-widget.h \ ++ gdm-option-widget.c \ ++ gdm-session-option-widget.h \ ++ gdm-session-option-widget.c \ + gdm-user-chooser-widget.h \ + gdm-user-chooser-widget.c \ + gdm-user-chooser-dialog.h \ +diff --git a/gui/simple-greeter/gdm-greeter-login-window.c b/gui/simple-greeter/gdm-greeter-login-window.c +index 6dc201a..c220dc4 100644 +--- a/gui/simple-greeter/gdm-greeter-login-window.c ++++ b/gui/simple-greeter/gdm-greeter-login-window.c +@@ -56,6 +56,7 @@ + + #include "gdm-greeter-login-window.h" + #include "gdm-user-chooser-widget.h" ++#include "gdm-session-option-widget.h" + + #ifdef HAVE_PAM + #include +@@ -85,6 +86,7 @@ + #define LSB_RELEASE_COMMAND "lsb_release -d" + + #define GDM_GREETER_LOGIN_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_GREETER_LOGIN_WINDOW, GdmGreeterLoginWindowPrivate)) ++#define GDM_CUSTOM_SESSION "custom" + + enum { + MODE_UNDEFINED = 0, +@@ -102,6 +104,7 @@ enum { + struct GdmGreeterLoginWindowPrivate + { + GtkBuilder *builder; ++ GtkWidget *session_option_widget; + GtkWidget *user_chooser; + GtkWidget *auth_banner_label; + GtkWidget *current_button; +@@ -143,6 +146,7 @@ enum { + QUERY_ANSWER, + START_SESSION, + USER_SELECTED, ++ SESSION_SELECTED, + CANCELLED, + LAST_SIGNAL + }; +@@ -505,12 +509,15 @@ switch_mode (GdmGreeterLoginWindow *login_window, + switch (number) { + case MODE_SELECTION: + set_log_in_button_mode (login_window, LOGIN_BUTTON_HIDDEN); ++ gtk_widget_hide (login_window->priv->session_option_widget); + break; + case MODE_TIMED_LOGIN: + set_log_in_button_mode (login_window, LOGIN_BUTTON_TIMED_LOGIN); ++ gtk_widget_show (login_window->priv->session_option_widget); + break; + case MODE_AUTHENTICATION: + set_log_in_button_mode (login_window, LOGIN_BUTTON_ANSWER_QUERY); ++ gtk_widget_show (login_window->priv->session_option_widget); + break; + default: + g_assert_not_reached (); +@@ -878,6 +885,7 @@ gdm_greeter_login_window_info_query (GdmGreeterLoginWindow *login_window, + gtk_label_set_text (GTK_LABEL (label), text); + + show_widget (login_window, "auth-input-box", TRUE); ++ + set_sensitive (GDM_GREETER_LOGIN_WINDOW (login_window), TRUE); + set_ready (GDM_GREETER_LOGIN_WINDOW (login_window)); + set_focus (GDM_GREETER_LOGIN_WINDOW (login_window)); +@@ -908,6 +916,7 @@ gdm_greeter_login_window_secret_info_query (GdmGreeterLoginWindow *login_window, + gtk_label_set_text (GTK_LABEL (label), text); + + show_widget (login_window, "auth-input-box", TRUE); ++ gtk_widget_show (login_window->priv->session_option_widget); + set_sensitive (GDM_GREETER_LOGIN_WINDOW (login_window), TRUE); + set_ready (GDM_GREETER_LOGIN_WINDOW (login_window)); + set_focus (GDM_GREETER_LOGIN_WINDOW (login_window)); +@@ -1049,6 +1058,46 @@ on_user_unchosen (GdmUserChooserWidget *user_chooser, + } + + static void ++on_session_activated (GdmSessionOptionWidget *session_option_widget, ++ GdmGreeterLoginWindow *login_window) ++{ ++ char *session; ++ ++ session = gdm_session_option_widget_get_current_session (GDM_SESSION_OPTION_WIDGET (login_window->priv->session_option_widget)); ++ if (session == NULL) { ++ return; ++ } ++ ++ g_signal_emit (login_window, signals[SESSION_SELECTED], 0, session); ++ ++ g_free (session); ++} ++ ++void ++gdm_greeter_login_window_set_default_session_name (GdmGreeterLoginWindow *login_window, ++ const char *session_name) ++{ ++ g_return_if_fail (GDM_IS_GREETER_LOGIN_WINDOW (login_window)); ++ ++ if (session_name != NULL && !gdm_option_widget_lookup_item (GDM_OPTION_WIDGET (login_window->priv->session_option_widget), ++ session_name, NULL, NULL, NULL)) { ++ if (strcmp (session_name, GDM_CUSTOM_SESSION) == 0) { ++ gdm_option_widget_add_item (GDM_OPTION_WIDGET (login_window->priv->session_option_widget), ++ GDM_CUSTOM_SESSION, ++ C_("customsession", "Custom"), ++ _("Custom session"), ++ GDM_OPTION_WIDGET_POSITION_TOP); ++ } else { ++ g_warning ("Default session is not available"); ++ return; ++ } ++ } ++ ++ gdm_option_widget_set_default_item (GDM_OPTION_WIDGET (login_window->priv->session_option_widget), ++ session_name); ++} ++ ++static void + rotate_computer_info (GdmGreeterLoginWindow *login_window) + { + GtkWidget *notebook; +@@ -1264,7 +1313,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 ++ /* 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")); +@@ -1273,6 +1322,7 @@ load_theme (GdmGreeterLoginWindow *login_window) + + 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), +@@ -1291,6 +1341,22 @@ 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); ++ ++ g_signal_connect (login_window->priv->session_option_widget, ++ "activated", ++ G_CALLBACK (on_session_activated), ++ login_window); ++ + 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);*/ + +@@ -1560,6 +1626,16 @@ gdm_greeter_login_window_class_init (GdmGreeterLoginWindowClass *klass) + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, + 1, G_TYPE_STRING); ++ signals [SESSION_SELECTED] = ++ g_signal_new ("session-selected", ++ G_TYPE_FROM_CLASS (object_class), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET (GdmGreeterLoginWindowClass, session_selected), ++ NULL, ++ NULL, ++ g_cclosure_marshal_VOID__STRING, ++ G_TYPE_NONE, ++ 1, G_TYPE_STRING); + signals [CANCELLED] = + g_signal_new ("cancelled", + G_TYPE_FROM_CLASS (object_class), +diff --git a/gui/simple-greeter/gdm-greeter-login-window.h b/gui/simple-greeter/gdm-greeter-login-window.h +index a5e68ae..c8b1167 100644 +--- a/gui/simple-greeter/gdm-greeter-login-window.h ++++ b/gui/simple-greeter/gdm-greeter-login-window.h +@@ -55,6 +55,8 @@ typedef struct + const char *text); + void (* user_selected) (GdmGreeterLoginWindow *login_window, + const char *text); ++ void (* session_selected) (GdmGreeterLoginWindow *login_window, ++ const char *text); + void (* cancelled) (GdmGreeterLoginWindow *login_window); + void (* start_session) (GdmGreeterLoginWindow *login_window); + +@@ -75,6 +77,8 @@ gboolean gdm_greeter_login_window_info (GdmGreeterLogin + const char *text); + gboolean gdm_greeter_login_window_problem (GdmGreeterLoginWindow *login_window, + const char *text); ++void gdm_greeter_login_window_set_default_session_name (GdmGreeterLoginWindow *login_window, ++ const char *text); + + void gdm_greeter_login_window_request_timed_login (GdmGreeterLoginWindow *login_window, + const char *username, +diff --git a/gui/simple-greeter/gdm-greeter-login-window.ui b/gui/simple-greeter/gdm-greeter-login-window.ui +index 9f1bc69..8409166 100644 +--- a/gui/simple-greeter/gdm-greeter-login-window.ui ++++ b/gui/simple-greeter/gdm-greeter-login-window.ui +@@ -277,8 +277,8 @@ + + + +- False +- False ++ True ++ True + end + 2 + +diff --git a/gui/simple-greeter/gdm-greeter-session.c b/gui/simple-greeter/gdm-greeter-session.c +index 14f518e..7be5acd 100644 +--- a/gui/simple-greeter/gdm-greeter-session.c ++++ b/gui/simple-greeter/gdm-greeter-session.c +@@ -163,6 +163,7 @@ on_default_session_name_changed (GdmGreeterClient *client, + GdmGreeterSession *session) + { + g_debug ("GdmGreeterSession: default session name changed: %s", text); ++ gdm_greeter_login_window_set_default_session_name (GDM_GREETER_LOGIN_WINDOW (session->priv->login_window), text); + } + + static void +@@ -238,8 +239,9 @@ on_query_answer (GdmGreeterLoginWindow *login_window, + } + + static void +-on_select_session (GdmGreeterSession *session, +- const char *text) ++on_select_session (GdmGreeterLoginWindow *login_window, ++ const char *text, ++ GdmGreeterSession *session) + { + gdm_greeter_client_call_select_session (session->priv->client, + text); +@@ -387,6 +389,10 @@ toggle_login_window (GdmGreeterSession *session, + G_CALLBACK (on_select_user), + session); + g_signal_connect (session->priv->login_window, ++ "session-selected", ++ G_CALLBACK (on_select_session), ++ session); ++ g_signal_connect (session->priv->login_window, + "cancelled", + G_CALLBACK (on_cancelled), + session); +diff --git a/gui/simple-greeter/gdm-session-option-widget.c b/gui/simple-greeter/gdm-session-option-widget.c +index fb10098..d504d7c 100644 +--- a/gui/simple-greeter/gdm-session-option-widget.c ++++ b/gui/simple-greeter/gdm-session-option-widget.c +@@ -160,7 +160,6 @@ gdm_session_option_widget_new (void) + + object = g_object_new (GDM_TYPE_SESSION_OPTION_WIDGET, + "label-text", _("Session"), +- "icon-name", "session-properties", + NULL); + + return GTK_WIDGET (object); +-- +1.7.4.1 +