mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-24 18:25:50 +00:00
Search filter popover on [Ctrl]+[F]
Currently using the [Ctrl]+[F] keyboard shortcut toggles the search bar visibility. Using the [Ctrl]+[F] keyboard shortcut shows the search filter popover (and gives it keyboard focus). To add this a new action "search-visible-popover" is added which in addition to the "search-visible" action adds the feature to focus and show the search dropdown menu. https://gitlab.gnome.org/GNOME/nautilus/issues/333
This commit is contained in:
parent
122f201dcf
commit
543f5ae369
|
@ -601,6 +601,18 @@ entry_tag_clicked (NautilusQueryEditor *editor)
|
|||
TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_query_editor_show_popover (NautilusQueryEditor *editor)
|
||||
{
|
||||
NautilusQueryEditorPrivate *priv;
|
||||
|
||||
priv = nautilus_query_editor_get_instance_private (editor);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->dropdown_button),
|
||||
TRUE);
|
||||
gtk_widget_grab_focus (GTK_WIDGET (priv->popover));
|
||||
}
|
||||
|
||||
static void
|
||||
entry_tag_close_button_clicked (NautilusQueryEditor *editor,
|
||||
GdTaggedEntryTag *tag)
|
||||
|
|
|
@ -86,3 +86,6 @@ void nautilus_query_editor_set_text (NautilusQueryEditor *editor,
|
|||
gboolean
|
||||
nautilus_query_editor_handle_event (NautilusQueryEditor *self,
|
||||
GdkEvent *event);
|
||||
|
||||
void
|
||||
nautilus_query_editor_show_popover (NautilusQueryEditor *editor);
|
||||
|
|
|
@ -875,13 +875,17 @@ nautilus_window_slot_constructed (GObject *object)
|
|||
static void
|
||||
action_search_visible (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
gpointer user_data,
|
||||
gboolean show_popover)
|
||||
{
|
||||
NautilusWindowSlot *self;
|
||||
GVariant *current_state;
|
||||
NautilusWindowSlotPrivate *priv;
|
||||
|
||||
self = NAUTILUS_WINDOW_SLOT (user_data);
|
||||
priv = nautilus_window_slot_get_instance_private (self);
|
||||
current_state = g_action_get_state (G_ACTION (action));
|
||||
|
||||
if (g_variant_get_boolean (current_state) != g_variant_get_boolean (state))
|
||||
{
|
||||
g_simple_action_set_state (action, state);
|
||||
|
@ -890,6 +894,10 @@ action_search_visible (GSimpleAction *action,
|
|||
{
|
||||
show_query_editor (self);
|
||||
nautilus_window_slot_set_searching (self, TRUE);
|
||||
if(show_popover == TRUE)
|
||||
{
|
||||
nautilus_query_editor_show_popover (priv->query_editor);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -901,6 +909,23 @@ action_search_visible (GSimpleAction *action,
|
|||
g_variant_unref (current_state);
|
||||
}
|
||||
|
||||
static void
|
||||
search_visible_with_popover (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
action_search_visible (action, state, user_data, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
search_visible_without_popover (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
action_search_visible (action, state, user_data, FALSE);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
change_files_view_mode (NautilusWindowSlot *self,
|
||||
guint view_id)
|
||||
|
@ -971,7 +996,8 @@ const GActionEntry slot_entries[] =
|
|||
/* 4 is NAUTILUS_VIEW_INVALID_ID */
|
||||
{ "files-view-mode", NULL, "u", "uint32 4", action_files_view_mode },
|
||||
{ "files-view-mode-toggle", action_files_view_mode_toggle },
|
||||
{ "search-visible", NULL, NULL, "false", action_search_visible },
|
||||
{ "search-visible", NULL, NULL, "false", search_visible_without_popover },
|
||||
{ "search-visible-popover", NULL, NULL, "false", search_visible_with_popover },
|
||||
};
|
||||
|
||||
static void
|
||||
|
@ -1018,7 +1044,7 @@ nautilus_window_slot_init (NautilusWindowSlot *self)
|
|||
G_ACTION_GROUP (priv->slot_action_group));
|
||||
nautilus_application_set_accelerator (app, "slot.files-view-mode(uint32 1)", "<control>1");
|
||||
nautilus_application_set_accelerator (app, "slot.files-view-mode(uint32 0)", "<control>2");
|
||||
nautilus_application_set_accelerator (app, "slot.search-visible", "<control>f");
|
||||
nautilus_application_set_accelerator (app, "slot.search-visible-popover", "<control>f");
|
||||
|
||||
priv->view_mode_before_search = NAUTILUS_VIEW_INVALID_ID;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue