GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit 385bd6a5 authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Federico Mena Quintero

Add gboolean return values and GError arguments to ::set_current_folder()

2004-03-05  Federico Mena Quintero  <federico@ximian.com>

	* gtk/gtkfilechooserprivate.h (struct _GtkFileChooserIface): Add
	gboolean return values and GError arguments to
	::set_current_folder() and ::select_path().

	* gtk/gtkfilechooser.c (gtk_file_chooser_set_current_folder):
	Return a boolean value for success/failure.
	(gtk_file_chooser_set_current_folder_uri): Likewise.
	(gtk_file_chooser_select_filename): Likewise.
	(gtk_file_chooser_select_uri): Likewise.
	(gtk_file_chooser_set_filename): Likewise.
	(gtk_file_chooser_set_uri): Likewise.
	(_gtk_file_chooser_set_current_folder_path): Likewise, plus take
	in a GError.
	(_gtk_file_chooser_select_path): Likewise.

	* gtk/gtkfilechooserutils.c (delegate_set_current_folder):
	Likewise.
	(delegate_select_path): Likewise.

	* gtk/gtkfilechooserdefault.c
	(gtk_file_chooser_default_select_path): Likewise.
	(gtk_file_chooser_default_set_current_folder): Likewise.
	(error_changing_folder_dialog): New helper function.
	(change_folder_and_display_error): New helper function.
	(switch_to_selected_folder): Use change_folder_and_display_error().
	(tree_selection_changed): Likewise.
	(shortcuts_activate_volume): Likewise.
	(shortcuts_activate_item): Likewise.
	(list_row_activated): Likewise.
	(path_bar_clicked): Likewise.
	(update_from_entry): Likewise.
	(up_folder_handler): Likewise.
	(home_folder_handler): Get the home path from the shortcuts model,
	and use change_folder_and_display_error().

	* tests/testfilechooser.c (set_current_folder): New helper
	function; pops up a simple error dialog if necessary.
	(set_filename): Likewise.
	(set_folder_nonexistent_cb): Use set_current_folder().
	(set_folder_existing_nonexistent_cb): Likewise.
	(set_filename_nonexistent_cb): Use set_filename().
	(set_filename_existing_nonexistent_cb): Likewise.
