[evolution-kolab] EPlugin: deactivate folder operations depending on context
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab] EPlugin: deactivate folder operations depending on context
- Date: Fri, 19 Oct 2012 18:27:28 +0000 (UTC)
commit 0b5f433f0c8ce771be922599cc6b48f312eaf3c2
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Fri Oct 19 19:17:47 2012 +0200
EPlugin: deactivate folder operations depending on context
* when in email view, deactivate sync strategy
setting
* when in PIM view, deactivate everything which
needs IMAP, but allow sync strategy setting
here (works on ESource, not on Camel)
src/eplugin/e-kolab-plugin-ui.c | 54 +++++++++++++++++++++++++++++++++++++++
1 files changed, 54 insertions(+), 0 deletions(-)
---
diff --git a/src/eplugin/e-kolab-plugin-ui.c b/src/eplugin/e-kolab-plugin-ui.c
index c4a84e9..b9e5bd4 100644
--- a/src/eplugin/e-kolab-plugin-ui.c
+++ b/src/eplugin/e-kolab-plugin-ui.c
@@ -37,6 +37,8 @@
#include <libevolution-utils/e-alert.h>
#include <misc/e-alert-bar.h>
+#include <libekolabutil/kolab-util-folder.h>
+
#include <libekolab/camel-kolab-imapx-store.h>
#include <libekolab/kolab-data-imap-account.h>
#include <libekolab/kolab-util-backend.h>
@@ -116,6 +118,7 @@ struct _KolabFolderPropUIWidgets {
typedef struct _KolabFolderPropUIData KolabFolderPropUIData;
struct _KolabFolderPropUIData {
EShellView *shell_view;
+ KolabFolderContextID shell_context;
KolabFolderPropUIWidgets *widgets;
KolabFolderMetaUIData *meta_ui_data;
KolabFolderPermUIData *perm_ui_data;
@@ -279,12 +282,16 @@ static KolabFolderPropUIData*
kolab_folder_prop_ui_dialog_data_new (EShellView *shell_view)
{
KolabFolderPropUIData *uidata = NULL;
+ KolabFolderContextID context = KOLAB_FOLDER_CONTEXT_INVAL;
gchar *foldername = NULL;
gchar *sourcename = NULL;
GError *tmp_err = NULL;
g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+ context = e_kolab_plugin_util_ui_get_shell_context (shell_view);
+ g_return_val_if_fail (context != KOLAB_FOLDER_CONTEXT_INVAL, NULL);
+
foldername = e_kolab_plugin_util_ui_get_selected_foldername (shell_view,
&tmp_err);
if (tmp_err != NULL) {
@@ -306,6 +313,7 @@ kolab_folder_prop_ui_dialog_data_new (EShellView *shell_view)
uidata = kolab_folder_prop_ui_data_new ();
uidata->shell_view = shell_view; /* FIXME ref the view? */
+ uidata->shell_context = context;
uidata->widgets->alert_bar = e_alert_bar_new ();
uidata->widgets->notebook = gtk_notebook_new ();
@@ -324,6 +332,7 @@ kolab_folder_prop_ui_dialog_data_new (EShellView *shell_view)
uidata->meta_ui_data = e_kolab_folder_metadata_ui_new ();
uidata->meta_ui_data->shell_view = shell_view;
+ uidata->meta_ui_data->shell_context = context;
uidata->meta_ui_data->alert_bar = E_ALERT_BAR (uidata->widgets->alert_bar);
uidata->meta_ui_data->dialog = GTK_DIALOG (uidata->widgets->dialog);
uidata->meta_ui_data->foldername = g_strdup (foldername);
@@ -331,6 +340,7 @@ kolab_folder_prop_ui_dialog_data_new (EShellView *shell_view)
uidata->perm_ui_data = e_kolab_folder_permissions_ui_new ();
uidata->perm_ui_data->shell_view = shell_view;
+ uidata->perm_ui_data->shell_context = context;
uidata->perm_ui_data->alert_bar = E_ALERT_BAR (uidata->widgets->alert_bar);
uidata->perm_ui_data->dialog = GTK_DIALOG (uidata->widgets->dialog);
uidata->perm_ui_data->foldername = g_strdup (foldername);
@@ -346,6 +356,49 @@ kolab_folder_prop_ui_dialog_data_new (EShellView *shell_view)
}
static void
+kolab_folder_prop_ui_dialog_update_sensitivity (KolabFolderPropUIData *uidata)
+{
+ GtkWidget *widget = 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 (GTK_IS_NOTEBOOK (uidata->widgets->notebook));
+ g_return_if_fail (uidata->meta_ui_data);
+ g_return_if_fail (uidata->meta_ui_data->widgets);
+ g_return_if_fail (uidata->perm_ui_data);
+ g_return_if_fail (uidata->perm_ui_data->widgets);
+
+ if (uidata->shell_context != KOLAB_FOLDER_CONTEXT_EMAIL)
+ goto skip_email;
+
+ /* in email view, we disable the PIM folder options */
+ widget = uidata->meta_ui_data->widgets->frame_options;
+ gtk_widget_set_sensitive (widget, FALSE);
+
+ skip_email:
+
+ if (! ((uidata->shell_context == KOLAB_FOLDER_CONTEXT_CALENDAR) ||
+ (uidata->shell_context == KOLAB_FOLDER_CONTEXT_CONTACT)))
+ goto skip_pim;
+
+ /* in PIM view, we disable all IMAP stuff (for which we
+ * need the CamelKolabIMAPXProvider, which is only available
+ * in email view)
+ */
+ widget = uidata->meta_ui_data->widgets->frame_type_select;
+ gtk_widget_set_sensitive (widget, FALSE);
+ widget = uidata->meta_ui_data->widgets->chk_btn_show_all;
+ gtk_widget_set_sensitive (widget, FALSE);
+ widget = uidata->perm_ui_data->widgets->container;
+ gtk_widget_set_sensitive (widget, FALSE);
+
+ skip_pim:
+
+ return;
+}
+
+static void
kolab_folder_prop_ui_dialog_assemble (KolabFolderPropUIData *uidata)
{
GtkWidget *content = NULL;
@@ -384,6 +437,7 @@ kolab_folder_prop_ui_dialog_assemble (KolabFolderPropUIData *uidata)
C_("Kolab Folder Properties",
"IMAP Access Control"));
gtk_widget_show_all (content);
+ kolab_folder_prop_ui_dialog_update_sensitivity (uidata);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]