[evolution-kolab] EPlugin: implemented Kolab folder type setting
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab] EPlugin: implemented Kolab folder type setting
- Date: Mon, 15 Oct 2012 18:19:06 +0000 (UTC)
commit 804d51cef54411823f6270681f19dca755655788
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Mon Oct 15 19:08:37 2012 +0200
EPlugin: implemented Kolab folder type setting
* implemented writing the Kolab folder type
annotation back onto the server, as selected
in the "Kolab Folder Properties..." dialog
src/eplugin/e-kolab-folder-metadata.c | 52 +++++++++++++++++++++++++++-----
1 files changed, 44 insertions(+), 8 deletions(-)
---
diff --git a/src/eplugin/e-kolab-folder-metadata.c b/src/eplugin/e-kolab-folder-metadata.c
index 89e11ad..dbbc1ed 100644
--- a/src/eplugin/e-kolab-folder-metadata.c
+++ b/src/eplugin/e-kolab-folder-metadata.c
@@ -100,8 +100,11 @@ kolab_folder_metadata_ui_foldertype_cb (GtkRadioButton *btn,
if (type != NULL)
foldertype = GPOINTER_TO_UINT (type);
- /* FIXME implement me */
- g_warning ("%s: folder type id: %i", __func__, foldertype);
+ if ((foldertype > KOLAB_FOLDER_TYPE_INVAL) &&
+ (foldertype < KOLAB_FOLDER_LAST_TYPE)) {
+ uidata->metadata->foldertype = foldertype;
+ uidata->changed = TRUE;
+ }
ok_btn = e_kolab_plugin_util_ui_dialog_ref_button (uidata->dialog,
GTK_STOCK_OK,
@@ -332,13 +335,13 @@ e_kolab_folder_metadata_ui_update_from_uidata (KolabFolderMetaUIData *uidata)
ii = 1;
break;
- case KOLAB_FOLDER_TYPE_TASK:
- case KOLAB_FOLDER_TYPE_TASK_DEFAULT:
+ case KOLAB_FOLDER_TYPE_NOTE:
+ case KOLAB_FOLDER_TYPE_NOTE_DEFAULT:
ii = 2;
break;
- case KOLAB_FOLDER_TYPE_NOTE:
- case KOLAB_FOLDER_TYPE_NOTE_DEFAULT:
+ case KOLAB_FOLDER_TYPE_TASK:
+ case KOLAB_FOLDER_TYPE_TASK_DEFAULT:
ii = 3;
break;
@@ -420,6 +423,11 @@ e_kolab_folder_metadata_ui_write_store (KolabFolderMetaUIData *uidata,
GCancellable *cancellable,
GError **err)
{
+ CamelKolabIMAPXStore *kstore = NULL;
+ gchar *selected_path = NULL;
+ GError *tmp_err = NULL;
+ gboolean ok = FALSE;
+
g_return_val_if_fail (uidata != NULL, FALSE);
/* cancellable may be NULL */
g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
@@ -430,8 +438,36 @@ e_kolab_folder_metadata_ui_write_store (KolabFolderMetaUIData *uidata,
if (! uidata->changed)
return TRUE;
- g_warning ("%s: FIXME implement me", __func__);
- return TRUE;
+ ok = e_kolab_plugin_util_ui_get_selected_store (uidata->shell_view,
+ &kstore,
+ &selected_path,
+ &tmp_err);
+ if (! ok)
+ goto exit;
+
+ if (g_strcmp0 (uidata->foldername, selected_path) != 0)
+ g_warning ("%s()[%u] foldername change: stored '%s' vs. current '%s'",
+ __func__, __LINE__, uidata->foldername, selected_path);
+
+ ok = camel_kolab_imapx_store_set_folder_type (kstore,
+ uidata->foldername,
+ uidata->metadata->foldertype,
+ cancellable,
+ &tmp_err);
+ exit:
+
+ if (tmp_err != NULL) {
+ g_propagate_error (err, tmp_err);
+ ok = FALSE;
+ }
+
+ if (kstore != NULL)
+ g_object_unref (kstore);
+
+ if (selected_path != NULL)
+ g_free (selected_path);
+
+ return ok;
}
/*----------------------------------------------------------------------------*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]