From 4f4615a46d5ba518c1e6a0c2412b1edf1e268d99 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 24 Nov 2008 05:14:44 +0000 Subject: Merge revisions 36737:36810 from trunk. svn path=/branches/kill-bonobo/; revision=36811 --- calendar/ChangeLog | 84 ++++++++++++++ calendar/gui/alarm-notify/alarm-notify-dialog.c | 28 ++++- calendar/gui/alarm-notify/alarm-notify-dialog.h | 3 +- calendar/gui/alarm-notify/alarm-notify.glade | 144 +++++++++++++++++++++++- calendar/gui/alarm-notify/alarm-queue.c | 9 +- calendar/gui/calendar-component.h | 1 + calendar/gui/dialogs/comp-editor.c | 4 +- calendar/gui/e-calendar-table.c | 10 ++ calendar/gui/e-calendar-view.c | 89 +++++++++++++++ calendar/gui/e-calendar-view.h | 1 + calendar/gui/e-day-view.c | 35 +++--- calendar/gui/e-week-view.c | 28 ++--- calendar/gui/gnome-cal.c | 41 ++++++- calendar/gui/memos-component.c | 50 ++------ calendar/gui/print.c | 2 +- calendar/gui/tasks-component.c | 63 ++++------- 16 files changed, 470 insertions(+), 122 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index b335913d39..a28754ad15 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,87 @@ +2008-11-19 Milan Crha + + ** Fix for bug #556224 + + * gui/gnome-cal.c: (struct _GnomeCalendarPrivate), (setup_widgets), + (update_todo_view_async), (update_todo_view), (gnome_calendar_init), + (gnome_calendar_destroy): Run always 'update_todo_view' in a separate + thread and guard its body with a mutex. + + * gui/gnome-cal.c: (update_query_async): Do not leak. + +2008-11-17 Matthew Barnes + + ** Fixes part of bug #557818 + + * gui/calendar-component.c: + * gui/memos-component.c: + * gui/tasks-component.c: + ESourceSelector now handles most of the drag-and-drop signals. + We just have to listen for the new "data-dropped" signal and + deal with it. Gets rid of a lot of duplicate logic. + +2008-11-17 Matthew Barnes + + ** Fixes part of bug #558322 + + * gui/calendar-component.c (rename_calendar_cb): + * gui/memos-component.c (rename_memo_list_cb): + * gui/tasks-component.c (rename_task_list_cb): + New "Rename" item in the source selector pop-up menu calls + the recently added e_source_selector_edit_primary_selection(). + Still need to bind the "F2" key to this action, but I'm not + sure how whether EPopup supports that. + +2008-11-11 Milan Crha + + ** Fix for bug #559604 + + * gui/e-calendar-view.h: (e_calendar_view_get_attendees_status_info): + * gui/e-calendar-view.c: (e_calendar_view_get_attendees_status_info), + (e_calendar_view_get_tooltips): + * gui/e-calendar-table.c: (query_tooltip_cb): + Show attendees' status in the tooltip if available. + +2008-11-11 Suman Manjunath + + ** Fix for bug #490503 + + * gui/e-day-view.c (set_text_as_bold), + (e_day_view_update_event_label), + (e_day_view_update_long_event_label): + * gui/e-week-view.c (set_text_as_bold), + (e_week_view_reshape_event_span): + Summary of unaccepted meetings in calendar views now appear as bolded. + If the meeting was sent to a mailing-list - the summary will always + appear as normal. + +2008-11-10 Suman Manjunath + + ** Fix for bug #443190 (bugzilla.novell.com) + + * gui/dialogs/comp-editor.c (fill_widgets), (real_edit_comp): + Block signals from attachment-bar while still filling the widgets. + +2008-11-07 Bharath Acharya + + ** Fix for bug #440007 (bugzilla.novell.com) + + * gui/print.c: (print_comp_draw_real): Print the attendees only if + its the first page. + +2008-11-04 Milan Crha + + ** Fix for bug #558354 + + * gui/alarm-notify/alarm-notify.glade: + * gui/alarm-notify/alarm-notify-dialog.h: (enum AlarmNotifyResult): + * gui/alarm-notify/alarm-notify-dialog.c: (struct AlarmNotify), + (dismiss_pressed_cb), (notified_alarms_dialog_new): + * gui/alarm-notify/alarm-queue.c: (notify_dialog_cb): + Changed "Close" button to "Dismiss All" and added a "Dismiss" button + to the alarm notification dialog to be able to dismiss only some of + the alarms shown in the dialog. + 2008-11-04 Matthew Barnes * gui/calendar-commands.c: diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.c b/calendar/gui/alarm-notify/alarm-notify-dialog.c index 61eea70f52..ee09c0dde4 100644 --- a/calendar/gui/alarm-notify/alarm-notify-dialog.c +++ b/calendar/gui/alarm-notify/alarm-notify-dialog.c @@ -67,6 +67,7 @@ typedef struct { GtkWidget *snooze_time_min; GtkWidget *snooze_time_hrs; GtkWidget *snooze_btn; + GtkWidget *dismiss_btn; GtkWidget *minutes_label; GtkWidget *hrs_label; GtkWidget *description; @@ -191,7 +192,30 @@ snooze_pressed_cb (GtkButton *button, gpointer user_data) if (!snooze_timeout) snooze_timeout = DEFAULT_SNOOZE_MINS; (* funcinfo->func) (ALARM_NOTIFY_SNOOZE, snooze_timeout, funcinfo->func_data); +} + +static void +dismiss_pressed_cb (GtkButton *button, gpointer user_data) +{ + AlarmNotify *an = user_data; + GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (an->treeview)); + + g_return_if_fail (model != NULL); + if (gtk_tree_model_iter_n_children (model, NULL) <= 1) { + gtk_dialog_response (GTK_DIALOG (an->dialog), GTK_RESPONSE_CLOSE); + } else { + GtkTreeIter iter; + AlarmFuncInfo *funcinfo = NULL; + GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (an->treeview)); + + if (gtk_tree_selection_get_selected (selection, &model, &iter)) + gtk_tree_model_get (model, &iter, ALARM_FUNCINFO_COLUMN, &funcinfo, -1); + + g_return_if_fail (funcinfo); + + (* funcinfo->func) (ALARM_NOTIFY_DISMISS, -1, funcinfo->func_data); + } } static void @@ -256,10 +280,11 @@ notified_alarms_dialog_new (void) an->scrolledwindow = glade_xml_get_widget (an->xml, "treeview-scrolledwindow"); snooze_btn = glade_xml_get_widget (an->xml, "snooze-button"); an->snooze_btn = snooze_btn; + an->dismiss_btn = glade_xml_get_widget (an->xml, "dismiss-button"); edit_btn = glade_xml_get_widget (an->xml, "edit-button"); if (!(an->dialog && an->scrolledwindow && an->treeview && an->snooze_time_min && an->snooze_time_hrs - && an->description && an->location && edit_btn && snooze_btn)) { + && an->description && an->location && edit_btn && snooze_btn && an->dismiss_btn)) { g_message ("alarm_notify_dialog(): Could not find all widgets in Glade file!"); g_object_unref (an->xml); g_free (an); @@ -292,6 +317,7 @@ notified_alarms_dialog_new (void) g_signal_connect (edit_btn, "clicked", G_CALLBACK (edit_pressed_cb), an); g_signal_connect (snooze_btn, "clicked", G_CALLBACK (snooze_pressed_cb), an); + g_signal_connect (an->dismiss_btn, "clicked", G_CALLBACK (dismiss_pressed_cb), an); g_signal_connect (G_OBJECT (an->dialog), "response", G_CALLBACK (dialog_response_cb), an); g_signal_connect (G_OBJECT (an->dialog), "destroy", G_CALLBACK (dialog_destroyed_cb), an); diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.h b/calendar/gui/alarm-notify/alarm-notify-dialog.h index 4b2a3d9c95..7a94793eaa 100644 --- a/calendar/gui/alarm-notify/alarm-notify-dialog.h +++ b/calendar/gui/alarm-notify/alarm-notify-dialog.h @@ -32,7 +32,8 @@ typedef enum { ALARM_NOTIFY_CLOSE, ALARM_NOTIFY_SNOOZE, - ALARM_NOTIFY_EDIT + ALARM_NOTIFY_EDIT, + ALARM_NOTIFY_DISMISS } AlarmNotifyResult; typedef struct _AlarmNotificationsDialog AlarmNotificationsDialog; diff --git a/calendar/gui/alarm-notify/alarm-notify.glade b/calendar/gui/alarm-notify/alarm-notify.glade index 539bd66269..df1b1f92a2 100644 --- a/calendar/gui/alarm-notify/alarm-notify.glade +++ b/calendar/gui/alarm-notify/alarm-notify.glade @@ -37,11 +37,73 @@ True True True - gtk-close - True GTK_RELIEF_NORMAL True -7 + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-close + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + Dismiss _All + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + @@ -527,6 +589,84 @@ False + + + + True + True + GTK_RELIEF_NORMAL + True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-apply + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Dismiss + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + 0 + False + False + + 0 diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index ad0abaa0e0..062c3acab5 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -1250,6 +1250,13 @@ notify_dialog_cb (AlarmNotifyResult result, int snooze_mins, gpointer data) break; + case ALARM_NOTIFY_DISMISS: + if (alarm_notifications_dialog) { + GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (alarm_notifications_dialog->treeview)); + gtk_list_store_remove (GTK_LIST_STORE (model), &tray_data->iter); + } + break; + case ALARM_NOTIFY_CLOSE: d(printf("%s:%d (notify_dialog_cb) - Dialog close\n",__FILE__, __LINE__)); if (alarm_notifications_dialog) { @@ -1270,7 +1277,7 @@ notify_dialog_cb (AlarmNotifyResult result, int snooze_mins, gpointer data) /* Task to remove the tray icons */ tray_list_remove_icons (); - } + } break; diff --git a/calendar/gui/calendar-component.h b/calendar/gui/calendar-component.h index 1e23bd52c1..5fbba8758e 100644 --- a/calendar/gui/calendar-component.h +++ b/calendar/gui/calendar-component.h @@ -26,6 +26,7 @@ #include #include +#include #include "Evolution.h" diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index c1f123e836..41e245ceef 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -2937,7 +2937,9 @@ fill_widgets (CompEditor *editor) if (e_cal_component_has_attachments (priv->comp)) { GSList *attachment_list = NULL; e_cal_component_get_attachment_list (priv->comp, &attachment_list); + g_signal_handlers_block_by_func(priv->attachment_bar, G_CALLBACK (attachment_bar_changed_cb), editor); set_attachment_list (editor, attachment_list); + g_signal_handlers_unblock_by_func(priv->attachment_bar, G_CALLBACK (attachment_bar_changed_cb), editor); g_slist_foreach (attachment_list, (GFunc)g_free, NULL); g_slist_free (attachment_list); } @@ -2950,7 +2952,6 @@ static void real_edit_comp (CompEditor *editor, ECalComponent *comp) { CompEditorPrivate *priv; - const char *uid; g_return_if_fail (IS_COMP_EDITOR (editor)); @@ -2969,7 +2970,6 @@ real_edit_comp (CompEditor *editor, ECalComponent *comp) priv->warned = FALSE; update_window_border (editor, NULL); - e_cal_component_get_uid (comp, &uid); fill_widgets (editor); diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 2929cddf9c..0189813af9 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -440,6 +440,16 @@ calendar_table_query_tooltip_cb (ECalendarTable *cal_table, e_cal_component_free_datetime (&dtstart); e_cal_component_free_datetime (&dtdue); + tmp = e_calendar_view_get_attendees_status_info (new_comp); + if (tmp) { + l = gtk_label_new (tmp); + gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5); + gtk_box_pack_start (GTK_BOX (w), l, FALSE, FALSE, 0); + + g_free (tmp); + tmp = NULL; + } + tmp2 = g_string_new (""); e_cal_component_get_description_list (new_comp, &desc); for (len = 0, p = desc; p != NULL; p = p->next) { diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 63740563f9..594527aee8 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -2034,6 +2034,83 @@ e_calendar_view_move_tip (GtkWidget *widget, int x, int y) gtk_widget_show (widget); } +/** + * Returns information about attendees in the component. If no attendees, then returns NULL. + * The information is like "Status: Accepted: X Declined: Y ...". + * Free returned pointer with g_free. + **/ +char * +e_calendar_view_get_attendees_status_info (ECalComponent *comp) +{ + struct _values { + icalparameter_partstat status; + const char *caption; + int count; + } values[] = { + { ICAL_PARTSTAT_ACCEPTED, N_("Accepted"), 0 }, + { ICAL_PARTSTAT_DECLINED, N_("Declined"), 0 }, + { ICAL_PARTSTAT_TENTATIVE, N_("Tentative"), 0 }, + { ICAL_PARTSTAT_DELEGATED, N_("Delegated"), 0 }, + { ICAL_PARTSTAT_NEEDSACTION, N_("Needs action"), 0 }, + { ICAL_PARTSTAT_NONE, N_("Other"), 0 }, + { ICAL_PARTSTAT_X, NULL, -1 } + }; + + GSList *attendees = NULL, *a; + gboolean have = FALSE; + char *res = NULL; + int i; + + if (!comp || !e_cal_component_has_attendees (comp)) + return NULL; + + e_cal_component_get_attendee_list (comp, &attendees); + + for (a = attendees; a; a = a->next) { + ECalComponentAttendee *att = a->data; + + if (att && att->cutype == ICAL_CUTYPE_INDIVIDUAL && + (att->role == ICAL_ROLE_CHAIR || + att->role == ICAL_ROLE_REQPARTICIPANT || + att->role == ICAL_ROLE_OPTPARTICIPANT)) { + have = TRUE; + + for (i = 0; values[i].count != -1; i++) { + if (att->status == values[i].status || values[i].status == ICAL_PARTSTAT_NONE) { + values[i].count++; + break; + } + } + } + } + + if (have) { + GString *str = g_string_new (""); + + for (i = 0; values[i].count != -1; i++) { + if (values[i].count > 0) { + if (str->str && *str->str) + g_string_append (str, " "); + + g_string_append_printf (str, "%s: %d", _(values[i].caption), values[i].count); + } + } + + g_string_prepend (str, ": "); + + /* To Translators: 'Status' here means the state of the attendees, the resulting string will be in a form: + Status: Accepted: X Declined: Y ... */ + g_string_prepend (str, _("Status")); + + res = g_string_free (str, FALSE); + } + + if (attendees) + e_cal_component_free_attendee_list (attendees); + + return res; +} + /* * It is expected to show the tooltips in this below format * @@ -2041,6 +2118,7 @@ e_calendar_view_move_tip (GtkWidget *widget, int x, int y) * Organiser: NameOfTheUser * Location: PlaceOfTheMeeting * Time : DateAndTime (xx Minutes) + * Status: Accepted: X Declined: Y ... */ gboolean @@ -2179,6 +2257,17 @@ e_calendar_view_get_tooltips (ECalendarViewEventData *data) g_free (tmp2); g_free (tmp1); + tmp = e_calendar_view_get_attendees_status_info (newcomp); + if (tmp) { + hbox = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start ((GtkBox *)hbox, gtk_label_new (tmp), FALSE, FALSE, 0); + ebox = gtk_event_box_new (); + gtk_container_add ((GtkContainer *)ebox, hbox); + gtk_box_pack_start ((GtkBox *)box, ebox, FALSE, FALSE, 0); + + g_free (tmp); + } + pevent->tooltip = gtk_window_new (GTK_WINDOW_POPUP); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type ((GtkFrame *)frame, GTK_SHADOW_IN); diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h index eb701aeffb..16a5548249 100644 --- a/calendar/gui/e-calendar-view.h +++ b/calendar/gui/e-calendar-view.h @@ -171,6 +171,7 @@ gboolean e_calendar_view_get_tooltips (ECalendarViewEventData *data); void e_calendar_view_move_tip (GtkWidget *widget, int x, int y); const gchar *e_calendar_view_get_icalcomponent_summary (ECal *ecal, icalcomponent *icalcomp, gboolean *free_text); +char *e_calendar_view_get_attendees_status_info (ECalComponent *comp); void draw_curved_rectangle (cairo_t *cr, double x0, diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 03cffc9d93..150e72e6c1 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -1776,41 +1776,38 @@ e_day_view_remove_event_cb (EDayView *day_view, return TRUE; } -#if 0 -/* Checks if the users participation status is Needs action and shows the summary as bold text*/ +/* Checks if the users participation status is NEEDS-ACTION and shows the summary as bold text */ static void set_text_as_bold (EDayViewEvent *event) { ECalComponent *comp; - char *address; - GSList *attendees, *l; + GSList *attendees = NULL, *l; + gchar *address; ECalComponentAttendee *at = NULL; comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); address = itip_get_comp_attendee (comp, event->comp_data->client); e_cal_component_get_attendee_list (comp, &attendees); - for (l = attendees; l; l = l->next) { ECalComponentAttendee *attendee = l->data; - if (g_str_equal (itip_strip_mailto (attendee->value), address)) { + if ((g_str_equal (itip_strip_mailto (attendee->value), address)) + || (attendee->sentby && g_str_equal (itip_strip_mailto (attendee->sentby), address))) { at = attendee; break; } } - - /* The attendee has not yet accepted the meeting, display the summary as bolded . - If the attendee is not present, it might have come through a mailing list*/ - if (!at || (at->status == ICAL_PARTSTAT_NEEDSACTION)) { - gnome_canvas_item_set (event->canvas_item, "bold", TRUE, NULL); - } - e_cal_component_free_attendee_list (attendees); - g_object_unref (comp); g_free (address); + g_object_unref (comp); + + /* The attendee has not yet accepted the meeting, display the summary as bolded. + If the attendee is not present, it might have come through a mailing list. + In that case, we never show the meeting as bold even if it is unaccepted. */ + if (at && (at->status == ICAL_PARTSTAT_NEEDSACTION)) + gnome_canvas_item_set (event->canvas_item, "bold", TRUE, NULL); } -#endif /* This updates the text shown for an event. If the event start or end do not lie on a row boundary, the time is displayed before the summary. */ @@ -1860,9 +1857,9 @@ e_day_view_update_event_label (EDayView *day_view, "text", text, NULL); -/* if (e_cal_get_static_capability (event->comp_data->client, CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING) + if (e_cal_get_static_capability (event->comp_data->client, CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING) && e_cal_util_component_has_attendee (event->comp_data->icalcomp)) - set_text_as_bold (event); */ + set_text_as_bold (event); if (free_text) g_free (text); @@ -1892,9 +1889,9 @@ e_day_view_update_long_event_label (EDayView *day_view, if (free_text) g_free ((gchar*)summary); -/* if (e_cal_get_static_capability (event->comp_data->client, CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING) + if (e_cal_get_static_capability (event->comp_data->client, CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING) && e_cal_util_component_has_attendee (event->comp_data->icalcomp)) - set_text_as_bold (event); */ + set_text_as_bold (event); } diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 6b9e43f581..2ac77a7be6 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -1878,41 +1878,38 @@ e_week_view_recalc_display_start_day (EWeekView *week_view) return FALSE; } -#if 0 -/* Checks if the users participation status is Needs action and shows the summary as bold text*/ +/* Checks if the users participation status is NEEDS-ACTION and shows the summary as bold text */ static void set_text_as_bold (EWeekViewEvent *event, EWeekViewEventSpan *span) { ECalComponent *comp; - char *address; - GSList *attendees, *l; + GSList *attendees = NULL, *l; + gchar *address; ECalComponentAttendee *at = NULL; comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); address = itip_get_comp_attendee (comp, event->comp_data->client); e_cal_component_get_attendee_list (comp, &attendees); - for (l = attendees; l; l = l->next) { ECalComponentAttendee *attendee = l->data; - if (g_str_equal (itip_strip_mailto (attendee->value), address)) { + if ((g_str_equal (itip_strip_mailto (attendee->value), address)) + || (attendee->sentby && g_str_equal (itip_strip_mailto (attendee->sentby), address))) { at = attendee; break; } } + e_cal_component_free_attendee_list (attendees); + g_free (address); + g_object_unref (comp); /* The attendee has not yet accepted the meeting, display the summary as bolded. - If the attendee is not present, it might have come through a mailing list*/ - if (!at || (at->status == ICAL_PARTSTAT_NEEDSACTION)) { + If the attendee is not present, it might have come through a mailing list. + In that case, we never show the meeting as bold even if it is unaccepted. */ + if (at && (at->status == ICAL_PARTSTAT_NEEDSACTION)) gnome_canvas_item_set (span->text_item, "bold", TRUE, NULL); - } - - e_cal_component_free_attendee_list (attendees); - g_object_unref (comp); - g_free (address); } -#endif /* This calls a given function for each event instance that matches the given uid. Note that it is safe for the callback to remove the event (since we @@ -2817,11 +2814,10 @@ e_week_view_reshape_event_span (EWeekView *week_view, if (free_text) g_free ((gchar*)summary); -/* Uncomment once the pango fix is in if (e_cal_get_static_capability (event->comp_data->client, CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING) && e_cal_util_component_has_attendee (event->comp_data->icalcomp)) { set_text_as_bold (event, span); - } */ + } g_object_set_data (G_OBJECT (span->text_item), "event-num", GINT_TO_POINTER (event_num)); g_signal_connect (span->text_item, "event", G_CALLBACK (e_week_view_on_text_item_event), diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index ca6fbe9721..a5ff34aa4f 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -179,6 +179,9 @@ struct _GnomeCalendarPrivate { /* We should know which calendar has been used to create object, so store it here before emitting "user_created" signal and make it NULL just after the emit. */ ECal *user_created_cal; + + /* used in update_todo_view, to prevent interleaving when called in separate thread */ + GMutex *todo_update_lock; }; /* Signal IDs */ @@ -738,6 +741,8 @@ update_query_async (struct _date_query_msg *msg) real_sexp = adjust_e_cal_view_sexp (gcal, priv->sexp); if (!real_sexp) { + g_object_unref (msg->gcal); + g_slice_free (struct _date_query_msg, msg); return; /* No time range is set, so don't start a query */ } @@ -1048,18 +1053,30 @@ timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer set_timezone (calendar); } +struct _mupdate_todo_msg { + Message header; + GnomeCalendar *gcal; +}; + static void -update_todo_view (GnomeCalendar *gcal) +update_todo_view_async (struct _mupdate_todo_msg *msg) { + GnomeCalendar *gcal; GnomeCalendarPrivate *priv; ECalModel *model; char *sexp = NULL; + g_return_if_fail (msg != NULL); + + gcal = msg->gcal; priv = gcal->priv; + g_mutex_lock (priv->todo_update_lock); + /* Set the query on the task pad */ if (priv->todo_sexp) { g_free (priv->todo_sexp); + priv->todo_sexp = NULL; } model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo)); @@ -1074,6 +1091,22 @@ update_todo_view (GnomeCalendar *gcal) e_cal_model_set_search_query (model, priv->todo_sexp); } + g_mutex_unlock (priv->todo_update_lock); + + g_object_unref (msg->gcal); + g_slice_free (struct _mupdate_todo_msg, msg); +} + +static void +update_todo_view (GnomeCalendar *gcal) +{ + struct _mupdate_todo_msg *msg; + + msg = g_slice_new0 (struct _mupdate_todo_msg); + msg->header.func = (MessageFunc) update_todo_view_async; + msg->gcal = g_object_ref (gcal); + + message_push ((Message *) msg); } static void @@ -1384,7 +1417,7 @@ setup_widgets (GnomeCalendar *gcal) gtk_widget_show (vbox); gtk_widget_show (sep); - update_todo_view (gcal); + /* update_todo_view (gcal); */ /* Timeout check to hide completed items */ priv->update_timeout = g_timeout_add_full (G_PRIORITY_LOW, 60000, (GSourceFunc) update_todo_view_cb, gcal, NULL); @@ -1500,6 +1533,8 @@ gnome_calendar_init (GnomeCalendar *gcal) e_categories_register_change_listener (G_CALLBACK (categories_changed_cb), gcal); + priv->todo_update_lock = g_mutex_new (); + priv->current_view_type = GNOME_CAL_DAY_VIEW; priv->range_selected = FALSE; priv->lview_select_daten_range = TRUE; @@ -1616,6 +1651,8 @@ gnome_calendar_destroy (GtkObject *object) g_signal_handlers_disconnect_by_func (cal_model, G_CALLBACK (view_done_cb), gcal); + g_mutex_free (priv->todo_update_lock); + g_free (priv); gcal->priv = NULL; } diff --git a/calendar/gui/memos-component.c b/calendar/gui/memos-component.c index 45974af517..4edce662a6 100644 --- a/calendar/gui/memos-component.c +++ b/calendar/gui/memos-component.c @@ -218,43 +218,21 @@ update_objects (ECal *client, icalcomponent *icalcomp) return TRUE; } -static void -selector_tree_drag_data_received (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *data, - guint info, - guint time, - gpointer user_data) +static gboolean +selector_tree_data_dropped (ESourceSelector *selector, + GtkSelectionData *data, + ESource *destination, + GdkDragAction action, + guint info, + MemosComponent *component) { - GtkTreePath *path = NULL; - GtkTreeViewDropPosition pos; - gpointer source = NULL; - GtkTreeModel *model; - GtkTreeIter iter; gboolean success = FALSE; icalcomponent *icalcomp = NULL; ECal *client = NULL; GSList *components, *p; - MemosComponent *component = MEMOS_COMPONENT (user_data); - - if (!gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (widget), - x, y, &path, &pos)) - goto finish; - - model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); - - if (!gtk_tree_model_get_iter (model, &iter, path)) - goto finish; - - - gtk_tree_model_get (model, &iter, 0, &source, -1); - - if (E_IS_SOURCE_GROUP (source) || e_source_get_readonly (source) || !data->data) - goto finish; - client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_JOURNAL); + client = auth_new_cal_from_source ( + destination, E_CAL_SOURCE_TYPE_JOURNAL); if (!client || !e_cal_open (client, TRUE, NULL)) goto finish; @@ -280,7 +258,7 @@ selector_tree_drag_data_received (GtkWidget *widget, continue; /* FIXME deal with GDK_ACTION_ASK */ - if (context->action == GDK_ACTION_COPY) { + if (action == GDK_ACTION_COPY) { old_uid = g_strdup (icalcomponent_get_uid (icalcomp)); uid = e_cal_component_gen_uid (); icalcomponent_set_uid (icalcomp, uid); @@ -297,7 +275,7 @@ selector_tree_drag_data_received (GtkWidget *widget, /* this will report success by last item, but we don't care */ success = update_objects (client, icalcomp); - if (success && context->action == GDK_ACTION_MOVE) { + if (success && action == GDK_ACTION_MOVE) { /* remove components rather here, because we know which has been moved */ ESource *source_source; ECal *source_client; @@ -337,12 +315,8 @@ selector_tree_drag_data_received (GtkWidget *widget, finish: if (client) g_object_unref (client); - if (source) - g_object_unref (source); - if (path) - gtk_tree_path_free (path); - gtk_drag_finish (context, success, success && context->action == GDK_ACTION_MOVE, time); + return success; } static void diff --git a/calendar/gui/print.c b/calendar/gui/print.c index 67b2f729b0..f3c6312e3f 100644 --- a/calendar/gui/print.c +++ b/calendar/gui/print.c @@ -2531,7 +2531,7 @@ print_comp_draw_real (GtkPrintOperation *operation, top += 20; /* Attendees */ - if (e_cal_component_has_attendees (comp)) { + if ((page_nr == 0) && e_cal_component_has_attendees (comp)) { top = bound_text (context, font, _("Attendees: "), -1, 0.0, top, width, height, FALSE, &page_start, &pages); pango_font_description_free (font); font = get_font_for_size (12, PANGO_WEIGHT_NORMAL); diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index c2ad3a45ef..d2424ed158 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -237,6 +237,16 @@ new_task_list_cb (EPopup *ep, EPopupItem *pitem, void *data) calendar_setup_new_task_list (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget))); } +static void +rename_task_list_cb (EPopup *ep, EPopupItem *pitem, void *data) +{ + TasksComponentView *component_view = data; + ESourceSelector *selector; + + selector = E_SOURCE_SELECTOR (component_view->source_selector); + e_source_selector_edit_primary_selection (selector); +} + static void edit_task_list_cb (EPopup *ep, EPopupItem *pitem, void *data) { @@ -278,6 +288,7 @@ mark_offline_cb (EPopup *ep, EPopupItem *pitem, void *data) static EPopupItem etc_source_popups[] = { { E_POPUP_ITEM, "10.new", N_("_New Task List"), new_task_list_cb, NULL, "stock_todo", 0, 0 }, { E_POPUP_ITEM, "15.copy", N_("_Copy..."), copy_task_list_cb, NULL, "edit-copy", 0, E_CAL_POPUP_SOURCE_PRIMARY }, + { E_POPUP_ITEM, "18.rename", N_("_Rename..."), rename_task_list_cb, NULL, NULL, 0, E_CAL_POPUP_SOURCE_PRIMARY }, { E_POPUP_BAR, "20.bar" }, { E_POPUP_ITEM, "20.delete", N_("_Delete"), delete_task_list_cb, NULL, "edit-delete", 0, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY }, @@ -397,43 +408,21 @@ update_objects (ECal *client, icalcomponent *icalcomp) return TRUE; } -static void -selector_tree_drag_data_received (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *data, - guint info, - guint time, - gpointer user_data) -{ - GtkTreePath *path = NULL; - GtkTreeViewDropPosition pos; - gpointer source = NULL; - GtkTreeModel *model; - GtkTreeIter iter; +static gboolean +selector_tree_data_dropped (ESourceSelector *selector, + GtkSelectionData *data, + ESource *destination, + GdkDragAction action, + guint info, + TasksComponent *component) +{ gboolean success = FALSE; icalcomponent *icalcomp = NULL; ECal *client = NULL; GSList *components, *p; - TasksComponent *component = TASKS_COMPONENT (user_data); - - if (!gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (widget), - x, y, &path, &pos)) - goto finish; - - model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); - - if (!gtk_tree_model_get_iter (model, &iter, path)) - goto finish; - - - gtk_tree_model_get (model, &iter, 0, &source, -1); - - if (E_IS_SOURCE_GROUP (source) || e_source_get_readonly (source) || !data->data) - goto finish; - client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_TODO); + client = auth_new_cal_from_source ( + destination, E_CAL_SOURCE_TYPE_TODO); if (!client || !e_cal_open (client, TRUE, NULL)) goto finish; @@ -459,7 +448,7 @@ selector_tree_drag_data_received (GtkWidget *widget, continue; /* FIXME deal with GDK_ACTION_ASK */ - if (context->action == GDK_ACTION_COPY) { + if (action == GDK_ACTION_COPY) { old_uid = g_strdup (icalcomponent_get_uid (icalcomp)); uid = e_cal_component_gen_uid (); icalcomponent_set_uid (icalcomp, uid); @@ -476,7 +465,7 @@ selector_tree_drag_data_received (GtkWidget *widget, /* this will report success by last item, but we don't care */ success = update_objects (client, icalcomp); - if (success && context->action == GDK_ACTION_MOVE) { + if (success && action == GDK_ACTION_MOVE) { /* remove components rather here, because we know which has been moved */ ESource *source_source; ECal *source_client; @@ -516,12 +505,8 @@ selector_tree_drag_data_received (GtkWidget *widget, finish: if (client) g_object_unref (client); - if (source) - g_object_unref (source); - if (path) - gtk_tree_path_free (path); - gtk_drag_finish (context, success, context->action == GDK_ACTION_MOVE, time); + return success; } static void -- cgit v1.2.3