summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build-aux/flatpak/org.gnome.Nautilus.json33
-rw-r--r--src/nautilus-search-popover.c46
-rw-r--r--src/resources/ui/nautilus-search-popover.ui32
3 files changed, 60 insertions, 51 deletions
diff --git a/build-aux/flatpak/org.gnome.Nautilus.json b/build-aux/flatpak/org.gnome.Nautilus.json
index 9ebd32019..dda328646 100644
--- a/build-aux/flatpak/org.gnome.Nautilus.json
+++ b/build-aux/flatpak/org.gnome.Nautilus.json
@@ -157,6 +157,39 @@
]
},
{
+ "name" : "libsass",
+ "buildsystem" : "meson",
+ "sources" : [
+ {
+ "type" : "git",
+ "url" : "https://github.com/lazka/libsass.git",
+ "branch" : "meson"
+ }
+ ]
+ },
+ {
+ "name" : "sassc",
+ "buildsystem" : "meson",
+ "sources" : [
+ {
+ "type" : "git",
+ "url" : "https://github.com/lazka/sassc.git",
+ "branch" : "meson"
+ }
+ ]
+ },
+ {
+ "name": "libadwaita",
+ "buildsystem": "meson",
+ "sources": [
+ {
+ "type": "git",
+ "url": "https://gitlab.gnome.org/msandova/libadwaita.git",
+ "branch": "adw-toggles"
+ }
+ ]
+ },
+ {
"buildsystem": "meson",
"run-tests": true,
"builddir": true,
diff --git a/src/nautilus-search-popover.c b/src/nautilus-search-popover.c
index 2282dc38d..03b6395b1 100644
--- a/src/nautilus-search-popover.c
+++ b/src/nautilus-search-popover.c
@@ -46,8 +46,7 @@ struct _NautilusSearchPopover
GtkWidget *last_used_button;
GtkWidget *last_modified_button;
GtkWidget *created_button;
- GtkWidget *full_text_search_button;
- GtkWidget *filename_search_button;
+ GtkWidget *search_toggles;
NautilusQuery *query;
GtkSingleSelection *other_types_model;
@@ -84,6 +83,9 @@ enum
static guint signals[LAST_SIGNAL];
+const char *SEARCH_ID_FULL_TEXT = "full-text";
+const char *SEARCH_ID_FILE_NAME = "file-name";
+
/* Callbacks */
static void
@@ -356,23 +358,15 @@ search_time_type_changed (GtkCheckButton *button,
}
static void
-search_fts_mode_changed (GtkToggleButton *button,
+search_fts_mode_changed (AdwToggleGroup *toggle_group,
+ GParamSpec *pspec,
NautilusSearchPopover *popover)
{
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (popover->full_text_search_button)) &&
- popover->fts_enabled == FALSE)
- {
- popover->fts_enabled = TRUE;
- g_settings_set_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_FTS_ENABLED, TRUE);
- g_object_notify (G_OBJECT (popover), "fts-enabled");
- }
- else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (popover->filename_search_button)) &&
- popover->fts_enabled == TRUE)
- {
- popover->fts_enabled = FALSE;
- g_settings_set_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_FTS_ENABLED, FALSE);
- g_object_notify (G_OBJECT (popover), "fts-enabled");
- }
+ gboolean fts_enabled;
+
+ fts_enabled = g_str_equal (adw_toggle_group_get_active (toggle_group), SEARCH_ID_FULL_TEXT);
+ g_settings_set_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_FTS_ENABLED, fts_enabled);
+ g_object_notify (G_OBJECT (popover), "fts-enabled");
}
/* Auxiliary methods */
@@ -735,8 +729,10 @@ void
nautilus_search_popover_set_fts_sensitive (NautilusSearchPopover *popover,
gboolean sensitive)
{
- gtk_widget_set_sensitive (popover->full_text_search_button, sensitive);
- gtk_widget_set_sensitive (popover->filename_search_button, sensitive);
+ adw_toggle_group_set_enabled (ADW_TOGGLE_GROUP (popover->search_toggles),
+ SEARCH_ID_FULL_TEXT, sensitive);
+ adw_toggle_group_set_enabled (ADW_TOGGLE_GROUP (popover->search_toggles),
+ SEARCH_ID_FILE_NAME, sensitive);
}
static void
@@ -914,8 +910,7 @@ nautilus_search_popover_class_init (NautilusSearchPopoverClass *klass)
gtk_widget_class_bind_template_child (widget_class, NautilusSearchPopover, last_used_button);
gtk_widget_class_bind_template_child (widget_class, NautilusSearchPopover, last_modified_button);
gtk_widget_class_bind_template_child (widget_class, NautilusSearchPopover, created_button);
- gtk_widget_class_bind_template_child (widget_class, NautilusSearchPopover, full_text_search_button);
- gtk_widget_class_bind_template_child (widget_class, NautilusSearchPopover, filename_search_button);
+ gtk_widget_class_bind_template_child (widget_class, NautilusSearchPopover, search_toggles);
gtk_widget_class_bind_template_callback (widget_class, calendar_day_selected);
gtk_widget_class_bind_template_callback (widget_class, clear_date_button_clicked);
@@ -934,6 +929,9 @@ nautilus_search_popover_init (NautilusSearchPopover *self)
{
NautilusQuerySearchType filter_time_type;
+ self->fts_enabled = g_settings_get_boolean (nautilus_preferences,
+ NAUTILUS_PREFERENCES_FTS_ENABLED);
+
gtk_widget_init_template (GTK_WIDGET (self));
/* Fuzzy dates listbox */
@@ -975,15 +973,13 @@ nautilus_search_popover_init (NautilusSearchPopover *self)
gtk_check_button_set_active (GTK_CHECK_BUTTON (self->created_button), TRUE);
}
- self->fts_enabled = g_settings_get_boolean (nautilus_preferences,
- NAUTILUS_PREFERENCES_FTS_ENABLED);
if (self->fts_enabled)
{
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->full_text_search_button), TRUE);
+ adw_toggle_group_set_active (ADW_TOGGLE_GROUP (self->search_toggles), SEARCH_ID_FULL_TEXT);
}
else
{
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->filename_search_button), TRUE);
+ adw_toggle_group_set_active (ADW_TOGGLE_GROUP (self->search_toggles), SEARCH_ID_FILE_NAME);
}
}
diff --git a/src/resources/ui/nautilus-search-popover.ui b/src/resources/ui/nautilus-search-popover.ui
index 889da8b34..7b86f91e1 100644
--- a/src/resources/ui/nautilus-search-popover.ui
+++ b/src/resources/ui/nautilus-search-popover.ui
@@ -286,30 +286,12 @@
</object>
</child>
<child>
- <object class="GtkBox">
- <property name="hexpand">True</property>
- <child>
- <object class="GtkToggleButton" id="full_text_search_button">
- <property name="label" translatable="yes">Full Text</property>
- <property name="tooltip_text" translatable="yes">Search Inside Files</property>
- <property name="hexpand">True</property>
- <property name="active">True</property>
- <signal name="toggled" handler="search_fts_mode_changed" object="NautilusSearchPopover" swapped="no" />
- </object>
- </child>
- <child>
- <object class="GtkToggleButton" id="filename_search_button">
- <property name="label" translatable="yes">File Name</property>
- <property name="tooltip_text" translatable="yes">Don't Search Inside Files</property>
- <property name="hexpand">True</property>
- <property name="group">full_text_search_button</property>
- <property name="active">True</property>
- <signal name="toggled" handler="search_fts_mode_changed" object="NautilusSearchPopover" swapped="no"/>
- </object>
- </child>
- <style>
- <class name="linked"/>
- </style>
+ <object class="AdwToggleGroup" id="search_toggles">
+ <signal name="notify::active" handler="search_fts_mode_changed" object="NautilusSearchPopover" swapped="no"/>
+ <toggles>
+ <toggle id="full-text" translatable="yes">Full Text</toggle>
+ <toggle id="file-name" translatable="yes">File Name</toggle>
+ </toggles>
<layout>
<property name="column">0</property>
<property name="row">6</property>
@@ -323,8 +305,6 @@
<object class="GtkSizeGroup">
<property name="mode">vertical</property>
<widgets>
- <widget name="full_text_search_button"/>
- <widget name="filename_search_button"/>
<widget name="select_date_button"/>
<widget name="clear_date_button"/>
</widgets>