Re: [evolution-patches] Patch to add open menu to right click popup for attachment(s) in meetings.
- From: viren <lviren novell com>
- To: sragavan novell com
- Cc: evolution-patches lists ximian com
- Subject: Re: [evolution-patches] Patch to add open menu to right click popup for attachment(s) in meetings.
- Date: Fri, 29 Jul 2005 09:00:50 +0530
Hi,
I have made changes.Also the patch for disabling the event-editor for
groupwise meeting is combined with the attachement since once the
meeting is created even the organizer can't modify the attachments.
Thanks,
Viren
On Tue, 2005-07-26 at 11:44 +0530, Srinivasa Ragavan wrote:
> On Tue, 2005-07-26 at 10:40 +0530, lviren wrote:
> > Index: gui/dialogs/comp-editor.c
> > ===================================================================
> > RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/comp-editor.c,v
> > retrieving revision 1.143
> > diff -u -p -r1.143 comp-editor.c
> > --- gui/dialogs/comp-editor.c 20 Jul 2005 11:18:54 -0000 1.143
> > +++ gui/dialogs/comp-editor.c 26 Jul 2005 04:47:59 -0000
> > @@ -1016,6 +1016,47 @@ attachment_bar_icon_clicked_cb (EAttachm
> > }
> >
> > /* Callbacks. */
> > +static void
> > +cab_open(EPopup *ep, EPopupItem *item, void *data)
> > +{
> > + EAttachmentBar *bar = data;
> > + CompEditor *editor = COMP_EDITOR (gtk_widget_get_toplevel
> > (GTK_WIDGET (bar)));
> > + GnomeIconList *icon_list;
> > + GList *p;
> > + int num;
> > + char *attach_file_url;
> > + GError *error = NULL;
> > +
> > + icon_list = GNOME_ICON_LIST (bar);
> > + p = gnome_icon_list_get_selection (icon_list);
> Hmm, since your flag is one/many im pretty sure that you can get more
> than one attachments here. It is a glist of selected attachments.
> But you use just one, the first one. NO
> > + if (p) {
> > + EAttachment *attachment;
> > + GSList *list;
> > + const char *comp_uid= NULL;
> > + const char *local_store =
> > e_cal_get_local_attachment_store (editor->priv->client);
> > +
> > + e_cal_component_get_uid (editor->priv->comp,
> > &comp_uid);
> > + num = GPOINTER_TO_INT (p->data);
> > + list = e_attachment_bar_get_attachment (bar, num);
> > + attachment = list->data;
> When you get the attachment, it is ref'ed. You are not unreffing it. It
> leaks a lot. Incase of multi selection everything selected is leaked.
> > + g_slist_free (list);
> > +
> > + attach_file_url = g_strconcat (local_store,
> > + comp_uid,
> > + "-",
> > +
> > camel_mime_part_get_filename(attachment->body),
> > + NULL);
> > +
> > + /* launch the url now */
> > + /* TODO should send GError and handle error
> > conditions
> > + * here */
> > + gnome_url_show (attach_file_url, &error);
> > +
> > + if (error)
> > + g_message ("DEBUG: Launch failed :(\n");
> > + g_free (attach_file_url);
> > + }
> > +}
> >
> > static void
> > cab_add(EPopup *ep, EPopupItem *item, void *data)
> > @@ -1056,10 +1097,11 @@ 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, 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 },
> > + { E_POPUP_ITEM, "10.attach", N_("_Open"), cab_open, NULL,
> > GTK_STOCK_OPEN, E_CAL_POPUP_ATTACHMENTS_ONE |
> > E_CAL_POPUP_ATTACHMENTS_MANY },
> cant we have the mailer way of 'open in foo app'. Ideally we should move
> forward one OPEN and a submenu of Open With having other applications.
> > + { E_POPUP_ITEM, "20.attach", N_("_Remove"), cab_remove, NULL,
> > GTK_STOCK_REMOVE, E_CAL_POPUP_ATTACHMENTS_MANY },
> > + { E_POPUP_ITEM, "30.attach", N_("_Properties"),
> > cab_properties, NULL, GTK_STOCK_PROPERTIES,
> > E_CAL_POPUP_ATTACHMENTS_ONE },
> > + { E_POPUP_BAR, "40.attach.00", NULL, NULL, NULL, NULL,
> > E_CAL_POPUP_ATTACHMENTS_MANY|E_CAL_POPUP_ATTACHMENTS_ONE },
> > + { E_POPUP_ITEM, "40.attach.01", N_("_Add attachment..."),
> > cab_add, NULL, GTK_STOCK_ADD, 0 },
> > };
> >
> > static void
> > @@ -1100,11 +1142,21 @@ cab_popup(EAttachmentBar *bar, GdkEventB
> > ECalPopup *ecp;
> > ECalPopupTargetAttachments *t;
> > GtkMenu *menu;
> > -
> > + CompEditorFlags flags;
> > + CompEditor *editor;
> > +
> > + editor = COMP_EDITOR (gtk_widget_get_toplevel (GTK_WIDGET
> > (bar)));
> > + flags = comp_editor_get_flags (editor);
> > attachments = e_attachment_bar_get_attachment(bar, id);
> >
> > - for (i=0;i<sizeof(cab_popups)/sizeof(cab_popups[0]);i++)
> > + for (i=0;i<sizeof(cab_popups)/sizeof(cab_popups[0]);i++) {
> > + if (!(flags & COMP_EDITOR_USER_ORG) &&
> > + (!strcmp (cab_popups[i].path,
> > "20.attach") ||
> > + !strcmp (cab_popups[i].path,
> > "40.attach.01")))
> This is wrong way of doing. Ideally this should have been a attachment
> flag in e-cal-popup and it should be filtered there. Any body could
> write a e-plugin and popup can take those attachments. Those are not
> caught here.
> > + continue;
> > + else
> > menus = g_slist_prepend(menus, &cab_popups[i]);
> > + }
> >
> > /** @HookPoint-ECalPopup: Calendar Attachment Bar Context Menu
> > * @Id: org.gnome.evolution.calendar.attachmentbar.popup
> > Index: ChangeLog
> > ===================================================================
> > RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
> > retrieving revision 1.2777
> > diff -u -p -r1.2777 ChangeLog
> > --- ChangeLog 22 Jul 2005 11:41:35 -0000 1.2777
> > +++ ChangeLog 26 Jul 2005 04:48:06 -0000
> > @@ -1,3 +1,8 @@
> > +2005-07-26 Viren.l <lviren novell com>
> > + * gui/dialogs/comp-editor.c: (cab_open), (cab_popup):
> > + Added Open to right click popup and cab_open callback.
> > + Append Remove and Add attachments menus to popup if user is
> > organizer.
> > +
> > 2005-07-22 Chenthill Palanisamy <pchenthill novell com>
> >
> > Fixes #309991
> >
> > _______________________________________________
> > evolution-patches mailing list
> > evolution-patches lists ximian com
> > http://lists.ximian.com/mailman/listinfo/evolution-patches
>
Index: gui/e-cal-popup.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-popup.h,v
retrieving revision 1.8
diff -u -p -r1.8 e-cal-popup.h
--- gui/e-cal-popup.h 25 Jul 2005 05:18:51 -0000 1.8
+++ gui/e-cal-popup.h 29 Jul 2005 03:28:45 -0000
@@ -25,6 +25,7 @@
#include <glib-object.h>
#include "e-util/e-popup.h"
+#include "dialogs/comp-editor.h"
#ifdef __cplusplus
extern "C" {
@@ -111,6 +112,7 @@ enum _e_cal_popup_target_source_t {
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 */
+ E_CAL_POPUP_MODIFY_ATTACHMENTS = 1<<2,/* check to open/remove attachments */
};
typedef struct _ECalPopupTargetSelect ECalPopupTargetSelect;
@@ -184,7 +186,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);
+ECalPopupTargetAttachments * e_cal_popup_target_new_attachments (ECalPopup *ecp, CompEditorFlags flags, GSList *attachments);
/* ********************************************************************** */
Index: gui/e-cal-popup.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-popup.c,v
retrieving revision 1.14
diff -u -p -r1.14 e-cal-popup.c
--- gui/e-cal-popup.c 25 Jul 2005 11:50:55 -0000 1.14
+++ gui/e-cal-popup.c 29 Jul 2005 03:28:45 -0000
@@ -278,8 +278,6 @@ e_cal_popup_target_new_select(ECalPopup
if (!read_only)
mask &= ~E_CAL_POPUP_SELECT_EDITABLE;
-
-
if (!e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT)
&& !e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK))
mask &= ~E_CAL_POPUP_SELECT_ASSIGNABLE;
@@ -347,13 +345,19 @@ e_cal_popup_target_new_source(ECalPopup
* Return value:
**/
ECalPopupTargetAttachments *
-e_cal_popup_target_new_attachments(ECalPopup *ecp, GSList *attachments)
+e_cal_popup_target_new_attachments(ECalPopup *ecp, CompEditorFlags flags, 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 ((flags & COMP_EDITOR_USER_ORG) ||
+ (flags & COMP_EDITOR_NEW_ITEM) ||
+ !(flags & COMP_EDITOR_MEETING))
+ mask &= ~ E_CAL_POPUP_MODIFY_ATTACHMENTS;
+
if (len > 0)
mask &= ~ E_CAL_POPUP_ATTACHMENTS_MANY;
if (len == 1)
@@ -423,6 +427,7 @@ static const EPopupHookTargetMask ecalph
static const EPopupHookTargetMask ecalph_attachments_masks[] = {
{ "one", E_CAL_POPUP_ATTACHMENTS_ONE },
{ "many", E_CAL_POPUP_ATTACHMENTS_MANY },
+ { "modify", E_CAL_POPUP_MODIFY_ATTACHMENTS },
{ 0 }
};
Index: gui/e-calendar-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-view.c,v
retrieving revision 1.88
diff -u -p -r1.88 e-calendar-view.c
--- gui/e-calendar-view.c 25 Jul 2005 04:55:59 -0000 1.88
+++ gui/e-calendar-view.c 29 Jul 2005 03:28:47 -0000
@@ -1801,8 +1801,10 @@ e_calendar_view_edit_appointment (ECalen
ECalComponent *comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
flags |= COMP_EDITOR_MEETING;
- if (itip_organizer_is_user (comp, client))
+
+ if (!e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_ORGANIZER))
flags |= COMP_EDITOR_USER_ORG;
+
g_object_unref (comp);
}
Index: gui/dialogs/meeting-page.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/meeting-page.c,v
retrieving revision 1.103
diff -u -p -r1.103 meeting-page.c
--- gui/dialogs/meeting-page.c 11 Jul 2005 02:35:49 -0000 1.103
+++ gui/dialogs/meeting-page.c 29 Jul 2005 03:28:47 -0000
@@ -326,11 +326,12 @@ sensitize_widgets (MeetingPage *mpage)
MeetingPagePrivate *priv = mpage->priv;
GError *error = NULL;
guint32 flags;
- gboolean delegate;
+ gboolean delegate, sens;
flags = COMP_EDITOR_PAGE (mpage)->flags;
delegate = flags & COMP_EDITOR_PAGE_DELEGATE;
+ sens = flags & COMP_EDITOR_PAGE_USER_ORG;
if (!e_cal_is_read_only (COMP_EDITOR_PAGE (mpage)->client, &read_only, &error)) {
if (error->code != E_CALENDAR_STATUS_BUSY)
read_only = TRUE;
@@ -338,9 +339,9 @@ sensitize_widgets (MeetingPage *mpage)
}
gtk_widget_set_sensitive (priv->organizer, !read_only);
gtk_widget_set_sensitive (priv->existing_organizer_btn, (!read_only && priv->user_org));
- gtk_widget_set_sensitive (priv->add, (!read_only && priv->user_org) || delegate);
- gtk_widget_set_sensitive (priv->remove, (!read_only && priv->user_org) || delegate);
- gtk_widget_set_sensitive (priv->invite, (!read_only && priv->user_org) || delegate);
+ gtk_widget_set_sensitive (priv->add, (!read_only && sens) || delegate);
+ gtk_widget_set_sensitive (priv->remove, (!read_only && sens) || delegate);
+ gtk_widget_set_sensitive (priv->invite, (!read_only && sens) || delegate);
gtk_widget_set_sensitive (GTK_WIDGET (priv->list_view), !read_only);
}
@@ -384,9 +385,6 @@ meeting_page_fill_widgets (CompEditorPag
gtk_widget_hide (priv->organizer_table);
gtk_widget_show (priv->existing_organizer_table);
if (itip_organizer_is_user (comp, page->client)) {
- gtk_widget_set_sensitive (priv->invite, TRUE);
- gtk_widget_set_sensitive (priv->add, TRUE);
- gtk_widget_set_sensitive (priv->remove, TRUE);
if (e_cal_get_static_capability (
page->client,
CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS))
Index: gui/dialogs/event-page.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/event-page.c,v
retrieving revision 1.87
diff -u -p -r1.87 event-page.c
--- gui/dialogs/event-page.c 6 Jul 2005 13:31:28 -0000 1.87
+++ gui/dialogs/event-page.c 29 Jul 2005 03:28:48 -0000
@@ -636,6 +636,7 @@ sensitize_widgets (EventPage *epage)
else
gtk_widget_hide (priv->alarm_warning);
gtk_widget_set_sensitive (priv->categories_btn, !read_only && sens);
+ gtk_widget_set_sensitive (priv->source_selector, !read_only && sens);
gtk_widget_set_sensitive (priv->sendoptions_button, !read_only && sens);
gtk_entry_set_editable (GTK_ENTRY (priv->categories), !read_only && sens);
Index: gui/dialogs/comp-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/comp-editor.c,v
retrieving revision 1.143
diff -u -p -r1.143 comp-editor.c
--- gui/dialogs/comp-editor.c 20 Jul 2005 11:18:54 -0000 1.143
+++ gui/dialogs/comp-editor.c 29 Jul 2005 03:28:50 -0000
@@ -1018,6 +1018,49 @@ attachment_bar_icon_clicked_cb (EAttachm
/* Callbacks. */
static void
+cab_open(EPopup *ep, EPopupItem *item, void *data)
+{
+ EAttachmentBar *bar = data;
+ CompEditor *editor = COMP_EDITOR (gtk_widget_get_toplevel (GTK_WIDGET (bar)));
+ GnomeIconList *icon_list;
+ GList *p;
+ int num;
+ char *attach_file_url;
+ GError *error = NULL;
+
+ icon_list = GNOME_ICON_LIST (bar);
+ p = gnome_icon_list_get_selection (icon_list);
+ if (p) {
+ EAttachment *attachment;
+ GSList *list;
+ const char *comp_uid= NULL;
+ const char *local_store = e_cal_get_local_attachment_store (editor->priv->client);
+
+ e_cal_component_get_uid (editor->priv->comp, &comp_uid);
+ num = GPOINTER_TO_INT (p->data);
+ list = e_attachment_bar_get_attachment (bar, num);
+ attachment = list->data;
+ g_slist_free (list);
+
+ attach_file_url = g_strconcat (local_store,
+ comp_uid,
+ "-",
+ camel_mime_part_get_filename(attachment->body),
+ NULL);
+
+ /* launch the url now */
+ /* TODO should send GError and handle error conditions
+ * here */
+ gnome_url_show (attach_file_url, &error);
+
+ if (error)
+ g_message ("DEBUG: Launch failed :(\n");
+ g_free (attach_file_url);
+ g_object_unref (attachment);
+ }
+}
+
+static void
cab_add(EPopup *ep, EPopupItem *item, void *data)
{
EAttachmentBar *bar = data;
@@ -1056,10 +1099,11 @@ 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, 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 },
+ { E_POPUP_ITEM, "10.attach", N_("_Open"), cab_open, NULL, GTK_STOCK_OPEN, E_CAL_POPUP_ATTACHMENTS_ONE},
+ { E_POPUP_ITEM, "20.attach", N_("_Remove"), cab_remove, NULL, GTK_STOCK_REMOVE, E_CAL_POPUP_ATTACHMENTS_MANY | E_CAL_POPUP_MODIFY_ATTACHMENTS },
+ { E_POPUP_ITEM, "30.attach", N_("_Properties"), cab_properties, NULL, GTK_STOCK_PROPERTIES, E_CAL_POPUP_ATTACHMENTS_ONE },
+ { E_POPUP_BAR, "40.attach.00", NULL, NULL, NULL, NULL, E_CAL_POPUP_ATTACHMENTS_MANY|E_CAL_POPUP_ATTACHMENTS_ONE },
+ { E_POPUP_ITEM, "40.attach.01", N_("_Add attachment..."), cab_add, NULL, GTK_STOCK_ADD, 0, E_CAL_POPUP_MODIFY_ATTACHMENTS},
};
static void
@@ -1100,8 +1144,9 @@ cab_popup(EAttachmentBar *bar, GdkEventB
ECalPopup *ecp;
ECalPopupTargetAttachments *t;
GtkMenu *menu;
-
- attachments = e_attachment_bar_get_attachment(bar, id);
+ CompEditor *editor = COMP_EDITOR (gtk_widget_get_toplevel (GTK_WIDGET (bar)));
+
+ attachments = e_attachment_bar_get_attachment(bar, id);
for (i=0;i<sizeof(cab_popups)/sizeof(cab_popups[0]);i++)
menus = g_slist_prepend(menus, &cab_popups[i]);
@@ -1115,7 +1160,7 @@ cab_popup(EAttachmentBar *bar, GdkEventB
*/
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 = e_cal_popup_target_new_attachments(ecp, editor->priv->flags, attachments);
t->target.widget = (GtkWidget *)bar;
menu = e_popup_create_menu_once((EPopup *)ecp, (EPopupTarget *)t, 0);
Index: gui/dialogs/event-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/event-editor.c,v
retrieving revision 1.68
diff -u -p -r1.68 event-editor.c
--- gui/dialogs/event-editor.c 4 Jul 2005 09:37:24 -0000 1.68
+++ gui/dialogs/event-editor.c 29 Jul 2005 03:28:50 -0000
@@ -410,9 +410,12 @@ static void
show_meeting (EventEditor *ee)
{
EventEditorPrivate *priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
priv = ee->priv;
-
+ editor = COMP_EDITOR (ee);
+ flags = comp_editor_get_flags (editor);
event_page_set_meeting (priv->event_page, TRUE);
if (!priv->meeting_shown) {
comp_editor_append_page (COMP_EDITOR (ee),
@@ -428,6 +431,10 @@ show_meeting (EventEditor *ee)
}
if (comp_editor_get_flags (COMP_EDITOR (ee)) & COMP_EDITOR_DELEGATE)
comp_editor_show_page (COMP_EDITOR (ee), COMP_EDITOR_PAGE (priv->meet_page));
+
+ if (!(flags & COMP_EDITOR_NEW_ITEM) && !(flags & COMP_EDITOR_USER_ORG))
+ gtk_drag_dest_unset(GTK_WIDGET (editor));
+
}
void
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2780
diff -u -p -r1.2780 ChangeLog
--- ChangeLog 25 Jul 2005 11:50:54 -0000 1.2780
+++ ChangeLog 29 Jul 2005 03:28:58 -0000
@@ -1,3 +1,19 @@
+2005-07-28 Viren.l <lviren novell com>
+
+ * gui/e-calendar-view.c: (e_calendar_view_edit_appointment):
+ Set/Unset the above flag by checking the static capability.
+ Removed the overriding check of itip_organizer_is_user.
+ * gui/dialogs/meeting-page.c:(meeting_page_fill_widgets):
+ Removed sensitizing of Add, Remove & Invite buttons.
+ * gui/dialogs/comp-editor.c: (cab_open), (cab_popup):
+ Added Open to right click popup with proper mask and cab_open callback.
+ * gui/dialogs/event-editor.c: (show_meeting):
+ If user is not organizer dont allow the widget to receive notification of drags.
+ * gui/e-cal-popup[ch]:Added an extra parameter CompEditorFlags to
+ e_cal_popup_target_attachments and made appropriate checks to set the MODIFY_ATTACHMENTS
+ mask.
+
+
2005-07-25 Chenthill Palanisamy <pchenthill novell com>
* gui/e-cal-popup.c:
meeting.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]