GNOME Bugzilla – Bug 772668
ephy_bookmarks_manager_save_to_file_async should actually be async
Last modified: 2018-08-03 20:53:28 UTC
I was making a couple minor improvements to migrate_bookmarks, when I noticed a curious problem: How is it that ephy_bookmarks_manager_save_to_file_async always finishes? Then I revised the question: How does it even do anything? There is no main loop! Then I discovered that ephy_bookmarks_manager_save_to_file_async is a nice asynchronous-looking wrapper for a synchronous function call. Looks like I reviewed the code too fast. :) Since gvdb doesn't have an async API, we probably need to use g_task_run_in_thread(). (And then we'll need to update the profile migrator to use the sync version.)
I think we should follow the opposite approach regarding the name, ephy_bookmarks_manager_save_to_file should be async, and if we need to a dd a sync version we add ephy_bookmarks_manager_save_to_file_sync. Also the _to_file makes me think it receives a file, but it always saves to the same file, so I would remove the to_file and leave just ephy_bookmarks_manager_save/load(). I wonder why those need to public, though, ideally the manager would load the bookmarks at startup, and watch them to update the file when they change. It could also do a sync save on dispose, so in the case of the migrator it will be done when the created manager is destroyed.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/epiphany/issues/336.