mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-11-05 16:04:31 +00:00
all: remove is_indexed property on NautilusSearchDirectory
It doesn't really make sense to artificially change the query target if we're indexed.
This commit is contained in:
parent
aef4bf26ed
commit
88b08d691c
10 changed files with 27 additions and 79 deletions
|
@ -833,14 +833,6 @@ nautilus_search_directory_is_modified (NautilusSearchDirectory *search)
|
|||
return search->details->modified;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nautilus_search_directory_is_indexed (NautilusSearchDirectory *search)
|
||||
{
|
||||
ensure_search_engine (search);
|
||||
return nautilus_search_engine_is_indexed (search->details->engine);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nautilus_search_directory_save_to_file (NautilusSearchDirectory *search,
|
||||
const char *save_file_uri)
|
||||
|
|
|
@ -59,7 +59,6 @@ NautilusSearchDirectory *nautilus_search_directory_new_from_saved_search (const
|
|||
|
||||
gboolean nautilus_search_directory_is_saved_search (NautilusSearchDirectory *search);
|
||||
gboolean nautilus_search_directory_is_modified (NautilusSearchDirectory *search);
|
||||
gboolean nautilus_search_directory_is_indexed (NautilusSearchDirectory *search);
|
||||
void nautilus_search_directory_save_search (NautilusSearchDirectory *search);
|
||||
void nautilus_search_directory_save_to_file (NautilusSearchDirectory *search,
|
||||
const char *save_file_uri);
|
||||
|
|
|
@ -368,12 +368,6 @@ nautilus_search_engine_simple_stop (NautilusSearchEngine *engine)
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
nautilus_search_engine_simple_is_indexed (NautilusSearchEngine *engine)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_search_engine_simple_set_query (NautilusSearchEngine *engine, NautilusQuery *query)
|
||||
{
|
||||
|
@ -407,7 +401,6 @@ nautilus_search_engine_simple_class_init (NautilusSearchEngineSimpleClass *class
|
|||
engine_class->set_query = nautilus_search_engine_simple_set_query;
|
||||
engine_class->start = nautilus_search_engine_simple_start;
|
||||
engine_class->stop = nautilus_search_engine_simple_stop;
|
||||
engine_class->is_indexed = nautilus_search_engine_simple_is_indexed;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -316,12 +316,6 @@ nautilus_search_engine_tracker_stop (NautilusSearchEngine *engine)
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
nautilus_search_engine_tracker_is_indexed (NautilusSearchEngine *engine)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_search_engine_tracker_set_query (NautilusSearchEngine *engine, NautilusQuery *query)
|
||||
{
|
||||
|
@ -353,7 +347,6 @@ nautilus_search_engine_tracker_class_init (NautilusSearchEngineTrackerClass *cla
|
|||
engine_class->set_query = nautilus_search_engine_tracker_set_query;
|
||||
engine_class->start = nautilus_search_engine_tracker_start;
|
||||
engine_class->stop = nautilus_search_engine_tracker_stop;
|
||||
engine_class->is_indexed = nautilus_search_engine_tracker_is_indexed;
|
||||
|
||||
g_type_class_add_private (class, sizeof (NautilusSearchEngineTrackerDetails));
|
||||
}
|
||||
|
|
|
@ -167,15 +167,6 @@ nautilus_search_engine_stop (NautilusSearchEngine *engine)
|
|||
NAUTILUS_SEARCH_ENGINE_GET_CLASS (engine)->stop (engine);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nautilus_search_engine_is_indexed (NautilusSearchEngine *engine)
|
||||
{
|
||||
g_return_val_if_fail (NAUTILUS_IS_SEARCH_ENGINE (engine), FALSE);
|
||||
g_return_val_if_fail (NAUTILUS_SEARCH_ENGINE_GET_CLASS (engine)->is_indexed != NULL, FALSE);
|
||||
|
||||
return NAUTILUS_SEARCH_ENGINE_GET_CLASS (engine)->is_indexed (engine);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_search_engine_hits_added (NautilusSearchEngine *engine, GList *hits)
|
||||
{
|
||||
|
|
|
@ -48,7 +48,6 @@ typedef struct {
|
|||
void (*set_query) (NautilusSearchEngine *engine, NautilusQuery *query);
|
||||
void (*start) (NautilusSearchEngine *engine);
|
||||
void (*stop) (NautilusSearchEngine *engine);
|
||||
gboolean (*is_indexed) (NautilusSearchEngine *engine);
|
||||
|
||||
/* Signals */
|
||||
void (*hits_added) (NautilusSearchEngine *engine, GList *hits);
|
||||
|
@ -65,7 +64,6 @@ NautilusSearchEngine* nautilus_search_engine_new (void);
|
|||
void nautilus_search_engine_set_query (NautilusSearchEngine *engine, NautilusQuery *query);
|
||||
void nautilus_search_engine_start (NautilusSearchEngine *engine);
|
||||
void nautilus_search_engine_stop (NautilusSearchEngine *engine);
|
||||
gboolean nautilus_search_engine_is_indexed (NautilusSearchEngine *engine);
|
||||
|
||||
void nautilus_search_engine_hits_added (NautilusSearchEngine *engine, GList *hits);
|
||||
void nautilus_search_engine_hits_subtracted (NautilusSearchEngine *engine, GList *hits);
|
||||
|
|
|
@ -63,7 +63,6 @@ typedef struct {
|
|||
} NautilusQueryEditorRowOps;
|
||||
|
||||
struct NautilusQueryEditorDetails {
|
||||
gboolean is_indexed;
|
||||
GtkWidget *entry;
|
||||
gboolean change_frozen;
|
||||
guint typing_timeout_id;
|
||||
|
@ -1013,10 +1012,8 @@ nautilus_query_editor_init (NautilusQueryEditor *editor)
|
|||
void
|
||||
nautilus_query_editor_set_default_query (NautilusQueryEditor *editor)
|
||||
{
|
||||
if (!editor->details->is_indexed) {
|
||||
nautilus_query_editor_add_row (editor, NAUTILUS_QUERY_EDITOR_ROW_LOCATION);
|
||||
nautilus_query_editor_changed (editor);
|
||||
}
|
||||
nautilus_query_editor_add_row (editor, NAUTILUS_QUERY_EDITOR_ROW_LOCATION);
|
||||
nautilus_query_editor_changed (editor);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1040,22 +1037,20 @@ finish_first_line (NautilusQueryEditor *editor, GtkWidget *hbox, gboolean use_go
|
|||
gtk_widget_set_tooltip_text (button,
|
||||
_("Add a new criterion to this search"));
|
||||
|
||||
if (!editor->details->is_indexed) {
|
||||
if (use_go) {
|
||||
button = gtk_button_new_with_label (_("Go"));
|
||||
} else {
|
||||
button = gtk_button_new_with_label (_("Reload"));
|
||||
}
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_set_tooltip_text (button,
|
||||
_("Perform or update the search"));
|
||||
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (go_search_cb), editor);
|
||||
|
||||
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
if (use_go) {
|
||||
button = gtk_button_new_with_label (_("Go"));
|
||||
} else {
|
||||
button = gtk_button_new_with_label (_("Reload"));
|
||||
}
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_set_tooltip_text (button,
|
||||
_("Perform or update the search"));
|
||||
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (go_search_cb), editor);
|
||||
|
||||
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1161,7 +1156,7 @@ nautilus_query_editor_changed_force (NautilusQueryEditor *editor, gboolean force
|
|||
if (query_is_valid (editor)) {
|
||||
query = nautilus_query_editor_get_query (editor);
|
||||
g_signal_emit (editor, signals[CHANGED], 0,
|
||||
query, editor->details->is_indexed || force_reload);
|
||||
query, force_reload);
|
||||
g_object_unref (query);
|
||||
}
|
||||
}
|
||||
|
@ -1224,15 +1219,11 @@ nautilus_query_editor_clear_query (NautilusQueryEditor *editor)
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
nautilus_query_editor_new (gboolean start_hidden,
|
||||
gboolean is_indexed)
|
||||
nautilus_query_editor_new (gboolean start_hidden)
|
||||
{
|
||||
GtkWidget *editor;
|
||||
|
||||
editor = g_object_new (NAUTILUS_TYPE_QUERY_EDITOR, NULL);
|
||||
|
||||
NAUTILUS_QUERY_EDITOR (editor)->details->is_indexed = is_indexed;
|
||||
|
||||
nautilus_query_editor_set_visible (NAUTILUS_QUERY_EDITOR (editor),
|
||||
!start_hidden);
|
||||
|
||||
|
@ -1276,7 +1267,6 @@ attach_to_external_entry (NautilusQueryEditor *editor)
|
|||
|
||||
GtkWidget*
|
||||
nautilus_query_editor_new_with_bar (gboolean start_hidden,
|
||||
gboolean is_indexed,
|
||||
gboolean start_attached,
|
||||
NautilusSearchBar *bar,
|
||||
NautilusWindowSlot *slot)
|
||||
|
@ -1285,8 +1275,6 @@ nautilus_query_editor_new_with_bar (gboolean start_hidden,
|
|||
NautilusQueryEditor *editor;
|
||||
|
||||
editor = NAUTILUS_QUERY_EDITOR (g_object_new (NAUTILUS_TYPE_QUERY_EDITOR, NULL));
|
||||
editor->details->is_indexed = is_indexed;
|
||||
|
||||
nautilus_query_editor_set_visible (editor, !start_hidden);
|
||||
|
||||
editor->details->bar = bar;
|
||||
|
|
|
@ -61,10 +61,8 @@ typedef struct {
|
|||
#include "nautilus-window-slot.h"
|
||||
|
||||
GType nautilus_query_editor_get_type (void);
|
||||
GtkWidget* nautilus_query_editor_new (gboolean start_hidden,
|
||||
gboolean is_indexed);
|
||||
GtkWidget* nautilus_query_editor_new (gboolean start_hidden);
|
||||
GtkWidget* nautilus_query_editor_new_with_bar (gboolean start_hidden,
|
||||
gboolean is_indexed,
|
||||
gboolean start_attached,
|
||||
NautilusSearchBar *bar,
|
||||
NautilusWindowSlot *slot);
|
||||
|
|
|
@ -150,30 +150,28 @@ search_bar_activate_callback (NautilusSearchBar *bar,
|
|||
|
||||
uri = nautilus_search_directory_generate_new_uri ();
|
||||
location = g_file_new_for_uri (uri);
|
||||
g_free (uri);
|
||||
|
||||
directory = nautilus_directory_get (location);
|
||||
|
||||
g_assert (NAUTILUS_IS_SEARCH_DIRECTORY (directory));
|
||||
|
||||
search_directory = NAUTILUS_SEARCH_DIRECTORY (directory);
|
||||
|
||||
query = nautilus_search_bar_get_query (NAUTILUS_SEARCH_BAR (pane->search_bar));
|
||||
|
||||
if (query != NULL) {
|
||||
NautilusWindowSlot *slot = pane->active_slot;
|
||||
if (!nautilus_search_directory_is_indexed (search_directory)) {
|
||||
current_uri = nautilus_window_slot_get_location_uri (slot);
|
||||
nautilus_query_set_location (query, current_uri);
|
||||
g_free (current_uri);
|
||||
}
|
||||
current_uri = nautilus_window_slot_get_location_uri (pane->active_slot);
|
||||
|
||||
nautilus_query_set_location (query, current_uri);
|
||||
nautilus_search_directory_set_query (search_directory, query);
|
||||
|
||||
g_free (current_uri);
|
||||
g_object_unref (query);
|
||||
}
|
||||
|
||||
nautilus_window_slot_go_to (pane->active_slot, location, FALSE);
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
g_object_unref (location);
|
||||
g_object_unref (location);
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -85,12 +85,10 @@ real_update_query_editor (NautilusWindowSlot *slot)
|
|||
search_directory = NAUTILUS_SEARCH_DIRECTORY (directory);
|
||||
|
||||
if (nautilus_search_directory_is_saved_search (search_directory)) {
|
||||
query_editor = nautilus_query_editor_new (TRUE,
|
||||
nautilus_search_directory_is_indexed (search_directory));
|
||||
query_editor = nautilus_query_editor_new (TRUE);
|
||||
nautilus_window_pane_sync_search_widgets (slot->pane);
|
||||
} else {
|
||||
query_editor = nautilus_query_editor_new_with_bar (FALSE,
|
||||
nautilus_search_directory_is_indexed (search_directory),
|
||||
slot->pane->window->details->active_pane->active_slot == slot,
|
||||
NAUTILUS_SEARCH_BAR (slot->pane->search_bar),
|
||||
slot);
|
||||
|
|
Loading…
Reference in a new issue