aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorSuman Manjunath <msuman@novell.com>2007-08-13 18:40:23 +0800
committerChenthill Palanisamy <pchen@src.gnome.org>2007-08-13 18:40:23 +0800
commit98087d1543dff4c0f1cf70b88c634ebe3bcbb656 (patch)
treefd6998b832ed6bb60398da9872e5b8922694baa5 /calendar
parent7701d36a65aba3e183fe30e6a0818c5405eb1f46 (diff)
downloadgsoc2013-evolution-98087d1543dff4c0f1cf70b88c634ebe3bcbb656.tar
gsoc2013-evolution-98087d1543dff4c0f1cf70b88c634ebe3bcbb656.tar.gz
gsoc2013-evolution-98087d1543dff4c0f1cf70b88c634ebe3bcbb656.tar.bz2
gsoc2013-evolution-98087d1543dff4c0f1cf70b88c634ebe3bcbb656.tar.lz
gsoc2013-evolution-98087d1543dff4c0f1cf70b88c634ebe3bcbb656.tar.xz
gsoc2013-evolution-98087d1543dff4c0f1cf70b88c634ebe3bcbb656.tar.zst
gsoc2013-evolution-98087d1543dff4c0f1cf70b88c634ebe3bcbb656.zip
reviewed by: Chenthill Palanisamy <pchenthill@novell.com>
2007-08-13 Suman Manjunath <msuman@novell.com> reviewed by: Chenthill Palanisamy <pchenthill@novell.com> * gui/dialogs/event-page.c: (event_page_init), (sensitize_widgets), (get_current_account), (event_page_fill_widgets), (event_page_fill_component), (existing_attendee), (event_page_set_info_string), (get_widgets), (source_changed_cb), (init_widgets), (event_page_select_organizer), (event_page_construct): * gui/dialogs/event-page.glade: * gui/dialogs/memo-page.c: (memo_page_init), * (sensitize_widgets), (memo_page_fill_widgets), (get_current_account), (memo_page_fill_component), (memo_page_set_info_string), (get_widgets), (source_changed_cb), (init_widgets), (memo_page_select_organizer), (memo_page_construct): * gui/dialogs/memo-page.glade: * gui/dialogs/task-page.c: (task_page_init), * (sensitize_widgets), (get_current_account), (task_page_fill_widgets), (task_page_fill_component), (existing_attendee), (task_page_set_info_string), (get_widgets), (source_changed_cb), (init_widgets), (task_page_select_organizer), (task_page_construct): * gui/dialogs/task-page.glade: Add a label on the top to show * information string for calendar, task and memo editors. It would be shown while operating on subscribed user's folder items. * gui/itip-utils.c: (itip_send_comp), (reply_to_calendar_comp): * A utility function sanitize_component has been removed. The sentby parameter is set in the event pages. --This line, and those below, will be ignored-- M calendar/gui/dialogs/task-page.glade M calendar/gui/dialogs/task-page.c M calendar/gui/dialogs/task-page.h M calendar/gui/dialogs/event-page.glade M calendar/gui/dialogs/memo-page.glade M calendar/gui/dialogs/event-page.c M calendar/gui/dialogs/event-page.h M calendar/gui/dialogs/memo-page.c M calendar/gui/dialogs/memo-page.h M calendar/gui/itip-utils.c M calendar/ChangeLog svn path=/trunk/; revision=33996
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog30
-rw-r--r--calendar/gui/dialogs/event-page.c222
-rw-r--r--calendar/gui/dialogs/event-page.glade56
-rw-r--r--calendar/gui/dialogs/event-page.h1
-rw-r--r--calendar/gui/dialogs/memo-page.c165
-rw-r--r--calendar/gui/dialogs/memo-page.glade55
-rw-r--r--calendar/gui/dialogs/memo-page.h2
-rw-r--r--calendar/gui/dialogs/task-page.c190
-rw-r--r--calendar/gui/dialogs/task-page.glade59
-rw-r--r--calendar/gui/dialogs/task-page.h2
-rw-r--r--calendar/gui/itip-utils.c76
11 files changed, 692 insertions, 166 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 28bc9905b8..83a299e5f4 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,33 @@
+2007-08-13 Suman Manjunath <msuman@novell.com>
+
+ reviewed by: Chenthill Palanisamy <pchenthill@novell.com>
+
+ * gui/dialogs/event-page.c: (event_page_init),
+ (sensitize_widgets), (get_current_account),
+ (event_page_fill_widgets), (event_page_fill_component),
+ (existing_attendee), (event_page_set_info_string), (get_widgets),
+ (source_changed_cb), (init_widgets), (event_page_select_organizer),
+ (event_page_construct):
+ * gui/dialogs/event-page.glade:
+ * gui/dialogs/memo-page.c: (memo_page_init), (sensitize_widgets),
+ (memo_page_fill_widgets), (get_current_account),
+ (memo_page_fill_component), (memo_page_set_info_string),
+ (get_widgets), (source_changed_cb), (init_widgets),
+ (memo_page_select_organizer), (memo_page_construct):
+ * gui/dialogs/memo-page.glade:
+ * gui/dialogs/task-page.c: (task_page_init), (sensitize_widgets),
+ (get_current_account), (task_page_fill_widgets),
+ (task_page_fill_component), (existing_attendee),
+ (task_page_set_info_string), (get_widgets), (source_changed_cb),
+ (init_widgets), (task_page_select_organizer),
+ (task_page_construct):
+ * gui/dialogs/task-page.glade: Add a label on the top to show information string
+ for calendar, task and memo editors. It would be shown while operating on subscribed
+ user's folder items.
+ * gui/itip-utils.c: (itip_send_comp), (reply_to_calendar_comp): A
+ utility function sanitize_component has been removed. The sentby parameter
+ is set in the event pages.
+
2007-08-10 Milan Crha <mcrha@redhat.com>
** Fix for bug #351552
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index de1048c793..d9c16556e3 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -70,6 +70,11 @@ struct _EventPagePrivate {
GtkWidget *main;
BonoboUIComponent *uic;
+ /* Generic informative messages placeholder */
+ GtkWidget *info_hbox;
+ GtkWidget *info_icon;
+ GtkWidget *info_string;
+
GtkWidget *summary;
GtkWidget *summary_label;
GtkWidget *location;
@@ -177,6 +182,9 @@ static void hour_sel_changed ( GtkSpinButton *widget, EventPage *epage);
static void minute_sel_changed ( GtkSpinButton *widget, EventPage *epage);
static void hour_minute_changed ( EventPage *epage);
static void update_end_time_selector( EventPage *epage);
+static void event_page_select_organizer (EventPage *epage, const char *backend_address);
+static void set_subscriber_info_string (EventPage *epage, const char *backend_address);
+
G_DEFINE_TYPE (EventPage, event_page, TYPE_COMP_EDITOR_PAGE);
/* Class initialization function for the event page */
@@ -236,6 +244,10 @@ event_page_init (EventPage *epage)
priv->categories = NULL;
priv->sod = NULL;
+ priv->info_hbox = NULL;
+ priv->info_icon = NULL;
+ priv->info_string = NULL;
+
priv->deleted_attendees = g_ptr_array_new ();
priv->comp = NULL;
@@ -576,7 +588,6 @@ clear_widgets (EventPage *epage)
e_dialog_editable_set (priv->categories, NULL);
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry), priv->default_address);
-
}
static gboolean
@@ -821,6 +832,11 @@ sensitize_widgets (EventPage *epage)
gtk_box_pack_start ((GtkBox *)priv->status_icons, priv->alarm_icon, FALSE, FALSE, 6);
}
+ /* The list of organizers is set to be non-editable. Otherwise any
+ * change in the displayed list causes an 'Account not found' error.
+ */
+ gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (priv->organizer)->entry), FALSE);
+
gtk_editable_set_editable (GTK_EDITABLE (priv->summary), !read_only);
gtk_editable_set_editable (GTK_EDITABLE (priv->location), sensitize);
gtk_widget_set_sensitive (priv->alarm_box, custom);
@@ -952,7 +968,7 @@ get_current_account (EventPage *epage)
EAccount *a = (EAccount *)e_iterator_get(it);
char *full = g_strdup_printf("%s <%s>", a->id->name, a->id->address);
- if (!strcmp (full, str)) {
+ if (!g_ascii_strcasecmp (full, str)) {
g_free (full);
g_object_unref (it);
@@ -978,6 +994,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
ECalComponentDateTime start_date, end_date;
const char *location, *uid = NULL;
const char *categories;
+ gchar *backend_addr = NULL;
ESource *source;
GSList *l;
gboolean validated = TRUE;
@@ -1026,11 +1043,17 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
}
e_cal_component_free_text_list (l);
+ e_cal_get_cal_address (COMP_EDITOR_PAGE (epage)->client, &backend_addr, NULL);
+ set_subscriber_info_string (epage, backend_addr);
+
if (priv->is_meeting) {
ECalComponentOrganizer organizer;
-
+
priv->user_add = itip_get_comp_attendee (comp, COMP_EDITOR_PAGE (epage)->client);
+ /* Organizer strings */
+ event_page_select_organizer (epage, backend_addr);
+
/* If there is an existing organizer show it properly */
if (e_cal_component_has_organizer (comp)) {
e_cal_component_get_organizer (comp, &organizer);
@@ -1039,7 +1062,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
gchar *string;
GList *list = NULL;
- if (itip_organizer_is_user (comp, page->client)) {
+ if (itip_organizer_is_user (comp, page->client) || itip_sentby_is_user (comp)) {
if (e_cal_get_static_capability (
page->client,
CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS))
@@ -1079,20 +1102,31 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
if (a != NULL) {
/* Reuse earlier declared *page, or rename this to avoid confusion? */
CompEditorPage *page = (CompEditorPage *) epage;
+
priv->ia = e_meeting_store_add_attendee_with_defaults (priv->model);
g_object_ref (priv->ia);
- e_meeting_attendee_set_address (priv->ia, g_strdup_printf ("MAILTO:%s", a->id->address));
- e_meeting_attendee_set_cn (priv->ia, g_strdup (a->id->name));
+ if (!(backend_addr && *backend_addr) || !g_ascii_strcasecmp (backend_addr, a->id->address)) {
+ e_meeting_attendee_set_address (priv->ia, g_strdup_printf ("MAILTO:%s", a->id->address));
+ e_meeting_attendee_set_cn (priv->ia, g_strdup (a->id->name));
+ } else {
+ e_meeting_attendee_set_address (priv->ia, g_strdup_printf ("MAILTO:%s", backend_addr));
+ e_meeting_attendee_set_sentby (priv->ia, g_strdup_printf ("MAILTO:%s", a->id->address));
+ }
+
if (page->client && e_cal_get_organizer_must_accept (page->client))
e_meeting_attendee_set_status (priv->ia, ICAL_PARTSTAT_NEEDSACTION);
else
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);
}
+
}
}
+ if (backend_addr)
+ g_free (backend_addr);
+
/* Start and end times */
e_cal_component_get_dtstart (comp, &start_date);
e_cal_component_get_dtend (comp, &end_date);
@@ -1452,13 +1486,18 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp)
e_cal_component_add_alarm (comp, ca);
}
}
-
+
if (priv->is_meeting) {
ECalComponentOrganizer organizer = {NULL, NULL, NULL, NULL};
if (!priv->existing) {
EAccount *a;
- gchar *addr = NULL;
+ gchar *backend_addr, *org_addr = NULL, *sentby = NULL;
+
+ e_cal_get_cal_address (priv->client, &backend_addr, NULL);
+
+ /* FIXME need not set Organizer strings here */
+ event_page_select_organizer (epage, backend_addr);
/* Find the identity for the organizer or sentby field */
a = get_current_account (epage);
@@ -1476,13 +1515,23 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp)
return FALSE;
}
- addr = g_strdup_printf ("MAILTO:%s", a->id->address);
+ if (!backend_addr || !g_ascii_strcasecmp (backend_addr, a->id->address)) {
+ org_addr = g_strdup_printf ("MAILTO:%s", a->id->address);
+ organizer.value = org_addr;
+ organizer.cn = a->id->name;
+ } else {
+ gchar *sentby = NULL;
+ org_addr = g_strdup_printf ("MAILTO:%s", backend_addr);
+ sentby = g_strdup_printf ("MAILTO:%s", a->id->address);
+ organizer.value = org_addr;
+ organizer.sentby = sentby;
+ }
- organizer.value = addr;
- organizer.cn = a->id->name;
e_cal_component_set_organizer (comp, &organizer);
- g_free (addr);
+ g_free (backend_addr);
+ g_free (org_addr);
+ g_free (sentby);
}
if (e_meeting_store_count_actual_attendees (priv->model) < 1) {
@@ -1710,19 +1759,27 @@ existing_attendee (EMeetingAttendee *ia, ECalComponent *comp)
{
GSList *attendees, *l;
const gchar *ia_address;
+ const gchar *ia_sentby = NULL;
ia_address = itip_strip_mailto (e_meeting_attendee_get_address (ia));
if (!ia_address)
return FALSE;
+ if (e_meeting_attendee_is_set_sentby (ia))
+ ia_sentby = itip_strip_mailto (e_meeting_attendee_get_sentby (ia));
+
e_cal_component_get_attendee_list (comp, &attendees);
for (l = attendees; l; l = l->next) {
ECalComponentAttendee *attendee = l->data;
const char *address;
+ const char *sentby = NULL;
address = itip_strip_mailto (attendee->value);
- if (address && !g_ascii_strcasecmp (ia_address, address)) {
+ if (attendee->sentby)
+ sentby = itip_strip_mailto (attendee->sentby);
+
+ if ((address && !g_ascii_strcasecmp (ia_address, address)) || (sentby && !g_ascii_strcasecmp (ia_sentby, sentby))) {
e_cal_component_free_attendee_list (attendees);
return TRUE;
}
@@ -2169,6 +2226,23 @@ event_page_set_show_categories (EventPage *epage, gboolean state)
}
}
+/*If the msg has some value set, the icon should always be set */
+void
+event_page_set_info_string (EventPage *epage, const gchar *icon, const gchar *msg)
+{
+ EventPagePrivate *priv;
+
+ priv = epage->priv;
+
+ gtk_image_set_from_stock (GTK_IMAGE (priv->info_icon), icon, GTK_ICON_SIZE_BUTTON);
+ gtk_label_set_text (GTK_LABEL(priv->info_string), msg);
+
+ if (msg && icon)
+ gtk_widget_show (priv->info_hbox);
+ else
+ gtk_widget_hide (priv->info_hbox);
+}
+
/* Gets the widgets from the XML file and returns if they are all available. */
static gboolean
get_widgets (EventPage *epage)
@@ -2224,6 +2298,10 @@ get_widgets (EventPage *epage)
priv->location = GW ("location");
priv->location_label = GW ("location-label");
+ priv->info_hbox = GW ("generic-info");
+ priv->info_icon = GW ("generic-info-image");
+ priv->info_string = GW ("generic-info-msgs");
+
priv->invite = GW ("invite");
priv->add = GW ("add-attendee");
priv->remove = GW ("remove-attendee");
@@ -2649,6 +2727,22 @@ source_changed_cb (GtkWidget *widget, ESource *source, gpointer data)
else
event_page_hide_options (epage);
+ if (client) {
+ gchar *backend_addr = NULL;
+
+ e_cal_get_cal_address(client, &backend_addr, NULL);
+
+ if (backend_addr && *backend_addr) {
+
+ if (priv->is_meeting)
+ event_page_select_organizer (epage, backend_addr);
+
+ set_subscriber_info_string (epage, backend_addr);
+ }
+
+ g_free (backend_addr);
+ }
+
sensitize_widgets (epage);
alarm_list_dialog_set_client (priv->alarm_list_dlg_widget, client);
@@ -2656,6 +2750,24 @@ source_changed_cb (GtkWidget *widget, ESource *source, gpointer data)
}
}
+
+static void
+set_subscriber_info_string (EventPage *epage, const char *backend_address)
+{
+ ECal *client = COMP_EDITOR_PAGE (epage)->client;
+ ESource *source;
+
+ source = e_cal_get_source (client);
+
+ if (e_source_get_property (source, "subscriber"))
+ /* Translators: This string is used when we are creating an Event
+ (meeting or appointment) on behalf of some other user */
+ event_page_set_info_string (epage, GTK_STOCK_DIALOG_INFO,
+ g_strdup_printf(_("You are acting on behalf of %s"), backend_address));
+ else
+ event_page_set_info_string (epage, NULL, NULL);
+}
+
static void
alarm_changed_cb (GtkWidget *widget, gpointer data)
{
@@ -2831,6 +2943,9 @@ init_widgets (EventPage *epage)
(EDateEditGetTimeCallback) comp_editor_get_current_time,
epage, NULL);
+ /* Generic informative messages */
+ gtk_widget_hide (priv->info_hbox);
+
/* Summary */
g_signal_connect((priv->summary), "changed",
G_CALLBACK (summary_changed_cb), epage);
@@ -3021,6 +3136,65 @@ init_widgets (EventPage *epage)
+static void
+event_page_select_organizer (EventPage *epage, const char *backend_address)
+{
+ EventPagePrivate *priv;
+ EIterator *it;
+ EAccount *def_account;
+ EAccount *a;
+ gboolean subscribed_cal = FALSE;
+ ESource *source = NULL;
+ const char *user_addr = NULL;
+
+ priv = epage->priv;
+ if (COMP_EDITOR_PAGE (epage)->client)
+ source = e_cal_get_source (COMP_EDITOR_PAGE (epage)->client);
+ if (source)
+ user_addr = e_source_get_property (source, "subscriber");
+
+ if (user_addr)
+ subscribed_cal = TRUE;
+ else
+ user_addr = backend_address;
+
+ /*FIXME find the organizer using the address strings which is set in org combo box */
+ def_account = itip_addresses_get_default();
+ for (it = e_list_get_iterator((EList *)priv->accounts);
+ e_iterator_is_valid(it);
+ e_iterator_next(it)) {
+ gchar *full = NULL;
+
+ a = (EAccount *)e_iterator_get(it);
+ full = g_strdup_printf("%s <%s>", a->id->name, a->id->address);
+
+ /* Note that the address specified by the backend gets
+ * precedence over the default mail address.
+ */
+ if (user_addr && !g_ascii_strcasecmp (user_addr, a->id->address)) {
+ if (priv->default_address)
+ g_free (priv->default_address);
+
+ priv->default_address = full;
+ } else if (a == def_account && !priv->default_address)
+ priv->default_address = full;
+
+ }
+ g_object_unref(it);
+
+ if (priv->default_address) {
+ if (!priv->comp || !e_cal_component_has_organizer (priv->comp)) {
+ gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry), priv->default_address);
+ /* FIXME: Use accessor functions to access private members of a GtkCombo widget */
+ gtk_widget_set_sensitive (GTK_WIDGET (GTK_COMBO (priv->organizer)->button), TRUE);
+ }
+ if (subscribed_cal)
+ /* FIXME: Use accessor functions to access private members of a GtkCombo widget */
+ gtk_widget_set_sensitive (GTK_WIDGET (GTK_COMBO (priv->organizer)->button), FALSE);
+ } else
+ g_warning ("No potential organizers!");
+}
+
/**
* event_page_construct:
* @epage: An event page.
@@ -3034,7 +3208,6 @@ EventPage *
event_page_construct (EventPage *epage, EMeetingStore *model, ECal *client)
{
EventPagePrivate *priv;
- char *backend_address = NULL;
EIterator *it;
EAccount *def_account;
GList *address_strings = NULL, *l;
@@ -3064,38 +3237,19 @@ event_page_construct (EventPage *epage, EMeetingStore *model, ECal *client)
return NULL;
}
- /* Address information */
- if (!e_cal_get_cal_address (client, &backend_address, NULL))
- return NULL;
-
priv->accounts = itip_addresses_get ();
def_account = itip_addresses_get_default();
for (it = e_list_get_iterator((EList *)priv->accounts);
e_iterator_is_valid(it);
e_iterator_next(it)) {
- char *full;
+ gchar *full = NULL;
a = (EAccount *)e_iterator_get(it);
full = g_strdup_printf("%s <%s>", a->id->name, a->id->address);
address_strings = g_list_append(address_strings, full);
-
- /* Note that the address specified by the backend gets
- * precedence over the default mail address.
- */
- if (backend_address && !strcmp (backend_address, a->id->address)) {
- if (priv->default_address)
- g_free (priv->default_address);
-
- priv->default_address = g_strdup (full);
- } else if (a == def_account && !priv->default_address) {
- priv->default_address = g_strdup (full);
- }
}
- if (backend_address)
- g_free (backend_address);
-
g_object_unref(it);
if (address_strings)
diff --git a/calendar/gui/dialogs/event-page.glade b/calendar/gui/dialogs/event-page.glade
index 75cf8a94a1..86a7cbf0b6 100644
--- a/calendar/gui/dialogs/event-page.glade
+++ b/calendar/gui/dialogs/event-page.glade
@@ -4,7 +4,7 @@
<glade-interface>
<widget class="GtkWindow" id="event-toplevel">
- <property name="title" translatable="no">window1</property>
+ <property name="title">window1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
@@ -43,6 +43,58 @@
</child>
<child>
+ <widget class="GtkHBox" id="generic-info">
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkImage" id="generic-info-image">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">6</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="generic-info-msgs">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">3</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
<widget class="GtkHBox" id="hbox56">
<property name="visible">True</property>
<property name="homogeneous">False</property>
@@ -105,7 +157,7 @@
</child>
<child>
- <widget class="GtkLabel" id="label68">
+ <widget class="GtkLabel" id="description-label">
<property name="visible">True</property>
<property name="label" translatable="yes">D_escription:</property>
<property name="use_underline">True</property>
diff --git a/calendar/gui/dialogs/event-page.h b/calendar/gui/dialogs/event-page.h
index 57610da201..b939e741af 100644
--- a/calendar/gui/dialogs/event-page.h
+++ b/calendar/gui/dialogs/event-page.h
@@ -72,6 +72,7 @@ void event_page_set_all_day_event (EventPage *epage, gboolean all_day);
void event_page_set_show_categories (EventPage *epage, gboolean state);
void event_page_set_show_time_busy (EventPage *epage, gboolean state);
void event_page_show_alarm (EventPage *epage);
+void event_page_set_info_string (EventPage *epage, const gchar *icon, const gchar *msg);
void event_page_set_view_role (EventPage *epage, gboolean state);
void event_page_set_view_status (EventPage *epage, gboolean state);
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c
index 816144042c..6c50cc029f 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -70,6 +70,11 @@ struct _MemoPagePrivate {
ECalComponentClassification classification;
+ /* Generic informative messages placeholder */
+ GtkWidget *info_hbox;
+ GtkWidget *info_icon;
+ GtkWidget *info_string;
+
/* Organizer */
GtkWidget *org_label;
GtkWidget *org_combo;
@@ -114,6 +119,7 @@ static GtkWidget *memo_page_get_widget (CompEditorPage *page);
static void memo_page_focus_main_widget (CompEditorPage *page);
static gboolean memo_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
static gboolean memo_page_fill_component (CompEditorPage *page, ECalComponent *comp);
+static void memo_page_select_organizer (MemoPage *mpage, const char *backend_address);
G_DEFINE_TYPE (MemoPage, memo_page, TYPE_COMP_EDITOR_PAGE)
@@ -163,6 +169,10 @@ memo_page_init (MemoPage *mpage)
priv->categories_btn = NULL;
priv->categories = NULL;
+ priv->info_hbox = NULL;
+ priv->info_icon = NULL;
+ priv->info_string = NULL;
+
priv->updating = FALSE;
}
@@ -300,8 +310,10 @@ sensitize_widgets (MemoPage *mpage)
priv = mpage->priv;
- if (!e_cal_is_read_only (COMP_EDITOR_PAGE (mpage)->client, &read_only, NULL))
- read_only = TRUE;
+ /* The list of organizers is set to be non-editable. Otherwise any
+ * change in the displayed list causes an 'Account not found' error.
+ */
+ gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (priv->org_combo)->entry), FALSE);
gtk_text_view_set_editable (GTK_TEXT_VIEW (priv->memo_content), sensitize);
gtk_widget_set_sensitive (priv->start_date, sensitize);
@@ -310,8 +322,6 @@ sensitize_widgets (MemoPage *mpage)
gtk_editable_set_editable (GTK_EDITABLE (priv->summary_entry), sensitize);
if (COMP_EDITOR_PAGE (mpage)->flags & COMP_EDITOR_IS_SHARED) {
- gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (priv->org_combo)->entry), sensitize);
-
if (priv->to_entry) {
gtk_editable_set_editable (GTK_EDITABLE (priv->to_entry), !read_only);
gtk_widget_grab_focus (priv->to_entry);
@@ -420,7 +430,7 @@ memo_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
else
string = g_strdup (strip);
- if (itip_organizer_is_user (comp, page->client)) {
+ if (itip_organizer_is_user (comp, page->client) || itip_sentby_is_user (comp)) {
} else {
list = g_list_append (list, string);
gtk_combo_set_popdown_strings (GTK_COMBO (priv->org_combo), list);
@@ -575,7 +585,7 @@ get_current_account (MemoPage *page)
EAccount *a = (EAccount *)e_iterator_get(it);
char *full = g_strdup_printf("%s <%s>", a->id->name, a->id->address);
- if (!strcmp (full, str)) {
+ if (!g_ascii_strcasecmp (full, str)) {
g_free (full);
g_object_unref (it);
@@ -707,7 +717,12 @@ memo_page_fill_component (CompEditorPage *page, ECalComponent *comp)
ECalComponentOrganizer organizer = {NULL, NULL, NULL, NULL};
EAccount *a;
- gchar *addr = NULL;
+ gchar *backend_addr = NULL, *org_addr = NULL, *sentby = NULL;
+
+ e_cal_get_cal_address (page->client, &backend_addr, NULL);
+
+ /* Organizer strings */
+ memo_page_select_organizer (mpage, backend_addr);
/* Find the identity for the organizer or sentby field */
a = get_current_account (mpage);
@@ -725,16 +740,25 @@ memo_page_fill_component (CompEditorPage *page, ECalComponent *comp)
return FALSE;
}
- addr = g_strdup_printf ("MAILTO:%s", a->id->address);
+ if (!backend_addr || !g_ascii_strcasecmp (backend_addr, a->id->address)) {
+ org_addr = g_strdup_printf ("MAILTO:%s", a->id->address);
+ organizer.value = org_addr;
+ organizer.cn = a->id->name;
+ } else {
+ org_addr = g_strdup_printf ("MAILTO:%s", backend_addr);
+ sentby = g_strdup_printf ("MAILTO:%s", a->id->address);
+ organizer.value = org_addr;
+ organizer.sentby = sentby;
+ };
- organizer.value = addr;
- organizer.cn = a->id->name;
e_cal_component_set_organizer (comp, &organizer);
if (page->flags & COMP_EDITOR_PAGE_NEW_ITEM)
comp_editor_page_notify_needs_send (page);
- g_free (addr);
+ g_free (backend_addr);
+ g_free (org_addr);
+ g_free (sentby);
}
return TRUE;
@@ -752,6 +776,23 @@ memo_page_set_show_categories (MemoPage *page, gboolean state)
}
}
+/*If the msg has some value set, the icon should always be set */
+void
+memo_page_set_info_string (MemoPage *mpage, const gchar *icon, const gchar *msg)
+{
+ MemoPagePrivate *priv;
+
+ priv = mpage->priv;
+
+ gtk_image_set_from_stock (GTK_IMAGE (priv->info_icon), icon, GTK_ICON_SIZE_BUTTON);
+ gtk_label_set_text (GTK_LABEL(priv->info_string), msg);
+
+ if (msg && icon)
+ gtk_widget_show (priv->info_hbox);
+ else
+ gtk_widget_hide (priv->info_hbox);
+}
+
/* Gets the widgets from the XML file and returns if they are all available. */
static gboolean
get_widgets (MemoPage *mpage)
@@ -781,6 +822,10 @@ get_widgets (MemoPage *mpage)
g_object_ref (priv->main);
gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main);
+ priv->info_hbox = GW ("generic-info");
+ priv->info_icon = GW ("generic-info-image");
+ priv->info_string = GW ("generic-info-msgs");
+
priv->org_label = GW ("org-label");
priv->org_combo = GW ("org-combo");
@@ -871,6 +916,17 @@ source_changed_cb (GtkWidget *widget, ESource *source, gpointer data)
comp_editor_notify_client_changed (
COMP_EDITOR (gtk_widget_get_toplevel (priv->main)),
client);
+
+ if (client) {
+ gchar *backend_addr = NULL;
+
+ e_cal_get_cal_address(client, &backend_addr, NULL);
+ if (backend_addr) {
+ memo_page_select_organizer (mpage, backend_addr);
+ g_free (backend_addr);
+ }
+ }
+
sensitize_widgets (mpage);
}
}
@@ -946,6 +1002,9 @@ init_widgets (MemoPage *mpage)
priv = mpage->priv;
+ /* Generic informative messages */
+ gtk_widget_hide (priv->info_hbox);
+
/* Summary */
g_signal_connect((priv->summary_entry), "changed",
G_CALLBACK (summary_changed_cb), mpage);
@@ -1020,6 +1079,69 @@ get_to_entry (ENameSelector *name_selector)
return GTK_WIDGET (name_selector_entry);
}
+static void
+memo_page_select_organizer (MemoPage *mpage, const char *backend_address)
+{
+ MemoPagePrivate *priv;
+ EIterator *it;
+ EAccount *def_account;
+ EAccount *a;
+ gboolean subscribed_cal = FALSE;
+ ESource *source = NULL;
+ const char *user_addr = NULL;
+
+ memo_page_set_info_string (mpage, NULL, NULL);
+
+ priv = mpage->priv;
+ if (COMP_EDITOR_PAGE (mpage)->client)
+ source = e_cal_get_source (COMP_EDITOR_PAGE (mpage)->client);
+ if (source)
+ user_addr = e_source_get_property (source, "subscriber");
+
+ if (user_addr)
+ subscribed_cal = TRUE;
+ else
+ user_addr = backend_address;
+
+ def_account = itip_addresses_get_default();
+ for (it = e_list_get_iterator((EList *)priv->accounts);
+ e_iterator_is_valid(it);
+ e_iterator_next(it)) {
+ gchar *full = NULL;
+
+ a = (EAccount *)e_iterator_get(it);
+ full = g_strdup_printf("%s <%s>", a->id->name, a->id->address);
+
+ /* Note that the address specified by the backend gets
+ * precedence over the default mail address.
+ */
+ if (user_addr && !g_ascii_strcasecmp (user_addr, a->id->address)) {
+ if (priv->default_address)
+ g_free (priv->default_address);
+
+ priv->default_address = full;
+ } else if (a == def_account && !priv->default_address)
+ priv->default_address = full;
+ }
+ g_object_unref(it);
+
+ if (priv->default_address) {
+ if (COMP_EDITOR_PAGE (mpage)->flags & COMP_EDITOR_PAGE_NEW_ITEM) {
+ gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->org_combo)->entry), priv->default_address);
+ /* FIXME: Use accessor functions to access private members of a GtkCombo widget */
+ gtk_widget_set_sensitive (GTK_WIDGET (GTK_COMBO (priv->org_combo)->button), TRUE);
+ }
+ if (subscribed_cal) {
+ /* Translators: This string is used when we are creating a Memo
+ on behalf of some other user */
+ memo_page_set_info_string (mpage, GTK_STOCK_DIALOG_INFO,
+ g_strdup_printf(_("You are acting on behalf of %s"), backend_address));
+ /* FIXME: Use accessor functions to access private members of a GtkCombo widget */
+ gtk_widget_set_sensitive (GTK_WIDGET (GTK_COMBO (priv->org_combo)->button), FALSE);
+ }
+ } else
+ g_warning ("No potential organizers!");
+}
/**
* memo_page_construct:
@@ -1041,6 +1163,7 @@ memo_page_construct (MemoPage *mpage)
EAccount *def_account;
EAccount *a;
CompEditorPageFlags flags = COMP_EDITOR_PAGE (mpage)->flags;
+ ECal *client = COMP_EDITOR_PAGE (mpage)->client;
priv = mpage->priv;
@@ -1062,32 +1185,26 @@ memo_page_construct (MemoPage *mpage)
return NULL;
}
+ /* Address information */
+ if (client && !e_cal_get_cal_address (client, &backend_address, NULL))
+ return NULL;
+
if (flags & COMP_EDITOR_PAGE_IS_SHARED) {
priv->accounts = itip_addresses_get ();
def_account = itip_addresses_get_default();
for (it = e_list_get_iterator((EList *)priv->accounts);
e_iterator_is_valid(it);
e_iterator_next(it)) {
- char *full;
+ gchar *full = NULL;
a = (EAccount *)e_iterator_get(it);
full = g_strdup_printf("%s <%s>", a->id->name, a->id->address);
address_strings = g_list_append(address_strings, full);
-
- /* Note that the address specified by the backend gets
- * precedence over the default mail address.
- */
- if (backend_address && !strcmp (backend_address, a->id->address)) {
- if (priv->default_address)
- g_free (priv->default_address);
-
- priv->default_address = g_strdup (full);
- } else if (a == def_account && !priv->default_address) {
- priv->default_address = g_strdup (full);
- }
}
+ memo_page_select_organizer (mpage, backend_address);
+
if (backend_address)
g_free (backend_address);
diff --git a/calendar/gui/dialogs/memo-page.glade b/calendar/gui/dialogs/memo-page.glade
index c8366f2a7c..4a76ecf82c 100644
--- a/calendar/gui/dialogs/memo-page.glade
+++ b/calendar/gui/dialogs/memo-page.glade
@@ -4,7 +4,7 @@
<glade-interface>
<widget class="GtkWindow" id="memo-toplevel">
- <property name="title" translatable="no">window1</property>
+ <property name="title">window1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
@@ -16,6 +16,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
<child>
<widget class="GtkVBox" id="memo-page">
@@ -24,6 +25,58 @@
<property name="spacing">0</property>
<child>
+ <widget class="GtkHBox" id="generic-info">
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkImage" id="generic-info-image">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">6</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="generic-info-msgs">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">3</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
<widget class="GtkHBox" id="hbox7">
<property name="border_width">3</property>
<property name="visible">True</property>
diff --git a/calendar/gui/dialogs/memo-page.h b/calendar/gui/dialogs/memo-page.h
index dabbf3edbc..a6fe66b549 100644
--- a/calendar/gui/dialogs/memo-page.h
+++ b/calendar/gui/dialogs/memo-page.h
@@ -55,7 +55,7 @@ MemoPage *memo_page_construct (MemoPage *epage);
MemoPage *memo_page_new (BonoboUIComponent *uic, CompEditorPageFlags flags);
void memo_page_set_classification (MemoPage *page, ECalComponentClassification class);
void memo_page_set_show_categories (MemoPage *page, gboolean state);
-
+void memo_page_set_info_string (MemoPage *mpage, const gchar *icon, const gchar *msg);
G_END_DECLS
#endif
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index dd6277cca5..55b02f5fe9 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -81,6 +81,11 @@ struct _TaskPagePrivate {
/* Lists of attendees */
GPtrArray *deleted_attendees;
+ /* Generic informative messages placeholder */
+ GtkWidget *info_hbox;
+ GtkWidget *info_icon;
+ GtkWidget *info_string;
+
GtkWidget *summary;
GtkWidget *summary_label;
@@ -143,6 +148,7 @@ static gboolean task_page_fill_component (CompEditorPage *page, ECalComponent *c
static gboolean task_page_fill_timezones (CompEditorPage *page, GHashTable *timezones);
static void task_page_set_summary (CompEditorPage *page, const char *summary);
static void task_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates);
+static void task_page_select_organizer (TaskPage *tpage, const char *backend_address);
G_DEFINE_TYPE (TaskPage, task_page, TYPE_COMP_EDITOR_PAGE)
@@ -192,6 +198,10 @@ task_page_init (TaskPage *tpage)
priv->sendoptions_shown = FALSE;
priv->sod = NULL;
+ priv->info_hbox = NULL;
+ priv->info_icon = NULL;
+ priv->info_string = NULL;
+
priv->updating = FALSE;
priv->sendoptions_shown = FALSE;
priv->is_assignment = FALSE;
@@ -391,6 +401,11 @@ sensitize_widgets (TaskPage *tpage)
sensitize = (!read_only && sens);
+ /* The list of organizers is set to be non-editable. Otherwise any
+ * change in the displayed list causes an 'Account not found' error.
+ */
+ gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (priv->organizer)->entry), FALSE);
+
gtk_editable_set_editable (GTK_EDITABLE (priv->summary), !read_only);
gtk_widget_set_sensitive (priv->due_date, !read_only);
gtk_widget_set_sensitive (priv->start_date, !read_only);
@@ -486,7 +501,7 @@ get_current_account (TaskPage *page)
EAccount *a = (EAccount *)e_iterator_get(it);
char *full = g_strdup_printf("%s <%s>", a->id->name, a->id->address);
- if (!strcmp (full, str)) {
+ if (!g_ascii_strcasecmp (full, str)) {
g_free (full);
g_object_unref (it);
@@ -662,16 +677,21 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
if (priv->is_assignment) {
ECalComponentOrganizer organizer;
+ gchar *backend_addr = NULL;
priv->user_add = itip_get_comp_attendee (comp, COMP_EDITOR_PAGE (tpage)->client);
+ /* Organizer strings */
+ e_cal_get_cal_address (COMP_EDITOR_PAGE (tpage)->client, &backend_addr, NULL);
+ task_page_select_organizer (tpage, backend_addr);
+
/* If there is an existing organizer show it properly */
if (e_cal_component_has_organizer (comp)) {
e_cal_component_get_organizer (comp, &organizer);
if (organizer.value != NULL) {
const gchar *strip = itip_strip_mailto (organizer.value);
gchar *string;
- if (itip_organizer_is_user (comp, page->client)) {
+ if (itip_organizer_is_user (comp, page->client) || itip_sentby_is_user (comp)) {
if (e_cal_get_static_capability (
page->client,
CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS))
@@ -704,21 +724,30 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
if (a != NULL) {
/* Reuse *page declared further up? */
CompEditorPage *page = (CompEditorPage *) tpage;
+
priv->ia = e_meeting_store_add_attendee_with_defaults (priv->model);
g_object_ref (priv->ia);
- e_meeting_attendee_set_address (priv->ia, g_strdup_printf ("MAILTO:%s", a->id->address));
- e_meeting_attendee_set_cn (priv->ia, g_strdup (a->id->name));
+ if (!(backend_addr && *backend_addr) || !g_ascii_strcasecmp (backend_addr, a->id->address)) {
+ e_meeting_attendee_set_address (priv->ia, g_strdup_printf ("MAILTO:%s", a->id->address));
+ e_meeting_attendee_set_cn (priv->ia, g_strdup (a->id->name));
+ } else {
+ e_meeting_attendee_set_address (priv->ia, g_strdup_printf ("MAILTO:%s", backend_addr));
+ e_meeting_attendee_set_sentby (priv->ia, g_strdup_printf ("MAILTO:%s", a->id->address));
+ }
+
if (page->client && e_cal_get_organizer_must_accept (page->client))
e_meeting_attendee_set_status (priv->ia, ICAL_PARTSTAT_NEEDSACTION);
else
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);
}
+
}
+ if (backend_addr)
+ g_free (backend_addr);
}
-
priv->updating = FALSE;
sensitize_widgets (tpage);
@@ -895,7 +924,12 @@ task_page_fill_component (CompEditorPage *page, ECalComponent *comp)
if (!priv->existing) {
EAccount *a;
- gchar *addr = NULL;
+ gchar *backend_addr = NULL, *org_addr = NULL, *sentby = NULL;
+
+ e_cal_get_cal_address (page->client, &backend_addr, NULL);
+
+ /* FIXME need not set organizer strings here */
+ task_page_select_organizer (tpage, backend_addr);
/* Find the identity for the organizer or sentby field */
a = get_current_account (tpage);
@@ -913,13 +947,22 @@ task_page_fill_component (CompEditorPage *page, ECalComponent *comp)
return FALSE;
}
- addr = g_strdup_printf ("MAILTO:%s", a->id->address);
+ if (!backend_addr || !g_ascii_strcasecmp (backend_addr, a->id->address)) {
+ org_addr = g_strdup_printf ("MAILTO:%s", a->id->address);
+ organizer.value = org_addr;
+ organizer.cn = a->id->name;
+ } else {
+ org_addr = g_strdup_printf ("MAILTO:%s", backend_addr);
+ sentby = g_strdup_printf ("MAILTO:%s", a->id->address);
+ organizer.value = org_addr;
+ organizer.sentby = sentby;
+ }
- organizer.value = addr;
- organizer.cn = a->id->name;
e_cal_component_set_organizer (comp, &organizer);
- g_free (addr);
+ g_free (backend_addr);
+ g_free (org_addr);
+ g_free (sentby);
}
if (e_meeting_store_count_actual_attendees (priv->model) < 1) {
@@ -1001,19 +1044,27 @@ existing_attendee (EMeetingAttendee *ia, ECalComponent *comp)
{
GSList *attendees, *l;
const gchar *ia_address;
+ const gchar *ia_sentby = NULL;
ia_address = itip_strip_mailto (e_meeting_attendee_get_address (ia));
if (!ia_address)
return FALSE;
+ if (e_meeting_attendee_is_set_sentby (ia))
+ ia_sentby = itip_strip_mailto (e_meeting_attendee_get_sentby (ia));
+
e_cal_component_get_attendee_list (comp, &attendees);
for (l = attendees; l; l = l->next) {
ECalComponentAttendee *attendee = l->data;
const char *address;
+ const char *sentby = NULL;
address = itip_strip_mailto (attendee->value);
- if (address && !g_ascii_strcasecmp (ia_address, address)) {
+ if (attendee->sentby)
+ sentby = itip_strip_mailto (attendee->sentby);
+
+ if ((address && !g_ascii_strcasecmp (ia_address, address)) || (sentby && !g_ascii_strcasecmp (ia_sentby, sentby))) {
e_cal_component_free_attendee_list (attendees);
return TRUE;
}
@@ -1351,6 +1402,24 @@ task_page_fill_timezones (CompEditorPage *page, GHashTable *timezones)
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)
+{
+ TaskPagePrivate *priv;
+
+ priv = tpage->priv;
+
+ gtk_image_set_from_stock (GTK_IMAGE (priv->info_icon), icon, GTK_ICON_SIZE_BUTTON);
+ gtk_label_set_text (GTK_LABEL(priv->info_string), msg);
+
+
+ if (msg && icon)
+ gtk_widget_show (priv->info_hbox);
+ else
+ gtk_widget_hide (priv->info_hbox);
+}
+
/* set_summary handler for the task page */
static void
task_page_set_summary (CompEditorPage *page, const char *summary)
@@ -1402,6 +1471,10 @@ get_widgets (TaskPage *tpage)
g_object_ref (priv->main);
gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main);
+ priv->info_hbox = GW ("generic-info");
+ priv->info_icon = GW ("generic-info-image");
+ priv->info_string = GW ("generic-info-msgs");
+
priv->summary = GW ("summary");
priv->summary_label = GW ("summary-label");
@@ -1657,6 +1730,16 @@ source_changed_cb (GtkWidget *widget, ESource *source, gpointer data)
else
task_page_hide_options (tpage);
+ if (client) {
+ gchar *backend_addr = NULL;
+
+ e_cal_get_cal_address(client, &backend_addr, NULL);
+
+ if (backend_addr && *backend_addr)
+ task_page_select_organizer (tpage, backend_addr);
+
+ g_free (backend_addr);
+ }
sensitize_widgets (tpage);
}
@@ -1707,6 +1790,9 @@ init_widgets (TaskPage *tpage)
(EDateEditGetTimeCallback) comp_editor_get_current_time,
tpage, NULL);
+ /* Generic informative messages */
+ gtk_widget_hide (priv->info_hbox);
+
/* Summary */
g_signal_connect((priv->summary), "changed",
G_CALLBACK (summary_changed_cb), tpage);
@@ -1801,6 +1887,72 @@ init_widgets (TaskPage *tpage)
+static void
+task_page_select_organizer (TaskPage *tpage, const char *backend_address)
+{
+ TaskPagePrivate *priv;
+ EIterator *it;
+ EAccount *def_account;
+ EAccount *a;
+ gboolean subscribed_cal = FALSE;
+ ESource *source = NULL;
+ const char *user_addr = NULL;
+
+ task_page_set_info_string (tpage, NULL, NULL);
+
+ priv = tpage->priv;
+ if (COMP_EDITOR_PAGE (tpage)->client)
+ source = e_cal_get_source (COMP_EDITOR_PAGE (tpage)->client);
+ if (source)
+ user_addr = e_source_get_property (source, "subscriber");
+
+ if (user_addr)
+ subscribed_cal = TRUE;
+ else
+ user_addr = backend_address;
+
+ def_account = itip_addresses_get_default();
+ for (it = e_list_get_iterator((EList *)priv->accounts);
+ e_iterator_is_valid(it);
+ e_iterator_next(it)) {
+ gchar *full = NULL;
+
+ a = (EAccount *)e_iterator_get(it);
+ full = g_strdup_printf("%s <%s>", a->id->name, a->id->address);
+
+ /* Note that the address specified by the backend gets
+ * precedence over the default mail address.
+ */
+ if (user_addr && !g_ascii_strcasecmp (user_addr, a->id->address)) {
+ if (priv->default_address)
+ g_free (priv->default_address);
+
+ priv->default_address = full;
+ } else if (a == def_account && !priv->default_address)
+ priv->default_address = full;
+ }
+ g_object_unref(it);
+
+ if (priv->default_address) {
+ if (!priv->comp || !e_cal_component_has_organizer (priv->comp)) {
+ gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry), priv->default_address);
+ /* FIXME: Use accessor functions to access private members of a GtkCombo widget */
+ gtk_widget_set_sensitive (GTK_WIDGET (GTK_COMBO (priv->organizer)->button), TRUE);
+ }
+
+ /*FIXME do not set the info string here */
+ if (subscribed_cal) {
+ /* Translators: This string is used when we are creating a Task
+ on behalf of some other user */
+ task_page_set_info_string (tpage, GTK_STOCK_DIALOG_INFO,
+ g_strdup_printf(_("You are acting on behalf of %s"), backend_address));
+ /* FIXME: Use accessor functions to access private members of a GtkCombo widget */
+ gtk_widget_set_sensitive (GTK_WIDGET (GTK_COMBO (priv->organizer)->button), FALSE);
+ }
+ } else
+ g_warning ("No potential organizers!");
+}
+
/**
* task_page_construct:
* @tpage: An task page.
@@ -1852,26 +2004,16 @@ task_page_construct (TaskPage *tpage, EMeetingStore *model, ECal *client)
for (it = e_list_get_iterator((EList *)priv->accounts);
e_iterator_is_valid(it);
e_iterator_next(it)) {
- char *full;
+ gchar *full = NULL;
a = (EAccount *)e_iterator_get(it);
full = g_strdup_printf("%s <%s>", a->id->name, a->id->address);
address_strings = g_list_append(address_strings, full);
-
- /* Note that the address specified by the backend gets
- * precedence over the default mail address.
- */
- if (backend_address && !strcmp (backend_address, a->id->address)) {
- if (priv->default_address)
- g_free (priv->default_address);
-
- priv->default_address = g_strdup (full);
- } else if (a == def_account && !priv->default_address) {
- priv->default_address = g_strdup (full);
- }
}
+ task_page_select_organizer (tpage, backend_address);
+
if (backend_address)
g_free (backend_address);
diff --git a/calendar/gui/dialogs/task-page.glade b/calendar/gui/dialogs/task-page.glade
index 7b98c97497..a4a105606c 100644
--- a/calendar/gui/dialogs/task-page.glade
+++ b/calendar/gui/dialogs/task-page.glade
@@ -4,7 +4,7 @@
<glade-interface>
<widget class="GtkWindow" id="task-toplevel">
- <property name="title" translatable="no">window1</property>
+ <property name="title">window1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
@@ -16,6 +16,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
<child>
<widget class="GtkVBox" id="task-page">
@@ -25,6 +26,58 @@
<property name="spacing">6</property>
<child>
+ <widget class="GtkHBox" id="generic-info">
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkImage" id="generic-info-image">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">6</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="generic-info-msgs">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">3</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
<widget class="GtkHBox" id="hbox7">
<property name="visible">True</property>
<property name="homogeneous">False</property>
@@ -320,6 +373,8 @@
<child>
<widget class="GtkTextView" id="description">
+ <property name="width_request">400</property>
+ <property name="height_request">150</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
@@ -335,8 +390,6 @@
<property name="right_margin">0</property>
<property name="indent">0</property>
<property name="text" translatable="yes"></property>
- <property name="width_request">400</property>
- <property name="height_request">150</property>
</widget>
</child>
</widget>
diff --git a/calendar/gui/dialogs/task-page.h b/calendar/gui/dialogs/task-page.h
index 64fa67591b..1431b4976b 100644
--- a/calendar/gui/dialogs/task-page.h
+++ b/calendar/gui/dialogs/task-page.h
@@ -70,7 +70,7 @@ void task_page_set_view_rsvp (TaskPage *page, gboolean state);
void task_page_set_classification (TaskPage *page, ECalComponentClassification class);
void task_page_set_show_timezone (TaskPage *page, gboolean state);
void task_page_set_show_categories (TaskPage *page, gboolean state);
-
+void task_page_set_info_string (TaskPage *tpage, const gchar *icon, const gchar *msg);
G_END_DECLS
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 06a1b9a91e..e77a3a895b 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -222,78 +222,6 @@ html_new_lines_for (char *string)
return html_string;
}
-void
-sanitize_component (ECalComponent *comp, ECal *client)
-{
- GSList *attendees;
- EAccountList *al;
- EAccount *a;
- EIterator *it;
- ECalComponentOrganizer organizer;
- ECalComponentAttendee *attendee = NULL;
- ESource *cal_source = NULL;
- char *backend_address = NULL;
- char *subscriber_address = NULL;
-
- e_cal_component_get_attendee_list (comp, &attendees);
- al = itip_addresses_get ();
- e_cal_get_cal_address (client, &backend_address, NULL);
- if (!al || !backend_address)
- return;
-
- /* Look for the backend address in the list of enabled accounts */
- for (it = e_list_get_iterator((EList *)al);
- e_iterator_is_valid(it);
- e_iterator_next(it)) {
-
- a = (EAccount *) e_iterator_get(it);
- if (!a->enabled)
- continue;
-
- if (!g_ascii_strcasecmp (a->id->address, backend_address)) {
- e_cal_component_free_attendee_list (attendees);
- g_free (backend_address);
- return;
- }
- }
-
- /* Backend address was not found in the list of accounts. Check if its a foreign/susbcribed backend */
- cal_source = e_cal_get_source (client);
- if (!cal_source) {
- e_cal_component_free_attendee_list (attendees);
- g_free (backend_address);
- return;
- }
-
- subscriber_address = e_source_get_property (cal_source, "subscriber");
- if (!subscriber_address) {
- e_cal_component_free_attendee_list (attendees);
- g_free (backend_address);
- return;
- }
-
- attendee = get_attendee (attendees, backend_address);
- e_cal_component_get_organizer (comp, &organizer) ;
-
- e_cal_component_free_attendee_list (attendees);
-
- if (organizer.value && !g_ascii_strcasecmp (itip_strip_mailto (organizer.value), subscriber_address)) {
- ECalComponentOrganizer new_organizer;
- new_organizer.value = g_strdup_printf ("MAILTO:%s", backend_address);
- new_organizer.cn = (attendee && attendee->cn) ? g_strdup (attendee->cn) : g_strdup (backend_address);
- new_organizer.sentby = g_strdup (organizer.value);
- new_organizer.language = g_strdup (organizer.language);
- e_cal_component_set_organizer (comp, &new_organizer);
- }
- else if (attendee) {
- attendee->sentby = g_strdup_printf ("MAILTO:%s", subscriber_address);
- }
-
- e_cal_component_rescan (comp);
- g_free (backend_address);
- g_free (subscriber_address);
-}
-
char *
itip_get_comp_attendee (ECalComponent *comp, ECal *client)
{
@@ -1313,7 +1241,6 @@ itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp,
/* Give the server a chance to manipulate the comp */
if (method != E_CAL_COMPONENT_METHOD_PUBLISH) {
- sanitize_component (send_comp, client);
if (!comp_server_send (method, send_comp, client, zones, &users))
goto cleanup;
}
@@ -1486,9 +1413,6 @@ reply_to_calendar_comp (ECalComponentItipMethod method, ECalComponent *send_comp
CORBA_exception_init (&ev);
- /* Sanitize the component */
- sanitize_component (send_comp, client);
-
/* Tidy up the comp */
comp = comp_compliant (method, send_comp, client, zones);
if (comp == NULL)