[epiphany/wip/sync-rebase: 58/74] ephy-bookmark: Better names for setters/getters



commit 4906be55e87346a8bc9bf28e3750c566fe502189
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date:   Tue Aug 30 15:46:12 2016 +0300

    ephy-bookmark: Better names for setters/getters

 src/bookmarks/ephy-bookmark-properties-grid.c |    8 +-
 src/bookmarks/ephy-bookmark.c                 |   14 ++--
 src/bookmarks/ephy-bookmark.h                 |   86 ++++++++++++------------
 src/bookmarks/ephy-bookmarks-manager.c        |    6 +-
 src/ephy-sync-service.c                       |   14 ++--
 5 files changed, 64 insertions(+), 64 deletions(-)
---
diff --git a/src/bookmarks/ephy-bookmark-properties-grid.c b/src/bookmarks/ephy-bookmark-properties-grid.c
index 62734f7..e7f0439 100644
--- a/src/bookmarks/ephy-bookmark-properties-grid.c
+++ b/src/bookmarks/ephy-bookmark-properties-grid.c
@@ -378,12 +378,12 @@ ephy_bookmark_properties_grid_check_prev_values (EphyBookmarkPropertiesGrid *sel
    * set the uploaded flag to FALSE. */
 
   if (g_strcmp0 (self->prev_name, ephy_bookmark_get_title (self->bookmark)) != 0) {
-    ephy_bookmark_set_uploaded (self->bookmark, FALSE);
+    ephy_bookmark_set_is_uploaded (self->bookmark, FALSE);
     return;
   }
 
   if (g_strcmp0 (self->prev_address, ephy_bookmark_get_url (self->bookmark)) != 0) {
-    ephy_bookmark_set_uploaded (self->bookmark, FALSE);
+    ephy_bookmark_set_is_uploaded (self->bookmark, FALSE);
     return;
   }
 
@@ -396,7 +396,7 @@ ephy_bookmark_properties_grid_check_prev_values (EphyBookmarkPropertiesGrid *sel
          !g_sequence_iter_is_end (iter); iter = g_sequence_iter_next (iter)) {
       if (!g_sequence_lookup (self->prev_tags, g_sequence_get (iter),
                               (GCompareDataFunc)ephy_bookmark_tags_compare, NULL)) {
-        ephy_bookmark_set_uploaded (self->bookmark, FALSE);
+        ephy_bookmark_set_is_uploaded (self->bookmark, FALSE);
         return;
       }
     }
@@ -406,7 +406,7 @@ ephy_bookmark_properties_grid_check_prev_values (EphyBookmarkPropertiesGrid *sel
          !g_sequence_iter_is_end (iter); iter = g_sequence_iter_next (iter)) {
       if (!g_sequence_lookup (tags, g_sequence_get (iter),
                               (GCompareDataFunc)ephy_bookmark_tags_compare, NULL)) {
-        ephy_bookmark_set_uploaded (self->bookmark, FALSE);
+        ephy_bookmark_set_is_uploaded (self->bookmark, FALSE);
         return;
       }
     }
diff --git a/src/bookmarks/ephy-bookmark.c b/src/bookmarks/ephy-bookmark.c
index 5ef5325..78cd8f6 100644
--- a/src/bookmarks/ephy-bookmark.c
+++ b/src/bookmarks/ephy-bookmark.c
@@ -355,8 +355,8 @@ ephy_bookmark_get_id (EphyBookmark *self)
 }
 
 void
