diff options
author | Chris Hemsing <C.Hemsing@gmx.net> | 2011-02-18 20:47:01 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:41:36 +0800 |
commit | cb4f089f51ea643df81930db232fa45f8c32d66b (patch) | |
tree | 8b5111c170ee156cfe75d4a0369410780eaa6db8 | |
parent | fab082af3506af7cc7ed093bd94043154db6dd8c (diff) | |
download | gsoc2013-evolution-cb4f089f51ea643df81930db232fa45f8c32d66b.tar.gz gsoc2013-evolution-cb4f089f51ea643df81930db232fa45f8c32d66b.tar.zst gsoc2013-evolution-cb4f089f51ea643df81930db232fa45f8c32d66b.zip |
Bug #639043 - Alarm notify snooze time not properly adjustable
-rw-r--r-- | calendar/gui/alarm-notify/alarm-notify-dialog.c | 34 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/alarm-notify.ui | 47 |
2 files changed, 65 insertions, 16 deletions
diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.c b/calendar/gui/alarm-notify/alarm-notify-dialog.c index ec3c05ed61..0169901c1f 100644 --- a/calendar/gui/alarm-notify/alarm-notify-dialog.c +++ b/calendar/gui/alarm-notify/alarm-notify-dialog.c @@ -63,10 +63,12 @@ typedef struct { GtkWidget *dialog; GtkWidget *snooze_time_min; GtkWidget *snooze_time_hrs; + GtkWidget *snooze_time_days; GtkWidget *snooze_btn; GtkWidget *dismiss_btn; GtkWidget *minutes_label; GtkWidget *hrs_label; + GtkWidget *days_label; GtkWidget *description; GtkWidget *location; GtkWidget *treeview; @@ -92,30 +94,36 @@ static void an_update_minutes_label (GtkSpinButton *sb, gpointer data) { AlarmNotify *an; - gchar *new_label; gint snooze_timeout_min; an = (AlarmNotify *) data; snooze_timeout_min = gtk_spin_button_get_value_as_int (sb); - new_label = g_strdup (ngettext ("minute", "minutes", snooze_timeout_min)); - gtk_label_set_text (GTK_LABEL (an->minutes_label), new_label); - g_free (new_label); + gtk_label_set_text (GTK_LABEL (an->minutes_label), ngettext ("minute", "minutes", snooze_timeout_min)); } static void an_update_hrs_label (GtkSpinButton *sb, gpointer data) { AlarmNotify *an; - gchar *new_label; gint snooze_timeout_hrs; an = (AlarmNotify *) data; snooze_timeout_hrs = gtk_spin_button_get_value_as_int (sb); - new_label = g_strdup (ngettext ("hour", "hours", snooze_timeout_hrs)); - gtk_label_set_text (GTK_LABEL (an->hrs_label), new_label); - g_free (new_label); + gtk_label_set_text (GTK_LABEL (an->hrs_label), ngettext ("hour", "hours", snooze_timeout_hrs)); +} + +static void +an_update_days_label (GtkSpinButton *sb, gpointer data) +{ + AlarmNotify *an; + gint snooze_timeout_days; + + an = (AlarmNotify *) data; + + snooze_timeout_days = gtk_spin_button_get_value_as_int (sb); + gtk_label_set_text (GTK_LABEL (an->days_label), ngettext ("days", "days", snooze_timeout_days)); } static void @@ -185,6 +193,7 @@ snooze_pressed_cb (GtkButton *button, gpointer user_data) snooze_timeout = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (an->snooze_time_min)); snooze_timeout += 60 * (gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (an->snooze_time_hrs))); + snooze_timeout += 60 * 24 * (gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (an->snooze_time_days))); if (!snooze_timeout) snooze_timeout = DEFAULT_SNOOZE_MINS; (* funcinfo->func) (ALARM_NOTIFY_SNOOZE, snooze_timeout, funcinfo->func_data); @@ -261,6 +270,8 @@ notified_alarms_dialog_new (void) an->minutes_label = e_builder_get_widget (an->builder, "minutes-label"); an->snooze_time_hrs = e_builder_get_widget (an->builder, "snooze-time-hrs"); an->hrs_label = e_builder_get_widget (an->builder, "hrs-label"); + an->snooze_time_days = e_builder_get_widget (an->builder, "snooze-time-days"); + an->days_label = e_builder_get_widget (an->builder, "days-label"); an->description = e_builder_get_widget (an->builder, "description-label"); an->location = e_builder_get_widget (an->builder, "location-label"); an->treeview = e_builder_get_widget (an->builder, "appointments-treeview"); @@ -269,7 +280,8 @@ notified_alarms_dialog_new (void) an->dismiss_btn = e_builder_get_widget (an->builder, "dismiss-button"); edit_btn = e_builder_get_widget (an->builder, "edit-button"); - if (!(an->dialog && an->treeview && an->snooze_time_min && an->snooze_time_hrs + if (!(an->dialog && an->treeview + && an->snooze_time_min && an->snooze_time_hrs && an->snooze_time_days && an->description && an->location && edit_btn && snooze_btn && an->dismiss_btn)) { g_warning ("alarm_notify_dialog(): Could not find all widgets in alarm-notify.ui file!"); g_object_unref (an->builder); @@ -327,6 +339,10 @@ notified_alarms_dialog_new (void) g_signal_connect (G_OBJECT (an->snooze_time_hrs), "value_changed", G_CALLBACK (an_update_hrs_label), an); + /* Set callback for updating the snooze "days" label */ + g_signal_connect (G_OBJECT (an->snooze_time_days), "value_changed", + G_CALLBACK (an_update_days_label), an); + na = g_new0 (AlarmNotificationsDialog, 1); na->treeview = an->treeview; diff --git a/calendar/gui/alarm-notify/alarm-notify.ui b/calendar/gui/alarm-notify/alarm-notify.ui index 181c381aee..bb418ab569 100644 --- a/calendar/gui/alarm-notify/alarm-notify.ui +++ b/calendar/gui/alarm-notify/alarm-notify.ui @@ -3,13 +3,18 @@ <!-- interface-requires gtk+ 2.12 --> <!-- interface-naming-policy toplevel-contextual --> <object class="GtkAdjustment" id="adjustment1"> - <property name="upper">12</property> + <property name="upper">65535</property> <property name="step_increment">1</property> <property name="page_increment">5</property> </object> <object class="GtkAdjustment" id="adjustment2"> + <property name="upper">65535</property> + <property name="step_increment">1</property> + <property name="page_increment">5</property> + </object> + <object class="GtkAdjustment" id="adjustment3"> + <property name="upper">65535</property> <property name="value">5</property> - <property name="upper">59</property> <property name="step_increment">1</property> <property name="page_increment">10</property> </object> @@ -177,7 +182,7 @@ <property name="visible">True</property> <property name="spacing">6</property> <child> - <object class="GtkSpinButton" id="snooze-time-hrs"> + <object class="GtkSpinButton" id="snooze-time-days"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> @@ -191,9 +196,9 @@ </packing> </child> <child> - <object class="GtkLabel" id="hrs-label"> + <object class="GtkLabel" id="days-label"> <property name="visible">True</property> - <property name="label" translatable="yes">hours</property> + <property name="label" translatable="yes">days</property> </object> <packing> <property name="expand">False</property> @@ -201,8 +206,9 @@ <property name="position">1</property> </packing> </child> + <child> - <object class="GtkSpinButton" id="snooze-time-min"> + <object class="GtkSpinButton" id="snooze-time-hrs"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> @@ -216,6 +222,33 @@ </packing> </child> <child> + <object class="GtkLabel" id="hrs-label"> + <property name="visible">True</property> + <property name="label" translatable="yes">hours</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">3</property> + </packing> + </child> + + + <child> + <object class="GtkSpinButton" id="snooze-time-min"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + <property name="adjustment">adjustment3</property> + <property name="climb_rate">1</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">4</property> + </packing> + </child> + <child> <object class="GtkLabel" id="minutes-label"> <property name="visible">True</property> <property name="label" translatable="yes">minutes</property> @@ -223,7 +256,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">3</property> + <property name="position">5</property> </packing> </child> </object> |