[nautilus] slot: ensure we're back from an active search when changing location
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] slot: ensure we're back from an active search when changing location
- Date: Fri, 26 Oct 2012 21:46:53 +0000 (UTC)
commit 0b59aa2e0477b8e7f044a33d3a7281d7c3b2770b
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Oct 26 17:39:47 2012 -0400
slot: ensure we're back from an active search when changing location
When search is turned off, we want to change the location of the slot to
the search base folder.
We used to keep track of the search active state using the state of the
search toggle button; unfortunately, the button is per-window,
so its active state will also be synchronized when switching tabs.
This will cause a non-search slot that becomes active following a tab
switch from a search slot to think its search just became inactive, and
will then change its location to the default ($HOME).
Fix the bug by keeping an additional state per-slot for whether there's
an active search.
https://bugzilla.gnome.org/show_bug.cgi?id=686893
src/nautilus-window-slot.c | 21 +++++++++++++++++++++
src/nautilus-window.c | 14 --------------
2 files changed, 21 insertions(+), 14 deletions(-)
---
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 0e6321e..7b86e9f 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -101,6 +101,7 @@ struct NautilusWindowSlotDetails {
gulong qe_changed_id;
gulong qe_cancel_id;
gulong qe_activated_id;
+ gboolean search_active;
/* Load state */
GCancellable *find_mount_cancellable;
@@ -142,11 +143,31 @@ toggle_toolbar_search_button (NautilusWindowSlot *slot,
{
GtkActionGroup *action_group;
GtkAction *action;
+ gboolean old_active;
+ GFile *location;
action_group = nautilus_window_get_main_action_group (slot->details->window);
action = gtk_action_group_get_action (action_group, NAUTILUS_ACTION_SEARCH);
+ old_active = slot->details->search_active;
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
+ slot->details->search_active = active;
+
+ /* If search was active on this slot and became inactive, change
+ * the slot location to the real directory.
+ */
+ if (!active && old_active) {
+ /* Use the query editor search root if possible */
+ location = nautilus_window_slot_get_query_editor_location (slot);
+
+ /* Use the home directory as a fallback */
+ if (location == NULL) {
+ location = g_file_new_for_path (g_get_home_dir ());
+ }
+
+ nautilus_window_slot_open_location (slot, location, 0);
+ g_object_unref (location);
+ }
}
static void
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index e94fbba..bf10c9e 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -282,21 +282,7 @@ nautilus_window_set_search_visible (NautilusWindow *window,
remember_focus_widget (window);
nautilus_window_slot_set_query_editor_visible (slot, TRUE);
} else {
- GFile *location = NULL;
-
restore_focus_widget (window);
-
- /* Use the location bar as the return location */
- location = nautilus_window_slot_get_query_editor_location (slot);
-
- /* Last try: use the home directory as the return location */
- if (location == NULL) {
- location = g_file_new_for_path (g_get_home_dir ());
- }
-
- nautilus_window_go_to (window, location);
- g_object_unref (location);
-
nautilus_window_slot_set_query_editor_visible (slot, FALSE);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]