file chooser: More search rework

Drop the radio buttons for current location vs everywhere, and
always search in the current location.
This commit is contained in:
Matthias Clasen 2015-06-26 20:02:31 -04:00
parent 1f96f351e0
commit 7e45b09c8e
2 changed files with 3 additions and 37 deletions

View File

@ -242,7 +242,6 @@ struct _GtkFileChooserWidgetPrivate {
/* OPERATION_MODE_SEARCH */
GtkWidget *search_entry;
GtkWidget *current_location_radio;
GtkSearchEngine *search_engine;
GtkQuery *search_query;
GtkFileSystemModel *search_model;
@ -2542,7 +2541,6 @@ static void
operation_mode_set_search (GtkFileChooserWidget *impl)
{
GtkFileChooserWidgetPrivate *priv = impl->priv;
gchar *current;
g_assert (priv->search_model == NULL);
@ -2554,12 +2552,6 @@ operation_mode_set_search (GtkFileChooserWidget *impl)
gtk_entry_grab_focus_without_selecting (GTK_ENTRY (priv->search_entry));
gtk_places_sidebar_set_location (GTK_PLACES_SIDEBAR (priv->places_sidebar), NULL);
gtk_widget_set_sensitive (priv->filter_combo, FALSE);
if (priv->current_folder)
current = g_file_get_basename (priv->current_folder);
else
current = g_strdup (_("Home"));
gtk_button_set_label (GTK_BUTTON (priv->current_location_radio), current);
g_free (current);
gtk_tree_view_column_set_visible (priv->list_location_column, TRUE);
}
@ -6302,8 +6294,7 @@ search_start_query (GtkFileChooserWidget *impl,
gtk_query_set_text (priv->search_query, query_text);
}
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->current_location_radio)) &&
priv->current_folder)
if (priv->current_folder)
{
gchar *location;
location = g_file_get_uri (priv->current_folder);
@ -7508,7 +7499,6 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, extra_and_filters);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, location_entry_box);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, search_entry);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, current_location_radio);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, list_name_column);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, list_pixbuf_renderer);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, list_name_renderer);

View File

@ -103,38 +103,14 @@
<property name="no-show-all">True</property>
<property name="spacing">6</property>
<property name="border_width">6</property>
<child>
<child type="center">
<object class="GtkSearchEntry" id="search_entry">
<property name="visible">True</property>
<property name="hexpand">True</property>
<property name="width-chars">45</property>
<signal name="search-changed" handler="search_entry_activate_cb" swapped="yes"/>
<signal name="stop-search" handler="search_entry_stop_cb" swapped="yes"/>
</object>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkRadioButton" id="current_location_radio">
<property name="visible">True</property>
<property name="draw-indicator">False</property>
<property name="label" translatable="yes">Home</property>
<signal name="toggled" handler="search_entry_activate_cb" swapped="yes"/>
</object>
</child>
<child>
<object class="GtkRadioButton">
<property name="visible">True</property>
<property name="draw-indicator">False</property>
<property name="group">current_location_radio</property>
<property name="label" translatable="yes">All Files</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="name">search</property>