[gtk+/wip/gbsneto/placessidebar-locations] filechooserwidget: use GtkPlacesView to display devices
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/gbsneto/placessidebar-locations] filechooserwidget: use GtkPlacesView to display devices
- Date: Sun, 7 Jun 2015 21:52:56 +0000 (UTC)
commit 8f749aa5e6620af886e39add58f354fd24050e5e
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun Jun 7 18:50:58 2015 -0300
filechooserwidget: use GtkPlacesView to display devices
Following the previous commits, make GtkFileChooserWidget use
the brand new GtkPlacesView to display local drives when "Other
Locations" is clicked.
For the sake of testing, GtkPlacesView::local-only property is set
to FALSE.
gtk/gtkfilechooserwidget.c | 15 +++++++++++++++
gtk/ui/gtkfilechooserwidget.ui | 12 ++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 22515da..c3d5dc0 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -2214,6 +2214,20 @@ places_sidebar_show_enter_location_cb (GtkPlacesSidebar *sidebar,
operation_mode_set (impl, OPERATION_MODE_ENTER_LOCATION);
}
+/* 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;
+
+ gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_files_stack), "other_locations");
+
+ priv->preview_widget_active = FALSE;
+ gtk_widget_hide (GTK_WIDGET (priv->browse_header_box));
+ update_preview_widget_visibility (impl);
+}
+
static void
location_toggle_popup_handler (GtkFileChooserWidget *impl)
{
@@ -7544,6 +7558,7 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
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_enter_location_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 00349fb..4f7c7e3 100644
--- a/gtk/ui/gtkfilechooserwidget.ui
+++ b/gtk/ui/gtkfilechooserwidget.ui
@@ -19,12 +19,14 @@
<property name="hscrollbar_policy">never</property>
<property name="local_only">True</property>
<property name="show_enter_location">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-enter-location" handler="places_sidebar_show_enter_location_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,16 @@
</packing>
</child>
<child>
+ <object class="GtkPlacesView" id="other_files_view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <signal name="open-location" handler="places_sidebar_open_location_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]