aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog31
-rw-r--r--calendar/cal-util/cal-component.c75
-rw-r--r--calendar/cal-util/cal-component.h3
-rw-r--r--calendar/gui/calendar-model.c138
-rw-r--r--calendar/gui/dialogs/task-editor-dialog.glade144
-rw-r--r--calendar/gui/dialogs/task-editor-dialog.glade.h3
-rw-r--r--calendar/gui/dialogs/task-editor.c239
-rw-r--r--calendar/gui/dialogs/task-page.glade144
-rw-r--r--calendar/gui/e-day-view.c15
-rw-r--r--calendar/gui/event-editor.c123
10 files changed, 563 insertions, 352 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 3a314c0e55..437dc32411 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,34 @@
+2000-09-11 Damon Chaplin <damon@helixcode.com>
+
+ * gui/dialogs/task-editor.c: changed to use EDateEdit.
+
+ * gui/dialogs/task-editor-dialog.glade: added "None" option to
+ Classification option menu, and used custom widgets for the date
+ entries so we can use EDateEdit widgets.
+
+ * gui/event-editor.c: changed to use EDateEdit. Note that this needs
+ to be fixed at some point to handle invalid dates, i.e. when
+ e_date_edit_get_time returns -1.
+
+ * gui/calendar-model.c (ensure_task_complete):
+ (ensure_task_not_complete): new functions to set the related properties
+ to make sure a task is marked as complete on not, i.e. "Date Completed"
+ "Status" and "Percent" properties.
+
+2000-09-08 Damon Chaplin <damon@helixcode.com>
+
+ * gui/calendar-model.c (get_is_complete): use the status field rather
+ than the completed date, as it is more reliable.
+ (get_is_overdue): use get_is_complete().
+ (calendar_model_mark_task_complete): check if it is already complete,
+ and if so don't update it.
+
+ * cal-util/cal-component.c (cal_component_get_status):
+ (cal_component_set_status): added functions to support the STATUS
+ property. Also added the property to CalComponentPrivate and set it
+ to NULL in free_icalcomponent(). Someone should check my code as I've
+ mainly done a Cut & Paste job.
+
2000-09-10 JP Rosevear <jpr@helixcode.com>
* conduits/todo/todo-conduit.c: Convert "//" style comments
(local_record_from_ical_uid): Remove iCalObject cruft
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c
index ff3bcd6d96..4ddec62159 100644
--- a/calendar/cal-util/cal-component.c
+++ b/calendar/cal-util/cal-component.c
@@ -37,6 +37,8 @@ struct _CalComponentPrivate {
icalproperty *uid;
+ icalproperty *status;
+
struct categories {
icalproperty *prop;
};
@@ -221,6 +223,8 @@ free_icalcomponent (CalComponent *comp)
priv->uid = NULL;
+ priv->status = NULL;
+
priv->categories_list = free_slist (priv->categories_list);
priv->classification = NULL;
@@ -471,6 +475,10 @@ scan_property (CalComponent *comp, icalproperty *prop)
kind = icalproperty_isa (prop);
switch (kind) {
+ case ICAL_STATUS_PROPERTY:
+ priv->status = prop;
+ break;
+
case ICAL_CATEGORIES_PROPERTY:
scan_categories (comp, prop);
break;
@@ -953,6 +961,73 @@ cal_component_set_uid (CalComponent *comp, const char *uid)
}
/**
+ * cal_component_get_status:
+ * @comp: A calendar component object.
+ * @status: Return value for the status string.
+ *
+ * Queries the status property of a calendar component object.
+ **/
+void
+cal_component_get_status (CalComponent *comp, const char **status)
+{
+ CalComponentPrivate *priv;
+
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (status != NULL);
+
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
+
+ if (!priv->status) {
+ *status = NULL;
+ return;
+ }
+
+ *status = icalproperty_get_status (priv->status);
+}
+
+/**
+ * cal_component_set_status:
+ * @comp: A calendar component object.
+ * @status: a status string, e.g. "IN-PROCESS", "NEEDS-ACTION". See the RFC.
+ *
+ * Sets the status string property of a calendar component object.
+ **/
+void
+cal_component_set_status (CalComponent *comp, const char *status)
+{
+ CalComponentPrivate *priv;
+
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (status != NULL);
+
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
+
+ priv->need_sequence_inc = TRUE;
+
+ if (status == NULL) {
+ if (priv->status) {
+ icalcomponent_remove_property (priv->icalcomp, priv->status);
+ icalproperty_free (priv->status);
+ priv->status = NULL;
+ }
+
+ return;
+ }
+
+ if (priv->status) {
+ icalproperty_set_status (priv->status, (char *) status);
+ } else {
+ priv->status = icalproperty_new_status ((char *) status);
+ icalcomponent_add_property (priv->icalcomp,
+ priv->status);
+ }
+}
+
+/**
* cal_component_get_categories_list:
* @comp: A calendar component object.
* @categ_list: Return value for the list of strings, where each string is a
diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h
index 5fa759748f..253d7b411f 100644
--- a/calendar/cal-util/cal-component.h
+++ b/calendar/cal-util/cal-component.h
@@ -165,6 +165,9 @@ void cal_component_commit_sequence (CalComponent *comp);
void cal_component_get_uid (CalComponent *comp, const char **uid);
void cal_component_set_uid (CalComponent *comp, const char *uid);
+void cal_component_get_status (CalComponent *comp, const char **status);
+void cal_component_set_status (CalComponent *comp, const char *status);
+
void cal_component_get_categories_list (CalComponent *comp, GSList **categ_list);
void cal_component_set_categories_list (CalComponent *comp, GSList *categ_list);
diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c
index 9abfded4a2..570337aa79 100644
--- a/calendar/gui/calendar-model.c
+++ b/calendar/gui/calendar-model.c
@@ -77,6 +77,9 @@ static char * calendar_model_value_to_string (ETableModel *etm, int col, const v
#endif
static void load_objects (CalendarModel *model);
static int remove_object (CalendarModel *model, const char *uid);
+static void ensure_task_complete (CalComponent *comp,
+ time_t completed_date);
+static void ensure_task_not_complete (CalComponent *comp);
static ETableModelClass *parent_class;
@@ -540,9 +543,17 @@ get_has_alarms (CalComponent *comp)
static gboolean
get_is_complete (CalComponent *comp)
{
+ const char *status;
+
+ cal_component_get_status (comp, &status);
+ return (status && !strcmp (status, "COMPLETED"));
+
+#if 0
struct icaltimetype *t;
gboolean retval;
+ /* I don't think this is as reliable, especially at the moment when
+ we can't set a Completed Date to None. */
cal_component_get_completed (comp, &t);
retval = (t != NULL);
@@ -550,6 +561,7 @@ get_is_complete (CalComponent *comp)
cal_component_free_icaltimetype (t);
return retval;
+#endif
}
/* Returns whether a calendar component is overdue.
@@ -571,26 +583,16 @@ get_is_overdue (CalComponent *comp)
if (!dt.value)
retval = FALSE;
else {
- struct icaltimetype *completed;
time_t t;
/* Second, is it already completed? */
- cal_component_get_completed (comp, &completed);
-
- if (completed) {
+ if (get_is_complete (comp)) {
retval = FALSE;
-
- cal_component_free_icaltimetype (completed);
goto out;
}
- /* Third, are we overdue as of right now?
- *
- * FIXME: should we check the PERCENT as well? If it is at 100%
- * but the COMPLETED property is not set, is the component
- * really overdue?
- **/
+ /* Third, are we overdue as of right now? */
t = icaltime_as_timet (*dt.value);
@@ -852,23 +854,20 @@ parse_time (const char *value)
return mktime (&tmp_tm);
}
-/* Sets the completion time of a component */
+/* Called to set the "Date Completed" field. We also need to update the
+ Status and Percent fields to make sure they match. */
static void
set_completed (CalComponent *comp, const char *value)
{
time_t t;
- struct icaltimetype itt;
t = parse_time (value);
if (t == -1) {
show_date_warning ();
- return;
} else if (t == 0) {
- cal_component_set_completed (comp, NULL);
- return;
+ ensure_task_not_complete (comp);
} else {
- itt = icaltime_from_timet (t, FALSE, TRUE);
- cal_component_set_completed (comp, &itt);
+ ensure_task_complete (comp, t);
}
}
@@ -960,6 +959,7 @@ set_percent (CalComponent *comp, const char *value)
if (string_is_empty (value)) {
cal_component_set_percent (comp, NULL);
+ ensure_task_not_complete (comp);
return;
}
@@ -971,6 +971,11 @@ set_percent (CalComponent *comp, const char *value)
}
cal_component_set_percent (comp, &percent);
+
+ if (percent == 100)
+ ensure_task_complete (comp, -1);
+ else
+ ensure_task_not_complete (comp);
}
/* FIXME: We need to set the "transient_for" property for the dialog, but the
@@ -1036,19 +1041,17 @@ set_url (CalComponent *comp, const char *value)
cal_component_set_url (comp, value);
}
-/* Sets the completion time of a component was toggled */
+/* Called to set the checkbutton field which indicates whether a task is
+ complete. */
static void
set_complete (CalComponent *comp, const void *value)
{
- time_t t = time (NULL);
gint state = GPOINTER_TO_INT (value);
- struct icaltimetype itt;
if (state) {
- itt = icaltime_from_timet (t, FALSE, FALSE);
- cal_component_set_completed (comp, &itt);
+ ensure_task_complete (comp, -1);
} else {
- cal_component_set_completed (comp, NULL);
+ ensure_task_not_complete (comp);
}
}
@@ -1769,8 +1772,6 @@ calendar_model_mark_task_complete (CalendarModel *model,
{
CalendarModelPrivate *priv;
CalComponent *comp;
- int percent;
- struct icaltimetype itt;
g_return_if_fail (model != NULL);
g_return_if_fail (IS_CALENDAR_MODEL (model));
@@ -1782,11 +1783,7 @@ calendar_model_mark_task_complete (CalendarModel *model,
comp = g_array_index (priv->objects, CalComponent *, row);
g_assert (comp != NULL);
- percent = 100;
- cal_component_set_percent (comp, &percent);
-
- itt = icaltime_from_timet (time (NULL), FALSE, TRUE);
- cal_component_set_completed (comp, &itt);
+ ensure_task_complete (comp, -1);
if (!cal_client_update_object (priv->client, comp))
g_message ("calendar_model_mark_task_complete(): Could not update the object!");
@@ -1809,3 +1806,80 @@ calendar_model_get_cal_object (CalendarModel *model,
return g_array_index (priv->objects, CalComponent *, row);
}
+
+
+/* This makes sure a task is marked as complete.
+ It makes sure the "Date Completed" property is set. If the completed_date
+ is not -1, then that is used, otherwise if the "Date Completed" property
+ is not already set it is set to the current time.
+ It makes sure the percent is set to 100, and that the status is "Completed".
+ Note that this doesn't update the component on the client. */
+static void
+ensure_task_complete (CalComponent *comp,
+ time_t completed_date)
+{
+ struct icaltimetype *old_completed = NULL;
+ struct icaltimetype new_completed;
+ const char *old_status;
+ int *old_percent, new_percent;
+ gboolean set_completed = TRUE;
+
+ /* Date Completed. */
+ if (completed_date == -1) {
+ cal_component_get_completed (comp, &old_completed);
+
+ if (old_completed) {
+ cal_component_free_icaltimetype (old_completed);
+ set_completed = FALSE;
+ } else {
+ completed_date = time (NULL);
+ }
+ }
+
+ if (set_completed) {
+ new_completed = icaltime_from_timet (completed_date, FALSE,
+ TRUE);
+ cal_component_set_completed (comp, &new_completed);
+ }
+
+ /* Percent. */
+ cal_component_get_percent (comp, &old_percent);
+ if (!old_percent || *old_percent != 100) {
+ new_percent = 100;
+ cal_component_set_percent (comp, &new_percent);
+ }
+ if (old_percent)
+ cal_component_free_percent (old_percent);
+
+ /* Status. */
+ cal_component_get_status (comp, &old_status);
+}
+
+
+/* This makes sure a task is marked as incomplete. It clears the
+ "Date Completed" property. If the percent is set to 100 it removes it,
+ and if the status is "Completed" it sets it to "Needs Action".
+ Note that this doesn't update the component on the client. */
+static void
+ensure_task_not_complete (CalComponent *comp)
+{
+ const char *old_status;
+ int *old_percent;
+
+ /* Date Completed. */
+ cal_component_set_completed (comp, NULL);
+
+ /* Percent. */
+ cal_component_get_percent (comp, &old_percent);
+ if (old_percent && *old_percent == 100)
+ cal_component_set_percent (comp, NULL);
+ if (old_percent)
+ cal_component_free_percent (old_percent);
+
+ /* Status. */
+ cal_component_get_status (comp, &old_status);
+ if (old_status && !strcmp (old_status, "COMPLETED"))
+ cal_component_set_status (comp, "NEEDS-ACTION");
+}
+
+
diff --git a/calendar/gui/dialogs/task-editor-dialog.glade b/calendar/gui/dialogs/task-editor-dialog.glade
index 8a8ca800d6..7f5bff8e6f 100644
--- a/calendar/gui/dialogs/task-editor-dialog.glade
+++ b/calendar/gui/dialogs/task-editor-dialog.glade
@@ -162,54 +162,6 @@
</child>
<widget>
- <class>GnomeDateEdit</class>
- <name>due-date</name>
- <show_time>True</show_time>
- <use_24_format>True</use_24_format>
- <week_start_monday>False</week_start_monday>
- <lower_hour>7</lower_hour>
- <upper_hour>19</upper_hour>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GnomeDateEdit</class>
- <name>start-date</name>
- <show_time>True</show_time>
- <use_24_format>True</use_24_format>
- <week_start_monday>False</week_start_monday>
- <lower_hour>7</lower_hour>
- <upper_hour>19</upper_hour>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
<class>GtkLabel</class>
<name>label6</name>
<label>Sta_rt Date:</label>
@@ -320,6 +272,52 @@
<yfill>False</yfill>
</child>
</widget>
+
+ <widget>
+ <class>Custom</class>
+ <name>due-date</name>
+ <creation_function>task_editor_create_date_edit</creation_function>
+ <int1>0</int1>
+ <int2>0</int2>
+ <last_modification_time>Sun, 10 Sep 2000 17:32:18 GMT</last_modification_time>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>Custom</class>
+ <name>start-date</name>
+ <creation_function>task_editor_create_date_edit</creation_function>
+ <int1>0</int1>
+ <int2>0</int2>
+ <last_modification_time>Sun, 10 Sep 2000 17:33:31 GMT</last_modification_time>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
</widget>
</widget>
@@ -435,7 +433,8 @@ Low
<class>GtkOptionMenu</class>
<name>classification</name>
<can_focus>True</can_focus>
- <items>Public
+ <items>None
+Public
Private
Confidential
</items>
@@ -587,30 +586,6 @@ Confidential
<column_spacing>4</column_spacing>
<widget>
- <class>GnomeDateEdit</class>
- <name>completed-date</name>
- <show_time>True</show_time>
- <use_24_format>True</use_24_format>
- <week_start_monday>False</week_start_monday>
- <lower_hour>7</lower_hour>
- <upper_hour>19</upper_hour>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
<class>GtkLabel</class>
<name>label12</name>
<label>Date Completed:</label>
@@ -685,6 +660,29 @@ Confidential
<yfill>False</yfill>
</child>
</widget>
+
+ <widget>
+ <class>Custom</class>
+ <name>completed-date</name>
+ <creation_function>task_editor_create_date_edit</creation_function>
+ <int1>0</int1>
+ <int2>0</int2>
+ <last_modification_time>Sun, 10 Sep 2000 17:34:07 GMT</last_modification_time>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
</widget>
<widget>
diff --git a/calendar/gui/dialogs/task-editor-dialog.glade.h b/calendar/gui/dialogs/task-editor-dialog.glade.h
index 9c20880b51..20f7db3014 100644
--- a/calendar/gui/dialogs/task-editor-dialog.glade.h
+++ b/calendar/gui/dialogs/task-editor-dialog.glade.h
@@ -21,7 +21,8 @@ gchar *s = N_("High\n"
"Low\n"
"");
gchar *s = N_("C_lassification:");
-gchar *s = N_("Public\n"
+gchar *s = N_("None\n"
+ "Public\n"
"Private\n"
"Confidential\n"
"");
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index 743a575179..240d1a5010 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -32,6 +32,7 @@
#include <glade/glade.h>
#include <e-util/e-util.h>
#include <e-util/e-dialog-widgets.h>
+#include <widgets/misc/e-dateedit.h>
#include <cal-util/timeutil.h>
#include <cal-client/cal-client.h>
#include "task-editor.h"
@@ -81,22 +82,25 @@ typedef struct {
GtkWidget *url;
} TaskEditorPrivate;
-/* CalComponent doesn't support status yet, so we use this temporarily. */
-typedef enum {
- STATUS_NOT_STARTED,
- STATUS_IN_PROGRESS,
- STATUS_COMPLETED,
- STATUS_CANCELLED
-} TaskEditorStatus;
+/* Note that these two arrays must match. */
static const int status_map[] = {
- STATUS_NOT_STARTED,
- STATUS_IN_PROGRESS,
- STATUS_COMPLETED,
- STATUS_CANCELLED,
+ ICAL_STATUS_NEEDSACTION,
+ ICAL_STATUS_INPROCESS,
+ ICAL_STATUS_COMPLETED,
+ ICAL_STATUS_CANCELLED,
-1
};
+static const char* status_string_map[] = {
+ "NEEDS-ACTION",
+ "IN-PROCESS",
+ "COMPLETED",
+ "CANCELLED",
+ NULL
+};
+
+
typedef enum {
PRIORITY_HIGH,
PRIORITY_NORMAL,
@@ -113,6 +117,7 @@ static const int priority_map[] = {
};
static const int classification_map[] = {
+ CAL_COMPONENT_CLASS_NONE,
CAL_COMPONENT_CLASS_PUBLIC,
CAL_COMPONENT_CLASS_PRIVATE,
CAL_COMPONENT_CLASS_CONFIDENTIAL,
@@ -150,13 +155,18 @@ static void raise_and_focus (GtkWidget *widget);
static TaskEditorPriority priority_value_to_index (int priority_value);
static int priority_index_to_value (TaskEditorPriority priority);
-static void completed_date_changed (GnomeDateEdit *dedit,
+static int status_string_to_value (const char *status_string);
+static const char* status_value_to_string (int status);
+
+static void completed_date_changed (EDateEdit *dedit,
TaskEditor *tedit);
static void status_changed (GtkMenu *menu,
TaskEditor *tedit);
static void percent_complete_changed (GtkAdjustment *adj,
TaskEditor *tedit);
+GtkWidget * task_editor_create_date_edit (void);
+
static GtkObjectClass *parent_class;
E_MAKE_TYPE(task_editor, "TaskEditor", TaskEditor,
@@ -270,6 +280,20 @@ task_editor_construct (TaskEditor *tedit)
}
+/* Called by libglade to create our custom EDateEdit widgets. */
+GtkWidget *
+task_editor_create_date_edit (void)
+{
+ GtkWidget *dedit;
+
+ dedit = e_date_edit_new ();
+ /* FIXME: Set other options. */
+ e_date_edit_set_time_popup_range (E_DATE_EDIT (dedit), 8, 18);
+ e_date_edit_set_allow_no_date_set (E_DATE_EDIT (dedit), TRUE);
+ return dedit;
+}
+
+
/* Callback used when the dialog box is destroyed */
static gint
app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
@@ -356,12 +380,9 @@ static void
init_widgets (TaskEditor *tedit)
{
TaskEditorPrivate *priv;
- GnomeDateEdit *gde;
- GtkWidget *widget;
priv = tedit->priv;
-
/* Connect signals. The Status, Percent Complete & Date Completed
properties are closely related so whenever one changes we may need
to update the other 2. */
@@ -377,38 +398,6 @@ init_widgets (TaskEditor *tedit)
gtk_signal_connect (GTK_OBJECT (GTK_SPIN_BUTTON (priv->percent_complete)->adjustment),
"value_changed",
GTK_SIGNAL_FUNC (percent_complete_changed), tedit);
-
-
- /* Hide the stupid 'Calendar' labels. */
- gde = GNOME_DATE_EDIT (priv->due_date);
- gtk_widget_hide (gde->cal_label);
- widget = gde->date_entry;
- gtk_box_set_child_packing (GTK_BOX (widget->parent), widget,
- FALSE, FALSE, 0, GTK_PACK_START);
- widget = gde->time_entry;
- gtk_box_set_child_packing (GTK_BOX (widget->parent), widget,
- FALSE, FALSE, 0, GTK_PACK_START);
- gtk_box_set_spacing (GTK_BOX (widget->parent), 2);
-
- gde = GNOME_DATE_EDIT (priv->start_date);
- gtk_widget_hide (gde->cal_label);
- widget = gde->date_entry;
- gtk_box_set_child_packing (GTK_BOX (widget->parent), widget,
- FALSE, FALSE, 0, GTK_PACK_START);
- widget = gde->time_entry;
- gtk_box_set_child_packing (GTK_BOX (widget->parent), widget,
- FALSE, FALSE, 0, GTK_PACK_START);
- gtk_box_set_spacing (GTK_BOX (widget->parent), 2);
-
- gde = GNOME_DATE_EDIT (priv->completed_date);
- gtk_widget_hide (gde->cal_label);
- widget = gde->date_entry;
- gtk_box_set_child_packing (GTK_BOX (widget->parent), widget,
- FALSE, FALSE, 0, GTK_PACK_START);
- widget = gde->time_entry;
- gtk_box_set_child_packing (GTK_BOX (widget->parent), widget,
- FALSE, FALSE, 0, GTK_PACK_START);
- gtk_box_set_spacing (GTK_BOX (widget->parent), 2);
}
@@ -949,8 +938,9 @@ fill_widgets (TaskEditor *tedit)
GSList *l;
time_t t;
int *priority_value, *percent;
+ icalproperty_status status;
TaskEditorPriority priority;
- const char *url;
+ const char *url, *status_string;
priv = tedit->priv;
@@ -980,20 +970,18 @@ fill_widgets (TaskEditor *tedit)
if (d.value) {
t = icaltime_as_timet (*d.value);
} else {
- /* FIXME: Can't set GnomeDateEdit to a date of 'None'. */
- t = time (NULL);
+ t = -1;
}
- e_dialog_dateedit_set (priv->due_date, t);
+ e_date_edit_set_time (E_DATE_EDIT (priv->due_date), t);
/* Start Date. */
cal_component_get_dtstart (priv->comp, &d);
if (d.value) {
t = icaltime_as_timet (*d.value);
} else {
- /* FIXME: Can't set GnomeDateEdit to a date of 'None'. */
- t = time (NULL);
+ t = -1;
}
- e_dialog_dateedit_set (priv->start_date, t);
+ e_date_edit_set_time (E_DATE_EDIT (priv->start_date), t);
/* Completed Date. */
cal_component_get_completed (priv->comp, &completed);
@@ -1001,10 +989,9 @@ fill_widgets (TaskEditor *tedit)
t = icaltime_as_timet (*completed);
cal_component_free_icaltimetype (completed);
} else {
- /* FIXME: Can't set GnomeDateEdit to a date of 'None'. */
- t = time (NULL);
+ t = -1;
}
- e_dialog_dateedit_set (priv->completed_date, t);
+ e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), t);
/* Percent Complete. */
cal_component_get_percent (priv->comp, &percent);
@@ -1016,9 +1003,25 @@ fill_widgets (TaskEditor *tedit)
e_dialog_spin_set (priv->percent_complete, 0);
}
- /* Status. FIXME: CalComponent doesn't support this yet. */
- e_dialog_option_menu_set (priv->status, STATUS_IN_PROGRESS,
- status_map);
+ /* Status. */
+ cal_component_get_status (priv->comp, &status_string);
+ if (status_string) {
+ status = status_string_to_value (status_string);
+ } else {
+ /* Try to user the percent value. */
+ if (percent) {
+ if (*percent == 0)
+ status = ICAL_STATUS_NEEDSACTION;
+ else if (*percent == 100)
+ status = ICAL_STATUS_COMPLETED;
+ else
+ status = ICAL_STATUS_INPROCESS;
+ } else {
+ status = ICAL_STATUS_NEEDSACTION;
+ }
+ }
+ g_print ("Setting status\n");
+ e_dialog_option_menu_set (priv->status, status, status_map);
/* Priority. */
cal_component_get_priority (priv->comp, &priority_value);
@@ -1028,11 +1031,13 @@ fill_widgets (TaskEditor *tedit)
} else {
priority = PRIORITY_UNDEFINED;
}
+ g_print ("Setting priority\n");
e_dialog_option_menu_set (priv->priority, priority, priority_map);
/* Classification. */
cal_component_get_classification (priv->comp, &classification);
+ g_print ("Setting classification\n");
e_dialog_option_menu_set (priv->classification, classification,
classification_map);
@@ -1079,11 +1084,12 @@ dialog_to_comp_object (TaskEditor *tedit)
CalComponentDateTime date;
time_t t;
GSList *list;
- TaskEditorStatus status;
+ icalproperty_status status;
TaskEditorPriority priority;
int priority_value, percent;
CalComponentClassification classification;
char *url;
+ const char *status_string;
priv = tedit->priv;
comp = priv->comp;
@@ -1106,19 +1112,31 @@ dialog_to_comp_object (TaskEditor *tedit)
date.tzid = NULL;
/* Due Date. */
- t = e_dialog_dateedit_get (priv->due_date);
- *date.value = icaltime_from_timet (t, FALSE, FALSE);
- cal_component_set_due (comp, &date);
+ t = e_date_edit_get_time (E_DATE_EDIT (priv->due_date));
+ if (t != -1) {
+ *date.value = icaltime_from_timet (t, FALSE, FALSE);
+ cal_component_set_due (comp, &date);
+ } else {
+ cal_component_set_due (comp, NULL);
+ }
/* Start Date. */
- t = e_dialog_dateedit_get (priv->start_date);
- *date.value = icaltime_from_timet (t, FALSE, FALSE);
- cal_component_set_dtstart (comp, &date);
+ t = e_date_edit_get_time (E_DATE_EDIT (priv->start_date));
+ if (t != -1) {
+ *date.value = icaltime_from_timet (t, FALSE, FALSE);
+ cal_component_set_dtstart (comp, &date);
+ } else {
+ cal_component_set_dtstart (comp, NULL);
+ }
/* Completed Date. */
- t = e_dialog_dateedit_get (priv->completed_date);
- *date.value = icaltime_from_timet (t, FALSE, FALSE);
- cal_component_set_completed (comp, date.value);
+ t = e_date_edit_get_time (E_DATE_EDIT (priv->completed_date));
+ if (t != -1) {
+ *date.value = icaltime_from_timet (t, FALSE, FALSE);
+ cal_component_set_completed (comp, date.value);
+ } else {
+ cal_component_set_completed (comp, NULL);
+ }
g_free (date.value);
@@ -1126,11 +1144,10 @@ dialog_to_comp_object (TaskEditor *tedit)
percent = e_dialog_spin_get_int (priv->percent_complete);
cal_component_set_percent (comp, &percent);
- /* Status. FIXME: CalComponent doesn't support it. */
+ /* Status. */
status = e_dialog_option_menu_get (priv->status, status_map);
-#if 0
- cal_component_set_status (comp, status);
-#endif
+ status_string = status_value_to_string (status);
+ cal_component_set_status (comp, status_string);
/* Priority. */
priority = e_dialog_option_menu_get (priv->priority, priority_map);
@@ -1262,8 +1279,38 @@ priority_index_to_value (TaskEditorPriority priority)
}
+static int
+status_string_to_value (const char *status_string)
+{
+ int i;
+
+ for (i = 0; status_map[i] != -1; i++) {
+ if (!strcmp (status_string_map[i], status_string))
+ return status_map[i];
+ }
+
+ g_warning ("Invalid todo status string");
+ return ICAL_STATUS_NEEDSACTION;
+}
+
+
+static const char*
+status_value_to_string (int status)
+{
+ int i;
+
+ for (i = 0; status_map[i] != -1; i++) {
+ if (status_map[i] == status)
+ return status_string_map[i];
+ }
+
+ g_warning ("Invalid todo status value");
+ return NULL;
+}
+
+
static void
-completed_date_changed (GnomeDateEdit *dedit,
+completed_date_changed (EDateEdit *dedit,
TaskEditor *tedit)
{
TaskEditorPrivate *priv;
@@ -1276,17 +1323,18 @@ completed_date_changed (GnomeDateEdit *dedit,
if (priv->ignore_callbacks)
return;
- t = e_dialog_dateedit_get (priv->completed_date);
- /* FIXME: We want to check for 'None' here. */
+ t = e_date_edit_get_time (E_DATE_EDIT (priv->completed_date));
priv->ignore_callbacks = TRUE;
- if (0) {
- /* What do we do if the 'Date Completed' property is set to
- 'None' ? The status should not be 'Completed' and the
- percent-complete should not be 100%, but what do we set
- them to? */
-
+ if (t == -1) {
+ /* If the 'Completed Date' is set to 'None', we set the
+ status to 'Not Started' and the percent-complete to 0.
+ The task may actually be partially-complete, but we leave
+ it to the user to set those fields. */
+ e_dialog_option_menu_set (priv->status, ICAL_STATUS_NEEDSACTION,
+ status_map);
+ e_dialog_spin_set (priv->percent_complete, 0);
} else {
- e_dialog_option_menu_set (priv->status, STATUS_COMPLETED,
+ e_dialog_option_menu_set (priv->status, ICAL_STATUS_COMPLETED,
status_map);
e_dialog_spin_set (priv->percent_complete, 100);
}
@@ -1299,7 +1347,7 @@ status_changed (GtkMenu *menu,
TaskEditor *tedit)
{
TaskEditorPrivate *priv;
- TaskEditorStatus status;
+ icalproperty_status status;
g_return_if_fail (IS_TASK_EDITOR (tedit));
@@ -1310,13 +1358,13 @@ status_changed (GtkMenu *menu,
status = e_dialog_option_menu_get (priv->status, status_map);
priv->ignore_callbacks = TRUE;
- if (status == STATUS_NOT_STARTED) {
+ if (status == ICAL_STATUS_NEEDSACTION) {
e_dialog_spin_set (priv->percent_complete, 0);
- /* FIXME: Set to 'None'. */
- e_dialog_dateedit_set (priv->completed_date, time (NULL));
- } else if (status == STATUS_COMPLETED) {
+ e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), -1);
+ } else if (status == ICAL_STATUS_COMPLETED) {
e_dialog_spin_set (priv->percent_complete, 100);
- e_dialog_dateedit_set (priv->completed_date, time (NULL));
+ e_date_edit_set_time (E_DATE_EDIT (priv->completed_date),
+ time (NULL));
}
priv->ignore_callbacks = FALSE;
}
@@ -1328,7 +1376,7 @@ percent_complete_changed (GtkAdjustment *adj,
{
TaskEditorPrivate *priv;
gint percent;
- TaskEditorStatus status;
+ icalproperty_status status;
time_t date_completed;
g_return_if_fail (IS_TASK_EDITOR (tedit));
@@ -1343,18 +1391,19 @@ percent_complete_changed (GtkAdjustment *adj,
if (percent == 100) {
date_completed = time (NULL);
- status = STATUS_COMPLETED;
+ status = ICAL_STATUS_COMPLETED;
} else {
/* FIXME: Set to 'None'. */
date_completed = time (NULL);
if (percent == 0)
- status = STATUS_NOT_STARTED;
+ status = ICAL_STATUS_NEEDSACTION;
else
- status = STATUS_IN_PROGRESS;
+ status = ICAL_STATUS_INPROCESS;
}
- e_dialog_dateedit_set (priv->completed_date, date_completed);
+ e_date_edit_set_time (E_DATE_EDIT (priv->completed_date),
+ date_completed);
e_dialog_option_menu_set (priv->status, status, status_map);
priv->ignore_callbacks = FALSE;
diff --git a/calendar/gui/dialogs/task-page.glade b/calendar/gui/dialogs/task-page.glade
index 8a8ca800d6..7f5bff8e6f 100644
--- a/calendar/gui/dialogs/task-page.glade
+++ b/calendar/gui/dialogs/task-page.glade
@@ -162,54 +162,6 @@
</child>
<widget>
- <class>GnomeDateEdit</class>
- <name>due-date</name>
- <show_time>True</show_time>
- <use_24_format>True</use_24_format>
- <week_start_monday>False</week_start_monday>
- <lower_hour>7</lower_hour>
- <upper_hour>19</upper_hour>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GnomeDateEdit</class>
- <name>start-date</name>
- <show_time>True</show_time>
- <use_24_format>True</use_24_format>
- <week_start_monday>False</week_start_monday>
- <lower_hour>7</lower_hour>
- <upper_hour>19</upper_hour>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
<class>GtkLabel</class>
<name>label6</name>
<label>Sta_rt Date:</label>
@@ -320,6 +272,52 @@
<yfill>False</yfill>
</child>
</widget>
+
+ <widget>
+ <class>Custom</class>
+ <name>due-date</name>
+ <creation_function>task_editor_create_date_edit</creation_function>
+ <int1>0</int1>
+ <int2>0</int2>
+ <last_modification_time>Sun, 10 Sep 2000 17:32:18 GMT</last_modification_time>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>Custom</class>
+ <name>start-date</name>
+ <creation_function>task_editor_create_date_edit</creation_function>
+ <int1>0</int1>
+ <int2>0</int2>
+ <last_modification_time>Sun, 10 Sep 2000 17:33:31 GMT</last_modification_time>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
</widget>
</widget>
@@ -435,7 +433,8 @@ Low
<class>GtkOptionMenu</class>
<name>classification</name>
<can_focus>True</can_focus>
- <items>Public
+ <items>None
+Public
Private
Confidential
</items>
@@ -587,30 +586,6 @@ Confidential
<column_spacing>4</column_spacing>
<widget>
- <class>GnomeDateEdit</class>
- <name>completed-date</name>
- <show_time>True</show_time>
- <use_24_format>True</use_24_format>
- <week_start_monday>False</week_start_monday>
- <lower_hour>7</lower_hour>
- <upper_hour>19</upper_hour>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
<class>GtkLabel</class>
<name>label12</name>
<label>Date Completed:</label>
@@ -685,6 +660,29 @@ Confidential
<yfill>False</yfill>
</child>
</widget>
+
+ <widget>
+ <class>Custom</class>
+ <name>completed-date</name>
+ <creation_function>task_editor_create_date_edit</creation_function>
+ <int1>0</int1>
+ <int2>0</int2>
+ <last_modification_time>Sun, 10 Sep 2000 17:34:07 GMT</last_modification_time>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
</widget>
<widget>
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 85bd8872be..06332f525c 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -5051,6 +5051,7 @@ e_day_view_get_event_position (EDayView *day_view,
{
EDayViewEvent *event;
gint start_row, end_row, cols_in_row, start_col, num_columns;
+ gfloat width;
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
@@ -5078,12 +5079,20 @@ e_day_view_get_event_position (EDayView *day_view,
end_row = day_view->resize_end_row;
}
- *item_x = day_view->day_offsets[day] + day_view->day_widths[day] * start_col / cols_in_row;
- *item_w = day_view->day_widths[day] * num_columns / cols_in_row - E_DAY_VIEW_GAP_WIDTH;
+
+ *item_x = day_view->day_offsets[day]
+ + day_view->day_widths[day] * start_col / cols_in_row;
+ *item_w = day_view->day_widths[day] * num_columns / cols_in_row
+ - E_DAY_VIEW_GAP_WIDTH;
*item_w = MAX (*item_w, 0);
*item_y = start_row * day_view->row_height;
+#if 0
*item_h = (end_row - start_row + 1) * day_view->row_height;
-
+#else
+ /* This makes the event end on the grid line of the next row,
+ which maybe looks nicer if you have 2 events on consecutive rows. */
+ *item_h = (end_row - start_row + 1) * day_view->row_height + 1;
+#endif
return TRUE;
}
diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c
index 53da36d4ca..452399c836 100644
--- a/calendar/gui/event-editor.c
+++ b/calendar/gui/event-editor.c
@@ -25,6 +25,7 @@
#include <gnome.h>
#include <glade/glade.h>
#include <e-util/e-dialog-widgets.h>
+#include <widgets/misc/e-dateedit.h>
#include <e-util/e-unicode.h>
#include <cal-util/timeutil.h>
#include "event-editor.h"
@@ -135,8 +136,8 @@ static void append_exception (EventEditor *ee, time_t t);
static void check_all_day (EventEditor *ee);
static void set_all_day (GtkWidget *toggle, EventEditor *ee);
static void alarm_toggle (GtkWidget *toggle, EventEditor *ee);
-static void check_dates (GnomeDateEdit *gde, EventEditor *ee);
-static void check_times (GnomeDateEdit *gde, EventEditor *ee);
+static void check_dates (EDateEdit *dedit, EventEditor *ee);
+static void check_times (EDateEdit *dedit, EventEditor *ee);
static void recurrence_toggled (GtkWidget *radio, EventEditor *ee);
static void recurrence_exception_added (GtkWidget *widget, EventEditor *ee);
static void recurrence_exception_deleted (GtkWidget *widget, EventEditor *ee);
@@ -486,8 +487,6 @@ static void
init_widgets (EventEditor *ee)
{
EventEditorPrivate *priv;
- GnomeDateEdit *gde;
- GtkWidget *widget;
priv = ee->priv;
@@ -538,27 +537,6 @@ init_widgets (EventEditor *ee)
GTK_SIGNAL_FUNC (recurrence_exception_deleted), ee);
gtk_signal_connect (GTK_OBJECT (priv->recurrence_exception_change), "clicked",
GTK_SIGNAL_FUNC (recurrence_exception_changed), ee);
-
- /* Hide the stupid 'Calendar' labels. */
- gde = GNOME_DATE_EDIT (priv->start_time);
- gtk_widget_hide (gde->cal_label);
- widget = gde->date_entry;
- gtk_box_set_child_packing (GTK_BOX (widget->parent), widget,
- FALSE, FALSE, 0, GTK_PACK_START);
- widget = gde->time_entry;
- gtk_box_set_child_packing (GTK_BOX (widget->parent), widget,
- FALSE, FALSE, 0, GTK_PACK_START);
- gtk_box_set_spacing (GTK_BOX (widget->parent), 2);
-
- gde = GNOME_DATE_EDIT (priv->end_time);
- gtk_widget_hide (gde->cal_label);
- widget = gde->date_entry;
- gtk_box_set_child_packing (GTK_BOX (widget->parent), widget,
- FALSE, FALSE, 0, GTK_PACK_START);
- widget = gde->time_entry;
- gtk_box_set_child_packing (GTK_BOX (widget->parent), widget,
- FALSE, FALSE, 0, GTK_PACK_START);
- gtk_box_set_spacing (GTK_BOX (widget->parent), 2);
}
/* Fills the widgets with default values */
@@ -581,8 +559,8 @@ clear_widgets (EventEditor *ee)
gtk_signal_handler_block_by_data (GTK_OBJECT (priv->start_time), ee);
gtk_signal_handler_block_by_data (GTK_OBJECT (priv->end_time), ee);
- e_dialog_dateedit_set (priv->start_time, now);
- e_dialog_dateedit_set (priv->end_time, now);
+ e_date_edit_set_time (E_DATE_EDIT (priv->start_time), now);
+ e_date_edit_set_time (E_DATE_EDIT (priv->end_time), now);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->start_time), ee);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->end_time), ee);
@@ -644,8 +622,7 @@ clear_widgets (EventEditor *ee)
e_dialog_toggle_set (priv->recurrence_ending_date_repeat_forever, TRUE);
e_dialog_spin_set (priv->recurrence_ending_date_end_after_count, 1);
- e_dialog_dateedit_set (priv->recurrence_ending_date_end_on_date,
- time_add_day (time (NULL), 1));
+ e_date_edit_set_time (E_DATE_EDIT (priv->recurrence_ending_date_end_on_date), time_add_day (time (NULL), 1));
/* Exceptions list */
@@ -698,8 +675,8 @@ fill_widgets (EventEditor *ee)
dtend = time_add_day (dtend, -1);
}
- e_dialog_dateedit_set (priv->start_time, dtstart);
- e_dialog_dateedit_set (priv->end_time, dtend);
+ e_date_edit_set_time (E_DATE_EDIT (priv->start_time), dtstart);
+ e_date_edit_set_time (E_DATE_EDIT (priv->end_time), dtend);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->start_time), ee);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->end_time), ee);
@@ -857,8 +834,7 @@ fill_widgets (EventEditor *ee)
e_dialog_toggle_set (priv->recurrence_ending_date_end_on, TRUE);
/* Shorten by one day, as we store end-on date a day ahead */
/* FIXME is this correct? */
- e_dialog_dateedit_set (priv->recurrence_ending_date_end_on_date,
- time_add_day (t, -1));
+ e_date_edit_set_time (E_DATE_EDIT (priv->recurrence_ending_date_end_on_date), time_add_day (t, -1));
}
cal_component_free_recur_list (list);
}
@@ -918,7 +894,7 @@ dialog_to_comp_object (EventEditor *ee)
cal_component_free_text_list (list);
date.value = g_new (struct icaltimetype, 1);
- t = e_dialog_dateedit_get (priv->start_time);
+ t = e_date_edit_get_time (E_DATE_EDIT (priv->start_time));
*date.value = icaltime_from_timet (t, FALSE, FALSE);
date.tzid = NULL;
cal_component_set_dtstart (comp, &date);
@@ -926,7 +902,7 @@ dialog_to_comp_object (EventEditor *ee)
/* If the all_day toggle is set, the end date is inclusive of the
entire day on which it points to. */
all_day_event = e_dialog_toggle_get (priv->all_day_event);
- t = e_dialog_dateedit_get (priv->end_time);
+ t = e_date_edit_get_time (E_DATE_EDIT (priv->end_time));
if (all_day_event)
t = time_day_end (t);
@@ -1040,7 +1016,7 @@ dialog_to_comp_object (EventEditor *ee)
/* Also here, to ensure that the event is used, we add a day
* to get the next day, in accordance to the RFC
*/
- t = e_dialog_dateedit_get (priv->recurrence_ending_date_end_on_date);
+ t = e_date_edit_get_time (E_DATE_EDIT (priv->recurrence_ending_date_end_on_date));
t = time_add_day (t, 1);
recur.until = icaltime_from_timet (t, TRUE, FALSE);
} else if (e_dialog_toggle_get (priv->recurrence_ending_date_end_after)) {
@@ -1756,8 +1732,8 @@ check_all_day (EventEditor *ee)
priv = ee->priv;
- ev_start = e_dialog_dateedit_get (priv->start_time);
- ev_end = e_dialog_dateedit_get (priv->end_time);
+ ev_start = e_date_edit_get_time (E_DATE_EDIT (priv->start_time));
+ ev_end = e_date_edit_get_time (E_DATE_EDIT (priv->end_time));
/* all day event checkbox */
if (time_day_begin (ev_start) == ev_start
@@ -1777,7 +1753,6 @@ set_all_day (GtkWidget *toggle, EventEditor *ee)
struct tm start_tm, end_tm;
time_t start_t, end_t;
gboolean all_day;
- int flags;
priv = ee->priv;
@@ -1785,7 +1760,7 @@ set_all_day (GtkWidget *toggle, EventEditor *ee)
entire day on which it points to. */
all_day = GTK_TOGGLE_BUTTON (toggle)->active;
- start_t = e_dialog_dateedit_get (priv->start_time);
+ start_t = e_date_edit_get_time (E_DATE_EDIT (priv->start_time));
start_tm = *localtime (&start_t);
start_tm.tm_min = 0;
start_tm.tm_sec = 0;
@@ -1795,9 +1770,10 @@ set_all_day (GtkWidget *toggle, EventEditor *ee)
else
start_tm.tm_hour = day_begin;
- e_dialog_dateedit_set (priv->start_time, mktime (&start_tm));
+ e_date_edit_set_time (E_DATE_EDIT (priv->start_time),
+ mktime (&start_tm));
- end_t = e_dialog_dateedit_get (priv->end_time);
+ end_t = e_date_edit_get_time (E_DATE_EDIT (priv->end_time));
end_tm = *localtime (&end_t);
end_tm.tm_min = 0;
end_tm.tm_sec = 0;
@@ -1813,25 +1789,17 @@ set_all_day (GtkWidget *toggle, EventEditor *ee)
end_tm.tm_hour = start_tm.tm_hour + 1;
}
- flags = gnome_date_edit_get_flags (GNOME_DATE_EDIT (priv->start_time));
- if (all_day)
- flags &= ~GNOME_DATE_EDIT_SHOW_TIME;
- else
- flags |= GNOME_DATE_EDIT_SHOW_TIME;
- gnome_date_edit_set_flags (GNOME_DATE_EDIT (priv->start_time), flags);
- gnome_date_edit_set_flags (GNOME_DATE_EDIT (priv->end_time), flags);
+ 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);
- e_dialog_dateedit_set (priv->end_time, mktime (&end_tm));
-
- gtk_widget_hide (GNOME_DATE_EDIT (priv->start_time)->cal_label);
- gtk_widget_hide (GNOME_DATE_EDIT (priv->end_time)->cal_label);
+ e_date_edit_set_time (E_DATE_EDIT (priv->end_time), mktime (&end_tm));
}
/*
* Callback: checks that the dates are start < end
*/
static void
-check_dates (GnomeDateEdit *gde, EventEditor *ee)
+check_dates (EDateEdit *dedit, EventEditor *ee)
{
EventEditorPrivate *priv;
time_t start, end;
@@ -1839,29 +1807,31 @@ check_dates (GnomeDateEdit *gde, EventEditor *ee)
priv = ee->priv;
- start = e_dialog_dateedit_get (priv->start_time);
- end = e_dialog_dateedit_get (priv->end_time);
+ start = e_date_edit_get_time (E_DATE_EDIT (priv->start_time));
+ end = e_date_edit_get_time (E_DATE_EDIT (priv->end_time));
if (start > end) {
tm_start = *localtime (&start);
tm_end = *localtime (&end);
- if (GTK_WIDGET (gde) == priv->start_time) {
+ if (GTK_WIDGET (dedit) == priv->start_time) {
tm_end.tm_year = tm_start.tm_year;
tm_end.tm_mon = tm_start.tm_mon;
tm_end.tm_mday = tm_start.tm_mday;
gtk_signal_handler_block_by_data (GTK_OBJECT (priv->end_time), ee);
- e_dialog_dateedit_set (priv->end_time, mktime (&tm_end));
+ e_date_edit_set_time (E_DATE_EDIT (priv->end_time),
+ mktime (&tm_end));
gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->end_time), ee);
- } else if (GTK_WIDGET (gde) == priv->end_time) {
+ } else if (GTK_WIDGET (dedit) == priv->end_time) {
tm_start.tm_year = tm_end.tm_year;
tm_start.tm_mon = tm_end.tm_mon;
tm_start.tm_mday = tm_end.tm_mday;
#if 0
gtk_signal_handler_block_by_data (GTK_OBJECT (priv->start_time), ee);
- e_dialog_dateedit_set (priv->start_time, mktime (&tm_start));
+ e_date_edit_set_time (E_DATE_EDIT (priv->start_time),
+ mktime (&tm_start));
gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->start_time), ee);
#endif
}
@@ -1873,7 +1843,7 @@ check_dates (GnomeDateEdit *gde, EventEditor *ee)
* selected hour range spans all of the day
*/
static void
-check_times (GnomeDateEdit *gde, EventEditor *ee)
+check_times (EDateEdit *dedit, EventEditor *ee)
{
EventEditorPrivate *priv;
time_t start, end;
@@ -1884,14 +1854,14 @@ check_times (GnomeDateEdit *gde, EventEditor *ee)
gdk_pointer_ungrab (GDK_CURRENT_TIME);
gdk_flush ();
#endif
- start = e_dialog_dateedit_get (priv->start_time);
- end = e_dialog_dateedit_get (priv->end_time);
+ start = e_date_edit_get_time (E_DATE_EDIT (priv->start_time));
+ end = e_date_edit_get_time (E_DATE_EDIT (priv->end_time));
if (start > end) {
tm_start = *localtime (&start);
tm_end = *localtime (&end);
- if (GTK_WIDGET (gde) == priv->start_time) {
+ if (GTK_WIDGET (dedit) == priv->start_time) {
tm_end.tm_min = tm_start.tm_min;
tm_end.tm_sec = tm_start.tm_sec;
tm_end.tm_hour = tm_start.tm_hour + 1;
@@ -1903,9 +1873,10 @@ check_times (GnomeDateEdit *gde, EventEditor *ee)
}
gtk_signal_handler_block_by_data (GTK_OBJECT (priv->end_time), ee);
- e_dialog_dateedit_set (priv->end_time, mktime (&tm_end));
+ e_date_edit_set_time (E_DATE_EDIT (priv->end_time),
+ mktime (&tm_end));
gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->end_time), ee);
- } else if (GTK_WIDGET (gde) == priv->end_time) {
+ } else if (GTK_WIDGET (dedit) == priv->end_time) {
tm_start.tm_min = tm_end.tm_min;
tm_start.tm_sec = tm_end.tm_sec;
tm_start.tm_hour = tm_end.tm_hour - 1;
@@ -1917,7 +1888,8 @@ check_times (GnomeDateEdit *gde, EventEditor *ee)
}
gtk_signal_handler_block_by_data (GTK_OBJECT (priv->start_time), ee);
- e_dialog_dateedit_set (priv->start_time, mktime (&tm_start));
+ e_date_edit_set_time (E_DATE_EDIT (priv->start_time),
+ mktime (&tm_start));
gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->start_time), ee);
}
}
@@ -1990,7 +1962,7 @@ recurrence_exception_added (GtkWidget *widget, EventEditor *ee)
priv = ee->priv;
- t = e_dialog_dateedit_get (priv->recurrence_exceptions_date);
+ t = e_date_edit_get_time (E_DATE_EDIT (priv->recurrence_exceptions_date));
append_exception (ee, t);
}
@@ -2037,7 +2009,7 @@ recurrence_exception_changed (GtkWidget *widget, EventEditor *ee)
sel = GPOINTER_TO_INT (clist->selection->data);
t = gtk_clist_get_row_data (clist, sel);
- *t = e_dialog_dateedit_get (priv->recurrence_exceptions_date);
+ *t = e_date_edit_get_time (E_DATE_EDIT (priv->recurrence_exceptions_date));
e_utf8_gtk_clist_set_text (clist, sel, 0, get_exception_string (*t));
}
@@ -2060,12 +2032,13 @@ make_date_edit_with_time (void)
GtkWidget *
date_edit_new (time_t the_time, int show_time)
{
- return gnome_date_edit_new_flags (the_time,
- ((show_time ? GNOME_DATE_EDIT_SHOW_TIME : 0)
- | (am_pm_flag ? 0 : GNOME_DATE_EDIT_24_HR)
- | (week_starts_on_monday
- ? GNOME_DATE_EDIT_WEEK_STARTS_ON_MONDAY
- : 0)));
+ GtkWidget *dedit;
+
+ dedit = e_date_edit_new ();
+ /* FIXME: Set other options. */
+ e_date_edit_set_show_time (E_DATE_EDIT (dedit), show_time);
+ e_date_edit_set_time_popup_range (E_DATE_EDIT (dedit), 8, 18);
+ return dedit;
}