124
* Utility method called by objects_added and objects_modified that updates a
125
* row in @store pointed to by @iter with data extracted from @ical.
124
* Utility method called by objects_added and objects_modified that inserts a
125
* new row (@insert is #TRUE) or updates a row (@insert is #FALSE) in @store
126
* pointed to by @iter with data extracted from @ical.
128
update_row (KotoTaskStore *store, icalcomponent *ical, GtkTreeIter *iter)
129
update_row (KotoTaskStore *store, icalcomponent *ical, gboolean insert, GtkTreeIter *iter)
130
131
icalproperty_status status;
131
132
icalproperty *prop;
152
153
icalproperty_free (prop);
155
/* TODO: if iter is NULL use insert_with_values so that insertions are sorted */
156
gtk_list_store_set (GTK_LIST_STORE (store), iter,
157
COLUMN_ICAL, koto_task_new (icalcomponent_new_clone (ical)),
158
COLUMN_DONE, status == ICAL_STATUS_COMPLETED,
159
COLUMN_PRIORITY, ical_util_get_priority (ical),
160
COLUMN_WEIGHT, get_weight (ical_util_get_priority (ical), due_time),
161
COLUMN_DUE, due_date,
162
COLUMN_SUMMARY, icalcomponent_get_summary (ical),
163
COLUMN_DESCRIPTION, icalcomponent_get_description (ical),
164
COLUMN_CATEGORY, categories,
157
gtk_list_store_insert_with_values (GTK_LIST_STORE (store), iter, 0,
158
COLUMN_ICAL, koto_task_new (icalcomponent_new_clone (ical)),
159
COLUMN_DONE, status == ICAL_STATUS_COMPLETED,
160
COLUMN_PRIORITY, ical_util_get_priority (ical),
161
COLUMN_WEIGHT, get_weight (ical_util_get_priority (ical), due_time),
162
COLUMN_DUE, due_date,
163
COLUMN_SUMMARY, icalcomponent_get_summary (ical),
164
COLUMN_DESCRIPTION, icalcomponent_get_description (ical),
165
COLUMN_CATEGORY, categories,
166
COLUMN_URL, ical_util_get_url (ical),
169
gtk_list_store_set (GTK_LIST_STORE (store), iter,
170
COLUMN_ICAL, koto_task_new (icalcomponent_new_clone (ical)),
171
COLUMN_DONE, status == ICAL_STATUS_COMPLETED,
172
COLUMN_PRIORITY, ical_util_get_priority (ical),
173
COLUMN_WEIGHT, get_weight (ical_util_get_priority (ical), due_time),
174
COLUMN_DUE, due_date,
175
COLUMN_SUMMARY, icalcomponent_get_summary (ical),
176
COLUMN_DESCRIPTION, icalcomponent_get_description (ical),
177
COLUMN_CATEGORY, categories,
178
COLUMN_URL, ical_util_get_url (ical),
167
182
g_strfreev (categories);
184
199
ical = objects->data;
186
gtk_list_store_append (GTK_LIST_STORE (store), &iter);
187
update_row (store, ical, &iter);
201
update_row (store, ical, TRUE, &iter);
189
203
g_hash_table_insert (priv->uid_hash,
190
204
g_strdup (icalcomponent_get_uid (ical)),
380
395
priv->view = g_object_ref (view);
381
396
priv->cal = g_object_ref (g_object_get_data (G_OBJECT (view), "koto-ecal"));
382
priv->sig_added = g_signal_connect (priv->view, "objects_added", G_CALLBACK (on_objects_added), store);
383
priv->sig_modified = g_signal_connect (priv->view, "objects_modified", G_CALLBACK (on_objects_modified), store);
384
priv->sig_removed = g_signal_connect (priv->view, "objects_removed", G_CALLBACK (on_objects_removed), store);
397
priv->sig_added = g_signal_connect (priv->view, "objects-added", G_CALLBACK (on_objects_added), store);
398
priv->sig_modified = g_signal_connect (priv->view, "objects-modified", G_CALLBACK (on_objects_modified), store);
399
priv->sig_removed = g_signal_connect (priv->view, "objects-removed", G_CALLBACK (on_objects_removed), store);
386
401
if (!priv->cal) {
387
402
g_warning ("koto-ecal not set on cal_view, cannot commit changes");