[bijiben] notebook: rename class from Collection to Notebook
- From: Pierre-Yves Luyten <pyluyten src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bijiben] notebook: rename class from Collection to Notebook
- Date: Thu, 31 Oct 2013 22:49:44 +0000 (UTC)
commit ad403bbb839990a289420f5e78bb03de93191291
Author: Pierre-Yves Luyten <py luyten fr>
Date: Thu Oct 31 23:16:11 2013 +0100
notebook: rename class from Collection to Notebook
Notebook makes more sense.
src/bjb-controller.c | 52 +++---
src/bjb-controller.h | 4 +-
src/bjb-empty-results-box.c | 2 +-
src/bjb-main-toolbar.c | 20 +-
src/bjb-main-view.c | 8 +-
src/bjb-note-tag-dialog.c | 90 +++++-----
src/libbiji/Makefile.am | 4 +-
src/libbiji/biji-collection.h | 66 -------
src/libbiji/biji-item.c | 12 +-
src/libbiji/biji-item.h | 16 +-
src/libbiji/biji-manager.c | 6 +-
src/libbiji/biji-manager.h | 2 +-
src/libbiji/biji-note-obj.c | 42 ++--
src/libbiji/biji-note-obj.h | 2 +-
src/libbiji/{biji-collection.c => biji-notebook.c} | 198 ++++++++++----------
src/libbiji/biji-notebook.h | 66 +++++++
src/libbiji/biji-tracker.c | 34 ++--
src/libbiji/biji-tracker.h | 12 +-
src/libbiji/deserializer/biji-lazy-deserializer.c | 2 +-
src/libbiji/deserializer/biji-tomboy-reader.c | 8 +-
src/libbiji/deserializer/biji-tomboy-reader.h | 2 +-
src/libbiji/libbiji.h | 2 +-
src/libbiji/provider/biji-import-provider.c | 6 +-
src/libbiji/provider/biji-local-provider.c | 24 ++--
src/libbiji/provider/biji-own-cloud-provider.c | 2 +-
src/libbiji/provider/biji-provider.h | 2 +-
src/libbiji/serializer/biji-lazy-serializer.c | 2 +-
27 files changed, 343 insertions(+), 343 deletions(-)
---
diff --git a/src/bjb-controller.c b/src/bjb-controller.c
index 35bb4ac..2136acb 100644
--- a/src/bjb-controller.c
+++ b/src/bjb-controller.c
@@ -43,7 +43,7 @@ struct _BjbControllerPrivate
{
BijiManager *manager ;
gchar *needle ;
- BijiCollection *collection;
+ BijiNotebook *notebook;
GtkTreeModel *model ;
BjbWindowBase *window;
@@ -109,7 +109,7 @@ bjb_controller_init (BjbController *self)
priv->items_to_show = NULL;
priv->n_items_to_show = BJB_ITEMS_SLICE;
priv->needle = NULL;
- priv->collection = NULL;
+ priv->notebook = NULL;
priv->connected = FALSE;
}
@@ -132,8 +132,8 @@ bjb_controller_finalize (GObject *object)
g_free (priv->needle);
g_list_free (priv->items_to_show);
- if (priv->collection)
- g_free (priv->collection);
+ if (priv->notebook)
+ g_free (priv->notebook);
G_OBJECT_CLASS (bjb_controller_parent_class)->finalize (object);
}
@@ -315,10 +315,10 @@ bjb_controller_add_item_if_needed (BjbController *self,
/* No search - we add the note */
if (!priv->needle || g_strcmp0 (priv->needle, "")==0)
{
- if (!priv->collection)
+ if (!priv->notebook)
need_to_add_item = TRUE;
- /* To do : we might have a collection
+ /* To do : we might have a notebook
* but have to udpate the view */
}
@@ -352,20 +352,20 @@ most_recent_item_first (gconstpointer a, gconstpointer b)
BijiItem *other = BIJI_ITEM (b);
glong result = 0;
- /* Always sort collections before notes */
- if (BIJI_IS_COLLECTION (a))
+ /* Always sort notebooks before notes */
+ if (BIJI_IS_NOTEBOOK (a))
{
if (BIJI_IS_NOTE_OBJ (b))
result = -1;
}
- else if (BIJI_IS_COLLECTION (b))
+ else if (BIJI_IS_NOTEBOOK (b))
{
result = 1;
}
/* If comparing two notes or
- * two collections, use the most recent cookbook */
+ * two notebooks, use the most recent cookbook */
else
{
result = biji_item_get_mtime (other)
@@ -536,7 +536,7 @@ on_manager_changed (BijiManager *manager,
if (BIJI_IS_NOTE_OBJ (item))
bjb_controller_get_iter (self, NULL, &p_iter);
- else if (BIJI_IS_COLLECTION (item))
+ else if (BIJI_IS_NOTEBOOK (item))
p_iter = NULL;
bjb_controller_add_item_if_needed (self, item, TRUE, p_iter);
@@ -545,7 +545,7 @@ on_manager_changed (BijiManager *manager,
notify_displayed_items_changed (self);
break;
- /* Same comment, prepend but collection before note */
+ /* Same comment, prepend but notebook before note */
case BIJI_MANAGER_NOTE_AMENDED:
if (bjb_controller_get_iter (self, item, &p_iter))
{
@@ -554,7 +554,7 @@ on_manager_changed (BijiManager *manager,
if (BIJI_IS_NOTE_OBJ (item))
bjb_controller_get_iter (self, NULL, &p_iter);
- else if (BIJI_IS_COLLECTION (item))
+ else if (BIJI_IS_NOTEBOOK (item))
p_iter = NULL;
bjb_controller_add_item_if_needed (self, item, TRUE, p_iter);
@@ -744,37 +744,37 @@ bjb_controller_shows_item (BjbController *self)
return (self->priv->items_to_show != NULL);
}
-BijiCollection *
-bjb_controller_get_collection (BjbController *self)
+BijiNotebook *
+bjb_controller_get_notebook (BjbController *self)
{
- return self->priv->collection;
+ return self->priv->notebook;
}
void
-bjb_controller_set_collection (BjbController *self,
- BijiCollection *coll)
+bjb_controller_set_notebook (BjbController *self,
+ BijiNotebook *coll)
{
- /* Going back from a collection */
+ /* Going back from a notebook */
if (!coll)
{
- if (!self->priv->collection)
+ if (!self->priv->notebook)
return;
bjb_window_base_switch_to (self->priv->window, BJB_WINDOW_BASE_SPINNER_VIEW);
- self->priv->collection = NULL;
+ self->priv->notebook = NULL;
bjb_controller_apply_needle (self);
return;
}
- /* Opening an __existing__ collection */
+ /* Opening an __existing__ notebook */
bjb_window_base_switch_to (self->priv->window, BJB_WINDOW_BASE_SPINNER_VIEW);
g_clear_pointer (&self->priv->items_to_show, g_list_free);
g_clear_pointer (&self->priv->needle, g_free);
self->priv->needle = g_strdup ("");
- self->priv->collection = coll;
- biji_get_items_with_collection_async (self->priv->manager,
+ self->priv->notebook = coll;
+ biji_get_items_with_notebook_async (self->priv->manager,
biji_item_get_title (BIJI_ITEM (coll)),
update_controller_callback,
self);
@@ -788,8 +788,8 @@ bjb_controller_show_more (BjbController *self)
/* FIXME: this method to refresh is just non sense */
- if (self->priv->collection != NULL)
- bjb_controller_set_collection (self, self->priv->collection);
+ if (self->priv->notebook != NULL)
+ bjb_controller_set_notebook (self, self->priv->notebook);
else
on_needle_changed (self);
diff --git a/src/bjb-controller.h b/src/bjb-controller.h
index 5dda3c2..e8c2d3d 100644
--- a/src/bjb-controller.h
+++ b/src/bjb-controller.h
@@ -72,9 +72,9 @@ void bjb_controller_disconnect (BjbController *self);
gboolean bjb_controller_shows_item (BjbController *self);
-BijiCollection * bjb_controller_get_collection (BjbController *self);
+BijiNotebook * bjb_controller_get_notebook (BjbController *self);
-void bjb_controller_set_collection (BjbController *self, BijiCollection *coll);
+void bjb_controller_set_notebook (BjbController *self, BijiNotebook *coll);
void bjb_controller_show_more (BjbController *controller);
diff --git a/src/bjb-empty-results-box.c b/src/bjb-empty-results-box.c
index 2f36b2b..1ac7d86 100644
--- a/src/bjb-empty-results-box.c
+++ b/src/bjb-empty-results-box.c
@@ -141,7 +141,7 @@ bjb_empty_results_box_set_type (BjbEmptyResultsBox *self,
case BJB_EMPTY_RESULTS_NO_NOTE:
gtk_label_set_label (
self->priv->details_label,
- _("Your notes collection is empty.\nClick the New button to create your first note."));
+ _("Your notes notebook is empty.\nClick the New button to create your first note."));
break;
case BJB_EMPTY_RESULTS_NO_RESULTS:
diff --git a/src/bjb-main-toolbar.c b/src/bjb-main-toolbar.c
index 61b1e13..d1629cb 100644
--- a/src/bjb-main-toolbar.c
+++ b/src/bjb-main-toolbar.c
@@ -110,7 +110,7 @@ on_new_note_clicked (GtkWidget *but, BjbMainView *view)
BijiManager *manager;
BjbSettings *settings;
- /* append note to collection */
+ /* append note to notebook */
manager = bjb_window_base_get_manager (bjb_main_view_get_window (view));
settings = bjb_app_get_settings (g_application_get_default ());
result = biji_manager_note_new (manager,
@@ -257,7 +257,7 @@ add_search_button (BjbMainToolbar *self)
"image-button");
gtk_header_bar_pack_end (GTK_HEADER_BAR (self), priv->search);
gtk_widget_set_tooltip_text (priv->search,
- _("Search note titles, content and collections"));
+ _("Search note titles, content and notebooks"));
active = bjb_window_base_get_show_search_bar (BJB_WINDOW_BASE (self->priv->window));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->search), active);
@@ -330,10 +330,10 @@ static void
update_label_for_standard (BjbMainToolbar *self)
{
BjbMainToolbarPrivate *priv = self->priv;
- BijiCollection *coll;
+ BijiNotebook *coll;
gchar *needle, *label;
- coll = bjb_controller_get_collection (priv->controller);
+ coll = bjb_controller_get_notebook (priv->controller);
needle = bjb_controller_get_needle (priv->controller);
if (coll)
@@ -372,14 +372,14 @@ connect_main_view_handlers (BjbMainToolbar *self)
static void
on_back_button_clicked (BjbMainToolbar *self)
{
- bjb_controller_set_collection (self->priv->controller, NULL);
+ bjb_controller_set_notebook (self->priv->controller, NULL);
}
static void
populate_bar_for_standard(BjbMainToolbar *self)
{
BjbMainToolbarPrivate *priv = self->priv;
- BijiCollection *coll;
+ BijiNotebook *coll;
GtkWidget *select_image;
gboolean rtl;
GtkSizeGroup *size;
@@ -392,7 +392,7 @@ populate_bar_for_standard(BjbMainToolbar *self)
"search-changed", G_CALLBACK(update_label_for_standard), self);
/* Go back to all notes */
- coll = bjb_controller_get_collection (priv->controller);
+ coll = bjb_controller_get_notebook (priv->controller);
if (coll != NULL)
{
@@ -460,7 +460,7 @@ populate_bar_for_icon_view(BjbMainToolbar *self)
"image-button");
gtk_header_bar_pack_end (GTK_HEADER_BAR (self), priv->list);
gtk_widget_set_tooltip_text (priv->list,
- _("View notes and collections in a list"));
+ _("View notes and notebooks in a list"));
g_signal_connect (priv->list, "clicked",
G_CALLBACK(on_view_mode_clicked),self);
@@ -484,7 +484,7 @@ populate_bar_for_list_view(BjbMainToolbar *self)
"image-button");
gtk_header_bar_pack_end (GTK_HEADER_BAR (self), priv->grid);
gtk_widget_set_tooltip_text (priv->grid,
- _("View notes and collections in a grid"));
+ _("View notes and notebooks in a grid"));
g_signal_connect (priv->grid, "clicked",
G_CALLBACK(on_view_mode_clicked),self);
@@ -598,7 +598,7 @@ delete_item_callback (GtkWidget *item, gpointer user_data)
{
BjbMainToolbar *self = BJB_MAIN_TOOLBAR (user_data);
- /* Delete the note from collection
+ /* Delete the note from notebook
* The deleted note will emit a signal. */
biji_manager_remove_item (
bjb_window_base_get_manager (GTK_WIDGET (self->priv->window)),
diff --git a/src/bjb-main-view.c b/src/bjb-main-view.c
index 6b3636e..9a2bfb4 100644
--- a/src/bjb-main-view.c
+++ b/src/bjb-main-view.c
@@ -218,10 +218,10 @@ switch_to_item (BjbMainView *view, BijiItem *to_open)
/* Collection
* TODO : check if already opened (same as above) */
- else if (BIJI_IS_COLLECTION (to_open))
+ else if (BIJI_IS_NOTEBOOK (to_open))
{
- bjb_controller_set_collection (view->priv->controller,
- BIJI_COLLECTION (to_open));
+ bjb_controller_set_notebook (view->priv->controller,
+ BIJI_NOTEBOOK (to_open));
}
}
@@ -482,7 +482,7 @@ render_type (GtkTreeViewColumn *tree_column,
if (item != NULL)
{
- if BIJI_IS_COLLECTION (item)
+ if BIJI_IS_NOTEBOOK (item)
str= _("Collection");
else if BIJI_IS_NOTE_OBJ (item)
diff --git a/src/bjb-note-tag-dialog.c b/src/bjb-note-tag-dialog.c
index e84bd77..c17214e 100644
--- a/src/bjb-note-tag-dialog.c
+++ b/src/bjb-note-tag-dialog.c
@@ -60,14 +60,14 @@ struct _BjbNoteTagDialogPrivate
// data
GList *items;
GtkListStore *store;
- GHashTable *collections;
+ GHashTable *notebooks;
// tmp when a new tag added
gchar *tag_to_scroll_to;
// for convenience, when a tag is toggled
- // stores the collection urn
- gchar *toggled_collection;
+ // stores the notebook urn
+ gchar *toggled_notebook;
};
@@ -76,7 +76,7 @@ struct _BjbNoteTagDialogPrivate
G_DEFINE_TYPE (BjbNoteTagDialog, bjb_note_tag_dialog, GTK_TYPE_DIALOG);
static void
-append_collection (BijiInfoSet *set, BjbNoteTagDialog *self)
+append_notebook (BijiInfoSet *set, BjbNoteTagDialog *self)
{
BjbNoteTagDialogPrivate *priv = self->priv;
@@ -85,12 +85,12 @@ append_collection (BijiInfoSet *set, BjbNoteTagDialog *self)
GList *l;
gtk_list_store_append (priv->store, &iter);
- item_has_tag = biji_item_has_collection (priv->items->data, set->title);
+ item_has_tag = biji_item_has_notebook (priv->items->data, set->title);
/* Check if other notes have the same */
for (l = priv->items; l != NULL; l = l->next)
{
- if (biji_item_has_collection (l->data, set->title) != item_has_tag)
+ if (biji_item_has_notebook (l->data, set->title) != item_has_tag)
{
item_has_tag = SELECTION_INCONSISTENT;
break;
@@ -104,7 +104,7 @@ append_collection (BijiInfoSet *set, BjbNoteTagDialog *self)
}
static gint
-bjb_compare_collection (gconstpointer a, gconstpointer b)
+bjb_compare_notebook (gconstpointer a, gconstpointer b)
{
gchar *up_a, *up_b;
@@ -166,14 +166,14 @@ bjb_note_tag_dialog_handle_tags (GHashTable *result, gpointer user_data)
BjbNoteTagDialogPrivate *priv = self->priv;
GList *tracker_info;
- if (priv->collections)
- g_hash_table_destroy (priv->collections);
+ if (priv->notebooks)
+ g_hash_table_destroy (priv->notebooks);
- priv->collections = result;
+ priv->notebooks = result;
- tracker_info = g_hash_table_get_values (priv->collections);
- tracker_info = g_list_sort (tracker_info, bjb_compare_collection);
- g_list_foreach (tracker_info, (GFunc) append_collection, self);
+ tracker_info = g_hash_table_get_values (priv->notebooks);
+ tracker_info = g_list_sort (tracker_info, bjb_compare_notebook);
+ g_list_foreach (tracker_info, (GFunc) append_notebook, self);
g_list_free (tracker_info);
/* If a new tag was added, scroll & free */
@@ -193,29 +193,29 @@ bjb_note_tag_dialog_handle_tags (GHashTable *result, gpointer user_data)
}
static void
-update_collections_model_async (BjbNoteTagDialog *self)
+update_notebooks_model_async (BjbNoteTagDialog *self)
{
BijiManager *manager;
manager = bjb_window_base_get_manager (GTK_WIDGET (self->priv->window));
gtk_list_store_clear (self->priv->store);
- biji_get_all_collections_async (manager, bjb_note_tag_dialog_handle_tags, self);
+ biji_get_all_notebooks_async (manager, bjb_note_tag_dialog_handle_tags, self);
}
/* Libbiji handles tracker & saving */
static void
-note_dialog_add_collection (gpointer iter, gpointer user_data)
+note_dialog_add_notebook (gpointer iter, gpointer user_data)
{
- g_return_if_fail (BIJI_IS_COLLECTION (user_data));
- biji_item_add_collection (iter, user_data, NULL);
+ g_return_if_fail (BIJI_IS_NOTEBOOK (user_data));
+ biji_item_add_notebook (iter, user_data, NULL);
}
static void
-note_dialog_remove_collection (gpointer iter, gpointer user_data)
+note_dialog_remove_notebook (gpointer iter, gpointer user_data)
{
- g_return_if_fail (BIJI_IS_COLLECTION (user_data));
- biji_item_remove_collection (iter, user_data);
+ g_return_if_fail (BIJI_IS_NOTEBOOK (user_data));
+ biji_item_remove_notebook (iter, user_data);
}
static void
@@ -232,56 +232,56 @@ on_tag_toggled (GtkCellRendererToggle *cell,
gint *column;
gchar *tag;
BijiManager *manager;
- BijiItem *collection;
+ BijiItem *notebook;
column = g_object_get_data (G_OBJECT (cell), "column");
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, column, &toggle_item, -1);
gtk_tree_model_get (model, &iter, COL_URN, &tag, -1);
- priv->toggled_collection = tag;
+ priv->toggled_notebook = tag;
manager = bjb_window_base_get_manager (GTK_WIDGET (self->priv->window));
- collection = biji_manager_get_item_at_path (manager, tag);
+ notebook = biji_manager_get_item_at_path (manager, tag);
- if (BIJI_IS_COLLECTION (collection))
+ if (BIJI_IS_NOTEBOOK (notebook))
{
if (toggle_item == SELECTION_INCONSISTENT || toggle_item == SELECTION_FALSE)
{
- g_list_foreach (priv->items, note_dialog_add_collection, collection);
+ g_list_foreach (priv->items, note_dialog_add_notebook, notebook);
toggle_item = SELECTION_TRUE;
}
else
{
- g_list_foreach (priv->items, note_dialog_remove_collection, collection);
+ g_list_foreach (priv->items, note_dialog_remove_notebook, notebook);
toggle_item = SELECTION_FALSE;
}
}
- priv->toggled_collection = NULL;
+ priv->toggled_notebook = NULL;
gtk_list_store_set (priv->store, &iter, column, toggle_item, -1);
gtk_tree_path_free (path);
}
-/* If the collection with same title already existed,
+/* If the notebook with same title already existed,
* libbiji has to avoid creating a new one
* and also check before tagging items */
static void
-on_new_collection_created_cb (BijiItem *coll, gpointer user_data)
+on_new_notebook_created_cb (BijiItem *coll, 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->items, note_dialog_add_collection, coll);
+ g_list_foreach (priv->items, note_dialog_add_notebook, coll);
- update_collections_model_async (self);
+ update_notebooks_model_async (self);
gtk_entry_set_text (GTK_ENTRY (priv->entry), "");
}
/* Gives the title and manager :
- * the collection is created & manager updated.
+ * the notebook is created & manager updated.
* afterward, our callback comes */
static void
add_new_tag (BjbNoteTagDialog *self)
@@ -290,7 +290,7 @@ add_new_tag (BjbNoteTagDialog *self)
const gchar *title = gtk_entry_get_text (GTK_ENTRY (self->priv->entry));
if (title && g_utf8_strlen (title, -1) > 0)
- biji_create_new_collection_async (manager, title, on_new_collection_created_cb, self);
+ biji_create_new_notebook_async (manager, title, on_new_notebook_created_cb, self);
}
static void
@@ -341,7 +341,7 @@ add_columns (GtkTreeView *view, BjbNoteTagDialog *self)
gtk_tree_view_append_column (view, column);
- /* List column: collection title */
+ /* List column: notebook title */
column = gtk_tree_view_column_new ();
gtk_tree_view_append_column (view, column);
@@ -359,10 +359,10 @@ bjb_note_tag_dialog_init (BjbNoteTagDialog *self)
self->priv = priv;
priv->items = NULL;
- priv->collections = NULL;
+ priv->notebooks = NULL;
priv->window = NULL;
priv->tag_to_scroll_to = NULL;
- priv->toggled_collection = NULL;
+ priv->toggled_notebook = NULL;
gtk_window_set_default_size (GTK_WINDOW (self),
BJB_NOTE_TAG_DIALOG_DEFAULT_WIDTH,
@@ -373,9 +373,9 @@ bjb_note_tag_dialog_init (BjbNoteTagDialog *self)
G_CALLBACK (gtk_widget_destroy), self);
priv->store = gtk_list_store_new (N_COLUMNS,
- G_TYPE_INT, // collection is active
- G_TYPE_STRING, // collection urn
- G_TYPE_STRING); // collection title
+ G_TYPE_INT, // notebook is active
+ G_TYPE_STRING, // notebook urn
+ G_TYPE_STRING); // notebook title
}
static void
@@ -396,7 +396,7 @@ bjb_note_tag_dialog_constructed (GObject *obj)
area = gtk_dialog_get_content_area (GTK_DIALOG (self));
gtk_container_set_border_width (GTK_CONTAINER (area), 8);
- label = gtk_label_new (_("Enter a name to create a collection"));
+ label = gtk_label_new (_("Enter a name to create a notebook"));
gtk_box_pack_start (GTK_BOX (area), label, FALSE, FALSE, 2);
/* New Tag */
@@ -406,12 +406,12 @@ bjb_note_tag_dialog_constructed (GObject *obj)
self->priv->entry = gtk_entry_new();
gtk_box_pack_start (GTK_BOX (hbox), self->priv->entry, TRUE, TRUE, 0);
- new = gtk_button_new_with_label (_("New collection"));
+ new = gtk_button_new_with_label (_("New notebook"));
g_signal_connect_swapped (new, "clicked", G_CALLBACK (add_new_tag), self);
gtk_box_pack_start (GTK_BOX (hbox), new, FALSE, FALSE, 2);
- /* List of collections */
+ /* List of notebooks */
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_ETCHED_IN);
@@ -419,7 +419,7 @@ bjb_note_tag_dialog_constructed (GObject *obj)
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- update_collections_model_async (self);
+ update_notebooks_model_async (self);
priv->view = GTK_TREE_VIEW (gtk_tree_view_new_with_model (GTK_TREE_MODEL (priv->store)));
gtk_tree_view_set_headers_visible (priv->view, FALSE);
g_object_unref (self->priv->store);
@@ -448,7 +448,7 @@ bjb_note_tag_dialog_finalize (GObject *object)
BjbNoteTagDialog *self = BJB_NOTE_TAG_DIALOG (object);
BjbNoteTagDialogPrivate *priv = self->priv;
- g_hash_table_destroy (priv->collections);
+ g_hash_table_destroy (priv->notebooks);
/* no reason, it should have been freed earlier */
if (priv->tag_to_scroll_to)
diff --git a/src/libbiji/Makefile.am b/src/libbiji/Makefile.am
index e3618b3..ee99d6d 100644
--- a/src/libbiji/Makefile.am
+++ b/src/libbiji/Makefile.am
@@ -31,8 +31,6 @@ libbiji_la_built_sources = \
libbiji_la_SOURCES = \
$(libbiji_la_built_sources) \
libbiji.h \
- biji-collection.c \
- biji-collection.h \
biji-date-time.c \
biji-date-time.h \
biji-error.c \
@@ -45,6 +43,8 @@ libbiji_la_SOURCES = \
biji-local-note.h \
biji-manager.c \
biji-manager.h \
+ biji-notebook.c \
+ biji-notebook.h \
biji-note-id.c \
biji-note-id.h \
biji-note-obj.c \
diff --git a/src/libbiji/biji-item.c b/src/libbiji/biji-item.c
index 01da173..90a4cd4 100644
--- a/src/libbiji/biji-item.c
+++ b/src/libbiji/biji-item.c
@@ -193,17 +193,17 @@ biji_item_is_collectable (BijiItem *item)
}
gboolean
-biji_item_has_collection (BijiItem *item, gchar *coll)
+biji_item_has_notebook (BijiItem *item, gchar *coll)
{
- return BIJI_ITEM_GET_CLASS (item)->has_collection (item, coll);
+ return BIJI_ITEM_GET_CLASS (item)->has_notebook (item, coll);
}
-gboolean biji_item_add_collection (BijiItem *item, BijiItem *coll, gchar *title)
+gboolean biji_item_add_notebook (BijiItem *item, BijiItem *coll, gchar *title)
{
- return BIJI_ITEM_GET_CLASS (item)->add_collection (item, coll, title);
+ return BIJI_ITEM_GET_CLASS (item)->add_notebook (item, coll, title);
}
-gboolean biji_item_remove_collection (BijiItem *item, BijiItem *collection)
+gboolean biji_item_remove_notebook (BijiItem *item, BijiItem *collection)
{
- return BIJI_ITEM_GET_CLASS (item)->remove_collection (item, collection);
+ return BIJI_ITEM_GET_CLASS (item)->remove_notebook (item, collection);
}
diff --git a/src/libbiji/biji-item.h b/src/libbiji/biji-item.h
index c02c28a..c57d7ba 100644
--- a/src/libbiji/biji-item.h
+++ b/src/libbiji/biji-item.h
@@ -72,9 +72,9 @@ struct BijiItemClass_
gboolean (*trash) (BijiItem *item);
gboolean (*is_collectable) (BijiItem *item);
- gboolean (*has_collection) (BijiItem *item, gchar *coll);
- gboolean (*add_collection) (BijiItem *item, BijiItem *coll, gchar *title);
- gboolean (*remove_collection) (BijiItem *item, BijiItem *coll);
+ gboolean (*has_notebook) (BijiItem *item, gchar *coll);
+ gboolean (*add_notebook) (BijiItem *item, BijiItem *coll, gchar *title);
+ gboolean (*remove_notebook) (BijiItem *item, BijiItem *coll);
};
/* Do not create a generic items, it's rather an iface
@@ -85,7 +85,7 @@ GType biji_item_get_type (void);
/* - note uuid is a location (as in GFile)
- * - collection uuid is urn */
+ * - notebook uuid is urn */
const gchar * biji_item_get_title (BijiItem *item);
@@ -120,21 +120,21 @@ gboolean biji_item_trash (BijiItem *item);
gboolean biji_item_is_collectable (BijiItem *item);
-gboolean biji_item_has_collection (BijiItem *item, gchar *collection);
+gboolean biji_item_has_notebook (BijiItem *item, gchar *collection);
/* Add Collection:
- * either provide an existing collection object
+ * either provide an existing notebook object
* or a title, in which case it's considered not on user action
* and no notifiy happens */
-gboolean biji_item_add_collection (BijiItem *item, BijiItem *collection, gchar *title);
+gboolean biji_item_add_notebook (BijiItem *item, BijiItem *collection, gchar *title);
/* Remove Collection:
* always on user action. */
-gboolean biji_item_remove_collection (BijiItem *item, BijiItem *collection);
+gboolean biji_item_remove_notebook (BijiItem *item, BijiItem *collection);
G_END_DECLS
diff --git a/src/libbiji/biji-manager.c b/src/libbiji/biji-manager.c
index 26b921d..b3b3629 100644
--- a/src/libbiji/biji-manager.c
+++ b/src/libbiji/biji-manager.c
@@ -20,7 +20,7 @@
#include "libbiji.h"
#include "biji-local-note.h" // FIXME !!!! biji_provider_note_new ()
-#include "biji-collection.h"
+#include "biji-notebook.h"
#include "biji-error.h"
#include "provider/biji-import-provider.h"
@@ -318,7 +318,7 @@ _biji_manager_add_one_item (BijiManager *manager, BijiItem *item)
g_signal_connect (item, "color-changed", G_CALLBACK (manager_on_item_icon_changed_cb), manager);
}
- else if (BIJI_IS_COLLECTION (item))
+ else if (BIJI_IS_NOTEBOOK (item))
{
g_signal_connect (item, "deleted", G_CALLBACK (on_item_deleted_cb), manager);
g_signal_connect (item , "icon-changed", G_CALLBACK (manager_on_item_icon_changed_cb), manager);
@@ -550,7 +550,7 @@ biji_manager_add_item (BijiManager *manager, BijiItem *item, gboolean notify)
else if (BIJI_IS_NOTE_OBJ (item))
_biji_manager_add_one_item (manager, item);
- else if (BIJI_IS_COLLECTION (item))
+ else if (BIJI_IS_NOTEBOOK (item))
{
g_hash_table_insert (manager->priv->items,
(gpointer) biji_item_get_uuid (item),
diff --git a/src/libbiji/biji-manager.h b/src/libbiji/biji-manager.h
index 33982de..00be344 100644
--- a/src/libbiji/biji-manager.h
+++ b/src/libbiji/biji-manager.h
@@ -107,7 +107,7 @@ BijiItem *biji_manager_get_item_at_path (BijiManager *manager,
const gchar *path);
-/* Get all items, either notes or collections
+/* Get all items, either notes or notebooks
* Free the GList, not its content */
GList *biji_manager_get_items (BijiManager *manager);
diff --git a/src/libbiji/biji-note-obj.c b/src/libbiji/biji-note-obj.c
index d84add7..8c71625 100644
--- a/src/libbiji/biji-note-obj.c
+++ b/src/libbiji/biji-note-obj.c
@@ -453,7 +453,7 @@ biji_note_obj_set_raw_text (BijiNoteObj *note, gchar *plain_text)
}
GList *
-biji_note_obj_get_collections (BijiNoteObj *n)
+biji_note_obj_get_notebooks (BijiNoteObj *n)
{
g_return_val_if_fail (BIJI_IS_NOTE_OBJ (n), NULL);
@@ -461,7 +461,7 @@ biji_note_obj_get_collections (BijiNoteObj *n)
}
gboolean
-biji_note_obj_has_collection (BijiItem *item, gchar *label)
+biji_note_obj_has_notebook (BijiItem *item, gchar *label)
{
BijiNoteObj *note = BIJI_NOTE_OBJ (item);
@@ -473,19 +473,19 @@ biji_note_obj_has_collection (BijiItem *item, gchar *label)
static void
-_biji_collection_refresh (gboolean query_result,
+_biji_notebook_refresh (gboolean query_result,
gpointer coll)
{
- g_return_if_fail (BIJI_IS_COLLECTION (coll));
+ g_return_if_fail (BIJI_IS_NOTEBOOK (coll));
if (query_result)
- biji_collection_refresh (BIJI_COLLECTION (coll));
+ biji_notebook_refresh (BIJI_NOTEBOOK (coll));
}
/*static */ gboolean
-biji_note_obj_add_collection (BijiItem *item,
- BijiItem *collection,
+biji_note_obj_add_notebook (BijiItem *item,
+ BijiItem *notebook,
gchar *title)
{
BijiNoteObj *note;
@@ -494,18 +494,18 @@ biji_note_obj_add_collection (BijiItem *item,
g_return_val_if_fail (BIJI_IS_NOTE_OBJ (item), FALSE);
note = BIJI_NOTE_OBJ (item);
- if (BIJI_IS_COLLECTION (collection))
- label = (gchar*) biji_item_get_title (collection);
+ if (BIJI_IS_NOTEBOOK (notebook))
+ label = (gchar*) biji_item_get_title (notebook);
- if (biji_note_obj_has_collection (item, label))
+ if (biji_note_obj_has_notebook (item, label))
return FALSE;
g_hash_table_add (note->priv->labels, g_strdup (label));
- if (BIJI_IS_COLLECTION (collection))
+ if (BIJI_IS_NOTEBOOK (notebook))
{
- biji_push_existing_collection_to_note (
- note, label, _biji_collection_refresh, collection); // Tracker
+ 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);
@@ -516,17 +516,17 @@ biji_note_obj_add_collection (BijiItem *item,
gboolean
-biji_note_obj_remove_collection (BijiItem *item, BijiItem *collection)
+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_COLLECTION (collection), 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 (collection)))
+ if (g_hash_table_remove (note->priv->labels, biji_item_get_title (notebook)))
{
- biji_remove_collection_from_note (
- note, collection, _biji_collection_refresh, collection); // tracker.
+ 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);
@@ -1011,8 +1011,8 @@ biji_note_obj_class_init (BijiNoteObjClass *klass)
item_class->get_pristine = biji_note_obj_get_pristine;
item_class->get_mtime = biji_note_obj_get_mtime;
item_class->trash = biji_note_obj_trash;
- item_class->has_collection = biji_note_obj_has_collection;
- item_class->add_collection = biji_note_obj_add_collection;
- item_class->remove_collection = biji_note_obj_remove_collection;
+ item_class->has_notebook = biji_note_obj_has_notebook;
+ item_class->add_notebook = biji_note_obj_add_notebook;
+ item_class->remove_notebook = biji_note_obj_remove_notebook;
}
diff --git a/src/libbiji/biji-note-obj.h b/src/libbiji/biji-note-obj.h
index aa1d553..22f42db 100644
--- a/src/libbiji/biji-note-obj.h
+++ b/src/libbiji/biji-note-obj.h
@@ -117,7 +117,7 @@ gboolean biji_note_obj_get_rgba (BijiNoteObj *n,
void biji_note_obj_set_rgba (BijiNoteObj *n, GdkRGBA *rgba) ;
-GList *biji_note_obj_get_collections (BijiNoteObj *n);
+GList *biji_note_obj_get_notebooks (BijiNoteObj *n);
gboolean note_obj_is_template (BijiNoteObj *n) ;
diff --git a/src/libbiji/biji-collection.c b/src/libbiji/biji-notebook.c
similarity index 63%
rename from src/libbiji/biji-collection.c
rename to src/libbiji/biji-notebook.c
index 88688b9..a59aa59 100644
--- a/src/libbiji/biji-collection.c
+++ b/src/libbiji/biji-notebook.c
@@ -1,5 +1,5 @@
/*
- * biji-collection.c
+ * biji-notebook.c
*
* Copyright (C) Pierre-Yves LUYTEN 2013 <py luyten fr>
*
@@ -18,28 +18,28 @@
*/
/*
- * in current implementation, one cannot add a collection
- * to a collection
+ * in current implementation, one cannot add a notebook
+ * to a notebook
* but tracker would be fine with this
* given we prevent self-containment.
*/
/*
- * biji_create_collection_icon
- * is adapted from Photos (photos_utils_create_collection_icon),
+ * biji_create_notebook_icon
+ * is adapted from Photos (photos_utils_create_notebook_icon),
* which is ported from Documents
*/
#include <math.h>
-#include "biji-collection.h"
+#include "biji-notebook.h"
#include "biji-tracker.h"
-static void biji_collection_update_collected (GList *result, gpointer user_data);
+static void biji_notebook_update_collected (GList *result, gpointer user_data);
-struct BijiCollectionPrivate_
+struct BijiNotebookPrivate_
{
gchar *urn;
@@ -52,9 +52,9 @@ struct BijiCollectionPrivate_
GList *collected_items;
};
-static void biji_collection_finalize (GObject *object);
+static void biji_notebook_finalize (GObject *object);
-G_DEFINE_TYPE (BijiCollection, biji_collection, BIJI_TYPE_ITEM)
+G_DEFINE_TYPE (BijiNotebook, biji_notebook, BIJI_TYPE_ITEM)
/* Properties */
enum {
@@ -62,48 +62,48 @@ enum {
PROP_URN,
PROP_NAME,
PROP_MTIME,
- BIJI_COLL_PROPERTIES
+ BIJI_NOTEBOOK_PROPERTIES
};
/* Signals */
enum {
- COLLECTION_DELETED,
- COLLECTION_ICON_UPDATED,
- BIJI_COLLECTIONS_SIGNALS
+ NOTEBOOK_DELETED,
+ NOTEBOOK_ICON_UPDATED,
+ BIJI_NOTEBOOKS_SIGNALS
};
-static GParamSpec *properties[BIJI_COLL_PROPERTIES] = { NULL, };
+static GParamSpec *properties[BIJI_NOTEBOOK_PROPERTIES] = { NULL, };
-static guint biji_collections_signals [BIJI_COLLECTIONS_SIGNALS] = { 0 };
+static guint biji_notebooks_signals [BIJI_NOTEBOOKS_SIGNALS] = { 0 };
static const gchar *
-biji_collection_get_title (BijiItem *coll)
+biji_notebook_get_title (BijiItem *coll)
{
- BijiCollection *collection;
+ BijiNotebook *notebook;
- g_return_val_if_fail (BIJI_IS_COLLECTION (coll), NULL);
- collection = BIJI_COLLECTION (coll);
+ g_return_val_if_fail (BIJI_IS_NOTEBOOK (coll), NULL);
+ notebook = BIJI_NOTEBOOK (coll);
- return collection->priv->name;
+ return notebook->priv->name;
}
static const gchar *
-biji_collection_get_uuid (BijiItem *coll)
+biji_notebook_get_uuid (BijiItem *coll)
{
- BijiCollection *collection;
+ BijiNotebook *notebook;
- g_return_val_if_fail (BIJI_IS_COLLECTION (coll), NULL);
- collection = BIJI_COLLECTION (coll);
+ g_return_val_if_fail (BIJI_IS_NOTEBOOK (coll), NULL);
+ notebook = BIJI_NOTEBOOK (coll);
- return collection->priv->urn;
+ return notebook->priv->urn;
}
static GdkPixbuf *
-biji_create_collection_icon (gint base_size, GList *pixbufs)
+biji_create_notebook_icon (gint base_size, GList *pixbufs)
{
cairo_surface_t *surface;
cairo_t *cr;
@@ -191,7 +191,7 @@ biji_create_collection_icon (gint base_size, GList *pixbufs)
}
static GList *
-get_collected_pix (BijiCollection *self)
+get_collected_pix (BijiNotebook *self)
{
GList *result = NULL, *l;
@@ -207,15 +207,15 @@ get_collected_pix (BijiCollection *self)
}
static GdkPixbuf *
-biji_collection_get_icon (BijiItem *coll)
+biji_notebook_get_icon (BijiItem *coll)
{
- BijiCollection *self = BIJI_COLLECTION (coll);
+ BijiNotebook *self = BIJI_NOTEBOOK (coll);
GList *pix;
if (!self->priv->icon)
{
pix = get_collected_pix (self);
- self->priv->icon = biji_create_collection_icon (BIJI_ICON_WIDTH, pix);
+ self->priv->icon = biji_create_notebook_icon (BIJI_ICON_WIDTH, pix);
g_list_free (pix);
}
@@ -224,15 +224,15 @@ biji_collection_get_icon (BijiItem *coll)
static GdkPixbuf *
-biji_collection_get_emblem (BijiItem *coll)
+biji_notebook_get_emblem (BijiItem *coll)
{
- BijiCollection *self = BIJI_COLLECTION (coll);
+ BijiNotebook *self = BIJI_NOTEBOOK (coll);
GList *pix;
if (!self->priv->emblem)
{
pix = get_collected_pix (self);
- self->priv->emblem = biji_create_collection_icon (BIJI_EMBLEM_WIDTH,
+ self->priv->emblem = biji_create_notebook_icon (BIJI_EMBLEM_WIDTH,
get_collected_pix (self));
g_list_free (pix);
}
@@ -243,37 +243,37 @@ biji_collection_get_emblem (BijiItem *coll)
static gint64
-biji_collection_get_mtime (BijiItem *coll)
+biji_notebook_get_mtime (BijiItem *coll)
{
- BijiCollection *self;
+ BijiNotebook *self;
- g_return_val_if_fail (BIJI_IS_COLLECTION (coll), 0);
- self = BIJI_COLLECTION (coll);
+ g_return_val_if_fail (BIJI_IS_NOTEBOOK (coll), 0);
+ self = BIJI_NOTEBOOK (coll);
return self->priv->mtime;
}
-/* As of today, collections are only local
+/* As of today, notebooks are only local
* We'll need to override this */
static const gchar *
-biji_collection_get_place (BijiItem *coll)
+biji_notebook_get_place (BijiItem *coll)
{
return "Local";
}
static gboolean
-biji_collection_trash (BijiItem *item)
+biji_notebook_trash (BijiItem *item)
{
- BijiCollection *self;
- g_return_val_if_fail (BIJI_IS_COLLECTION (item), FALSE);
+ BijiNotebook *self;
+ g_return_val_if_fail (BIJI_IS_NOTEBOOK (item), FALSE);
- self = BIJI_COLLECTION (item);
+ self = BIJI_NOTEBOOK (item);
- g_signal_emit (G_OBJECT (item), biji_collections_signals[COLLECTION_DELETED], 0);
- biji_remove_collection_from_tracker (biji_item_get_manager (item), self->priv->urn);
+ g_signal_emit (G_OBJECT (item), biji_notebooks_signals[NOTEBOOK_DELETED], 0);
+ biji_remove_notebook_from_tracker (biji_item_get_manager (item), self->priv->urn);
g_object_unref (self);
return TRUE;
@@ -281,7 +281,7 @@ biji_collection_trash (BijiItem *item)
static gboolean
-biji_collection_has_collection (BijiItem *item, gchar *collection)
+biji_notebook_has_notebook (BijiItem *item, gchar *notebook)
{
//todo
return FALSE;
@@ -289,28 +289,28 @@ biji_collection_has_collection (BijiItem *item, gchar *collection)
static gboolean
-biji_collection_add_collection (BijiItem *item, BijiItem *coll, gchar *title)
+biji_notebook_add_notebook (BijiItem *item, BijiItem *coll, gchar *title)
{
- g_warning ("biji collection add collection is not implemented.");
+ g_warning ("biji notebook add notebook is not implemented.");
return FALSE;
}
static gboolean
-biji_collection_remove_collection (BijiItem *item, BijiItem *collection)
+biji_notebook_remove_notebook (BijiItem *item, BijiItem *notebook)
{
- g_warning ("biji collection remove collection is not implemented.");
+ g_warning ("biji notebook remove notebook is not implemented.");
return FALSE;
}
static void
-biji_collection_set_property (GObject *object,
+biji_notebook_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
- BijiCollection *self = BIJI_COLLECTION (object);
+ BijiNotebook *self = BIJI_NOTEBOOK (object);
switch (property_id)
@@ -332,12 +332,12 @@ biji_collection_set_property (GObject *object,
static void
-biji_collection_get_property (GObject *object,
+biji_notebook_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
- BijiCollection *self = BIJI_COLLECTION (object);
+ BijiNotebook *self = BIJI_NOTEBOOK (object);
switch (property_id)
{
@@ -358,9 +358,9 @@ biji_collection_get_property (GObject *object,
static void
-on_collected_item_change (BijiCollection *self)
+on_collected_item_change (BijiNotebook *self)
{
- BijiCollectionPrivate *priv = self->priv;
+ BijiNotebookPrivate *priv = self->priv;
BijiManager *manager;
GList *l;
@@ -373,20 +373,20 @@ on_collected_item_change (BijiCollection *self)
}
/* Then re-process the whole stuff */
- biji_get_items_with_collection_async (manager,
+ biji_get_items_with_notebook_async (manager,
self->priv->name,
- biji_collection_update_collected,
+ biji_notebook_update_collected,
self);
}
/* For convenience, items are retrieved async.
* Thus use a signal once icon & emblem updated.*/
static void
-biji_collection_update_collected (GList *result,
+biji_notebook_update_collected (GList *result,
gpointer user_data)
{
- BijiCollection *self = user_data;
- BijiCollectionPrivate *priv = self->priv;
+ BijiNotebook *self = user_data;
+ BijiNotebookPrivate *priv = self->priv;
GList *l;
g_clear_pointer (&priv->collected_items, g_list_free);
@@ -405,27 +405,27 @@ biji_collection_update_collected (GList *result,
G_CALLBACK (on_collected_item_change), self);
}
- g_signal_emit (self, biji_collections_signals[COLLECTION_ICON_UPDATED], 0);
+ g_signal_emit (self, biji_notebooks_signals[NOTEBOOK_ICON_UPDATED], 0);
}
void
-biji_collection_refresh (BijiCollection *collection)
+biji_notebook_refresh (BijiNotebook *notebook)
{
- on_collected_item_change (collection);
+ on_collected_item_change (notebook);
}
static void
-biji_collection_constructed (GObject *obj)
+biji_notebook_constructed (GObject *obj)
{
- BijiCollection *self = BIJI_COLLECTION (obj);
+ BijiNotebook *self = BIJI_NOTEBOOK (obj);
BijiManager *manager;
manager = biji_item_get_manager (BIJI_ITEM (obj));
- biji_get_items_with_collection_async (manager,
+ biji_get_items_with_notebook_async (manager,
self->priv->name,
- biji_collection_update_collected,
+ biji_notebook_update_collected,
self);
}
@@ -437,7 +437,7 @@ say_no (BijiItem *item)
static void
-biji_collection_class_init (BijiCollectionClass *klass)
+biji_notebook_class_init (BijiNotebookClass *klass)
{
GObjectClass *g_object_class;
BijiItemClass* item_class;
@@ -445,12 +445,12 @@ biji_collection_class_init (BijiCollectionClass *klass)
g_object_class = G_OBJECT_CLASS (klass);
item_class = BIJI_ITEM_CLASS (klass);
- g_object_class->constructed = biji_collection_constructed;
- g_object_class->finalize = biji_collection_finalize;
- g_object_class->set_property = biji_collection_set_property;
- g_object_class->get_property = biji_collection_get_property;
+ g_object_class->constructed = biji_notebook_constructed;
+ g_object_class->finalize = biji_notebook_finalize;
+ g_object_class->set_property = biji_notebook_set_property;
+ g_object_class->get_property = biji_notebook_get_property;
- g_type_class_add_private ((gpointer)klass, sizeof (BijiCollectionPrivate));
+ g_type_class_add_private ((gpointer)klass, sizeof (BijiNotebookPrivate));
properties[PROP_URN] =
@@ -474,9 +474,9 @@ biji_collection_class_init (BijiCollectionClass *klass)
G_MININT64, G_MAXINT64, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_properties (g_object_class, BIJI_COLL_PROPERTIES, properties);
+ g_object_class_install_properties (g_object_class, BIJI_NOTEBOOK_PROPERTIES, properties);
- biji_collections_signals[COLLECTION_ICON_UPDATED] =
+ biji_notebooks_signals[NOTEBOOK_ICON_UPDATED] =
g_signal_new ("icon-changed",
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST,
@@ -487,7 +487,7 @@ biji_collection_class_init (BijiCollectionClass *klass)
G_TYPE_NONE,
0);
- biji_collections_signals[COLLECTION_DELETED] =
+ biji_notebooks_signals[NOTEBOOK_DELETED] =
g_signal_new ("deleted" ,
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST,
@@ -499,40 +499,40 @@ biji_collection_class_init (BijiCollectionClass *klass)
0);
/* Interface */
- item_class->get_title = biji_collection_get_title;
- item_class->get_uuid = biji_collection_get_uuid;
- item_class->get_icon = biji_collection_get_icon;
- item_class->get_emblem = biji_collection_get_emblem;
- item_class->get_pristine = biji_collection_get_emblem;
- item_class->get_mtime = biji_collection_get_mtime;
- item_class->get_place = biji_collection_get_place;
+ item_class->get_title = biji_notebook_get_title;
+ item_class->get_uuid = biji_notebook_get_uuid;
+ item_class->get_icon = biji_notebook_get_icon;
+ item_class->get_emblem = biji_notebook_get_emblem;
+ item_class->get_pristine = biji_notebook_get_emblem;
+ item_class->get_mtime = biji_notebook_get_mtime;
+ item_class->get_place = biji_notebook_get_place;
item_class->has_color = say_no;
- item_class->trash = biji_collection_trash;
+ item_class->trash = biji_notebook_trash;
item_class->is_collectable = say_no;
- item_class->has_collection = biji_collection_has_collection;
- item_class->add_collection = biji_collection_add_collection;
- item_class->remove_collection = biji_collection_remove_collection;
+ item_class->has_notebook = biji_notebook_has_notebook;
+ item_class->add_notebook = biji_notebook_add_notebook;
+ item_class->remove_notebook = biji_notebook_remove_notebook;
}
static void
-biji_collection_finalize (GObject *object)
+biji_notebook_finalize (GObject *object)
{
- BijiCollection *self;
- g_return_if_fail (BIJI_IS_COLLECTION (object));
+ BijiNotebook *self;
+ g_return_if_fail (BIJI_IS_NOTEBOOK (object));
- self = BIJI_COLLECTION (object);
+ self = BIJI_NOTEBOOK (object);
g_free (self->priv->name);
g_free (self->priv->urn);
- G_OBJECT_CLASS (biji_collection_parent_class)->finalize (object);
+ G_OBJECT_CLASS (biji_notebook_parent_class)->finalize (object);
}
static void
-biji_collection_init (BijiCollection *self)
+biji_notebook_init (BijiNotebook *self)
{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, BIJI_TYPE_COLLECTION, BijiCollectionPrivate);
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, BIJI_TYPE_NOTEBOOK, BijiNotebookPrivate);
self->priv->mtime = 0;
@@ -543,10 +543,10 @@ biji_collection_init (BijiCollection *self)
}
-BijiCollection *
-biji_collection_new (GObject *manager, gchar *urn, gchar *name, gint64 mtime)
+BijiNotebook *
+biji_notebook_new (GObject *manager, gchar *urn, gchar *name, gint64 mtime)
{
- return g_object_new (BIJI_TYPE_COLLECTION,
+ return g_object_new (BIJI_TYPE_NOTEBOOK,
"manager", manager,
"name", name,
"urn", urn,
diff --git a/src/libbiji/biji-notebook.h b/src/libbiji/biji-notebook.h
new file mode 100644
index 0000000..613b0a6
--- /dev/null
+++ b/src/libbiji/biji-notebook.h
@@ -0,0 +1,66 @@
+/*
+ * biji-notebook.h
+ *
+ * Copyright (C) Pierre-Yves LUYTEN 2013 <py luyten fr>
+ *
+ * bijiben is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * bijiben is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef BIJI_NOTEBOOK_H_
+#define BIJI_NOTEBOOK_H_ 1
+
+#include "biji-item.h"
+
+G_BEGIN_DECLS
+
+
+#define BIJI_TYPE_NOTEBOOK (biji_notebook_get_type ())
+#define BIJI_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BIJI_TYPE_NOTEBOOK, BijiNotebook))
+#define BIJI_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BIJI_TYPE_NOTEBOOK,
BijiNotebookClass))
+#define BIJI_IS_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BIJI_TYPE_NOTEBOOK))
+#define BIJI_IS_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BIJI_TYPE_NOTEBOOK))
+#define BIJI_NOTEBOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BIJI_TYPE_NOTEBOOK,
BijiNotebookClass))
+
+typedef struct BijiNotebook_ BijiNotebook;
+typedef struct BijiNotebookClass_ BijiNotebookClass;
+typedef struct BijiNotebookPrivate_ BijiNotebookPrivate;
+
+struct BijiNotebook_
+{
+ BijiItem parent;
+
+ BijiNotebookPrivate *priv;
+};
+
+struct BijiNotebookClass_
+{
+ BijiItemClass parent_class;
+};
+
+
+GType biji_notebook_get_type (void);
+
+/* Exiting coll in tracker : provide urn & iso8601 date
+ * To create a brand new notebook in tracker rather gobjectize existing one,
+ * see biji_create_new_notebook_async */
+BijiNotebook * biji_notebook_new (GObject *manager, gchar *urn, gchar *name, gint64 mtime);
+
+
+/* Watching for tracker would be best. Right now manually called. */
+void biji_notebook_refresh (BijiNotebook *collection);
+
+G_END_DECLS
+
+#endif /* BIJI_NOTEBOOK_H_ */
diff --git a/src/libbiji/biji-tracker.c b/src/libbiji/biji-tracker.c
index 9a7b42a..ec2ce04 100644
--- a/src/libbiji/biji-tracker.c
+++ b/src/libbiji/biji-tracker.c
@@ -326,7 +326,7 @@ bjb_query_async (BijiManager *manager,
void
-biji_get_all_collections_async (BijiManager *manager,
+biji_get_all_notebooks_async (BijiManager *manager,
BijiInfoSetsHCallback cb,
gpointer user_data)
{
@@ -347,15 +347,15 @@ biji_get_all_collections_async (BijiManager *manager,
/* FIXME: returns file://$PATH while we want $PATH
* workaround in biji_query_items_list_finish */
void
-biji_get_items_with_collection_async (BijiManager *manager,
- const gchar *collection,
+biji_get_items_with_notebook_async (BijiManager *manager,
+ const gchar *notebook,
BijiItemsListCallback list_cb,
gpointer user_data)
{
gchar *query;
query = g_strdup_printf ("SELECT ?s WHERE {?c nie:isPartOf ?s; nie:title '%s'}",
- collection);
+ notebook);
bjb_query_async (manager, query, NULL, list_cb, user_data);
}
@@ -377,7 +377,7 @@ biji_get_items_matching_async (BijiManager *manager,
/* We want to retrieve the key that noteBook uses.
* for notes: that is url. A file path is unique.
- * for collections: we have no url, directly use urn:uuid */
+ * for notebooks: we have no url, directly use urn:uuid */
query = g_strconcat (
"SELECT tracker:coalesce (?url, ?urn) WHERE ",
@@ -405,7 +405,7 @@ biji_get_items_matching_async (BijiManager *manager,
static void
-on_new_collection_query_executed (GObject *source_object, GAsyncResult *res, gpointer user_data)
+on_new_notebook_query_executed (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
BijiTrackerFinisher *finisher = user_data;
TrackerSparqlConnection *connection = TRACKER_SPARQL_CONNECTION (source_object);
@@ -415,13 +415,13 @@ on_new_collection_query_executed (GObject *source_object, GAsyncResult *res, gpo
gchar *key = NULL;
gchar *val = NULL;
gchar *urn = NULL;
- BijiCollection *collection = NULL;
+ BijiNotebook *notebook = NULL;
error = NULL;
variant = tracker_sparql_connection_update_blank_finish (connection, res, &error);
if (error != NULL)
{
- g_warning ("Unable to create collection: %s", error->message);
+ g_warning ("Unable to create notebook: %s", error->message);
g_error_free (error);
goto out;
}
@@ -454,19 +454,19 @@ on_new_collection_query_executed (GObject *source_object, GAsyncResult *res, gpo
/* Update the note manager */
if (urn)
{
- collection = biji_collection_new (
+ notebook = biji_notebook_new (
G_OBJECT (finisher->manager),
urn,
finisher->str,
g_get_real_time () / G_USEC_PER_SEC);
- biji_manager_add_item (finisher->manager, BIJI_ITEM (collection), TRUE);
+ biji_manager_add_item (finisher->manager, BIJI_ITEM (notebook), TRUE);
}
/* Run the callback from the caller */
out:
if (finisher->item_cb != NULL)
- (*finisher->item_cb) (BIJI_ITEM (collection), finisher->user_data);
+ (*finisher->item_cb) (BIJI_ITEM (notebook), finisher->user_data);
g_free (val);
g_free (key);
@@ -474,11 +474,11 @@ on_new_collection_query_executed (GObject *source_object, GAsyncResult *res, gpo
}
-/* This func creates the collection,
+/* This func creates the notebook,
* gives the urn to the notemanager,
* then run the 'afterward' callback */
void
-biji_create_new_collection_async (BijiManager *manager,
+biji_create_new_notebook_async (BijiManager *manager,
const gchar *name,
BijiItemCallback item_cb,
gpointer user_data)
@@ -509,7 +509,7 @@ biji_create_new_collection_async (BijiManager *manager,
query,
G_PRIORITY_DEFAULT,
NULL,
- on_new_collection_query_executed,
+ on_new_notebook_query_executed,
finisher);
}
@@ -517,7 +517,7 @@ biji_create_new_collection_async (BijiManager *manager,
/* removes the tag EVEN if files associated. */
void
-biji_remove_collection_from_tracker (BijiManager *manager, const gchar *urn)
+biji_remove_notebook_from_tracker (BijiManager *manager, const gchar *urn)
{
gchar *query;
@@ -527,7 +527,7 @@ biji_remove_collection_from_tracker (BijiManager *manager, const gchar *urn)
void
-biji_push_existing_collection_to_note (BijiNoteObj *note,
+biji_push_existing_notebook_to_note (BijiNoteObj *note,
gchar *title,
BijiBoolCallback afterward,
gpointer user_data)
@@ -546,7 +546,7 @@ biji_push_existing_collection_to_note (BijiNoteObj *note,
void
-biji_remove_collection_from_note (BijiNoteObj *note,
+biji_remove_notebook_from_note (BijiNoteObj *note,
BijiItem *coll,
BijiBoolCallback afterward,
gpointer user_data)
diff --git a/src/libbiji/biji-tracker.h b/src/libbiji/biji-tracker.h
index 88557ec..2883d1c 100644
--- a/src/libbiji/biji-tracker.h
+++ b/src/libbiji/biji-tracker.h
@@ -48,7 +48,7 @@ typedef void (*BijiInfoCallback) (BijiInfoSet *info, gpointer use
-void biji_get_items_with_collection_async (BijiManager *manager,
+void biji_get_items_with_notebook_async (BijiManager *manager,
const gchar *needle,
BijiItemsListCallback cb,
gpointer user_data);
@@ -61,33 +61,33 @@ void biji_get_items_matching_async (BijiManager *manager,
-void biji_get_all_collections_async (BijiManager *manager,
+void biji_get_all_notebooks_async (BijiManager *manager,
BijiInfoSetsHCallback cb,
gpointer user_data);
-void biji_create_new_collection_async (BijiManager *manager,
+void biji_create_new_notebook_async (BijiManager *manager,
const gchar *tag,
BijiItemCallback afterward,
gpointer user_data);
-void biji_remove_collection_from_tracker (BijiManager *manager,
+void biji_remove_notebook_from_tracker (BijiManager *manager,
const gchar *urn);
-void biji_push_existing_collection_to_note (BijiNoteObj *note,
+void biji_push_existing_notebook_to_note (BijiNoteObj *note,
gchar *title,
BijiBoolCallback bool_cb,
gpointer user_data);
-void biji_remove_collection_from_note (BijiNoteObj *note,
+void biji_remove_notebook_from_note (BijiNoteObj *note,
BijiItem *coll,
BijiBoolCallback bool_cb,
gpointer user_data);
diff --git a/src/libbiji/deserializer/biji-lazy-deserializer.c
b/src/libbiji/deserializer/biji-lazy-deserializer.c
index ac277df..695118b 100644
--- a/src/libbiji/deserializer/biji-lazy-deserializer.c
+++ b/src/libbiji/deserializer/biji-lazy-deserializer.c
@@ -508,7 +508,7 @@ processNode (BijiLazyDeserializer *self)
{
norm = g_string_new (tag);
g_string_erase (norm,0,16);
- biji_item_add_collection (BIJI_ITEM (n), NULL, norm->str);
+ biji_item_add_notebook (BIJI_ITEM (n), NULL, norm->str);
g_string_free (norm, TRUE);
}
diff --git a/src/libbiji/deserializer/biji-tomboy-reader.c b/src/libbiji/deserializer/biji-tomboy-reader.c
index ed8cdf3..01ede3e 100644
--- a/src/libbiji/deserializer/biji-tomboy-reader.c
+++ b/src/libbiji/deserializer/biji-tomboy-reader.c
@@ -79,7 +79,7 @@ struct BijiTomboyReaderPrivate_
GError *error;
BijiInfoSet *set;
gint64 metadata_mtime;
- GQueue *collections;
+ GQueue *notebooks;
};
@@ -311,8 +311,8 @@ processNode (BijiTomboyReader *self)
{
norm = g_string_new (tag);
g_string_erase (norm,0,16);
- //biji_item_add_collection (BIJI_ITEM (n), NULL, norm->str);
- //g_queue_push_head (priv->collections, norm->str);
+ //biji_item_add_notebook (BIJI_ITEM (n), NULL, norm->str);
+ //g_queue_push_head (priv->notebooks, norm->str);
g_string_free (norm, TRUE);
}
@@ -513,7 +513,7 @@ biji_tomboy_reader_read (gchar *source,
GError **error,
BijiInfoSet **set,
gchar **html,
- GList **collections)
+ GList **notebooks)
{
BijiTomboyReader *self;
BijiTomboyReaderPrivate *priv;
diff --git a/src/libbiji/deserializer/biji-tomboy-reader.h b/src/libbiji/deserializer/biji-tomboy-reader.h
index 81b3cdb..384507b 100644
--- a/src/libbiji/deserializer/biji-tomboy-reader.h
+++ b/src/libbiji/deserializer/biji-tomboy-reader.h
@@ -56,7 +56,7 @@ gboolean biji_tomboy_reader_read (gchar *source,
GError **result,
BijiInfoSet **set,
gchar **html,
- GList **collections);
+ GList **notebooks);
G_END_DECLS
diff --git a/src/libbiji/libbiji.h b/src/libbiji/libbiji.h
index eb250ac..6826a75 100644
--- a/src/libbiji/libbiji.h
+++ b/src/libbiji/libbiji.h
@@ -21,11 +21,11 @@
#define _LIBBIJI_INSIDE_H
-#include "biji-collection.h"
#include "biji-date-time.h"
#include "biji-item.h"
#include "biji-marshalers.h"
#include "biji-manager.h"
+#include "biji-notebook.h"
#include "biji-note-obj.h"
#include "biji-string.h"
#include "biji-tracker.h"
diff --git a/src/libbiji/provider/biji-import-provider.c b/src/libbiji/provider/biji-import-provider.c
index f5578bc..f3b3c3a 100644
--- a/src/libbiji/provider/biji-import-provider.c
+++ b/src/libbiji/provider/biji-import-provider.c
@@ -20,7 +20,7 @@
/*
- * TODO : re-implement collections
+ * TODO : re-implement notebooks
* TODO : re-implement old imports preserving
*/
@@ -90,14 +90,14 @@ instanciate_note (BijiImportProvider *self, GFileInfo *info, GFile *container)
GError *error = NULL;
BijiInfoSet *set;
gchar *html = NULL;
- GList *collections = NULL;
+ GList *notebooks = NULL;
biji_tomboy_reader_read (path,
&error,
&set,
&html,
- &collections);
+ ¬ebooks);
if (error != NULL)
{
diff --git a/src/libbiji/provider/biji-local-provider.c b/src/libbiji/provider/biji-local-provider.c
index 8512674..82cf93b 100644
--- a/src/libbiji/provider/biji-local-provider.c
+++ b/src/libbiji/provider/biji-local-provider.c
@@ -31,7 +31,7 @@
/*
- * Items are both notes and collections
+ * Items are both notes and notebooks
*
*/
@@ -88,28 +88,28 @@ release_enum_cb (GObject *source, GAsyncResult *res, gpointer user_data)
static void
-create_collection_if_needed (gpointer key,
+create_notebook_if_needed (gpointer key,
gpointer value,
gpointer user_data)
{
BijiLocalProvider *self;
BijiInfoSet *set;
- BijiCollection *collection;
+ BijiNotebook *notebook;
BijiManager *manager;
self = user_data;
set = value;
- collection = g_hash_table_lookup (self->priv->items, key);
+ notebook = g_hash_table_lookup (self->priv->items, key);
manager = biji_provider_get_manager (BIJI_PROVIDER (self));
- if (!collection)
+ if (!notebook)
{
- collection = biji_collection_new (G_OBJECT (manager), key, set->title, set->mtime);
+ notebook = biji_notebook_new (G_OBJECT (manager), key, set->title, set->mtime);
g_hash_table_insert (self->priv->items,
g_strdup (key),
- collection);
+ notebook);
}
/* InfoSet are freed per g_hash_table_destroy thanks to below caller */
@@ -117,7 +117,7 @@ create_collection_if_needed (gpointer key,
static void
-local_provider_finish (GHashTable *collections,
+local_provider_finish (GHashTable *notebooks,
gpointer user_data)
{
BijiLocalProvider *self;
@@ -125,8 +125,8 @@ local_provider_finish (GHashTable *collections,
self = user_data;
- g_hash_table_foreach (collections, create_collection_if_needed, user_data);
- g_hash_table_destroy (collections);
+ g_hash_table_foreach (notebooks, create_notebook_if_needed, user_data);
+ g_hash_table_destroy (notebooks);
/* Now simply provide data to controller */
@@ -198,8 +198,8 @@ enumerate_next_files_ready_cb (GObject *source,
g_list_free_full (files, g_object_unref);
/* Now we have all notes,
- * load the collections and we're good to notify loading done */
- biji_get_all_collections_async (biji_provider_get_manager (BIJI_PROVIDER (self)),
+ * load the notebooks and we're good to notify loading done */
+ biji_get_all_notebooks_async (biji_provider_get_manager (BIJI_PROVIDER (self)),
local_provider_finish,
self);
}
diff --git a/src/libbiji/provider/biji-own-cloud-provider.c b/src/libbiji/provider/biji-own-cloud-provider.c
index 6688642..fbe262b 100644
--- a/src/libbiji/provider/biji-own-cloud-provider.c
+++ b/src/libbiji/provider/biji-own-cloud-provider.c
@@ -17,7 +17,7 @@
/*
- * ownCloud does not have collections
+ * ownCloud does not have notebooks
* neither colors
* nor formating (but markdown could be used or even translated upstream
* on web app
diff --git a/src/libbiji/provider/biji-provider.h b/src/libbiji/provider/biji-provider.h
index df51cca..ccf7125 100644
--- a/src/libbiji/provider/biji-provider.h
+++ b/src/libbiji/provider/biji-provider.h
@@ -112,7 +112,7 @@ struct BijiProviderClass_
GdkRGBA *color);
- /* TODO : (*create_collection). Add a flag into provider info? */
+ /* TODO : (*create_notebook). Add a flag into provider info? */
};
diff --git a/src/libbiji/serializer/biji-lazy-serializer.c b/src/libbiji/serializer/biji-lazy-serializer.c
index fe44621..bf9a7c1 100644
--- a/src/libbiji/serializer/biji-lazy-serializer.c
+++ b/src/libbiji/serializer/biji-lazy-serializer.c
@@ -249,7 +249,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_collections (priv->note);
+ tags = biji_note_obj_get_notebooks (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]