Commit 5adf0129 authored by Leesoo Ahn's avatar Leesoo Ahn

bookmark-list: Add an error handler of saving bookmark list

For arbitrary reasons, g_mkdir_with_parents can be failed.
That could lead to an error that fails to replace contents of
new bookmark list.
parent 46000db0
Pipeline #43679 failed with stages
in 21 minutes and 55 seconds
......@@ -31,6 +31,7 @@
#include <gio/gio.h>
#include <string.h>
#include <errno.h>
#define LOAD_JOB 1
......@@ -54,12 +55,20 @@ enum
static guint signals[LAST_SIGNAL];
/* forward declarations */
#define NAUTILUS_BOOKMARK_LIST_ERROR (nautilus_bookmark_list_error_quark())
static GQuark nautilus_bookmark_list_error_quark (void);
static void nautilus_bookmark_list_load_file (NautilusBookmarkList *bookmarks);
static void nautilus_bookmark_list_save_file (NautilusBookmarkList *bookmarks);
G_DEFINE_TYPE (NautilusBookmarkList, nautilus_bookmark_list, G_TYPE_OBJECT)
static GQuark
nautilus_bookmark_list_error_quark (void)
return g_quark_from_static_string ("nautilus-bookmark-list-error-quark");
static NautilusBookmark *
new_bookmark_from_uri (const char *uri, const char *label)
......@@ -458,7 +467,15 @@ save_io_thread (GTask *task,
parent = g_file_get_parent (file);
path = g_file_get_path (parent);
g_mkdir_with_parents (path, 0700);
if (g_mkdir_with_parents (path, 0700) == -1) {
int saved_errno = errno;
g_set_error (&error, NAUTILUS_BOOKMARK_LIST_ERROR, 0,
"Failed to create bookmarks folder %s: %s",
path, g_strerror (saved_errno));
g_task_return_error (task, error);
contents = (gchar *) g_task_get_task_data (task);
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