}
static void
-midori_bookmarks_add_item_cb (KatzeArray* bookmarks,
- GObject* item)
+midori_bookmarks_add_item_cb (KatzeArray* folder,
+ GObject* item,
+ KatzeArray* bookmarks);
+
+static void
+midori_bookmarks_remove_item_cb (KatzeArray* bookmarks,
+ GObject* item);
+
+static void
+midori_bookmarks_add_item_cb (KatzeArray* folder,
+ GObject* item,
+ KatzeArray* bookmarks)
{
gchar* config_file;
GError* error;
g_error_free (error);
}
g_free (config_file);
+
+ if (folder == bookmarks && KATZE_IS_ARRAY (item))
+ {
+ g_signal_connect_after (item, "add-item",
+ G_CALLBACK (midori_bookmarks_add_item_cb), bookmarks);
+ g_signal_connect_after (item, "remove-item",
+ G_CALLBACK (midori_bookmarks_remove_item_cb), NULL);
+ }
}
static void
g_error_free (error);
}
g_free (config_file);
+
+ if (KATZE_IS_ARRAY (item))
+ g_signal_handlers_disconnect_by_func (item,
+ midori_bookmarks_add_item_cb, bookmarks);
}
static void
g_signal_connect_after (search_engines, "remove-item",
G_CALLBACK (midori_search_engines_remove_item_cb), NULL);
g_signal_connect_after (bookmarks, "add-item",
- G_CALLBACK (midori_bookmarks_add_item_cb), NULL);
+ G_CALLBACK (midori_bookmarks_add_item_cb), bookmarks);
g_signal_connect_after (bookmarks, "remove-item",
G_CALLBACK (midori_bookmarks_remove_item_cb), NULL);
+ if (!katze_array_is_empty (bookmarks))
+ {
+ guint i, n;
+ n = katze_array_get_length (bookmarks);
+ for (i = 0; i < n; i++)
+ {
+ KatzeItem* item = katze_array_get_nth_item (bookmarks, i);
+ if (KATZE_IS_ARRAY (item))
+ {
+ g_signal_connect_after (item, "add-item",
+ G_CALLBACK (midori_bookmarks_add_item_cb), bookmarks);
+ g_signal_connect_after (item, "remove-item",
+ G_CALLBACK (midori_bookmarks_remove_item_cb), NULL);
+ }
+ }
+ }
g_signal_connect_after (trash, "add-item",
G_CALLBACK (midori_trash_add_item_cb), NULL);
g_signal_connect_after (trash, "remove-item",