[gnome-notes/wip/igaldino/new-note-title: 8/9] note-id: Fix wrong warning on new note



commit a06f519a8c979550626d711039dd5ba4f2236d78
Author: Isaque Galdino <igaldino gmail com>
Date:   Sun Jun 9 21:58:31 2019 -0300

    note-id: Fix wrong warning on new note

 src/libbiji/biji-note-id.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)
---
diff --git a/src/libbiji/biji-note-id.c b/src/libbiji/biji-note-id.c
index f495c50..34e95da 100644
--- a/src/libbiji/biji-note-id.c
+++ b/src/libbiji/biji-note-id.c
@@ -201,9 +201,8 @@ biji_note_id_get_path (BijiNoteID* n)
 void
 biji_note_id_set_title  (BijiNoteID *n, gchar* title)
 {
-  if (n->title)
-    g_free (n->title);
-
+  g_return_if_fail (BIJI_IS_NOTE_ID (n));
+  g_clear_pointer (&n->title, g_free);
   n->title = g_strdup (title);
   g_object_notify_by_pspec (G_OBJECT (n), properties[PROP_TITLE]);
 }
@@ -221,20 +220,10 @@ biji_note_id_set_content (BijiNoteID *id,
                           const gchar *content)
 {
   g_return_val_if_fail (BIJI_IS_NOTE_ID (id), FALSE);
-  g_return_val_if_fail ((content != NULL), FALSE);
-
-  if (id->content != NULL &&
-      g_strcmp0 (id->content, content) != 0)
-    g_clear_pointer (&id->content, g_free);
-
-
-  if (id->content == NULL)
-  {
-    id->content = g_strdup (content);
-    return TRUE;
-  }
+  g_clear_pointer (&id->content, g_free);
+  id->content = g_strdup (content);
 
-  return FALSE;
+  return TRUE;
 }
 
 


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