file chooser: Note when searching remote locations

Inform the user that we won't search recursively when searching
in remote locations.
This commit is contained in:
Matthias Clasen 2015-07-24 16:26:32 -04:00
parent eee85d39e5
commit 49a596aa52
2 changed files with 104 additions and 79 deletions

View File

@ -216,6 +216,7 @@ struct _GtkFileChooserWidgetPrivate {
GtkWidget *browse_files_stack; GtkWidget *browse_files_stack;
GtkWidget *browse_files_swin; GtkWidget *browse_files_swin;
GtkWidget *browse_files_tree_view; GtkWidget *browse_files_tree_view;
GtkWidget *remote_warning_bar;
GtkWidget *browse_files_popover; GtkWidget *browse_files_popover;
GtkWidget *add_shortcut_item; GtkWidget *add_shortcut_item;
@ -3024,6 +3025,7 @@ operation_mode_stop (GtkFileChooserWidget *impl,
g_clear_object (&impl->priv->model_for_search); g_clear_object (&impl->priv->model_for_search);
search_stop_searching (impl, TRUE); search_stop_searching (impl, TRUE);
search_clear_model (impl, TRUE); search_clear_model (impl, TRUE);
gtk_widget_hide (impl->priv->remote_warning_bar);
} }
} }
@ -7223,6 +7225,9 @@ search_start_query (GtkFileChooserWidget *impl,
G_CALLBACK (search_engine_error_cb), impl); G_CALLBACK (search_engine_error_cb), impl);
_gtk_search_engine_start (priv->search_engine); _gtk_search_engine_start (priv->search_engine);
if (_gtk_file_consider_as_remote (gtk_query_get_location (priv->search_query)))
gtk_widget_show (priv->remote_warning_bar);
} }
/* Callback used when the user presses Enter while typing on the search /* Callback used when the user presses Enter while typing on the search
@ -8352,6 +8357,7 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, rename_file_rename_button); gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, rename_file_rename_button);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, rename_file_error_label); gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, rename_file_error_label);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, rename_file_popover); gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, rename_file_popover);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, remote_warning_bar);
/* And a *lot* of callbacks to bind ... */ /* And a *lot* of callbacks to bind ... */
gtk_widget_class_bind_template_callback (widget_class, browse_files_key_press_event_cb); gtk_widget_class_bind_template_callback (widget_class, browse_files_key_press_event_cb);

View File

@ -151,6 +151,10 @@
<style> <style>
<class name="view"/> <class name="view"/>
</style> </style>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child> <child>
<object class="GtkScrolledWindow" id="browse_files_swin"> <object class="GtkScrolledWindow" id="browse_files_swin">
<property name="visible">True</property> <property name="visible">True</property>
@ -246,6 +250,21 @@
</object> </object>
</child> </child>
</object> </object>
<packing>
<property name="expand">True</property>
</packing>
</child>
<child>
<object class="GtkActionBar" id="remote_warning_bar">
<child type="center">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Remote location — only searching the current folder</property>
</object>
</child>
</object>
</child>
</object>
<packing> <packing>
<property name="name">list</property> <property name="name">list</property>
</packing> </packing>
@ -253,7 +272,7 @@
<child> <child>
<object class="GtkPlacesView" id="places_view"> <object class="GtkPlacesView" id="places_view">
<property name="visible">True</property> <property name="visible">True</property>
<property name="local_only" bind-source="GtkFileChooserWidget" bind-property="local-only" bind-flags="default|sync-create" /> <property name="local_only" bind-source="GtkFileChooserWidget" bind-property="local-only" bind-flags="default|sync-create"/>
<signal name="open-location" handler="places_sidebar_open_location_cb" swapped="no"/> <signal name="open-location" handler="places_sidebar_open_location_cb" swapped="no"/>
<signal name="show-error-message" handler="places_sidebar_show_error_message_cb" swapped="no"/> <signal name="show-error-message" handler="places_sidebar_show_error_message_cb" swapped="no"/>
</object> </object>