Commit 8ad0abb8 authored by Tommi Komulainen's avatar Tommi Komulainen Committed by Tommi Komulainen
Browse files

Add ALREADY_EXISTS error code. Return an error code when the shortcut

2005-10-10  Tommi Komulainen  <tommi.komulainen@iki.fi>

	* gtk/gtkfilechooser.h (GtkFileChooserError): Add ALREADY_EXISTS error
	code.
	* gtk/gtkfilechooserdefault.c
	(gtk_file_chooser_default_add_shortcut_folder): Return an error code
	when the shortcut already exists in the sidebar.  (#147521)
parent 080fc7ec
2005-10-10 Tommi Komulainen <tommi.komulainen@iki.fi>
* gtk/gtkfilechooser.h (GtkFileChooserError): Add ALREADY_EXISTS error
code.
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_add_shortcut_folder): Return an error code
when the shortcut already exists in the sidebar. (#147521)
2005-10-09 Matthias Clasen <mclasen@redhat.com>
* tests/testcombo.c: Demonstrate how to use custom widgets in
......
2005-10-10 Tommi Komulainen <tommi.komulainen@iki.fi>
* gtk/gtkfilechooser.h (GtkFileChooserError): Add ALREADY_EXISTS error
code.
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_add_shortcut_folder): Return an error code
when the shortcut already exists in the sidebar. (#147521)
2005-10-09 Matthias Clasen <mclasen@redhat.com>
* tests/testcombo.c: Demonstrate how to use custom widgets in
......
......@@ -55,7 +55,8 @@ GType gtk_file_chooser_get_type (void) G_GNUC_CONST;
typedef enum {
GTK_FILE_CHOOSER_ERROR_NONEXISTENT,
GTK_FILE_CHOOSER_ERROR_BAD_FILENAME
GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
GTK_FILE_CHOOSER_ERROR_ALREADY_EXISTS
} GtkFileChooserError;
GQuark gtk_file_chooser_error_quark (void);
......
......@@ -5846,6 +5846,23 @@ gtk_file_chooser_default_add_shortcut_folder (GtkFileChooser *chooser,
if (!check_is_folder (impl->file_system, path, error))
return FALSE;
/* Avoid adding duplicates */
pos = shortcut_find_position (impl, path);
if (pos >= 0 && pos < shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS_SEPARATOR))
{
gchar *uri;
uri = gtk_file_system_path_to_uri (impl->file_system, path);
g_set_error (error,
GTK_FILE_CHOOSER_ERROR,
GTK_FILE_CHOOSER_ERROR_ALREADY_EXISTS,
_("shortcut %s already exists"),
uri);
g_free (uri);
return FALSE;
}
pos = shortcuts_get_pos_for_shortcut_folder (impl, impl->num_shortcuts);
result = shortcuts_insert_path (impl, pos, FALSE, NULL, path, NULL, FALSE, error);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment