diff options
author | Federico Mena Quintero <federico@ximian.com> | 2004-02-27 20:48:22 +0000 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2004-02-27 20:48:22 +0000 |
commit | c9e88e4e67c7dac0a59dbb5d296247725415da0e (patch) | |
tree | 3bf19c7d755e2d61f9b86755cf86c6a40d11597d /gtk/gtkfilesystem.c | |
parent | cc7c7d22639792bec201ebadb8513128dc97bd75 (diff) | |
download | gtk+-c9e88e4e67c7dac0a59dbb5d296247725415da0e.tar.gz |
Added a "position" argument.
2004-02-27 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilesystem.c (gtk_file_system_insert_bookmark): Added a
"position" argument.
* gtk/gtkfilesystem.h (GtkFileSystemError): Added value for
GTK_FILE_SYSTEM_ERROR_ALREADY_EXISTS.
(struct _GtkFileSystemIface): Added a "position" argument to the
::insert_bookmark() method.
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_insert_bookmark):
Updated; renamed from gtk_file_system_unix_add_bookmark(). Return
an error if the path already exists in the bookmarks list.
(gtk_file_system_unix_remove_bookmark): Return an error if the
path does not exist in the bookmarks list.
* gtk/gtkfilechooserdefault.c (shortcuts_add_bookmark_from_path):
For now, use gtk_file_system_insert_bookmark() with -1 for the
position. DnD will come next.
Diffstat (limited to 'gtk/gtkfilesystem.c')
-rw-r--r-- | gtk/gtkfilesystem.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/gtk/gtkfilesystem.c b/gtk/gtkfilesystem.c index 248017c728..8be7443bbf 100644 --- a/gtk/gtkfilesystem.c +++ b/gtk/gtkfilesystem.c @@ -665,36 +665,46 @@ gtk_file_system_render_icon (GtkFileSystem *file_system, } /** - * gtk_file_system_add_bookmark: + * gtk_file_system_insert_bookmark: * @file_system: a #GtkFileSystem - * @bookmark: path of the bookmark to add + * @path: path of the bookmark to add + * @position: index in the bookmarks list at which the @path should be inserted; use 0 + * for the beginning, and -1 or the number of bookmarks itself for the end of the list. * @error: location to store error, or %NULL * - * Adds a bookmark folder to the user's bookmarks list. If the operation succeeds, - * the "bookmarks_changed" signal will be emitted. + * Adds a path for a folder to the user's bookmarks list. If the operation + * succeeds, the "bookmarks_changed" signal will be emitted. Bookmark paths are + * unique; if you try to insert a @path that already exists, the operation will + * fail and the @error will be set to #GTK_FILE_SYSTEM_ERROR_ALREADY_EXISTS. To + * reorder the list of bookmarks, use gtk_file_system_remove_bookmark() to + * remove the path in question, and call gtk_file_system_insert_bookmark() with + * the new position for the path. * * Return value: TRUE if the operation succeeds, FALSE otherwise. In the latter case, * the @error value will be set. **/ gboolean -gtk_file_system_add_bookmark (GtkFileSystem *file_system, - const GtkFilePath *path, - GError **error) +gtk_file_system_insert_bookmark (GtkFileSystem *file_system, + const GtkFilePath *path, + gint position, + GError **error) { g_return_val_if_fail (GTK_IS_FILE_SYSTEM (file_system), FALSE); g_return_val_if_fail (path != NULL, FALSE); - return GTK_FILE_SYSTEM_GET_IFACE (file_system)->add_bookmark (file_system, path, error); + return GTK_FILE_SYSTEM_GET_IFACE (file_system)->insert_bookmark (file_system, path, position, error); } /** * gtk_file_system_remove_bookmark: * @file_system: a #GtkFileSystem - * @bookmark: path of the bookmark to remove + * @path: path of the bookmark to remove * @error: location to store error, or %NULL * * Removes a bookmark folder from the user's bookmarks list. If the operation - * succeeds, the "bookmarks_changed" signal will be emitted. + * succeeds, the "bookmarks_changed" signal will be emitted. If you try to remove + * a @path which does not exist in the bookmarks list, the operation will fail + * and the @error will be set to GTK_FILE_SYSTEM_ERROR_NONEXISTENT. * * Return value: TRUE if the operation succeeds, FALSE otherwise. In the latter * case, the @error value will be set. |