[epiphany] bookmarks-manager: fix handling of bookmarks import
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] bookmarks-manager: fix handling of bookmarks import
- Date: Tue, 24 Jan 2017 03:09:01 +0000 (UTC)
commit 2fdd7eec77097d236a8e8abb2caff002b81df357
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Mon Jan 23 21:04:48 2017 -0600
bookmarks-manager: fix handling of bookmarks import
When importing bookmarks we don't emit the bookmark-added signal, nor do
we connect to all the signals that we watch for other bookmarks, leading
to the result that the bookmarks popover can get really broken after a
bookmarks import until the browser is closed and restarted.
We only uncovered this bug because it so happened that I requested a
.gvdb file to help reproduce a different issue. Lucky.
https://bugzilla.gnome.org/show_bug.cgi?id=772131
src/bookmarks/ephy-bookmarks-manager.c | 29 +++++++++++++++++++----------
1 files changed, 19 insertions(+), 10 deletions(-)
---
diff --git a/src/bookmarks/ephy-bookmarks-manager.c b/src/bookmarks/ephy-bookmarks-manager.c
index f5a4ae1..3469bd3 100644
--- a/src/bookmarks/ephy-bookmarks-manager.c
+++ b/src/bookmarks/ephy-bookmarks-manager.c
@@ -221,6 +221,20 @@ ephy_bookmarks_manager_new (void)
return EPHY_BOOKMARKS_MANAGER (g_object_new (EPHY_TYPE_BOOKMARKS_MANAGER, NULL));
}
+static void
+ephy_bookmarks_manager_watch_bookmark (EphyBookmarksManager *self,
+ EphyBookmark *bookmark)
+{
+ g_signal_connect_object (bookmark, "notify::title",
+ G_CALLBACK (bookmark_title_changed_cb), self, 0);
+ g_signal_connect_object (bookmark, "notify::url",
+ G_CALLBACK (bookmark_url_changed_cb), self, 0);
+ g_signal_connect_object (bookmark, "tag-added",
+ G_CALLBACK (bookmark_tag_added_cb), self, 0);
+ g_signal_connect_object (bookmark, "tag-removed",
+ G_CALLBACK (bookmark_tag_removed_cb), self, 0);
+}
+
void
ephy_bookmarks_manager_add_bookmark (EphyBookmarksManager *self,
EphyBookmark *bookmark)
@@ -245,15 +259,7 @@ ephy_bookmarks_manager_add_bookmark (EphyBookmarksManager *self,
ephy_bookmarks_manager_save_to_file_async (self, NULL,
(GAsyncReadyCallback)ephy_bookmarks_manager_save_to_file_warn_on_error_cb,
NULL);
-
- g_signal_connect_object (bookmark, "notify::title",
- G_CALLBACK (bookmark_title_changed_cb), self, 0);
- g_signal_connect_object (bookmark, "notify::url",
- G_CALLBACK (bookmark_url_changed_cb), self, 0);
- g_signal_connect_object (bookmark, "tag-added",
- G_CALLBACK (bookmark_tag_added_cb), self, 0);
- g_signal_connect_object (bookmark, "tag-removed",
- G_CALLBACK (bookmark_tag_removed_cb), self, 0);
+ ephy_bookmarks_manager_watch_bookmark (self, bookmark);
}
}
@@ -274,8 +280,11 @@ ephy_bookmarks_manager_add_bookmarks (EphyBookmarksManager *self,
if (!g_sequence_lookup (self->bookmarks,
bookmark,
(GCompareDataFunc)ephy_bookmark_bookmarks_sort_func,
- NULL))
+ NULL)) {
g_sequence_prepend (self->bookmarks, g_object_ref (bookmark));
+ g_signal_emit (self, signals[BOOKMARK_ADDED], 0, bookmark);
+ ephy_bookmarks_manager_watch_bookmark (self, bookmark);
+ }
}
g_sequence_sort (self->bookmarks,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]