Re: [evolution-patches] Patch to add open menu to right click popup for attachment(s) in meetings.
- From: viren <lviren novell com>
- To: chenthill <pchenthill novell com>
- Cc: evolution-patches lists ximian com, sragavan novell com
- Subject: Re: [evolution-patches] Patch to add open menu to right click popup for attachment(s) in meetings.
- Date: Fri, 29 Jul 2005 18:35:44 +0530
Hi,
Added the itip_organizer* check which was removed.
Thanks,
Viren
On Fri, 2005-07-29 at 17:18 +0530, chenthill wrote:
> On Fri, 2005-07-29 at 15:10 +0530, viren wrote:
> > 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;
>
> You should check itip_organizer_is_user also. Please correct the
> indentations.
>
> thanks, chenthill.
> _______________________________________________
> evolution-patches mailing list
> evolution-patches lists ximian com
> http://lists.ximian.com/mailman/listinfo/evolution-patches
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 13:02:20 -0000
@@ -1801,8 +1801,11 @@ 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 (itip_organizer_is_user (comp, client) &&
+ !e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_ORGANIZER))
flags |= COMP_EDITOR_USER_ORG;
+
g_object_unref (comp);
}
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 13:02:21 -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, CompEditor *editor, 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 13:02:21 -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,25 @@ 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, CompEditor *editor, 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);
-
+ ECal *client;
+ gboolean read_only;
+ CompEditorFlags flags;
+
+ client = comp_editor_get_e_cal (editor);
+ flags = comp_editor_get_flags (editor);
+ e_cal_is_read_only (client, &read_only, NULL);
t->attachments = attachments;
+
+ if (!read_only && ((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 +433,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/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 13:02:22 -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: 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 13:02:24 -0000
@@ -326,11 +326,12 @@ sensitize_widgets (MeetingPage *mpage)
MeetingPagePrivate *priv = mpage->priv;
GError *error = NULL;
guint32 flags;
- gboolean delegate;
+ gboolean delegate, user_org;
flags = COMP_EDITOR_PAGE (mpage)->flags;
delegate = flags & COMP_EDITOR_PAGE_DELEGATE;
+ user_org = 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 && user_org) || delegate);
+ gtk_widget_set_sensitive (priv->remove, (!read_only && user_org) || delegate);
+ gtk_widget_set_sensitive (priv->invite, (!read_only && user_org) || 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 13:02:28 -0000
@@ -603,12 +603,12 @@ is_custom_alarm_store (EAlarmList *alarm
static void
sensitize_widgets (EventPage *epage)
{
- gboolean read_only, custom, alarm, sens = TRUE;
+ gboolean read_only, custom, alarm, user_org = TRUE;
EventPagePrivate *priv;
priv = epage->priv;
if (COMP_EDITOR_PAGE (epage)->flags & COMP_EDITOR_MEETING)
- sens = COMP_EDITOR_PAGE (epage)->flags & COMP_EDITOR_PAGE_USER_ORG;
+ user_org = COMP_EDITOR_PAGE (epage)->flags & COMP_EDITOR_PAGE_USER_ORG;
if (!e_cal_is_read_only (COMP_EDITOR_PAGE (epage)->client, &read_only, NULL))
read_only = TRUE;
@@ -616,18 +616,18 @@ sensitize_widgets (EventPage *epage)
custom = is_custom_alarm_store (priv->alarm_list_store, priv->old_summary, priv->alarm_units, priv->alarm_interval, NULL);
alarm = e_dialog_toggle_get (priv->alarm);
- gtk_widget_set_sensitive (priv->summary_label, !read_only && sens);
- gtk_entry_set_editable (GTK_ENTRY (priv->summary), !read_only && sens);
- gtk_widget_set_sensitive (priv->location_label, !read_only && sens);
- gtk_entry_set_editable (GTK_ENTRY (priv->location), !read_only && sens);
- gtk_widget_set_sensitive (priv->start_time, !read_only && sens);
- gtk_widget_set_sensitive (priv->start_timezone, !read_only && sens);
- gtk_widget_set_sensitive (priv->end_time, !read_only && sens);
- gtk_widget_set_sensitive (priv->end_timezone, !read_only && sens);
- gtk_widget_set_sensitive (priv->all_day_event, !read_only && sens);
- gtk_widget_set_sensitive (priv->description, !read_only && sens);
- gtk_widget_set_sensitive (priv->classification, !read_only && sens);
- gtk_widget_set_sensitive (priv->show_time_as_busy, !read_only && sens);
+ gtk_widget_set_sensitive (priv->summary_label, !read_only && user_org);
+ gtk_entry_set_editable (GTK_ENTRY (priv->summary), !read_only && user_org);
+ gtk_widget_set_sensitive (priv->location_label, !read_only && user_org);
+ gtk_entry_set_editable (GTK_ENTRY (priv->location), !read_only && user_org);
+ gtk_widget_set_sensitive (priv->start_time, !read_only && user_org);
+ gtk_widget_set_sensitive (priv->start_timezone, !read_only && user_org);
+ gtk_widget_set_sensitive (priv->end_time, !read_only && user_org);
+ gtk_widget_set_sensitive (priv->end_timezone, !read_only && user_org);
+ gtk_widget_set_sensitive (priv->all_day_event, !read_only && user_org);
+ gtk_widget_set_sensitive (priv->description, !read_only && user_org);
+ gtk_widget_set_sensitive (priv->classification, !read_only && user_org);
+ gtk_widget_set_sensitive (priv->show_time_as_busy, !read_only && user_org);
gtk_widget_set_sensitive (priv->alarm, !read_only);
gtk_widget_set_sensitive (priv->alarm_time, !read_only && !custom && alarm);
gtk_widget_set_sensitive (priv->alarm_custom, alarm);
@@ -635,9 +635,9 @@ sensitize_widgets (EventPage *epage)
gtk_widget_show (priv->alarm_warning);
else
gtk_widget_hide (priv->alarm_warning);
- gtk_widget_set_sensitive (priv->categories_btn, !read_only && sens);
- gtk_widget_set_sensitive (priv->sendoptions_button, !read_only && sens);
- gtk_entry_set_editable (GTK_ENTRY (priv->categories), !read_only && sens);
+ gtk_widget_set_sensitive (priv->categories_btn, !read_only);
+ gtk_widget_set_sensitive (priv->sendoptions_button, !read_only && user_org);
+ gtk_entry_set_editable (GTK_ENTRY (priv->categories), !read_only && user_org);
if (COMP_EDITOR_PAGE (epage)->flags & COMP_EDITOR_PAGE_DELEGATE) {
gtk_widget_set_sensitive (priv->sendoptions_button, TRUE);
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 13:02:33 -0000
@@ -1018,6 +1018,50 @@ 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 +1100,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, E_CAL_POPUP_MODIFY_ATTACHMENTS},
};
static void
@@ -1100,8 +1145,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,11 +1161,11 @@ 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, attachments);
t->target.widget = (GtkWidget *)bar;
menu = e_popup_create_menu_once((EPopup *)ecp, (EPopupTarget *)t, 0);
- if (event == NULL)
+ if (event == NULL )
gtk_menu_popup(menu, NULL, NULL, cab_popup_position, bar, 0, gtk_get_current_event_time());
else
gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button, event->time);
@@ -1254,19 +1300,6 @@ setup_widgets (CompEditor *editor)
}
-void
-comp_editor_sensitize_attachment_bar (CompEditor *editor, gboolean set)
-{
- CompEditorPrivate *priv;
-
- g_return_if_fail (IS_COMP_EDITOR (editor));
-
- priv = editor->priv;
-
- gtk_widget_set_sensitive (GTK_WIDGET (priv->attachment_bar), set);
- gtk_widget_set_sensitive (GTK_WIDGET (priv->attachment_scrolled_window), set);
-}
-
/* Object initialization function for the calendar component editor */
static void
comp_editor_init (CompEditor *editor)
@@ -2496,7 +2529,7 @@ comp_editor_notify_client_changed (CompE
if (!e_cal_is_read_only (client, &read_only, NULL))
read_only = TRUE;
- comp_editor_sensitize_attachment_bar (editor, !read_only);
+
gtk_dialog_set_response_sensitive (GTK_DIALOG (editor), GTK_RESPONSE_OK, !read_only);
}
Index: gui/dialogs/task-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/task-editor.c,v
retrieving revision 1.83
diff -u -p -r1.83 task-editor.c
--- gui/dialogs/task-editor.c 1 Apr 2005 08:44:56 -0000 1.83
+++ gui/dialogs/task-editor.c 29 Jul 2005 13:02:33 -0000
@@ -125,7 +125,6 @@ TaskEditor *
task_editor_construct (TaskEditor *te, ECal *client, gboolean is_assigned)
{
TaskEditorPrivate *priv;
- gboolean read_only = FALSE;
priv = te->priv;
@@ -146,10 +145,6 @@ task_editor_construct (TaskEditor *te, E
COMP_EDITOR_PAGE (priv->task_details_page),
_("Status"));
- if (!e_cal_is_read_only (client, &read_only, NULL))
- read_only = TRUE;
- comp_editor_sensitize_attachment_bar (COMP_EDITOR (te), !read_only);
-
if (priv->is_assigned) {
if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS))
task_page_show_options (priv->task_page);
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 13:02:56 -0000
@@ -1,3 +1,23 @@
+2005-07-28 Viren.l <lviren novell com>
+
+ * gui/e-calendar-view.c: (e_calendar_view_edit_appointment):
+ Set the COMP_EDITOR_USER_ORG flag by checking the static capability.
+ * gui/dialogs/meeting-page.c:(meeting_page_fill_widgets):
+ Removed sensitizing of Add, Remove & Invite buttons.
+ * gui/dialogs/event-page.c: (sensitize_widgets):
+ Renamed sens with user_org.
+ * gui/dialogs/comp-editor.c: (cab_open), (cab_popup):
+ Added Open to right click popup with proper mask and cab_open callback.
+ Removed comp_editor_sensitize_attachment_bar function.
+ * gui/dialogs/event-editor.c: (show_meeting):
+ If user is not organizer dont allow the widget to receive notification of drags.
+ * gui/dialogs/task-editor.c: (task_editor_construct):
+ Removed call made to comp_editor_sensitize_attachment_bar.
+ * gui/e-cal-popup[ch]:Added an extra parameter CompEditor 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:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]