From c1fa3c9668c19b6cb7ea45ff21f6e612e51b4c3c Mon Sep 17 00:00:00 2001 From: Shakti Sen Date: Mon, 18 Jul 2005 11:57:37 +0000 Subject: Added the functions org_gnome_exchange_calendar_permissions() and 2005-07-15 Shakti Sen * exchange-folder-permission.c: Added the functions org_gnome_exchange_calendar_permissions() and org_gnome_exchange_addressbook_permissions() to support 'Folder Permissions' for 'Calendar', 'Tasks' and 'Contacts' components. Also taken care of a bug #310493. * org-gnome-exchange-operations.eplug.in: Added the class hooks. Fixes bug#310479. Fixes bug#310493 as well. svn path=/trunk/; revision=29791 --- plugins/exchange-operations/ChangeLog | 12 +++ .../exchange-folder-permission.c | 113 +++++++++++++++++++-- .../exchange-permissions-dialog.c | 3 +- .../org-gnome-exchange-operations.eplug.in | 12 +++ 4 files changed, 127 insertions(+), 13 deletions(-) (limited to 'plugins/exchange-operations') diff --git a/plugins/exchange-operations/ChangeLog b/plugins/exchange-operations/ChangeLog index 83a3a65cb4..a9cd120d4b 100644 --- a/plugins/exchange-operations/ChangeLog +++ b/plugins/exchange-operations/ChangeLog @@ -1,3 +1,15 @@ +2005-07-15 Shakti Sen + + * exchange-folder-permission.c: Added the functions + org_gnome_exchange_calendar_permissions() and + org_gnome_exchange_addressbook_permissions() to support + 'Folder Permissions' for 'Calendar', 'Tasks' and 'Contacts' components. + Also taken care of a bug #310493. + * org-gnome-exchange-operations.eplug.in: Added the class hooks. + + Fixes bug#310479. + Fixes bug#310493 as well. + 2005-07-18 Praveen Kumar * exchange-account-setup.c (btn_chpass_clicked) : Handle the case diff --git a/plugins/exchange-operations/exchange-folder-permission.c b/plugins/exchange-operations/exchange-folder-permission.c index 885eb11493..e7aef33877 100644 --- a/plugins/exchange-operations/exchange-folder-permission.c +++ b/plugins/exchange-operations/exchange-folder-permission.c @@ -30,20 +30,25 @@ #include #include #include -#include "exchange-config-listener.h" -#include "exchange-operations.h" +#include +#include #include #include +#include "exchange-config-listener.h" +#include "exchange-operations.h" #include "exchange-permissions-dialog.h" +#include "addressbook/gui/widgets/eab-popup.h" static void org_folder_permissions_cb (EPopup *ep, EPopupItem *p, void *data); void org_gnome_exchange_folder_permissions (EPlugin *ep, EMPopupTargetFolder *t); void org_gnome_exchange_menu_folder_permissions (EPlugin *ep, EMMenuTargetSelect *target); +void org_gnome_exchange_calendar_permissions (EPlugin *ep, ECalPopupTargetSource *target); +void org_gnome_exchange_addressbook_permissions (EPlugin *ep, EABPopupTargetSource *target); gchar *selected_exchange_folder_uri = NULL; static EPopupItem popup_items[] = { - { E_POPUP_ITEM, "40.emc.30", N_("Permissions..."), org_folder_permissions_cb, NULL, "stock_new-dir", 0, EM_POPUP_FOLDER_INFERIORS } + { E_POPUP_ITEM, "30.emc.10", N_("Permissions..."), org_folder_permissions_cb, NULL, "stock_new-dir", 0, EM_POPUP_FOLDER_INFERIORS } }; static void @@ -52,15 +57,106 @@ popup_free (EPopup *ep, GSList *items, void *data) g_slist_free (items); } +void +org_gnome_exchange_calendar_permissions (EPlugin *ep, ECalPopupTargetSource *target) +{ + GSList *menus = NULL; + int i = 0; + static int first =0; + ExchangeAccount *account = NULL; + EFolder *folder = NULL; + ESource *source = NULL; + gchar *uri = NULL; + + source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); + uri = (gchar *) e_source_get_uri (source); + + if (! g_strrstr (uri, "exchange://")) { + return ; + } + + account = exchange_operations_get_exchange_account (); + + if (!account) + return; + + folder = exchange_account_get_folder (account, uri); + + if (!folder) + return; + + selected_exchange_folder_uri = uri; + + /* for translation*/ + if (!first) { + popup_items[0].label = _(popup_items[0].label); + first++; + + } + + for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++) + menus = g_slist_prepend (menus, &popup_items[i]); + + e_popup_add_items (target->target.popup, menus, NULL, popup_free, NULL); + +} + +void +org_gnome_exchange_addressbook_permissions (EPlugin *ep, EABPopupTargetSource *target) +{ + GSList *menus = NULL; + int i = 0; + static int first =0; + ExchangeAccount *account = NULL; + EFolder *folder = NULL; + ESource *source = NULL; + gchar *uri = NULL; + + source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); + uri = (gchar *) e_source_get_uri (source); + + if (! g_strrstr (uri, "exchange://")) { + return ; + } + + account = exchange_operations_get_exchange_account (); + + if (!account) + return; + + + folder = exchange_account_get_folder (account, uri); + + if (!folder) { + return; + } + + selected_exchange_folder_uri = uri; + + /* for translation*/ + if (!first) { + popup_items[0].label = _(popup_items[0].label); + first++; + } + + for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++) + menus = g_slist_prepend (menus, &popup_items[i]); + + e_popup_add_items (target->target.popup, menus, NULL, popup_free, NULL); +} + void org_gnome_exchange_folder_permissions (EPlugin *ep, EMPopupTargetFolder *t) { GSList *menus = NULL; int i = 0; - static int first =1; + static int first =0; ExchangeAccount *account = NULL; EFolder *folder = NULL; + if (! g_strrstr (t->uri, "exchange://")) + return ; + account = exchange_operations_get_exchange_account (); if (!account) @@ -72,18 +168,13 @@ org_gnome_exchange_folder_permissions (EPlugin *ep, EMPopupTargetFolder *t) if (!folder) return; - if (! g_strrstr (t->uri, "exchange://") && !folder) - return ; - selected_exchange_folder_uri = t->uri; /* for translation*/ - if (first) { + if (!first) { popup_items[0].label = _(popup_items[0].label); - + first++; } - first++; - for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++) menus = g_slist_prepend (menus, &popup_items[i]); diff --git a/plugins/exchange-operations/exchange-permissions-dialog.c b/plugins/exchange-operations/exchange-permissions-dialog.c index ca4f8ba307..8571d3630f 100644 --- a/plugins/exchange-operations/exchange-permissions-dialog.c +++ b/plugins/exchange-operations/exchange-permissions-dialog.c @@ -560,8 +560,7 @@ display_role (ExchangePermissionsDialog *dialog) -1); if (role == E2K_PERMISSIONS_ROLE_CUSTOM) { - gtk_widget_show (dialog->priv->separator); - gtk_widget_show (dialog->priv->custom); + /* FIXME: To show Custom */ role = E2K_PERMISSIONS_ROLE_NUM_ROLES + 1; } gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->priv->role_optionmenu), role); diff --git a/plugins/exchange-operations/org-gnome-exchange-operations.eplug.in b/plugins/exchange-operations/org-gnome-exchange-operations.eplug.in index ed2feef62f..6538c980b7 100644 --- a/plugins/exchange-operations/org-gnome-exchange-operations.eplug.in +++ b/plugins/exchange-operations/org-gnome-exchange-operations.eplug.in @@ -78,6 +78,18 @@ + + + + + + + + + + + + -- cgit v1.2.3