-ephy_bookmark_set_modified (EphyBookmark *self,
-                            double        modified)
+ephy_bookmark_set_modification_time (EphyBookmark *self,
+                                     double        modified)
 {
   g_return_if_fail (EPHY_IS_BOOKMARK (self));
 
@@ -364,7 +364,7 @@ ephy_bookmark_set_modified (EphyBookmark *self,
 }
 
 double
-ephy_bookmark_get_modified (EphyBookmark *self)
+ephy_bookmark_get_modification_time (EphyBookmark *self)
 {
   g_return_val_if_fail (EPHY_IS_BOOKMARK (self), -1);
 
@@ -372,8 +372,8 @@ ephy_bookmark_get_modified (EphyBookmark *self)
 }
 
 void
-ephy_bookmark_set_uploaded (EphyBookmark *self,
-                            gboolean      uploaded)
+ephy_bookmark_set_is_uploaded (EphyBookmark *self,
+                               gboolean      uploaded)
 {
   g_return_if_fail (EPHY_IS_BOOKMARK (self));
 
@@ -551,8 +551,8 @@ ephy_bookmark_from_bso (JsonObject *bso)
 
   bookmark = EPHY_BOOKMARK (object);
   ephy_bookmark_set_id (bookmark, json_object_get_string_member (bso, "id"));
-  ephy_bookmark_set_modified (bookmark, json_object_get_double_member (bso, "modified"));
-  ephy_bookmark_set_uploaded (bookmark, TRUE);
+  ephy_bookmark_set_modification_time (bookmark, json_object_get_double_member (bso, "modified"));
+  ephy_bookmark_set_is_uploaded (bookmark, TRUE);
 
 out:
   g_free (decoded);
diff --git a/src/bookmarks/ephy-bookmark.h b/src/bookmarks/ephy-bookmark.h
index 2bfc6e2..6fb9d82 100644
--- a/src/bookmarks/ephy-bookmark.h
+++ b/src/bookmarks/ephy-bookmark.h
@@ -27,48 +27,48 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (EphyBookmark, ephy_bookmark, EPHY, BOOKMARK, GObject)
 
-EphyBookmark        *ephy_bookmark_new                 (const char *url,
-                                                        const char *title,
-                                                        GSequence  *tags);
-
-void                 ephy_bookmark_set_time_added      (EphyBookmark *self,
-                                                        gint64        time_added);
-gint64               ephy_bookmark_get_time_added      (EphyBookmark *self);
-
-void                 ephy_bookmark_set_url             (EphyBookmark *self,
-                                                        const char   *url);
-const char          *ephy_bookmark_get_url             (EphyBookmark *self);
-
-void                 ephy_bookmark_set_title           (EphyBookmark *self,
-                                                        const char   *title);
-const char          *ephy_bookmark_get_title           (EphyBookmark *self);
-
-void                 ephy_bookmark_set_id              (EphyBookmark *self,
-                                                        const char   *id);
-const char          *ephy_bookmark_get_id              (EphyBookmark *self);
-
-void                 ephy_bookmark_set_modified        (EphyBookmark *self,
-                                                        double        modified);
-double               ephy_bookmark_get_modified        (EphyBookmark *self);
-
-void                 ephy_bookmark_set_uploaded        (EphyBookmark *self,
-                                                        gboolean      uploaded);
-gboolean             ephy_bookmark_is_uploaded         (EphyBookmark *self);
-
-void                 ephy_bookmark_add_tag             (EphyBookmark *self,
-                                                        const char   *tag);
-void                 ephy_bookmark_remove_tag          (EphyBookmark *self,
-                                                        const char   *tag);
-gboolean             ephy_bookmark_has_tag             (EphyBookmark *self,
-                                                        const char   *tag);
-GSequence           *ephy_bookmark_get_tags            (EphyBookmark *self);
-
-int                  ephy_bookmark_bookmarks_sort_func (EphyBookmark *bookmark1,
-                                                        EphyBookmark *bookmark2);
-int                  ephy_bookmark_tags_compare        (const char *tag1,
-                                                        const char *tag2);
-
-char                *ephy_bookmark_to_bso              (EphyBookmark *self);
-EphyBookmark        *ephy_bookmark_from_bso            (JsonObject *bso);
+EphyBookmark        *ephy_bookmark_new                   (const char *url,
+                                                          const char *title,
+                                                          GSequence  *tags);
+
+void                 ephy_bookmark_set_time_added        (EphyBookmark *self,
+                                                          gint64        time_added);
+gint64               ephy_bookmark_get_time_added        (EphyBookmark *self);
+
+void                 ephy_bookmark_set_url               (EphyBookmark *self,
+                                                          const char   *url);
+const char          *ephy_bookmark_get_url               (EphyBookmark *self);
+
+void                 ephy_bookmark_set_title             (EphyBookmark *self,
+                                                          const char   *title);
+const char          *ephy_bookmark_get_title             (EphyBookmark *self);
+
+void                 ephy_bookmark_set_id                (EphyBookmark *self,
+                                                          const char   *id);
+const char          *ephy_bookmark_get_id                (EphyBookmark *self);
+
+void                 ephy_bookmark_set_modification_time (EphyBookmark *self,
+                                                          double        modified);
+double               ephy_bookmark_get_modification_time (EphyBookmark *self);
+
+void                 ephy_bookmark_set_is_uploaded       (EphyBookmark *self,
+                                                          gboolean      uploaded);
+gboolean             ephy_bookmark_is_uploaded           (EphyBookmark *self);
+
+void                 ephy_bookmark_add_tag               (EphyBookmark *self,
+                                                          const char   *tag);
+void                 ephy_bookmark_remove_tag            (EphyBookmark *self,
+                                                          const char   *tag);
+gboolean             ephy_bookmark_has_tag               (EphyBookmark *self,
+                                                          const char   *tag);
+GSequence           *ephy_bookmark_get_tags              (EphyBookmark *self);
+
+int                  ephy_bookmark_bookmarks_sort_func   (EphyBookmark *bookmark1,
+                                                          EphyBookmark *bookmark2);
+int                  ephy_bookmark_tags_compare          (const char *tag1,
+                                                          const char *tag2);
+
+char                *ephy_bookmark_to_bso                (EphyBookmark *self);
+EphyBookmark        *ephy_bookmark_from_bso              (JsonObject *bso);
 
 G_END_DECLS
diff --git a/src/bookmarks/ephy-bookmarks-manager.c b/src/bookmarks/ephy-bookmarks-manager.c
index 40d4617..e20c01f 100644
--- a/src/bookmarks/ephy-bookmarks-manager.c
+++ b/src/bookmarks/ephy-bookmarks-manager.c
@@ -74,7 +74,7 @@ build_variant (EphyBookmark *bookmark)
   g_variant_builder_add (&builder, "x", ephy_bookmark_get_time_added (bookmark));
   g_variant_builder_add (&builder, "s", ephy_bookmark_get_title (bookmark));
   g_variant_builder_add (&builder, "s", ephy_bookmark_get_id (bookmark));
-  g_variant_builder_add (&builder, "d", ephy_bookmark_get_modified (bookmark));
+  g_variant_builder_add (&builder, "d", ephy_bookmark_get_modification_time (bookmark));
   g_variant_builder_add (&builder, "b", ephy_bookmark_is_uploaded (bookmark));
 
   g_variant_builder_open (&builder, G_VARIANT_TYPE ("as"));
@@ -581,8 +581,8 @@ ephy_bookmarks_manager_load_from_file (EphyBookmarksManager *self)
     bookmark = ephy_bookmark_new (list[i], title, tags);
     ephy_bookmark_set_time_added (bookmark, time_added);
     ephy_bookmark_set_id (bookmark, id);
-    ephy_bookmark_set_modified (bookmark, modified);
-    ephy_bookmark_set_uploaded (bookmark, uploaded);
+    ephy_bookmark_set_modification_time (bookmark, modified);
+    ephy_bookmark_set_is_uploaded (bookmark, uploaded);
     g_sequence_prepend (bookmarks, bookmark);
   }
   ephy_bookmarks_manager_add_bookmarks (self, bookmarks);
diff --git a/src/ephy-sync-service.c b/src/ephy-sync-service.c
index 354e18c..d7a0a74 100644
--- a/src/ephy-sync-service.c
+++ b/src/ephy-sync-service.c
@@ -966,8 +966,8 @@ upload_bookmark_response_cb (SoupSession *session,
 
   if (msg->status_code == 200) {
     last_modified = g_ascii_strtod (msg->response_body->data, NULL);
-    ephy_bookmark_set_modified (bookmark, last_modified);
-    ephy_bookmark_set_uploaded (bookmark, TRUE);
+    ephy_bookmark_set_modification_time (bookmark, last_modified);
+    ephy_bookmark_set_is_uploaded (bookmark, TRUE);
     ephy_bookmarks_manager_save_to_file_async (manager, NULL, NULL, NULL);
 
     LOG ("Successfully uploaded to server");
@@ -998,7 +998,7 @@ ephy_sync_service_upload_bookmark (EphySyncService *self,
                               EPHY_BOOKMARKS_COLLECTION,
                               ephy_bookmark_get_id (bookmark));
   bso = ephy_bookmark_to_bso (bookmark);
-  modified = ephy_bookmark_get_modified (bookmark);
+  modified = ephy_bookmark_get_modification_time (bookmark);
   ephy_sync_service_send_storage_message (self, endpoint,
                                           SOUP_METHOD_PUT, bso, -1,
                                           force ? -1 : modified,
@@ -1219,7 +1219,7 @@ sync_bookmarks_first_time_response_cb (SoupSession *session,
      * bookmark has been synced before in the past. Keep the one with the most
      * recent modified timestamp. */
     else {
-      if (ephy_bookmark_get_modified (remote) > ephy_bookmark_get_modified (local)) {
+      if (ephy_bookmark_get_modification_time (remote) > ephy_bookmark_get_modification_time (local)) {
         ephy_bookmarks_manager_remove_bookmark (manager, local);
         ephy_bookmarks_manager_add_bookmark (manager, remote);
 
@@ -1230,7 +1230,7 @@ sync_bookmarks_first_time_response_cb (SoupSession *session,
 
         g_hash_table_add (marked, remote);
       } else {
-        if (ephy_bookmark_get_modified (local) > ephy_bookmark_get_modified (remote))
+        if (ephy_bookmark_get_modification_time (local) > ephy_bookmark_get_modification_time (remote))
           ephy_sync_service_upload_bookmark (service, local, TRUE);
 
         g_hash_table_add (marked, local);
@@ -1313,7 +1313,7 @@ sync_bookmarks_response_cb (SoupSession *session,
            !g_sequence_iter_is_end (iter); iter = g_sequence_iter_next (iter))
         ephy_bookmarks_manager_add_tag (manager, g_sequence_get (iter));
     } else {
-      if (ephy_bookmark_get_modified (remote) > ephy_bookmark_get_modified (local)) {
+      if (ephy_bookmark_get_modification_time (remote) > ephy_bookmark_get_modification_time (local)) {
         ephy_bookmarks_manager_remove_bookmark (manager, local);
         ephy_bookmarks_manager_add_bookmark (manager, remote);
 
@@ -1322,7 +1322,7 @@ sync_bookmarks_response_cb (SoupSession *session,
              !g_sequence_iter_is_end (iter); iter = g_sequence_iter_next (iter))
           ephy_bookmarks_manager_add_tag (manager, g_sequence_get (iter));
       } else {
-        if (ephy_bookmark_get_modified (local) > ephy_bookmark_get_modified (remote))
+        if (ephy_bookmark_get_modification_time (local) > ephy_bookmark_get_modification_time (remote))
           ephy_sync_service_upload_bookmark (service, local, TRUE);
 
         g_object_unref (remote);


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