[gnome-notes/wip/igaldino/model-id-fix: 6/8] note-obj: path and title methods scope to public



commit 420f26fdcce1e342b77facad1d3eb1e901adacc1
Author: Isaque Galdino <igaldino gmail com>
Date:   Tue Jul 2 19:36:01 2019 -0300

    note-obj: path and title methods scope to public

 src/libbiji/biji-note-obj.c | 43 ++++++++++++++++++++++++++++++-------------
 src/libbiji/biji-note-obj.h |  6 ++++++
 2 files changed, 36 insertions(+), 13 deletions(-)
---
diff --git a/src/libbiji/biji-note-obj.c b/src/libbiji/biji-note-obj.c
index 9099077..3db50d1 100644
--- a/src/libbiji/biji-note-obj.c
+++ b/src/libbiji/biji-note-obj.c
@@ -268,30 +268,47 @@ biji_note_obj_is_trashed                    (BijiNoteObj *self)
 }
 
 
-static const gchar *
-biji_note_obj_get_path (BijiItem *item)
+const gchar *
+biji_note_obj_get_path (BijiNoteObj *self)
 {
-  BijiNoteObjPrivate *priv;
-
-  g_return_val_if_fail (BIJI_IS_NOTE_OBJ (item), NULL);
-
-  priv = biji_note_obj_get_instance_private (BIJI_NOTE_OBJ (item));
+  BijiNoteObjPrivate *priv = biji_note_obj_get_instance_private (self);
 
   return biji_note_id_get_path (priv->id);
 }
 
 static const gchar *
-biji_note_obj_get_title (BijiItem *item)
+biji_note_obj_get_path_from_item (BijiItem *item)
 {
-  BijiNoteObjPrivate *priv;
-
   g_return_val_if_fail (BIJI_IS_NOTE_OBJ (item), NULL);
 
-  priv = biji_note_obj_get_instance_private (BIJI_NOTE_OBJ (item));
+  return biji_note_obj_get_path (BIJI_NOTE_OBJ (item));
+}
+
+void
+biji_note_obj_set_path (BijiNoteObj *self,
+                        const char  *path)
+{
+  BijiNoteObjPrivate *priv = biji_note_obj_get_instance_private (self);
+
+  biji_note_id_set_path (priv->id, path);
+}
+
+const char *
+biji_note_obj_get_title (BijiNoteObj *self)
+{
+  BijiNoteObjPrivate *priv = biji_note_obj_get_instance_private (self);
 
   return biji_note_id_get_title (priv->id);
 }
 
+static const gchar *
+biji_note_obj_get_title_from_item (BijiItem *item)
+{
+  g_return_val_if_fail (BIJI_IS_NOTE_OBJ (item), NULL);
+
+  return biji_note_obj_get_title (BIJI_NOTE_OBJ (item));
+}
+
 /* If already a title, then note is renamed */
 gboolean
 biji_note_obj_set_title (BijiNoteObj *note, const gchar *proposed_title)
@@ -1083,8 +1100,8 @@ biji_note_obj_class_init (BijiNoteObjClass *klass)
 
   /* Interface
    * is_collectable is implemented at higher level, eg local_note */
-  item_class->get_title = biji_note_obj_get_title;
-  item_class->get_uuid = biji_note_obj_get_path;
+  item_class->get_title = biji_note_obj_get_title_from_item;
+  item_class->get_uuid = biji_note_obj_get_path_from_item;
   item_class->get_icon = biji_note_obj_get_icon;
   item_class->get_emblem = biji_note_obj_get_emblem;
   item_class->get_pristine = biji_note_obj_get_pristine;
diff --git a/src/libbiji/biji-note-obj.h b/src/libbiji/biji-note-obj.h
index e1b9a01..f31182d 100644
--- a/src/libbiji/biji-note-obj.h
+++ b/src/libbiji/biji-note-obj.h
@@ -154,6 +154,12 @@ const gchar     *biji_note_obj_get_raw_text                  (BijiNoteObj *note)
 void             biji_note_obj_set_raw_text                  (BijiNoteObj *note,
                                                               const gchar *plain_text);
 
+const char      *biji_note_obj_get_path                      (BijiNoteObj *self);
+
+void             biji_note_obj_set_path                      (BijiNoteObj *self,
+                                                              const char  *path);
+
+const char      *biji_note_obj_get_title                     (BijiNoteObj *self);
 
 gboolean         biji_note_obj_set_title                     (BijiNoteObj* note_obj_ptr,
                                                               const gchar* title);


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