After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 780564 - Epiphany doesn't import all bookmarks from Firefox
Epiphany doesn't import all bookmarks from Firefox
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: Bookmarks
3.24.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-03-26 18:27 UTC by Eddy Castillo
Modified: 2017-04-01 07:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
bookmarks (223.58 KB, text/html)
2017-03-26 18:27 UTC, Eddy Castillo
  Details
bookmarks: Fix problem causing bookmarks to disappear after an import (7.29 KB, patch)
2017-03-31 16:08 UTC, Iulian Radu
none Details | Review
bookmarks-import: Display new bookmarks immediately after an import (1.49 KB, patch)
2017-03-31 16:08 UTC, Iulian Radu
none Details | Review
bookmarks-manager: Change *_add_bookmark() to be (transfer none) (5.47 KB, patch)
2017-03-31 16:08 UTC, Iulian Radu
none Details | Review
bookmarks: Fix problem causing bookmarks to disappear after an import (7.64 KB, patch)
2017-03-31 20:48 UTC, Iulian Radu
committed Details | Review
bookmarks-import: Display new bookmarks immediately after an import (1.49 KB, patch)
2017-03-31 20:48 UTC, Iulian Radu
committed Details | Review
bookmarks-manager: Change *_add_bookmark() to be (transfer none) (5.13 KB, patch)
2017-03-31 20:48 UTC, Iulian Radu
committed Details | Review
bookmarks-manager: Change *_add_bookmark() to be (transfer none) (5.13 KB, patch)
2017-04-01 07:22 UTC, Iulian Radu
committed Details | Review
bookmarks-import: Display new bookmarks immediately after an import (1.49 KB, patch)
2017-04-01 07:22 UTC, Iulian Radu
committed Details | Review
bookmarks: Fix problem causing bookmarks to disappear after an import (7.63 KB, patch)
2017-04-01 07:23 UTC, Iulian Radu
committed Details | Review

Description Eddy Castillo 2017-03-26 18:27:21 UTC
Created attachment 348744 [details]
bookmarks

Epiphany doesn't import all bookmarks from Firefox using the new system. I have attached a sample to test it.

To reproduce:
1. In Firefox: Import the html file attached in the bookmarks manager window.
2. In epiphany: Import bookmarks from Firefox.

Expected results:
All bookmarks imported.

Actual results:
Only some bookmarks are imported.
Comment 1 Iulian Radu 2017-03-31 16:08:33 UTC
Created attachment 349064 [details] [review]
bookmarks: Fix problem causing bookmarks to disappear after an import

This fixes some bugs mainly related to importing bookmarks from Firefox.
In ephy_bookmarks_manager_add_bookmarks(), g_sequence_lookup()
was called on an unsorted sequence, which caused the function
to fail and not add bookmarks to the manager. Besides that, the compare
function used for various GSequence operations did not treat the
case where the time_added was equal for both bookmarks.
Comment 2 Iulian Radu 2017-03-31 16:08:41 UTC
Created attachment 349065 [details] [review]
bookmarks-import: Display new bookmarks immediately after an import

This fixes the problem where the browser has to be restarted after
importing a set of bookmarks from a gvdb file/firefox profile.
Comment 3 Iulian Radu 2017-03-31 16:08:48 UTC
Created attachment 349066 [details] [review]
bookmarks-manager: Change *_add_bookmark() to be (transfer none)

This should fix the inconsistency between *_add_bookmarks() and
*_add_bookmark().
Comment 4 Michael Catanzaro 2017-03-31 17:11:28 UTC
Review of attachment 349064 [details] [review]:

Great work, thanks a bunch!

::: src/bookmarks/ephy-bookmark.c
@@ +504,3 @@
 
+  if (time2 - time1 == 0)
+    return g_strcmp0 (ephy_bookmark_get_title (bookmark1),

I don't think this is good enough. You can have two bookmarks with the same title and time created, right? Don't you need to check the bookmark ID as well?
Comment 5 Michael Catanzaro 2017-03-31 17:13:13 UTC
Review of attachment 349065 [details] [review]:

::: src/bookmarks/ephy-bookmarks-manager.c
@@ +352,3 @@
+      position = g_sequence_iter_get_position (new_iter);
+
+      g_list_model_items_changed (G_LIST_MODEL (self), position, 0, 1);

Don't you think it would be better without the blank line above?
Comment 6 Michael Catanzaro 2017-03-31 17:14:34 UTC
Review of attachment 349066 [details] [review]:

::: src/bookmarks/ephy-bookmarks-manager.c
@@ +286,3 @@
 }
 
