aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/dialogs/Makefile.am7
-rw-r--r--calendar/gui/dialogs/comp-editor.c236
-rw-r--r--calendar/gui/dialogs/comp-editor.h2
-rw-r--r--calendar/gui/dialogs/event-editor.c3
-rw-r--r--calendar/gui/dialogs/task-editor.c3
-rw-r--r--calendar/gui/e-cal-model-calendar.c3
-rw-r--r--calendar/gui/e-calendar-table.c2
-rw-r--r--calendar/gui/e-calendar-view.c12
-rw-r--r--calendar/gui/e-day-view-main-item.c25
-rw-r--r--calendar/gui/e-day-view-top-item.c11
-rw-r--r--calendar/gui/e-day-view.c8
-rw-r--r--calendar/gui/e-day-view.h1
-rw-r--r--calendar/gui/e-itip-control.c6
-rw-r--r--calendar/gui/e-week-view-event-item.c21
-rw-r--r--calendar/gui/e-week-view.c5
-rw-r--r--calendar/gui/e-week-view.h1
-rw-r--r--calendar/gui/itip-utils.c65
-rw-r--r--calendar/gui/itip-utils.h2
18 files changed, 383 insertions, 30 deletions
diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am
index 00bc9865b9..11cdf3bd6d 100644
--- a/calendar/gui/dialogs/Makefile.am
+++ b/calendar/gui/dialogs/Makefile.am
@@ -26,6 +26,12 @@ libcal_dialogs_la_SOURCES = \
alarm-dialog.h \
alarm-list-dialog.c \
alarm-list-dialog.h \
+ cal-attachment-bar.c \
+ cal-attachment-bar.h \
+ cal-attachment-select-file.c \
+ cal-attachment-select-file.h \
+ cal-attachment.c \
+ cal-attachment.h \
cal-prefs-dialog.c \
cal-prefs-dialog.h \
calendar-setup.c \
@@ -80,6 +86,7 @@ libcal_dialogs_la_SOURCES = \
glade_DATA = \
alarm-dialog.glade \
alarm-list-dialog.glade \
+ cal-attachment.glade \
cal-prefs-dialog.glade \
e-delegate-dialog.glade \
event-page.glade \
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 7a4040db78..401ea63b9b 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -29,6 +29,7 @@
#include <glib.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtkstock.h>
+#include <libgnome/libgnome.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-uidefs.h>
#include <libgnomeui/gnome-dialog.h>
@@ -47,6 +48,11 @@
#include "recur-comp.h"
#include "comp-editor.h"
+#include "cal-attachment-bar.h"
+#include "widgets/misc/e-expander.h"
+
+
+
/* Private part of the CompEditor structure */
@@ -68,6 +74,17 @@ struct _CompEditorPrivate {
/* Notebook to hold the pages */
GtkNotebook *notebook;
+
+ /* Attachment handling */
+ GtkWidget *attachment_bar;
+ GtkWidget *attachment_scrolled_window;
+ GtkWidget *attachment_expander;
+ GtkWidget *attachment_expander_label;
+ GtkWidget *attachment_expander_icon;
+ GtkWidget *attachment_expander_num;
+
+ guint32 attachment_bar_visible : 1;
+
gboolean changed;
gboolean needs_send;
@@ -242,6 +259,11 @@ save_comp (CompEditor *editor)
/* send timezones */
g_hash_table_foreach (timezones, (GHFunc) send_timezone, editor);
g_hash_table_destroy (timezones);
+
+ /* Attachments*/
+
+ e_cal_component_set_attachment_list (priv->comp,
+ cal_attachment_bar_get_attachment_list ((CalAttachmentBar *) priv->attachment_bar));
/* send the component to the server */
if (!cal_comp_is_on_server (priv->comp, priv->client)) {
@@ -382,11 +404,83 @@ response_cb (GtkWidget *widget, int response, gpointer data)
}
}
+static void
+attachment_bar_changed_cb (CalAttachmentBar *bar,
+ void *data)
+{
+ CompEditor *editor = COMP_EDITOR (data);
+
+ guint attachment_num = cal_attachment_bar_get_num_attachments (
+ CAL_ATTACHMENT_BAR (editor->priv->attachment_bar));
+ if (attachment_num) {
+ gchar *num_text = g_strdup_printf (
+ ngettext ("<b>%d</b> File Attached", "<b>%d</b> Files Attached", attachment_num),
+ attachment_num);
+ gtk_label_set_markup (GTK_LABEL (editor->priv->attachment_expander_num),
+ num_text);
+ g_free (num_text);
+
+ gtk_widget_show (editor->priv->attachment_expander_icon);
+
+ } else {
+ gtk_label_set_text (GTK_LABEL (editor->priv->attachment_expander_num), "");
+ gtk_widget_hide (editor->priv->attachment_expander_icon);
+ }
+
+
+ /* Mark the editor as changed so it prompts about unsaved
+ changes on close */
+ comp_editor_set_changed (editor, TRUE);
+
+}
+
+static void
+attachment_bar_icon_clicked_cb (CalAttachmentBar *bar, void *data)
+{
+ 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) {
+ num = GPOINTER_TO_INT (p->data);
+ attach_file_url = cal_attachment_bar_get_nth_attachment_filename (bar, num);
+ /* 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
+attachment_expander_activate_cb (EExpander *expander,
+ void *data)
+{
+ CompEditor *editor = COMP_EDITOR (data);
+ gboolean show = e_expander_get_expanded (expander);
+
+ /* Update the expander label */
+ if (show)
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (editor->priv->attachment_expander_label),
+ _("Hide _Attachment Bar (drop attachments here)"));
+ else
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (editor->priv->attachment_expander_label),
+ _("Show _Attachment Bar (drop attachments here)"));
+
+}
+
/* Creates the basic in the editor */
static void
setup_widgets (CompEditor *editor)
{
CompEditorPrivate *priv;
+ GtkWidget *expander_hbox;
+ GdkPixbuf *attachment_pixbuf;
priv = editor->priv;
@@ -402,6 +496,59 @@ setup_widgets (CompEditor *editor)
gtk_dialog_set_response_sensitive (GTK_DIALOG (editor), GTK_RESPONSE_OK, FALSE);
g_signal_connect (editor, "response", G_CALLBACK (response_cb), editor);
+
+ /*Attachments */
+ priv->attachment_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->attachment_scrolled_window),
+ GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->attachment_scrolled_window),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+ priv->attachment_bar = cal_attachment_bar_new (NULL);
+ GTK_WIDGET_SET_FLAGS (priv->attachment_bar, GTK_CAN_FOCUS);
+ gtk_container_add (GTK_CONTAINER (priv->attachment_scrolled_window),
+ priv->attachment_bar);
+ gtk_widget_show (priv->attachment_bar);
+ g_signal_connect (priv->attachment_bar, "changed",
+ G_CALLBACK (attachment_bar_changed_cb), editor);
+ g_signal_connect (GNOME_ICON_LIST (priv->attachment_bar), "button-release-event",
+ G_CALLBACK (attachment_bar_icon_clicked_cb), NULL);
+ priv->attachment_expander_label =
+ gtk_label_new_with_mnemonic (_("Show _Attachment Bar (drop attachments here)"));
+ priv->attachment_expander_num = gtk_label_new ("");
+ gtk_label_set_use_markup (GTK_LABEL (priv->attachment_expander_num), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (priv->attachment_expander_label), 0.0, 0.5);
+ gtk_misc_set_alignment (GTK_MISC (priv->attachment_expander_num), 1.0, 0.5);
+ expander_hbox = gtk_hbox_new (FALSE, 0);
+
+ attachment_pixbuf = e_icon_factory_get_icon ("stock_attach", E_ICON_SIZE_MENU);
+ priv->attachment_expander_icon = gtk_image_new_from_pixbuf (attachment_pixbuf);
+ gtk_misc_set_alignment (GTK_MISC (priv->attachment_expander_icon), 1, 0.5);
+ gtk_widget_set_size_request (priv->attachment_expander_icon, 100, -1);
+ g_object_unref (attachment_pixbuf);
+
+ gtk_box_pack_start (GTK_BOX (expander_hbox), priv->attachment_expander_label,
+ TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (expander_hbox), priv->attachment_expander_icon,
+ TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (expander_hbox), priv->attachment_expander_num,
+ TRUE, TRUE, 0);
+ gtk_widget_show_all (expander_hbox);
+ gtk_widget_hide (priv->attachment_expander_icon);
+
+ priv->attachment_expander = e_expander_new ("");
+ e_expander_set_label_widget (E_EXPANDER (priv->attachment_expander), expander_hbox);
+
+ gtk_container_add (GTK_CONTAINER (priv->attachment_expander),
+ priv->attachment_scrolled_window);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (editor)->vbox), priv->attachment_expander,
+ FALSE, FALSE, GNOME_PAD_SMALL);
+ gtk_widget_show (priv->attachment_expander);
+ e_expander_set_expanded (E_EXPANDER (priv->attachment_expander), FALSE);
+ g_signal_connect_after (priv->attachment_expander, "activate",
+ G_CALLBACK (attachment_expander_activate_cb), editor);
+
+
}
/* Object initialization function for the calendar component editor */
@@ -1044,6 +1191,15 @@ fill_widgets (CompEditor *editor)
priv = editor->priv;
+ /*Check if attachments are available here and set them*/
+ if (e_cal_component_has_attachments (priv->comp)) {
+ GSList *attachment_list = NULL;
+ e_cal_component_get_attachment_list (priv->comp, &attachment_list);
+ cal_attachment_bar_set_attachment_list
+ ((CalAttachmentBar *)priv->attachment_bar, attachment_list);
+ e_expander_set_expanded (E_EXPANDER (priv->attachment_expander), TRUE);
+ }
+
for (l = priv->pages; l != NULL; l = l->next)
comp_editor_page_fill_widgets (l->data, priv->comp);
}
@@ -1085,6 +1241,8 @@ static void
real_edit_comp (CompEditor *editor, ECalComponent *comp)
{
CompEditorPrivate *priv;
+ char *source_url;
+ const char *uid;
g_return_if_fail (editor != NULL);
g_return_if_fail (IS_COMP_EDITOR (editor));
@@ -1105,6 +1263,13 @@ real_edit_comp (CompEditor *editor, ECalComponent *comp)
set_title_from_comp (editor);
set_icon_from_comp (editor);
+ e_cal_component_get_uid (comp, &uid);
+ source_url = g_strconcat (e_cal_get_uri (priv->client), "/", NULL);
+ /* The source_url and uid will be preserved by the callee and freed when
+ * the latter gets destroyed */
+ cal_attachment_bar_set_source_url (priv->attachment_bar, source_url);
+ cal_attachment_bar_set_comp_uid (priv->attachment_bar, g_strdup (uid));
+
fill_widgets (editor);
listen_for_changes (editor);
@@ -1122,21 +1287,56 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method)
priv = editor->priv;
- if (itip_send_comp (method, priv->comp, priv->client, NULL)) {
- tmp_comp = priv->comp;
- g_object_ref (tmp_comp);
- comp_editor_edit_comp (editor, tmp_comp);
- g_object_unref (tmp_comp);
-
- comp_editor_set_changed (editor, TRUE);
- save_comp (editor);
+ if (!e_cal_component_has_attachments (priv->comp)) {
+ if (itip_send_comp (method, priv->comp, priv->client,
+ NULL, NULL)) {
+ tmp_comp = priv->comp;
+ g_object_ref (tmp_comp);
+ comp_editor_edit_comp (editor, tmp_comp);
+ g_object_unref (tmp_comp);
+
+ comp_editor_set_changed (editor, TRUE);
+ save_comp (editor);
- return TRUE;
+ return TRUE;
+ }
+
+ } else {
+ /* Clone the component with attachments set to CID:... */
+ ECalComponent *send_comp;
+ int num_attachments, i;
+ GSList *attach_list = NULL;
+ GSList *mime_attach_list;
+
+ send_comp = e_cal_component_clone (priv->comp);
+ num_attachments = e_cal_component_get_num_attachments (send_comp);
+
+ for (i = 0; i < num_attachments ; i++) {
+ attach_list = g_slist_append (attach_list, g_strdup ("CID:..."));
+ }
+ e_cal_component_set_attachment_list (send_comp, attach_list);
+
+ /* mime_attach_list is freed by itip_send_comp */
+ mime_attach_list = comp_editor_get_mime_attach_list (editor);
+ if (itip_send_comp (method, send_comp, priv->client,
+ NULL, mime_attach_list)) {
+ tmp_comp = priv->comp;
+ g_object_ref (tmp_comp);
+ comp_editor_edit_comp (editor, tmp_comp);
+ g_object_unref (tmp_comp);
+
+ comp_editor_set_changed (editor, TRUE);
+ save_comp (editor);
+ g_object_unref (send_comp);
+ return TRUE;
+ }
+ g_object_unref (send_comp);
}
comp_editor_set_changed (editor, TRUE);
+
+ return FALSE;
- return FALSE;
}
@@ -1261,6 +1461,22 @@ comp_editor_close (CompEditor *editor)
return close;
}
+
+/* Utility function to get the mime-attachment list from the attachment
+ * bar for sending the comp via itip. The list and its contents must
+ * be freed by the caller.
+ */
+GSList *
+comp_editor_get_mime_attach_list (CompEditor *editor)
+{
+ GSList *mime_attach_list;
+
+ mime_attach_list = cal_attachment_bar_get_mime_attach_list
+ ((CalAttachmentBar *)editor->priv->attachment_bar);
+
+ return mime_attach_list;
+}
+
/* Brings attention to a window by raising it and giving it focus */
static void
raise_and_focus (GtkWidget *widget)
diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h
index 39966c70a7..ea6811e5a3 100644
--- a/calendar/gui/dialogs/comp-editor.h
+++ b/calendar/gui/dialogs/comp-editor.h
@@ -26,6 +26,7 @@
#include "../itip-utils.h"
#include "comp-editor-page.h"
#include "evolution-shell-component-utils.h"
+#include "cal-attachment-bar.h"
G_BEGIN_DECLS
@@ -90,6 +91,7 @@ gboolean comp_editor_save_comp (CompEditor *editor,
void comp_editor_delete_comp (CompEditor *editor);
gboolean comp_editor_send_comp (CompEditor *editor,
ECalComponentItipMethod method);
+GSList *comp_editor_get_mime_attach_list (CompEditor *editor);
gboolean comp_editor_close (CompEditor *editor);
void comp_editor_focus (CompEditor *editor);
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index a4edd680f9..1f266325bf 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -302,7 +302,8 @@ event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
gboolean result;
client = e_meeting_store_get_e_cal (priv->model);
- result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL);
+ result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp,
+ client, NULL, NULL);
g_object_unref (comp);
if (!result)
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index a0e251f8b8..a513bc25cf 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -286,7 +286,8 @@ task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
gboolean result;
client = e_meeting_store_get_e_cal (priv->model);
- result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL);
+ result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp,
+ client, NULL, NULL);
g_object_unref (comp);
if (!result)
diff --git a/calendar/gui/e-cal-model-calendar.c b/calendar/gui/e-cal-model-calendar.c
index 5284332f72..b64dce21c6 100644
--- a/calendar/gui/e-cal-model-calendar.c
+++ b/calendar/gui/e-cal-model-calendar.c
@@ -379,7 +379,8 @@ ecmc_set_value_at (ETableModel *etm, int col, int row, const void *value)
if (e_cal_modify_object (comp_data->client, comp_data->icalcomp, CALOBJ_MOD_ALL, NULL)) {
if (itip_organizer_is_user (comp, comp_data->client) &&
send_component_dialog (NULL, comp_data->client, comp, FALSE))
- itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, comp_data->client, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp,
+ comp_data->client, NULL, NULL);
} else {
g_warning (G_STRLOC ": Could not modify the object!");
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index e7847fe107..1141635308 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -1092,7 +1092,7 @@ e_calendar_table_on_forward (EPopup *ep, EPopupItem *pitem, void *data)
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
- itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL, NULL);
g_object_unref (comp);
}
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index c935cb3f6d..4d151e25fa 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -370,7 +370,7 @@ e_calendar_view_add_event (ECalendarView *cal_view, ECal *client, time_t dtstart
send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
client, comp, TRUE)) {
itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp,
- client, NULL);
+ client, NULL, NULL);
}
} else {
g_message (G_STRLOC ": Could not create the object!");
@@ -667,7 +667,7 @@ e_calendar_view_cut_clipboard (ECalendarView *cal_view)
&& cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
event->comp_data->client, comp, TRUE))
itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp,
- event->comp_data->client, NULL);
+ event->comp_data->client, NULL, NULL);
e_cal_component_get_uid (comp, &uid);
e_cal_remove_object (event->comp_data->client, uid, &error);
@@ -823,7 +823,7 @@ delete_event (ECalendarView *cal_view, ECalendarViewEvent *event)
event->comp_data->client,
comp, TRUE))
itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp,
- event->comp_data->client, NULL);
+ event->comp_data->client, NULL, NULL);
e_cal_component_get_uid (comp, &uid);
if (!uid || !*uid) {
@@ -933,7 +933,7 @@ e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view)
e_cal_component_free_datetime (&range.datetime);
}
- itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, event->comp_data->client, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, event->comp_data->client, NULL, NULL);
}
e_cal_remove_object_with_mod (event->comp_data->client, uid, rid, CALOBJ_MOD_THIS, &error);
@@ -1235,7 +1235,7 @@ on_forward (EPopup *ep, EPopupItem *pitem, void *data)
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, event->comp_data->client, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, event->comp_data->client, NULL, NULL);
g_list_free (selected);
g_object_unref (comp);
@@ -1661,7 +1661,7 @@ e_calendar_view_modify_and_send (ECalComponent *comp,
if (e_cal_modify_object (client, e_cal_component_get_icalcomponent (comp), mod, NULL)) {
if (itip_organizer_is_user (comp, client) &&
send_component_dialog (toplevel, client, comp, new))
- itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL, NULL);
} else {
g_message (G_STRLOC ": Could not update the object!");
}
diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c
index 9b2a40b9fe..f384fdbd66 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -468,6 +468,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
gint num_icons, icon_x, icon_y, icon_x_inc, icon_y_inc;
gint max_icon_w, max_icon_h;
gboolean draw_reminder_icon, draw_recurrence_icon, draw_timezone_icon, draw_meeting_icon;
+ gboolean draw_attach_icon;
GSList *categories_list, *elem;
ECalComponentTransparency transparency;
@@ -590,6 +591,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
draw_recurrence_icon = FALSE;
draw_timezone_icon = FALSE;
draw_meeting_icon = FALSE;
+ draw_attach_icon = FALSE;
icon_x = item_x + E_DAY_VIEW_BAR_WIDTH + E_DAY_VIEW_ICON_X_PAD;
icon_y = item_y + E_DAY_VIEW_EVENT_BORDER_HEIGHT
+ E_DAY_VIEW_ICON_Y_PAD;
@@ -603,7 +605,10 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
draw_recurrence_icon = TRUE;
num_icons++;
}
-
+ if (e_cal_component_has_attachments (comp)) {
+ draw_attach_icon = TRUE;
+ num_icons++;
+ }
/* If the DTSTART or DTEND are in a different timezone to our current
timezone, we display the timezone icon. */
if (event->different_timezone) {
@@ -678,7 +683,25 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
icon_x += icon_x_inc;
icon_y += icon_y_inc;
}
+ if (draw_attach_icon) {
+ max_icon_w = item_x + item_w - icon_x
+ - E_DAY_VIEW_EVENT_BORDER_WIDTH;
+ max_icon_h = item_y + item_h - icon_y
+ - E_DAY_VIEW_EVENT_BORDER_HEIGHT;
+ gdk_gc_set_clip_mask (gc, NULL);
+ gdk_draw_pixbuf (drawable, gc,
+ day_view->attach_icon,
+ 0, 0, icon_x, icon_y,
+ MIN (E_DAY_VIEW_ICON_WIDTH,
+ max_icon_w),
+ MIN (E_DAY_VIEW_ICON_HEIGHT,
+ max_icon_h),
+ GDK_RGB_DITHER_NORMAL,
+ 0, 0);
+ icon_x += icon_x_inc;
+ icon_y += icon_y_inc;
+ }
if (draw_timezone_icon) {
max_icon_w = item_x + item_w - icon_x
- E_DAY_VIEW_EVENT_BORDER_WIDTH;
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index c84ed2859c..a733a7ec17 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -534,6 +534,17 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
icon_x -= icon_x_inc;
}
+ if (icon_x <= max_icon_x && e_cal_component_has_attachments (comp)) {
+ gdk_gc_set_clip_mask (gc, NULL);
+ gdk_draw_pixbuf (drawable, gc,
+ day_view->attach_icon,
+ 0, 0, icon_x, icon_y,
+ E_DAY_VIEW_ICON_WIDTH,
+ E_DAY_VIEW_ICON_HEIGHT,
+ GDK_RGB_DITHER_NORMAL,
+ 0, 0);
+ icon_x -= icon_x_inc;
+ }
if (icon_x <= max_icon_x && e_cal_component_has_alarms (comp)) {
gdk_gc_set_clip_mask (gc, NULL);
gdk_draw_pixbuf (drawable, gc,
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index f675d797ad..fb5de111ee 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -1098,6 +1098,7 @@ e_day_view_realize (GtkWidget *widget)
day_view->recurrence_icon = e_icon_factory_get_icon ("stock_refresh", E_ICON_SIZE_MENU);
day_view->timezone_icon = e_icon_factory_get_icon ("stock_timezone", E_ICON_SIZE_MENU);
day_view->meeting_icon = e_icon_factory_get_icon ("stock_people", E_ICON_SIZE_MENU);
+ day_view->attach_icon = e_icon_factory_get_icon ("stock_attach", E_ICON_SIZE_MENU);
/* Set the canvas item colors. */
@@ -1184,6 +1185,8 @@ e_day_view_unrealize (GtkWidget *widget)
day_view->timezone_icon = NULL;
g_object_unref (day_view->meeting_icon);
day_view->meeting_icon = NULL;
+ g_object_unref (day_view->attach_icon);
+ day_view->attach_icon = NULL;
if (GTK_WIDGET_CLASS (e_day_view_parent_class)->unrealize)
(*GTK_WIDGET_CLASS (e_day_view_parent_class)->unrealize)(widget);
@@ -4282,7 +4285,8 @@ e_day_view_reshape_long_event (EDayView *day_view,
num_icons++;
if (e_cal_component_has_organizer (comp))
num_icons++;
-
+ if (e_cal_component_has_attachments (comp))
+ num_icons++;
e_cal_component_get_categories_list (comp, &categories_list);
for (elem = categories_list; elem; elem = elem->next) {
char *category;
@@ -4447,6 +4451,8 @@ e_day_view_reshape_day_event (EDayView *day_view,
num_icons++;
if (e_cal_component_has_recurrences (comp))
num_icons++;
+ if (e_cal_component_has_attachments (comp))
+ num_icons++;
if (event->different_timezone)
num_icons++;
if (e_cal_component_has_organizer (comp))
diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h
index 1d87d57211..4c563e4dbd 100644
--- a/calendar/gui/e-day-view.h
+++ b/calendar/gui/e-day-view.h
@@ -327,6 +327,7 @@ struct _EDayView
GdkPixbuf *recurrence_icon;
GdkPixbuf *timezone_icon;
GdkPixbuf *meeting_icon;
+ GdkPixbuf *attach_icon;
/* Colors for drawing. */
GdkColor colors[E_DAY_VIEW_COLOR_LAST];
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index 2ea9ed758b..77116834a1 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -2024,7 +2024,7 @@ send_item (EItipControl *itip)
comp = get_real_item (itip);
if (comp != NULL) {
- itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, priv->current_ecal, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, priv->current_ecal, NULL, NULL);
g_object_unref (comp);
dialog = gnome_ok_dialog (_("Item sent!\n"));
} else {
@@ -2070,7 +2070,7 @@ send_freebusy (EItipControl *itip)
for (l = comp_list; l; l = l->next) {
ECalComponent *comp = E_CAL_COMPONENT (l->data);
- itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, priv->current_ecal, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, priv->current_ecal, NULL, NULL);
g_object_unref (comp);
}
@@ -2510,7 +2510,7 @@ ok_clicked_cb (GtkWidget *widget, gpointer data)
g_slist_free (list);
e_cal_component_rescan (comp);
- itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, priv->current_ecal, priv->top_level);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, priv->current_ecal, priv->top_level, NULL);
g_object_unref (comp);
}
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index d088a416d5..e4ace7961e 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -596,7 +596,7 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem,
GdkGC *gc;
gint num_icons = 0, icon_x_inc;
gboolean draw_reminder_icon = FALSE, draw_recurrence_icon = FALSE;
- gboolean draw_timezone_icon = FALSE;
+ gboolean draw_timezone_icon = FALSE, draw_attach_icon = FALSE;
GSList *categories_list, *elem;
week_view = E_WEEK_VIEW (GTK_WIDGET (GNOME_CANVAS_ITEM (wveitem)->canvas)->parent);
@@ -619,7 +619,12 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem,
draw_recurrence_icon = TRUE;
num_icons++;
}
-
+
+ if (e_cal_component_has_attachments (comp)) {
+ draw_attach_icon = TRUE;
+ num_icons++;
+ }
+
if (event->different_timezone) {
draw_timezone_icon = TRUE;
num_icons++;
@@ -653,6 +658,18 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem,
icon_x += icon_x_inc;
}
+ if (draw_attach_icon && icon_x + E_WEEK_VIEW_ICON_WIDTH <= x2) {
+ gdk_gc_set_clip_mask (gc, NULL);
+ gdk_draw_pixbuf (drawable, gc,
+ week_view->attach_icon,
+ 0, 0, icon_x, icon_y,
+ E_WEEK_VIEW_ICON_WIDTH,
+ E_WEEK_VIEW_ICON_HEIGHT,
+ GDK_RGB_DITHER_NORMAL,
+ 0, 0);
+ icon_x += icon_x_inc;
+ }
+
if (draw_recurrence_icon && icon_x + E_WEEK_VIEW_ICON_WIDTH <= x2) {
gdk_gc_set_clip_mask (gc, NULL);
gdk_draw_pixbuf (drawable, gc,
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 17ebc66370..5ddc16ff28 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -699,6 +699,7 @@ e_week_view_realize (GtkWidget *widget)
week_view->reminder_icon = e_icon_factory_get_icon ("stock_bell", E_ICON_SIZE_MENU);
week_view->recurrence_icon = e_icon_factory_get_icon ("stock_refresh", E_ICON_SIZE_MENU);
week_view->timezone_icon = e_icon_factory_get_icon ("stock_timezone", E_ICON_SIZE_MENU);
+ week_view->attach_icon = e_icon_factory_get_icon ("stock_attach", E_ICON_SIZE_MENU);
}
static void
@@ -737,6 +738,8 @@ e_week_view_unrealize (GtkWidget *widget)
week_view->recurrence_icon = NULL;
g_object_unref (week_view->timezone_icon);
week_view->timezone_icon = NULL;
+ g_object_unref (week_view->attach_icon);
+ week_view->attach_icon = NULL;
if (GTK_WIDGET_CLASS (e_week_view_parent_class)->unrealize)
(*GTK_WIDGET_CLASS (e_week_view_parent_class)->unrealize)(widget);
@@ -2578,6 +2581,8 @@ e_week_view_reshape_event_span (EWeekView *week_view,
num_icons++;
if (e_cal_component_has_recurrences (comp))
num_icons++;
+ if (e_cal_component_has_attachments (comp))
+ num_icons++;
if (event->different_timezone)
num_icons++;
diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h
index 2b63748704..58ff08aa22 100644
--- a/calendar/gui/e-week-view.h
+++ b/calendar/gui/e-week-view.h
@@ -281,6 +281,7 @@ struct _EWeekView
/* The icons. */
GdkPixbuf *reminder_icon;
GdkPixbuf *recurrence_icon;
+ GdkPixbuf *attach_icon;
GdkPixbuf *timezone_icon;
/* Colors for drawing. */
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 9679cdcb45..36ddbea045 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -42,6 +42,7 @@
#include "e-util/e-passwords.h"
#include "calendar-config.h"
#include "itip-utils.h"
+#include "dialogs/cal-attachment.h"
#define GNOME_EVOLUTION_COMPOSER_OAFIID "OAFIID:GNOME_Evolution_Mail_Composer:" BASE_VERSION
@@ -823,9 +824,64 @@ comp_compliant (ECalComponentItipMethod method, ECalComponent *comp, ECal *clien
return clone;
}
+static gboolean
+append_cal_attachments (GNOME_Evolution_Composer composer_server, ECalComponent
+ *comp, GSList *attach_list)
+{
+ CORBA_char *content_type = NULL, *filename = NULL, *description = NULL;
+ CORBA_Environment ev;
+ GNOME_Evolution_Composer_AttachmentData *attach_data = NULL;
+ struct CalMimeAttach *mime_attach;
+ GSList *l;
+ gboolean retval = TRUE;
+
+ CORBA_exception_init (&ev);
+
+ for (l = attach_list; l ; l = l->next) {
+ mime_attach = (struct CalMimeAttach *) l->data;
+
+ filename = CORBA_string_dup (mime_attach->filename);
+ content_type = CORBA_string_dup (mime_attach->content_type);
+ description = CORBA_string_dup (mime_attach->description);
+
+ attach_data = GNOME_Evolution_Composer_AttachmentData__alloc ();
+ attach_data->_length = mime_attach->length;
+ attach_data->_maximum = attach_data->_length;
+ attach_data->_buffer = CORBA_sequence_CORBA_char_allocbuf (attach_data->_length);
+ memcpy (attach_data->_buffer, mime_attach->encoded_data, attach_data->_length);
+
+ GNOME_Evolution_Composer_attachData (composer_server,
+ content_type, filename, description,
+ TRUE, attach_data,
+ &ev);
+ if (BONOBO_EX (&ev)) {
+ g_warning ("Unable to add attachments in composer");
+ retval = FALSE;
+ }
+
+ CORBA_exception_free (&ev);
+ if (content_type != NULL)
+ CORBA_free (content_type);
+ if (filename != NULL)
+ CORBA_free (filename);
+ if (description != NULL)
+ CORBA_free (description);
+ if (attach_data != NULL) {
+ CORBA_free (attach_data->_buffer);
+ CORBA_free (attach_data);
+ }
+ g_free (mime_attach->filename);
+ g_free (mime_attach->content_type);
+ g_free (mime_attach->description);
+ g_free (mime_attach->encoded_data);
+ }
+
+ return retval;
+}
+
gboolean
itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp,
- ECal *client, icalcomponent *zones)
+ ECal *client, icalcomponent *zones, GSList *attachments_list)
{
GNOME_Evolution_Composer composer_server;
ECalComponent *comp = NULL;
@@ -932,7 +988,12 @@ itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp,
g_warning ("Unable to place iTip message in composer");
goto cleanup;
}
-
+
+ if (attachments_list) {
+ if (append_cal_attachments (composer_server, comp, attachments_list))
+ retval = TRUE;
+ }
+
if (method == E_CAL_COMPONENT_METHOD_PUBLISH) {
GNOME_Evolution_Composer_show (composer_server, &ev);
if (BONOBO_EX (&ev))
diff --git a/calendar/gui/itip-utils.h b/calendar/gui/itip-utils.h
index 936adfec8e..bfbd4ab6fc 100644
--- a/calendar/gui/itip-utils.h
+++ b/calendar/gui/itip-utils.h
@@ -29,7 +29,7 @@ gboolean itip_sentby_is_user (ECalComponent *comp);
const gchar *itip_strip_mailto (const gchar *address);
gboolean itip_send_comp (ECalComponentItipMethod method, ECalComponent *comp,
- ECal *client, icalcomponent *zones);
+ ECal *client, icalcomponent *zones, GSList *attachments_list);
gboolean itip_publish_comp (ECal *client, gchar* uri, gchar* username,
gchar* password, ECalComponent **pub_comp);