[gtk+/wip/gbsneto/placessidebar-locations: 3/3] filechooserwidget: use GtkPlacesView for internal devices



commit 7ce1d0e09ee0f2be1f1ddfe709cb079eb5103fbf
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Jun 10 08:16:16 2015 -0300

    filechooserwidget: use GtkPlacesView for internal devices

 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 232640c..ec03be0 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)
 {
@@ -7526,6 +7540,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 9af256a..3462c00 100644
--- a/gtk/ui/gtkfilechooserwidget.ui
+++ b/gtk/ui/gtkfilechooserwidget.ui
@@ -19,6 +19,7 @@
                 <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>
                 <property name="show_recent">True</property>
                 <style>
                   <class name="sidebar"/>
@@ -26,6 +27,7 @@
                 <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>
@@ -241,6 +243,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]