Changeset 1748

Show
Ignore:
Timestamp:
03/25/07 15:02:08
Author:
pvanhoof
Message:

Bugfixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libtinymailui-gtk/tny-gtk-header-list-model.c

    r1747 r1748  
    419419 
    420420static gboolean 
    421 notify_views (gpointer data) 
     421notify_views_add (gpointer data) 
    422422{ 
    423423        notify_views_data_t *stuff = data; 
     
    437437        GtkTreePath *path; 
    438438        notify_views_data_t *stuff; 
    439         static int delayer = 0; 
    440439 
    441440        g_static_rec_mutex_lock (me->iterator_lock); 
    442441 
    443         if (delayer == 100) 
    444         { 
    445                 stuff = g_slice_new (notify_views_data_t); 
    446                 stuff->self = g_object_ref (G_OBJECT (self)); 
    447                 stuff->path = gtk_tree_path_new (); 
    448                 gtk_tree_path_append_index (stuff->path, 0); 
    449                 stuff->iter.stamp = me->stamp; 
    450         } 
     442        stuff = g_slice_new (notify_views_data_t); 
     443        stuff->self = g_object_ref (G_OBJECT (self)); 
     444        stuff->path = gtk_tree_path_new (); 
     445        gtk_tree_path_append_index (stuff->path, 0); 
     446        stuff->iter.stamp = me->stamp; 
    451447 
    452448        /* Prepend something to the list */ 
     
    459455         * thread. Else wouldn't the GtkTreeViews like this. */ 
    460456 
    461         if (delayer == 100) 
    462         { 
    463                 if (stuff->path) 
    464                         g_timeout_add (0, notify_views, stuff); 
    465                 else { 
    466                         g_object_unref (G_OBJECT (stuff->self)); 
    467                         g_slice_free (notify_views_data_t, stuff); 
    468                 } 
    469                 delayer = 0; 
    470         } 
    471  
    472         delayer++; 
     457        if (stuff->path) 
     458                g_timeout_add (0, notify_views_add, stuff); 
     459        else { 
     460                g_object_unref (G_OBJECT (stuff->self)); 
     461                g_slice_free (notify_views_data_t, stuff); 
     462        } 
    473463 
    474464        g_static_rec_mutex_unlock (me->iterator_lock); 
     
    484474} 
    485475 
    486 static guint 
    487 tny_gtk_header_list_model_get_length (TnyList *self) 
    488 
    489         TnyGtkHeaderListModel *me = (TnyGtkHeaderListModel*)self; 
    490         guint retval = 0; 
    491  
    492         g_static_rec_mutex_lock (me->iterator_lock); 
    493         retval = me->items->len; 
    494         g_static_rec_mutex_unlock (me->iterator_lock); 
    495  
    496         return retval; 
    497 
     476 
     477 
     478static gboolean 
     479notify_views_delete (gpointer data) 
     480
     481        notify_views_data_t *stuff = data; 
     482 
     483        stuff->path = tny_gtk_header_list_model_get_path (GTK_TREE_MODEL (stuff->self), &(stuff->iter)); 
     484        if (stuff->path) 
     485        { 
     486                gtk_tree_model_row_deleted (GTK_TREE_MODEL (stuff->self), stuff->path); 
     487                gtk_tree_path_free (stuff->path); 
     488        } 
     489        g_object_unref (G_OBJECT (stuff->self)); 
     490        g_slice_free (notify_views_data_t, data); 
     491 
     492        return FALSE; 
     493
     494 
    498495 
    499496static void 
     
    520517        if (found) 
    521518        { 
    522                 GtkTreeIter iter; 
    523                 iter.stamp = me->stamp; 
    524                 iter.user_data = (gpointer) i; 
    525                 path = tny_gtk_header_list_model_get_path (GTK_TREE_MODEL (me), &iter); 
    526                 if (path) 
    527                 { 
    528                         /* Letting the observers know about this (the GtkTreeView) */ 
    529                         gtk_tree_model_row_deleted (GTK_TREE_MODEL (me), path); 
    530                         gtk_tree_path_free (path); 
    531                 } 
     519                notify_views_data_t *stuff; 
     520 
     521                stuff = g_slice_new (notify_views_data_t); 
     522                stuff->iter.stamp = me->stamp; 
     523                stuff->iter.user_data = (gpointer) i; 
     524                stuff->self = g_object_ref (G_OBJECT (self)); 
     525                g_timeout_add (0, notify_views_delete, stuff); 
     526 
    532527                g_ptr_array_remove (me->items, item); 
    533528        } 
    534529 
    535530        g_static_rec_mutex_unlock (me->iterator_lock); 
    536  
    537531        g_object_unref (G_OBJECT (item)); 
    538  
     532
     533 
     534static guint 
     535tny_gtk_header_list_model_get_length (TnyList *self) 
     536
     537        TnyGtkHeaderListModel *me = (TnyGtkHeaderListModel*)self; 
     538        guint retval = 0; 
     539 
     540        g_static_rec_mutex_lock (me->iterator_lock); 
     541        retval = me->items->len; 
     542        g_static_rec_mutex_unlock (me->iterator_lock); 
     543 
     544        return retval; 
    539545} 
    540546 
     
    618624        TnyGtkHeaderListModel *self = (TnyGtkHeaderListModel *)object; 
    619625 
    620         g_mutex_lock (self->folder_lock); 
    621626        g_static_rec_mutex_lock (self->iterator_lock); 
    622627 
     
    628633 
    629634        g_static_rec_mutex_unlock (self->iterator_lock); 
    630         g_mutex_unlock (self->folder_lock); 
    631  
    632         g_mutex_free (self->folder_lock); 
    633         self->folder_lock = NULL; 
     635 
    634636 
    635637        g_static_rec_mutex_free (self->iterator_lock); 
     
    659661{ 
    660662        self->folder = NULL; 
    661         self->folder_lock = g_mutex_new (); 
    662663        self->iterator_lock = g_new0 (GStaticRecMutex, 1); 
    663664        g_static_rec_mutex_init (self->iterator_lock); 
     
    683684        GtkTreePath *path; 
    684685 
    685         g_mutex_lock (self->folder_lock); 
    686686        g_static_rec_mutex_lock (self->iterator_lock); 
    687687 
     
    694694 
    695695        g_static_rec_mutex_unlock (self->iterator_lock); 
    696         g_mutex_unlock (self->folder_lock); 
    697696 
    698697        /* Get a new list of headers */ 
     
    704703        path = tny_gtk_header_list_model_get_path (GTK_TREE_MODEL (self), &iter); 
    705704 
    706         g_mutex_lock (self->folder_lock); 
    707705        g_static_rec_mutex_lock (self->iterator_lock); 
    708706 
     
    717715 
    718716        g_static_rec_mutex_unlock (self->iterator_lock); 
    719         g_mutex_unlock (self->folder_lock); 
    720717 
    721718        return; 
  • trunk/libtinymailui-gtk/tny-gtk-header-list-model.h

    r1708 r1748  
    6464        GObject parent; 
    6565 
    66         GMutex *folder_lock; 
    6766        GStaticRecMutex *iterator_lock; 
    6867        TnyFolder *folder;