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



Hi,

Thanks for your review.

Sarfraaz Ahmed wrote:

Hi,

Some comments below.
+++ exchange-folder-permission.c        15 Jul 2005 15:06:05 -0000
@@ -30,20 +30,25 @@


+void
+org_gnome_exchange_calendar_permissions (EPlugin *ep,
ECalPopupTargetSource *target)
+{
+
+       if (! g_strrstr (uri, "exchange://") && !folder)        {
+               return ;
+       }

Move this check for uri in the beginning.
Yes, I did it.

+
+       selected_exchange_folder_uri = uri;
+
+       /* for translation*/
+       if (first) {
+               popup_items[0].label =  _(popup_items[0].label);
+
+       }

This check doesnt look very logical. Guess, you wanted to have this
execute only once. You would have to initialise first to 0 and then
have it incremented inside the if clause.
Done.


+       if (! g_strrstr (uri, "exchange://") && !folder)        {
+               return ;

Similar
Done.

+       }
+
+       selected_exchange_folder_uri = uri;
+
+       /* for translation*/
+       if (first) {
+               popup_items[0].label =  _(popup_items[0].label);
+
+       }

Similar
Done.

+
+
+++ 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;

What is this for ?
This is just to show a label named 'Custom' (I am not showing that label now, it will show empty). This part fixes bug #310493.

I have attached the modified patch. Please review it.

Thanks,
Shakti

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/ChangeLog,v
retrieving revision 1.21
diff -u -p -r1.21 ChangeLog
--- ChangeLog	16 Jul 2005 06:48:42 -0000	1.21
+++ ChangeLog	18 Jul 2005 09:42:22 -0000
@@ -1,3 +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.
+	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-16  Sarfraaz Ahmed <asarfraaz novell com>
 
 	* exchange-ask-password.c : Removed. Is no longer being used
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	18 Jul 2005 09:42:22 -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
@@ -53,36 +58,122 @@ popup_free (EPopup *ep, GSList *items, v
 }
 
 void
-org_gnome_exchange_folder_permissions (EPlugin *ep, EMPopupTargetFolder *t)
+org_gnome_exchange_calendar_permissions (EPlugin *ep, ECalPopupTargetSource *target)
 {
 	GSList *menus = NULL;
 	int i = 0;
-	static int first =1;
+	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://") && !folder)	{
+		return ;
+	}
 
 	account = exchange_operations_get_exchange_account ();
 
 	if (!account)
 		return;
 
-	folder = exchange_account_get_folder (account, t->uri);
-
+	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://") && !folder)	{
+		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 =0;
+	ExchangeAccount *account = NULL;
+	EFolder *folder = NULL;
+
 	if (! g_strrstr (t->uri, "exchange://") && !folder)
 		return ;
 
+	account = exchange_operations_get_exchange_account ();
+
+	if (!account)
+		return;
+
+	folder = exchange_account_get_folder (account, t->uri);
+
+
+	if (!folder)
+		return;
+
 	selected_exchange_folder_uri = t->uri;
 	/* for translation*/
 	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]);
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	18 Jul 2005 09:42:23 -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	18 Jul 2005 09:42:23 -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]