Re: [evolution-patches] Fix to remove mailer code from calendar



with some more changed on naming conventions emp->ecp.

-Srini
On Fri, 2005-07-01 at 12:04 +0530, Srinivasa Ragavan wrote:
> On Fri, 2005-07-01 at 13:34 +0800, Not Zed wrote:
> > typo:
> > +       /** @HookPoint-ECa;Popup: Composer Attachment Bar Context Menu
> > 
> > 
> > Also, you haven't put the new target type in the popup hook.
> > 
> > Which suggests the plugin interface is untested, since it can't possibly
> > work.
> > 
> thanks for pointing it out. I have fixed it and attached the reworked
> patch.
> > On Fri, 2005-07-01 at 10:40 +0530, Srinivasa Ragavan wrote:
> > > Hi,
> > > 
> > > I have attached the patch. Please review and respond.
> > > 
> > > Thanks
> > > Srini.
> > > _______________________________________________
> > > evolution-patches mailing list
> > > evolution-patches lists ximian com
> > > http://lists.ximian.com/mailman/listinfo/evolution-patches
> > 
> > _______________________________________________
> > evolution-patches mailing list
> > evolution-patches lists ximian com
> > http://lists.ximian.com/mailman/listinfo/evolution-patches
> _______________________________________________
> evolution-patches mailing list
> evolution-patches lists ximian com
> http://lists.ximian.com/mailman/listinfo/evolution-patches
Index: e-cal-popup.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-popup.c,v
retrieving revision 1.10
diff -u -p -r1.10 e-cal-popup.c
--- e-cal-popup.c	6 Jun 2005 21:05:18 -0000	1.10
+++ e-cal-popup.c	1 Jul 2005 08:18:47 -0000
@@ -242,6 +242,33 @@ e_cal_popup_target_new_source(ECalPopup 
 	return t;
 }
 
+/**
+ * e_cal_popup_target_new_attachments:
+ * @ecp: 
+ * @attachments: A list of CalAttachment objects, reffed for
+ * the list.  Will be unreff'd once finished with.
+ * 
+ * Owns the list @attachments and their items after they're passed in.
+ * 
+ * Return value: 
+ **/
+ECalPopupTargetAttachments *
+e_cal_popup_target_new_attachments(ECalPopup *ecp, GSList *attachments)
+{
+	ECalPopupTargetAttachments *t = e_popup_target_new(&ecp->popup, E_CAL_POPUP_TARGET_ATTACHMENTS, sizeof(*t));
+	guint32 mask = ~0;
+	int len = g_slist_length(attachments);
+
+	t->attachments = attachments;
+	if (len > 0)
+		mask &= ~ E_CAL_POPUP_ATTACHMENTS_MANY;
+	if (len == 1)
+		mask &= ~ E_CAL_POPUP_ATTACHMENTS_ONE;
+	t->target.mask = mask;
+
+	return t;
+}
+
 /* ********************************************************************** */
 /* Popup menu plugin handler */
 
@@ -298,9 +325,16 @@ static const EPopupHookTargetMask ecalph
 	{ 0 }
 };
 
+static const EPopupHookTargetMask ecalph_attachments_masks[] = {
+	{ "one", E_CAL_POPUP_ATTACHMENTS_ONE },
+	{ "many", E_CAL_POPUP_ATTACHMENTS_MANY },
+	{ 0 }
+};
+
 static const EPopupHookTargetMap ecalph_targets[] = {
 	{ "select", E_CAL_POPUP_TARGET_SELECT, ecalph_select_masks },
 	{ "source", E_CAL_POPUP_TARGET_SOURCE, ecalph_source_masks },
+	{ "attachments", E_CAL_POPUP_TARGET_ATTACHMENTS, ecalph_attachments_masks },
 	{ 0 }
 };
 
