summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano1618@gmail.com>2018-03-19 15:35:40 +0000
committerCarlos Soriano <csoriano1618@gmail.com>2018-03-19 15:35:40 +0000
commit971e787e64ea18ae806e601c9ede99ba30f28b18 (patch)
treeb1a7ba960ee16dae8a3e1db8005758aaf1f3af04
parentf9d5630e5505ade005f36c1a7fd755bab65d475b (diff)
parent80dea23a92662807ece197c6dba53ab06264623e (diff)
downloadnautilus-971e787e64ea18ae806e601c9ede99ba30f28b18.tar.gz
Merge branch 'window-slot-null-view' into 'master'
Don’t search without a set-up view See merge request GNOME/nautilus!153
-rw-r--r--src/nautilus-query-editor.c5
-rw-r--r--src/nautilus-query-editor.h64
-rw-r--r--src/nautilus-window-slot.c6
-rw-r--r--src/nautilus-window.c1
4 files changed, 57 insertions, 19 deletions
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index 0041ff5b4..a2291a87a 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -391,6 +391,11 @@ create_query (NautilusQueryEditor *editor)
fts_enabled = nautilus_search_popover_get_fts_enabled (NAUTILUS_SEARCH_POPOVER (priv->popover));
+ if (priv->location == NULL)
+ {
+ return;
+ }
+
file = nautilus_file_get (priv->location);
query = nautilus_query_new ();
diff --git a/src/nautilus-query-editor.h b/src/nautilus-query-editor.h
index b940996dd..9d20dfc58 100644
--- a/src/nautilus-query-editor.h
+++ b/src/nautilus-query-editor.h
@@ -30,27 +30,57 @@
G_DECLARE_DERIVABLE_TYPE (NautilusQueryEditor, nautilus_query_editor, NAUTILUS, QUERY_EDITOR, GtkSearchBar)
-struct _NautilusQueryEditorClass {
- GtkSearchBarClass parent_class;
-
- void (* changed) (NautilusQueryEditor *editor,
- NautilusQuery *query,
- gboolean reload);
- void (* cancel) (NautilusQueryEditor *editor);
- void (* activated) (NautilusQueryEditor *editor);
-};
+struct _NautilusQueryEditorClass
+{
+ GtkSearchBarClass parent_class;
-#include "nautilus-window-slot.h"
+ void (* changed) (NautilusQueryEditor *editor,
+ NautilusQuery *query,
+ gboolean reload);
+ void (* cancel) (NautilusQueryEditor *editor);
+ void (* activated) (NautilusQueryEditor *editor);
+};
-GType nautilus_query_editor_get_type (void);
-GtkWidget* nautilus_query_editor_new (void);
+GtkWidget *nautilus_query_editor_new (void);
-NautilusQuery *nautilus_query_editor_get_query (NautilusQueryEditor *editor);
-void nautilus_query_editor_set_query (NautilusQueryEditor *editor,
- NautilusQuery *query);
-GFile * nautilus_query_editor_get_location (NautilusQueryEditor *editor);
+/**
+ * nautilus_query_editor_get_query:
+ *
+ * @editor: A #NautilusQueryEditor instance.
+ *
+ * Returns: (nullable) (transfer full): The #NautilusQuery for the editor.
+ */
+NautilusQuery *nautilus_query_editor_get_query (NautilusQueryEditor *editor);
+/**
+ * nautilus_query_editor_set_query:
+ *
+ * @editor: A #NautilusQueryEditor instance.
+ * @query: (nullable) (transfer full): The #NautilusQuery for the search.
+ */
+void nautilus_query_editor_set_query (NautilusQueryEditor *editor,
+ NautilusQuery *query);
+/**
+ * nautilus_query_editor_get_location:
+ *
+ * @editor: A #NautilusQueryEditor instance.
+ *
+ * Returns: (nullable) (transfer full): The location of the current search.
+ */
+GFile *nautilus_query_editor_get_location (NautilusQueryEditor *editor);
+/**
+ * nautilus_query_editor_set_location:
+ *
+ * @editor: A #NautilusQueryEditor instance.
+ * @location: (nullable) (transfer full): The location in which the search will take place.
+ */
void nautilus_query_editor_set_location (NautilusQueryEditor *editor,
- GFile *location);
+ GFile *location);
+/**
+ * nautilus_query_editor_set_text:
+ *
+ * @editor: A #NautilusQueryEditor instance.
+ * @text: (not nullable) (transfer none): The search text.
+ */
void nautilus_query_editor_set_text (NautilusQueryEditor *editor,
const gchar *text);
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 45a2bc60e..c3260aeb0 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -509,6 +509,10 @@ show_query_editor (NautilusWindowSlot *self)
priv = nautilus_window_slot_get_instance_private (self);
view = nautilus_window_slot_get_current_view (self);
+ if (view == NULL)
+ {
+ return;
+ }
if (nautilus_view_is_searching (view))
{
@@ -2782,8 +2786,6 @@ nautilus_window_slot_dispose (GObject *object)
nautilus_window_slot_remove_extra_location_widgets (self);
- nautilus_window_slot_set_active (self, FALSE);
-
if (priv->content_view)
{
gtk_widget_destroy (GTK_WIDGET (priv->content_view));
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index dee129eb3..1f8d5208e 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -2902,6 +2902,7 @@ real_window_close (NautilusWindow *window)
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
nautilus_window_save_geometry (window);
+ nautilus_window_set_active_slot (window, NULL);
gtk_widget_destroy (GTK_WIDGET (window));
}