[evolution-kolab] EPlugin: avoid writing non-changes to store



commit aae2b6d384c24584b0ab2f24c76ef8dc57c6256f
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Mon Oct 15 16:34:33 2012 +0200

    EPlugin: avoid writing non-changes to store
    
    * added flags to metadata / acl uidata whether
      or not changes have been made
    * write to store only if changes are pending

 src/eplugin/e-kolab-folder-metadata.c    |    8 ++++++++
 src/eplugin/e-kolab-folder-metadata.h    |    1 +
 src/eplugin/e-kolab-folder-permissions.c |   11 ++++++++++-
 src/eplugin/e-kolab-folder-permissions.h |    1 +
 4 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/src/eplugin/e-kolab-folder-metadata.c b/src/eplugin/e-kolab-folder-metadata.c
index 835275b..b6e8733 100644
--- a/src/eplugin/e-kolab-folder-metadata.c
+++ b/src/eplugin/e-kolab-folder-metadata.c
@@ -151,8 +151,13 @@ e_kolab_folder_metadata_ui_new (void)
 	GtkWidget *btn = NULL;
 	gint ii = 0;
 
+	/* documenting initial settings */
 	uidata->shell_view = NULL;
 	uidata->alert_bar = NULL;
+	uidata->dialog = NULL;
+	uidata->foldername = NULL;
+	uidata->sourcename = NULL;
+	uidata->changed = FALSE;
 
 	uidata->widgets = g_new0 (KolabFolderMetaUIWidgets, 1);
 	uidata->metadata = kolab_data_folder_metadata_new ();
@@ -426,6 +431,9 @@ e_kolab_folder_metadata_ui_write_store (KolabFolderMetaUIData *uidata,
 	g_return_val_if_fail (E_IS_SHELL_VIEW (uidata->shell_view), FALSE);
 	g_return_val_if_fail (uidata->metadata != NULL, FALSE);
 
+	if (! uidata->changed)
+		return TRUE;
+
 	g_warning ("%s: FIXME implement me", __func__);
 	return TRUE;
 }
diff --git a/src/eplugin/e-kolab-folder-metadata.h b/src/eplugin/e-kolab-folder-metadata.h
index 80c5b93..583deab 100644
--- a/src/eplugin/e-kolab-folder-metadata.h
+++ b/src/eplugin/e-kolab-folder-metadata.h
@@ -69,6 +69,7 @@ struct _KolabFolderMetaUIData {
 	KolabDataFolderMetadata *metadata;
 	gchar *foldername;
 	gchar *sourcename;
+	gboolean changed;
 };
 
 /*----------------------------------------------------------------------------*/
diff --git a/src/eplugin/e-kolab-folder-permissions.c b/src/eplugin/e-kolab-folder-permissions.c
index 71d6db4..bd7ecd3 100644
--- a/src/eplugin/e-kolab-folder-permissions.c
+++ b/src/eplugin/e-kolab-folder-permissions.c
@@ -855,10 +855,16 @@ e_kolab_folder_permissions_ui_new (void)
 	GtkWidget *treeview = NULL;
 	gint row = 0;
 
-	uidata->permissions = kolab_data_folder_permissions_new ();
+	/* documenting initial settings */
 	uidata->shell_view = NULL;
 	uidata->alert_bar = NULL;
+	uidata->dialog = NULL;
+	uidata->foldername = NULL;
+	uidata->sourcename = NULL;
+	uidata->editing = FALSE;
+	uidata->changed = FALSE;
 
+	uidata->permissions = kolab_data_folder_permissions_new ();
 	uidata->widgets = g_new0 (KolabFolderPermUIWidgets, 1);
 
 	uidata->widgets->container = gtk_frame_new (C_("Kolab Folder Permissions",
@@ -1068,6 +1074,9 @@ e_kolab_folder_permissions_ui_write_store (KolabFolderPermUIData *uidata,
 	g_return_val_if_fail (E_IS_SHELL_VIEW (uidata->shell_view), FALSE);
 	g_return_val_if_fail (uidata->permissions != NULL, FALSE);
 
+	if (! uidata->changed)
+		return TRUE;
+
 	g_warning ("%s: FIXME implement me", __func__);
 	return TRUE;
 }
diff --git a/src/eplugin/e-kolab-folder-permissions.h b/src/eplugin/e-kolab-folder-permissions.h
index 3a47b0d..3af6c23 100644
--- a/src/eplugin/e-kolab-folder-permissions.h
+++ b/src/eplugin/e-kolab-folder-permissions.h
@@ -82,6 +82,7 @@ struct _KolabFolderPermUIData {
 	gchar *foldername;
 	gchar *sourcename;
 	gboolean editing;
+	gboolean changed;
 };
 
 /*----------------------------------------------------------------------------*/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]