[bijiben] Vjournal: implemented "delete"
- From: Pierre-Yves Luyten <pyluyten src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bijiben] Vjournal: implemented "delete"
- Date: Sun, 27 Apr 2014 15:40:25 +0000 (UTC)
commit 850d31dbd42da7989dcbce5a54fe787df2901758
Author: Pierre-Yves Luyten <py luyten fr>
Date: Sun Apr 27 17:40:07 2014 +0200
Vjournal: implemented "delete"
src/libbiji/provider/biji-memo-note.c | 58 +++++++++++++++++++++++++++++----
1 files changed, 51 insertions(+), 7 deletions(-)
---
diff --git a/src/libbiji/provider/biji-memo-note.c b/src/libbiji/provider/biji-memo-note.c
index dac17b5..95f0f17 100644
--- a/src/libbiji/provider/biji-memo-note.c
+++ b/src/libbiji/provider/biji-memo-note.c
@@ -310,12 +310,42 @@ memo_set_html (BijiNoteObj *note, gchar *html)
+
+static void
+on_memo_deleted (GObject *ecal,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ GError *error = NULL;
+
+ e_cal_client_remove_object_finish (E_CAL_CLIENT (ecal),
+ res, &error);
+
+ if (error)
+ {
+ g_warning ("Could not delete memo:%s", error->message);
+ }
+}
+
+
static gboolean
memo_delete (BijiNoteObj *note)
{
- g_warning ("delete is not implemented yet");
+ BijiMemoNote *self;
+ const gchar *uid;
- return FALSE;
+ self = BIJI_MEMO_NOTE (note);
+ e_cal_component_get_uid (self->priv->ecal, &uid);
+ e_cal_client_remove_object (self->priv->client,
+ uid,
+ NULL, /* rid : all occurences */
+ E_CAL_OBJ_MOD_ALL, /* all occurences */
+ NULL, /* Cancellable */
+ on_memo_deleted,
+ self);
+
+
+ return TRUE;
}
@@ -328,6 +358,20 @@ memo_get_html (BijiNoteObj *note)
+static gchar *
+memo_get_basename (BijiNoteObj *note)
+{
+ const gchar *out;
+
+ e_cal_component_get_uid (
+ BIJI_MEMO_NOTE (note)->priv->ecal, &out);
+
+ return g_strdup (out);
+}
+
+
+
+
static const gchar *
memo_get_place (BijiItem *item)
{
@@ -377,7 +421,7 @@ biji_memo_note_class_init (BijiMemoNoteClass *klass)
item_class->has_color = item_no;
item_class->get_place = memo_get_place;
- note_class->get_basename = NULL;
+ note_class->get_basename = memo_get_basename;
note_class->get_html = memo_get_html;
note_class->set_html = memo_set_html;
note_class->save_note = memo_note_save;
@@ -419,10 +463,10 @@ biji_memo_note_new_from_info (BijiMemoProvider *provider,
id = biji_note_id_new_from_info (info);
ret = g_object_new (BIJI_TYPE_MEMO_NOTE,
- "manager", manager,
- "id", id,
- "ecal", component,
- NULL);
+ "manager", manager,
+ "id", id,
+ "ecal", component,
+ NULL);
ret->priv->id = id;
ret->priv->provider = BIJI_PROVIDER (provider);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]