| 443 | | notify_views_data_t *stuff = data; |
|---|
| 444 | | |
|---|
| 445 | | /* Caused by the delayer (see below), this one wont trigger for each |
|---|
| 446 | | * added item. Let's hope that the GtkTreeView copes with this by |
|---|
| 447 | | * reading the get_length property each time. March 2007 it did, as far |
|---|
| 448 | | * as I know. */ |
|---|
| 449 | | |
|---|
| 450 | | gtk_tree_model_row_inserted (GTK_TREE_MODEL (stuff->self), stuff->path, &(stuff->iter)); |
|---|
| 451 | | gtk_tree_path_free (stuff->path); |
|---|
| 452 | | g_object_unref (G_OBJECT (stuff->self)); |
|---|
| 453 | | g_slice_free (notify_views_data_t, data); |
|---|
| | 443 | TnyGtkHeaderListModel *me = (TnyGtkHeaderListModel*) data; |
|---|
| | 444 | gint i, added; GtkTreePath *path; |
|---|
| | 445 | |
|---|
| | 446 | g_mutex_lock (me->ra_lock); |
|---|
| | 447 | added = me->recent_added; |
|---|
| | 448 | me->recent_added = 0; |
|---|
| | 449 | me->going_to_update_views = FALSE; |
|---|
| | 450 | g_mutex_unlock (me->ra_lock); |
|---|
| | 451 | |
|---|
| | 452 | path = gtk_tree_path_new (); |
|---|
| | 453 | gtk_tree_path_append_index (path, 0); |
|---|
| | 454 | |
|---|
| | 455 | for (i = 0; i< added; i++) |
|---|
| | 456 | { |
|---|
| | 457 | GtkTreeIter iter; |
|---|
| | 458 | iter.stamp = me->stamp; |
|---|
| | 459 | iter.user_data = (gpointer) (me->items->len - 1); |
|---|
| | 460 | gtk_tree_model_row_inserted (GTK_TREE_MODEL (me), path, &iter); |
|---|
| | 461 | } |
|---|
| | 462 | |
|---|
| | 463 | gtk_tree_path_free (path); |
|---|
| | 464 | g_object_unref (G_OBJECT (me)); |
|---|
| 485 | | notify_views_data_t *stuff; |
|---|
| 486 | | |
|---|
| 487 | | stuff = g_slice_new (notify_views_data_t); |
|---|
| 488 | | stuff->self = g_object_ref (G_OBJECT (self)); |
|---|
| 489 | | stuff->path = gtk_tree_path_new (); |
|---|
| 490 | | gtk_tree_path_append_index (stuff->path, 0); |
|---|
| 491 | | stuff->iter.stamp = me->stamp; |
|---|
| 492 | | stuff->iter.user_data = (gpointer) (me->items->len - 1); |
|---|
| 493 | | |
|---|
| 494 | | /* Letting the model observers know about this (the GtkTreeViews). |
|---|
| 495 | | * The g_timeout_add stuff keeps it possible to launch the pre- |
|---|
| 496 | | * pender in a thread. Else wouldn't the GtkTreeViews like this. */ |
|---|
| 497 | | |
|---|
| 498 | | if (stuff->path) |
|---|
| 499 | | g_timeout_add (0, notify_views_add, stuff); |
|---|
| 500 | | else { |
|---|
| 501 | | g_object_unref (G_OBJECT (stuff->self)); |
|---|
| 502 | | g_slice_free (notify_views_data_t, stuff); |
|---|
| 503 | | } |
|---|
| 504 | | |
|---|
| 505 | | me->delayer = 0; |
|---|
| 506 | | } |
|---|
| 507 | | |
|---|
| 508 | | me->delayer++; |
|---|
| | 498 | g_object_ref (G_OBJECT (me)); |
|---|
| | 499 | me->going_to_update_views = TRUE; |
|---|
| | 500 | g_timeout_add (2000, notify_views_add, me); |
|---|
| | 501 | } |
|---|
| | 502 | g_mutex_unlock (me->ra_lock); |
|---|