diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index f867f6ef76..03d1771a59 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -2522,7 +2522,7 @@ put_recent_folder_in_pathbar (GtkFileChooserDefault *impl, GtkTreeIter *iter) gtk_tree_model_get (GTK_TREE_MODEL (priv->recent_model), iter, MODEL_COL_FILE, &file, -1); - _gtk_path_bar_set_file (GTK_PATH_BAR (priv->browse_path_bar), file, FALSE); + gtk_path_bar_set_location (GTK_PATH_BAR (priv->browse_path_bar), file, FALSE); g_object_unref (file); } @@ -4615,7 +4615,7 @@ update_current_folder_get_info_cb (GCancellable *cancellable, if (! _gtk_file_info_consider_as_directory (info)) goto out; - _gtk_path_bar_set_file (GTK_PATH_BAR (priv->browse_path_bar), data->file, data->keep_trail); + gtk_path_bar_set_location (GTK_PATH_BAR (priv->browse_path_bar), data->file, data->keep_trail); if (priv->current_folder != data->file) { diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c index 012dd1ba6c..faeb4a95c7 100644 --- a/gtk/gtkpathbar.c +++ b/gtk/gtkpathbar.c @@ -1973,24 +1973,33 @@ gtk_path_bar_get_info_callback (GCancellable *cancellable, file_info); } +/** + * gtk_path_bar_set_location: + * @path_bar: a #GtkPathBar + * @location: (allow-none): location to show, or #NULL for no current path + * + * Sets the location that the path bar should show. + * + * Since: 3.10 + */ void -_gtk_path_bar_set_file (GtkPathBar *path_bar, - GFile *file, - const gboolean keep_trail) +gtk_path_bar_set_location (GtkPathBar *path_bar, + GFile *location, + gboolean keep_trail) { struct SetFileInfo *info; g_return_if_fail (GTK_IS_PATH_BAR (path_bar)); - g_return_if_fail (G_IS_FILE (file)); + g_return_if_fail (G_IS_FILE (location)); /* Check whether the new path is already present in the pathbar as buttons. * This could be a parent directory or a previous selected subdirectory. */ - if (keep_trail && gtk_path_bar_check_parent_path (path_bar, file)) + if (keep_trail && gtk_path_bar_check_parent_path (path_bar, location)) return; info = g_new0 (struct SetFileInfo, 1); - info->file = g_object_ref (file); + info->file = g_object_ref (location); info->path_bar = path_bar; info->first_directory = TRUE; info->parent_file = g_file_get_parent (info->file); diff --git a/gtk/gtkpathbar.h b/gtk/gtkpathbar.h index 30bb3e009d..6ca93a2e68 100644 --- a/gtk/gtkpathbar.h +++ b/gtk/gtkpathbar.h @@ -64,11 +64,12 @@ GtkWidget *gtk_path_bar_new (void); GtkPlacesOpenFlags gtk_path_bar_get_open_flags (GtkPathBar *path_bar); void gtk_path_bar_set_open_flags (GtkPathBar *path_bar, GtkPlacesOpenFlags flags); +void gtk_path_bar_set_location (GtkPathBar *path_bar, + GFile *location, + gboolean keep_trail); + void _gtk_path_bar_set_file_system (GtkPathBar *path_bar, GtkFileSystem *file_system); -void _gtk_path_bar_set_file (GtkPathBar *path_bar, - GFile *file, - gboolean keep_trail); void _gtk_path_bar_up (GtkPathBar *path_bar); void _gtk_path_bar_down (GtkPathBar *path_bar);