Commit bc3fb55c authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Move interface definition into a private header so it can refer to

Fri Apr  4 17:30:27 2003  Owen Taylor  <otaylor@redhat.com>

        * gtkfilechooserprivate.h gtkfilechooser.h: Move
        interface definition into a private header so it
        can refer to GtkFileSystem.

        * *.[ch]: Switch over from using gchar *uri internally
        to using GtkFilePath * internally, and add
        conversion routines to GtkFileSystem.

        * TODO README: Updates.
parent a013536b
......@@ -19,6 +19,7 @@
*/
#include "gtkfilechooser.h"
#include "gtkfilechooserprivate.h"
#include "gtkfilechooserenums.h"
#include "gtkfilesystem.h"
......@@ -26,6 +27,8 @@
static void gtk_file_chooser_base_init (gpointer g_class);
static GtkFilePath *gtk_file_chooser_get_path (GtkFileChooser *chooser);
GType
gtk_file_chooser_get_type (void)
{
......@@ -212,21 +215,21 @@ gtk_file_chooser_get_select_multiple (GtkFileChooser *chooser)
return select_multiple;
}
char *
gchar *
gtk_file_chooser_get_filename (GtkFileChooser *chooser)
{
GSList *list;
GtkFileSystem *file_system;
GtkFilePath *path;
gchar *result = NULL;
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
list = gtk_file_chooser_get_filenames (chooser);
if (list)
file_system = _gtk_file_chooser_get_file_system (chooser);
path = gtk_file_chooser_get_path (chooser);
if (path)
{
result = list->data;
list = g_slist_delete_link (list, list);
g_slist_foreach (list, (GFunc)g_free, NULL);
g_slist_free (list);
result = gtk_file_system_path_to_filename (file_system, path);
gtk_file_path_free (path);
}
return result;
......@@ -234,65 +237,132 @@ gtk_file_chooser_get_filename (GtkFileChooser *chooser)
void
gtk_file_chooser_set_filename (GtkFileChooser *chooser,
const char *filename)
const gchar *filename)
{
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
gtk_file_chooser_unselect_all (chooser);
gtk_file_chooser_select_filename (chooser, filename);
}
void
gtk_file_chooser_select_filename (GtkFileChooser *chooser,
const char *filename)
const gchar *filename)
{
GtkFileSystem *file_system;
GtkFilePath *path;
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
g_return_if_fail (filename != NULL);
file_system = _gtk_file_chooser_get_file_system (chooser);
path = gtk_file_system_filename_to_path (file_system, filename);
if (path)
{
_gtk_file_chooser_select_path (chooser, path);
gtk_file_path_free (path);
}
}
void
gtk_file_chooser_unselect_filename (GtkFileChooser *chooser,
const char *filename)
{
GtkFileSystem *file_system;
GtkFilePath *path;
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
g_return_if_fail (filename != NULL);
file_system = _gtk_file_chooser_get_file_system (chooser);
path = gtk_file_system_filename_to_path (file_system, filename);
if (path)
{
_gtk_file_chooser_unselect_path (chooser, path);
gtk_file_path_free (path);
}
}
GSList *
gtk_file_chooser_get_filenames (GtkFileChooser *chooser)
{
GtkFileSystem *file_system;
GSList *paths;
GSList *tmp_list;
GSList *result = NULL;
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
return NULL;
file_system = _gtk_file_chooser_get_file_system (chooser);
paths = _gtk_file_chooser_get_paths (chooser);
for (tmp_list = paths; tmp_list; tmp_list = tmp_list->next)
{
gchar *filename = gtk_file_system_path_to_filename (file_system, tmp_list->data);
if (filename)
result = g_slist_prepend (result, filename);
}
gtk_file_paths_free (paths);
return g_slist_reverse (result);
}
void
gtk_file_chooser_set_current_folder (GtkFileChooser *chooser,
const gchar *filename)
{
GtkFileSystem *file_system;
GtkFilePath *path;
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
g_return_if_fail (filename != NULL);
file_system = _gtk_file_chooser_get_file_system (chooser);
path = gtk_file_system_filename_to_path (file_system, filename);
if (path)
{
_gtk_file_chooser_set_current_folder (chooser, path);
gtk_file_path_free (path);
}
}
gchar *
gtk_file_chooser_get_current_folder (GtkFileChooser *chooser)
{
GtkFileSystem *file_system;
GtkFilePath *path;
gchar *filename;
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
return NULL;
file_system = _gtk_file_chooser_get_file_system (chooser);
path = _gtk_file_chooser_get_current_folder (chooser);
filename = gtk_file_system_path_to_filename (file_system, path);
gtk_file_path_free (path);
return filename;
}
gchar *
gtk_file_chooser_get_uri (GtkFileChooser *chooser)
{
GSList *list;
GtkFileSystem *file_system;
GtkFilePath *path;
gchar *result = NULL;
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
list = gtk_file_chooser_get_uris (chooser);
if (list)
file_system = _gtk_file_chooser_get_file_system (chooser);
path = gtk_file_chooser_get_path (chooser);
if (path)
{
result = list->data;
list = g_slist_delete_link (list, list);
g_slist_foreach (list, (GFunc)g_free, NULL);
g_slist_free (list);
result = gtk_file_system_path_to_uri (file_system, path);
gtk_file_path_free (path);
}
return result;
......@@ -303,24 +373,49 @@ gtk_file_chooser_set_uri (GtkFileChooser *chooser,
const char *uri)
{
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
gtk_file_chooser_unselect_all (chooser);
gtk_file_chooser_select_uri (chooser, uri);
}
void
gtk_file_chooser_select_uri (GtkFileChooser *chooser,
const char *uri)
{
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
GtkFileSystem *file_system;
GtkFilePath *path;
GTK_FILE_CHOOSER_GET_IFACE (chooser)->unselect_uri (chooser, uri);
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
g_return_if_fail (uri != NULL);
file_system = _gtk_file_chooser_get_file_system (chooser);
path = gtk_file_system_uri_to_path (file_system, uri);
if (path)
{
_gtk_file_chooser_select_path (chooser, path);
gtk_file_path_free (path);
}
}
void
gtk_file_chooser_unselect_uri (GtkFileChooser *chooser,
const char *uri)
{
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
GtkFileSystem *file_system;
GtkFilePath *path;
GTK_FILE_CHOOSER_GET_IFACE (chooser)->unselect_uri (chooser, uri);
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
g_return_if_fail (uri != NULL);
file_system = _gtk_file_chooser_get_file_system (chooser);
path = gtk_file_system_uri_to_path (file_system, uri);
if (path)
{
_gtk_file_chooser_unselect_path (chooser, path);
gtk_file_path_free (path);
}
}
void
......@@ -343,30 +438,138 @@ gtk_file_chooser_unselect_all (GtkFileChooser *chooser)
GSList *
gtk_file_chooser_get_uris (GtkFileChooser *chooser)
{
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
GtkFileSystem *file_system;
GSList *paths;
GSList *tmp_list;
GSList *result = NULL;
return GTK_FILE_CHOOSER_GET_IFACE (chooser)->get_uris (chooser);
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
file_system = _gtk_file_chooser_get_file_system (chooser);
paths = _gtk_file_chooser_get_paths (chooser);
for (tmp_list = paths; tmp_list; tmp_list = tmp_list->next)
{
gchar *uri = gtk_file_system_path_to_uri (file_system, tmp_list->data);
if (uri)
result = g_slist_prepend (result, uri);
}
gtk_file_paths_free (paths);
return g_slist_reverse (result);
}
void
gtk_file_chooser_set_current_folder_uri (GtkFileChooser *chooser,
const gchar *uri)
{
GtkFileSystem *file_system;
GtkFilePath *path;
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
g_return_if_fail (uri != NULL);
return GTK_FILE_CHOOSER_GET_IFACE (chooser)->set_current_folder (chooser, uri);
}
file_system = _gtk_file_chooser_get_file_system (chooser);
path = gtk_file_system_uri_to_path (file_system, uri);
if (path)
{
_gtk_file_chooser_set_current_folder (chooser, path);
gtk_file_path_free (path);
}
}
gchar *
gtk_file_chooser_get_current_folder_uri (GtkFileChooser *chooser)
{
GtkFileSystem *file_system;
GtkFilePath *path;
gchar *uri;
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
file_system = _gtk_file_chooser_get_file_system (chooser);
path = _gtk_file_chooser_get_current_folder (chooser);
uri = gtk_file_system_path_to_uri (file_system, path);
gtk_file_path_free (path);
return uri;
}
void
_gtk_file_chooser_set_current_folder (GtkFileChooser *chooser,
const GtkFilePath *path)
{
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
g_return_if_fail (path != NULL);
GTK_FILE_CHOOSER_GET_IFACE (chooser)->set_current_folder (chooser, path);
}
GtkFilePath *
_gtk_file_chooser_get_current_folder (GtkFileChooser *chooser)
{
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
return GTK_FILE_CHOOSER_GET_IFACE (chooser)->get_current_folder (chooser);
}
void
_gtk_file_chooser_select_path (GtkFileChooser *chooser,
const GtkFilePath *path)
{
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
GTK_FILE_CHOOSER_GET_IFACE (chooser)->select_path (chooser, path);
}
void
_gtk_file_chooser_unselect_path (GtkFileChooser *chooser,
const GtkFilePath *path)
{
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
GTK_FILE_CHOOSER_GET_IFACE (chooser)->unselect_path (chooser, path);
}
GSList *
_gtk_file_chooser_get_paths (GtkFileChooser *chooser)
{
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
return GTK_FILE_CHOOSER_GET_IFACE (chooser)->get_paths (chooser);
}
static GtkFilePath *
gtk_file_chooser_get_path (GtkFileChooser *chooser)
{
GSList *list;
GtkFilePath *result = NULL;
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
list = _gtk_file_chooser_get_paths (chooser);
if (list)
{
result = list->data;
list = g_slist_delete_link (list, list);
gtk_file_paths_free (list);
}
return result;
}
GtkFileSystem *
_gtk_file_chooser_get_file_system (GtkFileChooser *chooser)
{
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
return GTK_FILE_CHOOSER_GET_IFACE (chooser)->get_file_system (chooser);
}
/* Preview widget
*/
void
......
......@@ -28,10 +28,8 @@ G_BEGIN_DECLS
#define GTK_TYPE_FILE_CHOOSER (gtk_file_chooser_get_type ())
#define GTK_FILE_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FILE_CHOOSER, GtkFileChooser))
#define GTK_IS_FILE_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FILE_CHOOSER))
#define GTK_FILE_CHOOSER_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_FILE_CHOOSER, GtkFileChooserIface))
typedef struct _GtkFileChooser GtkFileChooser;
typedef struct _GtkFileChooserIface GtkFileChooserIface;
typedef enum
{
......@@ -39,44 +37,6 @@ typedef enum
GTK_FILE_CHOOSER_ACTION_SAVE
} GtkFileChooserAction;
struct _GtkFileChooserIface
{
GTypeInterface base_iface;
/* GtkFileChooser interface has the following properties:
*
* action: GtkFileChooserAction
* folder_mode: boolean
* select_multiple: boolean
* show_hidden: boolean
* local_only: boolean
*
* preview_widget: GtkWidget
* preview_widget_active: boolean
*/
/* Methods
*/
void (*set_current_folder) (GtkFileChooser *chooser,
const char *uri);
char * (*get_current_folder) (GtkFileChooser *chooser);
void (*select_uri) (GtkFileChooser *chooser,
const char *uri);
void (*unselect_uri) (GtkFileChooser *chooser,
const char *uri);
void (*select_all) (GtkFileChooser *chooser);
void (*unselect_all) (GtkFileChooser *chooser);
GSList *(*get_uris) (GtkFileChooser *chooser);
/* Signals
*/
void (*current_folder_changed) (GtkFileChooser *chooser);
void (*selection_changed) (GtkFileChooser *chooser);
void (*update_preview) (GtkFileChooser *chooser,
const char *uri);
};
GType gtk_file_chooser_get_type (void);
/* Configuration
......
......@@ -60,7 +60,7 @@ struct _GtkFileChooserImplDefault
GtkFileChooserAction action;
gchar *current_folder;
GtkFilePath *current_folder;
guint folder_mode : 1;
guint local_only : 1;
......@@ -93,16 +93,17 @@ static void gtk_file_chooser_impl_default_get_property (GObject
GValue *value,
GParamSpec *pspec);
static void gtk_file_chooser_impl_default_set_current_folder (GtkFileChooser *chooser,
const char *uri);
static char * gtk_file_chooser_impl_default_get_current_folder (GtkFileChooser *chooser);
static void gtk_file_chooser_impl_default_select_uri (GtkFileChooser *chooser,
const char *uri);
static void gtk_file_chooser_impl_default_unselect_uri (GtkFileChooser *chooser,
const char *uri);
static void gtk_file_chooser_impl_default_select_all (GtkFileChooser *chooser);
static void gtk_file_chooser_impl_default_unselect_all (GtkFileChooser *chooser);
static GSList *gtk_file_chooser_impl_default_get_uris (GtkFileChooser *chooser);
static void gtk_file_chooser_impl_default_set_current_folder (GtkFileChooser *chooser,
const GtkFilePath *path);
static GtkFilePath * gtk_file_chooser_impl_default_get_current_folder (GtkFileChooser *chooser);
static void gtk_file_chooser_impl_default_select_path (GtkFileChooser *chooser,
const GtkFilePath *path);
static void gtk_file_chooser_impl_default_unselect_path (GtkFileChooser *chooser,
const GtkFilePath *path);
static void gtk_file_chooser_impl_default_select_all (GtkFileChooser *chooser);
static void gtk_file_chooser_impl_default_unselect_all (GtkFileChooser *chooser);
static GSList * gtk_file_chooser_impl_default_get_paths (GtkFileChooser *chooser);
static GtkFileSystem *gtk_file_chooser_impl_default_get_file_system (GtkFileChooser *chooser);
static void tree_selection_changed (GtkTreeSelection *tree_selection,
GtkFileChooserImplDefault *impl);
......@@ -182,11 +183,12 @@ gtk_file_chooser_impl_default_class_init (GtkFileChooserImplDefaultClass *class)
static void
gtk_file_chooser_impl_default_iface_init (GtkFileChooserIface *iface)
{
iface->select_uri = gtk_file_chooser_impl_default_select_uri;
iface->unselect_uri = gtk_file_chooser_impl_default_unselect_uri;
iface->select_path = gtk_file_chooser_impl_default_select_path;
iface->unselect_path = gtk_file_chooser_impl_default_unselect_path;
iface->select_all = gtk_file_chooser_impl_default_select_all;
iface->unselect_all = gtk_file_chooser_impl_default_unselect_all;
iface->get_uris = gtk_file_chooser_impl_default_get_uris;
iface->get_paths = gtk_file_chooser_impl_default_get_paths;
iface->get_file_system = gtk_file_chooser_impl_default_get_file_system;
iface->set_current_folder = gtk_file_chooser_impl_default_set_current_folder;
iface->get_current_folder = gtk_file_chooser_impl_default_get_current_folder;
}
......@@ -504,21 +506,21 @@ expand_and_select_func (GtkFileSystemModel *model,
}
static void
gtk_file_chooser_impl_default_set_current_folder (GtkFileChooser *chooser,
const char *uri)
gtk_file_chooser_impl_default_set_current_folder (GtkFileChooser *chooser,
const GtkFilePath *path)
{
GtkFileChooserImplDefault *impl = GTK_FILE_CHOOSER_IMPL_DEFAULT (chooser);
_gtk_file_system_model_uri_do (impl->tree_model, uri,
expand_and_select_func, impl);
_gtk_file_system_model_path_do (impl->tree_model, path,
expand_and_select_func, impl);
}
static char *
static GtkFilePath *
gtk_file_chooser_impl_default_get_current_folder (GtkFileChooser *chooser)
{
GtkFileChooserImplDefault *impl = GTK_FILE_CHOOSER_IMPL_DEFAULT (chooser);
return g_strdup (impl->current_folder);
return gtk_file_path_copy (impl->current_folder);
}
static void
......@@ -538,24 +540,24 @@ select_func (GtkFileSystemModel *model,
}
static void
gtk_file_chooser_impl_default_select_uri (GtkFileChooser *chooser,
const char *uri)
gtk_file_chooser_impl_default_select_path (GtkFileChooser *chooser,
const GtkFilePath *path)
{
GtkFileChooserImplDefault *impl = GTK_FILE_CHOOSER_IMPL_DEFAULT (chooser);
gchar *parent_uri;
GtkFilePath *parent_path;
if (!gtk_file_system_get_parent (impl->file_system, uri, &parent_uri, NULL)) /* NULL-GError */
if (!gtk_file_system_get_parent (impl->file_system, path, &parent_path, NULL)) /* NULL-GError */
return;
if (!parent_uri)
if (!parent_path)
{
gtk_file_chooser_set_current_folder_uri (chooser, uri);
_gtk_file_chooser_set_current_folder (chooser, path);
}
else
{
gtk_file_chooser_set_current_folder_uri (chooser, parent_uri);
g_free (parent_uri);
_gtk_file_system_model_uri_do (impl->list_model, uri,
_gtk_file_chooser_set_current_folder (chooser, parent_path);
gtk_file_path_free (parent_path);
_gtk_file_system_model_path_do (impl->list_model, path,
select_func, impl);
}
}
......@@ -578,12 +580,12 @@ unselect_func (GtkFileSystemModel *model,
}
static void
gtk_file_chooser_impl_default_unselect_uri (GtkFileChooser *chooser,
const char *uri)
gtk_file_chooser_impl_default_unselect_path (GtkFileChooser *chooser,
const GtkFilePath *path)
{
GtkFileChooserImplDefault *impl = GTK_FILE_CHOOSER_IMPL_DEFAULT (chooser);
_gtk_file_system_model_uri_do (impl->list_model, uri,
_gtk_file_system_model_path_do (impl->list_model, path,
unselect_func, impl);
}
......@@ -608,14 +610,14 @@ gtk_file_chooser_impl_default_unselect_all (GtkFileChooser *chooser)
}
static void
get_uris_foreach (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer data)
get_paths_foreach (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer data)
{
GtkTreePath *child_path;
GtkTreeIter child_iter;
const gchar *uri;
const GtkFilePath *file_path;
struct {
GSList *result;
......@@ -626,12 +628,12 @@ get_uris_foreach (GtkTreeModel *model,
gtk_tree_model_get_iter (GTK_TREE_MODEL (info->impl->list_model), &child_iter, child_path);
gtk_tree_path_free (child_path);
uri = _gtk_file_system_model_get_uri (info->impl->tree_model, &child_iter);
info->result = g_slist_prepend (info->result, g_strdup (uri));
file_path = _gtk_file_system_model_get_path (info->impl->tree_model, &child_iter);
info->result = g_slist_prepend (info->result, gtk_file_path_copy (file_path));
}
static GSList *
gtk_file_chooser_impl_default_get_uris (GtkFileChooser *chooser)
gtk_file_chooser_impl_default_get_paths (GtkFileChooser *chooser)
{
GtkFileChooserImplDefault *impl = GTK_FILE_CHOOSER_IMPL_DEFAULT (chooser);
GtkTreeSelection *selection;
......@@ -648,10 +650,18 @@ gtk_file_chooser_impl_default_get_uris (GtkFileChooser *chooser)
info.impl = impl;
gtk_tree_selection_selected_foreach (selection,
get_uris_foreach, &info);
get_paths_foreach, &info);
return g_slist_reverse (info.result);
}
static GtkFileSystem *
gtk_file_chooser_impl_default_get_file_system (GtkFileChooser *chooser)
{
GtkFileChooserImplDefault *impl = GTK_FILE_CHOOSER_IMPL_DEFAULT (chooser);
return impl->file_system;
}
static gint
name_sort_func (GtkTreeModel *model,
GtkTreeIter *a,
......@@ -763,20 +773,20 @@ tree_selection_changed (GtkTreeSelection *selection,
GtkFileChooserImplDefault *impl)
{
GtkTreeIter iter;
const gchar *uri;
const GtkFilePath *file_path;
GtkTreePath *path;
if (!gtk_tree_selection_get_selected (selection, NULL, &iter))
return;
uri = _gtk_file_system_model_get_uri (impl->tree_model, &iter);
if (impl->current_folder && strcmp (uri, impl->current_folder) == 0)
file_path = _gtk_file_system_model_get_path (impl->tree_model, &iter);
if (impl->current_folder && gtk_file_path_compare (file_path, impl->current_folder) == 0)
return;
if (impl->current_folder)
g_free (impl->current_folder);
impl->current_folder = g_strdup (uri);
_gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->entry), uri);
gtk_file_path_free (impl->current_folder);
impl->current_folder = gtk_file_path_copy (file_path);
_gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->entry), file_path);
if (impl->list_model)
{
......@@ -796,10 +806,10 @@ tree_selection_changed (GtkTreeSelection *selection,
/* Now update the list view to show the new row.
*/
uri = _gtk_file_system_model_get_uri (impl->tree_model, &iter);
file_path = _gtk_file_system_model_get_path (impl->tree_model, &iter);
impl->list_model = _gtk_file_system_model_new (impl->file_system,
uri, 0,
file_path, 0,
GTK_FILE_INFO_DISPLAY_NAME |
GTK_FILE_INFO_SIZE);
_gtk_file_system_model_set_show_folders (impl->list_model, FALSE);
......@@ -837,46 +847,46 @@ entry_activate (GtkEntry *entry,
GtkFileChooserImplDefault *impl)
{
GtkFileChooserEntry *chooser_entry = GTK_FILE_CHOOSER_ENTRY (entry);
const gchar *folder_uri = _gtk_file_chooser_entry_get_current_folder (chooser_entry);
const GtkFilePath *folder_path = _gtk_file_chooser_entry_get_current_folder (chooser_entry);
const gchar *file_part = _gtk_file_chooser_entry_get_file_part (chooser_entry);
gchar *new_folder = NULL;
GtkFilePath *new_folder = NULL;
/* If the file part is non-empty, we need to figure out if it
* refers to a folder within folder. We could optimize the case
* here where the folder is already loaded for one of our tree models.
*/
if (file_part[0] == '\0' && strcmp (impl->current_folder, folder_uri) != 0)
new_folder = g_strdup (folder_uri);
if (file_part[0] == '\0' && gtk_file_path_compare (impl->current_folder, folder_path) != 0)
new_folder = gtk_file_path_copy (folder_path);
else
{
GtkFileFolder *folder = NULL;
gchar *subfolder_uri = NULL;
GtkFilePath *subfolder_path = NULL;
GtkFileInfo *info = NULL;
folder = gtk_file_system_get_folder (impl->file_system,
folder_uri,
folder_path,
GTK_FILE_INFO_IS_FOLDER,
NULL); /* NULL-GError */
if (folder)
subfolder_uri = gtk_file_system_make_uri (impl->file_system,
folder_uri,
subfolder_path = gtk_file_system_make_path (impl->file_system,
folder_path,
file_part,
NULL); /* NULL-GError */
if (subfolder_uri)
if (subfolder_path)
info = gtk_file_folder_get_info (folder,
subfolder_uri,
subfolder_path,
NULL); /* NULL-GError */
if (info && gtk_file_info_get_is_folder (info))
new_folder = g_strdup (subfolder_uri);
new_folder = gtk_file_path_copy (subfolder_path);
if (folder)
g_object_unref (folder);
if (subfolder_uri)
g_free (subfolder_uri);
if (subfolder_path)
gtk_file_path_free (subfolder_path);
if (info)
gtk_file_info_free (info);
......@@ -886,10 +896,10 @@ entry_activate (GtkEntry *entry,
{
g_signal_stop_emission_by_name (entry, "activate");
gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (impl), new_folder);
_gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (impl), new_folder);
_gtk_file_chooser_entry_set_file_part (chooser_entry, "");
g_free (new_folder);
gtk_file_path_free (new_folder);
}
}
......
......@@ -40,8 +40,8 @@ struct _GtkFi