[nautilus] window-slot: prevent menu disappearing when Hidden Files toggled
- From: Neil Herald <neilh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] window-slot: prevent menu disappearing when Hidden Files toggled
- Date: Sat, 10 Dec 2016 20:46:59 +0000 (UTC)
commit acff418810418e594a094dfee045300320f69ff4
Author: Neil Herald <neil herald gmail com>
Date: Sat Dec 10 14:28:24 2016 +0000
window-slot: prevent menu disappearing when Hidden Files toggled
When the user toggled the Show Hidden Files option on the toolbar menu,
previously the menu disappeared - which isn't the correct behaviour. This
commit changes it so that the menu doesn't disappear.
https://bugzilla.gnome.org/show_bug.cgi?id=766952
src/nautilus-toolbar.c | 12 ++++++++++++
src/nautilus-toolbar.h | 2 ++
src/nautilus-window-slot.c | 9 ++++++++-
3 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index d5ed7e0..432ce1e 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -1166,6 +1166,18 @@ nautilus_toolbar_set_active_slot (NautilusToolbar *toolbar,
}
gboolean
+nautilus_toolbar_is_menu_visible (NautilusToolbar *self)
+{
+ GtkPopover *popover;
+
+ g_return_val_if_fail (NAUTILUS_IS_TOOLBAR (self), FALSE);
+
+ popover = GTK_POPOVER (gtk_menu_button_get_popover (GTK_MENU_BUTTON (self->view_button)));
+
+ return gtk_widget_is_visible (GTK_WIDGET (popover));
+}
+
+gboolean
nautilus_toolbar_is_operations_button_active (NautilusToolbar *self)
{
return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->operations_button));
diff --git a/src/nautilus-toolbar.h b/src/nautilus-toolbar.h
index 8b839a3..2ae1b74 100644
--- a/src/nautilus-toolbar.h
+++ b/src/nautilus-toolbar.h
@@ -45,6 +45,8 @@ void nautilus_toolbar_set_show_location_entry (NautilusToolbar *self,
void nautilus_toolbar_set_active_slot (NautilusToolbar *toolbar,
NautilusWindowSlot *slot);
+gboolean nautilus_toolbar_is_menu_visible (NautilusToolbar *toolbar);
+
gboolean nautilus_toolbar_is_operations_button_active (NautilusToolbar *toolbar);
void nautilus_toolbar_on_window_constructed (NautilusToolbar *toolbar);
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 0f4646f..268bfdd 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -28,6 +28,7 @@
#include "nautilus-list-view.h"
#include "nautilus-mime-actions.h"
#include "nautilus-special-location-bar.h"
+#include "nautilus-toolbar.h"
#include "nautilus-trash-bar.h"
#include "nautilus-trash-monitor.h"
#include "nautilus-view.h"
@@ -2436,7 +2437,13 @@ view_started_loading (NautilusWindowSlot *self,
nautilus_window_slot_set_allow_stop (self, TRUE);
}
- gtk_widget_grab_focus (GTK_WIDGET (priv->window));
+ /* Only grab focus if the menu isn't showing. Otherwise the menu disappears
+ * e.g. when the user toggles Show Hidden Files
+ */
+ if (!nautilus_toolbar_is_menu_visible (NAUTILUS_TOOLBAR (nautilus_window_get_toolbar (priv->window))))
+ {
+ gtk_widget_grab_focus (GTK_WIDGET (priv->window));
+ }
gtk_widget_show (GTK_WIDGET (priv->window));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]