Index: e-cal-popup.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-popup.h,v
retrieving revision 1.6
diff -u -p -r1.6 e-cal-popup.h
--- e-cal-popup.h	6 Jun 2005 21:05:18 -0000	1.6
+++ e-cal-popup.h	1 Jul 2005 08:18:48 -0000
@@ -47,6 +47,7 @@ struct _ECalendarView;
 enum _e_cal_popup_target_t {
 	E_CAL_POPUP_TARGET_SELECT,
 	E_CAL_POPUP_TARGET_SOURCE,
+	E_CAL_POPUP_TARGET_ATTACHMENTS,
 };
 
 /**
@@ -99,8 +100,21 @@ enum _e_cal_popup_target_source_t {
 	E_CAL_POPUP_SOURCE_NO_OFFLINE = 1 <<4
 };
 
+/**
+ * enum _e_cal_popup_target_attachments_t - ECalPopupTargetAttachments qualifiers.
+ * 
+ * @E_CAL_POPUP_ATTACHMENTS_ONE: There is one and only one attachment selected.
+ * @E_CAL_POPUP_ATTACHMENTS_MANY: There is one or more attachments selected.
+ * 
+ **/
+enum _e_cal_popup_target_attachments_t {
+	E_CAL_POPUP_ATTACHMENTS_ONE = 1<<0, /* only 1 selected */
+	E_CAL_POPUP_ATTACHMENTS_MANY = 1<<1, /* one or more selected */
+};
+
 typedef struct _ECalPopupTargetSelect ECalPopupTargetSelect;
 typedef struct _ECalPopupTargetSource ECalPopupTargetSource;
+typedef struct _ECalPopupTargetAttachments ECalPopupTargetAttachments;
 
 /**
  * struct _ECalPopupTargetSelect - A list of address cards.
@@ -136,6 +150,20 @@ struct _ECalPopupTargetSource {
 	struct _ESourceSelector *selector;
 };
 
+/**
+ * struct _ECalPopupTargetAttachments - A list of calendar attachments.
+ * 
+ * @target: Superclass.
+ * @attachments: A GSList list of CalAttachments.
+ *
+ * This target is used to represent a selected list of attachments in
+ * the calendar attachment area.
+ **/
+struct _ECalPopupTargetAttachments {
+	EPopupTarget target;
+	GSList *attachments;
+};
+
 typedef struct _EPopupItem ECalPopupItem;
 
 /* The object */
