aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Rosevear <jpr@novell.com>2004-06-25 21:37:39 +0800
committerJP Rosevear <jpr@src.gnome.org>2004-06-25 21:37:39 +0800
commit3c8ba7a13ff813aa4be767ca3db8813ce99566fc (patch)
treef1c274af8a9d2216b6f41751710ca967bbff8a0b
parentc3744c7c3cc38f6373dc55e5e957d7d8a76ade87 (diff)
downloadgsoc2013-evolution-3c8ba7a13ff813aa4be767ca3db8813ce99566fc.tar.gz
gsoc2013-evolution-3c8ba7a13ff813aa4be767ca3db8813ce99566fc.tar.zst
gsoc2013-evolution-3c8ba7a13ff813aa4be767ca3db8813ce99566fc.zip
free old_summary (is_custom_alarm): take description into account when
004-06-25 JP Rosevear <jpr@novell.com> * gui/dialogs/event-page.c (event_page_finalize): free old_summary (is_custom_alarm): take description into account when checking for custom alarm (is_custom_alarm_uid_list): pass old_summary (is_custom_alarm_store): ditto (is_custom_alarm_store): ditto (sensitize_widgets): ditto (event_page_fill_component): ditto (event_page_fill_widgets): store the initial summary (alarm_changed_cb): make sure the needs description property gets set on the default alarm (alarm_custom_clicked_cb): copy the current store in case the user hits cancel, if all the alarms are erased uncheck the alarm toggle * gui/dialogs/alarm-dialog.glade: add toggles for custom messages and sound * gui/dialogs/alarm-dialog.c (aalarm_widgets_to_alarm): store custom sound only if the toggle is checked (dalarm_widgets_to_alarm): store custom message only if toggle is checked (get_widgets): load new widgets (aalarm_sound_toggled_cb): sensitize sound entry (dalarm_message_toggled_cb): sensitize message entry (init_widgets): listen for toggle signals svn path=/trunk/; revision=26511
-rw-r--r--calendar/ChangeLog28
-rw-r--r--calendar/gui/dialogs/alarm-dialog.c42
-rw-r--r--calendar/gui/dialogs/alarm-dialog.glade194
-rw-r--r--calendar/gui/dialogs/event-page.c87
4 files changed, 268 insertions, 83 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 5267b41bdf..f64dea5182 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,31 @@
+2004-06-25 JP Rosevear <jpr@novell.com>
+
+ * gui/dialogs/event-page.c (event_page_finalize): free old_summary
+ (is_custom_alarm): take description into account when checking for
+ custom alarm
+ (is_custom_alarm_uid_list): pass old_summary
+ (is_custom_alarm_store): ditto
+ (is_custom_alarm_store): ditto
+ (sensitize_widgets): ditto
+ (event_page_fill_component): ditto
+ (event_page_fill_widgets): store the initial summary
+ (alarm_changed_cb): make sure the needs description property gets
+ set on the default alarm
+ (alarm_custom_clicked_cb): copy the current store in case the user
+ hits cancel, if all the alarms are erased uncheck the alarm toggle
+
+ * gui/dialogs/alarm-dialog.glade: add toggles for custom messages
+ and sound
+
+ * gui/dialogs/alarm-dialog.c (aalarm_widgets_to_alarm): store
+ custom sound only if the toggle is checked
+ (dalarm_widgets_to_alarm): store custom message only if toggle is
+ checked
+ (get_widgets): load new widgets
+ (aalarm_sound_toggled_cb): sensitize sound entry
+ (dalarm_message_toggled_cb): sensitize message entry
+ (init_widgets): listen for toggle signals
+
2004-06-24 JP Rosevear <jpr@novell.com>
* gui/dialogs/alarm-list-dialog.c (selection_changed_cb):
diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c
index e3d4b12be2..779ecf6b7b 100644
--- a/calendar/gui/dialogs/alarm-dialog.c
+++ b/calendar/gui/dialogs/alarm-dialog.c
@@ -89,10 +89,12 @@ typedef struct {
/* Display alarm widgets */
GtkWidget *dalarm_group;
+ GtkWidget *dalarm_message;
GtkWidget *dalarm_description;
/* Audio alarm widgets */
GtkWidget *aalarm_group;
+ GtkWidget *aalarm_sound;
GtkWidget *aalarm_attach;
/* Mail alarm widgets */
@@ -186,6 +188,8 @@ clear_widgets (Dialog *dialog)
e_dialog_option_menu_set (dialog->time, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, time_map);
gtk_widget_set_sensitive (dialog->repeat_group, FALSE);
+ gtk_widget_set_sensitive (dialog->dalarm_group, FALSE);
+ gtk_widget_set_sensitive (dialog->aalarm_group, FALSE);
gtk_notebook_set_current_page (GTK_NOTEBOOK (dialog->option_notebook), 0);
}
@@ -210,7 +214,6 @@ alarm_to_dialog (Dialog *dialog)
else
gtk_widget_set_sensitive (l->data, TRUE);
}
-
/* If we can repeat */
repeat = !e_cal_get_static_capability (dialog->ecal, CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT);
gtk_widget_set_sensitive (dialog->repeat_toggle, repeat);
@@ -259,6 +262,9 @@ aalarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm)
char *url;
icalattach *attach;
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->aalarm_sound)))
+ return;
+
url = e_dialog_editable_get (dialog->aalarm_attach);
attach = icalattach_new_from_url (url ? url : "");
g_free (url);
@@ -278,6 +284,9 @@ dalarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm)
icalcomponent *icalcomp;
icalproperty *icalprop;
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->dalarm_message)))
+ return;
+
text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->dalarm_description));
gtk_text_buffer_get_start_iter (text_buffer, &text_iter_start);
gtk_text_buffer_get_end_iter (text_buffer, &text_iter_end);
@@ -532,9 +541,11 @@ get_widgets (Dialog *dialog)
dialog->option_notebook = GW ("option-notebook");
dialog->dalarm_group = GW ("dalarm-group");
+ dialog->dalarm_message = GW ("dalarm-message");
dialog->dalarm_description = GW ("dalarm-description");
dialog->aalarm_group = GW ("aalarm-group");
+ dialog->aalarm_sound = GW ("aalarm-sound");
dialog->aalarm_attach = GW ("aalarm-attach");
dialog->malarm_group = GW ("malarm-group");
@@ -560,8 +571,10 @@ get_widgets (Dialog *dialog)
&& dialog->repeat_unit
&& dialog->option_notebook
&& dialog->dalarm_group
+ && dialog->dalarm_message
&& dialog->dalarm_description
&& dialog->aalarm_group
+ && dialog->aalarm_sound
&& dialog->aalarm_attach
&& dialog->malarm_group
&& dialog->malarm_address_group
@@ -674,6 +687,28 @@ repeat_toggle_toggled_cb (GtkToggleButton *toggle, gpointer data)
gtk_widget_set_sensitive (dialog->repeat_group, active);
}
+static void
+aalarm_sound_toggled_cb (GtkToggleButton *toggle, gpointer data)
+{
+ Dialog *dialog = data;
+ gboolean active;
+
+ active = gtk_toggle_button_get_active (toggle);
+
+ gtk_widget_set_sensitive (dialog->aalarm_group, active);
+}
+
+static void
+dalarm_message_toggled_cb (GtkToggleButton *toggle, gpointer data)
+{
+ Dialog *dialog = data;
+ gboolean active;
+
+ active = gtk_toggle_button_get_active (toggle);
+
+ gtk_widget_set_sensitive (dialog->dalarm_group, active);
+}
+
/* Hooks the widget signals */
static void
init_widgets (Dialog *dialog)
@@ -687,6 +722,11 @@ init_widgets (Dialog *dialog)
g_signal_connect (G_OBJECT (dialog->repeat_toggle), "toggled",
G_CALLBACK (repeat_toggle_toggled_cb), dialog);
+
+ g_signal_connect (G_OBJECT (dialog->aalarm_sound), "toggled",
+ G_CALLBACK (aalarm_sound_toggled_cb), dialog);
+ g_signal_connect (G_OBJECT (dialog->dalarm_message), "toggled",
+ G_CALLBACK (dalarm_message_toggled_cb), dialog);
}
gboolean
diff --git a/calendar/gui/dialogs/alarm-dialog.glade b/calendar/gui/dialogs/alarm-dialog.glade
index b5f869e82a..3c1c47ae38 100644
--- a/calendar/gui/dialogs/alarm-dialog.glade
+++ b/calendar/gui/dialogs/alarm-dialog.glade
@@ -368,7 +368,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
- <property name="label" translatable="yes">Repeat the alarm</property>
+ <property name="label" translatable="yes">_Repeat the alarm</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
@@ -572,34 +572,34 @@
<widget class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<property name="homogeneous">False</property>
- <property name="spacing">0</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkVBox" id="dalarm-group">
+ <widget class="GtkCheckButton" id="dalarm-message">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Custom _message</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Message to Display:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkTable" id="dalarm-group">
+ <property name="visible">True</property>
+ <property name="n_rows">1</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
@@ -628,15 +628,41 @@
</child>
</widget>
<packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Mes_sage:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
@@ -670,7 +696,25 @@
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
- <property name="spacing">0</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="aalarm-sound">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Custom alarm sound</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
<child>
<widget class="GtkHBox" id="aalarm-group">
@@ -681,8 +725,8 @@
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
- <property name="label" translatable="yes">Play sound:</property>
- <property name="use_underline">False</property>
+ <property name="label" translatable="yes">_Sound:</property>
+ <property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
@@ -691,6 +735,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
+ <property name="mnemonic_widget">aalarm-attach</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -766,29 +811,61 @@
<property name="spacing">0</property>
<child>
- <widget class="GtkHBox" id="palarm-group">
+ <widget class="GtkTable" id="palarm-group">
<property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
<property name="homogeneous">False</property>
- <property name="spacing">6</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
- <property name="label" translatable="yes">Run program:</property>
- <property name="use_underline">False</property>
+ <property name="label" translatable="yes">_Program:</property>
+ <property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
- <property name="xalign">0.5</property>
+ <property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
+ <property name="mnemonic_widget">palarm-program</property>
</widget>
<packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Arguments:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">palarm-args</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
</packing>
</child>
@@ -805,30 +882,11 @@
<property name="activates_default">False</property>
</widget>
<packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label6">
- <property name="visible">True</property>
- <property name="label" translatable="yes">With these arguments:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</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="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
</packing>
</child>
@@ -845,9 +903,11 @@
<property name="activates_default">False</property>
</widget>
<packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
</packing>
</child>
</widget>
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index e723d62fd2..6a69daea0f 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -89,6 +89,8 @@ struct _EventPagePrivate {
gboolean updating;
+ char *old_summary;
+
/* This is TRUE if both the start & end timezone are the same. If the
start timezone is then changed, we updated the end timezone to the
same value, since 99% of events start and end in one timezone. */
@@ -208,6 +210,8 @@ event_page_finalize (GObject *object)
priv->alarm_list_store = NULL;
}
+ g_free (priv->old_summary);
+
g_free (priv);
epage->priv = NULL;
@@ -433,12 +437,16 @@ clear_widgets (EventPage *epage)
}
static gboolean
-is_custom_alarm (ECalComponentAlarm *ca, int *alarm_type)
+is_custom_alarm (ECalComponentAlarm *ca, char *old_summary, int *alarm_type)
{
ECalComponentAlarmTrigger trigger;
ECalComponentAlarmRepeat repeat;
ECalComponentAlarmAction action;
+ ECalComponentText desc;
+ icalcomponent *icalcomp;
+ icalproperty *icalprop;
icalattach *attach;
+ gboolean needs_desc = FALSE;
e_cal_component_alarm_get_action (ca, &action);
if (action != E_CAL_COMPONENT_ALARM_DISPLAY)
@@ -448,11 +456,23 @@ is_custom_alarm (ECalComponentAlarm *ca, int *alarm_type)
if (attach)
return TRUE;
-#if 0
- e_cal_component_alarm_get_description (ca, &desc);
- if (attach)
- return TRUE;
-#endif
+ icalcomp = e_cal_component_alarm_get_icalcomponent (ca);
+ icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
+ while (icalprop) {
+ const char *x_name;
+
+ x_name = icalproperty_get_x_name (icalprop);
+ if (!strcmp (x_name, "X-EVOLUTION-NEEDS-DESCRIPTION"))
+ needs_desc = TRUE;
+
+ icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
+ }
+
+ if (!needs_desc) {
+ e_cal_component_alarm_get_description (ca, &desc);
+ if (!desc.value || !old_summary || strcmp (desc.value, old_summary))
+ return TRUE;
+ }
e_cal_component_alarm_get_repeat (ca, &repeat);
if (repeat.repetitions != 0)
@@ -504,7 +524,7 @@ is_custom_alarm (ECalComponentAlarm *ca, int *alarm_type)
}
static gboolean
-is_custom_alarm_uid_list (ECalComponent *comp, GList *alarms, int *alarm_type)
+is_custom_alarm_uid_list (ECalComponent *comp, GList *alarms, char *old_summary, int *alarm_type)
{
ECalComponentAlarm *ca;
gboolean result;
@@ -513,14 +533,14 @@ is_custom_alarm_uid_list (ECalComponent *comp, GList *alarms, int *alarm_type)
return TRUE;
ca = e_cal_component_get_alarm (comp, alarms->data);
- result = is_custom_alarm (ca, alarm_type);
+ result = is_custom_alarm (ca, old_summary, alarm_type);
e_cal_component_alarm_free (ca);
return result;
}
static gboolean
-is_custom_alarm_store (EAlarmList *alarm_list_store, int *alarm_type)
+is_custom_alarm_store (EAlarmList *alarm_list_store, char *old_summary, int *alarm_type)
{
const ECalComponentAlarm *alarm;
GtkTreeModel *model;
@@ -534,7 +554,7 @@ is_custom_alarm_store (EAlarmList *alarm_list_store, int *alarm_type)
return FALSE;
alarm = e_alarm_list_get_alarm (alarm_list_store, &iter);
- if (is_custom_alarm (( ECalComponentAlarm *)alarm, alarm_type))
+ if (is_custom_alarm ((ECalComponentAlarm *)alarm, old_summary, alarm_type))
return TRUE;
valid_iter = gtk_tree_model_iter_next (model, &iter);
@@ -555,7 +575,7 @@ sensitize_widgets (EventPage *epage)
if (!e_cal_is_read_only (COMP_EDITOR_PAGE (epage)->client, &read_only, NULL))
read_only = TRUE;
- custom = is_custom_alarm_store (priv->alarm_list_store, NULL);
+ custom = is_custom_alarm_store (priv->alarm_list_store, priv->old_summary, NULL);
alarm = e_dialog_toggle_get (priv->alarm);
gtk_widget_set_sensitive (priv->summary_label, !read_only);
@@ -612,7 +632,8 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
e_cal_component_get_summary (comp, &text);
e_dialog_editable_set (priv->summary, text.value);
-
+ priv->old_summary = g_strdup (text.value);
+
e_cal_component_get_location (comp, &location);
e_dialog_editable_set (priv->location, location);
@@ -681,7 +702,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
e_dialog_toggle_set (priv->alarm, TRUE);
alarms = e_cal_component_get_alarm_uids (comp);
- if (!is_custom_alarm_uid_list (comp, alarms, &alarm_type))
+ if (!is_custom_alarm_uid_list (comp, alarms, priv->old_summary, &alarm_type))
e_dialog_option_menu_set (priv->alarm_time, alarm_type, alarm_map);
for (l = alarms; l != NULL; l = l->next) {
@@ -872,7 +893,7 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp)
/* Alarm */
e_cal_component_remove_all_alarms (comp);
if (e_dialog_toggle_get (priv->alarm)) {
- if (is_custom_alarm_store (priv->alarm_list_store, NULL)) {
+ if (is_custom_alarm_store (priv->alarm_list_store, priv->old_summary, NULL)) {
GtkTreeModel *model;
GtkTreeIter iter;
gboolean valid_iter;
@@ -1552,6 +1573,8 @@ alarm_changed_cb (GtkWidget *widget, gpointer data)
if (e_dialog_toggle_get (priv->alarm)) {
ECalComponentAlarm *ca;
ECalComponentAlarmTrigger trigger;
+ icalcomponent *icalcomp;
+ icalproperty *icalprop;
int alarm_type;
ca = e_cal_component_alarm_new ();
@@ -1581,6 +1604,11 @@ alarm_changed_cb (GtkWidget *widget, gpointer data)
}
e_cal_component_alarm_set_trigger (ca, trigger);
+ icalcomp = e_cal_component_alarm_get_icalcomponent (ca);
+ icalprop = icalproperty_new_x ("1");
+ icalproperty_set_x_name (icalprop, "X-EVOLUTION-NEEDS-DESCRIPTION");
+ icalcomponent_add_property (icalcomp, icalprop);
+
e_alarm_list_append (priv->alarm_list_store, NULL, ca);
} else {
e_alarm_list_clear (priv->alarm_list_store);
@@ -1594,14 +1622,43 @@ alarm_custom_clicked_cb (GtkWidget *widget, gpointer data)
{
EventPage *epage;
EventPagePrivate *priv;
+ EAlarmList *temp_list_store;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gboolean valid_iter;
GtkWidget *toplevel;
epage = EVENT_PAGE (data);
priv = epage->priv;
+ /* Make a copy of the list store in case the user cancels */
+ temp_list_store = e_alarm_list_new ();
+ model = GTK_TREE_MODEL (priv->alarm_list_store);
+
+ for (valid_iter = gtk_tree_model_get_iter_first (model, &iter); valid_iter;
+ valid_iter = gtk_tree_model_iter_next (model, &iter)) {
+ ECalComponentAlarm *alarm;
+
+ alarm = (ECalComponentAlarm *) e_alarm_list_get_alarm (priv->alarm_list_store, &iter);
+ g_assert (alarm != NULL);
+
+ e_alarm_list_append (temp_list_store, NULL, alarm);
+ }
+
toplevel = gtk_widget_get_toplevel (priv->main);
- if (alarm_list_dialog_run (toplevel, COMP_EDITOR_PAGE (epage)->client, priv->alarm_list_store))
+ if (alarm_list_dialog_run (toplevel, COMP_EDITOR_PAGE (epage)->client, temp_list_store)) {
+ g_object_unref (priv->alarm_list_store);
+ priv->alarm_list_store = temp_list_store;
+
comp_editor_page_notify_changed (COMP_EDITOR_PAGE (epage));
+ } else {
+ g_object_unref (temp_list_store);
+ }
+
+ /* If the user erases everything, uncheck the alarm toggle */
+ valid_iter = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->alarm_list_store), &iter);
+ if (!valid_iter)
+ e_dialog_toggle_set (priv->alarm, FALSE);
sensitize_widgets (epage);
}