summaryrefslogtreecommitdiff
path: root/src/nautilus-query-editor.c
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2018-04-13 21:36:42 +0200
committerCarlos Soriano <csoriano@gnome.org>2018-05-03 22:43:39 +0200
commitf278574df4a7fe84ff8f7e70b0f9f260fa665072 (patch)
treef8049044b4ba7b6b9cf1747c898ab21294d482b0 /src/nautilus-query-editor.c
parent7346702032adde2255db99563b20f11715b2ab37 (diff)
downloadnautilus-f278574df4a7fe84ff8f7e70b0f9f260fa665072.tar.gz
general: Add actions to the toolbar
Generally actions in Nautilus were accessed through context menus or keyboard shorcuts. However, those are not very discoverable and are not touch friendly. Even more, in list view it was not possible to access background actions since there is always a selection, making Nautilus UX quite poor in that case. Also some actions were placed in the app menu, which didn't was not as clear for some people given that we have most of actions in the toolbar. In all, we came with a new design that solves the main goals of discoverability, touch friendly and accessibility for background actions and app actions, and now are placed in the toolbar together with an overhaul of the looks of Nautilus path bar and search. There is still work to do, specifically finding a design that works for the selection actions and also to replace the current information floating bar. The later might be just a different goal. However this goes in the right direction. See https://gitlab.gnome.org/GNOME/nautilus/issues/322
Diffstat (limited to 'src/nautilus-query-editor.c')
-rw-r--r--src/nautilus-query-editor.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index 5ce439e68..9c8033def 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -78,7 +78,7 @@ static void entry_changed_cb (GtkWidget *entry,
NautilusQueryEditor *editor);
static void nautilus_query_editor_changed (NautilusQueryEditor *editor);
-G_DEFINE_TYPE_WITH_PRIVATE (NautilusQueryEditor, nautilus_query_editor, GTK_TYPE_SEARCH_BAR);
+G_DEFINE_TYPE_WITH_PRIVATE (NautilusQueryEditor, nautilus_query_editor, GTK_TYPE_BOX);
static gboolean
settings_search_is_recursive (NautilusQueryEditor *editor)
@@ -428,7 +428,7 @@ entry_changed_cb (GtkWidget *entry,
priv = nautilus_query_editor_get_instance_private (editor);
- if (priv->change_frozen || !gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (editor)))
+ if (priv->change_frozen)
{
return;
}
@@ -468,27 +468,12 @@ entry_key_press_event_cb (GtkWidget *widget,
GdkEventKey *event,
NautilusQueryEditor *editor)
{
- if (event->keyval == GDK_KEY_Down)
+ if (event->keyval == GDK_KEY_Down )
{
gtk_widget_grab_focus (gtk_widget_get_toplevel (GTK_WIDGET (widget)));
}
- return FALSE;
-}
-
-static void
-search_mode_changed_cb (GObject *editor,
- GParamSpec *pspec,
- gpointer user_data)
-{
- NautilusQueryEditorPrivate *priv;
-
- priv = nautilus_query_editor_get_instance_private (NAUTILUS_QUERY_EDITOR (editor));
- if (!gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (editor)))
- {
- g_signal_emit (editor, signals[CANCEL], 0);
- gtk_widget_hide (priv->popover);
- }
+ return FALSE;
}
static void
@@ -657,8 +642,7 @@ setup_widgets (NautilusQueryEditor *editor)
/* create the search entry */
priv->entry = GTK_WIDGET (gd_tagged_entry_new ());
- gtk_widget_set_size_request (GTK_WIDGET (priv->entry), 400, -1);
- gtk_search_bar_connect_entry (GTK_SEARCH_BAR (editor), GTK_ENTRY (priv->entry));
+ gtk_widget_set_hexpand (priv->entry, TRUE);
gtk_container_add (GTK_CONTAINER (hbox), priv->entry);
@@ -696,8 +680,6 @@ setup_widgets (NautilusQueryEditor *editor)
gtk_menu_button_set_popover (GTK_MENU_BUTTON (priv->dropdown_button), priv->popover);
gtk_container_add (GTK_CONTAINER (hbox), priv->dropdown_button);
- g_signal_connect (editor, "notify::search-mode-enabled",
- G_CALLBACK (search_mode_changed_cb), NULL);
g_signal_connect (priv->entry, "key-press-event",
G_CALLBACK (entry_key_press_event_cb), editor);
g_signal_connect (priv->entry, "activate",
@@ -858,3 +840,14 @@ nautilus_query_editor_set_text (NautilusQueryEditor *editor,
/* The handler of the entry will take care of everything */
gtk_entry_set_text (GTK_ENTRY (priv->entry), text);
}
+
+gboolean
+nautilus_query_editor_handle_event (NautilusQueryEditor *self,
+ GdkEvent *event)
+{
+ NautilusQueryEditorPrivate *priv;
+
+ priv = nautilus_query_editor_get_instance_private (self);
+
+ return gtk_search_entry_handle_event (GTK_SEARCH_ENTRY (priv->entry), event);
+}