~ubuntu-branches/ubuntu/karmic/tasks/karmic

« back to all changes in this revision

Viewing changes to libkoto/koto-task-store.c

  • Committer: Bazaar Package Importer
  • Author(s): Ross Burton
  • Date: 2007-08-13 21:23:04 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070813212304-lygqq9gtx4g548w9
Tags: 0.11-1
* New upstream release
  - Fix crash when deleting tasks (Fixes: #437097)

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
update_row (KotoTaskStore *store, icalcomponent *ical, gboolean insert, GtkTreeIter *iter)
130
130
{
131
131
  icalproperty_status status;
132
 
  icalproperty *prop;
133
132
  icaltimetype due_time;
134
133
  GDate *due_date = NULL;
135
 
  char **categories = NULL;
 
134
  KotoTask *task;
136
135
 
137
136
  g_assert (KOTO_IS_TASK_STORE (store));
138
137
  g_assert (ical);
147
146
                                                    icaltimezone_get_utc_timezone ()));
148
147
  }
149
148
  
150
 
  prop = icalcomponent_get_first_property (ical, ICAL_CATEGORIES_PROPERTY);
151
 
  if (prop) {
152
 
    categories = g_strsplit (icalproperty_get_categories (prop), ",", 0);
153
 
    icalproperty_free (prop);
154
 
  }
155
 
  
 
149
  task = koto_task_new (icalcomponent_new_clone (ical));
 
150
 
156
151
  if (insert) {
157
152
    gtk_list_store_insert_with_values (GTK_LIST_STORE (store), iter, 0,
158
 
                                       COLUMN_ICAL, koto_task_new (icalcomponent_new_clone (ical)),
 
153
                                       COLUMN_ICAL, task,
159
154
                                       COLUMN_DONE, status == ICAL_STATUS_COMPLETED,
160
155
                                       COLUMN_PRIORITY, ical_util_get_priority (ical),
161
156
                                       COLUMN_WEIGHT, get_weight (ical_util_get_priority (ical), due_time),
162
157
                                       COLUMN_DUE, due_date,
163
158
                                       COLUMN_SUMMARY, icalcomponent_get_summary (ical),
164
 
                                       COLUMN_DESCRIPTION, icalcomponent_get_description (ical),
165
 
                                       COLUMN_CATEGORY, categories,
166
159
                                       COLUMN_URL, ical_util_get_url (ical),
167
160
                                       -1);
168
161
  } else {
169
162
    gtk_list_store_set (GTK_LIST_STORE (store), iter,
170
 
                        COLUMN_ICAL, koto_task_new (icalcomponent_new_clone (ical)),
 
163
                        COLUMN_ICAL, task,
171
164
                        COLUMN_DONE, status == ICAL_STATUS_COMPLETED,
172
165
                        COLUMN_PRIORITY, ical_util_get_priority (ical),
173
166
                        COLUMN_WEIGHT, get_weight (ical_util_get_priority (ical), due_time),
174
167
                        COLUMN_DUE, due_date,
175
168
                        COLUMN_SUMMARY, icalcomponent_get_summary (ical),
176
 
                        COLUMN_DESCRIPTION, icalcomponent_get_description (ical),
177
 
                        COLUMN_CATEGORY, categories,
178
169
                        COLUMN_URL, ical_util_get_url (ical),
179
170
                        -1);
180
171
  }
181
172
  
182
 
  g_strfreev (categories);
183
173
  if (due_date)
184
174
    g_date_free (due_date);
 
175
  koto_task_unref (task);
185
176
}
186
177
 
187
178
/*
338
329
    G_TYPE_INT, /* priority */
339
330
    G_TYPE_DATE, /* due */
340
331
    G_TYPE_STRING, /* summary */
341
 
    G_TYPE_STRING, /* description */
342
 
    G_TYPE_STRV, /* categories */
343
332
    G_TYPE_STRING, /* URL */
344
333
  };
345
334
 
393
382
  
394
383
  if (view) {
395
384
    priv->view = g_object_ref (view);
396
 
    priv->cal = g_object_ref (g_object_get_data (G_OBJECT (view), "koto-ecal"));
 
385
    priv->cal = g_object_get_data (G_OBJECT (view), "koto-ecal");
 
386
    if (priv->cal)
 
387
      g_object_ref (priv->cal);
397
388
    priv->sig_added = g_signal_connect (priv->view, "objects-added", G_CALLBACK (on_objects_added), store);
398
389
    priv->sig_modified = g_signal_connect (priv->view, "objects-modified", G_CALLBACK (on_objects_modified), store);
399
390
    priv->sig_removed = g_signal_connect (priv->view, "objects-removed", G_CALLBACK (on_objects_removed), store);
400
 
 
401
 
    if (!priv->cal) {
402
 
      g_warning ("koto-ecal not set on cal_view, cannot commit changes");
403
 
    }
404
391
  }
405
392
}
406
393