+

Don't add this blank line here.
Comment 7 Iulian Radu 2017-03-31 20:48:24 UTC
Created attachment 349078 [details] [review]
bookmarks: Fix problem causing bookmarks to disappear after an import

This fixes some bugs mainly related to importing bookmarks from Firefox.
In ephy_bookmarks_manager_add_bookmarks(), g_sequence_lookup()
was called on an unsorted sequence, which caused the function
to fail and not add bookmarks to the manager. Besides that, the compare
function used for various GSequence operations did not treat the
case where the time_added was equal for both bookmarks.
Comment 8 Iulian Radu 2017-03-31 20:48:34 UTC
Created attachment 349079 [details] [review]
bookmarks-import: Display new bookmarks immediately after an import

This fixes the problem where the browser has to be restarted after
importing a set of bookmarks from a gvdb file/firefox profile.
Comment 9 Iulian Radu 2017-03-31 20:48:40 UTC
Created attachment 349080 [details] [review]
bookmarks-manager: Change *_add_bookmark() to be (transfer none)

This should fix the inconsistency between *_add_bookmarks() and
*_add_bookmark().
Comment 10 Iulian Radu 2017-03-31 20:50:40 UTC
Please have a look at attachment 349074 [details] [review] as I also changed around line 300 in ephy-bookmarks-manager.c. I don't want to break anything else.
Comment 11 Michael Catanzaro 2017-03-31 21:36:58 UTC
(In reply to Iulian Radu from comment #10)
> Please have a look at attachment 349074 [details] [review] [review] as I also changed
> around line 300 in ephy-bookmarks-manager.c. I don't want to break anything
> else.

This is a GNOME Documents patch; which one did you really mean?
Comment 12 Michael Catanzaro 2017-03-31 21:40:03 UTC
Review of attachment 349079 [details] [review]:

OK
Comment 13 Michael Catanzaro 2017-03-31 21:40:11 UTC
Review of attachment 349080 [details] [review]:

OK
Comment 14 Michael Catanzaro 2017-03-31 21:40:19 UTC
Review of attachment 349078 [details] [review]:

::: src/bookmarks/ephy-bookmark.c
@@ +520,3 @@
+
+      return g_strcmp0 (id1, id2);
+    }

This looks right now, but I'd write it differently to avoid having two levels of nesting, and to avoid the return values from being separated so far from their corresponding checks. E.g.:

if (time2 - time1 != 0)
  return time2 - time1;

if (title_result != 0)
  return title_result;

That way, it will read more naturally/linearly.
Comment 15 Iulian Radu 2017-03-31 21:48:26 UTC
I meant 349078, sorry!
Comment 16 Michael Catanzaro 2017-03-31 22:50:26 UTC
The change looks sane to me.
Comment 17 Iulian Radu 2017-04-01 07:22:46 UTC
The following fixes have been pushed:
4562e88 bookmarks-manager: Change *_add_bookmark() to be (transfer none)
1d8b2e3 bookmarks-import: Display new bookmarks immediately after an import
aa05f49 bookmarks: Fix problem causing bookmarks to disappear after an import
Comment 18 Iulian Radu 2017-04-01 07:22:51 UTC
Created attachment 349102 [details] [review]
bookmarks-manager: Change *_add_bookmark() to be (transfer none)

This should fix the inconsistency between *_add_bookmarks() and
*_add_bookmark().
Comment 19 Iulian Radu 2017-04-01 07:22:56 UTC
Created attachment 349103 [details] [review]
bookmarks-import: Display new bookmarks immediately after an import

This fixes the problem where the browser has to be restarted after
importing a set of bookmarks from a gvdb file/firefox profile.
Comment 20 Iulian Radu 2017-04-01 07:23:04 UTC
Created attachment 349104 [details] [review]
bookmarks: Fix problem causing bookmarks to disappear after an import

This fixes some bugs mainly related to importing bookmarks from Firefox.
In ephy_bookmarks_manager_add_bookmarks(), g_sequence_lookup()
was called on an unsorted sequence, which caused the function
to fail and not add bookmarks to the manager. Besides that, the compare
function used for various GSequence operations did not treat the
case where the time_added was equal for both bookmarks.