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

@ -152,95 +152,114 @@
<class name="view"/> <class name="view"/>
</style> </style>
<child> <child>
<object class="GtkScrolledWindow" id="browse_files_swin"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="hscrollbar_policy">never</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkTreeView" id="browse_files_tree_view"> <object class="GtkScrolledWindow" id="browse_files_swin">
<property name="visible">True</property> <property name="visible">True</property>
<property name="has_tooltip">True</property> <property name="hscrollbar_policy">never</property>
<property name="enable-search">False</property>
<child internal-child="accessible">
<object class="AtkObject" id="browse_files_tree_view-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Files</property>
</object>
</child>
<signal name="button-press-event" handler="list_button_press_event_cb" swapped="no"/>
<signal name="drag-data-received" handler="file_list_drag_data_received_cb" swapped="no"/>
<signal name="drag-drop" handler="file_list_drag_drop_cb" swapped="no"/>
<signal name="drag-begin" handler="file_list_drag_begin_cb" swapped="no"/>
<signal name="drag-motion" handler="file_list_drag_motion_cb" swapped="no"/>
<signal name="drag-end" handler="file_list_drag_end_cb" swapped="no"/>
<signal name="key-press-event" handler="browse_files_key_press_event_cb" swapped="no"/>
<signal name="popup-menu" handler="list_popup_menu_cb" swapped="no"/>
<signal name="query-tooltip" handler="file_list_query_tooltip_cb" swapped="no"/>
<signal name="row-activated" handler="list_row_activated" swapped="no"/>
<signal name="cursor-changed" handler="list_cursor_changed" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection2">
<signal name="changed" handler="list_selection_changed" swapped="no"/>
</object>
</child>
<child> <child>
<object class="GtkTreeViewColumn" id="list_name_column"> <object class="GtkTreeView" id="browse_files_tree_view">
<property name="title" translatable="yes">Name</property> <property name="visible">True</property>
<property name="resizable">True</property> <property name="has_tooltip">True</property>
<property name="expand">True</property> <property name="enable-search">False</property>
<child> <child internal-child="accessible">
<object class="GtkCellRendererPixbuf" id="list_pixbuf_renderer"> <object class="AtkObject" id="browse_files_tree_view-atkobject">
<property name="xpad">6</property> <property name="AtkObject::accessible-name" translatable="yes">Files</property>
</object>
</child>
<signal name="button-press-event" handler="list_button_press_event_cb" swapped="no"/>
<signal name="drag-data-received" handler="file_list_drag_data_received_cb" swapped="no"/>
<signal name="drag-drop" handler="file_list_drag_drop_cb" swapped="no"/>
<signal name="drag-begin" handler="file_list_drag_begin_cb" swapped="no"/>
<signal name="drag-motion" handler="file_list_drag_motion_cb" swapped="no"/>
<signal name="drag-end" handler="file_list_drag_end_cb" swapped="no"/>
<signal name="key-press-event" handler="browse_files_key_press_event_cb" swapped="no"/>
<signal name="popup-menu" handler="list_popup_menu_cb" swapped="no"/>
<signal name="query-tooltip" handler="file_list_query_tooltip_cb" swapped="no"/>
<signal name="row-activated" handler="list_row_activated" swapped="no"/>
<signal name="cursor-changed" handler="list_cursor_changed" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection2">
<signal name="changed" handler="list_selection_changed" swapped="no"/>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkCellRendererText" id="list_name_renderer"> <object class="GtkTreeViewColumn" id="list_name_column">
<property name="width-chars">10</property> <property name="title" translatable="yes">Name</property>
<property name="ellipsize">end</property> <property name="resizable">True</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererPixbuf" id="list_pixbuf_renderer">
<property name="xpad">6</property>
</object>
</child>
<child>
<object class="GtkCellRendererText" id="list_name_renderer">
<property name="width-chars">10</property>
<property name="ellipsize">end</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="list_location_column">
<property name="title" translatable="yes">Location</property>
<property name="resizable">True</property>
<property name="visible">False</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText" id="list_location_renderer">
<property name="xalign">0</property>
<property name="width-chars">10</property>
<property name="ellipsize">start</property>
<property name="xpad">6</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="list_size_column">
<property name="title" translatable="yes">Size</property>
<property name="sizing">fixed</property>
<child>
<object class="GtkCellRendererText" id="list_size_renderer">
<property name="xalign">0</property>
<property name="xpad">6</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="list_time_column">
<property name="title" translatable="yes">Modified</property>
<property name="sizing">fixed</property>
<child>
<object class="GtkCellRendererText" id="list_date_renderer">
<property name="xpad">6</property>
</object>
</child>
<child>
<object class="GtkCellRendererText" id="list_time_renderer">
<property name="xpad">6</property>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>
</child> </child>
<child> </object>
<object class="GtkTreeViewColumn" id="list_location_column"> <packing>
<property name="title" translatable="yes">Location</property> <property name="expand">True</property>
<property name="resizable">True</property> </packing>
<property name="visible">False</property> </child>
<property name="expand">True</property> <child>
<child> <object class="GtkActionBar" id="remote_warning_bar">
<object class="GtkCellRendererText" id="list_location_renderer"> <child type="center">
<property name="xalign">0</property> <object class="GtkLabel">
<property name="width-chars">10</property> <property name="visible">True</property>
<property name="ellipsize">start</property> <property name="label" translatable="yes">Remote location — only searching the current folder</property>
<property name="xpad">6</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="list_size_column">
<property name="title" translatable="yes">Size</property>
<property name="sizing">fixed</property>
<child>
<object class="GtkCellRendererText" id="list_size_renderer">
<property name="xalign">0</property>
<property name="xpad">6</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="list_time_column">
<property name="title" translatable="yes">Modified</property>
<property name="sizing">fixed</property>
<child>
<object class="GtkCellRendererText" id="list_date_renderer">
<property name="xpad">6</property>
</object>
</child>
<child>
<object class="GtkCellRendererText" id="list_time_renderer">
<property name="xpad">6</property>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>
@ -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>