[evolution-patches] [calendar] Patch for End time selector, the 'for and untill' options.
- From: Johnny Jacob <johnnyjacob gmail com>
- To: evolution-patches gnome org
- Subject: [evolution-patches] [calendar] Patch for End time selector, the 'for and untill' options.
- Date: Wed, 14 Dec 2005 14:06:48 +0530
hi,
Patch for "end time selector: For, Untill " option when selecting end date/time.
For option allows to specify the endtime in hours and minutes from the
start time.
Please review the patch.
Thank you
Johnny
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2863
diff -u -p -r1.2863 ChangeLog
--- calendar/ChangeLog 6 Dec 2005 08:41:14 -0000 1.2863
+++ calendar/ChangeLog 9 Dec 2005 13:01:24 -0000
@@ -1,3 +1,16 @@
+2005-12-09 Johnny Jacob <johnnyjacob gmail com>
+ * gui/dialogs/event-page.c :
+ * (hour_sel_changed) : Added. Event handler for hour_selector
+ * (minute_sel_changed) : Added. Event handler for minute_selector
+ * (update_end_time_selector) : Added. Updates hour_selector
+ & minute_selector
+ * (hour_minute_changed) : Added. Updates DateEdit based on hour
+ and minute selectors
+ * (sensitize_widgets) : Handle end_time_selector's sensitivity.
+ * (get_widgets) : Get minute_selector.
+ * (init_widgets) : Initialize hour_selector and minute_selector.
+ * gui/dialogs/event-page.glade : minute_selector GtkSpinButton added.
+
2005-12-06 Veerapuram Varadhan <vvaradhan novell com>
* conduits/todo/todo-conduit.c (start_calendar_server):
Index: calendar/gui/dialogs/event-page.glade
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/event-page.glade,v
retrieving revision 1.32
diff -u -p -r1.32 event-page.glade
--- calendar/gui/dialogs/event-page.glade 22 Nov 2005 07:51:19
-0000 1.32
+++ calendar/gui/dialogs/event-page.glade 9 Dec 2005 13:02:11 -0000
@@ -16,7 +16,6 @@
<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="event-page">
@@ -619,15 +618,16 @@
<child>
<widget class="GtkSpinButton"
id="hour_selector">
+ <property name="width_request">52</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
- <property name="digits">1</property>
+ <property name="digits">0</property>
<property name="numeric">False</property>
<property
name="update_policy">GTK_UPDATE_ALWAYS</property>
<property
name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">1 0 24
0.5 1 1</property>
+ <property name="adjustment">1 0 0 1
1 1</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -660,6 +660,50 @@
<property name="fill">False</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkSpinButton"
id="minute_selector">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property
name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property
name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">0 0 59 5
10 10</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="label78">
+ <property name="visible">True</property>
+ <property name="label"
translatable="yes">minutes</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">2</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">2</property>
@@ -828,7 +872,6 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
Index: calendar/gui/dialogs/event-page.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/event-page.c,v
retrieving revision 1.92
diff -u -p -r1.92 event-page.c
--- calendar/gui/dialogs/event-page.c 26 Nov 2005 02:39:46 -0000 1.92
+++ calendar/gui/dialogs/event-page.c 9 Dec 2005 13:02:30 -0000
@@ -94,6 +94,7 @@ struct _EventPagePrivate {
GtkWidget *end_time_selector;
GtkWidget *time_hour;
GtkWidget *hour_selector;
+ GtkWidget *minute_selector;
GtkWidget *start_timezone;
GtkWidget *end_timezone;
GtkWidget *timezone_label;
@@ -168,6 +169,10 @@ static void notify_dates_changed (EventP
static gboolean check_start_before_end (struct icaltimetype
*start_tt, icaltimezone *start_zone,
struct icaltimetype *end_tt,
icaltimezone *end_zone, gboolean
adjust_end_time);
static void set_attendees (ECalComponent *comp, const GPtrArray *attendees);
+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);
G_DEFINE_TYPE (EventPage, event_page, TYPE_COMP_EDITOR_PAGE);
/* Class initialization function for the event page */
@@ -411,10 +416,10 @@ set_all_day (EventPage *epage, gboolean
set_all_day_event_menu (epage, all_day);
- if (all_day)
- gtk_option_menu_set_history ((GtkOptionMenu *)
priv->end_time_selector, 1);
/* TODO implement for in end time selector */
- gtk_widget_set_sensitive (priv->end_time_selector, FALSE);
+ if (all_day)
+ gtk_option_menu_set_history (priv->end_time_selector, 1);
+ gtk_widget_set_sensitive (priv->end_time_selector, !all_day);
e_date_edit_set_show_time (E_DATE_EDIT (priv->start_time), !all_day);
e_date_edit_set_show_time (E_DATE_EDIT (priv->end_time), !all_day);
@@ -785,7 +790,16 @@ sensitize_widgets (EventPage *epage)
gtk_widget_set_sensitive (priv->alarm_custom, alarm);
gtk_widget_set_sensitive (priv->categories_btn, sensitize);
/*TODO implement the for portion of the end time selector */
- gtk_widget_set_sensitive (priv->end_time_selector, FALSE);
+ if ( (COMP_EDITOR_PAGE(epage)->flags) & COMP_EDITOR_PAGE_NEW_ITEM ) {
+ if (priv->all_day_event) {
+ printf("Sen windgets : all day event\n");
+ gtk_option_menu_set_history
(priv->end_time_selector, 1);
+ } else
+ gtk_option_menu_set_history
(priv->end_time_selector, 0);
+ } else
+ gtk_option_menu_set_history (priv->end_time_selector, 1);
+
+
gtk_entry_set_editable (GTK_ENTRY (priv->categories), sensitize);
if (delegate) {
@@ -1042,6 +1056,7 @@ event_page_fill_widgets (CompEditorPage
e_cal_component_free_datetime (&start_date);
e_cal_component_free_datetime (&end_date);
+ update_end_time_selector (epage);
/* Classification */
e_cal_component_get_classification (comp, &cl);
switch (cl) {
@@ -1501,18 +1516,103 @@ event_page_set_dates (CompEditorPage *pa
static void
-time_sel_changed (GtkOptionMenu *widget, EventPagePrivate *priv)
+time_sel_changed (GtkOptionMenu *widget, EventPage *epage)
{
+ EventPagePrivate *priv;
int selection = gtk_option_menu_get_history (widget);
+ priv = epage->priv;
+
if (selection == 1) {
gtk_widget_hide (priv->time_hour);
gtk_widget_show (priv->end_time);
+ hour_sel_changed (priv->hour_selector, epage);
+ minute_sel_changed (priv->minute_selector, epage);
} else if (!selection){
gtk_widget_show (priv->time_hour);
gtk_widget_hide (priv->end_time);
+
+ update_end_time_selector ( epage);
}
-
+}
+
+static
+void update_end_time_selector (EventPage *epage)
+{
+ EventPagePrivate *priv;
+ struct icaltimetype start_tt = icaltime_null_time();
+ struct icaltimetype end_tt = icaltime_null_time();
+ time_t start_timet,end_timet;
+ gint hours,minutes;
+
+ priv = epage->priv;
+
+ e_date_edit_get_date (E_DATE_EDIT (priv->start_time),
+ &start_tt.year,
+ &start_tt.month,
+ &start_tt.day);
+ e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_time),
+ &start_tt.hour,
+ &start_tt.minute);
+ e_date_edit_get_date (E_DATE_EDIT (priv->end_time),
+ &end_tt.year,
+ &end_tt.month,
+ &end_tt.day);
+ e_date_edit_get_time_of_day (E_DATE_EDIT (priv->end_time),
+ &end_tt.hour,
+ &end_tt.minute);
+
+ end_timet = icaltime_as_timet (end_tt);
+ start_timet = icaltime_as_timet (start_tt);
+
+ end_timet -= start_timet;
+ hours = end_timet / ( 60 * 60 );
+ minutes = (end_timet/60) - ( hours * 60 );
+
+ gtk_spin_button_set_value (priv->hour_selector, hours);
+ gtk_spin_button_set_value (priv->minute_selector, minutes);
+}
+
+void
+static hour_sel_changed (GtkSpinButton *widget, EventPage *epage)
+{
+ hour_minute_changed(epage);
+}
+
+void
+static minute_sel_changed (GtkSpinButton *widget, EventPage *epage)
+{
+ hour_minute_changed ( epage);
+}
+
+void
+static hour_minute_changed ( EventPage *epage)
+{
+ EventPagePrivate *priv;
+ gint for_hours, for_minutes;
+ struct icaltimetype end_tt = icaltime_null_time();
+
+ priv = epage->priv;
+
+ e_date_edit_get_date (E_DATE_EDIT (priv->start_time),
+ &end_tt.year,
+ &end_tt.month,
+ &end_tt.day);
+ e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_time),
+ &end_tt.hour,
+ &end_tt.minute);
+
+ for_hours = gtk_spin_button_get_value ( priv->hour_selector);
+ for_minutes = gtk_spin_button_get_value ( priv->minute_selector);
+
+ icaltime_adjust (&end_tt, 0, for_hours, for_minutes, 0);
+
+ e_date_edit_set_date_and_time_of_day (E_DATE_EDIT (priv->end_time),
+ end_tt.year,
+ end_tt.month,
+ end_tt.day,
+ end_tt.hour,
+ end_tt.minute);
}
static void
@@ -1870,12 +1970,12 @@ event_page_set_all_day_event (EventPage
&end_tt.minute);
g_assert (date_set);
- if (all_day) {
- /* FIXME the history set here is wrong */
- gtk_option_menu_set_history ((GtkOptionMenu *)
priv->end_time_selector, 1);
- }
/* TODO implement the for portion in end time selector */
- gtk_widget_set_sensitive (priv->end_time_selector, FALSE);
+ gtk_widget_set_sensitive (priv->end_time_selector, !all_day);
+ if (all_day)
+ gtk_option_menu_set_history (priv->end_time_selector, 1);
+ else
+ gtk_option_menu_set_history (priv->end_time_selector, 0);
if (all_day) {
bonobo_ui_component_set_prop (epage->priv->uic,
"/commands/ViewTimeZone", "sensitive", "0", NULL);
@@ -2073,6 +2173,7 @@ get_widgets (EventPage *epage)
priv->time_hour = GW ("time-hour");
priv->hour_selector = GW ("hour_selector");
+ priv->minute_selector = GW ("minute_selector");
priv->end_time_selector = GW ("end-time-selector");
priv->end_time = GW ("end-time");
@@ -2650,7 +2751,13 @@ init_widgets (EventPage *epage)
gtk_option_menu_set_history ((GtkOptionMenu *)
priv->end_time_selector, 1);
gtk_widget_hide (priv->time_hour);
gtk_widget_show (priv->end_time);
- g_signal_connect (priv->end_time_selector, "changed", G_CALLBACK
(time_sel_changed), priv);
+ g_signal_connect (priv->end_time_selector, "changed", G_CALLBACK
(time_sel_changed), epage);
+ update_end_time_selector ( epage);
+
+ /* Hour and Minute selector */
+ gtk_spin_button_set_range( (GtkSpinButton*)
priv->hour_selector, 0, G_MAXINT);
+ g_signal_connect (priv->hour_selector, "value-changed", G_CALLBACK
(hour_sel_changed), epage);
+ g_signal_connect (priv->minute_selector, "value-changed", G_CALLBACK
(minute_sel_changed), epage);
/* Add the user defined time if necessary */
priv->alarm_units = calendar_config_get_default_reminder_units ();
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2863
diff -u -p -r1.2863 ChangeLog
--- calendar/ChangeLog 6 Dec 2005 08:41:14 -0000 1.2863
+++ calendar/ChangeLog 9 Dec 2005 13:01:24 -0000
@@ -1,3 +1,16 @@
+2005-12-09 Johnny Jacob <johnnyjacob gmail com>
+ * gui/dialogs/event-page.c :
+ * (hour_sel_changed) : Added. Event handler for hour_selector
+ * (minute_sel_changed) : Added. Event handler for minute_selector
+ * (update_end_time_selector) : Added. Updates hour_selector
+ & minute_selector
+ * (hour_minute_changed) : Added. Updates DateEdit based on hour
+ and minute selectors
+ * (sensitize_widgets) : Handle end_time_selector's sensitivity.
+ * (get_widgets) : Get minute_selector.
+ * (init_widgets) : Initialize hour_selector and minute_selector.
+ * gui/dialogs/event-page.glade : minute_selector GtkSpinButton added.
+
2005-12-06 Veerapuram Varadhan <vvaradhan novell com>
* conduits/todo/todo-conduit.c (start_calendar_server):
Index: calendar/gui/dialogs/event-page.glade
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/event-page.glade,v
retrieving revision 1.32
diff -u -p -r1.32 event-page.glade
--- calendar/gui/dialogs/event-page.glade 22 Nov 2005 07:51:19 -0000 1.32
+++ calendar/gui/dialogs/event-page.glade 9 Dec 2005 13:02:11 -0000
@@ -16,7 +16,6 @@
<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="event-page">
@@ -619,15 +618,16 @@
<child>
<widget class="GtkSpinButton" id="hour_selector">
+ <property name="width_request">52</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
- <property name="digits">1</property>
+ <property name="digits">0</property>
<property name="numeric">False</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">1 0 24 0.5 1 1</property>
+ <property name="adjustment">1 0 0 1 1 1</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -660,6 +660,50 @@
<property name="fill">False</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkSpinButton" id="minute_selector">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">0 0 59 5 10 10</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="label78">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">minutes</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">2</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">2</property>
@@ -828,7 +872,6 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
Index: calendar/gui/dialogs/event-page.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/event-page.c,v
retrieving revision 1.92
diff -u -p -r1.92 event-page.c
--- calendar/gui/dialogs/event-page.c 26 Nov 2005 02:39:46 -0000 1.92
+++ calendar/gui/dialogs/event-page.c 9 Dec 2005 13:02:30 -0000
@@ -94,6 +94,7 @@ struct _EventPagePrivate {
GtkWidget *end_time_selector;
GtkWidget *time_hour;
GtkWidget *hour_selector;
+ GtkWidget *minute_selector;
GtkWidget *start_timezone;
GtkWidget *end_timezone;
GtkWidget *timezone_label;
@@ -168,6 +169,10 @@ static void notify_dates_changed (EventP
static gboolean check_start_before_end (struct icaltimetype *start_tt, icaltimezone *start_zone,
struct icaltimetype *end_tt, icaltimezone *end_zone, gboolean adjust_end_time);
static void set_attendees (ECalComponent *comp, const GPtrArray *attendees);
+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);
G_DEFINE_TYPE (EventPage, event_page, TYPE_COMP_EDITOR_PAGE);
/* Class initialization function for the event page */
@@ -411,10 +416,10 @@ set_all_day (EventPage *epage, gboolean
set_all_day_event_menu (epage, all_day);
- if (all_day)
- gtk_option_menu_set_history ((GtkOptionMenu *) priv->end_time_selector, 1);
/* TODO implement for in end time selector */
- gtk_widget_set_sensitive (priv->end_time_selector, FALSE);
+ if (all_day)
+ gtk_option_menu_set_history (priv->end_time_selector, 1);
+ gtk_widget_set_sensitive (priv->end_time_selector, !all_day);
e_date_edit_set_show_time (E_DATE_EDIT (priv->start_time), !all_day);
e_date_edit_set_show_time (E_DATE_EDIT (priv->end_time), !all_day);
@@ -785,7 +790,16 @@ sensitize_widgets (EventPage *epage)
gtk_widget_set_sensitive (priv->alarm_custom, alarm);
gtk_widget_set_sensitive (priv->categories_btn, sensitize);
/*TODO implement the for portion of the end time selector */
- gtk_widget_set_sensitive (priv->end_time_selector, FALSE);
+ if ( (COMP_EDITOR_PAGE(epage)->flags) & COMP_EDITOR_PAGE_NEW_ITEM ) {
+ if (priv->all_day_event) {
+ printf("Sen windgets : all day event\n");
+ gtk_option_menu_set_history (priv->end_time_selector, 1);
+ } else
+ gtk_option_menu_set_history (priv->end_time_selector, 0);
+ } else
+ gtk_option_menu_set_history (priv->end_time_selector, 1);
+
+
gtk_entry_set_editable (GTK_ENTRY (priv->categories), sensitize);
if (delegate) {
@@ -1042,6 +1056,7 @@ event_page_fill_widgets (CompEditorPage
e_cal_component_free_datetime (&start_date);
e_cal_component_free_datetime (&end_date);
+ update_end_time_selector (epage);
/* Classification */
e_cal_component_get_classification (comp, &cl);
switch (cl) {
@@ -1501,18 +1516,103 @@ event_page_set_dates (CompEditorPage *pa
static void
-time_sel_changed (GtkOptionMenu *widget, EventPagePrivate *priv)
+time_sel_changed (GtkOptionMenu *widget, EventPage *epage)
{
+ EventPagePrivate *priv;
int selection = gtk_option_menu_get_history (widget);
+ priv = epage->priv;
+
if (selection == 1) {
gtk_widget_hide (priv->time_hour);
gtk_widget_show (priv->end_time);
+ hour_sel_changed (priv->hour_selector, epage);
+ minute_sel_changed (priv->minute_selector, epage);
} else if (!selection){
gtk_widget_show (priv->time_hour);
gtk_widget_hide (priv->end_time);
+
+ update_end_time_selector ( epage);
}
-
+}
+
+static
+void update_end_time_selector (EventPage *epage)
+{
+ EventPagePrivate *priv;
+ struct icaltimetype start_tt = icaltime_null_time();
+ struct icaltimetype end_tt = icaltime_null_time();
+ time_t start_timet,end_timet;
+ gint hours,minutes;
+
+ priv = epage->priv;
+
+ e_date_edit_get_date (E_DATE_EDIT (priv->start_time),
+ &start_tt.year,
+ &start_tt.month,
+ &start_tt.day);
+ e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_time),
+ &start_tt.hour,
+ &start_tt.minute);
+ e_date_edit_get_date (E_DATE_EDIT (priv->end_time),
+ &end_tt.year,
+ &end_tt.month,
+ &end_tt.day);
+ e_date_edit_get_time_of_day (E_DATE_EDIT (priv->end_time),
+ &end_tt.hour,
+ &end_tt.minute);
+
+ end_timet = icaltime_as_timet (end_tt);
+ start_timet = icaltime_as_timet (start_tt);
+
+ end_timet -= start_timet;
+ hours = end_timet / ( 60 * 60 );
+ minutes = (end_timet/60) - ( hours * 60 );
+
+ gtk_spin_button_set_value (priv->hour_selector, hours);
+ gtk_spin_button_set_value (priv->minute_selector, minutes);
+}
+
+void
+static hour_sel_changed (GtkSpinButton *widget, EventPage *epage)
+{
+ hour_minute_changed(epage);
+}
+
+void
+static minute_sel_changed (GtkSpinButton *widget, EventPage *epage)
+{
+ hour_minute_changed ( epage);
+}
+
+void
+static hour_minute_changed ( EventPage *epage)
+{
+ EventPagePrivate *priv;
+ gint for_hours, for_minutes;
+ struct icaltimetype end_tt = icaltime_null_time();
+
+ priv = epage->priv;
+
+ e_date_edit_get_date (E_DATE_EDIT (priv->start_time),
+ &end_tt.year,
+ &end_tt.month,
+ &end_tt.day);
+ e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_time),
+ &end_tt.hour,
+ &end_tt.minute);
+
+ for_hours = gtk_spin_button_get_value ( priv->hour_selector);
+ for_minutes = gtk_spin_button_get_value ( priv->minute_selector);
+
+ icaltime_adjust (&end_tt, 0, for_hours, for_minutes, 0);
+
+ e_date_edit_set_date_and_time_of_day (E_DATE_EDIT (priv->end_time),
+ end_tt.year,
+ end_tt.month,
+ end_tt.day,
+ end_tt.hour,
+ end_tt.minute);
}
static void
@@ -1870,12 +1970,12 @@ event_page_set_all_day_event (EventPage
&end_tt.minute);
g_assert (date_set);
- if (all_day) {
- /* FIXME the history set here is wrong */
- gtk_option_menu_set_history ((GtkOptionMenu *) priv->end_time_selector, 1);
- }
/* TODO implement the for portion in end time selector */
- gtk_widget_set_sensitive (priv->end_time_selector, FALSE);
+ gtk_widget_set_sensitive (priv->end_time_selector, !all_day);
+ if (all_day)
+ gtk_option_menu_set_history (priv->end_time_selector, 1);
+ else
+ gtk_option_menu_set_history (priv->end_time_selector, 0);
if (all_day) {
bonobo_ui_component_set_prop (epage->priv->uic, "/commands/ViewTimeZone", "sensitive", "0", NULL);
@@ -2073,6 +2173,7 @@ get_widgets (EventPage *epage)
priv->time_hour = GW ("time-hour");
priv->hour_selector = GW ("hour_selector");
+ priv->minute_selector = GW ("minute_selector");
priv->end_time_selector = GW ("end-time-selector");
priv->end_time = GW ("end-time");
@@ -2650,7 +2751,13 @@ init_widgets (EventPage *epage)
gtk_option_menu_set_history ((GtkOptionMenu *) priv->end_time_selector, 1);
gtk_widget_hide (priv->time_hour);
gtk_widget_show (priv->end_time);
- g_signal_connect (priv->end_time_selector, "changed", G_CALLBACK (time_sel_changed), priv);
+ g_signal_connect (priv->end_time_selector, "changed", G_CALLBACK (time_sel_changed), epage);
+ update_end_time_selector ( epage);
+
+ /* Hour and Minute selector */
+ gtk_spin_button_set_range( (GtkSpinButton*) priv->hour_selector, 0, G_MAXINT);
+ g_signal_connect (priv->hour_selector, "value-changed", G_CALLBACK (hour_sel_changed), epage);
+ g_signal_connect (priv->minute_selector, "value-changed", G_CALLBACK (minute_sel_changed), epage);
/* Add the user defined time if necessary */
priv->alarm_units = calendar_config_get_default_reminder_units ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]