From e247529b6bf93c652f6ba8d8485703f016967cee Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Fri, 16 Jan 2009 05:04:42 +0100 Subject: [PATCH] Do monitor changes of bookmarks and save on any change --- midori/main.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/midori/main.c b/midori/main.c index 0a84b1e8..f15f6304 100644 --- a/midori/main.c +++ b/midori/main.c @@ -1048,6 +1048,24 @@ katze_array_to_file (KatzeArray* array, return TRUE; } +static void +midori_bookmarks_notify_item_cb (KatzeArray* folder, + GParamSpec* pspec, + KatzeArray* bookmarks) +{ + gchar* config_file; + GError* error; + + config_file = build_config_filename ("bookmarks.xbel"); + error = NULL; + if (!katze_array_to_file (bookmarks, config_file, &error)) + { + g_warning (_("The bookmarks couldn't be saved. %s"), error->message); + g_error_free (error); + } + g_free (config_file); +} + static void midori_bookmarks_add_item_cb (KatzeArray* folder, GObject* item, @@ -1081,6 +1099,9 @@ midori_bookmarks_add_item_cb (KatzeArray* folder, g_signal_connect_after (item, "remove-item", G_CALLBACK (midori_bookmarks_remove_item_cb), NULL); } + + g_signal_connect_after (item, "notify", + G_CALLBACK (midori_bookmarks_notify_item_cb), NULL); } static void @@ -2197,6 +2218,8 @@ main (int argc, g_signal_connect_after (item, "remove-item", G_CALLBACK (midori_bookmarks_remove_item_cb), NULL); } + g_signal_connect_after (item, "notify", + G_CALLBACK (midori_bookmarks_notify_item_cb), bookmarks); } } g_signal_connect_after (trash, "add-item", -- 2.39.5