parent c43e4377
2004-03-05 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserprivate.h (struct _GtkFileChooserIface): Add
gboolean return values and GError arguments to
::set_current_folder() and ::select_path().
* gtk/gtkfilechooser.c (gtk_file_chooser_set_current_folder):
Return a boolean value for success/failure.
(gtk_file_chooser_set_current_folder_uri): Likewise.
(gtk_file_chooser_select_filename): Likewise.
(gtk_file_chooser_select_uri): Likewise.
(gtk_file_chooser_set_filename): Likewise.
(gtk_file_chooser_set_uri): Likewise.
(_gtk_file_chooser_set_current_folder_path): Likewise, plus take
in a GError.
(_gtk_file_chooser_select_path): Likewise.
* gtk/gtkfilechooserutils.c (delegate_set_current_folder):
Likewise.
(delegate_select_path): Likewise.
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_select_path): Likewise.
(gtk_file_chooser_default_set_current_folder): Likewise.
(error_changing_folder_dialog): New helper function.
(change_folder_and_display_error): New helper function.
(switch_to_selected_folder): Use change_folder_and_display_error().
(tree_selection_changed): Likewise.
(shortcuts_activate_volume): Likewise.
(shortcuts_activate_item): Likewise.
(list_row_activated): Likewise.
(path_bar_clicked): Likewise.
(update_from_entry): Likewise.
(up_folder_handler): Likewise.
(home_folder_handler): Get the home path from the shortcuts model,
and use change_folder_and_display_error().
* tests/testfilechooser.c (set_current_folder): New helper
function; pops up a simple error dialog if necessary.
(set_filename): Likewise.
(set_folder_nonexistent_cb): Use set_current_folder().
(set_folder_existing_nonexistent_cb): Likewise.
(set_filename_nonexistent_cb): Use set_filename().
(set_filename_existing_nonexistent_cb): Likewise.
Fri Mar 5 11:17:35 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_row_reference_new_proxy):
......
2004-03-05 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserprivate.h (struct _GtkFileChooserIface): Add
gboolean return values and GError arguments to
::set_current_folder() and ::select_path().
* gtk/gtkfilechooser.c (gtk_file_chooser_set_current_folder):
Return a boolean value for success/failure.
(gtk_file_chooser_set_current_folder_uri): Likewise.
(gtk_file_chooser_select_filename): Likewise.
(gtk_file_chooser_select_uri): Likewise.
(gtk_file_chooser_set_filename): Likewise.
(gtk_file_chooser_set_uri): Likewise.
(_gtk_file_chooser_set_current_folder_path): Likewise, plus take
in a GError.
(_gtk_file_chooser_select_path): Likewise.
* gtk/gtkfilechooserutils.c (delegate_set_current_folder):
Likewise.
(delegate_select_path): Likewise.
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_select_path): Likewise.
(gtk_file_chooser_default_set_current_folder): Likewise.
(error_changing_folder_dialog): New helper function.
(change_folder_and_display_error): New helper function.
(switch_to_selected_folder): Use change_folder_and_display_error().
(tree_selection_changed): Likewise.
(shortcuts_activate_volume): Likewise.
(shortcuts_activate_item): Likewise.
(list_row_activated): Likewise.
(path_bar_clicked): Likewise.
(update_from_entry): Likewise.
(up_folder_handler): Likewise.
(home_folder_handler): Get the home path from the shortcuts model,
and use change_folder_and_display_error().
* tests/testfilechooser.c (set_current_folder): New helper
function; pops up a simple error dialog if necessary.
(set_filename): Likewise.
(set_folder_nonexistent_cb): Use set_current_folder().
(set_folder_existing_nonexistent_cb): Likewise.
(set_filename_nonexistent_cb): Use set_filename().
(set_filename_existing_nonexistent_cb): Likewise.
Fri Mar 5 11:17:35 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_row_reference_new_proxy):
......
2004-03-05 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserprivate.h (struct _GtkFileChooserIface): Add
gboolean return values and GError arguments to
::set_current_folder() and ::select_path().
* gtk/gtkfilechooser.c (gtk_file_chooser_set_current_folder):
Return a boolean value for success/failure.
(gtk_file_chooser_set_current_folder_uri): Likewise.
(gtk_file_chooser_select_filename): Likewise.
(gtk_file_chooser_select_uri): Likewise.
(gtk_file_chooser_set_filename): Likewise.
(gtk_file_chooser_set_uri): Likewise.
(_gtk_file_chooser_set_current_folder_path): Likewise, plus take
in a GError.
(_gtk_file_chooser_select_path): Likewise.
* gtk/gtkfilechooserutils.c (delegate_set_current_folder):
Likewise.
(delegate_select_path): Likewise.
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_select_path): Likewise.
(gtk_file_chooser_default_set_current_folder): Likewise.
(error_changing_folder_dialog): New helper function.
(change_folder_and_display_error): New helper function.
(switch_to_selected_folder): Use change_folder_and_display_error().
(tree_selection_changed): Likewise.
(shortcuts_activate_volume): Likewise.
(shortcuts_activate_item): Likewise.
(list_row_activated): Likewise.
(path_bar_clicked): Likewise.
(update_from_entry): Likewise.
(up_folder_handler): Likewise.
(home_folder_handler): Get the home path from the shortcuts model,
and use change_folder_and_display_error().
* tests/testfilechooser.c (set_current_folder): New helper
function; pops up a simple error dialog if necessary.
(set_filename): Likewise.
(set_folder_nonexistent_cb): Use set_current_folder().
(set_folder_existing_nonexistent_cb): Likewise.
(set_filename_nonexistent_cb): Use set_filename().
(set_filename_existing_nonexistent_cb): Likewise.
Fri Mar 5 11:17:35 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_row_reference_new_proxy):
......
2004-03-05 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserprivate.h (struct _GtkFileChooserIface): Add
gboolean return values and GError arguments to
::set_current_folder() and ::select_path().
* gtk/gtkfilechooser.c (gtk_file_chooser_set_current_folder):
Return a boolean value for success/failure.
(gtk_file_chooser_set_current_folder_uri): Likewise.
(gtk_file_chooser_select_filename): Likewise.
(gtk_file_chooser_select_uri): Likewise.
(gtk_file_chooser_set_filename): Likewise.
(gtk_file_chooser_set_uri): Likewise.
(_gtk_file_chooser_set_current_folder_path): Likewise, plus take
in a GError.
(_gtk_file_chooser_select_path): Likewise.
* gtk/gtkfilechooserutils.c (delegate_set_current_folder):
Likewise.
(delegate_select_path): Likewise.
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_select_path): Likewise.
(gtk_file_chooser_default_set_current_folder): Likewise.
(error_changing_folder_dialog): New helper function.
(change_folder_and_display_error): New helper function.
(switch_to_selected_folder): Use change_folder_and_display_error().
(tree_selection_changed): Likewise.
(shortcuts_activate_volume): Likewise.
(shortcuts_activate_item): Likewise.
(list_row_activated): Likewise.
(path_bar_clicked): Likewise.
(update_from_entry): Likewise.
(up_folder_handler): Likewise.
(home_folder_handler): Get the home path from the shortcuts model,
and use change_folder_and_display_error().
* tests/testfilechooser.c (set_current_folder): New helper
function; pops up a simple error dialog if necessary.
(set_filename): Likewise.
(set_folder_nonexistent_cb): Use set_current_folder().
(set_folder_existing_nonexistent_cb): Likewise.
(set_filename_nonexistent_cb): Use set_filename().
(set_filename_existing_nonexistent_cb): Likewise.
Fri Mar 5 11:17:35 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_row_reference_new_proxy):
......
2004-03-05 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserprivate.h (struct _GtkFileChooserIface): Add
gboolean return values and GError arguments to
::set_current_folder() and ::select_path().
* gtk/gtkfilechooser.c (gtk_file_chooser_set_current_folder):
Return a boolean value for success/failure.
(gtk_file_chooser_set_current_folder_uri): Likewise.
(gtk_file_chooser_select_filename): Likewise.
(gtk_file_chooser_select_uri): Likewise.
(gtk_file_chooser_set_filename): Likewise.
(gtk_file_chooser_set_uri): Likewise.
(_gtk_file_chooser_set_current_folder_path): Likewise, plus take
in a GError.
(_gtk_file_chooser_select_path): Likewise.
* gtk/gtkfilechooserutils.c (delegate_set_current_folder):
Likewise.
(delegate_select_path): Likewise.
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_select_path): Likewise.
(gtk_file_chooser_default_set_current_folder): Likewise.
(error_changing_folder_dialog): New helper function.
(change_folder_and_display_error): New helper function.
(switch_to_selected_folder): Use change_folder_and_display_error().
(tree_selection_changed): Likewise.
(shortcuts_activate_volume): Likewise.
(shortcuts_activate_item): Likewise.
(list_row_activated): Likewise.
(path_bar_clicked): Likewise.
(update_from_entry): Likewise.
(up_folder_handler): Likewise.
(home_folder_handler): Get the home path from the shortcuts model,
and use change_folder_and_display_error().
* tests/testfilechooser.c (set_current_folder): New helper
function; pops up a simple error dialog if necessary.
(set_filename): Likewise.
(set_folder_nonexistent_cb): Use set_current_folder().
(set_folder_existing_nonexistent_cb): Likewise.
(set_filename_nonexistent_cb): Use set_filename().
(set_filename_existing_nonexistent_cb): Likewise.
Fri Mar 5 11:17:35 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_row_reference_new_proxy):
......
......@@ -359,16 +359,19 @@ gtk_file_chooser_get_filename (GtkFileChooser *chooser)
* for the directory change. To pre-enter a filename for the user, as in
* a save-as dialog, use gtk_file_chooser_set_current_name()
*
* Return value: %TRUE if both the folder could be changed and the file was
* selected successfully, %FALSE otherwise.
*
* Since: 2.4
**/
void
gboolean
gtk_file_chooser_set_filename (GtkFileChooser *chooser,
const gchar *filename)
{
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
gtk_file_chooser_unselect_all (chooser);
gtk_file_chooser_select_filename (chooser, filename);
return gtk_file_chooser_select_filename (chooser, filename);
}
/**
......@@ -380,26 +383,34 @@ gtk_file_chooser_set_filename (GtkFileChooser *chooser,
* folder of @chooser, then the current folder of @chooser will
* be changed to the folder containing @filename.
*
* Return value: %TRUE if both the folder could be changed and the file was
* selected successfully, %FALSE otherwise.
*
* Since: 2.4
**/
void
gboolean
gtk_file_chooser_select_filename (GtkFileChooser *chooser,
const gchar *filename)
{
GtkFileSystem *file_system;
GtkFilePath *path;
gboolean result;
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
g_return_if_fail (filename != NULL);
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
g_return_val_if_fail (filename != NULL, FALSE);
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);
result = _gtk_file_chooser_select_path (chooser, path, NULL);
gtk_file_path_free (path);
}
else
result = FALSE;
return result;
}
/**
......@@ -499,26 +510,34 @@ gtk_file_chooser_get_filenames (GtkFileChooser *chooser)
* The user will be shown the full contents of the current folder,
* plus user interface elements for navigating to other folders.
*
* Return value: %TRUE if the folder could be changed successfully, %FALSE
* otherwise.
*
* Since: 2.4
**/
void
gboolean
gtk_file_chooser_set_current_folder (GtkFileChooser *chooser,
const gchar *filename)
{
GtkFileSystem *file_system;
GtkFilePath *path;
gboolean result;
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
g_return_if_fail (filename != NULL);
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
g_return_val_if_fail (filename != NULL, FALSE);
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_path (chooser, path);
result = _gtk_file_chooser_set_current_folder_path (chooser, path, NULL);
gtk_file_path_free (path);
}
else
result = FALSE;
return result;
}
/**
......@@ -628,16 +647,19 @@ gtk_file_chooser_get_uri (GtkFileChooser *chooser)
* for the directory change. To pre-enter a filename for the user, as in
* a save-as dialog, use gtk_file_chooser_set_current_name()
*
* Return value: %TRUE if both the folder could be changed and the URI was
* selected successfully, %FALSE otherwise.
*
* Since: 2.4
**/
void
gboolean
gtk_file_chooser_set_uri (GtkFileChooser *chooser,
const char *uri)
{
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
gtk_file_chooser_unselect_all (chooser);
gtk_file_chooser_select_uri (chooser, uri);
return gtk_file_chooser_select_uri (chooser, uri);
}
/**
......@@ -649,26 +671,34 @@ gtk_file_chooser_set_uri (GtkFileChooser *chooser,
* file in the current folder of @chooser, then the current folder of
* @chooser will be changed to the folder containing @filename.
*
* Return value: %TRUE if both the folder could be changed and the URI was
* selected successfully, %FALSE otherwise.
*
* Since: 2.4
**/
void
gboolean
gtk_file_chooser_select_uri (GtkFileChooser *chooser,
const char *uri)
{
GtkFileSystem *file_system;
GtkFilePath *path;
gboolean result;
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
g_return_if_fail (uri != NULL);
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
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);
result = _gtk_file_chooser_select_path (chooser, path, NULL);
gtk_file_path_free (path);
}
else
result = FALSE;
return result;
}
/**
......@@ -774,26 +804,34 @@ gtk_file_chooser_get_uris (GtkFileChooser *chooser)
* The user will be shown the full contents of the current folder,
* plus user interface elements for navigating to other folders.
*
* Return value: %TRUE if the folder could be changed successfully, %FALSE
* otherwise.
*
* Since: 2.4
**/
void
gboolean
gtk_file_chooser_set_current_folder_uri (GtkFileChooser *chooser,
const gchar *uri)
{
GtkFileSystem *file_system;
GtkFilePath *path;
gboolean result;
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
g_return_if_fail (uri != NULL);
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
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_path (chooser, path);
result = _gtk_file_chooser_set_current_folder_path (chooser, path, NULL);
gtk_file_path_free (path);
}
else
result = FALSE;
return result;
}
/**
......@@ -830,20 +868,26 @@ gtk_file_chooser_get_current_folder_uri (GtkFileChooser *chooser)
* _gtk_file_chooser_set_current_folder_path:
* @chooser: a #GtkFileChooser
* @path: the #GtkFilePath for the new folder
* @error: location to store error, or %NULL.
*
* Sets the current folder for @chooser from a #GtkFilePath.
* Internal function, see gtk_file_chooser_set_current_folder_uri().
*
* Return value: %TRUE if the folder could be changed successfully, %FALSE
* otherwise.
*
* Since: 2.4
**/
void
gboolean
_gtk_file_chooser_set_current_folder_path (GtkFileChooser *chooser,
const GtkFilePath *path)
const GtkFilePath *path,
GError **error)
{
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
g_return_if_fail (path != NULL);
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
g_return_val_if_fail (path != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
GTK_FILE_CHOOSER_GET_IFACE (chooser)->set_current_folder (chooser, path);
return GTK_FILE_CHOOSER_GET_IFACE (chooser)->set_current_folder (chooser, path, error);
}
/**
......@@ -870,19 +914,26 @@ _gtk_file_chooser_get_current_folder_path (GtkFileChooser *chooser)
* _gtk_file_chooser_select_path:
* @chooser: a #GtkFileChooser
* @path: the path to select
* @error: location to store error, or %NULL
*
* Selects the file referred to by @path. An internal function. See
* _gtk_file_chooser_select_uri().
*
* Return value: %TRUE if both the folder could be changed and the path was
* selected successfully, %FALSE otherwise.
*
* Since: 2.4
**/
void
gboolean
_gtk_file_chooser_select_path (GtkFileChooser *chooser,
const GtkFilePath *path)
const GtkFilePath *path,
GError **error)
{
g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
g_return_val_if_fail (path != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
GTK_FILE_CHOOSER_GET_IFACE (chooser)->select_path (chooser, path);
return GTK_FILE_CHOOSER_GET_IFACE (chooser)->select_path (chooser, path, error);
}
/**
......
......@@ -65,39 +65,41 @@ void gtk_file_chooser_set_select_multiple (GtkFileChooser
gboolean select_multiple);
gboolean gtk_file_chooser_get_select_multiple (GtkFileChooser *chooser);
/* Suggested name for the Save-type actions
*/
void gtk_file_chooser_set_current_name (GtkFileChooser *chooser,
const gchar *name);
/* Filename manipulation
*/
void gtk_file_chooser_set_current_name (GtkFileChooser *chooser,
const gchar *name);
gchar * gtk_file_chooser_get_filename (GtkFileChooser *chooser);
void gtk_file_chooser_set_filename (GtkFileChooser *chooser,
const char *filename);
void gtk_file_chooser_select_filename (GtkFileChooser *chooser,
const char *filename);
void gtk_file_chooser_unselect_filename (GtkFileChooser *chooser,
const char *filename);
void gtk_file_chooser_select_all (GtkFileChooser *chooser);
void gtk_file_chooser_unselect_all (GtkFileChooser *chooser);
GSList *gtk_file_chooser_get_filenames (GtkFileChooser *chooser);
void gtk_file_chooser_set_current_folder (GtkFileChooser *chooser,
const gchar *filename);
gchar *gtk_file_chooser_get_current_folder (GtkFileChooser *chooser);
gchar * gtk_file_chooser_get_filename (GtkFileChooser *chooser);
gboolean gtk_file_chooser_set_filename (GtkFileChooser *chooser,
const char *filename);
gboolean gtk_file_chooser_select_filename (GtkFileChooser *chooser,
const char *filename);
void gtk_file_chooser_unselect_filename (GtkFileChooser *chooser,
const char *filename);
void gtk_file_chooser_select_all (GtkFileChooser *chooser);
void gtk_file_chooser_unselect_all (GtkFileChooser *chooser);
GSList * gtk_file_chooser_get_filenames (GtkFileChooser *chooser);
gboolean gtk_file_chooser_set_current_folder (GtkFileChooser *chooser,
const gchar *filename);
gchar * gtk_file_chooser_get_current_folder (GtkFileChooser *chooser);
/* URI manipulation
*/
gchar * gtk_file_chooser_get_uri (GtkFileChooser *chooser);
void gtk_file_chooser_set_uri (GtkFileChooser *chooser,
const char *uri);
void gtk_file_chooser_select_uri (GtkFileChooser *chooser,
const char *uri);
void gtk_file_chooser_unselect_uri (GtkFileChooser *chooser,
const char *uri);
GSList *gtk_file_chooser_get_uris (GtkFileChooser *chooser);
void gtk_file_chooser_set_current_folder_uri (GtkFileChooser *chooser,
const gchar *uri);
gchar *gtk_file_chooser_get_current_folder_uri (GtkFileChooser *chooser);
gchar * gtk_file_chooser_get_uri (GtkFileChooser *chooser);
gboolean gtk_file_chooser_set_uri (GtkFileChooser *chooser,
const char *uri);
gboolean gtk_file_chooser_select_uri (GtkFileChooser *chooser,
const char *uri);
void gtk_file_chooser_unselect_uri (GtkFileChooser *chooser,
const char *uri);
GSList * gtk_file_chooser_get_uris (GtkFileChooser *chooser);
gboolean gtk_file_chooser_set_current_folder_uri (GtkFileChooser *chooser,
const gchar *uri);
gchar * gtk_file_chooser_get_current_folder_uri (GtkFileChooser *chooser);
/* Preview widget
*/
......
......@@ -241,13 +241,15 @@ static void gtk_file_chooser_default_style_set (GtkWidget *
static void gtk_file_chooser_default_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen);
static void gtk_file_chooser_default_set_current_folder (GtkFileChooser *chooser,
const GtkFilePath *path);
static gboolean gtk_file_chooser_default_set_current_folder (GtkFileChooser *chooser,
const GtkFilePath *path,
GError **error);
static GtkFilePath * gtk_file_chooser_default_get_current_folder (GtkFileChooser *chooser);
static void gtk_file_chooser_default_set_current_name (GtkFileChooser *chooser,
const gchar *name);
static void gtk_file_chooser_default_select_path (GtkFileChooser *chooser,
const GtkFilePath *path);
static gboolean gtk_file_chooser_default_select_path (GtkFileChooser *chooser,
const GtkFilePath *path,
GError **error);
static void gtk_file_chooser_default_unselect_path (GtkFileChooser *chooser,
const GtkFilePath *path);
static void gtk_file_chooser_default_select_all (GtkFileChooser *chooser);
......@@ -663,6 +665,35 @@ error_building_filename_dialog (GtkFileChooserDefault *impl,
g_error_free (error);
}
/* Shows an error dialog when we cannot switch to a folder */
static void
error_changing_folder_dialog (GtkFileChooserDefault *impl,
const GtkFilePath *path,
GError *error)
{
error_dialog (impl,
_("Could not change the current folder to %s:\n%s"),
path,
error);
}
/* Changes folders, displaying an error dialog if this fails */
static gboolean
change_folder_and_display_error (GtkFileChooserDefault *impl,
const GtkFilePath *path)
{
GError *error;
gboolean result;
error = NULL;
result = _gtk_file_chooser_set_current_folder_path (GTK_FILE_CHOOSER (impl), path, &error);
if (!result)
error_changing_folder_dialog (impl, path, error);
return result;
}
static void
update_preview_widget_visibility (GtkFileChooserDefault *impl)
{
......@@ -1108,7 +1139,7 @@ shortcuts_add_current_folder (GtkFileChooserDefault *impl)
base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
else
base_path = NULL;
if (base_path &&
strcmp (gtk_file_path_get_string (base_path), gtk_file_path_get_string (impl->current_folder)) == 0)
{
......@@ -2919,20 +2950,19 @@ update_chooser_entry (GtkFileChooserDefault *impl)
gtk_file_info_get_display_name (info));
}
static void
static gboolean
gtk_file_chooser_default_set_current_folder (GtkFileChooser *chooser,
const GtkFilePath *path)
const GtkFilePath *path,
GError **error)
{
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
GError *error;
GError *err;
error = NULL;
if (!_gtk_path_bar_set_path (GTK_PATH_BAR (impl->browse_path_bar), path, impl->file_system, &error))
err = NULL;
if (!_gtk_path_bar_set_path (GTK_PATH_BAR (impl->browse_path_bar), path, impl->file_system, &err))
{
error_dialog (impl,
_("Could not set current folder: %s"),
path, error);
return;
g_propagate_error (error, err);
return FALSE;
}
if (impl->current_folder != path)
......@@ -2971,6 +3001,8 @@ gtk_file_chooser_default_set_current_folder (GtkFileChooser *chooser,
bookmarks_check_add_sensitivity (impl);
g_signal_emit_by_name (impl, "selection-changed", 0);
return TRUE;
}
static GtkFilePath *
......@@ -3008,32 +3040,37 @@ select_func (GtkFileSystemModel *model,
gtk_tree_path_free (sorted_path);