[gtk+/wip/gbsneto/other-locations: 3/3] filechooserwidget: use places view to manage fixed devices
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/gbsneto/other-locations: 3/3] filechooserwidget: use places view to manage fixed devices
- Date: Fri, 10 Jul 2015 00:01:23 +0000 (UTC)
commit ec67564cb37acd3c3fc2baf29c08b362415c73c6
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Jul 9 20:44:28 2015 -0300
filechooserwidget: use places view to manage fixed devices
Previous patch modified places sidebar widget to stop handling
fixed devices by adding an "Other Locations..." item. Up to now,
however, these changes are isolated from each other since the
bundled file manager widgets ignore the sidebar requests for
external management of fixed devices and networks.
To fix that, make the file chooser widget be aware of the
GtkPlacesSidebar::show-other-locations signal and, when requested,
show places view to manage the fixed devices and networks.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
gtk/gtkfilechooserwidget.c | 21 +++++++++++++++++++++
gtk/ui/gtkfilechooserwidget.ui | 14 ++++++++++++++
2 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 3e943b7..de93613 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -56,6 +56,7 @@
#include "gtkpathbar.h"
#include "gtkplacessidebar.h"
#include "gtkplacessidebarprivate.h"
+#include "gtkplacesviewprivate.h"
#include "gtkprivate.h"
#include "gtkrecentmanager.h"
#include "gtkscrolledwindow.h"
@@ -256,6 +257,7 @@ struct _GtkFileChooserWidgetPrivate {
char *browse_files_last_selected_name;
GtkWidget *places_sidebar;
+ GtkWidget *places_view;
StartupMode startup_mode;
/* OPERATION_MODE_SEARCH */
@@ -2738,6 +2740,22 @@ location_mode_set (GtkFileChooserWidget *impl,
g_object_notify (G_OBJECT (impl), "subtitle");
}
+/* Callback used when the places sidebar asks us to show other locations */
+static void
+places_sidebar_show_other_locations_cb (GtkPlacesSidebar *sidebar,
+ GtkFileChooserWidget *impl)
+{
+ GtkFileChooserWidgetPrivate *priv = impl->priv;
+
+ priv->preview_widget_active = FALSE;
+
+ gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_files_stack), "other_locations");
+ gtk_revealer_set_reveal_child (GTK_REVEALER (priv->browse_header_revealer), FALSE);
+ gtk_widget_set_sensitive (priv->filter_combo, FALSE);
+
+ update_preview_widget_visibility (impl);
+}
+
static void
location_toggle_popup_handler (GtkFileChooserWidget *impl)
{
@@ -3043,6 +3061,7 @@ operation_mode_set_search (GtkFileChooserWidget *impl)
g_assert (priv->search_model == NULL);
+ gtk_places_sidebar_set_location (GTK_PLACES_SIDEBAR (priv->places_sidebar), priv->current_folder);
gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_files_stack), "list");
gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_header_stack), "search");
gtk_revealer_set_reveal_child (GTK_REVEALER (priv->browse_header_revealer), TRUE);
@@ -8246,6 +8265,7 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_widgets_hpaned);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_files_stack);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, places_sidebar);
+ gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, places_view);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_files_tree_view);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_header_revealer);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_header_stack);
@@ -8296,6 +8316,7 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
gtk_widget_class_bind_template_callback (widget_class, path_bar_clicked);
gtk_widget_class_bind_template_callback (widget_class, places_sidebar_open_location_cb);
gtk_widget_class_bind_template_callback (widget_class, places_sidebar_show_error_message_cb);
+ gtk_widget_class_bind_template_callback (widget_class, places_sidebar_show_other_locations_cb);
gtk_widget_class_bind_template_callback (widget_class, search_entry_activate_cb);
gtk_widget_class_bind_template_callback (widget_class, search_entry_stop_cb);
gtk_widget_class_bind_template_callback (widget_class, new_folder_popover_active);
diff --git a/gtk/ui/gtkfilechooserwidget.ui b/gtk/ui/gtkfilechooserwidget.ui
index 8389bff..c6b03e7 100644
--- a/gtk/ui/gtkfilechooserwidget.ui
+++ b/gtk/ui/gtkfilechooserwidget.ui
@@ -17,11 +17,13 @@
<property name="can_focus">False</property>
<property name="hscrollbar_policy">never</property>
<property name="local_only">True</property>
+ <property name="show_other_locations">True</property>
<style>
<class name="sidebar"/>
</style>
<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-other-locations" handler="places_sidebar_show_other_locations_cb"
swapped="no"/>
</object>
<packing>
<property name="resize">False</property>
@@ -240,6 +242,18 @@
</packing>
</child>
<child>
+ <object class="GtkPlacesView" id="places_view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <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="show-error-message" handler="places_sidebar_show_error_message_cb"
swapped="no"/>
+ </object>
+ <packing>
+ <property name="name">other_locations</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="row_spacing">12</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]