summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Pandelea <alexandru.pandelea@gmail.com>2017-06-17 15:44:31 +0300
committerAlexandru Pandelea <alexandru.pandelea@gmail.com>2017-06-17 16:39:55 +0300
commitc8204febdc9d151cc3d5babb9c211a04357afbac (patch)
treecdc9fe3f6389187254e41b1037dc61f68623f49f
parenta924c9395ddb85e8b129b9d0bec78634ec91d6f2 (diff)
downloadnautilus-wip/alexpandelea/fts.tar.gz
add preference for ftswip/alexpandelea/fts
-rw-r--r--data/org.gnome.nautilus.gschema.xml5
-rw-r--r--src/nautilus-files-view.c1
-rw-r--r--src/nautilus-global-preferences.h3
-rw-r--r--src/nautilus-preferences-window.c5
-rw-r--r--src/nautilus-search-engine-tracker.c2
-rw-r--r--src/nautilus-search-popover.c11
-rw-r--r--src/resources/ui/nautilus-preferences-window.ui30
7 files changed, 55 insertions, 2 deletions
diff --git a/data/org.gnome.nautilus.gschema.xml b/data/org.gnome.nautilus.gschema.xml
index e162ebb42..c4dedbc95 100644
--- a/data/org.gnome.nautilus.gschema.xml
+++ b/data/org.gnome.nautilus.gschema.xml
@@ -217,6 +217,11 @@
<summary>Enable new experimental views</summary>
<description>Whether to use the new experimental views using the latest GTK+ widgets to help giving feedback and shaping their future.</description>
</key>
+ <key type="b" name="fts-default">
+ <default>true</default>
+ <summary>Whether to have full text search as default when opening a new window/tab</summary>
+ <description>If set to true, then Nautilus will also match the file contents besides the name</description>
+ </key>
</schema>
<schema path="/org/gnome/nautilus/compression/" id="org.gnome.nautilus.compression" gettext-domain="nautilus">
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index b73ebbcdd..7c0177093 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -3095,6 +3095,7 @@ static char *
get_bulk_rename_tool ()
{
char *bulk_rename_tool;
+
g_settings_get (nautilus_preferences, NAUTILUS_PREFERENCES_BULK_RENAME_TOOL, "^ay", &bulk_rename_tool);
return g_strstrip (bulk_rename_tool);
}
diff --git a/src/nautilus-global-preferences.h b/src/nautilus-global-preferences.h
index 7e52f6c77..f508f7d97 100644
--- a/src/nautilus-global-preferences.h
+++ b/src/nautilus-global-preferences.h
@@ -177,6 +177,9 @@ typedef enum
#define NAUTILUS_PREFERENCES_SHOW_DELETE_PERMANENTLY "show-delete-permanently"
#define NAUTILUS_PREFERENCES_SHOW_CREATE_LINK "show-create-link"
+/* Full Text Search as default */
+#define NAUTILUS_PREFERENCES_FTS_DEFAULT "fts-default"
+
void nautilus_global_preferences_init (void);
extern GSettings *nautilus_preferences;
diff --git a/src/nautilus-preferences-window.c b/src/nautilus-preferences-window.c
index c4952e9bd..a6d2a013d 100644
--- a/src/nautilus-preferences-window.c
+++ b/src/nautilus-preferences-window.c
@@ -61,6 +61,8 @@
"automatic_decompression_checkbutton"
#define NAUTILUS_PREFERENCES_DIALOG_USE_NEW_VIEWS_WIDGET \
"use_new_views_checkbutton"
+#define NAUTILUS_PREFERENCES_DEFAULT_FTS \
+ "fts_checkbutton"
/* int enums */
#define NAUTILUS_PREFERENCES_DIALOG_THUMBNAIL_LIMIT_WIDGET \
@@ -506,6 +508,9 @@ static void nautilus_preferences_window_setup(GtkBuilder *builder,
bind_builder_bool (builder, nautilus_preferences,
NAUTILUS_PREFERENCES_DIALOG_USE_NEW_VIEWS_WIDGET,
NAUTILUS_PREFERENCES_USE_EXPERIMENTAL_VIEWS);
+ bind_builder_bool (builder, nautilus_preferences,
+ NAUTILUS_PREFERENCES_DEFAULT_FTS,
+ NAUTILUS_PREFERENCES_FTS_DEFAULT);
bind_builder_radio (
builder, nautilus_preferences, (const char **) click_behavior_components,
diff --git a/src/nautilus-search-engine-tracker.c b/src/nautilus-search-engine-tracker.c
index be455c7dc..8a9bcb014 100644
--- a/src/nautilus-search-engine-tracker.c
+++ b/src/nautilus-search-engine-tracker.c
@@ -422,7 +422,7 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider)
}
g_string_append (sparql, ")} ORDER BY DESC (fts:rank(?urn))");
-
+ g_message ("\n%s\n", sparql->str);
tracker->details->cancellable = g_cancellable_new ();
tracker_sparql_connection_query_async (tracker->details->connection,
sparql->str,
diff --git a/src/nautilus-search-popover.c b/src/nautilus-search-popover.c
index 493a3f151..12662c6c1 100644
--- a/src/nautilus-search-popover.c
+++ b/src/nautilus-search-popover.c
@@ -848,6 +848,7 @@ nautilus_search_popover_class_init (NautilusSearchPopoverClass *klass)
gtk_widget_class_bind_template_callback (widget_class, toggle_calendar_icon_clicked);
gtk_widget_class_bind_template_callback (widget_class, types_listbox_row_activated);
gtk_widget_class_bind_template_callback (widget_class, search_time_type_changed);
+
gtk_widget_class_bind_template_callback (widget_class, search_fts_mode_changed);
}
@@ -886,8 +887,16 @@ nautilus_search_popover_init (NautilusSearchPopover *self)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->last_used_button), TRUE);
}
+ self->fts_enabled = g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_FTS_DEFAULT);
+ if (self->fts_enabled)
+ {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->full_text_search_button), TRUE);
+ }
+ else
+ {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->filename_search_button), TRUE);
+ }
- self->fts_enabled = FALSE;
}
GtkWidget *
diff --git a/src/resources/ui/nautilus-preferences-window.ui b/src/resources/ui/nautilus-preferences-window.ui
index a8f15bc88..fcbffe088 100644
--- a/src/resources/ui/nautilus-preferences-window.ui
+++ b/src/resources/ui/nautilus-preferences-window.ui
@@ -1028,6 +1028,36 @@
<property name="position">4</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="fts_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Full Text Search:</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="fts_checkbutton">
+ <property name="label" translatable="yes">Set as _default</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>