[nautilus] places-sidebar: focus the first non-heading row on focus-in
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] places-sidebar: focus the first non-heading row on focus-in
- Date: Mon, 19 Mar 2012 15:29:41 +0000 (UTC)
commit a06988aefdf6cf147936737e48005170410046b2
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Mar 19 11:23:53 2012 -0400
places-sidebar: focus the first non-heading row on focus-in
Instead of giving the focus to the heading, which would end up in
getting stuck there, since headings are not supposed to be actionable.
https://bugzilla.gnome.org/show_bug.cgi?id=672002
src/nautilus-places-sidebar.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
index 04af844..cf486d7 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -2526,6 +2526,30 @@ properties_cb (GtkMenuItem *item,
gtk_tree_path_free (path);
}
+static gboolean
+nautilus_places_sidebar_focus (GtkWidget *widget,
+ GtkDirectionType direction)
+{
+ NautilusPlacesSidebar *sidebar = NAUTILUS_PLACES_SIDEBAR (widget);
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ gboolean res;
+
+ res = get_selected_iter (sidebar, &iter);
+
+ if (!res) {
+ gtk_tree_model_get_iter_first (GTK_TREE_MODEL (sidebar->store), &iter);
+ res = find_next_row (sidebar, &iter);
+ if (res) {
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (sidebar->store), &iter);
+ gtk_tree_view_set_cursor (sidebar->tree_view, path, NULL, FALSE);
+ gtk_tree_path_free (path);
+ }
+ }
+
+ return GTK_WIDGET_CLASS (nautilus_places_sidebar_parent_class)->focus (widget, direction);
+}
+
/* Handler for GtkWidget::key-press-event on the shortcuts list */
static gboolean
bookmarks_key_press_event_cb (GtkWidget *widget,
@@ -3420,6 +3444,7 @@ nautilus_places_sidebar_class_init (NautilusPlacesSidebarClass *class)
G_OBJECT_CLASS (class)->dispose = nautilus_places_sidebar_dispose;
GTK_WIDGET_CLASS (class)->style_set = nautilus_places_sidebar_style_set;
+ GTK_WIDGET_CLASS (class)->focus = nautilus_places_sidebar_focus;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]