aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/calendar-model.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-04-11 12:33:22 +0800
committerChris Lahey <clahey@src.gnome.org>2001-04-11 12:33:22 +0800
commitc185a1b39f596d9fb8acb2e1deade43db8f533b0 (patch)
tree7f78e808d26d0b13dfb11b1c2ffcb6671a293021 /calendar/gui/calendar-model.c
parent6905c1b233e61f46a573ad56126e024bf0b9d3bd (diff)
downloadgsoc2013-evolution-c185a1b39f596d9fb8acb2e1deade43db8f533b0.tar
gsoc2013-evolution-c185a1b39f596d9fb8acb2e1deade43db8f533b0.tar.gz
gsoc2013-evolution-c185a1b39f596d9fb8acb2e1deade43db8f533b0.tar.bz2
gsoc2013-evolution-c185a1b39f596d9fb8acb2e1deade43db8f533b0.tar.lz
gsoc2013-evolution-c185a1b39f596d9fb8acb2e1deade43db8f533b0.tar.xz
gsoc2013-evolution-c185a1b39f596d9fb8acb2e1deade43db8f533b0.tar.zst
gsoc2013-evolution-c185a1b39f596d9fb8acb2e1deade43db8f533b0.zip
Fix this to just send the data to the wombat instead of inserting it
2001-04-11 Christopher James Lahey <clahey@ximian.com> * gui/calendar-model.c (calendar_model_append_row): Fix this to just send the data to the wombat instead of inserting it ourselves. svn path=/trunk/; revision=9223
Diffstat (limited to 'calendar/gui/calendar-model.c')
-rw-r--r--calendar/gui/calendar-model.c64
1 files changed, 20 insertions, 44 deletions
diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c
index 9f4f4b2217..f75499f4da 100644
--- a/calendar/gui/calendar-model.c
+++ b/calendar/gui/calendar-model.c
@@ -41,11 +41,11 @@
#include <libgnomeui/gnome-stock.h>
#include <libgnome/gnome-i18n.h>
#include <gal/widgets/e-unicode.h>
-
-#include "e-util/e-time-utils.h"
-#include "cal-util/timeutil.h"
-#include "calendar-commands.h"
+#include <e-util/e-time-utils.h>
+#include <cal-util/timeutil.h>
#include "calendar-model.h"
+#include "calendar-commands.h"
+
/* Private part of the ECalendarModel structure */
struct _CalendarModelPrivate {
@@ -67,9 +67,6 @@ struct _CalendarModelPrivate {
/* Whether we display dates in 24-hour format. */
gboolean use_24_hour_format;
- /* HACK: so that ETable can do its stupid append_row() thing */
- guint appending_row : 1;
-
/* The default category to use when creating new tasks, e.g. when the
filter is set to a certain category we use that category when
creating a new task. */
@@ -1286,12 +1283,6 @@ calendar_model_set_value_at (ETableModel *etm, int col, int row, const void *val
break;
}
- /* FIXME: this is an ugly HACK. ETable needs a better API for the
- * "click here to add an element" thingy.
- */
- if (priv->appending_row)
- return;
-
if (!cal_client_update_object (priv->client, comp))
g_message ("calendar_model_set_value_at(): Could not update the object!");
}
@@ -1340,51 +1331,36 @@ calendar_model_append_row (ETableModel *etm, ETableModel *source, gint row)
CalendarModel *model;
CalendarModelPrivate *priv;
CalComponent *comp;
- int *new_idx, col;
- const char *uid;
model = CALENDAR_MODEL (etm);
priv = model->priv;
- /* This is a HACK */
- priv->appending_row = TRUE;
-
/* FIXME: This should support other types of components, but for now it
* is only used for the task list.
*/
comp = cal_component_new ();
cal_component_set_new_vtype (comp, priv->new_comp_vtype);
- cal_component_get_uid (comp, &uid);
-
- g_array_append_val (priv->objects, comp);
- new_idx = g_new (int, 1);
- *new_idx = priv->objects->len - 1;
- g_hash_table_insert (priv->uid_index_hash, (char *) uid, new_idx);
-
- /* Notify the views about the new row. I think we have to do that here,
- or the views may become confused when they start getting
- "row_changed" or "cell_changed" signals for this new row. */
- e_table_model_row_inserted (etm, *new_idx);
-
- for (col = 0; col < CAL_COMPONENT_FIELD_NUM_FIELDS; col++) {
- const void *val;
-
- if (!e_table_model_is_cell_editable (etm, col, *new_idx))
- continue;
-
- val = e_table_model_value_at(source, col, row);
- e_table_model_set_value_at (etm, col, *new_idx, val);
- }
-
- /* This is the end of the HACK */
- priv->appending_row = FALSE;
+ set_categories (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_CATEGORIES, row));
+ set_classification (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_CLASSIFICATION, row));
+ set_completed (model, comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_COMPLETED, row));
+ /* FIXME: Need to reset dtstart if dtend happens before it */
+ set_datetime (model, comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_DTEND, row), cal_component_set_dtend);
+ /* FIXME: Need to reset dtend if dtstart happens after it */
+ set_datetime (model, comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_DTSTART, row), cal_component_set_dtstart);
+ set_datetime (model, comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_DUE, row), cal_component_set_due);
+ set_geo (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_GEO, row));
+ set_percent (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_PERCENT, row));
+ set_priority (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_PRIORITY, row));
+ set_summary (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_SUMMARY, row));
+ set_transparency (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_TRANSPARENCY, row));
+ set_url (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_URL, row));
+ set_complete (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_COMPLETE, row));
+ set_status (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_STATUS, row));
if (!cal_client_update_object (priv->client, comp)) {
/* FIXME: Show error dialog. */
g_message ("calendar_model_append_row(): Could not add new object!");
- remove_object (model, uid);
- e_table_model_row_deleted (etm, *new_idx);
}
}