18991N/A -DGDM_DEFAULTS_CONF=\"$(GDM_DEFAULTS_CONF)\" \
18991N/A -DGDM_CUSTOM_CONF=\"$(GDM_CUSTOM_CONF)\" \
18991N/A -DGDM_OLD_CONF=\"$(GDM_OLD_CONF)\" \
18962N/A+gdm_check_first_time_login (char *username)
18962N/A+ g_return_val_if_fail (username != NULL && username[0], FALSE);
18962N/A+ if (pwent != NULL && pwent->pw_dir != NULL) {
18962N/A+ user_dmrc = g_build_filename (pwent->pw_dir, ".dmrc", NULL);
18962N/A+ if (!g_file_test (user_dmrc, G_FILE_TEST_EXISTS)) {
18962N/A+ sys_dmrc = g_build_filename (GDM_CACHE_DIR, username, "dmrc", NULL);
18962N/A+ if (!g_file_test (sys_dmrc, G_FILE_TEST_EXISTS))
18991N/A+ g_return_val_if_fail (username != NULL && username[0], NULL);
18991N/A+ if (pwent != NULL && pwent->pw_dir != NULL &&
18991N/A+ g_file_test (pwent->pw_dir, G_FILE_TEST_EXISTS))
18991N/A+ return g_strdup (pwent->pw_dir);
18991N/A+gdm_create_temp_gdm_dmrc_filename (char *username) {
18991N/A+ g_return_val_if_fail (username != NULL && username[0], NULL);
18991N/A+ gdm_home = gdm_user_home (GDM_USERNAME);
18991N/A+ login_home = gdm_user_home (username);
18991N/A+ tmp_filename = g_build_filename (gdm_home, tmp_dmrc, NULL);
18962N/A char *gdm_read_default (gchar *key);
18962N/A+gboolean gdm_check_first_time_login (char *username);
18991N/A+char *gdm_user_home (char *username);
18991N/A+char *gdm_create_temp_gdm_dmrc_filename (char *username);
18940N/A+gdm_session_settings_first_time_load (GdmSessionSettings *settings,
18940N/A+ g_return_val_if_fail (settings != NULL, FALSE);
18940N/A+ g_return_val_if_fail (username != NULL, FALSE);
18940N/A+ if (settings->priv->session_name != NULL) {
18940N/A+ g_debug ("Freeing old session value %s", settings->priv->session_name);
18940N/A+ g_free (settings->priv->session_name);
18940N/A+ settings->priv->session_name = NULL;
18940N/A+ if (settings->priv->language_name != NULL) {
18940N/A+ g_debug ("Freeing old language value %s", settings->priv->language_name);
18940N/A+ g_free (settings->priv->language_name);
18940N/A+ settings->priv->language_name = NULL;
18940N/A+ if (settings->priv->layout_name != NULL) {
18940N/A+ g_debug ("Freeing old layout value %s", settings->priv->layout_name);
18940N/A+ g_free (settings->priv->layout_name);
18940N/A+ settings->priv->layout_name = NULL;
18940N/A+ filename = g_build_filename (GDM_CACHE_DIR, username, "dmrc", NULL);
18940N/A+ if (!g_key_file_load_from_file (key_file, filename,
18940N/A+ G_KEY_FILE_NONE, &load_error)) {
18940N/A+ g_propagate_error (error, load_error);
18940N/A+ session_name = g_key_file_get_string (key_file, "Desktop",
18940N/A+ g_debug ("Setting value to %s", session_name);
18940N/A+ gdm_session_settings_set_session_name (settings, session_name);
18940N/A+ } else if (g_error_matches (load_error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
18940N/A+ g_propagate_error (error, load_error);
18940N/A+ language_name = g_key_file_get_string (key_file, "Desktop", "Language",
18940N/A+ gdm_session_settings_set_language_name (settings, language_name);
18940N/A+ } else if (g_error_matches (load_error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
18940N/A+ g_propagate_error (error, load_error);
18940N/A+ layout_name = g_key_file_get_string (key_file, "Desktop", "Layout",
18940N/A+ gdm_session_settings_set_layout_name (settings, layout_name);
18940N/A+ } else if (g_error_matches (load_error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
18940N/A+ g_propagate_error (error, load_error);
18940N/A gdm_session_settings_load (GdmSessionSettings *settings,
18940N/A GType gdm_session_settings_get_type (void);
18940N/A GdmSessionSettings *gdm_session_settings_new (void);
18940N/A+gboolean gdm_session_settings_first_time_load (GdmSessionSettings *settings,
18940N/A gboolean gdm_session_settings_load (GdmSessionSettings *settings,
18991N/A+ * We create a special case if srcfile is
18991N/A+ * ~gdm/<worker->priv->username>.dmrc and
18991N/A+ * destfile is ~/.dmrc. In this case since
18991N/A+ * ~gdm/<worker->priv->username>.dmrc is
18991N/A+ * owned by ther user 'gdm', we need to by-pass
18991N/A+ * the uid check for copying the file.
18991N/A+owner_check (GdmSessionWorker *worker,
18991N/A+ char *login_home = gdm_user_home (worker->priv->username);
18991N/A+ char *user_dmrc = g_build_filename (login_home, ".dmrc", NULL);
18991N/A+ char *temp_gdm_dmrc = gdm_create_temp_gdm_dmrc_filename (worker->priv->username);
18991N/A+ if (!g_strcmp0 (temp_gdm_dmrc, srcfile) && !g_strcmp0 (user_dmrc, destfile))
18991N/A-check_user_copy_file (const char *srcfile,
18991N/A+check_user_copy_file (GdmSessionWorker *worker,
18991N/A g_debug ("File is not owned by user");
18991N/A g_debug ("GdmSessionWorker: Checking if %s should be copied to cache %s",
18991N/A- res = check_user_copy_file (userfilename,
18991N/A+ res = check_user_copy_file (worker,
18991N/A g_debug ("Checking user's ~/.gnome/gdm file");
18991N/A- res = check_user_copy_file (tempfilename,
18991N/A+ res = check_user_copy_file (worker,
18991N/A+copy_temp_dmrc_from_gdm_to_user (GdmSessionWorker *worker, char **filename)
18991N/A+ if ((temp_gdm_dmrc = gdm_create_temp_gdm_dmrc_filename (worker->priv->username)) == NULL)
18991N/A+ login_home = gdm_user_home (worker->priv->username);
18991N/A+ * gdm-first-time-login-helper saves the dmrc for
18991N/A+ * worker->priv->username as temp_gdm_dmrc under
18991N/A+ * gdm HOME. Copy this to .dmrc file under HOME and
18991N/A+ * change the ownership. This is a special case usage
18991N/A+ *filename = g_build_filename (login_home, ".dmrc", NULL);
18991N/A+ gdm_cache_copy_file (worker, temp_gdm_dmrc, *filename);
18991N/A+ /* Remove <user_name>.dmrc under gdm HOME */
18991N/A+ VE_IGNORE_EINTR (g_unlink (temp_gdm_dmrc));
18940N/A+run_gdm_first_time_login_helper (GdmSessionWorker *worker, char *session_name,
18940N/A+ char *language_name, char *layout_name)
18962N/A+ g_debug ("Running " LIBEXECDIR "/gdm-first-time-login-helper \"%s\" \"%s\" \"%s\" \"%s\"",
18962N/A+ worker->priv->username ? worker->priv->username : "",
18962N/A+ session_name ? session_name : "",
18962N/A+ layout_name ? layout_name : "",
18962N/A+ language_name ? language_name : "");
18962N/A+ char *argv[] = { LIBEXECDIR"/gdm-first-time-login-helper",
18962N/A+ worker->priv->username ? worker->priv->username : "",
18962N/A+ session_name ? session_name : "",
18962N/A+ layout_name ? layout_name : "",
18962N/A+ language_name ? language_name : "",
18962N/A+ /* Wait for the child to finish */
18962N/A+ if (waitpid (fpid, &status, 0) == -1) {
18962N/A+ g_debug("User aborted gdm-first-time-login-helper");
18962N/A+ g_debug("Cannot start gdm-first-time-login-helper");
18962N/A+ g_debug("Cannot start gdm-first-time-login-helper");
18991N/A+ copy_temp_dmrc_from_gdm_to_user (worker, &filename);
18962N/A+ cachedir = gdm_session_worker_create_cachedir (worker);
18962N/A+ g_debug ("Copying user dmrc file to cache");
18962N/A+ cachefile = g_build_filename (cachedir, "dmrc", NULL);
18962N/A+ gdm_cache_copy_file (worker, filename, cachefile);
18940N/A gdm_session_worker_accredit_user (GdmSessionWorker *worker,
18940N/A attempt_to_load_user_settings (worker, worker->priv->username,
18962N/A+ if (gdm_check_first_time_login (worker->priv->username) &&
18962N/A+ !gdm_session_settings_is_loaded (worker->priv->user_settings) &&
18962N/A+ run_gdm_first_time_login_helper (worker, session_name, language_name, layout_name)) {
18940N/A+ g_debug ("Now loading settings created by gdm-first-time-login-helper.");
18940N/A+ gdm_session_settings_first_time_load (worker->priv->user_settings, worker->priv->username, NULL);
18940N/A+ g_debug ("Did not run gdm-first-time-login-helper.");
18962N/A res = gdm_slave_connect_to_x11_display (GDM_SLAVE (slave));
18962N/A /* FIXME: handle wait-for-go */
18962N/A- gdm_slave_get_timed_login_details (GDM_SLAVE (slave), &enabled, NULL, &delay);
18962N/A+ gdm_slave_get_timed_login_details (GDM_SLAVE (slave), &enabled, &username, &delay);
18962N/A+ first_time_login = gdm_check_first_time_login (username);
18962N/A+ if (! enabled || delay > 0 || first_time_login) {
18962N/A gdm_slave_run_script (GDM_SLAVE (slave), GDMCONFDIR "/Init", GDM_USERNAME);
18962N/A if (slave->priv->connection_attempts >= MAX_CONNECT_ATTEMPTS) {
18962N/A g_warning ("Unable to connect to display after %d tries - bailing out", slave->priv->connection_attempts);
18991N/A+gdm_first_time_login_helper_SOURCES = \
18991N/A+gdm_first_time_login_helper_LDADD = \
18940N/A widget->priv->in_use_message = NULL;
18940N/A+ if (widget->priv->update_idle_id > 0) {
18940N/A+ g_source_remove (widget->priv->update_idle_id);
18940N/A+ widget->priv->update_idle_id = 0;
18940N/A G_OBJECT_CLASS (gdm_chooser_widget_parent_class)->dispose (object);
18940N/A+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
18940N/A+ * This program is free software; you can redistribute it
and/or modify
18940N/A+ * it under the terms of the GNU General Public License as published by
18940N/A+ * the Free Software Foundation; either version 2 of the License, or
18940N/A+ * (at your option) any later version.
18940N/A+ * This program is distributed in the hope that it will be useful,
18940N/A+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18940N/A+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18940N/A+ * GNU General Public License for more details.
18940N/A+ * You should have received a copy of the GNU General Public License
18940N/A+ * along with this program; if not, write to the Free Software
18940N/A+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18940N/A+ * Written by: Suresh Chandrasekharan <suresh.chandrasekharan@oracle.com>
18940N/A+typedef enum ptypes {MESSAGE=0, SESSION, LAYOUT, LANGUAGE} ptypes;
18940N/A+firsttime_login_message_popup (GtkWidget *dialog,
18940N/A+ dialog = (GtkWidget *) g_object_new (GTK_TYPE_MESSAGE_DIALOG,
18940N/A+ gtk_dialog_add_buttons (GTK_DIALOG (dialog),
18940N/A+ _("_Skip Setup"), GTK_RESPONSE_CANCEL,
18940N/A+ GTK_STOCK_OK, GTK_RESPONSE_OK,
18940N/A+ display_text = g_strconcat ("<b>", text, "</b>", NULL);
18940N/A+ gtk_message_dialog_set_markup ((GtkMessageDialog *)dialog, display_text);
18940N/A+ gtk_window_set_title (GTK_WINDOW (dialog), title);
18962N/A+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS);
18940N/A+ image = gtk_image_new_from_icon_name ("user-info", GTK_ICON_SIZE_DIALOG);
18940N/A+ gtk_message_dialog_set_image ((GtkMessageDialog *)dialog, image);
18940N/A+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
18940N/A+run_dialog(int height, int width, ptypes key, char *set_name, char **name) {
18940N/A+ dialog = firsttime_login_message_popup(dialog,
18940N/A+ _("First Time Login Assistant"),
18940N/A+ _("This is the first time you have logged in, please select your preferences:"));
18940N/A+ dialog = gdm_session_chooser_dialog_new();
18940N/A+ items = gdm_session_chooser_dialog_get_number_of_items (GDM_SESSION_CHOOSER_DIALOG (dialog));
18940N/A+ if (items && set_name && set_name[0] != '\0')
18940N/A+ gdm_session_chooser_dialog_set_current_session_name (GDM_SESSION_CHOOSER_DIALOG (dialog), set_name);
18940N/A+ dialog = gdm_layout_chooser_dialog_new();
18940N/A+ items = gdm_layout_chooser_dialog_get_number_of_items (GDM_LAYOUT_CHOOSER_DIALOG (dialog));
18940N/A+ if (items && set_name && set_name[0] != '\0')
18940N/A+ gdm_layout_chooser_dialog_set_current_layout_name (GDM_LAYOUT_CHOOSER_DIALOG (dialog), set_name);
18940N/A+ dialog = gdm_language_chooser_dialog_new();
18940N/A+ items = gdm_language_chooser_dialog_get_number_of_items (GDM_LANGUAGE_CHOOSER_DIALOG (dialog));
18940N/A+ if (items && set_name && set_name[0] != '\0')
18940N/A+ gdm_language_chooser_dialog_set_current_language_name (GDM_LANGUAGE_CHOOSER_DIALOG (dialog), set_name);
18940N/A+ gtk_widget_set_size_request (dialog, height, width);
18940N/A+ gtk_widget_show_all (GTK_WIDGET (dialog));
18940N/A+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
18940N/A+ *name = gdm_session_chooser_dialog_get_current_session_name (GDM_SESSION_CHOOSER_DIALOG (dialog));
18940N/A+ *name = gdm_layout_chooser_dialog_get_current_layout_name (GDM_LAYOUT_CHOOSER_DIALOG (dialog));
18940N/A+ *name = gdm_language_chooser_dialog_get_current_language_name (GDM_LANGUAGE_CHOOSER_DIALOG (dialog));
18991N/A+session_settings_save (char *session_name,
18940N/A+ g_return_val_if_fail (user_name != NULL, FALSE);
18991N/A+ if ((filename = gdm_create_temp_gdm_dmrc_filename (user_name)) == NULL)
18940N/A+ g_key_file_load_from_file (key_file, filename,
18940N/A+ g_key_file_set_string (key_file, "Desktop", "Session",
18940N/A+ g_key_file_set_string (key_file, "Desktop", "Language",
18940N/A+ g_key_file_set_string (key_file, "Desktop", "Layout",
18940N/A+ contents = g_key_file_to_data (key_file, &length, &file_error);
18940N/A+ g_propagate_error (error, file_error);
18940N/A+ if (!g_file_set_contents (filename, contents, length, &file_error)) {
18940N/A+ g_propagate_error (error, file_error);
18962N/A+ root_window = gdk_screen_get_root_window (gdk_screen_get_default ());
18962N/A+ cursor = gdk_cursor_new (GDK_LEFT_PTR);
18962N/A+ gdk_window_set_cursor (root_window, cursor);
18991N/A+ g_debug (_("User %s doesn't exist"), user_name);
18991N/A+ g_debug ("Changing (uid:gid) for child process to (%d:%d)",
18991N/A+ if (setgid (pwent->pw_gid) < 0) {
18991N/A+ g_debug (_("Couldn't set groupid to %d"),
18991N/A+ if (initgroups (pwent->pw_name, pwent->pw_gid) < 0) {
18991N/A+ g_debug (_("initgroups () failed for %s"),
18991N/A+ if (setuid (pwent->pw_uid) < 0) {
18991N/A+ g_debug (_("Couldn't set userid to %d"),
18991N/A+ g_debug (_("Couldn't set groupid to %d"), 0);
18991N/A+ /* Don't error out, it's not fatal, if it fails we'll
18991N/A+ /* this will get rid of any suplementary groups etc... */
18940N/A+ g_message ("Usage: %s <user name> <session_name> <layout_name> <language_name>", argv[0]);
18991N/A+ if (!set_uid_gid (GDM_USERNAME)) {
18991N/A+ g_warning (_("Could not set user to %s"), GDM_USERNAME);
18940N/A+ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
18940N/A+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
18940N/A+ run_dialog(480, 120, MESSAGE, NULL, &dialog_feedback);
18940N/A+ run_dialog(480, 480, SESSION, argv[2], &session_name);
18940N/A+ run_dialog(480, 480, LAYOUT, argv[3], &layout_name);
18940N/A+ run_dialog(480, 480, LANGUAGE, argv[4], &lang_name);
18940N/A+ if (!session_settings_save (session_name, lang_name, layout_name, argv[1], &error)) {
18940N/A+ g_warning (_("could not save session and language settings: %s"),
18940N/A gdm_language_chooser_widget_set_current_language_name (GDM_LANGUAGE_CHOOSER_WIDGET (dialog->priv->chooser_widget), language_name);
18940N/A+gdm_language_chooser_dialog_get_number_of_items (GdmLanguageChooserDialog *dialog)
18940N/A+ dialog->priv = GDM_LANGUAGE_CHOOSER_DIALOG_GET_PRIVATE (dialog);
18940N/A+ if (dialog->priv->chooser_widget == NULL)
18940N/A+ dialog->priv->chooser_widget = gdm_language_chooser_widget_new ();
18940N/A+ return gdm_chooser_widget_get_number_of_items (GDM_CHOOSER_WIDGET (dialog->priv->chooser_widget));
18940N/A gdm_language_chooser_dialog_size_request (GtkWidget *widget,
18940N/A gtk_dialog_add_buttons (GTK_DIALOG (dialog),
18940N/A- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
18940N/A+ _("_Skip Setup"), GTK_RESPONSE_CANCEL,
18940N/A char * gdm_language_chooser_dialog_get_current_language_name (GdmLanguageChooserDialog *dialog);
18940N/A void gdm_language_chooser_dialog_set_current_language_name (GdmLanguageChooserDialog *dialog,
18940N/A+int gdm_language_chooser_dialog_get_number_of_items
18940N/A+(GdmLanguageChooserDialog *dialog);
18940N/A gdm_chooser_widget_set_separator_position (GDM_CHOOSER_WIDGET (widget),
18940N/A GDM_CHOOSER_WIDGET_POSITION_TOP);
18940N/A+ if (!widget->priv->languages_added) {
18940N/A+ add_available_languages (widget);
18940N/A+ widget->priv->languages_added = TRUE;
18940N/A gdm_layout_chooser_widget_set_current_layout_name (GDM_LAYOUT_CHOOSER_WIDGET (dialog->priv->chooser_widget), layout_name);
18940N/A+gdm_layout_chooser_dialog_get_number_of_items (GdmLayoutChooserDialog *dialog)
18940N/A+ dialog->priv = GDM_LAYOUT_CHOOSER_DIALOG_GET_PRIVATE (dialog);
18940N/A+ if (dialog->priv->chooser_widget == NULL)
18940N/A+ dialog->priv->chooser_widget = gdm_layout_chooser_widget_new ();
18940N/A+ return gdm_chooser_widget_get_number_of_items (GDM_CHOOSER_WIDGET (dialog->priv->chooser_widget));
18940N/A gdm_layout_chooser_dialog_size_request (GtkWidget *widget,
18940N/A gdm_layout_chooser_dialog_init (GdmLayoutChooserDialog *dialog)
18940N/A dialog->priv = GDM_LAYOUT_CHOOSER_DIALOG_GET_PRIVATE (dialog);
18940N/A gdm_chooser_widget_set_hide_inactive_items (GDM_CHOOSER_WIDGET (dialog->priv->chooser_widget),
18940N/A- gdm_layout_chooser_widget_set_current_layout_name (GDM_LAYOUT_CHOOSER_WIDGET (dialog->priv->chooser_widget),
18940N/A- setlocale (LC_MESSAGES, NULL));
18940N/A+ layout_name = gdm_layout_chooser_widget_get_current_layout_name (GDM_LAYOUT_CHOOSER_WIDGET (dialog->priv->chooser_widget));
18940N/A+ gdm_layout_chooser_widget_set_current_layout_name (GDM_LAYOUT_CHOOSER_WIDGET (dialog->priv->chooser_widget), layout_name);
18940N/A gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog->priv->chooser_widget);
18940N/A g_signal_connect_swapped (G_OBJECT (dialog->priv->chooser_widget),
18940N/A gtk_dialog_add_buttons (GTK_DIALOG (dialog),
18940N/A- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
18940N/A+ _("_Skip Setup"), GTK_RESPONSE_CANCEL,
18940N/A char * gdm_layout_chooser_dialog_get_current_layout_name (GdmLayoutChooserDialog *dialog);
18940N/A void gdm_layout_chooser_dialog_set_current_layout_name (GdmLayoutChooserDialog *dialog,
18940N/A+int gdm_layout_chooser_dialog_get_number_of_items (GdmLayoutChooserDialog *dialog);
18940N/A gdm_chooser_widget_set_separator_position (GDM_CHOOSER_WIDGET (widget),
18940N/A GDM_CHOOSER_WIDGET_POSITION_TOP);
18940N/A+ if (!widget->priv->layouts_added) {
18940N/A+ add_available_layouts (widget);
18940N/A+ widget->priv->layouts_added = TRUE;
18940N/A+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
18940N/A+ * Copyright (C) 2008 Matthias Clasen <mclasen@redhat.com>
18940N/A+ * This program is free software; you can redistribute it
and/or modify
18940N/A+ * it under the terms of the GNU General Public License as published by
18940N/A+ * the Free Software Foundation; either version 2 of the License, or
18940N/A+ * (at your option) any later version.
18940N/A+ * This program is distributed in the hope that it will be useful,
18940N/A+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18940N/A+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18940N/A+ * GNU General Public License for more details.
18940N/A+ * You should have received a copy of the GNU General Public License
18940N/A+ * along with this program; if not, write to the Free Software
18940N/A+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18940N/A+ * Written by suresh.chandrasekharan@oracle.com based on
18940N/A+#define GDM_SESSION_CHOOSER_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SESSION_CHOOSER_DIALOG, GdmSessionChooserDialogPrivate))
18940N/A+struct GdmSessionChooserDialogPrivate
18940N/A+static void gdm_session_chooser_dialog_class_init (GdmSessionChooserDialogClass *klass);
18940N/A+static void gdm_session_chooser_dialog_init (GdmSessionChooserDialog *session_chooser_dialog);
18940N/A+static void gdm_session_chooser_dialog_finalize (GObject *object);
18940N/A+G_DEFINE_TYPE (GdmSessionChooserDialog, gdm_session_chooser_dialog, GTK_TYPE_DIALOG)
18940N/A+gdm_session_chooser_dialog_get_current_session_name (GdmSessionChooserDialog *dialog)
18940N/A+ g_return_val_if_fail (GDM_IS_SESSION_CHOOSER_DIALOG (dialog), NULL);
18940N/A+ session_name = gdm_session_chooser_widget_get_current_session_name (GDM_SESSION_CHOOSER_WIDGET (dialog->priv->chooser_widget));
18940N/A+gdm_session_chooser_dialog_set_current_session_name (GdmSessionChooserDialog *dialog,
18940N/A+ g_return_if_fail (GDM_IS_SESSION_CHOOSER_DIALOG (dialog));
18940N/A+ gdm_session_chooser_widget_set_current_session_name (GDM_SESSION_CHOOSER_WIDGET (dialog->priv->chooser_widget), session_name);
18940N/A+gdm_session_chooser_dialog_get_number_of_items (GdmSessionChooserDialog *dialog)
18940N/A+ dialog->priv = GDM_SESSION_CHOOSER_DIALOG_GET_PRIVATE (dialog);
18940N/A+ if (dialog->priv->chooser_widget == NULL)
18940N/A+ dialog->priv->chooser_widget = gdm_session_chooser_widget_new ();
18940N/A+ return gdm_chooser_widget_get_number_of_items (GDM_CHOOSER_WIDGET (dialog->priv->chooser_widget));
18940N/A+gdm_session_chooser_dialog_size_request (GtkWidget *widget,
18940N/A+ GtkRequisition child_requisition;
18940N/A+ if (GTK_WIDGET_CLASS (gdm_session_chooser_dialog_parent_class)->size_request) {
18940N/A+ GTK_WIDGET_CLASS (gdm_session_chooser_dialog_parent_class)->size_request (widget, requisition);
18940N/A+ screen_w = gdk_screen_get_width (gtk_widget_get_screen (widget));
18940N/A+ screen_h = gdk_screen_get_height (gtk_widget_get_screen (widget));
18940N/A+ gtk_widget_get_child_requisition (GTK_BIN (widget)->child, &child_requisition);
18940N/A+ *requisition = child_requisition;
18940N/A+ requisition->width += 2 * GTK_CONTAINER (widget)->border_width;
18940N/A+ requisition->height += 2 * GTK_CONTAINER (widget)->border_width;
18940N/A+ requisition->width = MIN (requisition->width, .50 * screen_w);
18940N/A+ requisition->height = MIN (requisition->height, .80 * screen_h);
18940N/A+gdm_session_chooser_dialog_realize (GtkWidget *widget)
18940N/A+ GdmSessionChooserDialog *chooser_dialog;
18940N/A+ chooser_dialog = GDM_SESSION_CHOOSER_DIALOG (widget);
18940N/A+ gtk_widget_show (chooser_dialog->priv->chooser_widget);
18940N/A+ GTK_WIDGET_CLASS (gdm_session_chooser_dialog_parent_class)->realize (widget);
18940N/A+gdm_session_chooser_dialog_class_init (GdmSessionChooserDialogClass *klass)
18940N/A+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
18940N/A+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
18940N/A+ object_class->finalize = gdm_session_chooser_dialog_finalize;
18940N/A+ widget_class->size_request = gdm_session_chooser_dialog_size_request;
18940N/A+ widget_class->realize = gdm_session_chooser_dialog_realize;
18940N/A+ g_type_class_add_private (klass, sizeof (GdmSessionChooserDialogPrivate));
18940N/A+respond (GdmSessionChooserDialog *dialog)
18940N/A+ gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
18940N/A+queue_response (GdmSessionChooserDialog *dialog)
18940N/A+ g_idle_add ((GSourceFunc) respond, dialog);
18940N/A+gdm_session_chooser_dialog_init (GdmSessionChooserDialog *dialog)
18940N/A+ dialog->priv = GDM_SESSION_CHOOSER_DIALOG_GET_PRIVATE (dialog);
18940N/A+ dialog->priv->chooser_widget = gdm_session_chooser_widget_new ();
18940N/A+ gdm_chooser_widget_set_hide_inactive_items (GDM_CHOOSER_WIDGET (dialog->priv->chooser_widget),
18940N/A+ session_name = gdm_session_chooser_widget_get_current_session_name (GDM_SESSION_CHOOSER_WIDGET (dialog->priv->chooser_widget));
18940N/A+ gdm_session_chooser_widget_set_current_session_name (GDM_SESSION_CHOOSER_WIDGET (dialog->priv->chooser_widget), session_name);
18940N/A+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog->priv->chooser_widget);
18940N/A+ g_signal_connect_swapped (G_OBJECT (dialog->priv->chooser_widget),
18940N/A+ "activated", G_CALLBACK (queue_response),
18940N/A+ gtk_dialog_add_buttons (GTK_DIALOG (dialog),
18940N/A+ _("_Skip Setup"), GTK_RESPONSE_CANCEL,
18940N/A+ GTK_STOCK_OK, GTK_RESPONSE_OK,
18940N/A+ gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
18940N/A+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
18940N/A+ gtk_container_set_border_width (GTK_CONTAINER (dialog->priv->chooser_widget), 5);
18940N/A+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS);
18940N/A+ gtk_window_set_default_size (GTK_WINDOW (dialog), 512, 440);
18940N/A+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
18940N/A+gdm_session_chooser_dialog_finalize (GObject *object)
18940N/A+ GdmSessionChooserDialog *session_chooser_dialog;
18940N/A+ g_return_if_fail (object != NULL);
18940N/A+ g_return_if_fail (GDM_IS_SESSION_CHOOSER_DIALOG (object));
18940N/A+ session_chooser_dialog = GDM_SESSION_CHOOSER_DIALOG (object);
18940N/A+ g_return_if_fail (session_chooser_dialog->priv != NULL);
18940N/A+ G_OBJECT_CLASS (gdm_session_chooser_dialog_parent_class)->finalize (object);
18940N/A+gdm_session_chooser_dialog_new (void)
18940N/A+ object = g_object_new (GDM_TYPE_SESSION_CHOOSER_DIALOG,
18940N/A+ "icon-name", "session-properties",
18940N/A+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
18940N/A+ * Copyright (C) 2008 Matthias Clasen <mclasen@redhat.com>
18940N/A+ * This program is free software; you can redistribute it
and/or modify
18940N/A+ * it under the terms of the GNU General Public License as published by
18940N/A+ * the Free Software Foundation; either version 2 of the License, or
18940N/A+ * (at your option) any later version.
18940N/A+ * This program is distributed in the hope that it will be useful,
18940N/A+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18940N/A+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18940N/A+ * GNU General Public License for more details.
18940N/A+ * You should have received a copy of the GNU General Public License
18940N/A+ * along with this program; if not, write to the Free Software
18940N/A+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18940N/A+ * Written by suresh.chandrasekharan@oracle.com based on
18940N/A+#ifndef __GDM_SESSION_CHOOSER_DIALOG_H
18940N/A+#define __GDM_SESSION_CHOOSER_DIALOG_H
18940N/A+#define GDM_TYPE_SESSION_CHOOSER_DIALOG (gdm_session_chooser_dialog_get_type ())
18940N/A+#define GDM_SESSION_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_SESSION_CHOOSER_DIALOG, GdmSessionChooserDialog))
18940N/A+#define GDM_SESSION_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_SESSION_CHOOSER_DIALOG, GdmSessionChooserDialogClass))
18940N/A+#define GDM_IS_SESSION_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_SESSION_CHOOSER_DIALOG))
18940N/A+#define GDM_IS_SESSION_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_SESSION_CHOOSER_DIALOG))
18940N/A+#define GDM_SESSION_CHOOSER_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_SESSION_CHOOSER_DIALOG, GdmSessionChooserDialogClass))
18940N/A+typedef struct GdmSessionChooserDialogPrivate GdmSessionChooserDialogPrivate;
18940N/A+ GdmSessionChooserDialogPrivate *priv;
18940N/A+} GdmSessionChooserDialogClass;
18940N/A+GType gdm_session_chooser_dialog_get_type (void);
18940N/A+GtkWidget * gdm_session_chooser_dialog_new (void);
18940N/A+char * gdm_session_chooser_dialog_get_current_session_name (GdmSessionChooserDialog *dialog);
18940N/A+void gdm_session_chooser_dialog_set_current_session_name (GdmSessionChooserDialog *dialog,
18940N/A+int gdm_session_chooser_dialog_get_number_of_items
18940N/A+(GdmSessionChooserDialog *dialog);
18940N/A+#endif /* __GDM_SESSION_CHOOSER_DIALOG_H */
18940N/A+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
18940N/A+ * Copyright (C) 2008 Matthias Clasen <mclasen@redhat.com>
18940N/A+ * This program is free software; you can redistribute it
and/or modify
18940N/A+ * it under the terms of the GNU General Public License as published by
18940N/A+ * the Free Software Foundation; either version 2 of the License, or
18940N/A+ * (at your option) any later version.
18940N/A+ * This program is distributed in the hope that it will be useful,
18940N/A+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18940N/A+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18940N/A+ * GNU General Public License for more details.
18940N/A+ * You should have received a copy of the GNU General Public License
18940N/A+ * along with this program; if not, write to the Free Software
18940N/A+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18940N/A+ * Written by suresh.chandrasekharan@oracle.com based on
18940N/A+#define GDM_SESSION_CHOOSER_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SESSION_CHOOSER_WIDGET, GdmSessionChooserWidgetPrivate))
18940N/A+struct GdmSessionChooserWidgetPrivate
18940N/A+static void gdm_session_chooser_widget_class_init (GdmSessionChooserWidgetClass *klass);
18940N/A+static void gdm_session_chooser_widget_init (GdmSessionChooserWidget *session_chooser_widget);
18940N/A+static void gdm_session_chooser_widget_finalize (GObject *object);
18940N/A+G_DEFINE_TYPE (GdmSessionChooserWidget, gdm_session_chooser_widget, GDM_TYPE_CHOOSER_WIDGET)
18940N/A+ CHOOSER_LIST_TITLE_COLUMN = 0,
18940N/A+ CHOOSER_LIST_TRANSLATED_COLUMN,
18940N/A+gdm_session_chooser_widget_get_current_session_name (GdmSessionChooserWidget *widget)
18940N/A+ g_return_val_if_fail (GDM_IS_SESSION_CHOOSER_WIDGET (widget), NULL);
18940N/A+ id = gdm_chooser_widget_get_selected_item (GDM_CHOOSER_WIDGET (widget));
18940N/A+gdm_session_chooser_widget_set_current_session_name (GdmSessionChooserWidget *widget,
18940N/A+ g_return_if_fail (GDM_IS_SESSION_CHOOSER_WIDGET (widget));
18940N/A+ gdm_chooser_widget_set_selected_item (GDM_CHOOSER_WIDGET (widget),
18940N/A+ gdm_chooser_widget_set_selected_item (GDM_CHOOSER_WIDGET (widget), id);
18940N/A+gdm_session_chooser_widget_add_session (GdmSessionChooserWidget *widget,
18940N/A+ escaped = g_markup_escape_text (name, -1);
18940N/A+ gdm_chooser_widget_add_item (GDM_CHOOSER_WIDGET (widget),
18940N/A+add_available_sessions (GdmSessionChooserWidget *widget)
18940N/A+ session_names = gdm_get_all_sessions ();
18940N/A+ for (i = 0; session_names[i] != NULL; i++) {
18940N/A+ gdm_session_chooser_widget_add_session (widget,
18940N/A+gdm_session_chooser_widget_dispose (GObject *object)
18940N/A+ G_OBJECT_CLASS (gdm_session_chooser_widget_parent_class)->dispose (object);
18940N/A+gdm_session_chooser_widget_realize (GtkWidget *widget)
18940N/A+ GdmSessionChooserWidget *chooser;
18940N/A+ chooser = GDM_SESSION_CHOOSER_WIDGET (widget);
18940N/A+ GTK_WIDGET_CLASS (gdm_session_chooser_widget_parent_class)->realize (widget);
18940N/A+ if (!chooser->priv->sessions_added) {
18940N/A+ add_available_sessions (chooser);
18940N/A+ chooser->priv->sessions_added = TRUE;
18940N/A+gdm_session_chooser_widget_class_init (GdmSessionChooserWidgetClass *klass)
18940N/A+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
18940N/A+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
18940N/A+ object_class->dispose = gdm_session_chooser_widget_dispose;
18940N/A+ object_class->finalize = gdm_session_chooser_widget_finalize;
18940N/A+ widget_class->realize = gdm_session_chooser_widget_realize;
18940N/A+ g_type_class_add_private (klass, sizeof (GdmSessionChooserWidgetPrivate));
18940N/A+gdm_session_chooser_widget_init (GdmSessionChooserWidget *widget)
18940N/A+ widget->priv = GDM_SESSION_CHOOSER_WIDGET_GET_PRIVATE (widget);
18940N/A+ gdm_chooser_widget_set_separator_position (GDM_CHOOSER_WIDGET (widget),
18940N/A+ GDM_CHOOSER_WIDGET_POSITION_TOP);
18940N/A+ if (!widget->priv->sessions_added) {
18940N/A+ add_available_sessions (widget);
18940N/A+ widget->priv->sessions_added = TRUE;
18940N/A+gdm_session_chooser_widget_finalize (GObject *object)
18940N/A+ GdmSessionChooserWidget *session_chooser_widget;
18940N/A+ g_return_if_fail (object != NULL);
18940N/A+ g_return_if_fail (GDM_IS_SESSION_CHOOSER_WIDGET (object));
18940N/A+ session_chooser_widget = GDM_SESSION_CHOOSER_WIDGET (object);
18940N/A+ g_return_if_fail (session_chooser_widget->priv != NULL);
18940N/A+ G_OBJECT_CLASS (gdm_session_chooser_widget_parent_class)->finalize (object);
18940N/A+gdm_session_chooser_widget_new (void)
18940N/A+ object = g_object_new (GDM_TYPE_SESSION_CHOOSER_WIDGET,
18940N/A+ "inactive-text", _("_Session:"),
18940N/A+ "active-text", _("_Session:"),
18940N/A+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
18940N/A+ * Copyright (C) 2008 Matthias Clasen <mclasen@redhat.com>
18940N/A+ * This program is free software; you can redistribute it
and/or modify
18940N/A+ * it under the terms of the GNU General Public License as published by
18940N/A+ * the Free Software Foundation; either version 2 of the License, or
18940N/A+ * (at your option) any later version.
18940N/A+ * This program is distributed in the hope that it will be useful,
18940N/A+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18940N/A+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18940N/A+ * GNU General Public License for more details.
18940N/A+ * You should have received a copy of the GNU General Public License
18940N/A+ * along with this program; if not, write to the Free Software
18940N/A+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18940N/A+ * Written by suresh.chandrasekharan@oracle.com based on
18940N/A+#ifndef __GDM_SESSION_CHOOSER_WIDGET_H
18940N/A+#define __GDM_SESSION_CHOOSER_WIDGET_H
18940N/A+#define GDM_TYPE_SESSION_CHOOSER_WIDGET (gdm_session_chooser_widget_get_type ())
18940N/A+#define GDM_SESSION_CHOOSER_WIDGET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_SESSION_CHOOSER_WIDGET, GdmSessionChooserWidget))
18940N/A+#define GDM_SESSION_CHOOSER_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_SESSION_CHOOSER_WIDGET, GdmSessionChooserWidgetClass))
18940N/A+#define GDM_IS_SESSION_CHOOSER_WIDGET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_SESSION_CHOOSER_WIDGET))
18940N/A+#define GDM_IS_SESSION_CHOOSER_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_SESSION_CHOOSER_WIDGET))
18940N/A+#define GDM_SESSION_CHOOSER_WIDGET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_SESSION_CHOOSER_WIDGET, GdmSessionChooserWidgetClass))
18940N/A+typedef struct GdmSessionChooserWidgetPrivate GdmSessionChooserWidgetPrivate;
18940N/A+ GdmSessionChooserWidgetPrivate *priv;
18940N/A+ GdmChooserWidgetClass parent_class;
18940N/A+} GdmSessionChooserWidgetClass;
18940N/A+GType gdm_session_chooser_widget_get_type (void);
18940N/A+GtkWidget * gdm_session_chooser_widget_new (void);
18940N/A+char * gdm_session_chooser_widget_get_current_session_name (GdmSessionChooserWidget *widget);
18940N/A+void gdm_session_chooser_widget_set_current_session_name (GdmSessionChooserWidget *widget,
18940N/A+#endif /* __GDM_SESSION_CHOOSER_WIDGET_H */