[bijiben] single row note : assign a title when the note is closed



commit 2ace0ea90e3bb91de0dda10c2c4c33e55c9883f1
Author: Pierre-Yves Luyten <py luyten fr>
Date:   Sat Mar 1 01:44:58 2014 +0100

    single row note : assign a title when the note is closed
    
    The title usually occurs when user inputs CR.
    If note is closed with a single row, use this as a title.

 src/libbiji/biji-note-obj.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/libbiji/biji-note-obj.c b/src/libbiji/biji-note-obj.c
index 051a32e..f83c935 100644
--- a/src/libbiji/biji-note-obj.c
+++ b/src/libbiji/biji-note-obj.c
@@ -844,6 +844,7 @@ _biji_note_obj_close (BijiNoteObj *note)
   BijiNoteObjPrivate *priv;
   BijiItem *item;
   BijiManager *manager;
+  const gchar *title;
 
   priv = note->priv;
   item = BIJI_ITEM (note);
@@ -859,6 +860,15 @@ _biji_note_obj_close (BijiNoteObj *note)
    * since no change could trigger save */
   if (biji_note_id_get_content (priv->id) == NULL)
     biji_manager_remove_item (manager, item);
+
+  /* If the note has no title */
+  title = biji_item_get_title (item);
+  if (title == NULL)
+    {
+      title = biji_note_obj_get_raw_text (note);
+      biji_note_obj_set_title (note, title);
+    }
+
 }
 
 GtkWidget *


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