diff options
author | Chenthill Palanisamy <pchenthill@novell.com> | 2005-01-06 17:25:21 +0800 |
---|---|---|
committer | Chenthill Palanisamy <pchen@src.gnome.org> | 2005-01-06 17:25:21 +0800 |
commit | b7c7fa51d6f12bf02871a65a4c6deffb3f559378 (patch) | |
tree | 0e4b31fa5e0716a9353b2e3a70eb1f1e25d05090 /calendar/gui | |
parent | 19eea87a0bc90e8d02548e3b901d8c1a57824147 (diff) | |
download | gsoc2013-evolution-b7c7fa51d6f12bf02871a65a4c6deffb3f559378.tar.gz gsoc2013-evolution-b7c7fa51d6f12bf02871a65a4c6deffb3f559378.tar.zst gsoc2013-evolution-b7c7fa51d6f12bf02871a65a4c6deffb3f559378.zip |
Commiting send options
2005-01-06 Chenthill Palanisamy <pchenthill@novell.com>
Commiting send options
svn path=/trunk/; revision=28252
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/dialogs/Makefile.am | 2 | ||||
-rw-r--r-- | calendar/gui/dialogs/e-send-options-utils.c | 219 | ||||
-rw-r--r-- | calendar/gui/dialogs/e-send-options-utils.h | 31 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-editor.c | 5 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 94 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.glade | 57 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.h | 3 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 4 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-page.c | 95 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-page.glade | 57 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-page.h | 2 |
11 files changed, 562 insertions, 7 deletions
diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am index 03f05715ed..00bc9865b9 100644 --- a/calendar/gui/dialogs/Makefile.am +++ b/calendar/gui/dialogs/Makefile.am @@ -48,6 +48,8 @@ libcal_dialogs_la_SOURCES = \ delete-error.h \ e-delegate-dialog.c \ e-delegate-dialog.h \ + e-send-options-utils.c \ + e-send-options-utils.h \ event-editor.c \ event-editor.h \ event-page.c \ diff --git a/calendar/gui/dialogs/e-send-options-utils.c b/calendar/gui/dialogs/e-send-options-utils.c new file mode 100644 index 0000000000..ff70a2ccd7 --- /dev/null +++ b/calendar/gui/dialogs/e-send-options-utils.c @@ -0,0 +1,219 @@ +/* Evolution calendar - Timezone selector dialog + * + * Copyright (C) 2001 Ximian, Inc. + * + * Authors: Damon Chaplin <damon@ximian.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#include "e-send-options-utils.h" +#include "../calendar-config.h" +#include <glib.h> + +ESendOptionsDialog *sod = NULL; + +void +e_sendoptions_utils_set_default_data (ESendOptionsDialog *sod, ESource *source, char * type) +{ + ESendOptionsGeneral *gopts = NULL; + ESendOptionsStatusTracking *sopts; + GConfClient *gconf = gconf_client_get_default (); + ESourceList *source_list; + const char *uid; + const char *value; + + gopts = sod->data->gopts; + sopts = sod->data->sopts; + + if (!strcmp (type, "calendar")) + source_list = e_source_list_new_for_gconf (gconf, "/apps/evolution/calendar/sources"); + else + source_list = e_source_list_new_for_gconf (gconf, "/apps/evolution/tasks/sources"); + + uid = e_source_peek_uid (source); + source = e_source_list_peek_source_by_uid (source_list, uid); + + /* priority */ + value = e_source_get_property (source, "priority"); + if (value) { + if (!strcmp (value, "high")) + gopts->priority = E_PRIORITY_HIGH; + else if (!strcmp (value, "standard")) + gopts->priority = E_PRIORITY_STANDARD; + else if (!strcmp (value, "low")) + gopts->priority = E_PRIORITY_LOW; + else + gopts->priority = E_PRIORITY_UNDEFINED; + } + /* Reply requested */ + value = e_source_get_property (source, "reply-requested"); + if (value) { + if (!strcmp (value, "none")) + gopts->reply_enabled = FALSE; + else if (!strcmp (value, "convinient")) { + gopts->reply_enabled = TRUE; + gopts->reply_convenient = TRUE; + } else { + gint i = atoi (value); + gopts->reply_within = i; + } + } + /* Delay delivery */ + value = e_source_get_property (source, "delay-delivery"); + if (value) { + if (!strcmp (value, "none")) + gopts->delay_enabled = FALSE; + else { + gopts->delay_enabled = TRUE; + gopts->delay_until = icaltime_as_timet (icaltime_from_string (value)); + } + } + /* Expiration Date */ + value = e_source_get_property (source, "expiration"); + if (value) { + if (!strcmp (value, "none")) + gopts->expiration_enabled = FALSE; + else { + gint i = atoi (value); + if (i == 0) + gopts->expiration_enabled = FALSE; + else + gopts->expiration_enabled = TRUE; + gopts->expire_after = i; + } + } + /* status tracking */ + value = e_source_get_property (source, "status-tracking"); + if (value) { + if (!strcmp (value, "none")) + sopts->tracking_enabled = FALSE; + else { + sopts->tracking_enabled = TRUE; + if (!strcmp (value, "delivered")) + sopts->track_when = E_DELIVERED; + else if (!strcmp (value, "delivered-opened")) + sopts->track_when = E_DELIVERED_OPENED; + else + sopts->track_when = E_ALL; + } + } + + /* Return Notifications */ + + value = e_source_get_property (source, "return-open"); + if (value) { + if (!strcmp (value, "none")) + sopts->opened = E_RETURN_NOTIFY_NONE; + else + sopts->opened = E_RETURN_NOTIFY_MAIL; + } + + value = e_source_get_property (source, "return-accept"); + if (value) { + if (!strcmp (value, "none")) + sopts->accepted = E_RETURN_NOTIFY_NONE; + else + sopts->accepted = E_RETURN_NOTIFY_MAIL; + } + + value = e_source_get_property (source, "return-decline"); + if (value) { + if (!strcmp (value, "none")) + sopts->declined = E_RETURN_NOTIFY_NONE; + else + sopts->declined = E_RETURN_NOTIFY_MAIL; + } + + value = e_source_get_property (source, "return-complete"); + if (value) { + if (!strcmp (value, "none")) + sopts->completed = E_RETURN_NOTIFY_NONE; + else + sopts->completed = E_RETURN_NOTIFY_MAIL; + } + +} + +void +e_sendoptions_utils_fill_component (ESendOptionsDialog *sod, ECalComponent *comp) +{ + int i = 1; + icalproperty *prop; + icalcomponent *icalcomp; + ESendOptionsGeneral *gopts; + ESendOptionsStatusTracking *sopts; + + gopts = sod->data->gopts; + sopts = sod->data->sopts; + + e_cal_component_set_sequence (comp, &i); + icalcomp = e_cal_component_get_icalcomponent (comp); + + if (e_sendoptions_get_need_general_options (sod)) { + prop = icalproperty_new_x ((const char *) g_strdup_printf ("%d", gopts->priority)); + icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-PRIORITY"); + icalcomponent_add_property (icalcomp, prop); + + if (gopts->reply_enabled) { + if (gopts->reply_convenient) + prop = icalproperty_new_x ("convenient"); + else + prop = icalproperty_new_x ((const char *) g_strdup_printf ( "%d", gopts->reply_within)); + icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-REPLY"); + icalcomponent_add_property (icalcomp, prop); + } + + if (gopts->expiration_enabled && gopts->expire_after) { + prop = icalproperty_new_x ((const char *) g_strdup_printf ( "%d", gopts->expire_after)); + icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-EXPIRE"); + icalcomponent_add_property (icalcomp, prop); + } + + if (gopts->delay_enabled) { + struct icaltimetype temp; + icaltimezone *zone = calendar_config_get_icaltimezone (); + temp = icaltime_from_timet_with_zone (gopts->delay_until, FALSE, zone); + prop = icalproperty_new_x (icaltime_as_ical_string (temp)); + icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-DELAY"); + icalcomponent_add_property (icalcomp, prop); + } + } + + if (sopts->tracking_enabled) + prop = icalproperty_new_x ((const char *) g_strdup_printf ( "%d", sopts->track_when)); + else + prop = icalproperty_new_x ("0"); + + icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-TRACKINFO"); + icalcomponent_add_property (icalcomp, prop); + + + prop = icalproperty_new_x ((const char *) g_strdup_printf ("%d", sopts->opened)); + icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-OPENED"); + icalcomponent_add_property (icalcomp, prop); + + prop = icalproperty_new_x ((const char *) g_strdup_printf ("%d", sopts->accepted)); + icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-ACCEPTED"); + icalcomponent_add_property (icalcomp, prop); + + prop = icalproperty_new_x ((const char *) g_strdup_printf ("%d", sopts->declined)); + icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-DECLINED"); + icalcomponent_add_property (icalcomp, prop); + + prop = icalproperty_new_x ((const char *) g_strdup_printf ("%d", sopts->completed)); + icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-COMPLETED"); + icalcomponent_add_property (icalcomp, prop); +} + diff --git a/calendar/gui/dialogs/e-send-options-utils.h b/calendar/gui/dialogs/e-send-options-utils.h new file mode 100644 index 0000000000..ef35d66d95 --- /dev/null +++ b/calendar/gui/dialogs/e-send-options-utils.h @@ -0,0 +1,31 @@ +/* Evolution calendar - Timezone selector dialog + * + * Copyright (C) 2001 Ximian, Inc. + * + * Authors: Damon Chaplin <damon@ximian.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __E_SENDOPTIONS_UTILS_H__ +#define __E_SENDOPTIONS_UTILS_H__ + +#include "widgets/misc/e-send-options.h" +#include <libecal/e-cal-component.h> +#include <libedataserver/e-source-list.h> + +void e_sendoptions_utils_set_default_data (ESendOptionsDialog *sod, ESource *source, char* type); +void e_sendoptions_utils_fill_component (ESendOptionsDialog *sod, ECalComponent *comp); +#endif diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index d9c558bec3..fb550d9724 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -147,6 +147,9 @@ event_editor_construct (EventEditor *ee, ECal *client) _("Recurrence")); if (priv->is_meeting) { + if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS)) + event_page_show_options (priv->event_page); + comp_editor_set_group_item (COMP_EDITOR (ee), TRUE); priv->sched_page = schedule_page_new (priv->model); g_object_ref (priv->sched_page); @@ -218,7 +221,7 @@ event_editor_edit_comp (CompEditor *editor, ECalComponent *comp) } else { GSList *l; int row; - + if (!priv->meeting_shown) { comp_editor_append_page (COMP_EDITOR (ee), COMP_EDITOR_PAGE (priv->sched_page), diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index d28b3cb986..cfd1642e8b 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -38,6 +38,7 @@ #include "e-util/e-categories-config.h" #include "e-util/e-dialog-widgets.h" #include "widgets/misc/e-dateedit.h" +#include "widgets/misc/e-send-options.h" #include <libecal/e-cal-time-util.h> #include "../calendar-config.h" #include "../e-timezone-entry.h" @@ -46,6 +47,7 @@ #include "../e-alarm-list.h" #include "alarm-list-dialog.h" #include "event-page.h" +#include "e-send-options-utils.h" @@ -84,11 +86,16 @@ struct _EventPagePrivate { GtkWidget *categories; GtkWidget *source_selector; + + GtkWidget *sendoptions_label; + GtkWidget *sendoptions_button; EAlarmList *alarm_list_store; gboolean updating; + gboolean sendoptions_shown; + ESendOptionsDialog *sod; char *old_summary; CalUnits alarm_units; int alarm_interval; @@ -163,11 +170,16 @@ event_page_init (EventPage *epage) priv->alarm_custom = NULL; priv->categories_btn = NULL; priv->categories = NULL; + priv->sendoptions_label = NULL; + priv->sendoptions_button = NULL; + priv->sod = NULL; priv->alarm_interval = -1; priv->updating = FALSE; + priv->sendoptions_shown = FALSE; priv->sync_timezones = FALSE; + } /* Destroy handler for the event page */ @@ -196,6 +208,10 @@ event_page_finalize (GObject *object) priv->alarm_list_store = NULL; } + if (priv->sod) { + g_object_unref (priv->sod); + priv->sod = NULL; + } g_free (priv->old_summary); g_free (priv); @@ -617,9 +633,36 @@ sensitize_widgets (EventPage *epage) else gtk_widget_hide (priv->alarm_warning); gtk_widget_set_sensitive (priv->categories_btn, !read_only); + gtk_widget_set_sensitive (priv->sendoptions_button, !read_only); gtk_entry_set_editable (GTK_ENTRY (priv->categories), !read_only); } +void +event_page_hide_options (EventPage *page) +{ + g_return_if_fail (IS_EVENT_PAGE (page)); + + gtk_widget_hide (page->priv->sendoptions_label); + gtk_widget_hide (page->priv->sendoptions_button); + + page->priv->sendoptions_shown = FALSE; +} + +void +event_page_show_options (EventPage *page) +{ + g_return_if_fail (IS_EVENT_PAGE (page)); + + gtk_widget_show (page->priv->sendoptions_label); + gtk_widget_show (page->priv->sendoptions_button); + + if (e_cal_get_static_capability (COMP_EDITOR_PAGE (page)->client, CAL_STATIC_CAPABILITY_NO_GEN_OPTIONS)) + e_sendoptions_set_need_general_options (page->priv->sod, FALSE); + + page->priv->sendoptions_shown = TRUE; +} + + /* fill_widgets handler for the event page */ static gboolean event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) @@ -630,7 +673,8 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) ECalComponentClassification cl; ECalComponentTransparency transparency; ECalComponentDateTime start_date, end_date; - const char *location; + icalcomponent *icalcomp; + const char *location, *uid = NULL; const char *categories; ESource *source; GSList *l; @@ -747,6 +791,12 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) source = e_cal_get_source (page->client); e_source_option_menu_select (E_SOURCE_OPTION_MENU (priv->source_selector), source); + e_cal_component_get_uid (comp, &uid); + if (e_cal_get_object (COMP_EDITOR_PAGE (epage)->client, uid, NULL, &icalcomp, NULL)) { + icalcomponent_free (icalcomp); + event_page_hide_options (epage); + } + priv->updating = FALSE; sensitize_widgets (epage); @@ -910,6 +960,10 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) busy = e_dialog_toggle_get (priv->show_time_as_busy); e_cal_component_set_transparency (comp, busy ? E_CAL_COMPONENT_TRANSP_OPAQUE : E_CAL_COMPONENT_TRANSP_TRANSPARENT); + /* send options */ + if (priv->sendoptions_shown && priv->sod) + e_sendoptions_utils_fill_component (priv->sod, comp); + /* Alarm */ e_cal_component_remove_all_alarms (comp); if (e_dialog_toggle_get (priv->alarm)) { @@ -1120,6 +1174,9 @@ get_widgets (EventPage *epage) priv->source_selector = GW ("source"); + priv->sendoptions_label = GW ("send-options-label"); + priv->sendoptions_button = GW ("send-options-button"); + #undef GW return (priv->summary @@ -1137,7 +1194,9 @@ get_widgets (EventPage *epage) && priv->alarm_warning && priv->alarm_custom && priv->categories_btn - && priv->categories); + && priv->categories + && priv->sendoptions_label + && priv->sendoptions_button); } /* Callback used when the summary changes; we emit the notification signal. */ @@ -1546,6 +1605,28 @@ categories_clicked_cb (GtkWidget *button, gpointer data) e_categories_config_open_dialog_for_entry (GTK_ENTRY (entry)); } +static void +e_sendoptions_clicked_cb (GtkWidget *button, gpointer data) +{ + EventPage *epage; + EventPagePrivate *priv; + GtkWidget *toplevel; + ESource *source; + + epage = EVENT_PAGE (data); + priv = epage->priv; + + if (!priv->sod) { + priv->sod = e_sendoptions_dialog_new (); + source = e_source_option_menu_peek_selected (E_SOURCE_OPTION_MENU (priv->source_selector)); + e_sendoptions_utils_set_default_data (priv->sod, source, "calendar"); + priv->sod->data->initialized = TRUE; + } + + toplevel = gtk_widget_get_toplevel (priv->main); + e_sendoptions_dialog_run (priv->sod, toplevel, E_ITEM_CALENDAR); +} + /* This is called when any field is changed; it notifies upstream. */ static void field_changed_cb (GtkWidget *widget, gpointer data) @@ -1597,6 +1678,11 @@ source_changed_cb (GtkWidget *widget, ESource *source, gpointer data) comp_editor_notify_client_changed ( COMP_EDITOR (gtk_widget_get_toplevel (priv->main)), client); + if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS)) + event_page_show_options (epage); + else + event_page_hide_options (epage); + sensitize_widgets (epage); } } @@ -1767,6 +1853,10 @@ init_widgets (EventPage *epage) g_signal_connect((priv->categories_btn), "clicked", G_CALLBACK (categories_clicked_cb), epage); + /* send options button */ + g_signal_connect((priv->sendoptions_button), "clicked", + G_CALLBACK (e_sendoptions_clicked_cb), epage); + /* Source selector */ g_signal_connect((priv->source_selector), "source_selected", G_CALLBACK (source_changed_cb), epage); diff --git a/calendar/gui/dialogs/event-page.glade b/calendar/gui/dialogs/event-page.glade index a8b9ba5110..0d734d5c50 100644 --- a/calendar/gui/dialogs/event-page.glade +++ b/calendar/gui/dialogs/event-page.glade @@ -831,6 +831,63 @@ <property name="fill">False</property> </packing> </child> + + <child> + <widget class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_NONE</property> + + <child> + <widget class="GtkAlignment" id="alignment2"> + <property name="border_width">12</property> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">0.06</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">0</property> + <property name="right_padding">253</property> + + <child> + <widget class="GtkButton" id="send-options-button"> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Ad_vanced send options</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="send-options-label"> + <property name="label" translatable="yes"><b>Send Options</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</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> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> </widget> </child> </widget> diff --git a/calendar/gui/dialogs/event-page.h b/calendar/gui/dialogs/event-page.h index a21f084e01..3659fe5d2d 100644 --- a/calendar/gui/dialogs/event-page.h +++ b/calendar/gui/dialogs/event-page.h @@ -53,8 +53,9 @@ typedef struct { GtkType event_page_get_type (void); EventPage *event_page_construct (EventPage *epage); EventPage *event_page_new (void); +void event_page_show_options (EventPage *page); +void event_page_hide_options (EventPage *page); - G_END_DECLS diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index ffcb48c7c7..a0e251f8b8 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -144,6 +144,9 @@ task_editor_construct (TaskEditor *te, ECal *client, gboolean is_assigned) COMP_EDITOR_PAGE (priv->task_details_page), _("Status")); if (priv->is_assigned) { + if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS)) + task_page_show_options (priv->task_page); + comp_editor_set_group_item (COMP_EDITOR (te), TRUE); priv->meet_page = meeting_page_new (priv->model, client); g_object_ref (priv->meet_page); @@ -208,6 +211,7 @@ task_editor_edit_comp (CompEditor *editor, ECalComponent *comp) GSList *l; int row; + task_page_hide_options (priv->task_page); if (!priv->assignment_shown) comp_editor_append_page (COMP_EDITOR (te), COMP_EDITOR_PAGE (priv->meet_page), diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 661eb452e3..bea294bcf4 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -44,6 +44,7 @@ #include "../calendar-config.h" #include "comp-editor.h" #include "comp-editor-util.h" +#include "e-send-options-utils.h" #include "task-page.h" @@ -72,8 +73,13 @@ struct _TaskPagePrivate { GtkWidget *categories; GtkWidget *source_selector; + GtkWidget *sendoptions_label; + GtkWidget *sendoptions_button; gboolean updating; + gboolean sendoptions_shown; + + ESendOptionsDialog *sod; }; static const int classification_map[] = { @@ -140,8 +146,13 @@ task_page_init (TaskPage *tpage) priv->classification = NULL; priv->categories_btn = NULL; priv->categories = NULL; + priv->sendoptions_label = NULL; + priv->sendoptions_button = NULL; + priv->sendoptions_shown = FALSE; + priv->sod = NULL; priv->updating = FALSE; + priv->sendoptions_shown = FALSE; } /* Destroy handler for the task page */ @@ -164,7 +175,12 @@ task_page_finalize (GObject *object) g_object_unref (priv->xml); priv->xml = NULL; } - + + if (priv->sod) { + g_object_unref (priv->sod); + priv->sod = NULL; + } + g_free (priv); tpage->priv = NULL; @@ -250,8 +266,33 @@ sensitize_widgets (TaskPage *tpage) gtk_widget_set_sensitive (priv->description, !read_only); gtk_widget_set_sensitive (priv->classification, !read_only); gtk_widget_set_sensitive (priv->categories_btn, !read_only); + gtk_widget_set_sensitive (priv->sendoptions_button, !read_only); gtk_entry_set_editable (GTK_ENTRY (priv->categories), !read_only); } +void +task_page_hide_options (TaskPage *page) +{ + g_return_if_fail (IS_TASK_PAGE (page)); + + gtk_widget_hide (page->priv->sendoptions_label); + gtk_widget_hide (page->priv->sendoptions_button); + + page->priv->sendoptions_shown = FALSE; + +} +void +task_page_show_options (TaskPage *page) +{ + g_return_if_fail (IS_TASK_PAGE (page)); + + gtk_widget_show (page->priv->sendoptions_label); + gtk_widget_show (page->priv->sendoptions_button); + + if (e_cal_get_static_capability (COMP_EDITOR_PAGE (page)->client, CAL_STATIC_CAPABILITY_NO_GEN_OPTIONS)) + e_sendoptions_set_need_general_options (page->priv->sod, FALSE); + + page->priv->sendoptions_shown = TRUE; +} /* fill_widgets handler for the task page */ static gboolean @@ -263,7 +304,8 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) ECalComponentDateTime d; ECalComponentClassification cl; GSList *l; - const char *categories; + icalcomponent *icalcomp; + const char *categories, *uid; icaltimezone *zone, *default_zone; ESource *source; @@ -391,6 +433,12 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) } e_dialog_option_menu_set (priv->classification, cl, classification_map); + e_cal_component_get_uid (comp, &uid); + if (e_cal_get_object (COMP_EDITOR_PAGE (tpage)->client, uid, NULL, &icalcomp, NULL)) { + icalcomponent_free (icalcomp); + task_page_hide_options (tpage); + } + /* Categories */ e_cal_component_get_categories (comp, &categories); e_dialog_editable_set (priv->categories, categories); @@ -530,6 +578,10 @@ task_page_fill_component (CompEditorPage *page, ECalComponent *comp) /* Classification. */ e_cal_component_set_classification (comp, classification_get (priv->classification)); + + /* send options */ + if (priv->sendoptions_shown && priv->sod) + e_sendoptions_utils_fill_component (priv->sod, comp); /* Categories */ cat = e_dialog_editable_get (priv->categories); @@ -648,6 +700,9 @@ get_widgets (TaskPage *tpage) priv->categories = GW ("categories"); priv->source_selector = GW ("source"); + + priv->sendoptions_label = GW ("send-options-label"); + priv->sendoptions_button = GW ("send-options-button"); #undef GW @@ -660,7 +715,9 @@ get_widgets (TaskPage *tpage) && priv->classification && priv->description && priv->categories_btn - && priv->categories); + && priv->categories + && priv->sendoptions_label + && priv->sendoptions_button); } /* Callback used when the summary changes; we emit the notification signal. */ @@ -818,11 +875,39 @@ source_changed_cb (GtkWidget *widget, ESource *source, gpointer data) comp_editor_notify_client_changed ( COMP_EDITOR (gtk_widget_get_toplevel (priv->main)), client); + if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS)) + task_page_show_options (tpage); + else + task_page_hide_options (tpage); + + sensitize_widgets (tpage); } } } +static void +e_sendoptions_clicked_cb (GtkWidget *button, gpointer data) +{ + TaskPage *tpage; + TaskPagePrivate *priv; + GtkWidget *toplevel; + ESource *source; + + tpage = TASK_PAGE (data); + priv = tpage->priv; + + if (!priv->sod) { + priv->sod = e_sendoptions_dialog_new (); + priv->sod->data->initialized = TRUE; + source = e_source_option_menu_peek_selected (E_SOURCE_OPTION_MENU (priv->source_selector)); + e_sendoptions_utils_set_default_data (priv->sod, source, "task"); + } + + toplevel = gtk_widget_get_toplevel (priv->main); + e_sendoptions_dialog_run (priv->sod, toplevel, E_ITEM_TASK); +} + /* Hooks the widget signals */ static gboolean init_widgets (TaskPage *tpage) @@ -860,6 +945,10 @@ init_widgets (TaskPage *tpage) /* Categories button */ g_signal_connect((priv->categories_btn), "clicked", G_CALLBACK (categories_clicked_cb), tpage); + + /* send options button */ + g_signal_connect((priv->sendoptions_button), "clicked", + G_CALLBACK (e_sendoptions_clicked_cb), tpage); /* Source selector */ g_signal_connect((priv->source_selector), "source_selected", diff --git a/calendar/gui/dialogs/task-page.glade b/calendar/gui/dialogs/task-page.glade index 77117b4f21..41acaff16d 100644 --- a/calendar/gui/dialogs/task-page.glade +++ b/calendar/gui/dialogs/task-page.glade @@ -587,6 +587,63 @@ <property name="fill">False</property> </packing> </child> + + <child> + <widget class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_NONE</property> + + <child> + <widget class="GtkAlignment" id="alignment1"> + <property name="border_width">12</property> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">0.11</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkButton" id="send-options-button"> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Ad_vanced send options</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="send-options-label"> + <property name="label" translatable="yes"><b>Send Options</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</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> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> </widget> </child> </widget> diff --git a/calendar/gui/dialogs/task-page.h b/calendar/gui/dialogs/task-page.h index 16ced619d7..0b2a98a950 100644 --- a/calendar/gui/dialogs/task-page.h +++ b/calendar/gui/dialogs/task-page.h @@ -52,6 +52,8 @@ typedef struct { GtkType task_page_get_type (void); TaskPage *task_page_construct (TaskPage *epage); TaskPage *task_page_new (void); +void task_page_show_options (TaskPage *page); +void task_page_hide_options (TaskPage *page); |