- Update to snapshot

- Split user-switcher out
This commit is contained in:
Ray Strode 2008-02-29 22:04:23 +00:00
parent 32ed7aad23
commit 651c1a1984
16 changed files with 127 additions and 5426 deletions

View File

@ -1 +1 @@
gdm-2.21.8.tar.gz
gdm-2.21.9.tar.gz

File diff suppressed because it is too large Load Diff

View File

@ -1,880 +0,0 @@
From 1a8e5634ea780869574072ce5d4b33048fb35698 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 13 Dec 2007 10:12:30 -0500
Subject: [PATCH] Change user-chooser-widget over to use new chooser widget
---
gui/simple-greeter/Makefile.am | 10 +
gui/simple-greeter/gdm-user-chooser-widget.c | 600 ++------------------------
gui/simple-greeter/gdm-user-chooser-widget.h | 11 +-
3 files changed, 59 insertions(+), 562 deletions(-)
diff --git a/gui/simple-greeter/Makefile.am b/gui/simple-greeter/Makefile.am
index a403f24..836c620 100644
--- a/gui/simple-greeter/Makefile.am
+++ b/gui/simple-greeter/Makefile.am
@@ -45,6 +45,8 @@ test_greeter_login_window_SOURCES = \
test-greeter-login-window.c \
gdm-greeter-login-window.h \
gdm-greeter-login-window.c \
+ gdm-chooser-widget.h \
+ gdm-chooser-widget.c \
gdm-user-chooser-widget.h \
gdm-user-chooser-widget.c \
gdm-user-chooser-dialog.h \
@@ -86,6 +88,8 @@ test_language_chooser_LDADD = \
test_session_chooser_SOURCES = \
test-session-chooser.c \
+ gdm-chooser-widget.h \
+ gdm-chooser-widget.c \
gdm-session-chooser-widget.h \
gdm-session-chooser-widget.c \
gdm-session-chooser-dialog.h \
@@ -98,6 +102,8 @@ test_session_chooser_LDADD = \
test_user_chooser_SOURCES = \
test-user-chooser.c \
+ gdm-chooser-widget.h \
+ gdm-chooser-widget.c \
gdm-user-chooser-widget.h \
gdm-user-chooser-widget.c \
gdm-user-chooser-dialog.h \
@@ -131,6 +137,8 @@ libexec_PROGRAMS = \
gdm_simple_greeter_SOURCES = \
greeter-main.c \
+ gdm-chooser-widget.h \
+ gdm-chooser-widget.c \
gdm-greeter-client.h \
gdm-greeter-client.c \
gdm-greeter-session.h \
@@ -145,6 +153,8 @@ gdm_simple_greeter_SOURCES = \
gdm-greeter-panel.c \
gdm-greeter-background.h \
gdm-greeter-background.c \
+ gdm-session-chooser-widget.h \
+ gdm-session-chooser-widget.c \
gdm-user-chooser-widget.h \
gdm-user-chooser-widget.c \
gdm-user-manager.h \
diff --git a/gui/simple-greeter/gdm-user-chooser-widget.c b/gui/simple-greeter/gdm-user-chooser-widget.c
index e8c0cdc..b8a9bb7 100644
--- a/gui/simple-greeter/gdm-user-chooser-widget.c
+++ b/gui/simple-greeter/gdm-user-chooser-widget.c
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ * Copyright (C) 2007 Ray Strode <rstrode@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -47,61 +48,23 @@ enum {
struct GdmUserChooserWidgetPrivate
{
- GtkWidget *treeview;
-
- GtkTreeModel *real_model;
- GtkTreeModel *filter_model;
- GtkTreeModel *sort_model;
-
GdmUserManager *manager;
GdkPixbuf *logged_in_pixbuf;
- char *chosen_user;
- gboolean show_only_chosen;
- gboolean show_other_user;
- gboolean show_guest_user;
- guint populate_id;
+ guint show_other_user : 1;
+ guint show_guest_user : 1;
};
enum {
PROP_0,
};
-enum {
- USER_CHOSEN,
- LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = { 0, };
-
static void gdm_user_chooser_widget_class_init (GdmUserChooserWidgetClass *klass);
static void gdm_user_chooser_widget_init (GdmUserChooserWidget *user_chooser_widget);
static void gdm_user_chooser_widget_finalize (GObject *object);
-G_DEFINE_TYPE (GdmUserChooserWidget, gdm_user_chooser_widget, GTK_TYPE_VBOX)
-
-enum {
- CHOOSER_LIST_PIXBUF_COLUMN = 0,
- CHOOSER_LIST_NAME_COLUMN,
- CHOOSER_LIST_TOOLTIP_COLUMN,
- CHOOSER_LIST_IS_LOGGED_IN_COLUMN,
- CHOOSER_LIST_ID_COLUMN
-};
-
-void
-gdm_user_chooser_widget_set_show_only_chosen (GdmUserChooserWidget *widget,
- gboolean show_only)
-{
- g_return_if_fail (GDM_IS_USER_CHOOSER_WIDGET (widget));
-
- if (widget->priv->show_only_chosen != show_only) {
- widget->priv->show_only_chosen = show_only;
- if (widget->priv->filter_model != NULL) {
- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (widget->priv->filter_model));
- }
- }
-}
+G_DEFINE_TYPE (GdmUserChooserWidget, gdm_user_chooser_widget, GDM_TYPE_CHOOSER_WIDGET)
void
gdm_user_chooser_widget_set_show_other_user (GdmUserChooserWidget *widget,
@@ -111,9 +74,6 @@ gdm_user_chooser_widget_set_show_other_user (GdmUserChooserWidget *widget,
if (widget->priv->show_other_user != show_user) {
widget->priv->show_other_user = show_user;
- if (widget->priv->filter_model != NULL) {
- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (widget->priv->filter_model));
- }
}
}
@@ -125,122 +85,15 @@ gdm_user_chooser_widget_set_show_guest_user (GdmUserChooserWidget *widget,
if (widget->priv->show_guest_user != show_user) {
widget->priv->show_guest_user = show_user;
- if (widget->priv->filter_model != NULL) {
- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (widget->priv->filter_model));
- }
}
}
char *
gdm_user_chooser_widget_get_chosen_user_name (GdmUserChooserWidget *widget)
{
- char *user_name;
-
g_return_val_if_fail (GDM_IS_USER_CHOOSER_WIDGET (widget), NULL);
- user_name = NULL;
- if (widget->priv->chosen_user != NULL) {
- user_name = g_strdup (widget->priv->chosen_user);
- }
-
- return user_name;
-}
-
-static void
-activate_name (GdmUserChooserWidget *widget,
- const char *name)
-{
- GtkTreeModel *model;
- GtkTreeIter iter;
- GtkTreePath *path;
-
- path = NULL;
-
- model = widget->priv->real_model;
-
- if (name != NULL && gtk_tree_model_get_iter_first (model, &iter)) {
-
- do {
- char *id;
- gboolean found;
-
- id = NULL;
- gtk_tree_model_get (model,
- &iter,
- CHOOSER_LIST_ID_COLUMN, &id,
- -1);
- if (id == NULL) {
- continue;
- }
-
- found = (strcmp (id, name) == 0);
-
- if (found) {
- path = gtk_tree_model_get_path (model, &iter);
- break;
- }
-
- } while (gtk_tree_model_iter_next (model, &iter));
- }
-
- if (path != NULL) {
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (widget->priv->treeview),
- path,
- NULL,
- TRUE,
- 0.5,
- 0.0);
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (widget->priv->treeview),
- path,
- NULL,
- FALSE);
-
- gtk_tree_view_row_activated (GTK_TREE_VIEW (widget->priv->treeview),
- path,
- NULL);
- gtk_tree_path_free (path);
- }
-}
-
-static void
-choose_user_id (GdmUserChooserWidget *widget,
- const char *id)
-{
-
- g_debug ("GdmUserChooserWidget: Selection changed from:'%s' to:'%s'",
- widget->priv->chosen_user ? widget->priv->chosen_user : "",
- id ? id : "");
-
- g_free (widget->priv->chosen_user);
- widget->priv->chosen_user = g_strdup (id);
-
- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (widget->priv->filter_model));
-}
-
-static void
-choose_selected_user (GdmUserChooserWidget *widget)
-{
- char *id;
- GtkTreeSelection *selection;
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- id = NULL;
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget->priv->treeview));
- if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
- gtk_tree_model_get (model, &iter, CHOOSER_LIST_ID_COLUMN, &id, -1);
- }
-
- choose_user_id (widget, id);
-}
-
-static void
-clear_selection (GdmUserChooserWidget *widget)
-{
- GtkTreeSelection *selection;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget->priv->treeview));
- gtk_tree_selection_unselect_all (selection);
+ return gdm_chooser_widget_get_active_item (GDM_CHOOSER_WIDGET (widget));
}
void
@@ -249,14 +102,18 @@ gdm_user_chooser_widget_set_chosen_user_name (GdmUserChooserWidget *widget,
{
g_return_if_fail (GDM_IS_USER_CHOOSER_WIDGET (widget));
- if (name == NULL) {
- clear_selection (widget);
- choose_user_id (widget, NULL);
- } else {
- activate_name (widget, name);
- }
+ gdm_chooser_widget_set_active_item (GDM_CHOOSER_WIDGET (widget), name);
}
+void
+gdm_user_chooser_widget_set_show_only_chosen (GdmUserChooserWidget *widget,
+ gboolean show_only) {
+ g_return_if_fail (GDM_IS_USER_CHOOSER_WIDGET (widget));
+
+ gdm_chooser_widget_set_hide_inactive_items (GDM_CHOOSER_WIDGET (widget),
+ show_only);
+
+}
static void
gdm_user_chooser_widget_set_property (GObject *object,
guint prop_id,
@@ -315,55 +172,22 @@ gdm_user_chooser_widget_dispose (GObject *object)
widget = GDM_USER_CHOOSER_WIDGET (object);
- g_free (widget->priv->chosen_user);
- widget->priv->chosen_user = NULL;
-
G_OBJECT_CLASS (gdm_user_chooser_widget_parent_class)->dispose (object);
}
static void
gdm_user_chooser_widget_class_init (GdmUserChooserWidgetClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = gdm_user_chooser_widget_get_property;
object_class->set_property = gdm_user_chooser_widget_set_property;
object_class->constructor = gdm_user_chooser_widget_constructor;
object_class->dispose = gdm_user_chooser_widget_dispose;
object_class->finalize = gdm_user_chooser_widget_finalize;
- signals [USER_CHOSEN] = g_signal_new ("user-chosen",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdmUserChooserWidgetClass, user_chosen),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
g_type_class_add_private (klass, sizeof (GdmUserChooserWidgetPrivate));
}
-static void
-on_selection_changed (GtkTreeSelection *selection,
- GdmUserChooserWidget *widget)
-{
-}
-
-static void
-on_row_activated (GtkTreeView *tree_view,
- GtkTreePath *tree_path,
- GtkTreeViewColumn *tree_column,
- GdmUserChooserWidget *widget)
-{
- choose_selected_user (widget);
-
- g_signal_emit (widget, signals[USER_CHOSEN], 0);
-
- clear_selection (widget);
-}
-
static GdkPixbuf *
get_pixbuf_for_user (GdmUserChooserWidget *widget,
const char *username)
@@ -394,107 +218,37 @@ get_logged_in_pixbuf (GdmUserChooserWidget *widget)
}
static gboolean
-populate_model (GdmUserChooserWidget *widget)
+add_special_users (GdmUserChooserWidget *widget)
{
- GtkTreeIter iter;
GdkPixbuf *pixbuf;
widget->priv->logged_in_pixbuf = get_logged_in_pixbuf (widget);
pixbuf = get_pixbuf_for_user (widget, NULL);
- /* Add some fake entries */
- gtk_list_store_append (GTK_LIST_STORE (widget->priv->real_model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (widget->priv->real_model), &iter,
- CHOOSER_LIST_PIXBUF_COLUMN, pixbuf,
- CHOOSER_LIST_NAME_COLUMN, _("Other..."),
- CHOOSER_LIST_TOOLTIP_COLUMN, _("Choose a different account"),
- CHOOSER_LIST_IS_LOGGED_IN_COLUMN, FALSE,
- CHOOSER_LIST_ID_COLUMN, GDM_USER_CHOOSER_USER_OTHER,
- -1);
-
- gtk_list_store_append (GTK_LIST_STORE (widget->priv->real_model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (widget->priv->real_model), &iter,
- CHOOSER_LIST_PIXBUF_COLUMN, pixbuf,
- CHOOSER_LIST_NAME_COLUMN, _("Guest"),
- CHOOSER_LIST_TOOLTIP_COLUMN, _("Login as a temporary guest"),
- CHOOSER_LIST_IS_LOGGED_IN_COLUMN, FALSE,
- CHOOSER_LIST_ID_COLUMN, GDM_USER_CHOOSER_USER_GUEST,
- -1);
-
+ gdm_chooser_widget_add_item (GDM_CHOOSER_WIDGET (widget),
+ GDM_USER_CHOOSER_USER_OTHER,
+ pixbuf, _("Other..."),
+ _("Choose a different account"), FALSE,
+ TRUE);
+
+ gdm_chooser_widget_add_item (GDM_CHOOSER_WIDGET (widget),
+ GDM_USER_CHOOSER_USER_GUEST,
+ pixbuf, _("Guest"),
+ _("Login as a temporary guest"), FALSE,
+ TRUE);
if (pixbuf != NULL) {
g_object_unref (pixbuf);
}
- widget->priv->populate_id = 0;
return FALSE;
}
-static int
-compare_user_names (char *name_a,
- char *name_b,
- char *id_a,
- char *id_b)
-{
-
- if (id_a == NULL) {
- return 1;
- } else if (id_b == NULL) {
- return -1;
- }
-
- if (strcmp (id_a, "__other") == 0) {
- return 1;
- } else if (strcmp (id_b, "__other") == 0) {
- return -1;
- } else if (strcmp (id_a, "__guest") == 0) {
- return 1;
- } else if (strcmp (id_b, "__guest") == 0) {
- return -1;
- }
-
- if (name_a == NULL) {
- return 1;
- } else if (name_b == NULL) {
- return -1;
- }
-
- return g_utf8_collate (name_a, name_b);
-}
-
-static int
-compare_user (GtkTreeModel *model,
- GtkTreeIter *a,
- GtkTreeIter *b,
- gpointer user_data)
-{
- char *name_a;
- char *name_b;
- char *id_a;
- char *id_b;
- int result;
-
- gtk_tree_model_get (model, a, CHOOSER_LIST_NAME_COLUMN, &name_a, -1);
- gtk_tree_model_get (model, b, CHOOSER_LIST_NAME_COLUMN, &name_b, -1);
- gtk_tree_model_get (model, a, CHOOSER_LIST_ID_COLUMN, &id_a, -1);
- gtk_tree_model_get (model, b, CHOOSER_LIST_ID_COLUMN, &id_b, -1);
-
- result = compare_user_names (name_a, name_b, id_a, id_b);
-
- g_free (name_a);
- g_free (name_b);
- g_free (id_a);
- g_free (id_b);
-
- return result;
-}
-
static void
on_user_added (GdmUserManager *manager,
GdmUser *user,
GdmUserChooserWidget *widget)
{
- GtkTreeIter iter;
GdkPixbuf *pixbuf;
char *tooltip;
@@ -502,18 +256,13 @@ on_user_added (GdmUserManager *manager,
pixbuf = gdm_user_render_icon (user, GTK_WIDGET (widget), ICON_SIZE);
- tooltip = g_strdup_printf ("%s: %s",
- _("Short Name"),
+ tooltip = g_strdup_printf (_("Log in as %s"),
gdm_user_get_user_name (user));
- gtk_list_store_append (GTK_LIST_STORE (widget->priv->real_model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (widget->priv->real_model), &iter,
- CHOOSER_LIST_PIXBUF_COLUMN, pixbuf,
- CHOOSER_LIST_NAME_COLUMN, gdm_user_get_real_name (user),
- CHOOSER_LIST_TOOLTIP_COLUMN, tooltip,
- CHOOSER_LIST_IS_LOGGED_IN_COLUMN, gdm_user_get_num_sessions (user) > 0,
- CHOOSER_LIST_ID_COLUMN, gdm_user_get_user_name (user),
- -1);
+ gdm_chooser_widget_add_item (GDM_CHOOSER_WIDGET (widget),
+ gdm_user_get_user_name (user),
+ pixbuf, gdm_user_get_real_name (user),
+ tooltip, FALSE, FALSE);
g_free (tooltip);
if (pixbuf != NULL) {
@@ -526,41 +275,14 @@ on_user_removed (GdmUserManager *manager,
GdmUser *user,
GdmUserChooserWidget *widget)
{
- GtkTreeIter iter;
- gboolean found;
const char *user_name;
g_debug ("GdmUserChooserWidget: User removed: %s", gdm_user_get_user_name (user));
- found = FALSE;
-
user_name = gdm_user_get_user_name (user);
- if (gtk_tree_model_get_iter_first (widget->priv->real_model, &iter)) {
-
- do {
- char *id;
-
- id = NULL;
- gtk_tree_model_get (widget->priv->real_model,
- &iter,
- CHOOSER_LIST_ID_COLUMN, &id,
- -1);
- if (id == NULL) {
- continue;
- }
-
- found = (strcmp (id, user_name) == 0);
-
- if (found) {
- break;
- }
-
- } while (gtk_tree_model_iter_next (widget->priv->real_model, &iter));
- }
- if (found) {
- gtk_list_store_remove (GTK_LIST_STORE (widget->priv->real_model), &iter);
- }
+ gdm_chooser_widget_remove_item (GDM_CHOOSER_WIDGET (widget),
+ user_name);
}
static void
@@ -568,162 +290,28 @@ on_user_is_logged_in_changed (GdmUserManager *manager,
GdmUser *user,
GdmUserChooserWidget *widget)
{
- GtkTreeIter iter;
- gboolean found;
const char *user_name;
gboolean is_logged_in;
g_debug ("GdmUserChooserWidget: User logged in changed: %s", gdm_user_get_user_name (user));
- found = FALSE;
-
user_name = gdm_user_get_user_name (user);
is_logged_in = gdm_user_get_num_sessions (user) > 0;
- if (gtk_tree_model_get_iter_first (widget->priv->real_model, &iter)) {
-
- do {
- char *id;
-
- id = NULL;
- gtk_tree_model_get (widget->priv->real_model,
- &iter,
- CHOOSER_LIST_ID_COLUMN, &id,
- -1);
- if (id == NULL) {
- continue;
- }
-
- found = (strcmp (id, user_name) == 0);
-
- if (found) {
- break;
- }
-
- } while (gtk_tree_model_iter_next (widget->priv->real_model, &iter));
- }
-
- if (found) {
- gtk_list_store_set (GTK_LIST_STORE (widget->priv->real_model),
- &iter,
- CHOOSER_LIST_IS_LOGGED_IN_COLUMN, is_logged_in,
- -1);
- }
-}
-
-static gboolean
-user_visible_cb (GtkTreeModel *model,
- GtkTreeIter *iter,
- GdmUserChooserWidget *widget)
-{
- char *id;
- gboolean ret;
-
- ret = FALSE;
-
- id = NULL;
- gtk_tree_model_get (model, iter, CHOOSER_LIST_ID_COLUMN, &id, -1);
- if (id == NULL) {
- goto out;
- }
-
- /* if a user is chosen */
- if (widget->priv->chosen_user != NULL
- && widget->priv->show_only_chosen) {
-
- ret = (strcmp (id, widget->priv->chosen_user) == 0);
- goto out;
- }
-
- if (! widget->priv->show_other_user
- && strcmp (id, GDM_USER_CHOOSER_USER_OTHER) == 0) {
- ret = FALSE;
- goto out;
- }
- if (! widget->priv->show_guest_user
- && strcmp (id, GDM_USER_CHOOSER_USER_GUEST) == 0) {
- ret = FALSE;
- goto out;
- }
-
- ret = TRUE;
-
- out:
- g_free (id);
-
- return ret;
-}
-
-static void
-name_cell_data_func (GtkTreeViewColumn *tree_column,
- GtkCellRenderer *cell,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- GdmUserChooserWidget *widget)
-{
- gboolean logged_in;
- char *name;
- char *markup;
-
- name = NULL;
- gtk_tree_model_get (model,
- iter,
- CHOOSER_LIST_IS_LOGGED_IN_COLUMN, &logged_in,
- CHOOSER_LIST_NAME_COLUMN, &name,
- -1);
-
- if (logged_in) {
- markup = g_strdup_printf ("<b>%s</b>\n<i><span size=\"x-small\">%s</span></i>",
- name,
- _("Currently logged in"));
- } else {
- markup = g_strdup_printf ("<b>%s</b>", name);
- }
-
- g_object_set (cell,
- "markup", markup,
- NULL);
-
- g_free (markup);
- g_free (name);
-}
-
-static void
-check_cell_data_func (GtkTreeViewColumn *tree_column,
- GtkCellRenderer *cell,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- GdmUserChooserWidget *widget)
-{
- gboolean logged_in;
- GdkPixbuf *pixbuf;
-
- gtk_tree_model_get (model,
- iter,
- CHOOSER_LIST_IS_LOGGED_IN_COLUMN, &logged_in,
- -1);
-
- if (logged_in) {
- pixbuf = widget->priv->logged_in_pixbuf;
- } else {
- pixbuf = NULL;
- }
-
- g_object_set (cell,
- "pixbuf", pixbuf,
- NULL);
+ gdm_chooser_widget_set_item_in_use (GDM_CHOOSER_WIDGET (widget),
+ user_name, is_logged_in);
}
static void
gdm_user_chooser_widget_init (GdmUserChooserWidget *widget)
{
- GtkWidget *scrolled;
- GtkTreeViewColumn *column;
- GtkTreeSelection *selection;
- GtkCellRenderer *renderer;
-
widget->priv = GDM_USER_CHOOSER_WIDGET_GET_PRIVATE (widget);
+ gdm_chooser_widget_set_separator_position (GDM_CHOOSER_WIDGET (widget),
+ GDM_CHOOSER_WIDGET_POSITION_BOTTOM);
+ gdm_chooser_widget_set_in_use_message (GDM_CHOOSER_WIDGET (widget),
+ _("Currently logged in"));
+
widget->priv->manager = gdm_user_manager_ref_default ();
g_signal_connect (widget->priv->manager,
"user-added",
@@ -738,103 +326,7 @@ gdm_user_chooser_widget_init (GdmUserChooserWidget *widget)
G_CALLBACK (on_user_is_logged_in_changed),
widget);
- scrolled = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
- GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
- GTK_POLICY_NEVER,
- GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (widget), scrolled, TRUE, TRUE, 0);
-
- widget->priv->treeview = gtk_tree_view_new ();
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (widget->priv->treeview), FALSE);
-
- g_signal_connect (widget->priv->treeview,
- "row-activated",
- G_CALLBACK (on_row_activated),
- widget);
- gtk_container_add (GTK_CONTAINER (scrolled), widget->priv->treeview);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget->priv->treeview));
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
- g_signal_connect (selection, "changed",
- G_CALLBACK (on_selection_changed),
- widget);
-
- widget->priv->real_model = (GtkTreeModel *)gtk_list_store_new (5,
- GDK_TYPE_PIXBUF,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_BOOLEAN,
- G_TYPE_STRING);
-
- widget->priv->filter_model = gtk_tree_model_filter_new (widget->priv->real_model, NULL);
-
- gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (widget->priv->filter_model),
- (GtkTreeModelFilterVisibleFunc) user_visible_cb,
- widget,
- NULL);
-
- widget->priv->sort_model = gtk_tree_model_sort_new_with_model (widget->priv->filter_model);
-
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (widget->priv->sort_model),
- CHOOSER_LIST_NAME_COLUMN,
- compare_user,
- NULL, NULL);
-
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (widget->priv->sort_model),
- CHOOSER_LIST_NAME_COLUMN,
- GTK_SORT_ASCENDING);
-
- gtk_tree_view_set_model (GTK_TREE_VIEW (widget->priv->treeview), widget->priv->sort_model);
-
- /* CHECK COLUMN */
- renderer = gtk_cell_renderer_pixbuf_new ();
- column = gtk_tree_view_column_new ();
- gtk_tree_view_column_pack_start (column, renderer, FALSE);
- gtk_tree_view_append_column (GTK_TREE_VIEW (widget->priv->treeview), column);
- gtk_tree_view_column_set_cell_data_func (column,
- renderer,
- (GtkTreeCellDataFunc) check_cell_data_func,
- widget,
- NULL);
- g_object_set (renderer,
- "width", 96,
- "yalign", 0.5,
- "xalign", 0.5,
- NULL);
-
- /* FACE COLUMN */
- renderer = gtk_cell_renderer_pixbuf_new ();
- column = gtk_tree_view_column_new ();
- gtk_tree_view_column_pack_start (column, renderer, FALSE);
- gtk_tree_view_append_column (GTK_TREE_VIEW (widget->priv->treeview), column);
-
- gtk_tree_view_column_set_attributes (column,
- renderer,
- "pixbuf", CHOOSER_LIST_PIXBUF_COLUMN,
- NULL);
-
- g_object_set (renderer,
- "width", 64,
- "yalign", 0.5,
- "xalign", 1.0,
- NULL);
-
- /* NAME COLUMN */
- renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new ();
- gtk_tree_view_column_pack_start (column, renderer, FALSE);
- gtk_tree_view_append_column (GTK_TREE_VIEW (widget->priv->treeview), column);
- gtk_tree_view_column_set_cell_data_func (column,
- renderer,
- (GtkTreeCellDataFunc) name_cell_data_func,
- widget,
- NULL);
-
- gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (widget->priv->treeview), CHOOSER_LIST_TOOLTIP_COLUMN);
-
- widget->priv->populate_id = g_idle_add ((GSourceFunc)populate_model, widget);
+ add_special_users (widget);
}
static void
@@ -849,10 +341,6 @@ gdm_user_chooser_widget_finalize (GObject *object)
g_return_if_fail (widget->priv != NULL);
- if (widget->priv->populate_id > 0) {
- g_source_remove (widget->priv->populate_id);
- }
-
G_OBJECT_CLASS (gdm_user_chooser_widget_parent_class)->finalize (object);
}
@@ -862,6 +350,8 @@ gdm_user_chooser_widget_new (void)
GObject *object;
object = g_object_new (GDM_TYPE_USER_CHOOSER_WIDGET,
+ "inactive-text", _("_Users:"),
+ "active-text", _("_User:"),
NULL);
return GTK_WIDGET (object);
diff --git a/gui/simple-greeter/gdm-user-chooser-widget.h b/gui/simple-greeter/gdm-user-chooser-widget.h
index 9c1ef6f..a117fb3 100644
--- a/gui/simple-greeter/gdm-user-chooser-widget.h
+++ b/gui/simple-greeter/gdm-user-chooser-widget.h
@@ -22,7 +22,8 @@
#define __GDM_USER_CHOOSER_WIDGET_H
#include <glib-object.h>
-#include <gtk/gtkvbox.h>
+
+#include "gdm-chooser-widget.h"
G_BEGIN_DECLS
@@ -37,16 +38,13 @@ typedef struct GdmUserChooserWidgetPrivate GdmUserChooserWidgetPrivate;
typedef struct
{
- GtkVBox parent;
+ GdmChooserWidget parent;
GdmUserChooserWidgetPrivate *priv;
} GdmUserChooserWidget;
typedef struct
{
- GtkVBoxClass parent_class;
-
- /* signals */
- void (* user_chosen) (GdmUserChooserWidget *widget);
+ GdmChooserWidgetClass parent_class;
} GdmUserChooserWidgetClass;
#define GDM_USER_CHOOSER_USER_OTHER "__other"
@@ -64,7 +62,6 @@ void gdm_user_chooser_widget_set_show_other_user (GdmUs
gboolean show_other);
void gdm_user_chooser_widget_set_show_guest_user (GdmUserChooserWidget *widget,
gboolean show_other);
-
G_END_DECLS
#endif /* __GDM_USER_CHOOSER_WIDGET_H */
--
1.5.3.6

