In my previous patch, "adding a fulltext toggle button to search bar" I added fulltext search option to the search bar in browser mode. In this patch I include support for spatial mode as well. Daniel Lowengrub ---- diff --git a/src/nautilus-navigation-window-slot.c b/src/nautilus-navigation-window-slot.c index 74cde52..bf2871f 100644 --- a/src/nautilus-navigation-window-slot.c +++ b/src/nautilus-navigation-window-slot.c @@ -133,7 +133,6 @@ nautilus_navigation_window_slot_update_query_editor (NautilusWindowSlot *slot) navigation_window = NAUTILUS_NAVIGATION_WINDOW (slot->pane->window);
query_editor = NULL; - directory = nautilus_directory_get (slot->location); if (NAUTILUS_IS_SEARCH_DIRECTORY (directory)) { search_directory = NAUTILUS_SEARCH_DIRECTORY (directory); diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c index 24d0f02..3b69636 100644 --- a/src/nautilus-query-editor.c +++ b/src/nautilus-query-editor.c @@ -67,6 +67,7 @@ struct NautilusQueryEditorDetails { gboolean is_indexed; GtkWidget *entry; gboolean change_frozen; + gboolean fts_active; guint typing_timeout_id; gboolean is_visible; GtkWidget *invisible_vbox; @@ -1039,12 +1040,22 @@ finish_first_line (NautilusQueryEditor *editor, GtkWidget *hbox, gboolean use_go } } +static void fts_toggle_cb (GtkWidget *fts_button, NautilusQueryEditor *editor) +{ + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (fts_button))) { + editor->details->fts_active = TRUE; + } else { + editor->details->fts_active = FALSE; + } +} + static void setup_internal_entry (NautilusQueryEditor *editor) { GtkWidget *hbox, *label; + GtkWidget *fts_button; char *label_markup; - + /* Create visible part: */ hbox = gtk_hbox_new (FALSE, 6); gtk_widget_show (hbox); @@ -1061,12 +1072,18 @@ setup_internal_entry (NautilusQueryEditor *editor) gtk_label_set_mnemonic_widget (GTK_LABEL (label), editor->details->entry); gtk_box_pack_start (GTK_BOX (hbox), editor->details->entry, TRUE, TRUE, 0); + fts_button = gtk_toggle_button_new_with_label ("Fulltext"); + gtk_box_pack_start (GTK_BOX (hbox), fts_button, FALSE, TRUE, 0); + g_signal_connect (editor->details->entry, "activate", G_CALLBACK (entry_activate_cb), editor); g_signal_connect (editor->details->entry, "changed", G_CALLBACK (entry_changed_cb), editor); - gtk_widget_show (editor->details->entry); + g_signal_connect (G_OBJECT (fts_button), "toggled", + G_CALLBACK (fts_toggle_cb), editor); + gtk_widget_show (editor->details->entry); + gtk_widget_show (fts_button); finish_first_line (editor, hbox, TRUE); } @@ -1074,7 +1091,7 @@ static void setup_external_entry (NautilusQueryEditor *editor, GtkWidget *entry) { GtkWidget *hbox, *label; - + /* Create visible part: */ hbox = gtk_hbox_new (FALSE, 6); gtk_widget_show (hbox); @@ -1157,13 +1174,18 @@ nautilus_query_editor_get_query (NautilusQueryEditor *editor) GList *l; NautilusQueryEditorRow *row; gboolean fts_active; - + if (editor == NULL || editor->details == NULL || editor->details->entry == NULL) { return NULL; } query_text = gtk_entry_get_text (GTK_ENTRY (editor->details->entry)); - fts_active = nautilus_search_bar_get_fts (editor->details->bar); + + if (editor->details->bar != NULL) { /*if we're using an external search bar */ + fts_active = nautilus_search_bar_get_fts (editor->details->bar); + } else { /* we're using our own fts button */ + fts_active = editor->details->fts_active; + } /* Empty string is a NULL query */ if (query_text && query_text[0] == '\0') { -- nautilus-list mailing list nautilus-list@gnome.org http://mail.gnome.org/mailman/listinfo/nautilus-list