aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorFabiano FidĂȘncio <fidencio@redhat.com>2013-06-27 02:17:27 +0800
committerFabiano FidĂȘncio <fidencio@redhat.com>2013-06-28 20:04:36 +0800
commit2b0e8f0a21169b879c044cf917eee51bede7dca5 (patch)
tree6b15efe2fff8e2016a20c2e39a21326b1fe874bf /calendar
parent046a17ba199e79b44337ac376131a2d566a3e7d8 (diff)
downloadgsoc2013-evolution-2b0e8f0a21169b879c044cf917eee51bede7dca5.tar.gz
gsoc2013-evolution-2b0e8f0a21169b879c044cf917eee51bede7dca5.tar.zst
gsoc2013-evolution-2b0e8f0a21169b879c044cf917eee51bede7dca5.zip
Bug #703053 - Error on setting reminder 'after start of appointment'
Check if the client supports setting 'after start' reminder and disable it if necessary (and also disabling 'before end of appoint')
Diffstat (limited to 'calendar')
-rw-r--r--calendar/gui/dialogs/alarm-dialog.c119
-rw-r--r--calendar/gui/dialogs/alarm-dialog.ui42
2 files changed, 90 insertions, 71 deletions
diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c
index 42411f9af7..71852c50d0 100644
--- a/calendar/gui/dialogs/alarm-dialog.c
+++ b/calendar/gui/dialogs/alarm-dialog.c
@@ -182,6 +182,34 @@ clear_widgets (Dialog *dialog)
gtk_notebook_set_current_page (GTK_NOTEBOOK (dialog->option_notebook), 0);
}
+static void
+populate_relative_time_combobox_widget (GtkWidget *combobox,
+ ECalClient *cal_client,
+ const gint *map,
+ gint prop)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gboolean valid;
+ gboolean alarm_after_start;
+ gint i;
+
+ alarm_after_start = !e_client_check_capability (
+ E_CLIENT (cal_client), CAL_STATIC_CAPABILITY_NO_ALARM_AFTER_START);
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (combobox));
+ valid = gtk_tree_model_get_iter_first (model, &iter);
+
+ for (i = 0; valid && map[i] != -1; i++) {
+ gtk_list_store_set (
+ GTK_LIST_STORE (model),
+ &iter,
+ 1,
+ alarm_after_start ? TRUE : (map[i] == prop ? FALSE : TRUE),
+ -1);
+ valid = gtk_tree_model_iter_next (model, &iter);
+ }
+}
+
/* fill_widgets handler for the alarm page */
static void
alarm_to_dialog (Dialog *dialog)
@@ -205,10 +233,13 @@ alarm_to_dialog (Dialog *dialog)
GTK_LIST_STORE (model), &iter,
1, !e_client_check_capability (E_CLIENT (dialog->cal_client), action_map_cap[i]),
-1);
-
valid = gtk_tree_model_iter_next (model, &iter);
}
+ populate_relative_time_combobox_widget (dialog->relative_combo, dialog->cal_client, relative_map, AFTER);
+ populate_relative_time_combobox_widget (
+ dialog->time_combo, dialog->cal_client, time_map, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END);
+
/* Set a default address if possible */
if (!e_client_check_capability (E_CLIENT (dialog->cal_client), CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS)
&& !e_cal_component_alarm_has_attendees (dialog->alarm)
@@ -775,6 +806,44 @@ dialog_to_alarm (Dialog *dialog)
}
}
+static void
+build_combobox_widget (GtkWidget *combobox,
+ const gchar *actions[])
+{
+ GtkComboBox *combo = GTK_COMBO_BOX (combobox);
+ GtkCellRenderer *cell;
+ GtkListStore *store;
+ gint i;
+
+ g_return_val_if_fail (combo != NULL, FALSE);
+ g_return_val_if_fail (GTK_IS_COMBO_BOX (combo), FALSE);
+
+ store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN);
+ gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store));
+ g_object_unref (store);
+
+ gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo));
+
+ cell = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);
+ gtk_cell_layout_set_attributes (
+ GTK_CELL_LAYOUT (combo), cell,
+ "text", 0,
+ "sensitive", 1,
+ NULL);
+
+ for (i = 0; actions[i] != NULL; i++) {
+ GtkTreeIter iter;
+
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (
+ store, &iter,
+ 0, _(actions[i]),
+ 1, TRUE,
+ -1);
+ }
+}
+
/* Gets the widgets from the XML file and returns TRUE if they are all available. */
static gboolean
get_widgets (Dialog *dialog)
@@ -820,41 +889,31 @@ get_widgets (Dialog *dialog)
N_("Pop up an alert"),
N_("Play a sound"),
N_("Run a program"),
- N_("Send an email")
+ N_("Send an email"),
+ NULL
};
- GtkComboBox *combo = (GtkComboBox *) dialog->action_combo;
- GtkCellRenderer *cell;
- GtkListStore *store;
- gint i;
-
- g_return_val_if_fail (combo != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_COMBO_BOX (combo), FALSE);
-
- store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN);
- gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store));
- g_object_unref (store);
+ build_combobox_widget (dialog->action_combo, actions);
+ }
- gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo));
+ if (dialog->relative_combo) {
+ const gchar *actions[] = {
+ N_("before"),
+ N_("after"),
+ NULL
+ };
- cell = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);
- gtk_cell_layout_set_attributes (
- GTK_CELL_LAYOUT (combo), cell,
- "text", 0,
- "sensitive", 1,
- NULL);
+ build_combobox_widget (dialog->relative_combo, actions);
+ }
- for (i = 0; i < G_N_ELEMENTS (actions); i++) {
- GtkTreeIter iter;
+ if (dialog->time_combo) {
+ const gchar *actions[] = {
+ N_("start of appointmenet"),
+ N_("end of appointment"),
+ NULL
+ };
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (
- store, &iter,
- 0, _(actions[i]),
- 1, TRUE,
- -1);
- }
+ build_combobox_widget (dialog->time_combo, actions);
}
return (dialog->action_combo
diff --git a/calendar/gui/dialogs/alarm-dialog.ui b/calendar/gui/dialogs/alarm-dialog.ui
index ba2d7abbd3..c7c03106f4 100644
--- a/calendar/gui/dialogs/alarm-dialog.ui
+++ b/calendar/gui/dialogs/alarm-dialog.ui
@@ -47,32 +47,6 @@
</columns>
<data>
<row>
- <col id="0" translatable="yes">before</col>
- </row>
- <row>
- <col id="0" translatable="yes">after</col>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="model3">
- <columns>
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">start of appointment</col>
- </row>
- <row>
- <col id="0" translatable="yes">end of appointment</col>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="model4">
- <columns>
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
<col id="0" translatable="yes">minutes</col>
</row>
<row>
@@ -256,13 +230,6 @@
<property name="visible">True</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
- <property name="model">model2</property>
- <child>
- <object class="GtkCellRendererText" id="renderer2"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
</object>
<packing>
<property name="padding">0</property>
@@ -275,13 +242,6 @@
<property name="visible">True</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
- <property name="model">model3</property>
- <child>
- <object class="GtkCellRendererText" id="renderer3"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
</object>
<packing>
<property name="padding">0</property>
@@ -449,7 +409,7 @@
<property name="visible">True</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
- <property name="model">model4</property>
+ <property name="model">model2</property>
<child>
<object class="GtkCellRendererText" id="renderer4"/>
<attributes>