[gtk+/wip/matthiasc/filechooser: 5/13] file chooser: Add a button to close the location entry



commit f12fc2f1d024383b4036bb269f3a77c61b6a22ac
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 26 21:39:50 2015 -0400

    file chooser: Add a button to close the location entry
    
    This follows the latest mockups.

 gtk/gtkfilechooserwidget.c     |    7 +++++++
 gtk/ui/gtkfilechooserwidget.ui |   21 ++++++++++++++++++++-
 2 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 064c258..61ee109 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -2223,6 +2223,12 @@ location_mode_set (GtkFileChooserWidget *impl,
   g_object_notify (G_OBJECT (impl), "subtitle");
 }
 
+static void
+location_entry_close_clicked (GtkFileChooserWidget *impl)
+{
+  location_mode_set (impl, LOCATION_MODE_PATH_BAR);
+}
+
 /* Callback used when the places sidebar needs us to enter a location */
 static void
 places_sidebar_show_enter_location_cb (GtkPlacesSidebar *sidebar,
@@ -7581,6 +7587,7 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
   gtk_widget_class_bind_template_callback (widget_class, new_folder_popover_active);
   gtk_widget_class_bind_template_callback (widget_class, new_folder_name_changed);
   gtk_widget_class_bind_template_callback (widget_class, new_folder_create_clicked);
+  gtk_widget_class_bind_template_callback (widget_class, location_entry_close_clicked);
 }
 
 static void
diff --git a/gtk/ui/gtkfilechooserwidget.ui b/gtk/ui/gtkfilechooserwidget.ui
index 02a287a..b391ab1 100644
--- a/gtk/ui/gtkfilechooserwidget.ui
+++ b/gtk/ui/gtkfilechooserwidget.ui
@@ -90,8 +90,27 @@
                               <object class="GtkBox" id="location_entry_box">
                                 <property name="visible">True</property>
                                 <property name="no-show-all">True</property>
-                                <property name="spacing">6</property>
                                 <property name="border_width">6</property>
+                                <style>
+                                  <class name="linked"/>
+                                </style>
+                                <child>
+                                  <object class="GtkButton" id="location_entry_close">
+                                    <property name="visible">True</property>
+                                    <property name="focus-on-click">False</property>
+                                    <signal name="clicked" handler="location_entry_close_clicked" 
swapped="yes"/>
+                                    <child>
+                                      <object class="GtkImage">
+                                        <property name="visible">True</property>
+                                        <property name="icon-name">window-close-symbolic</property>
+                                        <property name="icon-size">1</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                  <packing>
+                                    <property name="pack-type">end</property>
+                                  </packing>
+                                </child>
                               </object>
                               <packing>
                                 <property name="name">location</property>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]