[evolution-kolab/ek-wip-acl] EPlugin: stubbed in functions for metadata/acl querying, dialog update



commit 497f6a926af69ae81908744d50b4e5212eabd5df
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Wed Aug 8 15:40:33 2012 +0200

    EPlugin: stubbed in functions for metadata/acl querying, dialog update
    
    * before actually diong anything with the Kolab folder
      properties dialog, we'll need to query the current
      ACL and annotation data
    * having successfully queried that, we can update the
      dialog according to the query results and activate
      the notebook for use
    * if querying of ACL or annotation data fails, the
      notebook remains inactive and the GError as returned
      by Camel will be shown in the dialog's EAlertBar
      ("Cancel" will be the only action activated in this
      case)

 src/eplugin/e-kolab-plugin-ui.c |   93 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 86 insertions(+), 7 deletions(-)
---
diff --git a/src/eplugin/e-kolab-plugin-ui.c b/src/eplugin/e-kolab-plugin-ui.c
index 5caedd6..07a1023 100644
--- a/src/eplugin/e-kolab-plugin-ui.c
+++ b/src/eplugin/e-kolab-plugin-ui.c
@@ -114,6 +114,7 @@ struct _KolabFolderPropUIWidgets {
 
 typedef struct _KolabFolderPropUIData KolabFolderPropUIData;
 struct _KolabFolderPropUIData {
+	EShellView *shell_view;
 	KolabFolderPropUIWidgets *widgets;
 	KolabFolderMetaUIData *meta_ui_data;
 	KolabFolderPermUIData *perm_ui_data;
@@ -126,6 +127,7 @@ kolab_folder_prop_ui_data_new ()
 	KolabFolderPropUIData *uidata = NULL;
 
 	uidata = g_new0 (KolabFolderPropUIData, 1);
+	uidata->shell_view = NULL;
 	uidata->widgets = g_new0 (KolabFolderPropUIWidgets, 1);
 	uidata->meta_ui_data = NULL;
 	uidata->perm_ui_data = NULL;
@@ -140,6 +142,11 @@ kolab_folder_prop_ui_data_free (KolabFolderPropUIData *uidata)
 	if (uidata == NULL)
 		return;
 
+	/* FIXME do we need to ref/unref the shell view? */
+#if 0
+	g_object_unref (uidata->shell_view);
+#endif
+
 	/* the actual widgets will have been deleted already,
 	 * so just deleting the struct shell here
 	 */
@@ -173,7 +180,7 @@ kolab_folder_prop_ui_clear_all_entries (GObject *dialog)
 
 static void
 kolab_folder_prop_ui_notebook_enable (KolabFolderPropUIData *uidata,
-                                     gboolean enable)
+                                      gboolean enable)
 {
 	g_return_if_fail (uidata != NULL);
 	g_return_if_fail (uidata->widgets != NULL);
@@ -233,6 +240,7 @@ kolab_folder_prop_ui_dialog_data_new (EShellView *shell_view)
 	sourcename = e_kolab_plugin_util_ui_get_selected_sourcename (shell_view);
 
 	uidata = kolab_folder_prop_ui_data_new ();
+	uidata->shell_view = shell_view; /* FIXME ref the view? */
 	uidata->widgets->alert_bar = e_alert_bar_new ();
 	uidata->widgets->notebook = gtk_notebook_new ();
 
@@ -326,6 +334,16 @@ kolab_folder_prop_ui_dialog_visible (KolabFolderPropUIData *uidata,
 }
 
 static void
+kolab_folder_prop_ui_dialog_update_from_uidata (KolabFolderPropUIData *uidata)
+{
+	g_return_if_fail (uidata != NULL);
+	g_return_if_fail (uidata->widgets != NULL);
+	g_return_if_fail (GTK_IS_DIALOG (uidata->widgets->dialog));
+
+	g_warning ("%s: FIXME implement me", __func__);
+}
+
+static void
 kolab_folder_prop_ui_alertbar_visible (KolabFolderPropUIData *uidata,
                                        gboolean visible)
 {
@@ -340,6 +358,50 @@ kolab_folder_prop_ui_alertbar_visible (KolabFolderPropUIData *uidata,
 }
 
 static void
+kolab_folder_prop_ui_alertbar_show_error (KolabFolderPropUIData *uidata,
+                                          GError *err)
+{
+	g_return_if_fail (uidata != NULL);
+	g_return_if_fail (uidata->widgets != NULL);
+	g_return_if_fail (E_IS_ALERT_BAR (uidata->widgets->alert_bar));
+
+	if (err == NULL)
+		return;
+
+	g_warning ("%s: FIXME implement me", __func__);
+}
+
+static gboolean
+kolab_folder_prop_ui_query_metadata (KolabFolderPropUIData *uidata,
+                                     GCancellable *cancellable,
+                                     GError **err)
+{
+	g_return_val_if_fail (uidata != NULL, FALSE);
+	g_return_val_if_fail (E_IS_SHELL_VIEW (uidata->shell_view), FALSE);
+	g_return_val_if_fail (uidata->widgets != NULL, FALSE);
+	g_return_val_if_fail (E_IS_ALERT_BAR (uidata->widgets->alert_bar), FALSE);
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	g_warning ("%s: FIXME implement me", __func__);
+	return TRUE;
+}
+
+static gboolean
+kolab_folder_prop_ui_query_acl (KolabFolderPropUIData *uidata,
+                                GCancellable *cancellable,
+                                GError **err)
+{
+	g_return_val_if_fail (uidata != NULL, FALSE);
+	g_return_val_if_fail (E_IS_SHELL_VIEW (uidata->shell_view), FALSE);
+	g_return_val_if_fail (uidata->widgets != NULL, FALSE);
+	g_return_val_if_fail (E_IS_ALERT_BAR (uidata->widgets->alert_bar), FALSE);
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	g_warning ("%s: FIXME implement me", __func__);
+	return TRUE;
+}
+
+static void
 kolab_plugin_ui_action_kolab_properties_cb (GtkAction *action,
                                             EShellView *shell_view)
 {
@@ -375,16 +437,33 @@ kolab_plugin_ui_action_kolab_properties_cb (GtkAction *action,
 
 	/* TODO
 	 *
-	 * - get metadata setting for selected folder
-	 * - get ACL setting for selected folder
-	 * - if error, show in alert bar, allow Cancel only
-	 * - if ok, activate notebook and OK button
-	 *
-	 * more TODO
 	 * - add an EActivity bar and a cancellation stack
 	 *   so we can cancel getting the info as well as
 	 *   cancel setting the new options later on
+	 *
 	 */
+
+	ok = kolab_folder_prop_ui_query_metadata (uidata,
+	                                          NULL, /* add cancellation stack here */
+	                                          &tmp_err);
+	if (! ok)
+		goto exit;
+
+	ok = kolab_folder_prop_ui_query_acl (uidata,
+	                                     NULL, /* add cancellation stack here */
+	                                     &tmp_err);
+	if (! ok)
+		goto exit;
+
+	kolab_folder_prop_ui_dialog_update_from_uidata (uidata);
+	kolab_folder_prop_ui_notebook_enable (uidata, TRUE);
+
+ exit:
+	if (tmp_err != NULL) {
+		kolab_folder_prop_ui_alertbar_show_error (uidata,
+		                                          tmp_err);
+		g_error_free (tmp_err);
+	}
 }
 
 static void



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