Re: [evolution-patches] Patch to add open menu to right click popup for attachment(s) in meetings.



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 -r1.8 e-cal-popup.h
27a28
> #include "dialogs/comp-editor.h"
113a115
> 	E_CAL_POPUP_MODIFY_ATTACHMENTS = 1<<2,/* check to open/remove attachments */
187c189
< 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 -r1.14 e-cal-popup.c
281,282d280
< 	
< 		
350c348
< e_cal_popup_target_new_attachments(ECalPopup *ecp, GSList *attachments)
---
> e_cal_popup_target_new_attachments(ECalPopup *ecp, CompEditorFlags flags, GSList *attachments)
356a355,360
> 	
> 	if ((flags & COMP_EDITOR_USER_ORG) || 
> 			(flags & COMP_EDITOR_NEW_ITEM) ||
> 			!(flags & COMP_EDITOR_MEETING))	
> 		mask &= ~ E_CAL_POPUP_MODIFY_ATTACHMENTS;
> 
425a430
> 	{ "modify", E_CAL_POPUP_MODIFY_ATTACHMENTS },
Index: gui/e-calendar-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-view.c,v
retrieving revision 1.88
diff -r1.88 e-calendar-view.c
1804c1804,1805
< 		if (itip_organizer_is_user (comp, client))
---
> 		
> 		if (!e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_ORGANIZER)) 
1805a1807
> 
Index: gui/dialogs/comp-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/comp-editor.c,v
retrieving revision 1.143
diff -r1.143 comp-editor.c
1020a1021,1063
> 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
1059,1062c1102,1106
< 	{ 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},
1103,1104c1147,1149
< 
<         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);
1118c1163
< 	t = e_cal_popup_target_new_attachments(ecp, attachments);
---
> 	t = e_cal_popup_target_new_attachments(ecp, editor->priv->flags, attachments);
Index: gui/dialogs/event-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/event-editor.c,v
retrieving revision 1.68
diff -r1.68 event-editor.c
412a413,414
> 	CompEditor *editor;
> 	CompEditorFlags flags;
415c417,418
< 
---
> 	editor = COMP_EDITOR (ee);
> 	flags = comp_editor_get_flags (editor);
430a434,437
> 	
> 	if (!(flags & COMP_EDITOR_NEW_ITEM) && !(flags & COMP_EDITOR_USER_ORG))  
> 		gtk_drag_dest_unset(GTK_WIDGET  (editor));
> 
Index: gui/dialogs/meeting-page.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/meeting-page.c,v
retrieving revision 1.103
diff -r1.103 meeting-page.c
329c329
< 	gboolean delegate;
---
> 	gboolean delegate, sens;
333a334
> 	sens = flags & COMP_EDITOR_PAGE_USER_ORG;
341,343c342,344
< 	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);
387,389d387
< 				gtk_widget_set_sensitive (priv->invite, TRUE);
< 				gtk_widget_set_sensitive (priv->add, TRUE);
< 				gtk_widget_set_sensitive (priv->remove, TRUE);
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2780
diff -r1.2780 ChangeLog
0a1,16
> 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.
> 	    
> 	 


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