aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-04-26 11:48:39 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-04-26 12:04:39 +0800
commit831e7616c7aee818a304c962bf6007d03a29c2ed (patch)
tree7395926683411b6eee2a8595c68c0cdae184f498 /calendar
parent6c62a6cc48086f50f9c957f9720ef75a416f8305 (diff)
downloadgsoc2013-evolution-831e7616c7aee818a304c962bf6007d03a29c2ed.tar.gz
gsoc2013-evolution-831e7616c7aee818a304c962bf6007d03a29c2ed.tar.zst
gsoc2013-evolution-831e7616c7aee818a304c962bf6007d03a29c2ed.zip
CompEditor cleanups.
Random cleanups from the account-mgmt branch, to reduce diff noise.
Diffstat (limited to 'calendar')
-rw-r--r--calendar/gui/dialogs/comp-editor-page.c31
-rw-r--r--calendar/gui/dialogs/comp-editor-page.h33
-rw-r--r--calendar/gui/dialogs/event-editor.c3
-rw-r--r--calendar/gui/dialogs/event-page.c819
-rw-r--r--calendar/gui/dialogs/event-page.h2
-rw-r--r--calendar/gui/dialogs/task-editor.c56
-rw-r--r--calendar/gui/dialogs/task-page.c568
-rw-r--r--calendar/gui/dialogs/task-page.h2
8 files changed, 768 insertions, 746 deletions
diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c
index a18b82c940..89adf7c491 100644
--- a/calendar/gui/dialogs/comp-editor-page.c
+++ b/calendar/gui/dialogs/comp-editor-page.c
@@ -129,15 +129,6 @@ comp_editor_page_class_init (CompEditorPageClass *class)
object_class->get_property = comp_editor_page_get_property;
object_class->dispose = comp_editor_page_dispose;
- class->dates_changed = NULL;
-
- class->get_widget = NULL;
- class->focus_main_widget = NULL;
- class->fill_widgets = NULL;
- class->fill_component = NULL;
- class->fill_timezones = NULL;
- class->set_dates = NULL;
-
g_object_class_install_property (
object_class,
PROP_EDITOR,
@@ -400,6 +391,28 @@ comp_editor_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
}
/**
+ * comp_editor_page_add_attendee:
+ * @page: a #CompEditorPage
+ * @attendee: an #EMeetingAttendee
+ *
+ * Adds @attendee to an internal meeting store.
+ **/
+void
+comp_editor_page_add_attendee (CompEditorPage *page,
+ EMeetingAttendee *attendee)
+{
+ CompEditorPageClass *class;
+
+ g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
+ g_return_if_fail (E_IS_MEETING_ATTENDEE (attendee));
+
+ class = COMP_EDITOR_PAGE_GET_CLASS (page);
+ g_return_if_fail (class->add_attendee != NULL);
+
+ class->add_attendee (page, attendee);
+}
+
+/**
* comp_editor_page_notify_dates_changed:
* @page: An editor page.
*
diff --git a/calendar/gui/dialogs/comp-editor-page.h b/calendar/gui/dialogs/comp-editor-page.h
index a58da9b804..2b9f7a4467 100644
--- a/calendar/gui/dialogs/comp-editor-page.h
+++ b/calendar/gui/dialogs/comp-editor-page.h
@@ -30,6 +30,8 @@
#include <libecal/e-cal-component.h>
#include <libecal/e-cal.h>
+#include <calendar/gui/e-meeting-attendee.h>
+
/* Standard GObject macros */
#define TYPE_COMP_EDITOR_PAGE \
(comp_editor_page_get_type ())
@@ -80,20 +82,23 @@ struct _CompEditorPage {
struct _CompEditorPageClass {
GObjectClass parent_class;
- /* Notification signals */
-
- void (* dates_changed) (CompEditorPage *page, const gchar *dates);
-
- /* Virtual methods */
-
- GtkWidget *(* get_widget) (CompEditorPage *page);
- void (* focus_main_widget) (CompEditorPage *page);
-
- gboolean (* fill_widgets) (CompEditorPage *page, ECalComponent *comp);
- gboolean (* fill_component) (CompEditorPage *page, ECalComponent *comp);
- gboolean (* fill_timezones) (CompEditorPage *page, GHashTable *timezones);
+ /* Signals */
+ void (*dates_changed) (CompEditorPage *page,
+ const gchar *dates);
- void (* set_dates) (CompEditorPage *page, CompEditorPageDates *dates);
+ /* Methods */
+ GtkWidget * (*get_widget) (CompEditorPage *page);
+ void (*focus_main_widget) (CompEditorPage *page);
+ gboolean (*fill_widgets) (CompEditorPage *page,
+ ECalComponent *comp);
+ gboolean (*fill_component) (CompEditorPage *page,
+ ECalComponent *comp);
+ gboolean (*fill_timezones) (CompEditorPage *page,
+ GHashTable *timezones);
+ void (*set_dates) (CompEditorPage *page,
+ CompEditorPageDates *dates);
+ void (*add_attendee) (CompEditorPage *page,
+ EMeetingAttendee *attendee);
};
GType comp_editor_page_get_type (void);
@@ -114,6 +119,8 @@ gboolean comp_editor_page_fill_timezones (CompEditorPage *page,
GHashTable *timezones);
void comp_editor_page_set_dates (CompEditorPage *page,
CompEditorPageDates *dates);
+void comp_editor_page_add_attendee (CompEditorPage *page,
+ EMeetingAttendee *attendee);
void comp_editor_page_notify_dates_changed
(CompEditorPage *page,
CompEditorPageDates *dates);
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 3e146ed96d..808df901d3 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -665,7 +665,8 @@ event_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
e_meeting_attendee_set_edit_level (
ia, E_MEETING_ATTENDEE_EDIT_NONE);
- event_page_add_attendee (priv->event_page, ia);
+ comp_editor_page_add_attendee (
+ COMP_EDITOR_PAGE (priv->event_page), ia);
g_object_unref (ia);
}
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index f9583538f2..ccbbcd03bb 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -58,6 +58,10 @@
#include "event-page.h"
#include "e-send-options-utils.h"
+#define EVENT_PAGE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), TYPE_EVENT_PAGE, EventPagePrivate))
+
enum {
ALARM_NONE,
ALARM_15_MINUTES,
@@ -187,11 +191,6 @@ struct _EventPagePrivate {
const gint *alarm_map;
};
-static GtkWidget *event_page_get_widget (CompEditorPage *page);
-static void event_page_focus_main_widget (CompEditorPage *page);
-static gboolean event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
-static gboolean event_page_fill_component (CompEditorPage *page, ECalComponent *comp);
-static gboolean event_page_fill_timezones (CompEditorPage *page, GHashTable *timezones);
static void event_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates);
static void notify_dates_changed (EventPage *epage, struct icaltimetype *start_tt, struct icaltimetype *end_tt);
static gboolean check_start_before_end (struct icaltimetype *start_tt, icaltimezone *start_zone,
@@ -206,120 +205,40 @@ static void set_subscriber_info_string (EventPage *epage, const gchar *backend_a
G_DEFINE_TYPE (EventPage, event_page, TYPE_COMP_EDITOR_PAGE)
-static void
-event_page_dispose (GObject *object)
+static EAccount *
+get_current_account (EventPage *epage)
{
EventPagePrivate *priv;
+ EIterator *it;
+ const gchar *str;
- priv = EVENT_PAGE (object)->priv;
+ priv = epage->priv;
- if (priv->comp != NULL) {
- g_object_unref (priv->comp);
- priv->comp = NULL;
- }
+ str = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer))));
+ if (!str)
+ return NULL;
- if (priv->main != NULL) {
- g_object_unref (priv->main);
- priv->main = NULL;
- }
+ for (it = e_list_get_iterator ((EList *)priv->accounts); e_iterator_is_valid (it); e_iterator_next (it)) {
+ EAccount *a = (EAccount *)e_iterator_get (it);
+ gchar *full = g_strdup_printf("%s <%s>", a->id->name, a->id->address);
- if (priv->builder != NULL) {
- g_object_unref (priv->builder);
- priv->builder = NULL;
- }
+ if (!g_ascii_strcasecmp (full, str)) {
+ g_free (full);
+ g_object_unref (it);
- if (priv->alarm_list_store != NULL) {
- g_object_unref (priv->alarm_list_store);
- priv->alarm_list_store = NULL;
- }
+ return a;
+ }
- if (priv->sod != NULL) {
- g_object_unref (priv->sod);
- priv->sod = NULL;
+ g_free (full);
}
+ g_object_unref (it);
- /* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (event_page_parent_class)->dispose (object);
-}
-
-static void
-event_page_finalize (GObject *object)
-{
- EventPagePrivate *priv;
-
- priv = EVENT_PAGE (object)->priv;
-
- g_list_foreach (priv->address_strings, (GFunc) g_free, NULL);
- g_list_free (priv->address_strings);
-
- g_ptr_array_foreach (
- priv->deleted_attendees, (GFunc) g_object_unref, NULL);
- g_ptr_array_free (priv->deleted_attendees, TRUE);
-
- g_free (priv->old_summary);
- g_free (priv->subscriber_info_text);
-
- priv->alarm_list_dlg_widget = NULL;
-
- /* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (event_page_parent_class)->finalize (object);
-}
-
-static void
-event_page_class_init (EventPageClass *class)
-{
- GObjectClass *object_class;
- CompEditorPageClass *editor_page_class;
-
- g_type_class_add_private (class, sizeof (EventPagePrivate));
-
- object_class = G_OBJECT_CLASS (class);
- object_class->dispose = event_page_dispose;
- object_class->finalize = event_page_finalize;
-
- editor_page_class = COMP_EDITOR_PAGE_CLASS (class);
- editor_page_class->get_widget = event_page_get_widget;
- editor_page_class->focus_main_widget = event_page_focus_main_widget;
- editor_page_class->fill_widgets = event_page_fill_widgets;
- editor_page_class->fill_component = event_page_fill_component;
- editor_page_class->fill_timezones = event_page_fill_timezones;
- editor_page_class->set_dates = event_page_set_dates;
-}
-
-static void
-event_page_init (EventPage *epage)
-{
- epage->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- epage, TYPE_EVENT_PAGE, EventPagePrivate);
- epage->priv->deleted_attendees = g_ptr_array_new ();
- epage->priv->alarm_interval = -1;
- epage->priv->alarm_map = alarm_map_with_user_time;
-}
-
-static void
-set_busy_time_menu (EventPage *epage, gboolean active)
-{
- CompEditor *editor;
- GtkAction *action;
-
- editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
- action = comp_editor_get_action (editor, "show-time-busy");
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
-}
-
-static void
-enable_busy_time_menu (EventPage *epage, gboolean sensitive)
-{
- CompEditor *editor;
- GtkAction *action;
-
- editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
- action = comp_editor_get_action (editor, "show-time-busy");
- gtk_action_set_sensitive (action, sensitive);
+ return NULL;
}
static void
-set_all_day_event_menu (EventPage *epage, gboolean active)
+set_all_day_event_menu (EventPage *epage,
+ gboolean active)
{
CompEditor *editor;
GtkAction *action;
@@ -329,148 +248,50 @@ set_all_day_event_menu (EventPage *epage, gboolean active)
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
}
-/* get_widget handler for the event page */
-static GtkWidget *
-event_page_get_widget (CompEditorPage *page)
-{
- EventPagePrivate *priv;
-
- priv = EVENT_PAGE (page)->priv;
-
- return priv->main;
-}
-
-/* focus_main_widget handler for the event page */
-static void
-event_page_focus_main_widget (CompEditorPage *page)
-{
- EventPagePrivate *priv;
-
- priv = EVENT_PAGE (page)->priv;
-
- gtk_widget_grab_focus (priv->summary);
-}
-
/* Sets the 'All Day Event' flag to the given value (without emitting signals),
* and shows or hides the widgets as appropriate. */
static void
-set_all_day (EventPage *epage, gboolean all_day)
+set_all_day (EventPage *epage,
+ gboolean all_day)
{
- EventPagePrivate *priv;
-
- priv = epage->priv;
-
set_all_day_event_menu (epage, all_day);
/* TODO implement for in end time selector */
if (all_day)
- gtk_combo_box_set_active (GTK_COMBO_BOX (priv->end_time_combo), 1);
- gtk_widget_set_sensitive (priv->end_time_combo, !all_day);
-
- e_date_edit_set_show_time (E_DATE_EDIT (priv->start_time), !all_day);
- e_date_edit_set_show_time (E_DATE_EDIT (priv->end_time), !all_day);
+ gtk_combo_box_set_active (
+ GTK_COMBO_BOX (epage->priv->end_time_combo), 1);
+ gtk_widget_set_sensitive (epage->priv->end_time_combo, !all_day);
+ e_date_edit_set_show_time (
+ E_DATE_EDIT (epage->priv->start_time), !all_day);
+ e_date_edit_set_show_time (
+ E_DATE_EDIT (epage->priv->end_time), !all_day);
}
static void
-update_time (EventPage *epage,
- ECalComponentDateTime *start_date,
- ECalComponentDateTime *end_date)
+enable_busy_time_menu (EventPage *epage,
+ gboolean sensitive)
{
- EventPagePrivate *priv = epage->priv;
CompEditor *editor;
- ECal *client;
GtkAction *action;
- struct icaltimetype *start_tt, *end_tt, implied_tt;
- icaltimezone *start_zone = NULL, *def_zone = NULL;
- gboolean all_day_event, homezone=TRUE;
- gboolean show_timezone;
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
- client = comp_editor_get_client (editor);
-
- /* Note that if we are creating a new event, the timezones may not be
- on the server, so we try to get the builtin timezone with the TZID
- first. */
- start_zone = icaltimezone_get_builtin_timezone_from_tzid (start_date->tzid);
- if (!start_zone) {
- /* FIXME: Handle error better. */
- if (!e_cal_get_timezone (client, start_date->tzid, &start_zone, NULL)) {
- g_warning ("Couldn't get timezone from server: %s",
- start_date->tzid ? start_date->tzid : "");
- }
- }
-
- /* If both times are DATE values, we set the 'All Day Event' checkbox.
- Also, if DTEND is after DTSTART, we subtract 1 day from it. */
- all_day_event = FALSE;
- start_tt = start_date->value;
- end_tt = end_date->value;
- if (!end_tt && start_tt->is_date) {
- end_tt = &implied_tt;
- *end_tt = *start_tt;
- icaltime_adjust (end_tt, 1, 0, 0, 0);
- }
-
- if (start_tt->is_date && end_tt->is_date) {
- all_day_event = TRUE;
- if (icaltime_compare_date_only (*end_tt, *start_tt) > 0) {
- icaltime_adjust (end_tt, -1, 0, 0, 0);
- }
- }
-
- epage->priv->all_day_event = all_day_event;
- set_all_day (epage, all_day_event);
-
- /* If it is an all day event, we set both timezones to the current
- timezone, so that if the user toggles the 'All Day Event' checkbox
- the event uses the current timezone rather than none at all. */
- if (all_day_event)
- start_zone = e_meeting_store_get_timezone (
- epage->priv->meeting_store);
-
- g_signal_handlers_block_matched (priv->start_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage);
- g_signal_handlers_block_matched (priv->end_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage);
-
- e_date_edit_set_date (E_DATE_EDIT (priv->start_time), start_tt->year,
- start_tt->month, start_tt->day);
- e_date_edit_set_time_of_day (E_DATE_EDIT (priv->start_time),
- start_tt->hour, start_tt->minute);
-
- e_date_edit_set_date (E_DATE_EDIT (priv->end_time), end_tt->year,
- end_tt->month, end_tt->day);
- e_date_edit_set_time_of_day (E_DATE_EDIT (priv->end_time),
- end_tt->hour, end_tt->minute);
-
- g_signal_handlers_unblock_matched (priv->start_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage);
- g_signal_handlers_unblock_matched (priv->end_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage);
-
- /* Set the timezones, and set sync_timezones to TRUE if both timezones
- are the same. */
- g_signal_handlers_block_matched (priv->start_timezone, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage);
- g_signal_handlers_block_matched (priv->end_timezone, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage);
-
- if (start_zone)
- e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->start_timezone),
- start_zone);
- def_zone = e_meeting_store_get_timezone (epage->priv->meeting_store);
- if (!def_zone || !start_zone || strcmp (icaltimezone_get_tzid (def_zone), icaltimezone_get_tzid (start_zone)))
- homezone = FALSE;
-
- action = comp_editor_get_action (editor, "view-time-zone");
- show_timezone = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- event_page_set_show_timezone (epage, (show_timezone || !homezone) & !all_day_event);
-
- /*unblock the endtimezone widget*/
- g_signal_handlers_unblock_matched (priv->end_timezone, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage);
- g_signal_handlers_unblock_matched (priv->start_timezone, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage);
+ action = comp_editor_get_action (editor, "show-time-busy");
+ gtk_action_set_sensitive (action, sensitive);
+}
- priv->sync_timezones = TRUE;
+static void
+set_busy_time_menu (EventPage *epage,
+ gboolean active)
+{
+ CompEditor *editor;
+ GtkAction *action;
- update_end_time_combo (epage);
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ action = comp_editor_get_action (editor, "show-time-busy");
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
}
-/* Fills the widgets with default values */
static void
clear_widgets (EventPage *epage)
{
@@ -513,7 +334,11 @@ clear_widgets (EventPage *epage)
}
static gboolean
-is_custom_alarm (ECalComponentAlarm *ca, gchar *old_summary, EDurationType user_units, gint user_interval, gint *alarm_type)
+is_custom_alarm (ECalComponentAlarm *ca,
+ gchar *old_summary,
+ EDurationType user_units,
+ gint user_interval,
+ gint *alarm_type)
{
ECalComponentAlarmTrigger trigger;
ECalComponentAlarmRepeat repeat;
@@ -632,23 +457,11 @@ is_custom_alarm (ECalComponentAlarm *ca, gchar *old_summary, EDurationType user_
}
static gboolean
-is_custom_alarm_uid_list (ECalComponent *comp, GList *alarms, gchar *old_summary, EDurationType user_units, gint user_interval, gint *alarm_type)
-{
- ECalComponentAlarm *ca;
- gboolean result;
-
- if (g_list_length (alarms) > 1)
- return TRUE;
-
- ca = e_cal_component_get_alarm (comp, alarms->data);
- result = is_custom_alarm (ca, old_summary, user_units, user_interval, alarm_type);
- e_cal_component_alarm_free (ca);
-
- return result;
-}
-
-static gboolean
-is_custom_alarm_store (EAlarmList *alarm_list_store, gchar *old_summary, EDurationType user_units, gint user_interval, gint *alarm_type)
+is_custom_alarm_store (EAlarmList *alarm_list_store,
+ gchar *old_summary,
+ EDurationType user_units,
+ gint user_interval,
+ gint *alarm_type)
{
const ECalComponentAlarm *alarm;
GtkTreeModel *model;
@@ -672,45 +485,69 @@ is_custom_alarm_store (EAlarmList *alarm_list_store, gchar *old_summary, EDurat
return FALSE;
}
-void
-event_page_set_view_role (EventPage *epage, gboolean state)
+static gboolean
+is_custom_alarm_uid_list (ECalComponent *comp,
+ GList *alarms,
+ gchar *old_summary,
+ EDurationType user_units,
+ gint user_interval,
+ gint *alarm_type)
{
- EventPagePrivate *priv = epage->priv;
+ ECalComponentAlarm *ca;
+ gboolean result;
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ROLE_COL, state);
-}
+ if (g_list_length (alarms) > 1)
+ return TRUE;
-void
-event_page_set_view_status (EventPage *epage, gboolean state)
-{
- EventPagePrivate *priv = epage->priv;
+ ca = e_cal_component_get_alarm (comp, alarms->data);
+ result = is_custom_alarm (
+ ca, old_summary, user_units, user_interval, alarm_type);
+ e_cal_component_alarm_free (ca);
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_STATUS_COL, state);
+ return result;
}
-void
-event_page_set_view_type (EventPage *epage, gboolean state)
+/* returns whether changed info text */
+static gboolean
+check_starts_in_the_past (EventPage *epage)
{
- EventPagePrivate *priv = epage->priv;
+ EventPagePrivate *priv;
+ struct icaltimetype start_tt = icaltime_null_time ();
+ gboolean date_set;
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_TYPE_COL, state);
-}
+ if ((comp_editor_get_flags (comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage))) & COMP_EDITOR_NEW_ITEM) == 0)
+ return FALSE;
-void
-event_page_set_view_rsvp (EventPage *epage, gboolean state)
-{
- EventPagePrivate *priv = epage->priv;
+ priv = epage->priv;
+ date_set = e_date_edit_get_date (E_DATE_EDIT (priv->start_time), &start_tt.year, &start_tt.month, &start_tt.day);
+
+ g_return_val_if_fail (date_set, FALSE);
+
+ if (priv->all_day_event) {
+ start_tt.is_date = TRUE;
+ } else {
+ e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_time), &start_tt.hour, &start_tt.minute);
+ start_tt.zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
+ }
+
+ if (comp_editor_test_time_in_the_past (start_tt)) {
+ gchar *tmp = g_strconcat ("<b>", _("Event's start time is in the past"), "</b>", NULL);
+ event_page_set_info_string (epage, GTK_STOCK_DIALOG_WARNING, tmp);
+ g_free (tmp);
+ } else {
+ event_page_set_info_string (epage, NULL, NULL);
+ }
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_RSVP_COL, state);
+ return TRUE;
}
static void
-alarm_image_button_clicked_cb (GtkWidget *button, EventPage *epage)
+alarm_image_button_clicked_cb (GtkWidget *button,
+ EventPage *epage)
{
CompEditor *editor;
GtkAction *action;
- g_return_if_fail (epage != NULL);
g_return_if_fail (IS_EVENT_PAGE (epage));
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
@@ -719,7 +556,9 @@ alarm_image_button_clicked_cb (GtkWidget *button, EventPage *epage)
}
static GtkWidget *
-create_alarm_image_button (const gchar *image_text, const gchar *tip_text, EventPage *epage)
+create_alarm_image_button (const gchar *image_text,
+ const gchar *tip_text,
+ EventPage *epage)
{
GtkWidget *image, *button;
@@ -733,46 +572,13 @@ create_alarm_image_button (const gchar *image_text, const gchar *tip_text, Event
gtk_widget_show_all (button);
gtk_widget_set_tooltip_text (button, tip_text);
- g_signal_connect (button, "clicked", G_CALLBACK (alarm_image_button_clicked_cb), epage);
+ g_signal_connect (
+ button, "clicked",
+ G_CALLBACK (alarm_image_button_clicked_cb), epage);
return button;
}
-/* returns whether changed info text */
-static gboolean
-check_starts_in_the_past (EventPage *epage)
-{
- EventPagePrivate *priv;
- struct icaltimetype start_tt = icaltime_null_time ();
- gboolean date_set;
-
- if ((comp_editor_get_flags (comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage))) & COMP_EDITOR_NEW_ITEM) == 0)
- return FALSE;
-
- priv = epage->priv;
- date_set = e_date_edit_get_date (E_DATE_EDIT (priv->start_time), &start_tt.year, &start_tt.month, &start_tt.day);
-
- g_return_val_if_fail (date_set, FALSE);
-
- if (priv->all_day_event) {
- start_tt.is_date = TRUE;
- } else {
- e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_time), &start_tt.hour, &start_tt.minute);
- start_tt.zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
- }
-
- if (comp_editor_test_time_in_the_past (start_tt)) {
- gchar *tmp = g_strconcat ("<b>", _("Event's start time is in the past"), "</b>",
- priv->subscriber_info_text ? "\n" : "", priv->subscriber_info_text, NULL);
- event_page_set_info_string (epage, GTK_STOCK_DIALOG_WARNING, tmp);
- g_free (tmp);
- } else {
- event_page_set_info_string (epage, priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, priv->subscriber_info_text);
- }
-
- return TRUE;
-}
-
static void
sensitize_widgets (EventPage *epage)
{
@@ -888,85 +694,124 @@ sensitize_widgets (EventPage *epage)
gtk_widget_show (priv->organizer);
gtk_label_set_text_with_mnemonic ((GtkLabel *) priv->org_cal_label, _("Or_ganizer:"));
}
-
}
-void
-event_page_hide_options (EventPage *page)
-{
- CompEditor *editor;
- GtkAction *action;
-
- g_return_if_fail (IS_EVENT_PAGE (page));
-
- editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
- action = comp_editor_get_action (editor, "send-options");
- gtk_action_set_visible (action, FALSE);
-}
-
-void
-event_page_show_options (EventPage *page)
+static void
+update_time (EventPage *epage,
+ ECalComponentDateTime *start_date,
+ ECalComponentDateTime *end_date)
{
CompEditor *editor;
+ ECal *client;
GtkAction *action;
+ struct icaltimetype *start_tt, *end_tt, implied_tt;
+ icaltimezone *start_zone = NULL, *def_zone = NULL;
+ gboolean all_day_event, homezone=TRUE;
+ gboolean show_timezone;
- g_return_if_fail (IS_EVENT_PAGE (page));
-
- editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
- action = comp_editor_get_action (editor, "send-options");
- gtk_action_set_visible (action, TRUE);
-}
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ client = comp_editor_get_client (editor);
-void
-event_page_set_meeting (EventPage *page, gboolean set)
-{
- g_return_if_fail (IS_EVENT_PAGE (page));
+ /* Note that if we are creating a new event, the timezones may not be
+ on the server, so we try to get the builtin timezone with the TZID
+ first. */
+ start_zone = icaltimezone_get_builtin_timezone_from_tzid (start_date->tzid);
+ if (!start_zone) {
+ /* FIXME: Handle error better. */
+ if (!e_cal_get_timezone (client, start_date->tzid, &start_zone, NULL)) {
+ g_warning ("Couldn't get timezone from server: %s",
+ start_date->tzid ? start_date->tzid : "");
+ }
+ }
- page->priv->is_meeting = set;
- if (page->priv->comp)
- sensitize_widgets (page);
-}
+ /* If both times are DATE values, we set the 'All Day Event' checkbox.
+ Also, if DTEND is after DTSTART, we subtract 1 day from it. */
+ all_day_event = FALSE;
+ start_tt = start_date->value;
+ end_tt = end_date->value;
+ if (!end_tt && start_tt->is_date) {
+ end_tt = &implied_tt;
+ *end_tt = *start_tt;
+ icaltime_adjust (end_tt, 1, 0, 0, 0);
+ }
-void
-event_page_set_delegate (EventPage *page, gboolean set)
-{
- g_return_if_fail (IS_EVENT_PAGE (page));
+ if (start_tt->is_date && end_tt->is_date) {
+ all_day_event = TRUE;
+ if (icaltime_compare_date_only (*end_tt, *start_tt) > 0) {
+ icaltime_adjust (end_tt, -1, 0, 0, 0);
+ }
+ }
- if (set)
- gtk_label_set_text_with_mnemonic ((GtkLabel *)page->priv->attendees_label, _("_Delegatees"));
- else
- gtk_label_set_text_with_mnemonic ((GtkLabel *)page->priv->attendees_label, _("Atte_ndees"));
-}
+ epage->priv->all_day_event = all_day_event;
+ set_all_day (epage, all_day_event);
-static EAccount *
-get_current_account (EventPage *epage)
-{
- EventPagePrivate *priv;
- EIterator *it;
- const gchar *str;
+ /* If it is an all day event, we set both timezones to the current
+ timezone, so that if the user toggles the 'All Day Event' checkbox
+ the event uses the current timezone rather than none at all. */
+ if (all_day_event)
+ start_zone = e_meeting_store_get_timezone (
+ epage->priv->meeting_store);
- priv = epage->priv;
+ g_signal_handlers_block_matched (
+ epage->priv->start_time, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, epage);
+ g_signal_handlers_block_matched (
+ epage->priv->end_time, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, epage);
+
+ e_date_edit_set_date (
+ E_DATE_EDIT (epage->priv->start_time),
+ start_tt->year, start_tt->month, start_tt->day);
+ e_date_edit_set_time_of_day (
+ E_DATE_EDIT (epage->priv->start_time),
+ start_tt->hour, start_tt->minute);
+
+ e_date_edit_set_date (
+ E_DATE_EDIT (epage->priv->end_time),
+ end_tt->year, end_tt->month, end_tt->day);
+ e_date_edit_set_time_of_day (
+ E_DATE_EDIT (epage->priv->end_time),
+ end_tt->hour, end_tt->minute);
+
+ g_signal_handlers_unblock_matched (
+ epage->priv->start_time, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, epage);
+ g_signal_handlers_unblock_matched (
+ epage->priv->end_time, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, epage);
- str = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer))));
- if (!str)
- return NULL;
+ /* Set the timezones, and set sync_timezones to TRUE if both timezones
+ are the same. */
+ g_signal_handlers_block_matched (
+ epage->priv->start_timezone, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, epage);
+ g_signal_handlers_block_matched (
+ epage->priv->end_timezone, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, epage);
- for (it = e_list_get_iterator ((EList *)priv->accounts); e_iterator_is_valid (it); e_iterator_next (it)) {
- EAccount *a = (EAccount *)e_iterator_get (it);
- gchar *full = g_strdup_printf("%s <%s>", a->id->name, a->id->address);
+ if (start_zone)
+ e_timezone_entry_set_timezone (
+ E_TIMEZONE_ENTRY (epage->priv->start_timezone),
+ start_zone);
+ def_zone = e_meeting_store_get_timezone (epage->priv->meeting_store);
+ if (!def_zone || !start_zone || strcmp (icaltimezone_get_tzid (def_zone), icaltimezone_get_tzid (start_zone)))
+ homezone = FALSE;
- if (!g_ascii_strcasecmp (full, str)) {
- g_free (full);
- g_object_unref (it);
+ action = comp_editor_get_action (editor, "view-time-zone");
+ show_timezone = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ event_page_set_show_timezone (epage, (show_timezone || !homezone) & !all_day_event);
- return a;
- }
+ /*unblock the endtimezone widget*/
+ g_signal_handlers_unblock_matched (
+ epage->priv->end_timezone, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, epage);
+ g_signal_handlers_unblock_matched (
+ epage->priv->start_timezone, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, epage);
- g_free (full);
- }
- g_object_unref (it);
+ epage->priv->sync_timezones = TRUE;
- return NULL;
+ update_end_time_combo (epage);
}
static void
@@ -990,9 +835,83 @@ organizer_changed_cb (GtkEntry *entry, EventPage *epage)
e_meeting_attendee_set_cn (epage->priv->ia, g_strdup (account->id->name));
}
-/* fill_widgets handler for the event page */
+static void
+event_page_dispose (GObject *object)
+{
+ EventPagePrivate *priv;
+
+ priv = EVENT_PAGE_GET_PRIVATE (object);
+
+ if (priv->comp != NULL) {
+ g_object_unref (priv->comp);
+ priv->comp = NULL;
+ }
+
+ if (priv->main != NULL) {
+ g_object_unref (priv->main);
+ priv->main = NULL;
+ }
+
+ if (priv->builder != NULL) {
+ g_object_unref (priv->builder);
+ priv->builder = NULL;
+ }
+
+ if (priv->alarm_list_store != NULL) {
+ g_object_unref (priv->alarm_list_store);
+ priv->alarm_list_store = NULL;
+ }
+
+ if (priv->sod != NULL) {
+ g_object_unref (priv->sod);
+ priv->sod = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (event_page_parent_class)->dispose (object);
+}
+
+static void
+event_page_finalize (GObject *object)
+{
+ EventPagePrivate *priv;
+
+ priv = EVENT_PAGE_GET_PRIVATE (object);
+
+ g_list_foreach (priv->address_strings, (GFunc) g_free, NULL);
+ g_list_free (priv->address_strings);
+
+ g_ptr_array_foreach (
+ priv->deleted_attendees, (GFunc) g_object_unref, NULL);
+ g_ptr_array_free (priv->deleted_attendees, TRUE);
+
+ g_free (priv->old_summary);
+
+ priv->alarm_list_dlg_widget = NULL;
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (event_page_parent_class)->finalize (object);
+}
+
+static GtkWidget *
+event_page_get_widget (CompEditorPage *page)
+{
+ EventPage *event_page = EVENT_PAGE (page);
+
+ return event_page->priv->main;
+}
+
+static void
+event_page_focus_main_widget (CompEditorPage *page)
+{
+ EventPage *event_page = EVENT_PAGE (page);
+
+ gtk_widget_grab_focus (event_page->priv->summary);
+}
+
static gboolean
-event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
+event_page_fill_widgets (CompEditorPage *page,
+ ECalComponent *comp)
{
ECal *client;
CompEditor *editor;
@@ -1141,7 +1060,6 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
e_meeting_attendee_set_status (priv->ia, ICAL_PARTSTAT_ACCEPTED);
e_meeting_list_view_add_attendee_to_name_selector (E_MEETING_LIST_VIEW (priv->list_view), priv->ia);
}
-
}
}
@@ -1236,9 +1154,9 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
return validated;
}
-/* fill_component handler for the event page */
static gboolean
-event_page_fill_component (CompEditorPage *page, ECalComponent *comp)
+event_page_fill_component (CompEditorPage *page,
+ ECalComponent *comp)
{
CompEditor *editor;
CompEditorFlags flags;
@@ -1601,9 +1519,9 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp)
return TRUE;
}
-/* fill_timezones handler for the event page */
static gboolean
-event_page_fill_timezones (CompEditorPage *page, GHashTable *timezones)
+event_page_fill_timezones (CompEditorPage *page,
+ GHashTable *timezones)
{
EventPage *epage;
EventPagePrivate *priv;
@@ -1630,12 +1548,140 @@ event_page_fill_timezones (CompEditorPage *page, GHashTable *timezones)
}
static void
-event_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
+event_page_set_dates (CompEditorPage *page,
+ CompEditorPageDates *dates)
{
update_time (EVENT_PAGE (page), dates->start, dates->end);
}
-
+static void
+event_page_add_attendee (CompEditorPage *page,
+ EMeetingAttendee *attendee)
+{
+ CompEditor *editor;
+ EventPagePrivate *priv;
+
+ priv = EVENT_PAGE_GET_PRIVATE (page);
+ editor = comp_editor_page_get_editor (page);
+
+ if ((comp_editor_get_flags (editor) & COMP_EDITOR_DELEGATE) != 0) {
+ gchar *delfrom;
+
+ /* EMeetingAttendee takes ownership of the string. */
+ delfrom = g_strdup_printf ("MAILTO:%s", priv->user_add);
+ e_meeting_attendee_set_delfrom (attendee, delfrom);
+ }
+
+ e_meeting_store_add_attendee (priv->meeting_store, attendee);
+ e_meeting_list_view_add_attendee_to_name_selector (
+ E_MEETING_LIST_VIEW (priv->list_view), attendee);
+}
+
+static void
+event_page_class_init (EventPageClass *class)
+{
+ GObjectClass *object_class;
+ CompEditorPageClass *editor_page_class;
+
+ g_type_class_add_private (class, sizeof (EventPagePrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = event_page_dispose;
+ object_class->finalize = event_page_finalize;
+
+ editor_page_class = COMP_EDITOR_PAGE_CLASS (class);
+ editor_page_class->get_widget = event_page_get_widget;
+ editor_page_class->focus_main_widget = event_page_focus_main_widget;
+ editor_page_class->fill_widgets = event_page_fill_widgets;
+ editor_page_class->fill_component = event_page_fill_component;
+ editor_page_class->fill_timezones = event_page_fill_timezones;
+ editor_page_class->set_dates = event_page_set_dates;
+ editor_page_class->add_attendee = event_page_add_attendee;
+}
+
+static void
+event_page_init (EventPage *epage)
+{
+ epage->priv = EVENT_PAGE_GET_PRIVATE (epage);
+ epage->priv->deleted_attendees = g_ptr_array_new ();
+ epage->priv->alarm_interval = -1;
+ epage->priv->alarm_map = alarm_map_with_user_time;
+}
+
+void
+event_page_set_view_role (EventPage *epage, gboolean state)
+{
+ e_meeting_list_view_column_set_visible (
+ epage->priv->list_view, E_MEETING_STORE_ROLE_COL, state);
+}
+
+void
+event_page_set_view_status (EventPage *epage, gboolean state)
+{
+ e_meeting_list_view_column_set_visible (
+ epage->priv->list_view, E_MEETING_STORE_STATUS_COL, state);
+}
+
+void
+event_page_set_view_type (EventPage *epage, gboolean state)
+{
+ e_meeting_list_view_column_set_visible (
+ epage->priv->list_view, E_MEETING_STORE_TYPE_COL, state);
+}
+
+void
+event_page_set_view_rsvp (EventPage *epage, gboolean state)
+{
+ e_meeting_list_view_column_set_visible (
+ epage->priv->list_view, E_MEETING_STORE_RSVP_COL, state);
+}
+
+void
+event_page_hide_options (EventPage *page)
+{
+ CompEditor *editor;
+ GtkAction *action;
+
+ g_return_if_fail (IS_EVENT_PAGE (page));
+
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
+ action = comp_editor_get_action (editor, "send-options");
+ gtk_action_set_visible (action, FALSE);
+}
+
+void
+event_page_show_options (EventPage *page)
+{
+ CompEditor *editor;
+ GtkAction *action;
+
+ g_return_if_fail (IS_EVENT_PAGE (page));
+
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
+ action = comp_editor_get_action (editor, "send-options");
+ gtk_action_set_visible (action, TRUE);
+}
+
+void
+event_page_set_meeting (EventPage *page, gboolean set)
+{
+ g_return_if_fail (IS_EVENT_PAGE (page));
+
+ page->priv->is_meeting = set;
+ if (page->priv->comp)
+ sensitize_widgets (page);
+}
+
+void
+event_page_set_delegate (EventPage *page, gboolean set)
+{
+ g_return_if_fail (IS_EVENT_PAGE (page));
+
+ if (set)
+ gtk_label_set_text_with_mnemonic ((GtkLabel *)page->priv->attendees_label, _("_Delegatees"));
+ else
+ gtk_label_set_text_with_mnemonic ((GtkLabel *)page->priv->attendees_label, _("Atte_ndees"));
+}
static void
time_sel_changed (GtkComboBox *combo, EventPage *epage)
@@ -3304,31 +3350,6 @@ event_page_get_name_selector (EventPage *epage)
}
/**
- * event_page_add_attendee
- * @epage: an #EventPage
- * @attendee: Attendee to be added.
- *
- * Add attendee to meeting store and name selector.
- **/
-void
-event_page_add_attendee (EventPage *epage, EMeetingAttendee *attendee)
-{
- EventPagePrivate *priv;
-
- g_return_if_fail (epage != NULL);
- g_return_if_fail (IS_EVENT_PAGE (epage));
-
- priv = epage->priv;
-
- if ((comp_editor_get_flags (comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage))) & COMP_EDITOR_DELEGATE) != 0) {
- e_meeting_attendee_set_delfrom (attendee, g_strdup_printf ("MAILTO:%s", epage->priv->user_add));
- }
-
- e_meeting_store_add_attendee (priv->meeting_store, attendee);
- e_meeting_list_view_add_attendee_to_name_selector (E_MEETING_LIST_VIEW (priv->list_view), attendee);
-}
-
-/**
* event_page_remove_all_attendees
* @epage: an #EventPage
*
diff --git a/calendar/gui/dialogs/event-page.h b/calendar/gui/dialogs/event-page.h
index 04665eb9de..fdfb9849ca 100644
--- a/calendar/gui/dialogs/event-page.h
+++ b/calendar/gui/dialogs/event-page.h
@@ -106,8 +106,6 @@ void event_page_set_view_type (EventPage *epage,
void event_page_set_view_rvsp (EventPage *epage,
gboolean state);
ENameSelector * event_page_get_name_selector (EventPage *epage);
-void event_page_add_attendee (EventPage *epage,
- EMeetingAttendee *attendee);
void event_page_remove_all_attendees (EventPage *epage);
GtkWidget * event_page_get_alarm_page (EventPage *epage);
GtkWidget * event_page_get_attendee_page (EventPage *epage);
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index 83ee031476..91d4598fdf 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -40,6 +40,10 @@
#include "cancel-comp.h"
#include "task-editor.h"
+#define TASK_EDITOR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), TYPE_TASK_EDITOR, TaskEditorPrivate))
+
struct _TaskEditorPrivate {
TaskPage *task_page;
TaskDetailsPage *task_details_page;
@@ -152,7 +156,7 @@ task_editor_constructor (GType type,
type, n_construct_properties, construct_properties);
editor = COMP_EDITOR (object);
- priv = TASK_EDITOR (object)->priv;
+ priv = TASK_EDITOR_GET_PRIVATE (object);
client = comp_editor_get_client (editor);
flags = comp_editor_get_flags (editor);
@@ -177,7 +181,7 @@ task_editor_dispose (GObject *object)
{
TaskEditorPrivate *priv;
- priv = TASK_EDITOR (object)->priv;
+ priv = TASK_EDITOR_GET_PRIVATE (object);
if (priv->task_page) {
g_object_unref (priv->task_page);
@@ -203,7 +207,7 @@ task_editor_constructed (GObject *object)
{
TaskEditorPrivate *priv;
- priv = TASK_EDITOR (object)->priv;
+ priv = TASK_EDITOR_GET_PRIVATE (object);
g_object_bind_property (
object, "client",
@@ -218,66 +222,54 @@ static void
task_editor_show_categories (CompEditor *editor,
gboolean visible)
{
- TaskEditorPrivate *priv;
+ TaskEditor *task_editor = TASK_EDITOR (editor);
- priv = TASK_EDITOR (editor)->priv;
-
- task_page_set_show_categories (priv->task_page, visible);
+ task_page_set_show_categories (task_editor->priv->task_page, visible);
}
static void
task_editor_show_role (CompEditor *editor,
gboolean visible)
{
- TaskEditorPrivate *priv;
+ TaskEditor *task_editor = TASK_EDITOR (editor);
- priv = TASK_EDITOR (editor)->priv;
-
- task_page_set_view_role (priv->task_page, visible);
+ task_page_set_view_role (task_editor->priv->task_page, visible);
}
static void
task_editor_show_rsvp (CompEditor *editor,
gboolean visible)
{
- TaskEditorPrivate *priv;
-
- priv = TASK_EDITOR (editor)->priv;
+ TaskEditor *task_editor = TASK_EDITOR (editor);
- task_page_set_view_rsvp (priv->task_page, visible);
+ task_page_set_view_rsvp (task_editor->priv->task_page, visible);
}
static void
task_editor_show_status (CompEditor *editor,
gboolean visible)
{
- TaskEditorPrivate *priv;
-
- priv = TASK_EDITOR (editor)->priv;
+ TaskEditor *task_editor = TASK_EDITOR (editor);
- task_page_set_view_status (priv->task_page, visible);
+ task_page_set_view_status (task_editor->priv->task_page, visible);
}
static void
task_editor_show_time_zone (CompEditor *editor,
gboolean visible)
{
- TaskEditorPrivate *priv;
+ TaskEditor *task_editor = TASK_EDITOR (editor);
- priv = TASK_EDITOR (editor)->priv;
-
- task_page_set_show_timezone (priv->task_page, visible);
+ task_page_set_show_timezone (task_editor->priv->task_page, visible);
}
static void
task_editor_show_type (CompEditor *editor,
gboolean visible)
{
- TaskEditorPrivate *priv;
-
- priv = TASK_EDITOR (editor)->priv;
+ TaskEditor *task_editor = TASK_EDITOR (editor);
- task_page_set_view_type (priv->task_page, visible);
+ task_page_set_view_type (task_editor->priv->task_page, visible);
}
static void
@@ -316,8 +308,7 @@ task_editor_init (TaskEditor *te)
const gchar *id;
GError *error = NULL;
- te->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- te, TYPE_TASK_EDITOR, TaskEditorPrivate);
+ te->priv = TASK_EDITOR_GET_PRIVATE (te);
te->priv->model = E_MEETING_STORE (e_meeting_store_new ());
te->priv->assignment_shown = TRUE;
te->priv->updating = FALSE;
@@ -391,7 +382,7 @@ task_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
ECal *client;
GSList *attendees = NULL;
- priv = TASK_EDITOR (editor)->priv;
+ priv = TASK_EDITOR_GET_PRIVATE (editor);
priv->updating = TRUE;
@@ -422,7 +413,8 @@ task_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
e_meeting_attendee_is_set_delto (ia))
e_meeting_attendee_set_edit_level (
ia, E_MEETING_ATTENDEE_EDIT_NONE);
- task_page_add_attendee (priv->task_page, ia);
+ comp_editor_page_add_attendee (
+ COMP_EDITOR_PAGE (priv->task_page), ia);
g_object_unref (ia);
}
@@ -474,7 +466,7 @@ task_editor_send_comp (CompEditor *editor,
TaskEditorPrivate *priv;
ECalComponent *comp = NULL;
- priv = TASK_EDITOR (editor)->priv;
+ priv = TASK_EDITOR_GET_PRIVATE (editor);
/* Don't cancel more than once or when just publishing */
if (method == E_CAL_COMPONENT_METHOD_PUBLISH ||
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index ee8138ec07..f416d53d88 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -54,7 +54,10 @@
#include "../e-meeting-store.h"
#include "../e-meeting-list-view.h"
-/* Private part of the TaskPage structure */
+#define TASK_PAGE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), TYPE_TASK_PAGE, TaskPagePrivate))
+
struct _TaskPagePrivate {
GtkBuilder *builder;
@@ -107,8 +110,8 @@ struct _TaskPagePrivate {
GtkWidget *attendees_label;
/* ListView stuff */
- EMeetingStore *model;
- ECal *client;
+ ECal *client;
+ EMeetingStore *meeting_store;
EMeetingListView *list_view;
gint row;
@@ -129,123 +132,41 @@ static const gint classification_map[] = {
-1
};
-
-
-static void task_page_finalize (GObject *object);
-
-static GtkWidget *task_page_get_widget (CompEditorPage *page);
-static void task_page_focus_main_widget (CompEditorPage *page);
-static gboolean task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
-static gboolean task_page_fill_component (CompEditorPage *page, ECalComponent *comp);
static gboolean task_page_fill_timezones (CompEditorPage *page, GHashTable *timezones);
static void task_page_select_organizer (TaskPage *tpage, const gchar *backend_address);
static void set_subscriber_info_string (TaskPage *tpage, const gchar *backend_address);
G_DEFINE_TYPE (TaskPage, task_page, TYPE_COMP_EDITOR_PAGE)
-static void
-task_page_dispose (GObject *object)
-{
- TaskPagePrivate *priv;
-
- priv = TASK_PAGE (object)->priv;
-
- if (priv->main != NULL) {
- g_object_unref (priv->main);
- priv->main = NULL;
- }
-
- if (priv->builder != NULL) {
- g_object_unref (priv->builder);
- priv->builder = NULL;
- }
-
- if (priv->sod != NULL) {
- g_object_unref (priv->sod);
- priv->sod = NULL;
- }
-
- if (priv->comp != NULL) {
- g_object_unref (priv->comp);
- priv->comp = NULL;
- }
-
- /* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (task_page_parent_class)->dispose (object);
-}
-
-static void
-task_page_finalize (GObject *object)
+static EAccount *
+get_current_account (TaskPage *page)
{
TaskPagePrivate *priv;
+ EIterator *it;
+ const gchar *str;
- priv = TASK_PAGE (object)->priv;
-
- g_list_foreach (priv->address_strings, (GFunc) g_free, NULL);
- g_list_free (priv->address_strings);
-
- g_ptr_array_foreach (
- priv->deleted_attendees, (GFunc) g_object_unref, NULL);
- g_ptr_array_free (priv->deleted_attendees, TRUE);
-
- g_free (priv->subscriber_info_text);
-
- /* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (task_page_parent_class)->finalize (object);
-}
-
-static void
-task_page_class_init (TaskPageClass *class)
-{
- GObjectClass *object_class;
- CompEditorPageClass *editor_page_class;
-
- g_type_class_add_private (class, sizeof (TaskPagePrivate));
-
- object_class = G_OBJECT_CLASS (class);
- object_class->dispose = task_page_dispose;
- object_class->finalize = task_page_finalize;
-
- editor_page_class = COMP_EDITOR_PAGE_CLASS (class);
- editor_page_class->get_widget = task_page_get_widget;
- editor_page_class->focus_main_widget = task_page_focus_main_widget;
- editor_page_class->fill_widgets = task_page_fill_widgets;
- editor_page_class->fill_component = task_page_fill_component;
- editor_page_class->fill_timezones = task_page_fill_timezones;
-}
-
-static void
-task_page_init (TaskPage *tpage)
-{
- tpage->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- tpage, TYPE_TASK_PAGE, TaskPagePrivate);
- tpage->priv->deleted_attendees = g_ptr_array_new ();
-}
+ priv = page->priv;
-/* get_widget handler for the task page */
-static GtkWidget *
-task_page_get_widget (CompEditorPage *page)
-{
- TaskPage *tpage;
- TaskPagePrivate *priv;
+ str = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer))));
+ if (!str)
+ return NULL;
- tpage = TASK_PAGE (page);
- priv = tpage->priv;
+ for (it = e_list_get_iterator ((EList *)priv->accounts); e_iterator_is_valid (it); e_iterator_next (it)) {
+ EAccount *a = (EAccount *)e_iterator_get (it);
+ gchar *full = g_strdup_printf("%s <%s>", a->id->name, a->id->address);
- return priv->main;
-}
+ if (!g_ascii_strcasecmp (full, str)) {
+ g_free (full);
+ g_object_unref (it);
-/* focus_main_widget handler for the task page */
-static void
-task_page_focus_main_widget (CompEditorPage *page)
-{
- TaskPage *tpage;
- TaskPagePrivate *priv;
+ return a;
+ }
- tpage = TASK_PAGE (page);
- priv = tpage->priv;
+ g_free (full);
+ }
+ g_object_unref (it);
- gtk_widget_grab_focus (priv->summary);
+ return NULL;
}
/* Fills the widgets with default values */
@@ -273,40 +194,9 @@ clear_widgets (TaskPage *tpage)
e_dialog_editable_set (priv->categories, NULL);
}
-void
-task_page_set_view_role (TaskPage *page, gboolean state)
-{
- TaskPagePrivate *priv = page->priv;
-
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ROLE_COL, state);
-}
-
-void
-task_page_set_view_status (TaskPage *page, gboolean state)
-{
- TaskPagePrivate *priv = page->priv;
-
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_STATUS_COL, state);
-}
-
-void
-task_page_set_view_type (TaskPage *page, gboolean state)
-{
- TaskPagePrivate *priv = page->priv;
-
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_TYPE_COL, state);
-}
-
-void
-task_page_set_view_rsvp (TaskPage *page, gboolean state)
-{
- TaskPagePrivate *priv = page->priv;
-
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_RSVP_COL, state);
-}
-
static gboolean
-date_in_past (TaskPage *tpage, EDateEdit *date)
+date_in_past (TaskPage *tpage,
+ EDateEdit *date)
{
struct icaltimetype tt = icaltime_null_time ();
@@ -431,96 +321,128 @@ sensitize_widgets (TaskPage *tpage)
gtk_label_set_mnemonic_widget (GTK_LABEL (priv->org_cal_label), priv->organizer);
}
}
-void
-task_page_hide_options (TaskPage *page)
+
+static void
+set_attendees (ECalComponent *comp,
+ const GPtrArray *attendees)
{
- CompEditor *editor;
- GtkAction *action;
+ GSList *comp_attendees = NULL, *l;
+ gint i;
- g_return_if_fail (IS_TASK_PAGE (page));
+ for (i = 0; i < attendees->len; i++) {
+ EMeetingAttendee *ia = g_ptr_array_index (attendees, i);
+ ECalComponentAttendee *ca;
- editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
- action = comp_editor_get_action (editor, "send-options");
- gtk_action_set_visible (action, FALSE);
-}
+ ca = e_meeting_attendee_as_e_cal_component_attendee (ia);
-void
-task_page_show_options (TaskPage *page)
-{
- CompEditor *editor;
- GtkAction *action;
+ comp_attendees = g_slist_prepend (comp_attendees, ca);
- g_return_if_fail (IS_TASK_PAGE (page));
+ }
+ comp_attendees = g_slist_reverse (comp_attendees);
- editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
- action = comp_editor_get_action (editor, "send-options");
- gtk_action_set_visible (action, TRUE);
+ e_cal_component_set_attendee_list (comp, comp_attendees);
+
+ for (l = comp_attendees; l != NULL; l = l->next)
+ g_free (l->data);
+ g_slist_free (comp_attendees);
}
-void
-task_page_set_assignment (TaskPage *page, gboolean set)
+static void
+organizer_changed_cb (GtkEntry *entry,
+ TaskPage *tpage)
{
- g_return_if_fail (IS_TASK_PAGE (page));
+ EAccount *account;
- page->priv->is_assignment = set;
- sensitize_widgets (page);
+ g_return_if_fail (GTK_IS_ENTRY (entry));
+ g_return_if_fail (IS_TASK_PAGE (tpage));
+
+ if (!tpage->priv->ia)
+ return;
+
+ account = get_current_account (tpage);
+ if (!account || !account->id)
+ return;
+
+ e_meeting_attendee_set_address (tpage->priv->ia, g_strdup_printf ("MAILTO:%s", account->id->address));
+ e_meeting_attendee_set_cn (tpage->priv->ia, g_strdup (account->id->name));
}
-static EAccount *
-get_current_account (TaskPage *page)
+static void
+task_page_dispose (GObject *object)
{
TaskPagePrivate *priv;
- EIterator *it;
- const gchar *str;
- priv = page->priv;
+ priv = TASK_PAGE_GET_PRIVATE (object);
- str = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer))));
- if (!str)
- return NULL;
-
- for (it = e_list_get_iterator ((EList *)priv->accounts); e_iterator_is_valid (it); e_iterator_next (it)) {
- EAccount *a = (EAccount *)e_iterator_get (it);
- gchar *full = g_strdup_printf("%s <%s>", a->id->name, a->id->address);
+ if (priv->main != NULL) {
+ g_object_unref (priv->main);
+ priv->main = NULL;
+ }
- if (!g_ascii_strcasecmp (full, str)) {
- g_free (full);
- g_object_unref (it);
+ if (priv->builder != NULL) {
+ g_object_unref (priv->builder);
+ priv->builder = NULL;
+ }
- return a;
- }
+ if (priv->sod != NULL) {
+ g_object_unref (priv->sod);
+ priv->sod = NULL;
+ }
- g_free (full);
+ if (priv->comp != NULL) {
+ g_object_unref (priv->comp);
+ priv->comp = NULL;
}
- g_object_unref (it);
- return NULL;
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (task_page_parent_class)->dispose (object);
}
static void
-organizer_changed_cb (GtkEntry *entry, TaskPage *tpage)
+task_page_finalize (GObject *object)
{
- EAccount *account;
+ TaskPagePrivate *priv;
- g_return_if_fail (entry != NULL);
- g_return_if_fail (GTK_IS_ENTRY (entry));
- g_return_if_fail (tpage != NULL);
- g_return_if_fail (IS_TASK_PAGE (tpage));
+ priv = TASK_PAGE_GET_PRIVATE (object);
- if (!tpage->priv->ia)
- return;
+ g_list_foreach (priv->address_strings, (GFunc) g_free, NULL);
+ g_list_free (priv->address_strings);
- account = get_current_account (tpage);
- if (!account || !account->id)
- return;
+ g_ptr_array_foreach (
+ priv->deleted_attendees, (GFunc) g_object_unref, NULL);
+ g_ptr_array_free (priv->deleted_attendees, TRUE);
- e_meeting_attendee_set_address (tpage->priv->ia, g_strdup_printf ("MAILTO:%s", account->id->address));
- e_meeting_attendee_set_cn (tpage->priv->ia, g_strdup (account->id->name));
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (task_page_parent_class)->finalize (object);
+}
+
+static GtkWidget *
+task_page_get_widget (CompEditorPage *page)
+{
+ TaskPage *tpage;
+ TaskPagePrivate *priv;
+
+ tpage = TASK_PAGE (page);
+ priv = tpage->priv;
+
+ return priv->main;
+}
+
+static void
+task_page_focus_main_widget (CompEditorPage *page)
+{
+ TaskPage *tpage;
+ TaskPagePrivate *priv;
+
+ tpage = TASK_PAGE (page);
+ priv = tpage->priv;
+
+ gtk_widget_grab_focus (priv->summary);
}
-/* fill_widgets handler for the task page */
static gboolean
-task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
+task_page_fill_widgets (CompEditorPage *page,
+ ECalComponent *comp)
{
TaskPage *tpage;
TaskPagePrivate *priv;
@@ -746,7 +668,7 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
a = get_current_account (tpage);
if (a != NULL) {
- priv->ia = e_meeting_store_add_attendee_with_defaults (priv->model);
+ priv->ia = e_meeting_store_add_attendee_with_defaults (priv->meeting_store);
g_object_ref (priv->ia);
if (!(backend_addr && *backend_addr) || !g_ascii_strcasecmp (backend_addr, a->id->address)) {
@@ -774,33 +696,9 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
return TRUE;
}
-static void
-set_attendees (ECalComponent *comp, const GPtrArray *attendees)
-{
- GSList *comp_attendees = NULL, *l;
- gint i;
-
- for (i = 0; i < attendees->len; i++) {
- EMeetingAttendee *ia = g_ptr_array_index (attendees, i);
- ECalComponentAttendee *ca;
-
- ca = e_meeting_attendee_as_e_cal_component_attendee (ia);
-
- comp_attendees = g_slist_prepend (comp_attendees, ca);
-
- }
- comp_attendees = g_slist_reverse (comp_attendees);
-
- e_cal_component_set_attendee_list (comp, comp_attendees);
-
- for (l = comp_attendees; l != NULL; l = l->next)
- g_free (l->data);
- g_slist_free (comp_attendees);
-}
-
-/* fill_component handler for the task page */
static gboolean
-task_page_fill_component (CompEditorPage *page, ECalComponent *comp)
+task_page_fill_component (CompEditorPage *page,
+ ECalComponent *comp)
{
TaskPage *tpage;
TaskPagePrivate *priv;
@@ -992,7 +890,7 @@ task_page_fill_component (CompEditorPage *page, ECalComponent *comp)
g_free (sentby);
}
- if (e_meeting_store_count_actual_attendees (priv->model) < 1) {
+ if (e_meeting_store_count_actual_attendees (priv->meeting_store) < 1) {
e_notice (priv->main, GTK_MESSAGE_ERROR,
_("At least one attendee is required."));
return FALSE;
@@ -1001,7 +899,7 @@ task_page_fill_component (CompEditorPage *page, ECalComponent *comp)
if (flags & COMP_EDITOR_DELEGATE ) {
GSList *attendee_list, *l;
gint i;
- const GPtrArray *attendees = e_meeting_store_get_attendees (priv->model);
+ const GPtrArray *attendees = e_meeting_store_get_attendees (priv->meeting_store);
e_cal_component_get_attendee_list (priv->comp, &attendee_list);
@@ -1028,12 +926,151 @@ task_page_fill_component (CompEditorPage *page, ECalComponent *comp)
e_cal_component_set_attendee_list (comp, attendee_list);
e_cal_component_free_attendee_list (attendee_list);
} else
- set_attendees (comp, e_meeting_store_get_attendees (priv->model));
+ set_attendees (comp, e_meeting_store_get_attendees (priv->meeting_store));
}
return TRUE;
}
+static gboolean
+task_page_fill_timezones (CompEditorPage *page,
+ GHashTable *timezones)
+{
+ TaskPage *tpage;
+ TaskPagePrivate *priv;
+ icaltimezone *zone;
+
+ tpage = TASK_PAGE (page);
+ priv = tpage->priv;
+
+ /* add start date timezone */
+ zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->timezone));
+ if (zone) {
+ if (!g_hash_table_lookup (timezones, icaltimezone_get_tzid (zone)))
+ g_hash_table_insert (timezones, (gpointer) icaltimezone_get_tzid (zone), zone);
+ }
+
+ return TRUE;
+}
+
+static void
+task_page_add_attendee (CompEditorPage *page,
+ EMeetingAttendee *attendee)
+{
+ CompEditor *editor;
+ TaskPagePrivate *priv;
+
+ priv = TASK_PAGE_GET_PRIVATE (page);
+ editor = comp_editor_page_get_editor (page);
+
+ if ((comp_editor_get_flags (editor) & COMP_EDITOR_DELEGATE) != 0) {
+ gchar *delfrom;
+
+ /* EMeetingAttendee takes ownership of the string. */
+ delfrom = g_strdup_printf ("MAILTO:%s", priv->user_add);
+ e_meeting_attendee_set_delfrom (attendee, delfrom);
+ }
+
+ e_meeting_store_add_attendee (priv->meeting_store, attendee);
+ e_meeting_list_view_add_attendee_to_name_selector (
+ E_MEETING_LIST_VIEW (priv->list_view), attendee);
+}
+
+static void
+task_page_class_init (TaskPageClass *class)
+{
+ GObjectClass *object_class;
+ CompEditorPageClass *editor_page_class;
+
+ g_type_class_add_private (class, sizeof (TaskPagePrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = task_page_dispose;
+ object_class->finalize = task_page_finalize;
+
+ editor_page_class = COMP_EDITOR_PAGE_CLASS (class);
+ editor_page_class->get_widget = task_page_get_widget;
+ editor_page_class->focus_main_widget = task_page_focus_main_widget;
+ editor_page_class->fill_widgets = task_page_fill_widgets;
+ editor_page_class->fill_component = task_page_fill_component;
+ editor_page_class->fill_timezones = task_page_fill_timezones;
+ editor_page_class->add_attendee = task_page_add_attendee;
+}
+
+static void
+task_page_init (TaskPage *tpage)
+{
+ tpage->priv = TASK_PAGE_GET_PRIVATE (tpage);
+ tpage->priv->deleted_attendees = g_ptr_array_new ();
+}
+
+void
+task_page_set_view_role (TaskPage *page, gboolean state)
+{
+ TaskPagePrivate *priv = page->priv;
+
+ e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ROLE_COL, state);
+}
+
+void
+task_page_set_view_status (TaskPage *page, gboolean state)
+{
+ TaskPagePrivate *priv = page->priv;
+
+ e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_STATUS_COL, state);
+}
+
+void
+task_page_set_view_type (TaskPage *page, gboolean state)
+{
+ TaskPagePrivate *priv = page->priv;
+
+ e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_TYPE_COL, state);
+}
+
+void
+task_page_set_view_rsvp (TaskPage *page, gboolean state)
+{
+ TaskPagePrivate *priv = page->priv;
+
+ e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_RSVP_COL, state);
+}
+
+void
+task_page_hide_options (TaskPage *page)
+{
+ CompEditor *editor;
+ GtkAction *action;
+
+ g_return_if_fail (IS_TASK_PAGE (page));
+
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
+ action = comp_editor_get_action (editor, "send-options");
+ gtk_action_set_visible (action, FALSE);
+}
+
+void
+task_page_show_options (TaskPage *page)
+{
+ CompEditor *editor;
+ GtkAction *action;
+
+ g_return_if_fail (IS_TASK_PAGE (page));
+
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
+ action = comp_editor_get_action (editor, "send-options");
+ gtk_action_set_visible (action, TRUE);
+}
+
+void
+task_page_set_assignment (TaskPage *page, gboolean set)
+{
+ g_return_if_fail (IS_TASK_PAGE (page));
+
+ page->priv->is_assignment = set;
+ sensitize_widgets (page);
+}
+
static void
add_clicked_cb (GtkButton *btn, TaskPage *page)
{
@@ -1044,7 +1081,7 @@ add_clicked_cb (GtkButton *btn, TaskPage *page)
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
flags = comp_editor_get_flags (editor);
- attendee = e_meeting_store_add_attendee_with_defaults (page->priv->model);
+ attendee = e_meeting_store_add_attendee_with_defaults (page->priv->meeting_store);
if (flags & COMP_EDITOR_DELEGATE) {
e_meeting_attendee_set_delfrom (attendee, g_strdup_printf ("MAILTO:%s", page->priv->user_add));
@@ -1127,7 +1164,7 @@ remove_attendee (TaskPage *page, EMeetingAttendee *ia)
if (e_meeting_attendee_is_set_delfrom (ia)) {
EMeetingAttendee *ib;
- ib = e_meeting_store_find_attendee (priv->model, e_meeting_attendee_get_delfrom (ia), &pos);
+ ib = e_meeting_store_find_attendee (priv->meeting_store, e_meeting_attendee_get_delfrom (ia), &pos);
if (ib != NULL) {
e_meeting_attendee_set_delto (ib, NULL);
@@ -1146,11 +1183,11 @@ remove_attendee (TaskPage *page, EMeetingAttendee *ia)
}
if (e_meeting_attendee_get_delto (ia) != NULL)
- ib = e_meeting_store_find_attendee (priv->model, e_meeting_attendee_get_delto (ia), NULL);
+ ib = e_meeting_store_find_attendee (priv->meeting_store, e_meeting_attendee_get_delto (ia), NULL);
comp_editor_manage_new_attendees (priv->comp, ia, FALSE);
e_meeting_list_view_remove_attendee_from_name_selector (priv->list_view, ia);
- e_meeting_store_remove_attendee (priv->model, ia);
+ e_meeting_store_remove_attendee (priv->meeting_store, ia);
ia = ib;
}
@@ -1174,7 +1211,7 @@ remove_clicked_cb (GtkButton *btn, TaskPage *page)
priv = page->priv;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->list_view));
- model = GTK_TREE_MODEL (priv->model);
+ model = GTK_TREE_MODEL (priv->meeting_store);
if (!(paths = gtk_tree_selection_get_selected_rows (selection, &model))) {
g_warning ("Could not get a selection to delete.");
return;
@@ -1184,10 +1221,10 @@ remove_clicked_cb (GtkButton *btn, TaskPage *page)
for (tmp = paths; tmp; tmp=tmp->next) {
path = tmp->data;
- gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->model), &iter, path);
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->meeting_store), &iter, path);
- gtk_tree_model_get (GTK_TREE_MODEL (priv->model), &iter, E_MEETING_STORE_ADDRESS_COL, &address, -1);
- ia = e_meeting_store_find_attendee (priv->model, address, NULL);
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->meeting_store), &iter, E_MEETING_STORE_ADDRESS_COL, &address, -1);
+ ia = e_meeting_store_find_attendee (priv->meeting_store, address, NULL);
g_free (address);
if (!ia) {
g_warning ("Cannot delete attendee\n");
@@ -1201,10 +1238,10 @@ remove_clicked_cb (GtkButton *btn, TaskPage *page)
}
/* Select closest item after removal */
- valid_iter = gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->model), &iter, path);
+ valid_iter = gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->meeting_store), &iter, path);
if (!valid_iter) {
gtk_tree_path_prev (path);
- valid_iter = gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->model), &iter, path);
+ valid_iter = gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->meeting_store), &iter, path);
}
if (valid_iter) {
@@ -1252,7 +1289,7 @@ attendee_added_cb (EMeetingListView *emlv,
gtk_widget_set_sensitive (priv->add, FALSE);
gtk_widget_set_sensitive (priv->edit, FALSE);
- delegator = e_meeting_store_find_attendee (priv->model, priv->user_add, NULL);
+ delegator = e_meeting_store_find_attendee (priv->meeting_store, priv->user_add, NULL);
g_return_if_fail (delegator != NULL);
e_meeting_attendee_set_delto (delegator, g_strdup (e_meeting_attendee_get_address (ia)));
@@ -1272,7 +1309,7 @@ list_view_event (EMeetingListView *list_view, GdkEvent *event, TaskPage *page) {
if (event->type == GDK_2BUTTON_PRESS && flags & COMP_EDITOR_USER_ORG) {
EMeetingAttendee *attendee;
- attendee = e_meeting_store_add_attendee_with_defaults (priv->model);
+ attendee = e_meeting_store_add_attendee_with_defaults (priv->meeting_store);
if (flags & COMP_EDITOR_DELEGATE) {
e_meeting_attendee_set_delfrom (attendee, g_strdup_printf ("MAILTO:%s", page->priv->user_add));
@@ -1327,27 +1364,6 @@ task_page_set_show_categories (TaskPage *page, gboolean state)
}
}
-/* fill_timezones handler for the event page */
-static gboolean
-task_page_fill_timezones (CompEditorPage *page, GHashTable *timezones)
-{
- TaskPage *tpage;
- TaskPagePrivate *priv;
- icaltimezone *zone;
-
- tpage = TASK_PAGE (page);
- priv = tpage->priv;
-
- /* add start date timezone */
- zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->timezone));
- if (zone) {
- if (!g_hash_table_lookup (timezones, icaltimezone_get_tzid (zone)))
- g_hash_table_insert (timezones, (gpointer) icaltimezone_get_tzid (zone), zone);
- }
-
- return TRUE;
-}
-
/*If the msg has some value set, the icon should always be set */
void
task_page_set_info_string (TaskPage *tpage, const gchar *icon, const gchar *msg)
@@ -1428,7 +1444,7 @@ get_widgets (TaskPage *tpage)
priv->attendee_box = e_builder_get_widget (priv->builder, "attendee-box");
priv->org_cal_label = e_builder_get_widget (priv->builder, "org-task-label");
- priv->list_view = e_meeting_list_view_new (priv->model);
+ priv->list_view = e_meeting_list_view_new (priv->meeting_store);
selection = gtk_tree_view_get_selection ((GtkTreeView *) priv->list_view);
gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
@@ -2038,15 +2054,16 @@ task_page_select_organizer (TaskPage *tpage, const gchar *backend_address)
* created.
**/
TaskPage *
-task_page_construct (TaskPage *tpage, EMeetingStore *model, ECal *client)
+task_page_construct (TaskPage *tpage,
+ EMeetingStore *meeting_store,
+ ECal *client)
{
TaskPagePrivate *priv;
EIterator *it;
EAccount *a;
priv = tpage->priv;
- g_object_ref (model);
- priv->model = model;
+ priv->meeting_store = g_object_ref (meeting_store);
priv->client = client;
/* Make sure our custom widget classes are registered with
@@ -2146,28 +2163,3 @@ task_page_get_cancel_comp (TaskPage *page)
return e_cal_component_clone (priv->comp);
}
-
-/**
- * task_page_add_attendee
- * @tpage: a #TaskPage
- * @attendee: Attendee to be added.
- *
- * Add attendee to meeting store and name selector.
- **/
-void
-task_page_add_attendee (TaskPage *tpage, EMeetingAttendee *attendee)
-{
- TaskPagePrivate *priv;
-
- g_return_if_fail (tpage != NULL);
- g_return_if_fail (IS_TASK_PAGE (tpage));
-
- priv = tpage->priv;
-
- if ((comp_editor_get_flags (comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage))) & COMP_EDITOR_DELEGATE) != 0) {
- e_meeting_attendee_set_delfrom (attendee, g_strdup_printf ("MAILTO:%s", tpage->priv->user_add));
- }
-
- e_meeting_store_add_attendee (priv->model, attendee);
- e_meeting_list_view_add_attendee_to_name_selector (E_MEETING_LIST_VIEW (priv->list_view), attendee);
-}
diff --git a/calendar/gui/dialogs/task-page.h b/calendar/gui/dialogs/task-page.h
index 0be9b8538b..007dcdeec4 100644
--- a/calendar/gui/dialogs/task-page.h
+++ b/calendar/gui/dialogs/task-page.h
@@ -96,8 +96,6 @@ void task_page_set_show_categories (TaskPage *page,
void task_page_set_info_string (TaskPage *tpage,
const gchar *icon,
const gchar *msg);
-void task_page_add_attendee (TaskPage *tpage,
- EMeetingAttendee *attendee);
G_END_DECLS