/*static */ gboolean biji_note_obj_add_notebook (BijiItem *item, BijiItem *notebook, gchar *title) { BijiNoteObj *note; gchar *label = title; g_return_val_if_fail (BIJI_IS_NOTE_OBJ (item), FALSE); note = BIJI_NOTE_OBJ (item); if (BIJI_IS_NOTEBOOK (notebook)) label = (gchar*) biji_item_get_title (notebook); if (biji_note_obj_has_notebook (item, label)) return FALSE; g_hash_table_add (note->priv->labels, g_strdup (label)); if (BIJI_IS_NOTEBOOK (notebook)) { biji_push_existing_notebook_to_note ( note, label, _biji_notebook_refresh, notebook); // Tracker biji_note_id_set_last_metadata_change_date (note->priv->id, g_get_real_time () / G_USEC_PER_SEC); biji_note_obj_save_note (note); } return TRUE; }
/* * TODO : move this to local provider. */ static BijiNoteObj * biji_note_book_local_note_new (BijiNoteBook *book, gchar *str) { BijiNoteObj *ret = get_note_skeleton (book); if (str) { gchar *unique, *html; unique = biji_note_book_get_unique_title (book, str); html = html_from_plain_text (str); biji_note_obj_set_title (ret, unique); biji_note_obj_set_raw_text (ret, str); biji_note_obj_set_html (ret, html); g_free (unique); g_free (html); } biji_note_obj_save_note (ret); biji_note_book_add_item (book, BIJI_ITEM (ret), TRUE); return ret; }
static void biji_note_obj_set_rgba_internal (BijiNoteObj *n, GdkRGBA *rgba) { n->priv->color = gdk_rgba_copy(rgba); n->priv->icon_needs_update = TRUE; biji_note_id_set_last_metadata_change_date_now (n->priv->id); biji_note_obj_save_note (n); /* Make editor & notebook know about this change */ g_signal_emit (G_OBJECT (n), biji_obj_signals[NOTE_COLOR_CHANGED],0); g_signal_emit (G_OBJECT (n), biji_obj_signals[NOTE_CHANGED],0); }
BijiNoteObj* biji_note_book_get_new_note_from_string (BijiNoteBook *book, gchar *title) { BijiNoteObj *ret = get_note_skeleton (book); /* Note will copy title */ biji_note_obj_set_title (ret, title); biji_note_obj_save_note (ret); note_book_append_new_note (book,ret); return ret ; }
void biji_note_obj_set_rgba (BijiNoteObj *n, GdkRGBA *rgba) { if (!n->priv->color) biji_note_obj_set_rgba_internal (n, rgba); else if (!gdk_rgba_equal (n->priv->color,rgba)) { gdk_rgba_free (n->priv->color); biji_note_obj_clear_icons (n); biji_note_obj_set_rgba_internal (n, rgba); biji_note_id_set_last_metadata_change_date (n->priv->id, g_get_real_time () / G_USEC_PER_SEC); biji_note_obj_save_note (n); } }
BijiNoteObj * biji_note_book_new_note_with_text (BijiNoteBook *book, gchar *plain_text) { BijiNoteObj *ret = get_note_skeleton (book); /* Note will copy title, raw_text and html strings */ biji_note_obj_set_title (ret, DEFAULT_NOTE_TITLE); biji_note_obj_set_raw_text (ret, g_strdup (plain_text)); biji_note_obj_set_html_content (ret, plain_text); biji_note_obj_save_note (ret); note_book_append_new_note (book,ret); return ret; }
gboolean biji_note_obj_remove_notebook (BijiItem *item, BijiItem *notebook) { g_return_val_if_fail (BIJI_IS_NOTE_OBJ (item), FALSE); g_return_val_if_fail (BIJI_IS_NOTEBOOK (notebook), FALSE); BijiNoteObj *note = BIJI_NOTE_OBJ (item); if (g_hash_table_remove (note->priv->labels, biji_item_get_title (notebook))) { biji_remove_notebook_from_note ( note, notebook, _biji_notebook_refresh, notebook); // tracker. biji_note_id_set_last_metadata_change_date (note->priv->id, g_get_real_time () / G_USEC_PER_SEC); biji_note_obj_save_note (note); return TRUE; } return FALSE; }