[bijiben] New Notes without title : don't let notebook mess up our plans sanitizing notes title
- From: Pierre-Yves Luyten <pyluyten src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bijiben] New Notes without title : don't let notebook mess up our plans sanitizing notes title
- Date: Wed, 21 Nov 2012 23:55:00 +0000 (UTC)
commit 28a60ec3abdb312ccc36fb27392ae5b5cc7eb33f
Author: Pierre-Yves Luyten <py luyten fr>
Date: Thu Nov 22 00:54:26 2012 +0100
New Notes without title : don't let notebook mess up our plans sanitizing notes title
src/libbiji/biji-note-book.c | 30 ++++++++++++++++++------------
1 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/src/libbiji/biji-note-book.c b/src/libbiji/biji-note-book.c
index c5a5546..6ee2886 100644
--- a/src/libbiji/biji-note-book.c
+++ b/src/libbiji/biji-note-book.c
@@ -179,22 +179,28 @@ biji_book_get_or_create_tag_book(BijiNoteBook *book, gchar *tag)
/* If title not unique, add sufffix "n", starting with 2, until ok */
static void
_biji_note_book_sanitize_title (BijiNoteBook *book, BijiNoteObj *note)
-{
- gchar *title = biji_note_obj_get_title (note);
- gchar *new_title = g_strdup (title);
- gint suffix = 2;
+{
+ gchar *title, *new_title;
+
+ title = biji_note_obj_get_title (note);
- while (!_biji_note_book_is_title_unique (book, new_title))
+ if (title)
{
- g_free (new_title);
- new_title = g_strdup_printf("%s (%i)", title, suffix);
- suffix++;
- }
+ new_title = g_strdup (title);
+ gint suffix = 2;
- if ( g_strcmp0 (new_title, title) != 0)
- biji_note_obj_set_title (note, new_title);
+ while (!_biji_note_book_is_title_unique (book, new_title))
+ {
+ g_free (new_title);
+ new_title = g_strdup_printf("%s (%i)", title, suffix);
+ suffix++;
+ }
+
+ if ( g_strcmp0 (new_title, title) != 0)
+ biji_note_obj_set_title (note, new_title);
- g_free(new_title);
+ g_free(new_title);
+ }
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]