[bijiben] Tracker: use DataContainer rather than tags
- From: Pierre-Yves Luyten <pyluyten src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bijiben] Tracker: use DataContainer rather than tags
- Date: Sun, 3 Feb 2013 10:20:47 +0000 (UTC)
commit cff0c27cc1489b66a773f5f65e165a1e54d6000d
Author: Pierre-Yves Luyten <py luyten fr>
Date: Sun Feb 3 11:15:55 2013 +0100
Tracker: use DataContainer rather than tags
src/bjb-controller.c | 22 +++---
src/bjb-note-tag-dialog.c | 80 +++++++++++------
src/libbiji/biji-note-obj.c | 14 ++--
src/libbiji/biji-note-obj.h | 8 +-
src/libbiji/biji-tracker.c | 99 +++++++++++----------
src/libbiji/biji-tracker.h | 29 ++++--
src/libbiji/deserializer/biji-lazy-deserializer.c | 2 +-
src/libbiji/serializer/biji-lazy-serializer.c | 2 +-
8 files changed, 148 insertions(+), 108 deletions(-)
---
diff --git a/src/bjb-controller.c b/src/bjb-controller.c
index d376af1..ced9690 100644
--- a/src/bjb-controller.c
+++ b/src/bjb-controller.c
@@ -232,21 +232,21 @@ update_view (BjbController *self)
g_list_foreach (notes,(GFunc)bjb_controller_add_note,self);
}
-static glong
-most_recent_note_first ( BijiNoteObj *a, BijiNoteObj *b)
+static gint
+most_recent_note_first (gconstpointer a, gconstpointer b)
{
- glong result = biji_note_obj_get_last_change_date_sec (b);
- return result - biji_note_obj_get_last_change_date_sec (a);
+ BijiNoteObj *one = BIJI_NOTE_OBJ (a);
+ BijiNoteObj *other = BIJI_NOTE_OBJ (b);
+
+ glong result = biji_note_obj_get_last_change_date_sec (other);
+ return result - biji_note_obj_get_last_change_date_sec (one);
}
static void
sort_notes( BjbController *self)
{
- GList *notes ;
-
- notes = self->priv->notes_to_show ;
- notes = g_list_sort(notes,(GCompareFunc)most_recent_note_first);
- self->priv->notes_to_show = notes ;
+ self->priv->notes_to_show = g_list_sort (self->priv->notes_to_show,
+ most_recent_note_first);
}
static void
@@ -264,7 +264,7 @@ update_controller_callback (GObject *source_object,
GList *result;
BjbController *self = BJB_CONTROLLER (user_data);
- result = biji_get_notes_with_strings_or_tag_finish (source_object, res, self->priv->book);
+ result = biji_get_notes_with_strings_or_collection_finish (source_object, res, self->priv->book);
self->priv->notes_to_show = result;
sort_and_update (self);
}
@@ -287,7 +287,7 @@ bjb_controller_apply_needle ( BjbController *self )
return;
}
- biji_get_notes_with_string_or_tag_async (needle, update_controller_callback, self);
+ biji_get_notes_with_string_or_collection_async (needle, update_controller_callback, self);
}
static void
diff --git a/src/bjb-note-tag-dialog.c b/src/bjb-note-tag-dialog.c
index ea6a81d..95889dc 100644
--- a/src/bjb-note-tag-dialog.c
+++ b/src/bjb-note-tag-dialog.c
@@ -59,9 +59,14 @@ struct _BjbNoteTagDialogPrivate
// data
GList *notes;
GtkListStore *store;
+ GHashTable *collections;
// tmp when a new tag added
gchar *tag_to_scroll_to;
+
+ // tmp for convenience, when a tag is toggled
+ gchar *toggled_collection;
+
};
#define BJB_NOTE_TAG_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BJB_TYPE_NOTE_TAG_DIALOG, BjbNoteTagDialogPrivate))
@@ -78,21 +83,21 @@ append_tag (gchar *tag, BjbNoteTagDialog *self)
GList *l;
gtk_list_store_append (priv->store, &iter);
- note_has_tag = biji_note_obj_has_label (priv->notes->data, tag);
+ note_has_tag = biji_note_obj_has_collection (priv->notes->data, tag);
/* Check if other notes have the same */
for (l = priv->notes; l != NULL; l = l->next)
{
- if (biji_note_obj_has_label (l->data, tag) != note_has_tag)
+ if (biji_note_obj_has_collection (l->data, tag) != note_has_tag)
{
note_has_tag = SELECTION_INCONSISTENT;
break;
}
}
- gtk_list_store_set (priv->store, &iter,
- COL_SELECTION, note_has_tag,
- COL_TAG_NAME , tag, -1);
+ gtk_list_store_set (priv->store, &iter,
+ COL_SELECTION, note_has_tag,
+ COL_TAG_NAME , tag, -1);
}
static gint
@@ -154,14 +159,18 @@ bjb_note_tag_dialog_handle_tags (GObject *source_object,
{
BjbNoteTagDialog *self = BJB_NOTE_TAG_DIALOG (user_data);
BjbNoteTagDialogPrivate *priv = self->priv;
+ GList *collections;
+
+ if (priv->collections)
+ g_hash_table_destroy (priv->collections);
- GList *tags;
+ priv->collections = biji_get_all_collections_finish (source_object, res);
- tags = biji_get_all_tags_finish (source_object, res);
- tags = g_list_sort (tags, bjb_compare_tag);
+ collections = g_hash_table_get_keys (priv->collections);
+ collections = g_list_sort (collections, bjb_compare_tag);
- g_list_foreach (tags, (GFunc) append_tag, self);
- g_list_free_full (tags, g_free);
+ g_list_foreach (collections, (GFunc) append_tag, self);
+ g_list_free (collections);
/* If a new tag was added, scroll & free */
if (priv->tag_to_scroll_to)
@@ -180,23 +189,31 @@ bjb_note_tag_dialog_handle_tags (GObject *source_object,
}
static void
-update_tags_model_async (BjbNoteTagDialog *self)
+update_collections_model_async (BjbNoteTagDialog *self)
{
gtk_list_store_clear (self->priv->store);
- biji_get_all_tracker_tags_async (bjb_note_tag_dialog_handle_tags, self);
+ biji_get_all_collections_async (bjb_note_tag_dialog_handle_tags, self);
}
/* Libbiji handles tracker & saving */
static void
-note_dialog_add_tag (BijiNoteObj *note, gchar *tag)
+note_dialog_add_tag (gpointer iter, gpointer collection)
{
- biji_note_obj_add_label (note, tag, TRUE);
+ BijiNoteObj *note = BIJI_NOTE_OBJ (iter);
+ gchar *title = (gchar*) collection;
+
+ biji_note_obj_add_collection (note, title, TRUE);
}
static void
-note_dialog_remove_tag (BijiNoteObj *note, gchar *tag)
+note_dialog_remove_tag (gpointer iter, gpointer user_data)
{
- biji_note_obj_remove_label (note, tag);
+ BijiNoteObj *note = BIJI_NOTE_OBJ (iter);
+ BjbNoteTagDialog *self = user_data;
+ gchar *urn = g_hash_table_lookup (self->priv->collections,
+ self->priv->toggled_collection);
+
+ biji_note_obj_remove_collection (note, self->priv->toggled_collection, urn);
}
static void
@@ -218,40 +235,44 @@ on_tag_toggled (GtkCellRendererToggle *cell,
gtk_tree_model_get (model, &iter, column, &toggle_item, -1);
gtk_tree_model_get (model, &iter,COL_TAG_NAME, &tag,-1);
+ priv->toggled_collection = tag;
+
if (toggle_item == SELECTION_INCONSISTENT || toggle_item == SELECTION_FALSE)
{
- g_list_foreach (priv->notes, (GFunc) note_dialog_add_tag, tag);
+ g_list_foreach (priv->notes, note_dialog_add_tag, tag);
toggle_item = SELECTION_TRUE;
}
else
{
- g_list_foreach (priv->notes, (GFunc) note_dialog_remove_tag, tag);
+ g_list_foreach (priv->notes, note_dialog_remove_tag, self);
toggle_item = SELECTION_FALSE;
}
+ priv->toggled_collection = NULL;
gtk_list_store_set (priv->store, &iter, column, toggle_item, -1);
gtk_tree_path_free (path);
}
static void
-on_new_tag_added_cb (gpointer user_data)
+on_new_collection_created_cb (gpointer user_data)
{
BjbNoteTagDialog *self = user_data;
BjbNoteTagDialogPrivate *priv = self->priv;
priv->tag_to_scroll_to = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->entry)));
- g_list_foreach (priv->notes, (GFunc) note_dialog_add_tag, priv->tag_to_scroll_to);
+ g_list_foreach (priv->notes, note_dialog_add_tag, priv->tag_to_scroll_to);
- update_tags_model_async (self);
+ update_collections_model_async (self);
gtk_entry_set_text (GTK_ENTRY (priv->entry), "");
}
static void
add_new_tag (BjbNoteTagDialog *self)
{
- push_tag_to_tracker (gtk_entry_get_text (GTK_ENTRY (self->priv->entry)),
- on_new_tag_added_cb,
- self );
+ const gchar *collection = gtk_entry_get_text (GTK_ENTRY (self->priv->entry));
+
+ if (collection && g_utf8_strlen (collection, -1) > 0)
+ biji_create_new_collection (collection, on_new_collection_created_cb, self);
}
static void
@@ -315,8 +336,10 @@ bjb_note_tag_dialog_init (BjbNoteTagDialog *self)
self->priv = priv;
priv->notes = NULL;
+ priv->collections = NULL;
priv->window = NULL;
priv->tag_to_scroll_to = NULL;
+ priv->toggled_collection = NULL;
gtk_window_set_default_size (GTK_WINDOW (self),
BJB_NOTE_TAG_DIALOG_DEFAULT_WIDTH,
@@ -325,10 +348,9 @@ bjb_note_tag_dialog_init (BjbNoteTagDialog *self)
g_signal_connect_swapped (self, "response",
G_CALLBACK (gtk_widget_destroy), self);
-
priv->store = gtk_list_store_new (N_COLUMNS,
G_TYPE_INT, // tag active
- G_TYPE_STRING); // tag
+ G_TYPE_STRING); // collection title
}
static void
@@ -364,7 +386,7 @@ bjb_note_tag_dialog_constructed (GObject *obj)
gtk_box_pack_start (GTK_BOX (hbox), new, FALSE, FALSE, 2);
- /* List of tags */
+ /* List of collections */
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_ETCHED_IN);
@@ -372,7 +394,7 @@ bjb_note_tag_dialog_constructed (GObject *obj)
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- update_tags_model_async (self);
+ update_collections_model_async (self);
priv->view = GTK_TREE_VIEW (gtk_tree_view_new_with_model (GTK_TREE_MODEL (priv->store)));
g_object_unref (self->priv->store);
@@ -400,6 +422,8 @@ bjb_note_tag_dialog_finalize (GObject *object)
BjbNoteTagDialog *self = BJB_NOTE_TAG_DIALOG (object);
BjbNoteTagDialogPrivate *priv = self->priv;
+ g_hash_table_destroy (priv->collections);
+
/* no reason, it should have been freed earlier */
if (priv->tag_to_scroll_to)
g_free (priv->tag_to_scroll_to);
diff --git a/src/libbiji/biji-note-obj.c b/src/libbiji/biji-note-obj.c
index 96e7704..9168adc 100644
--- a/src/libbiji/biji-note-obj.c
+++ b/src/libbiji/biji-note-obj.c
@@ -571,7 +571,7 @@ void biji_note_obj_set_raw_text (BijiNoteObj *note, gchar *plain_text)
}
GList *
-biji_note_obj_get_labels (BijiNoteObj *n)
+biji_note_obj_get_collections (BijiNoteObj *n)
{
g_return_val_if_fail (BIJI_IS_NOTE_OBJ (n), NULL);
@@ -579,7 +579,7 @@ biji_note_obj_get_labels (BijiNoteObj *n)
}
gboolean
-biji_note_obj_has_label (BijiNoteObj *note, gchar *label)
+biji_note_obj_has_collection (BijiNoteObj *note, gchar *label)
{
if (g_hash_table_lookup (note->priv->labels, label))
return TRUE;
@@ -588,11 +588,11 @@ biji_note_obj_has_label (BijiNoteObj *note, gchar *label)
}
gboolean
-biji_note_obj_add_label (BijiNoteObj *note, gchar *label, gboolean on_user_action_cb)
+biji_note_obj_add_collection (BijiNoteObj *note, gchar *label, gboolean on_user_action_cb)
{
g_return_val_if_fail (BIJI_IS_NOTE_OBJ (note), FALSE);
g_return_val_if_fail (label != NULL, FALSE);
- g_return_val_if_fail (!biji_note_obj_has_label (note, label), FALSE);
+ g_return_val_if_fail (!biji_note_obj_has_collection (note, label), FALSE);
gchar *tag = g_strdup (label);
@@ -600,7 +600,7 @@ biji_note_obj_add_label (BijiNoteObj *note, gchar *label, gboolean on_user_actio
if (on_user_action_cb)
{
- push_existing_or_new_tag_to_note (tag, note); // Tracker
+ biji_push_existing_collection_to_note (note, tag); // Tracker
biji_note_id_set_last_metadata_change_date_now (note->priv->id);
biji_note_obj_save_note (note);
}
@@ -609,13 +609,13 @@ biji_note_obj_add_label (BijiNoteObj *note, gchar *label, gboolean on_user_actio
}
gboolean
-biji_note_obj_remove_label (BijiNoteObj *note, gchar *label)
+biji_note_obj_remove_collection (BijiNoteObj *note, gchar *label, gchar *urn)
{
g_return_val_if_fail (BIJI_IS_NOTE_OBJ (note), FALSE);
if (g_hash_table_remove (note->priv->labels, label))
{
- remove_tag_from_note (label, note); // tracker.
+ biji_remove_collection_from_note (note, urn); // tracker.
biji_note_id_set_last_metadata_change_date_now (note->priv->id);
biji_note_obj_save_note (note);
return TRUE;
diff --git a/src/libbiji/biji-note-obj.h b/src/libbiji/biji-note-obj.h
index b3078fa..ce27b0a 100644
--- a/src/libbiji/biji-note-obj.h
+++ b/src/libbiji/biji-note-obj.h
@@ -114,13 +114,13 @@ void biji_note_obj_set_rgba(BijiNoteObj *n, GdkRGBA *rgba) ;
/* Tracker Tags. Free the GList.
* Remove label always due to user action. Add label has to precise */
-GList * biji_note_obj_get_labels (BijiNoteObj *n);
+GList * biji_note_obj_get_collections (BijiNoteObj *n);
-gboolean biji_note_obj_has_label (BijiNoteObj *note, gchar *label);
+gboolean biji_note_obj_has_collection (BijiNoteObj *note, gchar *label);
-gboolean biji_note_obj_add_label (BijiNoteObj *note, gchar *label, gboolean on_user_action_cb);
+gboolean biji_note_obj_add_collection (BijiNoteObj *note, gchar *label, gboolean on_user_action_cb);
-gboolean biji_note_obj_remove_label (BijiNoteObj *note, gchar *label);
+gboolean biji_note_obj_remove_collection (BijiNoteObj *note, gchar *label, gchar *urn);
/////////////////////////////////////////////////////////////////// templates
gboolean note_obj_is_template(BijiNoteObj *n) ;
diff --git a/src/libbiji/biji-tracker.c b/src/libbiji/biji-tracker.c
index 5e84898..4affce7 100644
--- a/src/libbiji/biji-tracker.c
+++ b/src/libbiji/biji-tracker.c
@@ -142,16 +142,19 @@ get_note_url (BijiNoteObj *note)
/////////////// Tags
-/* This func only provides tags.
+/* This func only provides collections.
* TODO : include number of notes / files */
-GList *
-biji_get_all_tags_finish (GObject *source_object,
- GAsyncResult *res)
+GHashTable *
+biji_get_all_collections_finish (GObject *source_object,
+ GAsyncResult *res)
{
TrackerSparqlConnection *self = TRACKER_SPARQL_CONNECTION (source_object);
TrackerSparqlCursor *cursor;
GError *error = NULL;
- GList *result = NULL;
+ GHashTable *result = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ g_free);
cursor = tracker_sparql_connection_query_finish (self,
res,
@@ -165,12 +168,13 @@ biji_get_all_tags_finish (GObject *source_object,
if (cursor)
{
- gchar* tag;
+ gchar *urn, *collection;
while (tracker_sparql_cursor_next (cursor, NULL, NULL))
{
- tag = g_strdup (tracker_sparql_cursor_get_string (cursor, 0, NULL));
- result = g_list_prepend (result, (gpointer) tag);
+ urn = g_strdup (tracker_sparql_cursor_get_string (cursor, 0, NULL));
+ collection = g_strdup (tracker_sparql_cursor_get_string (cursor, 1, NULL));
+ g_hash_table_replace (result, collection, urn);
}
g_object_unref (cursor);
@@ -180,19 +184,18 @@ biji_get_all_tags_finish (GObject *source_object,
}
void
-biji_get_all_tracker_tags_async (GAsyncReadyCallback f,
- gpointer user_data)
+biji_get_all_collections_async (GAsyncReadyCallback f,
+ gpointer user_data)
{
- gchar *query = "SELECT DISTINCT ?labels WHERE \
- { ?tags a nao:Tag ; nao:prefLabel ?labels. }";
+ gchar *query = "SELECT ?c ?title WHERE { ?c a nfo:DataContainer ; nie:title ?title ; nie:generator 'Bijiben'}";
bjb_perform_query_async (query, f, user_data);
}
GList *
-biji_get_notes_with_strings_or_tag_finish (GObject *source_object,
- GAsyncResult *res,
- BijiNoteBook *book)
+biji_get_notes_with_strings_or_collection_finish (GObject *source_object,
+ GAsyncResult *res,
+ BijiNoteBook *book)
{
TrackerSparqlConnection *self = TRACKER_SPARQL_CONNECTION (source_object);
TrackerSparqlCursor *cursor;
@@ -209,17 +212,33 @@ biji_get_notes_with_strings_or_tag_finish (GObject *source_object,
if (cursor)
{
- gchar * uri;
+ const gchar *full_path;
+ gchar *path;
BijiNoteObj *note = NULL;
while (tracker_sparql_cursor_next (cursor, NULL, NULL))
{
- uri = g_strdup (tracker_sparql_cursor_get_string (cursor, 0, NULL));
- note = note_book_get_note_at_path (book, uri);
+ full_path = tracker_sparql_cursor_get_string (cursor, 0, NULL);
+
+ if (g_str_has_prefix (full_path, "file://"))
+ {
+ GString *string;
+ string = g_string_new (full_path);
+ g_string_erase (string, 0, 7);
+ path = g_string_free (string, FALSE);
+ }
+ else
+ {
+ path = g_strdup (full_path);
+ }
+
+ note = note_book_get_note_at_path (book, path);
/* Sorting is done in another place */
if (note)
result = g_list_prepend (result, note);
+
+ g_free (path);
}
g_object_unref (cursor);
@@ -228,28 +247,26 @@ biji_get_notes_with_strings_or_tag_finish (GObject *source_object,
return result;
}
-/* TODO : not case sensitive */
+/* FIXME : the nie:isPartOf returns file://$path, while
+ * union fts returns $path which leads to uggly code
+ * TODO : not case sensitive */
void
-biji_get_notes_with_string_or_tag_async (gchar *needle, GAsyncReadyCallback f, gpointer user_data)
+biji_get_notes_with_string_or_collection_async (gchar *needle, GAsyncReadyCallback f, gpointer user_data)
{
gchar *query;
- query = g_strdup_printf ("SELECT ?s WHERE {{ ?s nie:generator 'Bijiben'. \
- ?s a nfo:Note ;nao:hasTag [nao:prefLabel'%s'] } \
- UNION { ?s fts:match '%s'. ?s nie:generator 'Bijiben'}}",
+ query = g_strdup_printf ("SELECT ?s WHERE {{?c nie:isPartOf ?s; nie:title '%s'} \
+ UNION {?s fts:match '%s'. ?s nie:generator 'Bijiben'}}",
needle, needle);
bjb_perform_query_async (query, f, user_data);
- g_free (query);
}
void
-push_tag_to_tracker (const gchar *tag, BijiFunc afterward, gpointer user_data)
+biji_create_new_collection (const gchar *tag, BijiFunc afterward, gpointer user_data)
{
- gchar *query = g_strdup_printf ("INSERT {_:tag a nao:Tag ; \
- nao:prefLabel '%s' . } \
- WHERE { OPTIONAL {?tag a nao:Tag ; nao:prefLabel '%s'} . \
- FILTER (!bound(?tag)) }",tag,tag);
+ gchar *query = g_strdup_printf ("INSERT {_:result a nfo:DataContainer;a nie:DataObject;nie:title '%s' ; nie:generator 'Bijiben'}"
+ ,tag);
biji_perform_update_async_and_free (query, afterward, user_data);
}
@@ -257,41 +274,31 @@ push_tag_to_tracker (const gchar *tag, BijiFunc afterward, gpointer user_data)
/* removes the tag EVEN if files associated.
* TODO : afterward */
void
-remove_tag_from_tracker(gchar *tag)
+biji_remove_collection_from_tracker (gchar *urn)
{
- gchar *value = tracker_str (tag);
- gchar *query = g_strdup_printf ("DELETE { ?tag a nao:Tag } \
- WHERE { ?tag nao:prefLabel '%s' }",value);
-
+ gchar *query = g_strdup_printf ("DELETE {'%s' a nfo:DataContainer}", urn);
biji_perform_update_async_and_free (query, NULL, NULL);
- g_free (tag);
}
void
-push_existing_or_new_tag_to_note (gchar *tag, BijiNoteObj *note)
+biji_push_existing_collection_to_note (BijiNoteObj *note, gchar *title)
{
gchar *url = get_note_url (note);
- gchar *query = g_strdup_printf (
- "INSERT {_:tag a nao:Tag ; nao:prefLabel '%s'. \
- ?unknown nao:hasTag _:tag} WHERE {?unknown nie:url '%s'}",
- tag, url);
+ gchar *query = g_strdup_printf ("INSERT {?urn nie:isPartOf '%s'} WHERE {?urn a nfo:DataContainer; nie:title '%s'; nie:generator 'Bijiben'}",
+ url, title);
biji_perform_update_async_and_free (query, NULL, NULL);
-
g_free (url);
}
/* This one is to be fixed */
void
-remove_tag_from_note (gchar *tag, BijiNoteObj *note)
+biji_remove_collection_from_note (BijiNoteObj *note, gchar *urn)
{
gchar *url = get_note_url (note);
- gchar *query = g_strdup_printf ("DELETE { ?urn nao:hasTag ?label } \
- WHERE { ?urn nie:url ?f . ?label nao:prefLabel '%s' . \
- FILTER (?f = '%s') }", tag, url);
+ gchar *query = g_strdup_printf ("DELETE {'%s' nie:isPartOf '%s'}", urn, url);
biji_perform_update_async_and_free (query, NULL, NULL);
-
g_free (url);
}
diff --git a/src/libbiji/biji-tracker.h b/src/libbiji/biji-tracker.h
index b6a8952..eb84a99 100644
--- a/src/libbiji/biji-tracker.h
+++ b/src/libbiji/biji-tracker.h
@@ -27,22 +27,31 @@
/* todo : find this on glib */
typedef void (*BijiFunc) (gpointer user_data);
-/* All notes matching (either content or tag) */
-GList * biji_get_notes_with_strings_or_tag_finish (GObject *source_object, GAsyncResult *res, BijiNoteBook *book);
-void biji_get_notes_with_string_or_tag_async (gchar *needle, GAsyncReadyCallback f, gpointer user_data);
+/* All notes matching (either content or collections) */
+GList * biji_get_notes_with_strings_or_collection_finish (GObject *source_object,
+ GAsyncResult *res,
+ BijiNoteBook *book);
-/* Get tags */
-GList * biji_get_all_tags_finish (GObject *source_object, GAsyncResult *res);
+void biji_get_notes_with_string_or_collection_async (gchar *needle,
+ GAsyncReadyCallback f,
+ gpointer user_data);
-void biji_get_all_tracker_tags_async (GAsyncReadyCallback f, gpointer user_data);
+/* Collections */
-void push_tag_to_tracker (const gchar *tag, BijiFunc afterward, gpointer user_data);
+/* The URN is the... value. Collection _title_ is the key.*/
+GHashTable * biji_get_all_collections_finish (GObject *source_object, GAsyncResult *res);
-void remove_tag_from_tracker(gchar *tag);
+void biji_get_all_collections_async (GAsyncReadyCallback f, gpointer user_data);
-void push_existing_or_new_tag_to_note (gchar *tag,BijiNoteObj *note);
+void biji_create_new_collection (const gchar *tag, BijiFunc afterward, gpointer user_data);
-void remove_tag_from_note (gchar *tag, BijiNoteObj *note) ;
+void biji_remove_collection_from_tracker (gchar *urn);
+
+// when adding an existing collection, use the collection title
+void biji_push_existing_collection_to_note (BijiNoteObj *note, gchar *title);
+
+// when removing, use the urn
+void biji_remove_collection_from_note (BijiNoteObj *note, gchar *urn);
/* Insert or update */
void bijiben_push_note_to_tracker(BijiNoteObj *note);
diff --git a/src/libbiji/deserializer/biji-lazy-deserializer.c b/src/libbiji/deserializer/biji-lazy-deserializer.c
index 13f0ece..adcbb50 100644
--- a/src/libbiji/deserializer/biji-lazy-deserializer.c
+++ b/src/libbiji/deserializer/biji-lazy-deserializer.c
@@ -492,7 +492,7 @@ processNode (BijiLazyDeserializer *self)
{
norm = g_string_new (tag);
g_string_erase (norm,0,16);
- biji_note_obj_add_label (n, norm->str, FALSE);
+ biji_note_obj_add_collection (n, norm->str, FALSE);
g_string_free (norm, TRUE);
}
diff --git a/src/libbiji/serializer/biji-lazy-serializer.c b/src/libbiji/serializer/biji-lazy-serializer.c
index bcf4a23..3c1a149 100644
--- a/src/libbiji/serializer/biji-lazy-serializer.c
+++ b/src/libbiji/serializer/biji-lazy-serializer.c
@@ -221,7 +221,7 @@ biji_lazy_serialize_internal (BijiLazySerializer *self)
//<tags>
xmlTextWriterWriteRaw(priv->writer, BAD_CAST "\n ");
xmlTextWriterStartElement (priv->writer, BAD_CAST "tags");
- tags = biji_note_obj_get_labels (priv->note);
+ tags = biji_note_obj_get_collections (priv->note);
g_list_foreach (tags, (GFunc) serialize_tags, priv->writer);
xmlTextWriterEndElement (priv->writer);
g_list_free (tags);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]