[gtk+/pathbar: 4/8] Rename ::path-clicked to ::open-location for consistency with GtkPlacesSidebar



commit 2fca8c83b42c4dd372f441a82d4a76137d7d163b
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Apr 25 14:32:33 2013 -0500

    Rename ::path-clicked to ::open-location for consistency with GtkPlacesSidebar
    
    Eventually this signal will also pass an open-flags argument.
    
    Signed-off-by: Federico Mena Quintero <federico gnome org>

 gtk/gtkfilechooserdefault.c  |   22 +++++++++++-----------
 gtk/gtkfilechooserdefault.ui |    2 +-
 gtk/gtkpathbar.c             |   41 +++++++++++++++++++++++++++++++++--------
 gtk/gtkpathbar.h             |    8 ++++----
 4 files changed, 49 insertions(+), 24 deletions(-)
---
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index c6bea39..f867f6e 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -504,11 +504,11 @@ static void list_row_activated         (GtkTreeView           *tree_view,
                                        GtkTreeViewColumn     *column,
                                        GtkFileChooserDefault *impl);
 
-static void path_bar_clicked (GtkPathBar            *path_bar,
-                             GFile                 *file,
-                             GFile                 *child,
-                              gboolean               child_is_hidden,
-                              GtkFileChooserDefault *impl);
+static void path_bar_open_location_cb (GtkPathBar            *path_bar,
+                                      GFile                 *file,
+                                      GFile                 *child,
+                                      gboolean               child_is_hidden,
+                                      GtkFileChooserDefault *impl);
 
 static void update_cell_renderer_attributes (GtkFileChooserDefault *impl);
 
@@ -7014,11 +7014,11 @@ list_row_activated (GtkTreeView           *tree_view,
 }
 
 static void
-path_bar_clicked (GtkPathBar            *path_bar,
-                 GFile                 *file,
-                 GFile                 *child_file,
-                 gboolean               child_is_hidden,
-                 GtkFileChooserDefault *impl)
+path_bar_open_location_cb (GtkPathBar            *path_bar,
+                          GFile                 *file,
+                          GFile                 *child_file,
+                          gboolean               child_is_hidden,
+                          GtkFileChooserDefault *impl)
 {
   if (child_file)
     pending_select_files_add (impl, child_file);
@@ -7507,7 +7507,7 @@ _gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
   gtk_widget_class_bind_callback (widget_class, filter_combo_changed);
   gtk_widget_class_bind_callback (widget_class, location_button_toggled_cb);
   gtk_widget_class_bind_callback (widget_class, new_folder_button_clicked);
-  gtk_widget_class_bind_callback (widget_class, path_bar_clicked);
+  gtk_widget_class_bind_callback (widget_class, path_bar_open_location_cb);
   gtk_widget_class_bind_callback (widget_class, places_sidebar_open_location_cb);
   gtk_widget_class_bind_callback (widget_class, places_sidebar_show_error_message_cb);
 }
diff --git a/gtk/gtkfilechooserdefault.ui b/gtk/gtkfilechooserdefault.ui
index 5cf2ef3..22cf403 100644
--- a/gtk/gtkfilechooserdefault.ui
+++ b/gtk/gtkfilechooserdefault.ui
@@ -79,7 +79,7 @@
                   <object class="GtkPathBar" id="browse_path_bar">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <signal name="path-clicked" handler="path_bar_clicked" after="yes" swapped="no"/>
+                    <signal name="open-location" handler="path_bar_open_location_cb" after="yes" 
swapped="no"/>
                   </object>
                   <packing>
                     <property name="expand">True</property>
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index 62f81c1..e41250a 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -74,7 +74,7 @@ struct _GtkPathBarPrivate
 };
 
 enum {
-  PATH_CLICKED,
+  OPEN_LOCATION,
   LAST_SIGNAL
 };
 
@@ -298,16 +298,41 @@ gtk_path_bar_class_init (GtkPathBarClass *path_bar_class)
   /* FIXME: */
   /*  container_class->child_type = gtk_path_bar_child_type;*/
 
-  path_bar_signals [PATH_CLICKED] =
-    g_signal_new (I_("path-clicked"),
+  /**
+   * GtkPathBar::open-location
+   * @path_bar: the object which received the signal.
+   * location: location which the calling application should open.
+   * child_file: child of @location which is shown in the path bar.
+   * child_is_hidden: whether @child_file is a hidden file.
+   *
+   * The path bar emits this signal when the user clicks on one of its path
+   * buttons.  For example, if the pathbar is showing /foo/bar and the user
+   * clicks on the button for "foo", then @location will point to /foo, @child_file
+   * will point to /foo/bar, and @child_is_hidden will indicate whether "bar"
+   * refers to a hidden file or not.
+   *
+   * In case the user clicks the innermost path component of the path being shown,
+   * for example "bar" in the above case, then @child_file will be #NULL.
+   *
+   * The calling application can use @child_file and @child_is_hidden to
+   * determine whether to highlight a child file in the parent folder that will
+   * be shown:  in the above case, the application could show the contents of
+   * the "foo" folder, with "bar" selected for convenience.  In case "bar" were
+   * a hidden file (as indicated by @child_is_hidden), the application would
+   * turn on a "show hidden files" preference for the folder being shown.
+   *
+   * Since: 3.10
+   */
+  path_bar_signals [OPEN_LOCATION] =
+    g_signal_new (I_("open-location"),
                  G_OBJECT_CLASS_TYPE (gobject_class),
                  G_SIGNAL_RUN_FIRST,
-                 G_STRUCT_OFFSET (GtkPathBarClass, path_clicked),
+                 0,
                  NULL, NULL,
-                 _gtk_marshal_VOID__POINTER_POINTER_BOOLEAN,
+                 _gtk_marshal_VOID__OBJECT_OBJECT_BOOLEAN,
                  G_TYPE_NONE, 3,
-                 G_TYPE_POINTER,
-                 G_TYPE_POINTER,
+                 G_TYPE_OBJECT,
+                 G_TYPE_OBJECT,
                  G_TYPE_BOOLEAN);
 
   properties[PROP_OPEN_FLAGS] =
@@ -1427,7 +1452,7 @@ button_clicked_cb (GtkWidget *button,
       child_is_hidden = FALSE;
     }
 
-  g_signal_emit (path_bar, path_bar_signals [PATH_CLICKED], 0,
+  g_signal_emit (path_bar, path_bar_signals [OPEN_LOCATION], 0,
                 button_data->file, child_file, child_is_hidden);
 }
 
diff --git a/gtk/gtkpathbar.h b/gtk/gtkpathbar.h
index 062bf9b..30bb3e0 100644
--- a/gtk/gtkpathbar.h
+++ b/gtk/gtkpathbar.h
@@ -51,10 +51,10 @@ struct _GtkPathBarClass
 {
   GtkContainerClass parent_class;
 
-  void (* path_clicked) (GtkPathBar  *path_bar,
-                        GFile       *file,
-                        GFile       *child_file,
-                        gboolean     child_is_hidden);
+  void (* open_location) (GtkPathBar  *path_bar,
+                         GFile       *file,
+                         GFile       *child_file,
+                         gboolean     child_is_hidden);
 };
 
 GType    gtk_path_bar_get_type (void) G_GNUC_CONST;


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