[bijiben] noteBook: remove duplicates
- From: Pierre-Yves Luyten <pyluyten src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bijiben] noteBook: remove duplicates
- Date: Sat, 8 Dec 2012 01:02:58 +0000 (UTC)
commit a449467bf75e32acd3878a9197bd9d0a2cfb14c0
Author: Pierre-Yves Luyten <py luyten fr>
Date: Sat Dec 8 02:02:17 2012 +0100
noteBook: remove duplicates
src/libbiji/biji-note-book.c | 72 +++++++++++------------------------------
src/libbiji/biji-note-book.h | 24 +++-----------
2 files changed, 25 insertions(+), 71 deletions(-)
---
diff --git a/src/libbiji/biji-note-book.c b/src/libbiji/biji-note-book.c
index b99032c..8357b7b 100644
--- a/src/libbiji/biji-note-book.c
+++ b/src/libbiji/biji-note-book.c
@@ -464,29 +464,6 @@ add_note_to_list_if_tag_prefix(BijiNoteObj *note,TagBook *booklet)
}
}
-GList *
-_biji_note_book_get_notes_with_tag(BijiNoteBook *book,gchar *tag)
-{
- TagBook *tag_book = biji_book_get_or_create_tag_book(book,tag);
- return tag_book->notes ;
-}
-
-GList *
-_biji_note_book_get_notes_with_tag_prefix(BijiNoteBook *book,gchar *tag)
-{
- // we do create a pseudo tag book for convenience...
- TagBook booklet ;
- booklet.name = tag ;
- booklet.notes = NULL ;
-
- GList *notes;
- notes = g_hash_table_get_values (book->priv->notes);
-
- g_list_foreach (notes,(GFunc)add_note_to_list_if_tag_prefix,&booklet);
- g_list_free (notes);
- return booklet.notes ;
-}
-
static void
add_note_to_list_if_no_tag (BijiNoteObj *note, GList **notes)
{
@@ -524,7 +501,7 @@ biji_note_book_remove_note(BijiNoteBook *book,BijiNoteObj *note)
}
GList *
-biji_note_book_get_notes(BijiNoteBook *book)
+biji_note_book_get_notes (BijiNoteBook *book)
{
return g_hash_table_get_values (book->priv->notes);
}
@@ -536,51 +513,42 @@ note_book_get_note_at_path (BijiNoteBook *book, gchar *path)
}
GList *
-biji_note_book_get_notes_with_tag(BijiNoteBook *book,gchar* tag)
+biji_note_book_get_notes_with_tag (BijiNoteBook *book,gchar* tag)
{
g_return_val_if_fail(BIJI_IS_NOTE_BOOK(book),NULL);
- return _biji_note_book_get_notes_with_tag(book,tag);
-}
-GList *
-biji_note_book_get_notes_with_tag_prefix(BijiNoteBook *book,gchar* tag)
-{
- return _biji_note_book_get_notes_with_tag_prefix(book,tag);
+ TagBook *tag_book = biji_book_get_or_create_tag_book(book,tag);
+ return tag_book->notes ;
}
GList *
-biji_note_book_get_no_tag_notes(BijiNoteBook *book)
+biji_note_book_get_notes_with_tag_prefix (BijiNoteBook *book,gchar* tag)
{
- return _biji_note_book_get_no_tag_notes(book);
+ g_return_val_if_fail(BIJI_IS_NOTE_BOOK(book),NULL);
+
+ // we do create a pseudo tag book for convenience...
+ TagBook booklet ;
+ booklet.name = tag ;
+ booklet.notes = NULL ;
+
+ GList *notes;
+ notes = g_hash_table_get_values (book->priv->notes);
+
+ g_list_foreach (notes,(GFunc)add_note_to_list_if_tag_prefix,&booklet);
+ g_list_free (notes);
+ return booklet.notes ;
}
void
biji_note_book_remove_tag(BijiNoteBook *book,gchar *tag)
{
- GList *notes = _biji_note_book_get_notes_with_tag(book,tag) ;
+ GList *notes = biji_note_book_get_notes_with_tag (book,tag) ;
// Remove the tag then save the note.
g_list_foreach(notes,(GFunc) biji_note_obj_remove_tag,tag);
g_list_foreach(notes,(GFunc) biji_note_obj_save_note,NULL);
-}
-
-BijiNoteObj *
-biji_note_book_get_tag_template(BijiNoteBook *book, gchar *tag)
-{
- GList *notes = _biji_note_book_get_notes_with_tag(book,tag) ;
- if ( notes == NULL )
- return NULL ;
-
- gint i ;
- for ( i=0 ; i < g_list_length (notes) ; i++ )
- {
- BijiNoteObj *note = BIJI_NOTE_OBJ ( g_list_nth_data(notes,i));
- if ( note_obj_is_template(note))
- return note ;
- }
-
- return NULL ;
+ g_list_free (notes);
}
BijiNoteBook *
diff --git a/src/libbiji/biji-note-book.h b/src/libbiji/biji-note-book.h
index 36ab4aa..736c0d2 100644
--- a/src/libbiji/biji-note-book.h
+++ b/src/libbiji/biji-note-book.h
@@ -50,34 +50,20 @@ BijiNoteObj * note_book_get_note_at_path(BijiNoteBook *book,gchar *path);
void biji_note_book_remove_tag(BijiNoteBook *book,gchar *tag);
-BijiNoteObj * biji_note_book_get_tag_template(BijiNoteBook *book, gchar *tag);
-
/* All GLIST return values should be freed, and never the content */
-GList * _biji_note_book_get_notes_with_tag(BijiNoteBook *book,gchar *tag);
-
-GList * _biji_note_book_get_no_tag_notes(BijiNoteBook *book);
-
-GList * _biji_note_book_get_notes_with_tag_prefix(BijiNoteBook *book,gchar *tag);
GList * biji_note_book_get_notes (BijiNoteBook *book);
-GList * biji_note_book_get_notes_with_tag(BijiNoteBook *book,gchar* tag);
-
-GList * biji_note_book_get_notes_with_tag_prefix(BijiNoteBook *book,gchar* tag);
-
-GList * biji_note_book_get_no_tag_notes(BijiNoteBook *book);
+GList * biji_note_book_get_notes_with_tag (BijiNoteBook *book,gchar* tag);
-/* Get a collection of notes from tomboy format files */
-BijiNoteBook *biji_book_new_from_dir(gchar *tomboy_format_folder);
+GList * biji_note_book_get_notes_with_tag_prefix (BijiNoteBook *book,gchar* tag);
-// Create a Note from a tomboy.note file
-BijiNoteObj* biji_note_get_new_from_file (const gchar* path);
+/* New Notes */
+BijiNoteObj* biji_note_get_new_from_file (const gchar* tomboy_format_note_path);
-/* Get a blanck new note FIXME set dates */
BijiNoteObj * biji_note_book_get_new_note_from_string (BijiNoteBook *book, gchar *title);
-BijiNoteObj * biji_note_book_new_note_with_text (BijiNoteBook *book,
- gchar *plain_text);
+BijiNoteObj * biji_note_book_new_note_with_text (BijiNoteBook *book, gchar *plain_text);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]