[nautilus/gnome-3-6] window: don't remember focus widget when switching search visible
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/gnome-3-6] window: don't remember focus widget when switching search visible
- Date: Mon, 29 Oct 2012 22:54:50 +0000 (UTC)
commit a198febc399961edaa69c066c7f368deba197258
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Oct 29 18:44:23 2012 -0400
window: don't remember focus widget when switching search visible
The workaround we need to make to focus the entry on-the-fly and
synchronizing the visible state with the toolbar button badly clash with
the focus widget state saving mechanism we have in place.
We end up calling remember_focus_widget() on the newly-focused
search entry in certain circumstances, so we end up restoring the focus
on the (then hidden) search entry, which will then eat key events while
invisible.
Sidestep the issue entirely by just focusing back the view when closing
the query editor.
src/nautilus-window-menus.c | 4 +++-
src/nautilus-window-private.h | 3 ---
src/nautilus-window-slot.c | 4 ++++
src/nautilus-window.c | 21 +++------------------
4 files changed, 10 insertions(+), 22 deletions(-)
---
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index a61fb24..2308ca9 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -422,10 +422,12 @@ static void
action_show_hide_search_callback (GtkAction *action,
NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
gboolean active;
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- nautilus_window_set_search_visible (window, active);
+ slot = nautilus_window_get_active_slot (window);
+ nautilus_window_slot_set_search_visible (slot, active);
}
static void
diff --git a/src/nautilus-window-private.h b/src/nautilus-window-private.h
index b35db8a..68d28e0 100644
--- a/src/nautilus-window-private.h
+++ b/src/nautilus-window-private.h
@@ -116,9 +116,6 @@ void nautilus_window_sync_zoom_widgets (NautilusWindow *window);
void nautilus_window_sync_up_button (NautilusWindow *window);
void nautilus_window_sync_view_as_menus (NautilusWindow *window);
-void nautilus_window_set_search_visible (NautilusWindow *window,
- gboolean visible);
-
/* window menus */
void nautilus_window_initialize_actions (NautilusWindow *window);
void nautilus_window_initialize_menus (NautilusWindow *window);
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index fa5fbe6..da826c4 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -274,6 +274,10 @@ nautilus_window_slot_set_search_visible (NautilusWindowSlot *slot,
}
}
+ if (active_slot) {
+ nautilus_window_grab_focus (slot->details->window);
+ }
+
hide_query_editor (slot);
}
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 7459342..4543a91 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -206,7 +206,9 @@ remember_focus_widget (NautilusWindow *window)
void
nautilus_window_grab_focus (NautilusWindow *window)
{
- if (NAUTILUS_IS_WINDOW (window) && window->details->active_slot) {
+ if (NAUTILUS_IS_WINDOW (window) &&
+ window->details->active_slot &&
+ window->details->active_slot->content_view) {
nautilus_view_grab_focus (window->details->active_slot->content_view);
}
}
@@ -268,23 +270,6 @@ notebook_switch_page_cb (GtkNotebook *notebook,
return FALSE;
}
-void
-nautilus_window_set_search_visible (NautilusWindow *window,
- gboolean visible)
-{
- NautilusWindowSlot *slot;
-
- slot = window->details->active_slot;
-
- if (visible) {
- remember_focus_widget (window);
- } else {
- restore_focus_widget (window);
- }
-
- nautilus_window_slot_set_search_visible (slot, visible);
-}
-
static void
close_slot (NautilusWindow *window,
NautilusWindowSlot *slot,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]