[evolution-kolab/ek-wip-gui] EPlugin: rework of folder context menu
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/ek-wip-gui] EPlugin: rework of folder context menu
- Date: Sat, 18 Feb 2012 19:28:14 +0000 (UTC)
commit 1e3125392173a49bddb37eabf8e82ea8a98698f5
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Sat Feb 18 20:23:17 2012 +0100
EPlugin: rework of folder context menu
* reduced context menu entries to one
* organized metadata, permissions, ... settings
in a tabbed dialog window
* better encapsulated (and separated out) the
permissions UI elements and metadata UI elements
* added displaying of selected folder in dialog
src/eplugin/e-kolab-folder-metadata.c | 58 +++++-
src/eplugin/e-kolab-folder-metadata.h | 27 +++
src/eplugin/e-kolab-folder-permissions.c | 184 +++-------------
src/eplugin/e-kolab-folder-permissions.h | 37 +++-
src/eplugin/e-kolab-plugin-ui.c | 345 ++++++++++++++++++++---------
src/eplugin/org-gnome-kolab.eplug.xml | 15 +-
6 files changed, 391 insertions(+), 275 deletions(-)
---
diff --git a/src/eplugin/e-kolab-folder-metadata.c b/src/eplugin/e-kolab-folder-metadata.c
index cdddd28..019dc59 100644
--- a/src/eplugin/e-kolab-folder-metadata.c
+++ b/src/eplugin/e-kolab-folder-metadata.c
@@ -28,6 +28,8 @@
#include <config.h>
+#include <glib/gi18n-lib.h>
+
#include "e-kolab-folder-metadata.h"
/*----------------------------------------------------------------------------*/
@@ -41,9 +43,63 @@
/*----------------------------------------------------------------------------*/
/* API functions (non-UI) */
-
/*----------------------------------------------------------------------------*/
/* API functions (UI) */
+KolabFolderMetaUIData*
+e_kolab_folder_metadata_ui_new (void)
+{
+ KolabFolderMetaUIData *uidata = g_new0 (KolabFolderMetaUIData, 1);
+ GtkWidget *widget = NULL;
+ GtkWidget *hvbox = NULL;
+
+ uidata->widgets = g_new0 (KolabFolderMetaUIWidgets, 1);
+ uidata->widgets->container = gtk_frame_new (_("Folder Type"));
+
+ hvbox = gtk_grid_new ();
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (hvbox), GTK_ORIENTATION_VERTICAL);
+ gtk_grid_set_column_spacing (GTK_GRID (hvbox), 2);
+ gtk_container_add (GTK_CONTAINER (uidata->widgets->container), hvbox);
+
+ widget = gtk_radio_button_new_with_label (NULL, C_("Folder Type", "Mail"));
+ uidata->widgets->radio_btn_type_mail = widget;
+ uidata->widgets->radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
+ gtk_container_add (GTK_CONTAINER (hvbox), widget);
+
+ widget = gtk_radio_button_new_with_label (uidata->widgets->radio_group, C_("Folder Type", "Calendar"));
+ uidata->widgets->radio_btn_type_calendar = widget;
+ gtk_container_add (GTK_CONTAINER (hvbox), widget);
+
+ widget = gtk_radio_button_new_with_label (uidata->widgets->radio_group, C_("Folder Type", "Memos"));
+ uidata->widgets->radio_btn_type_memos = widget;
+ gtk_container_add (GTK_CONTAINER (hvbox), widget);
+
+ widget = gtk_radio_button_new_with_label (uidata->widgets->radio_group, C_("Folder Type", "Tasks"));
+ uidata->widgets->radio_btn_type_tasks = widget;
+ gtk_container_add (GTK_CONTAINER (hvbox), widget);
+
+ widget = gtk_radio_button_new_with_label (uidata->widgets->radio_group, C_("Folder Type", "Contacts"));
+ uidata->widgets->radio_btn_type_contacts = widget;
+ gtk_container_add (GTK_CONTAINER (hvbox), widget);
+
+ return uidata;
+}
+
+void
+e_kolab_folder_metadata_ui_free (KolabFolderMetaUIData *uidata)
+{
+ if (uidata == NULL)
+ return;
+
+ /* the actual widgets will have been deleted already,
+ * so just deleting the struct shell here
+ */
+ if (uidata->widgets != NULL)
+ g_free (uidata->widgets);
+
+ kolab_data_folder_metadata_free (uidata->metadata);
+
+ g_free (uidata);
+}
/*----------------------------------------------------------------------------*/
diff --git a/src/eplugin/e-kolab-folder-metadata.h b/src/eplugin/e-kolab-folder-metadata.h
index 958fd80..ee6426e 100644
--- a/src/eplugin/e-kolab-folder-metadata.h
+++ b/src/eplugin/e-kolab-folder-metadata.h
@@ -34,8 +34,35 @@
#include <glib.h>
#include <gtk/gtk.h>
+#include <libekolab/kolab-data-folder-metadata.h>
+
+/*----------------------------------------------------------------------------*/
+
+typedef struct _KolabFolderMetaUIWidgets KolabFolderMetaUIWidgets;
+struct _KolabFolderMetaUIWidgets {
+ GtkWidget *container;
+ /* sub-widgets of container */
+ GSList *radio_group;
+ GtkWidget *radio_btn_type_mail;
+ GtkWidget *radio_btn_type_calendar;
+ GtkWidget *radio_btn_type_memos;
+ GtkWidget *radio_btn_type_tasks;
+ GtkWidget *radio_btn_type_contacts;
+};
+
+typedef struct _KolabFolderMetaUIData KolabFolderMetaUIData;
+struct _KolabFolderMetaUIData {
+ KolabFolderMetaUIWidgets *widgets;
+ KolabDataFolderMetadata *metadata;
+};
+
/*----------------------------------------------------------------------------*/
+KolabFolderMetaUIData*
+e_kolab_folder_metadata_ui_new (void);
+
+void
+e_kolab_folder_metadata_ui_free (KolabFolderMetaUIData *uidata);
/*----------------------------------------------------------------------------*/
diff --git a/src/eplugin/e-kolab-folder-permissions.c b/src/eplugin/e-kolab-folder-permissions.c
index e2bd55c..9efa23d 100644
--- a/src/eplugin/e-kolab-folder-permissions.c
+++ b/src/eplugin/e-kolab-folder-permissions.c
@@ -33,38 +33,22 @@
#include <e-util/e-config.h>
#include <e-util/e-plugin.h>
-#include <libekolab/kolab-data-folder-permissions.h>
-#include <libekolab/kolab-data-imap-account.h>
-
-#include <libekolabutil/kolab-util-folder.h>
-
-#include "e-kolab-plugin-types.h"
#include "e-kolab-folder-permissions.h"
/*----------------------------------------------------------------------------*/
+/* internal statics (non-UI) */
-#define E_KOLAB_PERM_DLG_UIDATA "e-kolab-perm-dlg-uidata"
-
-typedef struct _KolabFolderPermUIWidgets KolabFolderPermUIWidgets;
-struct _KolabFolderPermUIWidgets {
- GtkWidget *dialog;
-};
-
-typedef struct _KolabFolderPermUIData KolabFolderPermUIData;
-struct _KolabFolderPermUIData {
- KolabFolderPermUIWidgets *widgets;
- KolabDataFolderPermissions *permissions;
- KolabDataImapAccount *account;
-};
+/*----------------------------------------------------------------------------*/
+/* internal statics (UI) */
/*----------------------------------------------------------------------------*/
-/* internal statics (non-UI) */
+/* API functions (non-UI) */
-static KolabDataFolderPermissions*
-kolab_folder_permissions_read_data_from_folder (const KolabDataImapAccount *account,
- const gchar *foldername,
- KolabFolderTypeID foldertype,
- GError **err)
+KolabDataFolderPermissions*
+e_kolab_folder_permissions_read_data_from_folder (const KolabDataImapAccount *account,
+ const gchar *foldername,
+ KolabFolderTypeID foldertype,
+ GError **err)
{
KolabDataFolderPermissions *data = NULL;
@@ -81,12 +65,12 @@ kolab_folder_permissions_read_data_from_folder (const KolabDataImapAccount *acco
return data;
}
-static gboolean
-kolab_folder_permissions_write_data_to_folder (const KolabDataImapAccount *account,
- const gchar *foldername,
- KolabFolderTypeID foldertype,
- const KolabDataFolderPermissions *data,
- GError **err)
+gboolean
+e_kolab_folder_permissions_write_data_to_folder (const KolabDataImapAccount *account,
+ const gchar *foldername,
+ KolabFolderTypeID foldertype,
+ const KolabDataFolderPermissions *data,
+ GError **err)
{
g_assert (account != NULL);
g_assert (foldername != NULL);
@@ -101,144 +85,34 @@ kolab_folder_permissions_write_data_to_folder (const KolabDataImapAccount *accou
}
/*----------------------------------------------------------------------------*/
-/* internal statics (UI) */
-
-static KolabFolderPermUIWidgets*
-kolab_folder_perm_ui_widgets_new (void)
-{
- return g_new0 (KolabFolderPermUIWidgets, 1);
-}
-
-static void
-kolab_folder_perm_ui_widgets_free (KolabFolderPermUIWidgets *widgets)
-{
- if (widgets == NULL)
- return;
-
- g_free (widgets);
-}
-
-static void
-kolab_folder_perm_ui_widgets_enable (KolabFolderPermUIWidgets *widgets,
- gboolean enabled)
-{
- g_return_if_fail (widgets != NULL);
-
- /* FIXME implement me */
- g_warning ("%s: FIXME implement me", __func__);
-}
+/* API functions (UI) */
-static KolabFolderPermUIData*
-kolab_folder_perm_ui_data_new ()
+KolabFolderPermUIData*
+e_kolab_folder_permissions_ui_new (void)
{
- KolabFolderPermUIData *uidata = NULL;
+ KolabFolderPermUIData *uidata = g_new0 (KolabFolderPermUIData, 1);
- uidata = g_new0 (KolabFolderPermUIData, 1);
- uidata->widgets = kolab_folder_perm_ui_widgets_new ();
- uidata->permissions = NULL;
- uidata->account = NULL;
+ uidata->widgets = g_new0 (KolabFolderPermUIWidgets, 1);
+ uidata->widgets->container = gtk_frame_new (_("Folder Permissions"));
return uidata;
}
-static void
-kolab_folder_perm_ui_data_free (KolabFolderPermUIData *uidata)
+void
+e_kolab_folder_permissions_ui_free (KolabFolderPermUIData *uidata)
{
if (uidata == NULL)
return;
- kolab_folder_perm_ui_widgets_free (uidata->widgets);
+ /* the actual widgets will have been deleted already,
+ * so just deleting the struct shell here
+ */
+ if (uidata->widgets != NULL)
+ g_free (uidata->widgets);
+
kolab_data_folder_permissions_free (uidata->permissions);
- kolab_data_imap_account_free (uidata->account);
g_free (uidata);
}
-static void
-kolab_folder_perm_ui_data_destroy (gpointer data)
-{
- if (data == NULL)
- return;
-
- kolab_folder_perm_ui_data_free ((KolabFolderPermUIData *)data);
-}
-
-static void
-kolab_folder_perm_ui_clear_all_entries (GObject *dialog)
-{
- g_return_if_fail (dialog != NULL);
-
- /* FIXME implement me */
- g_warning ("%s: FIXME implement me", __func__);
-}
-
-static void
-kolab_folder_perm_ui_response_cb (GObject *dialog,
- gint response_id)
-{
- g_return_if_fail (dialog != NULL);
-
- if (response_id != GTK_RESPONSE_OK) {
- kolab_folder_perm_ui_clear_all_entries (dialog);
- gtk_widget_destroy (GTK_WIDGET (dialog));
- return;
- }
-
- /* FIXME implement me */
- g_warning ("%s: FIXME implement me", __func__);
-}
-
-/*----------------------------------------------------------------------------*/
-/* API functions (non-UI) */
-
-
-/*----------------------------------------------------------------------------*/
-/* API functions (UI) */
-
-void
-e_kolab_folder_permissions_ui_dialog (GtkWindow *parent,
- const KolabDataImapAccount *account)
-{
- KolabFolderPermUIData *uidata = NULL;
- GObject *dialog = NULL;
- GtkWidget *content = NULL;
-
- if (parent != NULL)
- g_assert (GTK_IS_WINDOW (parent));
- g_assert (account != NULL);
-
- uidata = kolab_folder_perm_ui_data_new ();
-
- uidata->widgets->dialog = \
- gtk_dialog_new_with_buttons (_("Edit Kolab folder permissions..."),
- parent,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
-
- uidata->account = kolab_data_imap_account_clone (account);
-
- dialog = G_OBJECT (uidata->widgets->dialog);
- g_signal_connect (dialog, "response", G_CALLBACK (kolab_folder_perm_ui_response_cb), NULL);
- g_object_set_data_full (dialog, E_KOLAB_PERM_DLG_UIDATA, uidata, kolab_folder_perm_ui_data_destroy);
-
- content = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
-
- /* TODO set dialog content */
-
- /* TODO set signals */
-
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
-
- kolab_folder_perm_ui_widgets_enable (uidata->widgets, FALSE);
-
- gtk_dialog_set_response_sensitive (GTK_DIALOG (uidata->widgets->dialog),
- GTK_RESPONSE_OK,
- FALSE);
-
- gtk_widget_show_all (content);
- gtk_widget_show (GTK_WIDGET (dialog));
-}
-
/*----------------------------------------------------------------------------*/
diff --git a/src/eplugin/e-kolab-folder-permissions.h b/src/eplugin/e-kolab-folder-permissions.h
index 15cde4e..04d81f0 100644
--- a/src/eplugin/e-kolab-folder-permissions.h
+++ b/src/eplugin/e-kolab-folder-permissions.h
@@ -34,11 +34,44 @@
#include <glib.h>
#include <gtk/gtk.h>
+#include <libekolab/kolab-data-folder-permissions.h>
+#include <libekolab/kolab-data-imap-account.h>
+
+#include <libekolabutil/kolab-util-folder.h>
+
+/*----------------------------------------------------------------------------*/
+
+typedef struct _KolabFolderPermUIWidgets KolabFolderPermUIWidgets;
+struct _KolabFolderPermUIWidgets {
+ GtkWidget *container;
+ /* sub-widgets of container */
+};
+
+typedef struct _KolabFolderPermUIData KolabFolderPermUIData;
+struct _KolabFolderPermUIData {
+ KolabFolderPermUIWidgets *widgets;
+ KolabDataFolderPermissions *permissions;
+};
+
/*----------------------------------------------------------------------------*/
+KolabFolderPermUIData*
+e_kolab_folder_permissions_ui_new (void);
+
void
-e_kolab_folder_permissions_ui_dialog (GtkWindow *parent,
- const KolabDataImapAccount *account);
+e_kolab_folder_permissions_ui_free (KolabFolderPermUIData *uidata);
+
+KolabDataFolderPermissions*
+e_kolab_folder_permissions_read_data_from_folder (const KolabDataImapAccount *account,
+ const gchar *foldername,
+ KolabFolderTypeID foldertype,
+ GError **err);
+gboolean
+e_kolab_folder_permissions_write_data_to_folder (const KolabDataImapAccount *account,
+ const gchar *foldername,
+ KolabFolderTypeID foldertype,
+ const KolabDataFolderPermissions *data,
+ GError **err);
/*----------------------------------------------------------------------------*/
diff --git a/src/eplugin/e-kolab-plugin-ui.c b/src/eplugin/e-kolab-plugin-ui.c
index 54b3ec2..28b048e 100644
--- a/src/eplugin/e-kolab-plugin-ui.c
+++ b/src/eplugin/e-kolab-plugin-ui.c
@@ -46,6 +46,7 @@
#include <libekolab/kolab-data-imap-account.h>
#include <libekolabutil/kolab-util-camel.h>
+#include "e-kolab-folder-metadata.h"
#include "e-kolab-folder-permissions.h"
#include "e-kolab-plugin-ui.h"
@@ -53,95 +54,153 @@
/* how many menu entries are defined; all calendar/tasks/memos/contacts
actions should have same count */
-#define KOLAB_CONTEXT_NUM_ENTRIES 2
+#define KOLAB_CONTEXT_NUM_ENTRIES 1
-static void kolab_plugin_ui_action_folder_permissions_cb (GtkAction *action, EShellView *shell_view);
-static void kolab_plugin_ui_action_folder_metadata_cb (GtkAction *action, EShellView *shell_view);
+static void kolab_plugin_ui_action_kolab_properties_cb (GtkAction *action, EShellView *shell_view);
static GtkActionEntry mail_folder_context_entries[] = {
- { "kolab-mail-folder-permissions",
+ { "kolab-mail-folder-properties",
"folder-new",
- N_("Permissions..."),
+ N_("Kolab Folder Properties..."),
NULL,
- N_("Edit Kolab mail folder permissions"),
- G_CALLBACK (kolab_plugin_ui_action_folder_permissions_cb) },
-
- { "kolab-mail-folder-metadata",
- "folder-new",
- N_("Metadata..."),
- NULL,
- N_("Edit Kolab mail folder metadata"),
- G_CALLBACK (kolab_plugin_ui_action_folder_metadata_cb) }
+ N_("Edit Kolab mail folder properties"),
+ G_CALLBACK (kolab_plugin_ui_action_kolab_properties_cb) }
};
static GtkActionEntry calendar_context_entries[] = {
-
- { "kolab-calendar-folder-permissions",
+ { "kolab-calendar-folder-properties",
"folder-new",
- N_("Permissions..."),
+ N_("Kolab Folder Properties..."),
NULL,
- N_("Edit Kolab calendar permissions"),
- G_CALLBACK (kolab_plugin_ui_action_folder_permissions_cb) },
-
- { "kolab-calendar-folder-metadata",
- "folder-new",
- N_("Metadata..."),
- NULL,
- N_("Edit Kolab calendar metadata"),
- G_CALLBACK (kolab_plugin_ui_action_folder_metadata_cb) }
+ N_("Edit Kolab calendar folder properties"),
+ G_CALLBACK (kolab_plugin_ui_action_kolab_properties_cb) }
};
static GtkActionEntry memos_context_entries[] = {
-
- { "kolab-memos-folder-permissions",
+ { "kolab-memos-folder-properties",
"folder-new",
- N_("Permissions..."),
+ N_("Kolab Folder Properties..."),
NULL,
- N_("Edit Kolab memos permissions"),
- G_CALLBACK (kolab_plugin_ui_action_folder_permissions_cb) },
-
- { "kolab-memos-folder-metadata",
- "folder-new",
- N_("Metadata..."),
- NULL,
- N_("Edit Kolab memos metadata"),
- G_CALLBACK (kolab_plugin_ui_action_folder_metadata_cb) }
+ N_("Edit Kolab memos folder properties"),
+ G_CALLBACK (kolab_plugin_ui_action_kolab_properties_cb) }
};
static GtkActionEntry tasks_context_entries[] = {
-
- { "kolab-tasks-folder-permissions",
+ { "kolab-tasks-folder-properties",
"folder-new",
- N_("Permissions..."),
+ N_("Kolab Folder Properties..."),
NULL,
- N_("Edit Kolab tasks permissions"),
- G_CALLBACK (kolab_plugin_ui_action_folder_permissions_cb) },
+ N_("Edit Kolab Tasks folder properties"),
+ G_CALLBACK (kolab_plugin_ui_action_kolab_properties_cb) }
+};
- { "kolab-tasks-folder-metadata",
+static GtkActionEntry contacts_context_entries[] = {
+ { "kolab-contacts-folder-properties",
"folder-new",
- N_("Metadata..."),
+ N_("Kolab Folder Properties..."),
NULL,
- N_("Edit Kolab tasks metadata"),
- G_CALLBACK (kolab_plugin_ui_action_folder_metadata_cb) }
+ N_("Edit Kolab contacts folder properties"),
+ G_CALLBACK (kolab_plugin_ui_action_kolab_properties_cb) }
};
-static GtkActionEntry contacts_context_entries[] = {
+/*----------------------------------------------------------------------------*/
+/* UI data structures */
- { "kolab-contacts-folder-permissions",
- "folder-new",
- N_("Permissions..."),
- NULL,
- N_("Edit Kolab contacts permissions"),
- G_CALLBACK (kolab_plugin_ui_action_folder_permissions_cb) },
+#define E_KOLAB_PROP_DLG_UIDATA "e-kolab-prop-dlg-uidata"
- { "kolab-contacts-folder-metadata",
- "folder-new",
- N_("Metadata..."),
- NULL,
- N_("Edit Kolab contacts metadata"),
- G_CALLBACK (kolab_plugin_ui_action_folder_metadata_cb) }
+typedef struct _KolabFolderPropUIWidgets KolabFolderPropUIWidgets;
+struct _KolabFolderPropUIWidgets {
+ GtkWidget *dialog;
+ /* sub-widgets of dialog */
+ GtkWidget *selected_folder;
+ GtkWidget *notebook;
+};
+
+typedef struct _KolabFolderPropUIData KolabFolderPropUIData;
+struct _KolabFolderPropUIData {
+ KolabFolderPropUIWidgets *widgets;
+ KolabFolderMetaUIData *meta_ui_data;
+ KolabFolderPermUIData *perm_ui_data;
+ KolabDataImapAccount *account;
};
+static void
+kolab_folder_prop_ui_widgets_enable (KolabFolderPropUIWidgets *widgets,
+ gboolean enabled)
+{
+ g_return_if_fail (widgets != NULL);
+
+ /* FIXME implement me */
+ g_warning ("%s: FIXME implement me", __func__);
+}
+
+static KolabFolderPropUIData*
+kolab_folder_prop_ui_data_new ()
+{
+ KolabFolderPropUIData *uidata = NULL;
+
+ uidata = g_new0 (KolabFolderPropUIData, 1);
+ uidata->widgets = g_new0 (KolabFolderPropUIWidgets, 1);
+ uidata->meta_ui_data = NULL;
+ uidata->perm_ui_data = NULL;
+ uidata->account = NULL;
+
+ return uidata;
+}
+
+static void
+kolab_folder_prop_ui_data_free (KolabFolderPropUIData *uidata)
+{
+ if (uidata == NULL)
+ return;
+
+ /* the actual widgets will have been deleted already,
+ * so just deleting the struct shell here
+ */
+ if (uidata->widgets != NULL)
+ g_free (uidata->widgets);
+
+ e_kolab_folder_metadata_ui_free (uidata->meta_ui_data);
+ e_kolab_folder_permissions_ui_free (uidata->perm_ui_data);
+ kolab_data_imap_account_free (uidata->account);
+
+ g_free (uidata);
+}
+
+static void
+kolab_folder_prop_ui_data_destroy (gpointer data)
+{
+ if (data == NULL)
+ return;
+
+ kolab_folder_prop_ui_data_free ((KolabFolderPropUIData *)data);
+}
+
+static void
+kolab_folder_prop_ui_clear_all_entries (GObject *dialog)
+{
+ g_return_if_fail (dialog != NULL);
+
+ /* FIXME implement me */
+ g_warning ("%s: FIXME implement me", __func__);
+}
+
+static void
+kolab_folder_prop_ui_response_cb (GObject *dialog,
+ gint response_id)
+{
+ g_return_if_fail (dialog != NULL);
+
+ if (response_id != GTK_RESPONSE_OK) {
+ kolab_folder_prop_ui_clear_all_entries (dialog);
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ return;
+ }
+
+ /* FIXME implement me */
+ g_warning ("%s: FIXME implement me", __func__);
+}
+
/*----------------------------------------------------------------------------*/
/* internal statics (non-UI) */
@@ -149,32 +208,136 @@ static GtkActionEntry contacts_context_entries[] = {
/*----------------------------------------------------------------------------*/
/* internal statics (UI) */
-static void
-kolab_plugin_ui_action_folder_permissions_cb (GtkAction *action,
- EShellView *shell_view)
+static gchar*
+kolab_plugin_ui_get_selected_path (EShellView *shell_view,
+ gboolean *is_kolab_account_node,
+ gboolean *is_kolab_folder_node)
{
- KolabDataImapAccount *account = NULL;
+ EShellSidebar *shell_sidebar = NULL;
+ EMFolderTree *folder_tree = NULL;
+ CamelStore *selected_store = NULL;
+ gchar *selected_path = NULL;
- g_assert (action != NULL);
g_assert (E_IS_SHELL_VIEW (shell_view));
- /* FIXME implement me */
- g_warning ("%s: FIXME implement me", __func__);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL);
+ if (em_folder_tree_get_selected (folder_tree, &selected_store, &selected_path) ||
+ em_folder_tree_store_root_selected (folder_tree, &selected_store)) {
+ if (selected_store) {
+ CamelProvider *provider = camel_service_get_provider (CAMEL_SERVICE (selected_store));
+
+ if (provider && g_ascii_strcasecmp (provider->protocol, KOLAB_CAMEL_PROVIDER_PROTOCOL) == 0) {
+ *is_kolab_account_node = !selected_path || !*selected_path;
+ *is_kolab_folder_node = !*is_kolab_account_node;
+ }
- account = kolab_data_imap_account_new ();
- e_kolab_folder_permissions_ui_dialog (NULL, account);
- kolab_data_imap_account_free (account);
+ g_object_unref (selected_store);
+ }
+ }
+ g_object_unref (folder_tree);
+
+ return selected_path;
}
-static void
-kolab_plugin_ui_action_folder_metadata_cb (GtkAction *action,
- EShellView *shell_view)
+GtkWidget*
+kolab_plugin_ui_selected_folder_widget (GtkAction *action,
+ EShellView *shell_view)
{
+ GtkWidget *label = NULL;
+ gchar *labeltext = NULL;
+ gchar *foldername = NULL;
+ gboolean is_kolab_account_node = FALSE;
+ gboolean is_kolab_folder_node = FALSE;
+
g_assert (action != NULL);
g_assert (E_IS_SHELL_VIEW (shell_view));
- /* FIXME implement me */
- g_warning ("%s: FIXME implement me", __func__);
+ foldername = kolab_plugin_ui_get_selected_path (shell_view,
+ &is_kolab_account_node,
+ &is_kolab_folder_node);
+ g_assert (!is_kolab_account_node);
+ g_assert (is_kolab_folder_node);
+
+ label = gtk_label_new (NULL);
+ labeltext = g_strconcat ("<b>", _("Selected Folder"), ": </b>", foldername, NULL);
+ g_free (foldername);
+ gtk_label_set_markup (GTK_LABEL (label), labeltext);
+ g_free (labeltext);
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
+
+ return label;
+}
+
+static void
+kolab_plugin_ui_action_kolab_properties_cb (GtkAction *action,
+ EShellView *shell_view)
+{
+ KolabFolderPropUIData *uidata = NULL;
+ GObject *dialog = NULL;
+ GtkWidget *content = NULL;
+ GtkNotebook *notebook = NULL;
+
+ uidata = kolab_folder_prop_ui_data_new ();
+
+ uidata->widgets->dialog = \
+ gtk_dialog_new_with_buttons (_("Edit Kolab folder properties..."),
+ NULL, /* parent */
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ NULL);
+
+ uidata->widgets->selected_folder = \
+ kolab_plugin_ui_selected_folder_widget (action, shell_view);
+
+ uidata->meta_ui_data = e_kolab_folder_metadata_ui_new ();
+ uidata->perm_ui_data = e_kolab_folder_permissions_ui_new ();
+ /* FIXME get account data here */
+ uidata->account = kolab_data_imap_account_new ();
+
+ 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);
+
+ content = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_container_add (GTK_CONTAINER (content), uidata->widgets->selected_folder);
+ uidata->widgets->notebook = gtk_notebook_new ();
+ notebook = GTK_NOTEBOOK (uidata->widgets->notebook);
+ gtk_notebook_set_show_border (notebook, TRUE);
+ gtk_container_add (GTK_CONTAINER (content),
+ uidata->widgets->notebook);
+
+ /* set notebook content */
+
+ /* folder metadata notebook page */
+ gtk_notebook_append_page (notebook,
+ uidata->meta_ui_data->widgets->container,
+ NULL);
+ gtk_notebook_set_tab_label_text (notebook,
+ uidata->meta_ui_data->widgets->container,
+ _("Metadata"));
+
+ /* folder permissions notebook page */
+ gtk_notebook_append_page (notebook,
+ uidata->perm_ui_data->widgets->container,
+ NULL);
+ gtk_notebook_set_tab_label_text (notebook,
+ uidata->perm_ui_data->widgets->container,
+ _("Access Control"));
+
+ /* TODO connect signals */
+
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+
+ kolab_folder_prop_ui_widgets_enable (uidata->widgets, FALSE);
+
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+ GTK_RESPONSE_OK,
+ FALSE);
+
+ gtk_widget_show_all (content);
+ gtk_widget_show (uidata->widgets->dialog);
}
static gboolean
@@ -239,38 +402,6 @@ kolab_plugin_ui_enable_actions (GtkActionGroup *action_group,
}
}
-static gchar*
-kolab_plugin_ui_get_selected_path (EShellView *shell_view,
- gboolean *is_kolab_account_node,
- gboolean *is_kolab_folder_node)
-{
- EShellSidebar *shell_sidebar = NULL;
- EMFolderTree *folder_tree = NULL;
- CamelStore *selected_store = NULL;
- gchar *selected_path = NULL;
-
- g_assert (E_IS_SHELL_VIEW (shell_view));
-
- shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
- g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL);
- if (em_folder_tree_get_selected (folder_tree, &selected_store, &selected_path) ||
- em_folder_tree_store_root_selected (folder_tree, &selected_store)) {
- if (selected_store) {
- CamelProvider *provider = camel_service_get_provider (CAMEL_SERVICE (selected_store));
-
- if (provider && g_ascii_strcasecmp (provider->protocol, KOLAB_CAMEL_PROVIDER_PROTOCOL) == 0) {
- *is_kolab_account_node = !selected_path || !*selected_path;
- *is_kolab_folder_node = !*is_kolab_account_node;
- }
-
- g_object_unref (selected_store);
- }
- }
- g_object_unref (folder_tree);
-
- return selected_path;
-}
-
static void
kolab_plugin_ui_update_mail_entries_cb (EShellView *shell_view,
GtkActionEntry *entries)
diff --git a/src/eplugin/org-gnome-kolab.eplug.xml b/src/eplugin/org-gnome-kolab.eplug.xml
index 358ff46..d27fffd 100644
--- a/src/eplugin/org-gnome-kolab.eplug.xml
+++ b/src/eplugin/org-gnome-kolab.eplug.xml
@@ -43,40 +43,35 @@
<ui-manager id="org.gnome.evolution.mail" callback="e_kolab_plugin_init_mail">
<popup name="mail-folder-popup">
<placeholder name="mail-folder-popup-actions">
- <menuitem action="kolab-mail-folder-permissions" />
- <menuitem action="kolab-mail-folder-metadata" />
+ <menuitem action="kolab-mail-folder-properties" />
</placeholder>
</popup>
</ui-manager>
<ui-manager id="org.gnome.evolution.calendars" callback="e_kolab_plugin_init_calendar">
<popup name="calendar-popup">
<placeholder name="calendar-popup-actions">
- <menuitem action="kolab-calendar-folder-permissions" />
- <menuitem action="kolab-calendar-folder-metadata" />
+ <menuitem action="kolab-calendar-folder-properties" />
</placeholder>
</popup>
</ui-manager>
<ui-manager id="org.gnome.evolution.tasks" callback="e_kolab_plugin_init_tasks">
<popup name="task-list-popup">
<placeholder name="task-list-popup-actions">
- <menuitem action="kolab-tasks-folder-permissions" />
- <menuitem action="kolab-tasks-folder-metadata" />
+ <menuitem action="kolab-tasks-folder-properties" />
</placeholder>
</popup>
</ui-manager>
<ui-manager id="org.gnome.evolution.memos" callback="e_kolab_plugin_init_memos">
<popup name="memo-list-popup">
<placeholder name="memo-list-popup-actions">
- <menuitem action="kolab-memo-folder-permissions" />
- <menuitem action="kolab-memo-folder-metadata" />
+ <menuitem action="kolab-memo-folder-properties" />
</placeholder>
</popup>
</ui-manager>
<ui-manager id="org.gnome.evolution.contacts" callback="e_kolab_plugin_init_contacts">
<popup name="address-book-popup">
<placeholder name="address-book-popup-actions">
- <menuitem action="kolab-contacts-folder-permissions" />
- <menuitem action="kolab-contacts-folder-metadata" />
+ <menuitem action="kolab-contacts-folder-properties" />
</placeholder>
</popup>
</ui-manager>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]