示例#1
0
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 ;
}
示例#2
0
static void
_biji_note_book_add_one_note(BijiNoteBook *book,BijiNoteObj *note)
{
  g_return_if_fail(BIJI_IS_NOTE_OBJ(note));
  gint i ; 

  _biji_note_book_sanitize_title(book,note);

  /* Welcome to the book ! */
  _biji_note_obj_set_book(note,(gpointer)book);

  // Handle tags
  GList *note_tags = _biji_note_obj_get_tags(note) ;
  for ( i=0 ; i<g_list_length (note_tags) ; i++ )
  {  
    TagBook *tag_book;
    tag_book = biji_book_get_or_create_tag_book(book,
                                                g_list_nth_data (note_tags,i));

    // Handle template
    if ( note_obj_is_template(note) )
    {
      tag_book->template_note = note ;
    }

    else 
    {
      tag_book->notes = g_list_append(tag_book->notes,note) ;
      tag_book->length ++ ;
    }
  }

  // Add it to the list and emit signal
  g_hash_table_insert (book->priv->notes,
                       biji_note_obj_get_path (note), note);

  book->priv->note_renamed = g_signal_connect(note,"renamed",
                                              G_CALLBACK(notify_changed),book);
  g_signal_connect (note,"changed", G_CALLBACK(notify_changed),book);
    
  //TODO g_signal_connect(note,"deleted"...) ;
  g_signal_emit ( G_OBJECT (book), biji_book_signals[BOOK_AMENDED],0);
}
示例#3
0
gboolean
biji_note_obj_is_template(BijiNoteObj *note)
{
  return note_obj_is_template(note);
}