[evolution-kolab] EPlugin: more folder properties dialog code reorganization



commit 432a23d3af5b3eb71a5743e6f383b11f1b4a028c
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Wed Aug 8 14:07:51 2012 +0200

    EPlugin: more folder properties dialog code reorganization

 src/eplugin/e-kolab-plugin-ui.c |   86 +++++++++++++++++++++++++++++---------
 1 files changed, 65 insertions(+), 21 deletions(-)
---
diff --git a/src/eplugin/e-kolab-plugin-ui.c b/src/eplugin/e-kolab-plugin-ui.c
index f0ff7f2..5caedd6 100644
--- a/src/eplugin/e-kolab-plugin-ui.c
+++ b/src/eplugin/e-kolab-plugin-ui.c
@@ -120,17 +120,6 @@ struct _KolabFolderPropUIData {
 	KolabDataImapAccount *account;
 };
 
-static void
-kolab_folder_prop_ui_widgets_enable (KolabFolderPropUIWidgets *widgets,
-                                     gboolean enabled)
-{
-	g_return_if_fail (widgets != NULL);
-	(void)enabled; /* FIXME */
-
-	/* FIXME implement me */
-	g_warning ("%s: FIXME implement me", __func__);
-}
-
 static KolabFolderPropUIData*
 kolab_folder_prop_ui_data_new ()
 {
@@ -183,6 +172,18 @@ kolab_folder_prop_ui_clear_all_entries (GObject *dialog)
 }
 
 static void
+kolab_folder_prop_ui_notebook_enable (KolabFolderPropUIData *uidata,
+                                     gboolean enable)
+{
+	g_return_if_fail (uidata != NULL);
+	g_return_if_fail (uidata->widgets != NULL);
+	g_return_if_fail (GTK_IS_NOTEBOOK (uidata->widgets->notebook));
+
+	gtk_widget_set_sensitive (uidata->widgets->notebook,
+	                          enable);
+}
+
+static void
 kolab_folder_prop_ui_response_cb (GObject *dialog,
                                   gint response_id)
 {
@@ -206,7 +207,7 @@ kolab_folder_prop_ui_response_cb (GObject *dialog,
 /* internal statics (UI) */
 
 static KolabFolderPropUIData*
-kolab_folder_prop_ui_new_dialog_data (EShellView *shell_view)
+kolab_folder_prop_ui_dialog_data_new (EShellView *shell_view)
 {
 	KolabFolderPropUIData *uidata = NULL;
 	gchar *foldername = NULL;
@@ -270,12 +271,15 @@ kolab_folder_prop_ui_new_dialog_data (EShellView *shell_view)
 }
 
 static void
-kolab_folder_prop_ui_assemble_dialog (KolabFolderPropUIData *uidata)
+kolab_folder_prop_ui_dialog_assemble (KolabFolderPropUIData *uidata)
 {
 	GtkWidget *content = NULL;
 	GtkNotebook *notebook = NULL;
 
 	g_return_if_fail (uidata != NULL);
+	g_return_if_fail (uidata->widgets != NULL);
+	g_return_if_fail (GTK_IS_DIALOG (uidata->widgets->dialog));
+	g_return_if_fail (E_IS_ALERT_BAR (uidata->widgets->alert_bar));
 
 	content = gtk_dialog_get_content_area (GTK_DIALOG (uidata->widgets->dialog));
 	gtk_container_add (GTK_CONTAINER (content), uidata->widgets->alert_bar);
@@ -308,39 +312,79 @@ kolab_folder_prop_ui_assemble_dialog (KolabFolderPropUIData *uidata)
 }
 
 static void
+kolab_folder_prop_ui_dialog_visible (KolabFolderPropUIData *uidata,
+                                     gboolean visible)
+{
+	g_return_if_fail (uidata != NULL);
+	g_return_if_fail (uidata->widgets != NULL);
+	g_return_if_fail (GTK_IS_DIALOG (uidata->widgets->dialog));
+
+	if (visible)
+		gtk_widget_show (uidata->widgets->dialog);
+	else
+		gtk_widget_hide (uidata->widgets->dialog);
+}
+
+static void
+kolab_folder_prop_ui_alertbar_visible (KolabFolderPropUIData *uidata,
+                                       gboolean visible)
+{
+	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 (visible)
+		gtk_widget_show (uidata->widgets->alert_bar);
+	else
+		gtk_widget_hide (uidata->widgets->alert_bar);
+}
+
+static void
 kolab_plugin_ui_action_kolab_properties_cb (GtkAction *action,
                                             EShellView *shell_view)
 {
 	KolabFolderPropUIData *uidata = NULL;
 	GObject *dialog = NULL;
+	GError *tmp_err = NULL;
+	gboolean ok = TRUE;
 
 	g_return_if_fail (action != NULL);
 	g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
 
 	/* create widgets and payload data structures */
-	uidata = kolab_folder_prop_ui_new_dialog_data (shell_view);
+	uidata = kolab_folder_prop_ui_dialog_data_new (shell_view);
 	g_return_if_fail (uidata != NULL);
 
 	/* assemble dialog */
-	kolab_folder_prop_ui_assemble_dialog (uidata);
+	kolab_folder_prop_ui_dialog_assemble (uidata);
 
 	/* connect response callback */
 	dialog = G_OBJECT (uidata->widgets->dialog);
 	g_signal_connect (dialog, "response", G_CALLBACK (kolab_folder_prop_ui_response_cb), NULL);
 	g_object_set_data_full (dialog, E_KOLAB_PROP_DLG_UIDATA, uidata, kolab_folder_prop_ui_data_destroy);
 
-	/* TODO connect signals */
+	kolab_folder_prop_ui_notebook_enable (uidata, FALSE);
 
 	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
-
-	kolab_folder_prop_ui_widgets_enable (uidata->widgets, FALSE);
-
 	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
 	                                   GTK_RESPONSE_OK,
 	                                   FALSE);
 
-	gtk_widget_hide (uidata->widgets->alert_bar);
-	gtk_widget_show (uidata->widgets->dialog);
+	kolab_folder_prop_ui_alertbar_visible (uidata, FALSE);
+	kolab_folder_prop_ui_dialog_visible (uidata, TRUE);
+
+	/* 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
+	 */
 }
 
 static void



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