[epiphany/wip/sync: 66/74] sync: Allow mobile bookmarks to be synced too



commit 5aa6404157ce92cde758807792967bc402fa870c
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date:   Mon Jul 31 03:45:32 2017 +0300

    sync: Allow mobile bookmarks to be synced too
    
    Have them displayed under a Mobile tag

 src/bookmarks/ephy-bookmarks-manager.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/bookmarks/ephy-bookmarks-manager.c b/src/bookmarks/ephy-bookmarks-manager.c
index 1a7ad91..7fe9cf4 100644
--- a/src/bookmarks/ephy-bookmarks-manager.c
+++ b/src/bookmarks/ephy-bookmarks-manager.c
@@ -752,11 +752,13 @@ ephy_bookmarks_manager_handle_initial_merge (EphyBookmarksManager *self,
     char *parent_id;
 
     g_object_get (l->data, "type", &type, "parentid", &parent_id, NULL);
-    /* Ignore mobile/unfiled bookmarks and everything that is not of type bookmark. */
-    if (g_strcmp0 (type, "bookmark") ||
-        (!g_strcmp0 (parent_id, "mobile") || !g_strcmp0 (parent_id, "unfiled")))
+    /* Ignore unfiled bookmarks and everything that is not of type bookmark. */
+    if (g_strcmp0 (type, "bookmark") || !g_strcmp0 (parent_id, "unfiled"))
       goto next;
 
+    if (!g_strcmp0 (parent_id, "mobile") && !ephy_bookmark_has_tag (l->data, "Mobile"))
+      ephy_bookmark_add_tag (l->data, "Mobile");
+
     /* Bookmarks from server may miss the time added timestamp. */
     if (!ephy_bookmark_get_time_added (l->data))
       ephy_bookmark_set_time_added (l->data, g_get_real_time ());
@@ -843,11 +845,13 @@ ephy_bookmarks_manager_handle_regular_merge (EphyBookmarksManager *self,
     char *parent_id;
 
     g_object_get (l->data, "type", &type, "parentid", &parent_id, NULL);
-    /* Ignore mobile/unfiled bookmarks and everything that is not of type bookmark. */
-    if (g_strcmp0 (type, "bookmark") ||
-        (!g_strcmp0 (parent_id, "mobile") || !g_strcmp0 (parent_id, "unfiled")))
+    /* Ignore unfiled bookmarks and everything that is not of type bookmark. */
+    if (g_strcmp0 (type, "bookmark") || !g_strcmp0 (parent_id, "unfiled"))
       goto next;
 
+    if (!g_strcmp0 (parent_id, "mobile") && !ephy_bookmark_has_tag (l->data, "Mobile"))
+      ephy_bookmark_add_tag (l->data, "Mobile");
+
     /* Bookmarks from server may miss the time added timestamp. */
     if (!ephy_bookmark_get_time_added (l->data))
       ephy_bookmark_set_time_added (l->data, g_get_real_time ());
@@ -902,6 +906,9 @@ synchronizable_manager_merge (EphySynchronizableManager              *manager,
   EphyBookmarksManager *self = EPHY_BOOKMARKS_MANAGER (manager);
   GSList *to_upload = NULL;
 
+  if (!ephy_bookmarks_manager_tag_exists (self, "Mobile"))
+    ephy_bookmarks_manager_create_tag (self, "Mobile");
+
   if (is_initial)
     to_upload = ephy_bookmarks_manager_handle_initial_merge (self,
                                                              remotes_updated);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]