@@ -155,6 +183,7 @@ ECalPopup *e_cal_popup_new(const char *m
 
 ECalPopupTargetSelect *e_cal_popup_target_new_select(ECalPopup *eabp, struct _ECalModel *model, GPtrArray *events);
 ECalPopupTargetSource *e_cal_popup_target_new_source(ECalPopup *eabp, struct _ESourceSelector *selector);
+ECalPopupTargetAttachments * e_cal_popup_target_new_attachments (ECalPopup *ecp, GSList *attachments);
 
 /* ********************************************************************** */
 
Index: dialogs/cal-attachment-bar.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/cal-attachment-bar.c,v
retrieving revision 1.11
diff -u -p -r1.11 cal-attachment-bar.c
--- dialogs/cal-attachment-bar.c	24 May 2005 08:45:16 -0000	1.11
+++ dialogs/cal-attachment-bar.c	1 Jul 2005 08:18:48 -0000
@@ -58,7 +58,7 @@
 #include "e-util/e-icon-factory.h"
 #include "e-util/e-error.h"
 #include "e-util/e-mktemp.h"
-#include "mail/em-popup.h"
+#include "../e-cal-popup.h"
 
 #define ICON_WIDTH 64
 #define ICON_SEPARATORS " /-_"
@@ -470,9 +470,9 @@ cab_remove(EPopup *ep, EPopupItem *item,
 
 /* Popup menu handling.  */
 static EPopupItem cab_popups[] = {
-	{ E_POPUP_ITEM, "10.attach", N_("_Remove"), cab_remove, NULL, GTK_STOCK_REMOVE, EM_POPUP_ATTACHMENTS_MANY },
-	{ E_POPUP_ITEM, "20.attach", N_("_Properties"), cab_properties, NULL, GTK_STOCK_PROPERTIES, EM_POPUP_ATTACHMENTS_ONE },
-	{ E_POPUP_BAR, "30.attach.00", NULL, NULL, NULL, NULL, EM_POPUP_ATTACHMENTS_MANY|EM_POPUP_ATTACHMENTS_ONE },
+	{ E_POPUP_ITEM, "10.attach", N_("_Remove"), cab_remove, NULL, GTK_STOCK_REMOVE, E_CAL_POPUP_ATTACHMENTS_MANY },
+	{ E_POPUP_ITEM, "20.attach", N_("_Properties"), cab_properties, NULL, GTK_STOCK_PROPERTIES, E_CAL_POPUP_ATTACHMENTS_ONE },
+	{ E_POPUP_BAR, "30.attach.00", NULL, NULL, NULL, NULL, E_CAL_POPUP_ATTACHMENTS_MANY|E_CAL_POPUP_ATTACHMENTS_ONE },
 	{ E_POPUP_ITEM, "30.attach.01", N_("_Add attachment..."), cab_add, NULL, GTK_STOCK_ADD, 0 },
 };
 
@@ -512,8 +512,8 @@ cab_popup(CalAttachmentBar *bar, GdkEven
 	GList *p;
 	GSList *attachments = NULL, *menus = NULL;
 	int i;
-	EMPopup *emp;
-	EMPopupTargetAttachments *t;
+	ECalPopup *ecp;
+	ECalPopupTargetAttachments *t;
 	GtkMenu *menu;
 	CalAttachment *attachment;
 
@@ -538,18 +538,18 @@ cab_popup(CalAttachmentBar *bar, GdkEven
 	for (i=0;i<sizeof(cab_popups)/sizeof(cab_popups[0]);i++)
 		menus = g_slist_prepend(menus, &cab_popups[i]);
 
-	/** @HookPoint-EMPopup: Composer Attachment Bar Context Menu
-	 * @Id: org.gnome.evolution.mail.composer.attachmentbar.popup
+	/** @HookPoint-ECalPopup: Calendar Attachment Bar Context Menu
+	 * @Id: org.gnome.evolution.calendar.attachmentbar.popup
 	 * @Class: org.gnome.evolution.mail.popup:1.0
-	 * @Target: EMPopupTargetAttachments
+	 * @Target: ECalPopupTargetAttachments
 	 *
-	 * This is the context menu on the composer attachment bar.
+	 * This is the context menu on the calendar attachment bar.
 	 */
-	emp = em_popup_new("org.gnome.evolution.mail.composer.attachmentbar.popup");
-	e_popup_add_items((EPopup *)emp, menus, NULL, cab_popups_free, bar);
-	t = em_popup_target_new_attachments(emp, attachments);
+	ecp = e_cal_popup_new("org.gnome.evolution.calendar.attachmentbar.popup");
+	e_popup_add_items((EPopup *)ecp, menus, NULL, cab_popups_free, bar);
+	t = e_cal_popup_target_new_attachments(ecp, attachments);
 	t->target.widget = (GtkWidget *)bar;
-	menu = e_popup_create_menu_once((EPopup *)emp, (EPopupTarget *)t, 0);
+	menu = e_popup_create_menu_once((EPopup *)ecp, (EPopupTarget *)t, 0);
 
 	if (event == NULL)
 		gtk_menu_popup(menu, NULL, NULL, cab_popup_position, bar, 0, gtk_get_current_event_time());
Index: dialogs/comp-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/comp-editor.c,v
retrieving revision 1.131
diff -u -p -r1.131 comp-editor.c
--- dialogs/comp-editor.c	6 Jun 2005 21:05:18 -0000	1.131
+++ dialogs/comp-editor.c	1 Jul 2005 08:18:49 -0000
@@ -57,6 +57,7 @@
 #include "cancel-comp.h"
 #include "recur-comp.h"
 #include "comp-editor.h"
+#include "../e-cal-popup.h"
 
 #include "cal-attachment-bar.h"
 #include "widgets/misc/e-expander.h"
@@ -447,7 +448,7 @@ drag_data_received (CompEditor *editor, 
 		return;
 
 	if (context->action == GDK_ACTION_ASK) {
-		EMPopup *emp;
+		ECalPopup *ecp;
 		GSList *menus = NULL;
 		GtkMenu *menu;
 		int i;
@@ -466,12 +467,12 @@ drag_data_received (CompEditor *editor, 
 		memcpy(m->selection->data, selection->data, selection->length);
 		m->selection->length = selection->length;
 
-		emp = em_popup_new("org.gnome.evolution.mail.editor.popup.drop");
+		ecp = e_cal_popup_new("org.gnome.evolution.calendar.editor.popup.drop");
 		for (i=0;i<sizeof(drop_popup_menu)/sizeof(drop_popup_menu[0]);i++)
 			menus = g_slist_append(menus, &drop_popup_menu[i]);
 
-		e_popup_add_items((EPopup *)emp, menus, NULL, drop_popup_free, m);
-		menu = e_popup_create_menu_once((EPopup *)emp, NULL, 0);
+		e_popup_add_items((EPopup *)ecp, menus, NULL, drop_popup_free, m);
+		menu = e_popup_create_menu_once((EPopup *)ecp, NULL, 0);
 		gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0, time);
 	} else {
 		drop_action(editor, context, context->action, selection, info, time);


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