[evolution-patches] Patch for bug#310479 (Exchange-component)



Hi,

I am attaching a patch which shows the right click 'Folder Permissions' menu-item for 'Calendar', 'Tasks' and 'Contacts' components. Please review the patch.

The bugzilla bug #310479.

Thanks,
Shakti


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/ChangeLog,v
retrieving revision 1.20
diff -u -p -r1.20 ChangeLog
--- ChangeLog	15 Jul 2005 05:39:09 -0000	1.20
+++ ChangeLog	15 Jul 2005 15:06:05 -0000
@@ -1,5 +1,15 @@
 2005-07-15  Shakti Sen <shprasad novell com>
 
+	* 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.
+	* org-gnome-exchange-operations.eplug.in: Added the class hooks.
+
+	Fixes bug#310479.
+
+2005-07-15  Shakti Sen <shprasad novell com>
+
 	* Makefile.am: Included the e-foreign-folder-dialog.glade file.
 	* e-foreign-folder-dialog.glade: Added newly.
 
Index: exchange-folder-permission.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-folder-permission.c,v
retrieving revision 1.3
diff -u -p -r1.3 exchange-folder-permission.c
--- exchange-folder-permission.c	14 Jul 2005 07:00:51 -0000	1.3
+++ exchange-folder-permission.c	15 Jul 2005 15:06:05 -0000
@@ -30,20 +30,25 @@
 #include <libedataserver/e-xml-hash-utils.h>
 #include <exchange/exchange-account.h>
 #include <e-util/e-dialog-utils.h>
-#include "exchange-config-listener.h"
-#include "exchange-operations.h"
+#include <calendar/gui/e-cal-popup.h>
+#include <libedataserverui/e-source-selector.h>
 #include <mail/em-popup.h>
 #include <mail/em-menu.h>
+#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,6 +57,96 @@ popup_free (EPopup *ep, GSList *items, v
        g_slist_free (items);
 }
 
+void
+org_gnome_exchange_calendar_permissions (EPlugin *ep, ECalPopupTargetSource *target)
+{
+	GSList *menus = NULL;
+	int i = 0;
+	static int first =1;
+	ExchangeAccount *account = NULL;
+	EFolder *folder = NULL;
+	ESource *source = NULL;
+	gchar *uri = NULL;
+
+	account = exchange_operations_get_exchange_account ();
+
+	if (!account)
+		return;
+
+	source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector));
+	uri = (gchar *) e_source_get_uri (source);
+
+	folder = exchange_account_get_folder (account, uri);
+
+	if (!folder) {
+		return;
+	}
+
+	if (! g_strrstr (uri, "exchange://") && !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 =1;
+	ExchangeAccount *account = NULL;
+	EFolder *folder = NULL;
+	ESource *source = NULL;
+	gchar *uri = NULL;
+
+	account = exchange_operations_get_exchange_account ();
+
+	if (!account)
+		return;
+
+	source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector));
+	uri = (gchar *) e_source_get_uri (source);
+
+	folder = exchange_account_get_folder (account, uri);
+
+	if (!folder) {
+		return;
+	}
+
+	if (! g_strrstr (uri, "exchange://") && !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)
 {
Index: exchange-permissions-dialog.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-permissions-dialog.c,v
retrieving revision 1.3
diff -u -p -r1.3 exchange-permissions-dialog.c
--- exchange-permissions-dialog.c	14 Jul 2005 11:18:35 -0000	1.3
+++ exchange-permissions-dialog.c	15 Jul 2005 15:06:05 -0000
@@ -560,8 +560,7 @@ display_role (ExchangePermissionsDialog 
 			    -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);
Index: org-gnome-exchange-operations.eplug.in
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/org-gnome-exchange-operations.eplug.in,v
retrieving revision 1.4
diff -u -p -r1.4 org-gnome-exchange-operations.eplug.in
--- org-gnome-exchange-operations.eplug.in	13 Jul 2005 11:10:33 -0000	1.4
+++ org-gnome-exchange-operations.eplug.in	15 Jul 2005 15:06:05 -0000
@@ -78,6 +78,18 @@
 		<menu id="org.gnome.evolution.mail.foldertree.popup" target="folder" factory = "org_gnome_exchange_folder_permissions">
 		</menu>
 	</hook> 
+	<hook class="org.gnome.evolution.calendar.popup:1.0">
+		<menu id="org.gnome.evolution.calendar.source.popup" target="source" factory="org_gnome_exchange_calendar_permissions">
+		</menu>
+	</hook>
+	<hook class="org.gnome.evolution.calendar.popup:1.0">
+		<menu id="org.gnome.evolution.tasks.source.popup" target="source" factory="org_gnome_exchange_calendar_permissions">
+		</menu>
+	</hook>
+	<hook class="org.gnome.evolution.addressbook.popup:1.0">
+		<menu id="org.gnome.evolution.addressbook.source.popup" target="source" factory="org_gnome_exchange_addressbook_permissions">
+		</menu>
+	</hook>
 	<hook class="org.gnome.evolution.mail.bonobomenu:1.0">
 	<menu id="org.gnome.evolution.mail.browser" target="select">
 	<ui file="@PLUGINDIR@/org-gnome-folder-permissions.xml"/>


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