View File

@ -1,522 +0,0 @@
From 62276dc527e60a27f951cf73ad8de3fb1c8ced8a Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 13 Dec 2007 10:14:33 -0500
Subject: [PATCH] Change session-chooser-widget over to use new chooser widget
---
gui/simple-greeter/gdm-session-chooser-widget.c | 352 +++--------------------
gui/simple-greeter/gdm-session-chooser-widget.h | 15 +-
2 files changed, 50 insertions(+), 317 deletions(-)
diff --git a/gui/simple-greeter/gdm-session-chooser-widget.c b/gui/simple-greeter/gdm-session-chooser-widget.c
index 7763da7..849be94 100644
--- a/gui/simple-greeter/gdm-session-chooser-widget.c
+++ b/gui/simple-greeter/gdm-session-chooser-widget.c
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ * Copyright (C) 2007 Ray Strode <rstrode@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,6 +35,7 @@
#include <gtk/gtk.h>
#include "gdm-session-chooser-widget.h"
+#include "gdm-chooser-widget.h"
enum {
DESKTOP_ENTRY_NO_DISPLAY = 1 << 0,
@@ -54,34 +56,18 @@ typedef struct _GdmChooserSession {
struct GdmSessionChooserWidgetPrivate
{
- GtkWidget *treeview;
-
GHashTable *available_sessions;
- char *current_session;
};
enum {
PROP_0,
};
-enum {
- SESSION_ACTIVATED,
- LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = { 0, };
-
static void gdm_session_chooser_widget_class_init (GdmSessionChooserWidgetClass *klass);
static void gdm_session_chooser_widget_init (GdmSessionChooserWidget *session_chooser_widget);
static void gdm_session_chooser_widget_finalize (GObject *object);
-G_DEFINE_TYPE (GdmSessionChooserWidget, gdm_session_chooser_widget, GTK_TYPE_VBOX)
-
-enum {
- CHOOSER_LIST_NAME_COLUMN = 0,
- CHOOSER_LIST_COMMENT_COLUMN,
- CHOOSER_LIST_ID_COLUMN
-};
+G_DEFINE_TYPE (GdmSessionChooserWidget, gdm_session_chooser_widget, GDM_TYPE_CHOOSER_WIDGET)
static void
chooser_session_free (GdmChooserSession *session)
@@ -101,89 +87,28 @@ chooser_session_free (GdmChooserSession *session)
char *
gdm_session_chooser_widget_get_current_session_name (GdmSessionChooserWidget *widget)
{
- char *session_name;
-
g_return_val_if_fail (GDM_IS_SESSION_CHOOSER_WIDGET (widget), NULL);
-
- session_name = NULL;
- if (widget->priv->current_session != NULL) {
- session_name = g_strdup (widget->priv->current_session);
- }
-
- return session_name;
+ return gdm_chooser_widget_get_active_item (GDM_CHOOSER_WIDGET (widget));
}
-static void
-select_name (GdmSessionChooserWidget *widget,
- const char *name)
+void
+gdm_session_chooser_widget_set_current_session_name (GdmSessionChooserWidget *widget,
+ const char *name)
{
- GtkTreeModel *model;
- GtkTreeIter iter;
- GtkTreePath *path;
-
- path = NULL;
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget->priv->treeview));
-
- if (name != NULL && gtk_tree_model_get_iter_first (model, &iter)) {
-
- do {
- GdmChooserSession *session;
- char *id;
- gboolean found;
-
- session = NULL;
- id = NULL;
- gtk_tree_model_get (model,
- &iter,
- CHOOSER_LIST_ID_COLUMN, &id,
- -1);
- if (id != NULL) {
- session = g_hash_table_lookup (widget->priv->available_sessions, id);
- g_free (id);
- }
-
- found = (session != NULL
- && session->filename != NULL
- && strcmp (session->filename, name) == 0);
-
- if (found) {
- path = gtk_tree_model_get_path (model, &iter);
- break;
- }
-
- } while (gtk_tree_model_iter_next (model, &iter));
- }
+ g_return_if_fail (GDM_IS_SESSION_CHOOSER_WIDGET (widget));
- if (path != NULL) {
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (widget->priv->treeview),
- path,
- gtk_tree_view_get_column (GTK_TREE_VIEW (widget->priv->treeview), 0),
- TRUE, 0.5, 0.0);
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (widget->priv->treeview),
- path,
- NULL,
- FALSE);
-
- gtk_tree_path_free (path);
- }
+ gdm_chooser_widget_set_active_item (GDM_CHOOSER_WIDGET (widget),
+ name);
}
void
-gdm_session_chooser_widget_set_current_session_name (GdmSessionChooserWidget *widget,
- const char *name)
+gdm_session_chooser_widget_set_show_only_chosen (GdmSessionChooserWidget *widget,
+ gboolean show_only)
{
- GtkTreeSelection *selection;
-
g_return_if_fail (GDM_IS_SESSION_CHOOSER_WIDGET (widget));
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget->priv->treeview));
-
- if (name == NULL) {
- gtk_tree_selection_unselect_all (selection);
- } else {
- select_name (widget, name);
- }
+ gdm_chooser_widget_set_hide_inactive_items (GDM_CHOOSER_WIDGET (widget),
+ show_only);
}
static void
@@ -249,9 +174,6 @@ gdm_session_chooser_widget_dispose (GObject *object)
widget->priv->available_sessions = NULL;
}
- g_free (widget->priv->current_session);
- widget->priv->current_session = NULL;
-
G_OBJECT_CLASS (gdm_session_chooser_widget_parent_class)->dispose (object);
}
@@ -266,39 +188,9 @@ gdm_session_chooser_widget_class_init (GdmSessionChooserWidgetClass *klass)
object_class->dispose = gdm_session_chooser_widget_dispose;
object_class->finalize = gdm_session_chooser_widget_finalize;
- signals [SESSION_ACTIVATED] = g_signal_new ("session-activated",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdmSessionChooserWidgetClass, session_activated),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
g_type_class_add_private (klass, sizeof (GdmSessionChooserWidgetPrivate));
}
-static void
-on_session_selected (GtkTreeSelection *selection,
- GdmSessionChooserWidget *widget)
-{
- GtkTreeModel *model = NULL;
- GtkTreeIter iter = {0};
- char *id;
-
- id = NULL;
-
- if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
- gtk_tree_model_get (model, &iter, CHOOSER_LIST_ID_COLUMN, &id, -1);
- }
-
- g_free (widget->priv->current_session);
- widget->priv->current_session = g_strdup (id);
-
- g_free (id);
-}
-
/* adapted from gnome-menus desktop-entries.c */
static guint
get_flags_from_key_file (GKeyFile *key_file,
@@ -460,21 +352,13 @@ collect_sessions (GdmSessionChooserWidget *widget)
}
static void
-on_row_activated (GtkTreeView *tree_view,
- GtkTreePath *tree_path,
- GtkTreeViewColumn *tree_column,
- GdmSessionChooserWidget *widget)
-{
- g_signal_emit (widget, signals[SESSION_ACTIVATED], 0);
-}
-
-static void
-add_session_to_model (const char *name,
- GdmChooserSession *session,
- GdmSessionChooserWidget *widget)
+add_session (const char *name,
+ GdmChooserSession *session,
+ GdmSessionChooserWidget *widget)
{
- GtkTreeModel *model;
- GtkTreeIter iter;
+ g_assert (name != NULL);
+ g_assert (session != NULL);
+ g_assert (GDM_IS_SESSION_CHOOSER_WIDGET (widget));
if (session->flags & DESKTOP_ENTRY_NO_DISPLAY
|| session->flags & DESKTOP_ENTRY_HIDDEN
@@ -483,197 +367,43 @@ add_session_to_model (const char *name,
g_debug ("Not adding session to list: %s", session->filename);
}
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget->priv->treeview));
-
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (model),
- &iter,
- CHOOSER_LIST_NAME_COLUMN, session->translated_name,
- CHOOSER_LIST_COMMENT_COLUMN, session->translated_comment,
- CHOOSER_LIST_ID_COLUMN, name,
- -1);
+ gdm_chooser_widget_add_item (GDM_CHOOSER_WIDGET (widget), name,
+ NULL, session->translated_name,
+ session->translated_comment, FALSE, FALSE);
}
static void
-populate_model (GdmSessionChooserWidget *widget,
- GtkTreeModel *model)
+add_available_sessions (GdmSessionChooserWidget *widget)
{
- GtkTreeIter iter;
-
- /* Add some fake entries */
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- CHOOSER_LIST_NAME_COLUMN, _("Previous Session"),
- CHOOSER_LIST_ID_COLUMN, "__previous-session",
- -1);
-
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- CHOOSER_LIST_NAME_COLUMN, _("System Default"),
- CHOOSER_LIST_ID_COLUMN, "__default-session",
- -1);
-
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- CHOOSER_LIST_NAME_COLUMN, NULL,
- CHOOSER_LIST_ID_COLUMN, "__separator",
- -1);
+ gdm_chooser_widget_add_item (GDM_CHOOSER_WIDGET (widget),
+ GDM_SESSION_CHOOSER_SESSION_PREVIOUS,
+ NULL, _("Default"),
+ _("Login with the same session as "
+ "last time."),
+ FALSE, TRUE);
+ gdm_chooser_widget_add_item (GDM_CHOOSER_WIDGET (widget),
+ GDM_SESSION_CHOOSER_SESSION_DEFAULT,
+ NULL, _("Legacy"),
+ _("Login based on preset legacy configuration"),
+ FALSE, TRUE);
g_hash_table_foreach (widget->priv->available_sessions,
- (GHFunc)add_session_to_model,
+ (GHFunc) add_session,
widget);
}
-static gboolean
-separator_func (GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer data)
-{
- int column = GPOINTER_TO_INT (data);
- char *text;
-
- gtk_tree_model_get (model, iter, column, &text, -1);
-
- if (text != NULL && strcmp (text, "__separator") == 0) {
- return TRUE;
- }
-
- g_free (text);
-
- return FALSE;
-}
-
-static int
-compare_session_names (char *name_a,
- char *name_b,
- char *id_a,
- char *id_b)
-{
-
- if (id_a == NULL) {
- return 1;
- } else if (id_b == NULL) {
- return -1;
- }
-
- if (strcmp (id_a, "__previous-session") == 0) {
- return -1;
- } else if (strcmp (id_b, "__previous-session") == 0) {
- return 1;
- } else if (strcmp (id_a, "__default-session") == 0) {
- return -1;
- } else if (strcmp (id_b, "__default-session") == 0) {
- return 1;
- } else if (strcmp (id_a, "__separator") == 0) {
- return -1;
- } else if (strcmp (id_b, "__separator") == 0) {
- return 1;
- }
-
- if (name_a == NULL) {
- return 1;
- } else if (name_b == NULL) {
- return -1;
- }
-
- return g_utf8_collate (name_a, name_b);
-}
-
-static int
-compare_session (GtkTreeModel *model,
- GtkTreeIter *a,
- GtkTreeIter *b,
- gpointer user_data)
-{
- char *name_a;
- char *name_b;
- char *id_a;
- char *id_b;
- int result;
-
- gtk_tree_model_get (model, a, CHOOSER_LIST_NAME_COLUMN, &name_a, -1);
- gtk_tree_model_get (model, b, CHOOSER_LIST_NAME_COLUMN, &name_b, -1);
- gtk_tree_model_get (model, a, CHOOSER_LIST_ID_COLUMN, &id_a, -1);
- gtk_tree_model_get (model, b, CHOOSER_LIST_ID_COLUMN, &id_b, -1);
-
- result = compare_session_names (name_a, name_b, id_a, id_b);
-
- g_free (name_a);
- g_free (name_b);
- g_free (id_a);
- g_free (id_b);
-
- return result;
-}
-
static void
gdm_session_chooser_widget_init (GdmSessionChooserWidget *widget)
{
- GtkWidget *scrolled;
- GtkTreeSelection *selection;
- GtkTreeViewColumn *column;
- GtkTreeModel *model;
-
widget->priv = GDM_SESSION_CHOOSER_WIDGET_GET_PRIVATE (widget);
+ gdm_chooser_widget_set_separator_position (GDM_CHOOSER_WIDGET (widget),
+ GDM_CHOOSER_WIDGET_POSITION_TOP);
widget->priv->available_sessions = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)chooser_session_free);
- scrolled = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
- GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
- GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (widget), scrolled, TRUE, TRUE, 0);
-
- widget->priv->treeview = gtk_tree_view_new ();
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (widget->priv->treeview), FALSE);
- g_signal_connect (widget->priv->treeview,
- "row-activated",
- G_CALLBACK (on_row_activated),
- widget);
- gtk_container_add (GTK_CONTAINER (scrolled), widget->priv->treeview);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget->priv->treeview));
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
- g_signal_connect (selection, "changed",
- G_CALLBACK (on_session_selected),
- widget);
-
- model = (GtkTreeModel *)gtk_list_store_new (3,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_STRING);
- gtk_tree_view_set_model (GTK_TREE_VIEW (widget->priv->treeview), model);
-
- column = gtk_tree_view_column_new_with_attributes ("Session",
- gtk_cell_renderer_text_new (),
- "text", CHOOSER_LIST_NAME_COLUMN,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (widget->priv->treeview), column);
-
- column = gtk_tree_view_column_new_with_attributes ("Comment",
- gtk_cell_renderer_text_new (),
- "text", CHOOSER_LIST_COMMENT_COLUMN,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (widget->priv->treeview), column);
-
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (model),
- CHOOSER_LIST_NAME_COLUMN,
- compare_session,
- NULL, NULL);
-
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model),
- CHOOSER_LIST_NAME_COLUMN,
- GTK_SORT_ASCENDING);
-
- gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (widget->priv->treeview),
- separator_func,
- GINT_TO_POINTER (CHOOSER_LIST_ID_COLUMN),
- NULL);
-
collect_sessions (widget);
- populate_model (widget, model);
+ add_available_sessions (widget);
}
static void
@@ -696,7 +426,9 @@ gdm_session_chooser_widget_new (void)
{
GObject *object;
- object = g_object_new (GDM_TYPE_SESSION_CHOOSER_WIDGET,
+ object = g_object_new (GDM_TYPE_SESSION_CHOOSER_WIDGET,
+ "inactive-text", _("_Sessions:"),
+ "active-text", _("_Session:"),
NULL);
return GTK_WIDGET (object);
diff --git a/gui/simple-greeter/gdm-session-chooser-widget.h b/gui/simple-greeter/gdm-session-chooser-widget.h
index ec32b23..63ea466 100644
--- a/gui/simple-greeter/gdm-session-chooser-widget.h
+++ b/gui/simple-greeter/gdm-session-chooser-widget.h
@@ -22,7 +22,7 @@
#define __GDM_SESSION_CHOOSER_WIDGET_H
#include <glib-object.h>
-#include <gtk/gtkvbox.h>
+#include "gdm-chooser-widget.h"
G_BEGIN_DECLS
@@ -37,25 +37,26 @@ typedef struct GdmSessionChooserWidgetPrivate GdmSessionChooserWidgetPrivate;
typedef struct
{
- GtkVBox parent;
+ GdmChooserWidget parent;
GdmSessionChooserWidgetPrivate *priv;
} GdmSessionChooserWidget;
typedef struct
{
- GtkVBoxClass parent_class;
-
- /* signals */
- void (* session_activated) (GdmSessionChooserWidget *widget);
+ GdmChooserWidgetClass parent_class;
} GdmSessionChooserWidgetClass;
+#define GDM_SESSION_CHOOSER_SESSION_PREVIOUS "__previous-session"
+#define GDM_SESSION_CHOOSER_SESSION_DEFAULT "__default-session"
+
GType gdm_session_chooser_widget_get_type (void);
GtkWidget * gdm_session_chooser_widget_new (void);
char * gdm_session_chooser_widget_get_current_session_name (GdmSessionChooserWidget *widget);
void gdm_session_chooser_widget_set_current_session_name (GdmSessionChooserWidget *widget,
const char *session_name);
-
+void gdm_session_chooser_widget_set_show_only_chosen (GdmSessionChooserWidget *widget,
+ gboolean show_only);
G_END_DECLS
#endif /* __GDM_SESSION_CHOOSER_WIDGET_H */
--
1.5.3.6

View File

@ -1,24 +0,0 @@
From ed5e63fbb8cf281f8e7bfd8062b3f453fcb3d279 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 13 Dec 2007 10:16:37 -0500
Subject: [PATCH] Don't shrink to chosen item by by default for dialog
---
gui/simple-greeter/gdm-user-chooser-dialog.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/gui/simple-greeter/gdm-user-chooser-dialog.c b/gui/simple-greeter/gdm-user-chooser-dialog.c
index f3e83a2..4848177 100644
--- a/gui/simple-greeter/gdm-user-chooser-dialog.c
+++ b/gui/simple-greeter/gdm-user-chooser-dialog.c
@@ -154,7 +154,6 @@ gdm_user_chooser_dialog_init (GdmUserChooserDialog *dialog)
dialog->priv = GDM_USER_CHOOSER_DIALOG_GET_PRIVATE (dialog);
dialog->priv->chooser_widget = gdm_user_chooser_widget_new ();
- gdm_user_chooser_widget_set_show_only_chosen (GDM_USER_CHOOSER_WIDGET (dialog->priv->chooser_widget), TRUE);
gdm_user_chooser_widget_set_show_other_user (GDM_USER_CHOOSER_WIDGET (dialog->priv->chooser_widget), TRUE);
gdm_user_chooser_widget_set_show_guest_user (GDM_USER_CHOOSER_WIDGET (dialog->priv->chooser_widget), TRUE);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog->priv->chooser_widget);
--
1.5.3.6

File diff suppressed because it is too large Load Diff

View File

@ -1,138 +0,0 @@
From 33c2ba849b1f752deb38cf8715571eadbc4b323b Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 13 Dec 2007 14:38:16 -0500
Subject: [PATCH] add lame animation to greeter login window
---
gui/simple-greeter/gdm-greeter-login-window.c | 90 +++++++++++++++++++++++-
1 files changed, 86 insertions(+), 4 deletions(-)
diff --git a/gui/simple-greeter/gdm-greeter-login-window.c b/gui/simple-greeter/gdm-greeter-login-window.c
index ca14b38..ceb9e88 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.c
+++ b/gui/simple-greeter/gdm-greeter-login-window.c
@@ -72,6 +72,8 @@ struct GdmGreeterLoginWindowPrivate
char *timeformat;
guint update_clock_id;
gboolean clock_show_seconds;
+
+ guint animation_timeout_id;
};
enum {
@@ -860,12 +862,60 @@ load_theme (GdmGreeterLoginWindow *login_window)
switch_mode (login_window, MODE_SELECTION);
}
+static gboolean
+fit_window_to_children (GdmGreeterLoginWindow *window)
+{
+ int x;
+ int y;
+ int width;
+ int height;
+ int height_step;
+ int width_step;
+
+ /* FIXME: this animation logic is really dumb
+ */
+
+ if (!GTK_WIDGET_REALIZED (GTK_WIDGET (window))) {
+ return FALSE;
+ }
+
+ gdk_window_get_geometry (GTK_WIDGET (window)->window,
+ &x, &y, &width, &height, NULL);
+
+ if (height == GTK_WIDGET (window)->requisition.height) {
+ return FALSE;
+ }
+
+ if (width < GTK_WIDGET (window)->requisition.width) {
+ width_step = MIN (1, GTK_WIDGET (window)->requisition.width - width);
+ } else if (width > GTK_WIDGET (window)->requisition.width) {
+ width_step = -1 * MIN (1, width - GTK_WIDGET (window)->requisition.width);
+ } else {
+ width_step = 0;
+ }
+
+ if (height < GTK_WIDGET (window)->requisition.height) {
+ height_step = MIN ((int) 25, GTK_WIDGET (window)->requisition.height - height);
+ } else if (height > GTK_WIDGET (window)->requisition.height) {
+ height_step = -1 * MIN ((int) 25, height - GTK_WIDGET (window)->requisition.height);
+ } else {
+ height_step = 0;
+ }
+
+ gdk_window_resize (GTK_WIDGET (window)->window,
+ width + width_step,
+ height + height_step);
+
+ return TRUE;
+}
+
static void
gdm_greeter_login_window_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
- int screen_w;
- int screen_h;
+ int screen_w;
+ int screen_h;
+ GtkRequisition child_requisition;
if (GTK_WIDGET_CLASS (gdm_greeter_login_window_parent_class)->size_request) {
GTK_WIDGET_CLASS (gdm_greeter_login_window_parent_class)->size_request (widget, requisition);
@@ -874,8 +924,39 @@ gdm_greeter_login_window_size_request (GtkWidget *widget,
screen_w = gdk_screen_get_width (gtk_widget_get_screen (widget));
screen_h = gdk_screen_get_height (gtk_widget_get_screen (widget));
- requisition->height = screen_h * 0.5;
- requisition->width = screen_w * 0.3;
+ gtk_widget_size_request (GTK_BIN (widget)->child, &child_requisition);
+ *requisition = child_requisition;
+
+ requisition->width += 2 * GTK_CONTAINER (widget)->border_width;
+ requisition->height += 2 * GTK_CONTAINER (widget)->border_width;
+
+ requisition->width = MIN (requisition->width, .50 * screen_w);
+ requisition->height = MIN (requisition->height, .80 * screen_h);
+}
+
+static void
+clear_animation_timeout_id (GdmGreeterLoginWindow *window)
+{
+ window->priv->animation_timeout_id = 0;
+}
+
+static void
+gdm_greeter_login_window_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ GdmGreeterLoginWindow *window;
+
+ window = GDM_GREETER_LOGIN_WINDOW (widget);
+
+ if (window->priv->animation_timeout_id == 0) {
+ window->priv->animation_timeout_id =
+ g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, 20,
+ (GSourceFunc) fit_window_to_children,
+ widget,
+ (GDestroyNotify) clear_animation_timeout_id);
+ }
+
+ GTK_WIDGET_CLASS (gdm_greeter_login_window_parent_class)->size_allocate (widget, allocation);
}
static GObject *
@@ -910,6 +991,7 @@ gdm_greeter_login_window_class_init (GdmGreeterLoginWindowClass *klass)
object_class->finalize = gdm_greeter_login_window_finalize;
widget_class->size_request = gdm_greeter_login_window_size_request;
+ widget_class->size_allocate = gdm_greeter_login_window_size_allocate;
signals [BEGIN_VERIFICATION] =
g_signal_new ("begin-verification",
--
1.5.3.6

View File

@ -1,210 +0,0 @@
--- gdm/gui/simple-greeter/gdm-greeter-login-window.c (revision 5571)
+++ gdm/gui/simple-greeter/gdm-greeter-login-window.c (revision 5573)
@@ -780,10 +780,6 @@ custom_widget_constructor (GladeXML
widget = gdm_session_chooser_widget_new ();
}
- if (widget != NULL) {
- gtk_widget_show (widget);
- }
-
return widget;
}
@@ -827,6 +823,8 @@ load_theme (GdmGreeterLoginWindow *login
G_CALLBACK (on_user_unchosen),
login_window);
+ gtk_widget_show (login_window->priv->user_chooser);
+
login_window->priv->session_chooser =
glade_xml_get_widget (login_window->priv->xml, "session-chooser");
--- gdm/gui/simple-greeter/gdm-chooser-widget.c (revision 5571)
+++ gdm/gui/simple-greeter/gdm-chooser-widget.c (revision 5573)
@@ -84,6 +84,7 @@ struct GdmChooserWidgetPrivate
guint animation_timeout_id;
guint32 should_hide_inactive_items : 1;
+ guint32 emit_activated_after_animation : 1;
GdmChooserWidgetPosition separator_position;
GdmChooserWidgetState state;
@@ -335,10 +336,16 @@ shrink_edge_toward_active_row (GdmChoose
}
static gboolean
-iterate_animation (GdmChooserWidget *widget)
+run_animation (GdmChooserWidget *widget,
+ int number_of_iterations)
{
gboolean is_done;
+ /* FIXME: this function could be done a lot more efficiently
+ * If we know we need to iterate more than once before the next redraw
+ * we should be able to avoid a lot of intermediate work
+ */
+
is_done = FALSE;
if (widget->priv->state == GDM_CHOOSER_WIDGET_STATE_SHRINKING) {
@@ -357,6 +364,8 @@ iterate_animation (GdmChooserWidget *wid
GtkTreeIter iter;
gboolean is_visible;
+ g_assert (widget->priv->state == GDM_CHOOSER_WIDGET_STATE_GROWING);
+
path = gtk_tree_path_new_first ();
do {
@@ -382,24 +391,70 @@ iterate_animation (GdmChooserWidget *wid
gtk_tree_path_free (path);
}
- return is_done != TRUE;
+ number_of_iterations--;
+
+ if (number_of_iterations == 0) {
+ return is_done;
+ }
+
+ return run_animation (widget, number_of_iterations);
+}
+
+static gboolean
+on_animation_timeout (GdmChooserWidget *widget)
+{
+ return run_animation (widget, 1) != TRUE;
}
static void
-stop_animation (GdmChooserWidget *widget)
+on_animation_done (GdmChooserWidget *widget)
{
if (widget->priv->animation_timeout_id == 0) {
return;
}
- gtk_tree_row_reference_free (widget->priv->top_edge_row);
- widget->priv->top_edge_row = NULL;
+ if (widget->priv->top_edge_row != NULL) {
+ gtk_tree_row_reference_free (widget->priv->top_edge_row);
+ widget->priv->top_edge_row = NULL;
+ }
- gtk_tree_row_reference_free (widget->priv->bottom_edge_row);
- widget->priv->bottom_edge_row = NULL;
+ if (widget->priv->bottom_edge_row != NULL) {
+ gtk_tree_row_reference_free (widget->priv->bottom_edge_row);
+ widget->priv->bottom_edge_row = NULL;
+ }
widget->priv->animation_timeout_id = 0;
gtk_widget_set_sensitive (GTK_WIDGET (widget), TRUE);
+
+ if (widget->priv->emit_activated_after_animation) {
+ g_signal_emit (widget, signals[ACTIVATED], 0);
+ widget->priv->emit_activated_after_animation = FALSE;
+ }
+}
+
+static int
+get_number_of_on_screen_rows (GdmChooserWidget *widget)
+{
+ GtkTreePath *start_path;
+ GtkTreePath *end_path;
+ int *start_index;
+ int *end_index;
+ int number_of_rows;
+
+ if (!gtk_tree_view_get_visible_range (GTK_TREE_VIEW (widget->priv->items_view),
+ &start_path, &end_path)) {
+ return 0;
+ }
+
+ start_index = gtk_tree_path_get_indices (start_path);
+ end_index = gtk_tree_path_get_indices (end_path);
+
+ number_of_rows = *end_index - *start_index;
+
+ gtk_tree_path_free (start_path);
+ gtk_tree_path_free (end_path);
+
+ return number_of_rows;
}
static void
@@ -417,8 +472,12 @@ start_animation (GdmChooserWidget *widge
number_of_rows = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (widget->priv->list_store), NULL);
if (widget->priv->state == GDM_CHOOSER_WIDGET_STATE_SHRINKING) {
+ int number_of_on_screen_rows;
+ int number_of_iterations;
+
if (number_of_visible_rows <= 1) {
widget->priv->state = GDM_CHOOSER_WIDGET_STATE_SHRUNK;
+ on_animation_done (widget);
return;
}
@@ -434,11 +493,18 @@ start_animation (GdmChooserWidget *widge
gtk_tree_path_free (edge_path);
g_assert (widget->priv->top_edge_row != NULL && widget->priv->bottom_edge_row != NULL);
+
+ number_of_on_screen_rows = get_number_of_on_screen_rows (widget);
+ number_of_iterations = number_of_visible_rows - number_of_on_screen_rows;
+ number_of_iterations = MAX (0, number_of_iterations);
+
+ run_animation (widget, number_of_iterations);
}
if (widget->priv->state == GDM_CHOOSER_WIDGET_STATE_GROWING) {
if (number_of_visible_rows >= number_of_rows) {
widget->priv->state = GDM_CHOOSER_WIDGET_STATE_GROWN;
+ on_animation_done (widget);
return;
}
}
@@ -451,8 +517,8 @@ start_animation (GdmChooserWidget *widge
widget->priv->animation_timeout_id =
g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,
1000 / (4 * number_of_rows),
- (GSourceFunc) iterate_animation,
- widget, (GDestroyNotify) stop_animation);
+ (GSourceFunc) on_animation_timeout,
+ widget, (GDestroyNotify) on_animation_done);
}
static void
@@ -534,11 +600,14 @@ activate_from_row (GdmChooserWidget *
}
widget->priv->active_row = gtk_tree_row_reference_copy (row);
- g_signal_emit (widget, signals[ACTIVATED], 0);
if (widget->priv->should_hide_inactive_items) {
+ widget->priv->emit_activated_after_animation = TRUE;
gdm_chooser_widget_shrink (widget);
+ } else {
+ g_signal_emit (widget, signals[ACTIVATED], 0);
}
+
}
static void
@@ -551,11 +620,11 @@ deactivate (GdmChooserWidget *widget)
gtk_tree_row_reference_free (widget->priv->active_row);
widget->priv->active_row = NULL;
- g_signal_emit (widget, signals[DEACTIVATED], 0, NULL, NULL);
-
if (widget->priv->state != GDM_CHOOSER_WIDGET_STATE_GROWN) {
gdm_chooser_widget_grow (widget);
}
+
+ g_signal_emit (widget, signals[DEACTIVATED], 0);
}
static void

View File

@ -1,16 +0,0 @@
diff -up gdm-2.21.2/data/session-setup.entries.fix-background gdm-2.21.2/data/session-setup.entries
--- gdm-2.21.2/data/session-setup.entries.fix-background 2007-11-19 15:42:00.000000000 -0500
+++ gdm-2.21.2/data/session-setup.entries 2007-11-19 16:05:43.000000000 -0500
@@ -103,6 +104,12 @@
</value>
</entry>
<entry>
+ <key>/desktop/gnome/background/picture_filename</key>
+ <value>
+ <string>/usr/share/backgrounds/images/default.png</string>
+ </value>
+ </entry>
+ <entry>
<key>/desktop/gnome/url-handlers/http/command</key>
<value>
<string>/bin/true</string>

View File

@ -1,12 +0,0 @@
diff -up gdm-2.21.2/gui/simple-greeter/gdm-greeter-login-window.c.hide-guest gdm-2.21.2/gui/simple-greeter/gdm-greeter-login-window.c
--- gdm-2.21.2/gui/simple-greeter/gdm-greeter-login-window.c.hide-guest 2008-01-07 14:28:13.000000000 -0500
+++ gdm-2.21.2/gui/simple-greeter/gdm-greeter-login-window.c 2008-01-07 14:28:26.000000000 -0500
@@ -806,7 +806,7 @@ load_theme (GdmGreeterLoginWindow *login
/* FIXME: set from gconf */
gdm_user_chooser_widget_set_show_other_user (GDM_USER_CHOOSER_WIDGET (login_window->priv->user_chooser), TRUE);
- gdm_user_chooser_widget_set_show_guest_user (GDM_USER_CHOOSER_WIDGET (login_window->priv->user_chooser), TRUE);
+ gdm_user_chooser_widget_set_show_guest_user (GDM_USER_CHOOSER_WIDGET (login_window->priv->user_chooser), FALSE);
g_signal_connect (login_window->priv->user_chooser,
"activated",

View File

@ -1,11 +0,0 @@
diff -up gdm-2.21.2/gui/simple-greeter/gdm-greeter-session.c.use-metacity gdm-2.21.2/gui/simple-greeter/gdm-greeter-session.c
--- gdm-2.21.2/gui/simple-greeter/gdm-greeter-session.c.use-metacity 2007-11-20 19:23:03.000000000 -0500
+++ gdm-2.21.2/gui/simple-greeter/gdm-greeter-session.c 2007-11-20 19:23:34.000000000 -0500
@@ -283,6 +283,7 @@ launch_compiz (GdmGreeterSession *sessio
g_debug ("GdmGreeterSession: Launching compiz");
ret = FALSE;
+ return ret;
error = NULL;
g_spawn_command_line_async ("gtk-window-decorator --replace", &error);

View File

@ -1,284 +0,0 @@
Index: gdm/daemon/gdm-session-direct.c
===================================================================
--- gdm/daemon/gdm-session-direct.c (revision 5874)
+++ gdm/daemon/gdm-session-direct.c (working copy)
@@ -842,6 +842,130 @@ gdm_session_direct_handle_saved_language
return DBUS_HANDLER_RESULT_HANDLED;
}
+static gboolean
+is_prog_in_path (const char *prog)
+{
+ char *f;
+ gboolean ret;
+
+ f = g_find_program_in_path (prog);
+ ret = (f != NULL);
+ g_free (f);
+ return ret;
+}
+
+static gboolean
+get_session_command_for_file (const char *file,
+ char **command)
+{
+ GKeyFile *key_file;
+ GError *error;
+ char *full_path;
+ char *exec;
+ gboolean ret;
+ gboolean res;
+ const char *search_dirs[] = {
+ "/etc/X11/sessions/",
+ DMCONFDIR "/Sessions/",
+ DATADIR "/gdm/BuiltInSessions/",
+ DATADIR "/xsessions/",
+ NULL
+ };
+
+ exec = NULL;
+ ret = FALSE;
+ if (command != NULL) {
+ *command = NULL;
+ }
+
+ key_file = g_key_file_new ();
+
+ g_debug ("GdmSessionDirect: looking for session file '%s'", file);
+
+ error = NULL;
+ full_path = NULL;
+ res = g_key_file_load_from_dirs (key_file,
+ file,
+ search_dirs,
+ &full_path,
+ G_KEY_FILE_NONE,
+ &error);
+ if (! res) {
+ g_debug ("GdmSessionDirect: File '%s' not found: %s", file, error->message);
+ g_error_free (error);
+ if (command != NULL) {
+ *command = NULL;
+ }
+ goto out;
+ }
+
+ error = NULL;
+ res = g_key_file_get_boolean (key_file,
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_HIDDEN,
+ &error);
+ if (error == NULL && res) {
+ g_debug ("GdmSessionDirect: Session %s is marked as hidden", file);
+ goto out;
+ }
+
+ error = NULL;
+ exec = g_key_file_get_string (key_file,
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_TRY_EXEC,
+ &error);
+ if (exec == NULL) {
+ g_debug ("GdmSessionDirect: %s key not found", G_KEY_FILE_DESKTOP_KEY_TRY_EXEC);
+ goto out;
+ }
+
+ res = is_prog_in_path (exec);
+ g_free (exec);
+
+ if (! res) {
+ g_debug ("GdmSessionDirect: Command not found: %s", G_KEY_FILE_DESKTOP_KEY_TRY_EXEC);
+ goto out;
+ }
+
+ error = NULL;
+ exec = g_key_file_get_string (key_file,
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_EXEC,
+ &error);
+ if (error != NULL) {
+ g_debug ("GdmSessionDirect: %s key not found: %s",
+ G_KEY_FILE_DESKTOP_KEY_EXEC,
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ if (command != NULL) {
+ *command = g_strdup (exec);
+ }
+ ret = TRUE;
+
+out:
+ g_free (exec);
+
+ return ret;
+}
+
+static gboolean
+get_session_command_for_name (const char *name,
+ char **command)
+{
+ gboolean res;
+ char *filename;
+
+ filename = g_strdup_printf ("%s.desktop", name);
+
+ command = NULL;
+ res = get_session_command_for_file (filename, command);
+
+ return res;
+}
+
static DBusHandlerResult
gdm_session_direct_handle_saved_session_name_read (GdmSessionDirect *session,
DBusConnection *connection,
@@ -862,6 +986,14 @@ gdm_session_direct_handle_saved_session_
dbus_connection_send (connection, reply, NULL);
dbus_message_unref (reply);
+ if (! get_session_command_for_name (session_name, NULL)) {
+ /* ignore sessions that don't exist */
+ g_debug ("GdmSessionDirect: not using invalid .dmrc session: %s", session_name);
+ g_free (session->priv->saved_session);
+ session->priv->saved_session = NULL;
+ goto out;
+ }
+
if (strcmp (session_name,
get_default_session_name (session)) != 0) {
g_free (session->priv->saved_session);
@@ -870,7 +1002,7 @@ gdm_session_direct_handle_saved_session_
_gdm_session_default_session_name_changed (GDM_SESSION (session),
session_name);
}
-
+ out:
return DBUS_HANDLER_RESULT_HANDLED;
}
@@ -1603,115 +1735,6 @@ send_environment (GdmSessionDirect *sess
session);
}
-static gboolean
-is_prog_in_path (const char *prog)
-{
- char *f;
- gboolean ret;
-
- f = g_find_program_in_path (prog);
- ret = (f != NULL);
- g_free (f);
- return ret;
-}
-
-static gboolean
-get_session_command_for_file (const char *file,
- char **command)
-{
- GKeyFile *key_file;
- GError *error;
- char *full_path;
- char *exec;
- gboolean ret;
- gboolean res;
- const char *search_dirs[] = {
- "/etc/X11/sessions/",
- DMCONFDIR "/Sessions/",
- DATADIR "/gdm/BuiltInSessions/",
- DATADIR "/xsessions/",
- NULL
- };
-
- exec = NULL;
- ret = FALSE;
- if (command != NULL) {
- *command = NULL;
- }
-
- key_file = g_key_file_new ();
-
- g_debug ("GdmSessionDirect: looking for session file '%s'", file);
-
- error = NULL;
- full_path = NULL;
- res = g_key_file_load_from_dirs (key_file,
- file,
- search_dirs,
- &full_path,
- G_KEY_FILE_NONE,
- &error);
- if (! res) {
- g_debug ("GdmSessionDirect: File '%s' not found: %s", file, error->message);
- g_error_free (error);
- if (command != NULL) {
- *command = NULL;
- }
- goto out;
- }
-
- error = NULL;
- res = g_key_file_get_boolean (key_file,
- G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_HIDDEN,
- &error);
- if (error == NULL && res) {
- g_debug ("GdmSessionDirect: Session %s is marked as hidden", file);
- goto out;
- }
-
- error = NULL;
- exec = g_key_file_get_string (key_file,
- G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_TRY_EXEC,
- &error);
- if (exec == NULL) {
- g_debug ("GdmSessionDirect: %s key not found", G_KEY_FILE_DESKTOP_KEY_TRY_EXEC);
- goto out;
- }
-
- res = is_prog_in_path (exec);
- g_free (exec);
-
- if (! res) {
- g_debug ("GdmSessionDirect: Command not found: %s", G_KEY_FILE_DESKTOP_KEY_TRY_EXEC);
- goto out;
- }
-
- error = NULL;
- exec = g_key_file_get_string (key_file,
- G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_EXEC,
- &error);
- if (error != NULL) {
- g_debug ("GdmSessionDirect: %s key not found: %s",
- G_KEY_FILE_DESKTOP_KEY_EXEC,
- error->message);
- g_error_free (error);
- goto out;
- }
-
- if (command != NULL) {
- *command = g_strdup (exec);
- }
- ret = TRUE;
-
-out:
- g_free (exec);
-
- return ret;
-}
-
static const char *
get_language_name (GdmSessionDirect *session)
{
@@ -1725,6 +1748,8 @@ get_language_name (GdmSessionDirect *ses
static const char *
get_session_name (GdmSessionDirect *session)
{
+ /* FIXME: test the session names before we use them? */
+
if (session->priv->selected_session != NULL) {
return session->priv->selected_session;
}

View File

@ -0,0 +1,25 @@
Index: gui/simple-greeter/gdm-greeter-login-window.c
===================================================================
--- gdm-2.21.9/gui/simple-greeter/gdm-greeter-login-window.c (revision 5897)
+++ gdm-2.21.9/gui/simple-greeter/gdm-greeter-login-window.c (working copy)
@@ -178,16 +178,16 @@ capslock_update (GdmGreeterLoginWindow *
static gboolean
is_capslock_on (void)
{
- unsigned int states;
+ XkbStateRec states;
Display *dsp;
dsp = GDK_DISPLAY ();
- if (XkbGetIndicatorState (dsp, XkbUseCoreKbd, &states) != Success) {
- return FALSE;
+ if (XkbGetState (dsp, XkbUseCoreKbd, &states) != Success) {
+ return FALSE;
}
- return (states & ShiftMask) != 0;
+ return (states.locked_mods & LockMask) != 0;
}
static void

View File

@ -0,0 +1,59 @@
--- gdm-2.21.9/gui/simple-greeter/gdm-greeter-login-window.c (revision 5896)
+++ gdm-2.21.9/gui/simple-greeter/gdm-greeter-login-window.c (working copy)
@@ -1325,10 +1325,21 @@ static gboolean
gdm_greeter_login_window_key_press_event (GtkWidget *widget,
GdkEventKey *event)
{
+ GdmGreeterLoginWindow *login_window;
+ gboolean capslock_on;
+
+ login_window = GDM_GREETER_LOGIN_WINDOW (widget);
+
if (event->keyval == GDK_Escape) {
reset_dialog (GDM_GREETER_LOGIN_WINDOW (widget));
}
+ capslock_on = is_capslock_on ();
+
+ if (capslock_on != login_window->priv->caps_lock_on) {
+ capslock_update (login_window, capslock_on);
+ }
+
return GTK_WIDGET_CLASS (gdm_greeter_login_window_parent_class)->key_press_event (widget, event);
}
@@ -1581,22 +1592,6 @@ gdm_greeter_login_window_class_init (Gdm
g_type_class_add_private (klass, sizeof (GdmGreeterLoginWindowPrivate));
}
-static gint
-window_key_press (GtkWidget *widget,
- GdkEventKey *event,
- GdmGreeterLoginWindow *login_window)
-{
- gboolean capslock_on;
-
- capslock_on = is_capslock_on ();
-
- if (capslock_on != login_window->priv->caps_lock_on) {
- capslock_update (login_window, capslock_on);
- }
-
- return TRUE;
-}
-
static void
on_gconf_key_changed (GConfClient *client,
guint cnxn_id,
@@ -1659,11 +1654,6 @@ gdm_greeter_login_window_init (GdmGreete
login_window,
NULL,
NULL);
-
- g_signal_connect (login_window, "key_press_event",
- G_CALLBACK (window_key_press),
- login_window);
-
}
static void

View File

@ -18,8 +18,8 @@
Summary: The GNOME Display Manager
Name: gdm
Version: 2.21.8
Release: 1%{?dist}
Version: 2.21.9
Release: 0.2008.02.29.1%{?dist}
Epoch: 1
License: GPLv2+
Group: User Interface/X
@ -29,11 +29,7 @@ Source1: gdm-pam
Source2: gdm-autologin-pam
Source3: gdmsetup-pam
Patch1: gdm-2.21.8-fedora-logo.patch
Patch2: gdm-2.21.8-validate-dmrc.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Prereq: /usr/sbin/useradd
Requires: gtk2 >= 0:%{gtk2_version}
@ -53,7 +49,7 @@ Requires: xorg-x11-xinit
Requires: hal >= %{hal_version}
Requires: ConsoleKit >= %{consolekit_version}
Requires: PolicyKit-gnome >= %{polkit_version}
Requires: gnome-settings-daemon
Requires: gnome-settings-daemon >= 2.21.92
# since we use it, and pam spams the log if the module is missing
Requires: gnome-keyring-pam
Requires(post): scrollkeeper
@ -93,16 +89,34 @@ BuildRequires: gnome-panel-devel
Requires: audit-libs >= %{libauditver}
Patch0: gdm-2.21.9-dont-steal-all-keypresses.patch
Patch1: gdm-2.21.9-check-capslock-state-not-capslock-light-state.patch
Patch99: gdm-2.21.8-fedora-logo.patch
%package user-switch-applet
Summary: GDM User Switcher Panel Applet
Group: User Interface/Desktops
Requires: gdm >= 0:2.21.9
Obsoletes: fast-user-switch-applet
Provides: fast-user-switch-applet = %{epoch}:%{version}-%{release}
%description
Gdm (the GNOME Display Manager) is a highly configurable
reimplementation of xdm, the X Display Manager. Gdm allows you to log
into your system with the X Window System running and supports running
several different X sessions on your local machine at the same time.
GDM provides the graphical login screen, shown shortly after boot up,
log out, and when user switching.
%description user-switch-applet
The GDM user switcher applet provides a mechanism for changing among
multiple simulanteous logged in users.
%prep
%setup -q
%patch1 -p1 -b .fedora-logo
%patch2 -p1 -b .validate-dmrc
%patch0 -p1 -b .dont-steal-all-keypresses
%patch1 -p1 -b .check-capslock-state-not-capslock-light-state
%patch99 -p1 -b .fedora-logo
%build
cp -f %{SOURCE1} data/gdm
@ -141,29 +155,8 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/gdm/Xsession
rm -f $RPM_BUILD_ROOT%{_libdir}/gtk-2.0/modules/*.a
rm -f $RPM_BUILD_ROOT%{_libdir}/gtk-2.0/modules/*.la
# remove the gnome session file, since we don't use it anymore
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/X11/dm/Sessions/gnome.desktop
# remove the other gnome session file, since we put it in gnome-session
rm -rf $RPM_BUILD_ROOT%{_datadir}/xsessions
mkdir -p $RPM_BUILD_ROOT%{_datadir}/gdm/autostart/LoginWindow
# no dumb flexiserver thing, Xnest is too broken
rm -f $RPM_BUILD_ROOT%{_datadir}/gdm/applications/gdmflexiserver-xnest.desktop
desktop-file-install --vendor gnome --delete-original \
--dir $RPM_BUILD_ROOT%{_datadir}/gdm/applications \
$RPM_BUILD_ROOT%{_datadir}/gdm/applications/gdmsetup.desktop || :
desktop-file-install --vendor gnome --delete-original \
--dir $RPM_BUILD_ROOT%{_datadir}/gdm/applications \
$RPM_BUILD_ROOT%{_datadir}/gdm/applications/gdmphotosetup.desktop || :
desktop-file-install --delete-original \
--dir $RPM_BUILD_ROOT%{_datadir}/gdm/applications \
$RPM_BUILD_ROOT%{_datadir}/gdm/applications/gdmflexiserver.desktop || :
rm -rf $RPM_BUILD_ROOT%{_localstatedir}/scrollkeeper
find $RPM_BUILD_ROOT -name '*.a' -delete
@ -283,13 +276,13 @@ fi
%{_datadir}/pixmaps/faces/*.png
%{_datadir}/pixmaps/faces/*.jpg
%{_datadir}/icons/hicolor/*/apps/*.png
%{_datadir}/gdm
%{_libexecdir}/*
%{_sbindir}/*
%{_bindir}/*
%{_datadir}/gdm/*.glade
%{_sysconfdir}/gconf/schemas/*.schemas
%{_libdir}/bonobo/servers/GNOME_GdmUserSwitchApplet.server
%{_datadir}/gnome-2.0/ui/GNOME_GdmUserSwitchApplet.xml
%dir %{_datadir}/gdm
%dir %{_datadir}/gdm/autostart
%dir %{_datadir}/gdm/autostart/LoginWindow
%dir %{_localstatedir}/log/gdm
%attr(1750, root, gdm) %dir %{_localstatedir}/lib/gdm/.gconf.mandatory
@ -298,7 +291,18 @@ fi
%attr(1770, root, gdm) %dir %{_localstatedir}/gdm
%attr(1770, root, gdm) %dir %{_localstatedir}/lib/gdm
%files user-switch-applet
%defattr(-, root, root)
%{_libexecdir}/gdm-user-switch-applet
%{_datadir}/gdm/gdm-user-switch-applet.glade
%{_libdir}/bonobo/servers/GNOME_FastUserSwitchApplet.server
%{_datadir}/gnome-2.0/ui/GNOME_FastUserSwitchApplet.xml
%changelog
* Fri Feb 29 2008 Ray Strode <rstrode@redhat.com> - 1:2.21.9-0.2008.02.29.1
- Update to snapshot
- Split user-switcher out
* Mon Feb 25 2008 Jon McCann <jmccann@redhat.com> - 1:2.21.8-1
- Update to 2.21.8

View File

@ -1 +1 @@
5eecea9d8466bcab8790699685f28b0b gdm-2.21.8.tar.gz
7e8c358319a47254882f2504d24ce53c gdm-2.21.9.tar.gz