gdm r6484 - in trunk: . gui/simple-greeter
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gdm r6484 - in trunk: . gui/simple-greeter
- Date: Tue, 9 Sep 2008 00:20:37 +0000 (UTC)
Author: mccann
Date: Tue Sep 9 00:20:37 2008
New Revision: 6484
URL: http://svn.gnome.org/viewvc/gdm?rev=6484&view=rev
Log:
2008-09-08 William Jon McCann <jmccann redhat com>
* gui/simple-greeter/gdm-chooser-widget.c
(translate_view_path_to_list_path), (get_active_item_id),
(get_selected_list_path), (gdm_chooser_widget_get_selected_item):
* gui/simple-greeter/gdm-chooser-widget.h:
* gui/simple-greeter/gdm-language-chooser-widget.c
(gdm_language_chooser_widget_get_current_language_name):
* gui/simple-greeter/gdm-layout-chooser-widget.c
(gdm_layout_chooser_widget_get_current_layout_name):
Use the selected item instead of the active item for the
language and layout choosers. We don't do this for the
user chooser because we change the selection of it in order
to work around the widget using the selection color.
Modified:
trunk/ChangeLog
trunk/gui/simple-greeter/gdm-chooser-widget.c
trunk/gui/simple-greeter/gdm-chooser-widget.h
trunk/gui/simple-greeter/gdm-language-chooser-widget.c
trunk/gui/simple-greeter/gdm-layout-chooser-widget.c
Modified: trunk/gui/simple-greeter/gdm-chooser-widget.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-chooser-widget.c (original)
+++ trunk/gui/simple-greeter/gdm-chooser-widget.c Tue Sep 9 00:20:37 2008
@@ -275,6 +275,26 @@
*path = sorted_path;
}
+
+static void
+translate_view_path_to_list_path (GdmChooserWidget *widget,
+ GtkTreePath **path)
+{
+ GtkTreePath *filtered_path;
+ GtkTreePath *list_path;
+
+ /* the child model is the source for the filter */
+ filtered_path = gtk_tree_model_sort_convert_path_to_child_path (widget->priv->model_sorter,
+ *path);
+
+ list_path = gtk_tree_model_filter_convert_path_to_child_path (widget->priv->model_filter,
+ filtered_path);
+ gtk_tree_path_free (filtered_path);
+
+ gtk_tree_path_free (*path);
+ *path = list_path;
+}
+
static GtkTreePath *
get_list_path_to_active_row (GdmChooserWidget *widget)
{
@@ -335,7 +355,7 @@
CHOOSER_ID_COLUMN,
&item_id,
-1);
- };
+ }
gtk_tree_path_free (path);
return item_id;
@@ -350,6 +370,59 @@
}
static void
+get_selected_list_path (GdmChooserWidget *widget,
+ GtkTreePath **pathp)
+{
+ GtkTreeSelection *selection;
+ GtkTreeModel *sort_model;
+ GtkTreeIter sorted_iter;
+ GtkTreePath *path;
+
+ path = NULL;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget->priv->items_view));
+ if (gtk_tree_selection_get_selected (selection, &sort_model, &sorted_iter)) {
+
+ g_assert (sort_model == GTK_TREE_MODEL (widget->priv->model_sorter));
+
+ path = gtk_tree_model_get_path (sort_model, &sorted_iter);
+
+ translate_view_path_to_list_path (widget, &path);
+ } else {
+ g_debug ("GdmChooserWidget: no rows selected");
+ }
+
+ *pathp = path;
+}
+
+char *
+gdm_chooser_widget_get_selected_item (GdmChooserWidget *widget)
+{
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+ GtkTreePath *path;
+ char *id;
+
+ id = NULL;
+
+ get_selected_list_path (widget, &path);
+
+ model = GTK_TREE_MODEL (widget->priv->list_store);
+
+ if (gtk_tree_model_get_iter (model, &iter, path)) {
+ gtk_tree_model_get (model,
+ &iter,
+ CHOOSER_ID_COLUMN,
+ &id,
+ -1);
+ }
+
+ gtk_tree_path_free (path);
+
+ return id;
+}
+
+static void
activate_from_item_id (GdmChooserWidget *widget,
const char *item_id)
{
@@ -920,51 +993,6 @@
g_signal_emit (widget, signals[DEACTIVATED], 0);
}
-static void
-translate_view_path_to_list_path (GdmChooserWidget *widget,
- GtkTreePath **path)
-{
- GtkTreePath *filtered_path;
- GtkTreePath *list_path;
-
- /* the child model is the source for the filter */
- filtered_path = gtk_tree_model_sort_convert_path_to_child_path (widget->priv->model_sorter,
- *path);
-
- list_path = gtk_tree_model_filter_convert_path_to_child_path (widget->priv->model_filter,
- filtered_path);
- gtk_tree_path_free (filtered_path);
-
- gtk_tree_path_free (*path);
- *path = list_path;
-}
-
-static void
-get_selected_list_path (GdmChooserWidget *widget,
- GtkTreePath **pathp)
-{
- GtkTreeSelection *selection;
- GtkTreeModel *sort_model;
- GtkTreeIter sorted_iter;
- GtkTreePath *path;
-
- path = NULL;
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget->priv->items_view));
- if (gtk_tree_selection_get_selected (selection, &sort_model, &sorted_iter)) {
-
- g_assert (sort_model == GTK_TREE_MODEL (widget->priv->model_sorter));
-
- path = gtk_tree_model_get_path (sort_model, &sorted_iter);
-
- translate_view_path_to_list_path (widget, &path);
- } else {
- g_debug ("GdmChooserWidget: no rows selected");
- }
-
- *pathp = path;
-}
-
void
gdm_chooser_widget_activate_selected_item (GdmChooserWidget *widget)
{
Modified: trunk/gui/simple-greeter/gdm-chooser-widget.h
==============================================================================
--- trunk/gui/simple-greeter/gdm-chooser-widget.h (original)
+++ trunk/gui/simple-greeter/gdm-chooser-widget.h Tue Sep 9 00:20:37 2008
@@ -105,6 +105,8 @@
gboolean *is_in_use,
gboolean *is_separate);
+char * gdm_chooser_widget_get_selected_item (GdmChooserWidget *widget);
+
char * gdm_chooser_widget_get_active_item (GdmChooserWidget *widget);
void gdm_chooser_widget_set_active_item (GdmChooserWidget *widget,
const char *item);
Modified: trunk/gui/simple-greeter/gdm-language-chooser-widget.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-language-chooser-widget.c (original)
+++ trunk/gui/simple-greeter/gdm-language-chooser-widget.c Tue Sep 9 00:20:37 2008
@@ -66,7 +66,7 @@
g_return_val_if_fail (GDM_IS_LANGUAGE_CHOOSER_WIDGET (widget), NULL);
- language_name = gdm_chooser_widget_get_active_item (GDM_CHOOSER_WIDGET (widget));
+ language_name = gdm_chooser_widget_get_selected_item (GDM_CHOOSER_WIDGET (widget));
if (language_name == NULL) {
language_name = g_strdup (setlocale (LC_MESSAGES, NULL));
Modified: trunk/gui/simple-greeter/gdm-layout-chooser-widget.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-layout-chooser-widget.c (original)
+++ trunk/gui/simple-greeter/gdm-layout-chooser-widget.c Tue Sep 9 00:20:37 2008
@@ -66,7 +66,7 @@
g_return_val_if_fail (GDM_IS_LAYOUT_CHOOSER_WIDGET (widget), NULL);
- id = gdm_chooser_widget_get_active_item (GDM_CHOOSER_WIDGET (widget));
+ id = gdm_chooser_widget_get_selected_item (GDM_CHOOSER_WIDGET (widget));
if (id == NULL) {
id = g_strdup ("us");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]