summaryrefslogtreecommitdiff
path: root/gtk/gtkfilechooserutils.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@ximian.com>2004-03-05 20:47:05 +0000
committerFederico Mena Quintero <federico@src.gnome.org>2004-03-05 20:47:05 +0000
commit385bd6a54e2c0b6b2ca69c8f66d5657a48f78b47 (patch)
tree273f971089b0240539873b82ef6d645aafba15c1 /gtk/gtkfilechooserutils.c
parentc43e4377481bb7f04745438fa8217943c2e2ea3b (diff)
downloadgtk+-385bd6a54e2c0b6b2ca69c8f66d5657a48f78b47.tar.gz
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.
Diffstat (limited to 'gtk/gtkfilechooserutils.c')
-rw-r--r--gtk/gtkfilechooserutils.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/gtk/gtkfilechooserutils.c b/gtk/gtkfilechooserutils.c
index 653f196a87..f957771888 100644
--- a/gtk/gtkfilechooserutils.c
+++ b/gtk/gtkfilechooserutils.c
@@ -24,13 +24,15 @@
#include "gtkfilesystem.h"
#include "gtktypebuiltins.h"
-static void delegate_set_current_folder (GtkFileChooser *chooser,
- const GtkFilePath *path);
+static gboolean delegate_set_current_folder (GtkFileChooser *chooser,
+ const GtkFilePath *path,
+ GError **error);
static GtkFilePath * delegate_get_current_folder (GtkFileChooser *chooser);
static void delegate_set_current_name (GtkFileChooser *chooser,
const gchar *name);
-static void delegate_select_path (GtkFileChooser *chooser,
- const GtkFilePath *path);
+static gboolean delegate_select_path (GtkFileChooser *chooser,
+ const GtkFilePath *path,
+ GError **error);
static void delegate_unselect_path (GtkFileChooser *chooser,
const GtkFilePath *path);
static void delegate_select_all (GtkFileChooser *chooser);
@@ -65,7 +67,7 @@ static void delegate_file_activated (GtkFileChooser *choose
/**
* _gtk_file_chooser_install_properties:
* @klass: the class structure for a type deriving from #GObject
- *
+ *
* Installs the necessary properties for a class implementing
* #GtkFileChooser. A #GtkParamSpecOverride property is installed
* for each property, using the values from the #GtkFileChooserProp
@@ -111,7 +113,7 @@ _gtk_file_chooser_install_properties (GObjectClass *klass)
/**
* _gtk_file_chooser_delegate_iface_init:
* @iface: a #GtkFileChoserIface structure
- *
+ *
* An interface-initialization function for use in cases where
* an object is simply delegating the methods, signals of
* the #GtkFileChooser interface to another object.
@@ -157,7 +159,7 @@ _gtk_file_chooser_set_delegate (GtkFileChooser *receiver,
{
g_return_if_fail (GTK_IS_FILE_CHOOSER (receiver));
g_return_if_fail (GTK_IS_FILE_CHOOSER (delegate));
-
+
g_object_set_data (G_OBJECT (receiver), "gtk-file-chooser-delegate", delegate);
g_signal_connect (delegate, "notify",
@@ -178,11 +180,12 @@ get_delegate (GtkFileChooser *receiver)
return g_object_get_data (G_OBJECT (receiver), "gtk-file-chooser-delegate");
}
-static void
+static gboolean
delegate_select_path (GtkFileChooser *chooser,
- const GtkFilePath *path)
+ const GtkFilePath *path,
+ GError **error)
{
- _gtk_file_chooser_select_path (get_delegate (chooser), path);
+ return _gtk_file_chooser_select_path (get_delegate (chooser), path, error);
}
static void
@@ -264,11 +267,12 @@ delegate_list_shortcut_folders (GtkFileChooser *chooser)
return gtk_file_chooser_list_shortcut_folders (get_delegate (chooser));
}
-static void
+static gboolean
delegate_set_current_folder (GtkFileChooser *chooser,
- const GtkFilePath *path)
+ const GtkFilePath *path,
+ GError **error)
{
- _gtk_file_chooser_set_current_folder_path (get_delegate (chooser), path);
+ return _gtk_file_chooser_set_current_folder_path (get_delegate (chooser), path, error);
}
static GtkFilePath *