+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
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);
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);