aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@novell.com>2005-12-14 22:58:38 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2005-12-14 22:58:38 +0800
commitda500959a1945968b513f015927f1ba14391fb75 (patch)
treeaaaf31143d1d86dc742351a21aaac8a1e4db6eca /calendar
parent1065638cd6f013036d2344bdc4d0671202d5f56e (diff)
downloadgsoc2013-evolution-da500959a1945968b513f015927f1ba14391fb75.tar
gsoc2013-evolution-da500959a1945968b513f015927f1ba14391fb75.tar.gz
gsoc2013-evolution-da500959a1945968b513f015927f1ba14391fb75.tar.bz2
gsoc2013-evolution-da500959a1945968b513f015927f1ba14391fb75.tar.lz
gsoc2013-evolution-da500959a1945968b513f015927f1ba14391fb75.tar.xz
gsoc2013-evolution-da500959a1945968b513f015927f1ba14391fb75.tar.zst
gsoc2013-evolution-da500959a1945968b513f015927f1ba14391fb75.zip
Committed Johnny's patch for adding the FOR time implementation
2005-12-14 Srinivasa Ragavan <sragavan@novell.com> * Committed Johnny's patch for adding the FOR time implementation svn path=/trunk/; revision=30776
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog15
-rw-r--r--calendar/gui/dialogs/event-page.c130
-rw-r--r--calendar/gui/dialogs/event-page.glade51
3 files changed, 180 insertions, 16 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 66578528c3..a60456962f 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,18 @@
+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.
+
+ * gui/dialogs/event-page.glade: Added the widgets to the glade
+
2005-11-27 Johnny Jacob <johnnyjacob@gmail.com>
** Fixes bug #324060
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index f58fc61829..a099d8daef 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -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;
@@ -171,6 +172,10 @@ static void notify_dates_changed (EventPage *epage, struct icaltimetype *start_t
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 */
@@ -417,10 +422,10 @@ set_all_day (EventPage *epage, gboolean all_day)
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);
@@ -813,7 +818,15 @@ 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)
+ 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) {
@@ -1070,6 +1083,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
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) {
@@ -1529,18 +1543,103 @@ event_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
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
@@ -1898,12 +1997,12 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day)
&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);
@@ -2104,6 +2203,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");
@@ -2690,7 +2790,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 ();
diff --git a/calendar/gui/dialogs/event-page.glade b/calendar/gui/dialogs/event-page.glade
index e55bfedbb8..8aeeddefd3 100644
--- a/calendar/gui/dialogs/event-page.glade
+++ b/calendar/gui/dialogs/event-page.glade
@@ -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>
@@ -843,7 +887,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">