Changeset 1935

Show
Ignore:
Timestamp:
05/09/07 21:56:11
Author:
pvanhoof
Message:

Moved private API to a private struct

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r1934 r1935  
     12007-05-09  Philip Van Hoof  <pvanhoof@gnome.org> 
     2 
     3        * libtinymailui-gtk/tny-gtk-header-list-model.c: Moved the private API 
     4        to a private type 
     5 
     6        * This was a minor API change 
     7 
    182007-05-09  Jose Dapena Paz  <jdapena@igalia.com> 
    29 
  • trunk/libtinymailui-gtk/tny-gtk-header-list-iterator-priv.h

    r1708 r1935  
    6262 
    6363 
     64 
     65#define TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE(o)        \ 
     66        (G_TYPE_INSTANCE_GET_PRIVATE ((o), TNY_TYPE_GTK_HEADER_LIST_MODEL, TnyGtkHeaderListModelPriv)) 
     67 
     68typedef struct _TnyGtkHeaderListModelPriv TnyGtkHeaderListModelPriv; 
     69 
     70struct _TnyGtkHeaderListModelPriv 
     71{ 
     72        GStaticRecMutex *iterator_lock; 
     73        TnyFolder *folder; 
     74        gint stamp, registered; 
     75        gint updating_views; 
     76        GMutex *ra_lock, *to_lock; 
     77        gint cur_len; 
     78        guint add_timeout; 
     79 
     80        guint timeout_span; 
     81        GPtrArray *items; 
     82        GArray *del_timeouts; 
     83        TnyIterator *iterator; 
     84}; 
     85 
    6486G_END_DECLS 
    6587 
  • trunk/libtinymailui-gtk/tny-gtk-header-list-iterator.c

    r1708 r1935  
    9090{ 
    9191        TnyGtkHeaderListIterator *me = (TnyGtkHeaderListIterator*) self; 
     92        TnyGtkHeaderListModelPriv *mpriv; 
    9293 
    9394        if (G_UNLIKELY (!me || !me->model)) 
    9495                return; 
    9596 
     97        mpriv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (me->model); 
     98 
    9699        /* Move the iterator to the next node */ 
    97100 
    98         g_static_rec_mutex_lock (me->model->iterator_lock); 
     101        g_static_rec_mutex_lock (mpriv->iterator_lock); 
    99102        me->current++; 
    100         g_static_rec_mutex_unlock (me->model->iterator_lock); 
     103        g_static_rec_mutex_unlock (mpriv->iterator_lock); 
    101104 
    102105        return; 
     
    114117{ 
    115118        TnyGtkHeaderListIterator *me = (TnyGtkHeaderListIterator*) self; 
     119        TnyGtkHeaderListModelPriv *mpriv; 
    116120 
    117121        if (G_UNLIKELY (!me || !me->model)) 
     
    120124        /* Move the iterator to the previous node */ 
    121125 
    122         g_static_rec_mutex_lock (me->model->iterator_lock); 
     126        mpriv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (me->model); 
     127 
     128        g_static_rec_mutex_lock (mpriv->iterator_lock); 
    123129        me->current--; 
    124         g_static_rec_mutex_unlock (me->model->iterator_lock); 
     130        g_static_rec_mutex_unlock (mpriv->iterator_lock); 
    125131 
    126132        return; 
     
    130136_tny_gtk_header_list_iterator_is_done_nl (TnyGtkHeaderListIterator *me) 
    131137{ 
     138        TnyGtkHeaderListModelPriv *mpriv; 
     139 
    132140        if (G_UNLIKELY (!me  || !me->model)) 
    133141                return TRUE; 
    134142 
    135         return (me->current < 0 || me->current >= me->model->items->len); 
     143        mpriv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (me->model); 
     144 
     145        return (me->current < 0 || me->current >= mpriv->items->len); 
    136146} 
    137147 
     
    140150{ 
    141151        TnyGtkHeaderListIterator *me = (TnyGtkHeaderListIterator*) self; 
     152        TnyGtkHeaderListModelPriv *mpriv; 
    142153        gboolean retval = FALSE; 
    143154 
     
    145156                return FALSE; 
    146157 
    147         g_static_rec_mutex_lock (me->model->iterator_lock); 
    148         retval = (me->current < 0 || me->current >= me->model->items->len); 
    149         g_static_rec_mutex_unlock (me->model->iterator_lock); 
     158        mpriv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (me->model); 
     159        g_static_rec_mutex_lock (mpriv->iterator_lock); 
     160        retval = (me->current < 0 || me->current >= mpriv->items->len); 
     161        g_static_rec_mutex_unlock (mpriv->iterator_lock); 
    150162 
    151163        return retval; 
     
    165177{ 
    166178        TnyGtkHeaderListIterator *me = (TnyGtkHeaderListIterator*) self; 
     179        TnyGtkHeaderListModelPriv *mpriv; 
    167180 
    168181        if (G_UNLIKELY (!me || !me->current || !me->model)) 
    169182                return; 
    170183 
    171         g_static_rec_mutex_lock (me->model->iterator_lock); 
     184        mpriv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (me->model); 
     185 
     186        g_static_rec_mutex_lock (mpriv->iterator_lock); 
    172187        me->current = 0; 
    173         g_static_rec_mutex_unlock (me->model->iterator_lock); 
     188        g_static_rec_mutex_unlock (mpriv->iterator_lock); 
    174189 
    175190        return; 
     
    188203{ 
    189204        TnyGtkHeaderListIterator *me = (TnyGtkHeaderListIterator*) self; 
     205        TnyGtkHeaderListModelPriv *mpriv; 
    190206 
    191207        if (G_UNLIKELY (!me || !me->current || !me->model)) 
    192208                return; 
    193209 
    194         g_static_rec_mutex_lock (me->model->iterator_lock); 
     210        mpriv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (me->model); 
     211 
     212        g_static_rec_mutex_lock (mpriv->iterator_lock); 
    195213        me->current = nth; 
    196         g_static_rec_mutex_unlock (me->model->iterator_lock); 
     214        g_static_rec_mutex_unlock (mpriv->iterator_lock); 
    197215 
    198216        return; 
     
    203221_tny_gtk_header_list_iterator_get_current_nl (TnyGtkHeaderListIterator *me) 
    204222{ 
    205         return me->model->items->pdata[me->current]; 
     223        TnyGtkHeaderListModelPriv *mpriv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (me->model); 
     224        return mpriv->items->pdata[me->current]; 
    206225} 
    207226 
     
    210229{ 
    211230        TnyGtkHeaderListIterator *me = (TnyGtkHeaderListIterator*) self; 
     231        TnyGtkHeaderListModelPriv *mpriv; 
    212232        gpointer retval; 
    213233 
     
    217237        /* Give the data of the current node */ 
    218238 
    219         g_static_rec_mutex_lock (me->model->iterator_lock); 
    220         retval = me->model->items->pdata[me->current]; 
    221         g_static_rec_mutex_unlock (me->model->iterator_lock); 
    222  
     239        mpriv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (me->model); 
     240 
     241        g_static_rec_mutex_lock (mpriv->iterator_lock); 
     242        retval = mpriv->items->pdata[me->current]; 
    223243        if (retval) 
    224                 g_object_ref (G_OBJECT(retval)); 
    225  
    226         return (GObject*)retval; 
     244                g_object_ref (retval); 
     245        g_static_rec_mutex_unlock (mpriv->iterator_lock); 
     246 
     247 
     248        return (GObject*) retval; 
    227249} 
    228250 
     
    238260                return NULL; 
    239261 
    240         g_object_ref (G_OBJECT (me->model)); 
     262        g_object_ref (me->model); 
    241263 
    242264        return TNY_LIST (me->model); 
  • trunk/libtinymailui-gtk/tny-gtk-header-list-model.c

    r1923 r1935  
    4040#include "tny-gtk-header-list-iterator-priv.h" 
    4141 
     42 
    4243static gint  
    4344add_del_timeout (TnyGtkHeaderListModel *me, guint num) 
    4445{ 
     46        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (me); 
     47 
    4548        gint retval = 0; 
    46         g_mutex_lock (me->to_lock); 
    47         if (!me->del_timeouts) 
    48                 me->del_timeouts = g_array_new (FALSE, FALSE, sizeof (guint)); 
    49         g_array_append_val (me->del_timeouts, num); 
    50         retval = me->del_timeouts->len-1; 
    51         g_mutex_unlock (me->to_lock); 
     49        g_mutex_lock (priv->to_lock); 
     50        if (!priv->del_timeouts) 
     51                priv->del_timeouts = g_array_new (FALSE, FALSE, sizeof (guint)); 
     52        g_array_append_val (priv->del_timeouts, num); 
     53        retval = priv->del_timeouts->len-1; 
     54        g_mutex_unlock (priv->to_lock); 
     55 
    5256        return retval; 
    5357} 
     
    5660remove_del_timeouts (TnyGtkHeaderListModel *me) 
    5761{ 
     62        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (me); 
     63 
    5864        gint i; 
    5965        guint src; 
    6066 
    61         g_mutex_lock (me->to_lock); 
    62  
    63         if (!me->del_timeouts) 
     67        g_mutex_lock (priv->to_lock); 
     68 
     69        if (!priv->del_timeouts) 
    6470        { 
    65                 g_mutex_unlock (me->to_lock); 
     71                g_mutex_unlock (priv->to_lock); 
    6672                return; 
    6773        } 
    6874 
    69         for (i = 0; i < me->del_timeouts->len; i++) 
     75        for (i = 0; i < priv->del_timeouts->len; i++) 
    7076        { 
    71                 src = g_array_index (me->del_timeouts, guint, i); 
     77                src = g_array_index (priv->del_timeouts, guint, i); 
    7278                if (src > 0) 
    7379                        g_source_remove (src); 
    74                 g_array_index (me->del_timeouts, guint, i) = 0; 
    75         } 
    76         g_array_free (me->del_timeouts, TRUE); 
    77         me->del_timeouts = NULL; 
    78         g_mutex_unlock (me->to_lock); 
     80                g_array_index (priv->del_timeouts, guint, i) = 0; 
     81        } 
     82        g_array_free (priv->del_timeouts, TRUE); 
     83        priv->del_timeouts = NULL; 
     84        g_mutex_unlock (priv->to_lock); 
    7985} 
    8086 
     
    128134tny_gtk_header_list_model_get_iter (GtkTreeModel *self, GtkTreeIter *iter, GtkTreePath *path) 
    129135{ 
    130         TnyGtkHeaderListModel *list_model = TNY_GTK_HEADER_LIST_MODEL (self); 
    131         gint i, tlen; gboolean retval=FALSE; 
     136        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (self); 
     137 
     138        gint i, tlen;  
     139        gboolean retval=FALSE; 
    132140 
    133141        g_return_val_if_fail (gtk_tree_path_get_depth (path) > 0, FALSE); 
    134142 
    135         g_static_rec_mutex_lock (list_model->iterator_lock);  
     143        g_static_rec_mutex_lock (priv->iterator_lock);  
    136144 
    137145        i = gtk_tree_path_get_indices (path)[0]; 
    138146 
    139         g_mutex_lock (list_model->ra_lock); 
    140         tlen = list_model->cur_len; 
    141         g_mutex_unlock (list_model->ra_lock); 
     147        g_mutex_lock (priv->ra_lock); 
     148        tlen = priv->cur_len; 
     149        g_mutex_unlock (priv->ra_lock); 
    142150 
    143151        if (i >= tlen) 
     
    145153        else { 
    146154                if (i >= 0 && i < tlen) { 
    147                         iter->stamp = list_model->stamp; 
     155                        iter->stamp = priv->stamp; 
    148156                        iter->user_data = (gpointer) i; 
    149157                        retval = TRUE; 
     
    151159        } 
    152160 
    153         g_static_rec_mutex_unlock (list_model->iterator_lock); 
     161        g_static_rec_mutex_unlock (priv->iterator_lock); 
    154162 
    155163        return retval; 
     
    159167tny_gtk_header_list_model_get_path (GtkTreeModel *self, GtkTreeIter *iter) 
    160168{ 
     169        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (self); 
    161170        GtkTreePath *tree_path; 
    162171        gint i = 0, tlen; 
    163         TnyGtkHeaderListModel *list_model = TNY_GTK_HEADER_LIST_MODEL (self); 
    164172 
    165173        /* Return the path of an existing GtkTreeIter */ 
    166         if  (!(iter->stamp == TNY_GTK_HEADER_LIST_MODEL (self)->stamp)) 
     174        if  (!(iter->stamp == priv->stamp)) 
    167175                return NULL; 
    168176 
    169         g_static_rec_mutex_lock (list_model->iterator_lock); 
     177        g_static_rec_mutex_lock (priv->iterator_lock); 
    170178 
    171179        i = (gint) iter->user_data; 
    172180 
    173         g_mutex_lock (list_model->ra_lock); 
    174         tlen = list_model->cur_len; 
    175         g_mutex_unlock (list_model->ra_lock); 
     181        g_mutex_lock (priv->ra_lock); 
     182        tlen = priv->cur_len; 
     183        g_mutex_unlock (priv->ra_lock); 
    176184 
    177185        if (i < 0 || i >= tlen) { 
    178                 g_static_rec_mutex_unlock (list_model->iterator_lock); 
     186                g_static_rec_mutex_unlock (priv->iterator_lock); 
    179187                return NULL; 
    180188        } 
     
    183191        gtk_tree_path_append_index (tree_path, i); 
    184192 
    185         g_static_rec_mutex_unlock (list_model->iterator_lock); 
     193        g_static_rec_mutex_unlock (priv->iterator_lock); 
    186194 
    187195        return tree_path; 
     
    220228tny_gtk_header_list_model_received_date_sort_func (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data) 
    221229{ 
    222         TnyGtkHeaderListModel *list_model = TNY_GTK_HEADER_LIST_MODEL (model); 
     230        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (model); 
    223231 
    224232        TnyHeader *hdr_a, *hdr_b; 
     
    229237         * of times while you are sorting things. */ 
    230238 
    231         hdr_a = list_model->items->pdata[(gint)a->user_data]; 
    232         hdr_b = list_model->items->pdata[(gint)b->user_data]; 
     239        hdr_a = priv->items->pdata[(gint)a->user_data]; 
     240        hdr_b = priv->items->pdata[(gint)b->user_data]; 
    233241 
    234242        recv_a = tny_header_get_date_received (hdr_a); 
     
    252260tny_gtk_header_list_model_sent_date_sort_func (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data) 
    253261{ 
    254         TnyGtkHeaderListModel *list_model = TNY_GTK_HEADER_LIST_MODEL (model); 
     262        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (model); 
    255263 
    256264        TnyHeader *hdr_a, *hdr_b; 
     
    261269         * of times while you are sorting things. */ 
    262270 
    263         hdr_a = list_model->items->pdata[(gint)a->user_data]; 
    264         hdr_b = list_model->items->pdata[(gint)b->user_data]; 
     271        hdr_a = priv->items->pdata[(gint)a->user_data]; 
     272        hdr_b = priv->items->pdata[(gint)b->user_data]; 
    265273 
    266274        recv_a = tny_header_get_date_sent (hdr_a); 
     
    273281tny_gtk_header_list_model_get_value (GtkTreeModel *self, GtkTreeIter *iter, gint column, GValue *value) 
    274282{ 
    275         TnyGtkHeaderListModel *list_model = TNY_GTK_HEADER_LIST_MODEL (self); 
     283        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (self); 
     284 
    276285        const gchar *str; 
    277286        gchar *rdate = NULL; 
    278287        gint i; 
    279288 
    280         if (iter->stamp != list_model->stamp) 
     289        if (iter->stamp != priv->stamp) 
    281290                return; 
    282291 
    283         g_static_rec_mutex_lock (list_model->iterator_lock); 
     292        g_static_rec_mutex_lock (priv->iterator_lock); 
    284293 
    285294        /* Get the index out of the iter, and use the item by looking it up in 
     
    292301         * length of the available data in the array, not only the registered 
    293302         * length, although in 99.999999% of the cases it's the same) */ 
    294         if (i < 0 || i >= list_model->items->len) 
     303        if (i < 0 || i >= priv->items->len) 
    295304        { 
    296305                g_warning ("GtkTreeModel in invalid state\n"); 
    297                 g_static_rec_mutex_unlock (list_model->iterator_lock); 
     306                g_static_rec_mutex_unlock (priv->iterator_lock); 
    298307                return; 
    299308        } 
     
    303312                case TNY_GTK_HEADER_LIST_MODEL_CC_COLUMN: 
    304313                        g_value_init (value, G_TYPE_STRING); 
    305                         str = tny_header_get_cc ((TnyHeader*) list_model->items->pdata[i]); 
     314                        str = tny_header_get_cc ((TnyHeader*) priv->items->pdata[i]); 
    306315                        if (str) 
    307316                                g_value_set_string (value, str); 
     
    309318                case TNY_GTK_HEADER_LIST_MODEL_DATE_SENT_COLUMN: 
    310319                        g_value_init (value, G_TYPE_STRING); 
    311                         rdate = _get_readable_date (tny_header_get_date_sent ((TnyHeader*) list_model->items->pdata[i])); 
     320                        rdate = _get_readable_date (tny_header_get_date_sent ((TnyHeader*) priv->items->pdata[i])); 
    312321                        if (rdate) 
    313322                                g_value_set_string (value, rdate); 
     
    317326                case TNY_GTK_HEADER_LIST_MODEL_DATE_RECEIVED_COLUMN: 
    318327                        g_value_init (value, G_TYPE_STRING); 
    319                         rdate = _get_readable_date (tny_header_get_date_received ((TnyHeader*) list_model->items->pdata[i])); 
     328                        rdate = _get_readable_date (tny_header_get_date_received ((TnyHeader*) priv->items->pdata[i])); 
    320329                        if (rdate) 
    321330                                g_value_set_string (value, rdate); 
     
    326335                        g_value_init (value, G_TYPE_INT); 
    327336                        g_value_set_int (value,  
    328                                             tny_header_get_date_sent ((TnyHeader*) list_model->items->pdata[i])); 
     337                                            tny_header_get_date_sent ((TnyHeader*) priv->items->pdata[i])); 
    329338                        break; 
    330339                case TNY_GTK_HEADER_LIST_MODEL_DATE_RECEIVED_TIME_T_COLUMN: 
    331340                        g_value_init (value, G_TYPE_INT); 
    332341                        g_value_set_int (value,  
    333                                          tny_header_get_date_received ((TnyHeader*) list_model->items->pdata[i])); 
     342                                         tny_header_get_date_received ((TnyHeader*) priv->items->pdata[i])); 
    334343                        break; 
    335344 
    336345                case TNY_GTK_HEADER_LIST_MODEL_MESSAGE_SIZE_COLUMN: 
    337346                        g_value_init (value, G_TYPE_INT); 
    338                         g_value_set_int (value, tny_header_get_message_size((TnyHeader*) list_model->items->pdata[i])); 
     347                        g_value_set_int (value, tny_header_get_message_size((TnyHeader*) priv->items->pdata[i])); 
    339348                        break;                   
    340349                case TNY_GTK_HEADER_LIST_MODEL_INSTANCE_COLUMN: 
    341350                        g_value_init (value, G_TYPE_OBJECT); 
    342                         g_value_set_object (value, (TnyHeader*) list_model->items->pdata[i]); 
     351                        g_value_set_object (value, (TnyHeader*) priv->items->pdata[i]); 
    343352                        break; 
    344353                case TNY_GTK_HEADER_LIST_MODEL_TO_COLUMN: 
    345354                        g_value_init (value, G_TYPE_STRING); 
    346                         str = tny_header_get_to ((TnyHeader*) list_model->items->pdata[i]); 
     355                        str = tny_header_get_to ((TnyHeader*) priv->items->pdata[i]); 
    347356                        if (str) 
    348357                                g_value_set_string (value, str); 
     
    350359                case TNY_GTK_HEADER_LIST_MODEL_SUBJECT_COLUMN: 
    351360                        g_value_init (value, G_TYPE_STRING); 
    352                         str = tny_header_get_subject ((TnyHeader*) list_model->items->pdata[i]); 
     361                        str = tny_header_get_subject ((TnyHeader*) priv->items->pdata[i]); 
    353362                        if (str) 
    354363                                g_value_set_string (value, str); 
     
    356365                case TNY_GTK_HEADER_LIST_MODEL_FROM_COLUMN: 
    357366                        g_value_init (value, G_TYPE_STRING); 
    358                         str = tny_header_get_from ((TnyHeader*) list_model->items->pdata[i]); 
     367                        str = tny_header_get_from ((TnyHeader*) priv->items->pdata[i]); 
    359368                        if (str) 
    360369                                g_value_set_string (value, str); 
     
    362371                case TNY_GTK_HEADER_LIST_MODEL_FLAGS_COLUMN: 
    363372                        g_value_init (value, G_TYPE_INT); 
    364                         g_value_set_int (value, tny_header_get_flags ((TnyHeader*) list_model->items->pdata[i])); 
     373                        g_value_set_int (value, tny_header_get_flags ((TnyHeader*) priv->items->pdata[i])); 
    365374                        break; 
    366375                default: 
     
    368377        } 
    369378 
    370         g_static_rec_mutex_unlock (list_model->iterator_lock); 
     379        g_static_rec_mutex_unlock (priv->iterator_lock); 
    371380 
    372381        return; 
     
    376385tny_gtk_header_list_model_iter_next (GtkTreeModel *self, GtkTreeIter *iter) 
    377386{ 
     387        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (self); 
    378388        gboolean retval; 
    379         TnyGtkHeaderListModel *list_model = TNY_GTK_HEADER_LIST_MODEL (self); 
    380389        gint newv; 
    381390 
    382         if (iter->stamp != TNY_GTK_HEADER_LIST_MODEL (self)->stamp) 
     391        if (iter->stamp != priv->stamp) 
    383392                return FALSE; 
    384393 
    385         g_static_rec_mutex_lock (list_model->iterator_lock); 
     394        g_static_rec_mutex_lock (priv->iterator_lock); 
    386395 
    387396        /* The next will simply be the current plus one: That's because we are 
     
    390399         * can't be part of the GPtrArray instance (would be devastating). */ 
    391400 
    392         newv = ((gint)iter->user_data); 
     401        newv = ((gint) iter->user_data); 
    393402        newv++;  
    394403        iter->user_data = (gpointer) newv; 
    395404 
    396         g_mutex_lock (list_model->ra_lock); 
    397         retval = (newv >= 0 && newv < list_model->cur_len); 
    398         g_mutex_unlock (list_model->ra_lock); 
     405        g_mutex_lock (priv->ra_lock); 
     406        retval = (newv >= 0 && newv < priv->cur_len); 
     407        g_mutex_unlock (priv->ra_lock); 
    399408 
    400409        if (!retval) { 
     
    403412        } 
    404413 
    405         g_static_rec_mutex_unlock (list_model->iterator_lock); 
     414        g_static_rec_mutex_unlock (priv->iterator_lock); 
    406415 
    407416        return retval; 
     
    420429tny_gtk_header_list_model_iter_n_children (GtkTreeModel *self, GtkTreeIter *iter) 
    421430{ 
     431        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (self); 
    422432        gint retval = -1; 
    423         TnyGtkHeaderListModel *list_model = TNY_GTK_HEADER_LIST_MODEL (self); 
    424433 
    425434        /* Return the amount of children for this GtkTreeIter. Because this 
     
    427436           return the full length. */ 
    428437 
    429         g_static_rec_mutex_lock (list_model->iterator_lock); 
     438        g_static_rec_mutex_lock (priv->iterator_lock); 
    430439 
    431440        if (G_LIKELY (!iter)) 
    432                 retval = list_model->cur_len; 
    433  
    434         g_static_rec_mutex_unlock (list_model->iterator_lock); 
     441                retval = priv->cur_len; 
     442 
     443        g_static_rec_mutex_unlock (priv->iterator_lock); 
    435444 
    436445        return retval; 
     
    440449tny_gtk_header_list_model_iter_nth_child (GtkTreeModel *self, GtkTreeIter *iter, GtkTreeIter *parent, gint n) 
    441450{ 
    442         TnyGtkHeaderListModel *list_model = TNY_GTK_HEADER_LIST_MODEL (self); 
     451        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (self); 
    443452        gboolean retval = FALSE; 
    444453        gint tlen; 
     
    447456                return FALSE; 
    448457 
    449         g_static_rec_mutex_lock (list_model->iterator_lock); 
    450  
    451         g_mutex_lock (list_model->ra_lock); 
    452         tlen = list_model->cur_len; 
    453         g_mutex_unlock (list_model->ra_lock); 
     458        g_static_rec_mutex_lock (priv->iterator_lock); 
     459 
     460        g_mutex_lock (priv->ra_lock); 
     461        tlen = priv->cur_len; 
     462        g_mutex_unlock (priv->ra_lock); 
    454463 
    455464        if (n >= 0 && n < tlen)  
    456465        { 
    457                 iter->stamp = TNY_GTK_HEADER_LIST_MODEL (self)->stamp; 
     466                iter->stamp = priv->stamp; 
    458467                iter->user_data = (gpointer) n; 
    459468                retval = TRUE; 
     
    463472        } 
    464473 
    465         g_static_rec_mutex_unlock (list_model->iterator_lock); 
     474        g_static_rec_mutex_unlock (priv->iterator_lock); 
    466475 
    467476        return retval; 
     
    490499notify_views_add_destroy (gpointer data) 
    491500{ 
    492         TnyGtkHeaderListModel *me = (TnyGtkHeaderListModel*) data
    493  
    494         g_mutex_lock (me->ra_lock); 
    495         me->updating_views = -1; 
    496         g_mutex_unlock (me->ra_lock); 
    497  
    498         if (me->timeout_span < 5000) 
    499                 me->timeout_span += 300; 
    500         me->add_timeout = 0; 
    501         g_object_unref (me); 
     501        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (data)
     502 
     503        g_mutex_lock (priv->ra_lock); 
     504        priv->updating_views = -1; 
     505        g_mutex_unlock (priv->ra_lock); 
     506 
     507        if (priv->timeout_span < 5000) 
     508                priv->timeout_span += 300; 
     509        priv->add_timeout = 0; 
     510        g_object_unref (data); 
    502511 
    503512        return; 
     
    507516notify_views_add (gpointer data) 
    508517{ 
    509         TnyGtkHeaderListModel *me = (TnyGtkHeaderListModel*) data
     518        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (data)
    510519        gint already_registered, going_tb_registered, i; 
    511520  
     
    514523        GtkTreeIter iter; 
    515524 
    516         g_mutex_lock (me->ra_lock); 
    517         me->updating_views++; 
    518         if (me->registered >= me->items->len) { 
    519                 g_mutex_unlock (me->ra_lock); 
     525        g_mutex_lock (priv->ra_lock); 
     526        priv->updating_views++; 
     527        if (priv->registered >= priv->items->len) { 
     528                g_mutex_unlock (priv->ra_lock); 
    520529                return FALSE; 
    521530        } 
    522531 
    523         already_registered = me->registered; 
    524  
    525         if (me->items->len - already_registered > 1000)  
     532        already_registered = priv->registered; 
     533 
     534        if (priv->items->len - already_registered > 1000)  
    526535        { 
    527536                going_tb_registered = already_registered + 1000; 
    528537                needmore = TRUE; 
    529538        } else 
    530                 going_tb_registered = me->items->len; 
    531  
    532         me->registered = going_tb_registered; 
    533  
    534         if (me->updating_views < 2) 
     539                going_tb_registered = priv->items->len; 
     540 
     541        priv->registered = going_tb_registered; 
     542 
     543        if (priv->updating_views < 2) 
    535544                needmore = TRUE; 
    536545 
    537         g_mutex_unlock (me->ra_lock); 
     546        g_mutex_unlock (priv->ra_lock); 
    538547 
    539548        gdk_threads_enter(); 
     
    541550        for (i = already_registered; i < going_tb_registered; i++) 
    542551        { 
    543                 iter.stamp = me->stamp; 
     552                iter.stamp = priv->stamp; 
    544553                iter.user_data = (gpointer) i; 
    545554                path = gtk_tree_path_new (); 
     
    547556                if (G_LIKELY (path)) 
    548557                { 
    549                         me->cur_len = i+1; 
    550                         gtk_tree_model_row_inserted ((GtkTreeModel *)me, path, &iter); 
     558                        priv->cur_len = i+1; 
     559                        gtk_tree_model_row_inserted ((GtkTreeModel *) data, path, &iter); 
    551560                        gtk_tree_path_free (path); 
    552561                } 
     
    565574tny_gtk_header_list_model_prepend (TnyList *self, GObject* item) 
    566575{ 
    567         TnyGtkHeaderListModel *me = (TnyGtkHeaderListModel*)self; 
    568         g_static_rec_mutex_lock (me->iterator_lock); 
     576        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (self); 
     577 
     578        g_static_rec_mutex_lock (priv->iterator_lock); 
    569579 
    570580        /* Prepend something to the list itself. The get_length will auto update 
     
    574584        g_object_ref (item); 
    575585 
    576         g_mutex_lock (me->ra_lock); 
    577  
    578         g_ptr_array_add (me->items, item); 
     586        g_mutex_lock (priv->ra_lock); 
     587 
     588        g_ptr_array_add (priv->items, item); 
    579589 
    580590        /* This prepend will happen very often, the notificating of the view is,  
    581591         * however, quite slow and gdk wants us to do this from the mainloop */ 
    582592 
    583         if (me->updating_views == -1) 
     593        if (priv->updating_views == -1) 
    584594        { 
    585                 me->updating_views = 0; 
    586                 g_object_ref (me); 
    587  
    588                 if (me->add_timeout > 0) { 
    589                         g_source_remove (me->add_timeout); 
    590                         me->add_timeout = 0; 
     595                priv->updating_views = 0; 
     596                g_object_ref (self); 
     597 
     598                if (priv->add_timeout > 0) { 
     599                        g_source_remove (priv->add_timeout); 
     600                        priv->add_timeout = 0; 
    591601                } 
    592602 
    593                 me->add_timeout = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,  
    594                         me->timeout_span, notify_views_add, me,  
     603                priv->add_timeout = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,  
     604                        priv->timeout_span, notify_views_add, self,  
    595605                        notify_views_add_destroy); 
    596606        } 
    597607 
    598         g_mutex_unlock (me->ra_lock); 
    599  
    600         g_static_rec_mutex_unlock (me->iterator_lock); 
     608        g_mutex_unlock (priv->ra_lock); 
     609 
     610        g_static_rec_mutex_unlock (priv->iterator_lock); 
    601611 
    602612        return; 
     
    624634{ 
    625635        notify_views_data_t *stuff = data; 
    626         TnyGtkHeaderListModel *me = (TnyGtkHeaderListModel*) stuff->self
    627  
    628         g_mutex_lock (me->to_lock); 
    629         if (stuff->src != -1 && stuff->src < me->del_timeouts->len) 
    630                 g_array_index (me->del_timeouts, guint, (guint) stuff->src) = 0; 
    631         g_mutex_unlock (me->to_lock); 
     636        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (stuff->self)
     637 
     638        g_mutex_lock (priv->to_lock); 
     639        if (stuff->src != -1 && stuff->src < priv->del_timeouts->len) 
     640                g_array_index (priv->del_timeouts, guint, (guint) stuff->src) = 0; 
     641        g_mutex_unlock (priv->to_lock); 
    632642 
    633643        g_object_unref (stuff->item); 
     
    644654{ 
    645655        notify_views_data_t *stuff = data; 
    646         TnyGtkHeaderListModel *me = (TnyGtkHeaderListModel*) stuff->self; 
     656        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (stuff->self); 
     657 
    647658        GtkTreePath *path; 
    648659        GtkTreeIter iter; 
     
    650661        GObject *mitem, *item = stuff->item; 
    651662 
    652         g_static_rec_mutex_lock (me->iterator_lock); 
    653  
    654         for (i=0; i < me->items->len; i++) 
    655                 if (me->items->pdata[i] == item) 
     663        g_static_rec_mutex_lock (priv->iterator_lock); 
     664 
     665        for (i=0; i < priv->items->len; i++) 
     666                if (priv->items->pdata[i] == item) 
    656667                { 
    657668                        found = TRUE; 
     
    661672        if (found) 
    662673        { 
    663                 iter.stamp = me->stamp; 
     674                iter.stamp = priv->stamp; 
    664675                iter.user_data = (gpointer) i; 
    665676                path = gtk_tree_path_new (); 
    666677                gtk_tree_path_append_index (path, i); 
    667                 gtk_tree_model_row_deleted (GTK_TREE_MODEL (me), path); 
    668                 g_mutex_lock (me->ra_lock); 
    669                 me->cur_len--; 
    670                 me->registered--; 
    671                 g_mutex_unlock (me->ra_lock); 
     678                gtk_tree_model_row_deleted ((GtkTreeModel *) stuff->self, path); 
     679                g_mutex_lock (priv->ra_lock); 
     680                priv->cur_len--; 
     681                priv->registered--; 
     682                g_mutex_unlock (priv->ra_lock); 
    672683                gtk_tree_path_free (path); 
    673684 
    674                 mitem = g_ptr_array_remove_index (me->items, i); 
     685                mitem = g_ptr_array_remove_index (priv->items, i); 
    675686                if (mitem) 
    676687                        g_object_unref (mitem); 
    677688        } 
    678689 
    679         g_static_rec_mutex_unlock (me->iterator_lock); 
     690        g_static_rec_mutex_unlock (priv->iterator_lock); 
    680691 
    681692        if (g_main_loop_is_running (stuff->loop)) 
     
    689700tny_gtk_header_list_model_remove (TnyList *self, GObject* item) 
    690701{ 
    691         TnyGtkHeaderListModel *me = (TnyGtkHeaderListModel*) self
     702        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (self)
    692703        notify_views_data_t *stuff; 
    693704        guint src; 
     
    702713        src = g_timeout_add_full (G_PRIORITY_HIGH_IDLE, 0, 
    703714                notify_views_delete, stuff, notify_views_delete_destroy); 
    704         stuff->src = (gint) add_del_timeout (me, src); 
     715        stuff->src = (gint) add_del_timeout ((TnyGtkHeaderListModel *) self, src); 
    705716 
    706717        /* This truly sucks :-( */ 
     
    713724tny_gtk_header_list_model_get_length (TnyList *self) 
    714725{ 
    715         TnyGtkHeaderListModel *me = (TnyGtkHeaderListModel*)self
     726        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (self)
    716727        guint retval = 0; 
    717728 
    718         g_static_rec_mutex_lock (me->iterator_lock); 
    719         retval = me->items->len; 
    720         g_static_rec_mutex_unlock (me->iterator_lock); 
     729        g_static_rec_mutex_lock (priv->iterator_lock); 
     730        retval = priv->items->len; 
     731        g_static_rec_mutex_unlock (priv->iterator_lock); 
    721732 
    722733        return retval; 
     
    726737tny_gtk_header_list_model_create_iterator (TnyList *self) 
    727738{ 
    728         TnyGtkHeaderListModel *me = (TnyGtkHeaderListModel*)self; 
    729  
    730         /* Return a new iterator */ 
    731  
    732         return _tny_gtk_header_list_iterator_new (me); 
     739        return _tny_gtk_header_list_iterator_new ((TnyGtkHeaderListModel *) self); 
    733740} 
    734741 
     
    737744{ 
    738745        GPtrArray *items = user_data; 
    739         g_ptr_array_add (items, g_object_ref (G_OBJECT (data))); 
     746        g_ptr_array_add (items, g_object_ref (data)); 
    740747        return; 
    741748} 
     
    744751tny_gtk_header_list_model_copy_the_list (TnyList *self) 
    745752{ 
    746         TnyGtkHeaderListModel *me = (TnyGtkHeaderListModel*)self
     753        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (self)
    747754        TnyGtkHeaderListModel *copy = g_object_new (TNY_TYPE_GTK_HEADER_LIST_MODEL, NULL); 
     755        TnyGtkHeaderListModelPriv *cpriv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (copy); 
    748756 
    749757        /* This only copies the TnyList pieces. The result is not a 
     
    755763           only a copy of the list-nodes of course. */ 
    756764 
    757         g_static_rec_mutex_lock (me->iterator_lock); 
    758  
    759         GPtrArray *items_copy = g_ptr_array_sized_new (me->items->len); 
    760         g_ptr_array_foreach (me->items, copy_it, items_copy); 
    761         copy->items = items_copy; 
    762  
    763         g_static_rec_mutex_unlock (me->iterator_lock); 
     765        g_static_rec_mutex_lock (priv->iterator_lock); 
     766 
     767        GPtrArray *items_copy = g_ptr_array_sized_new (priv->items->len); 
     768        g_ptr_array_foreach (priv->items, copy_it, items_copy); 
     769        cpriv->items = items_copy; 
     770        g_static_rec_mutex_unlock (priv->iterator_lock); 
    764771 
    765772        return TNY_LIST (copy); 
     
    769776tny_gtk_header_list_model_foreach_in_the_list (TnyList *self, GFunc func, gpointer user_data) 
    770777{ 
    771         TnyGtkHeaderListModel *me = (TnyGtkHeaderListModel*)self; 
    772  
    773         /* Foreach item in the list (without using a slower iterator) */ 
    774  
    775         g_static_rec_mutex_lock (me->iterator_lock); 
    776  
    777         g_ptr_array_foreach (me->items, func, user_data); 
    778  
    779         g_static_rec_mutex_unlock (me->iterator_lock); 
     778        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (self); 
     779 
     780        g_static_rec_mutex_lock (priv->iterator_lock); 
     781        g_ptr_array_foreach (priv->items, func, user_data); 
     782        g_static_rec_mutex_unlock (priv->iterator_lock); 
    780783 
    781784        return; 
     
    800803tny_gtk_header_list_model_finalize (GObject *object) 
    801804{ 
    802         TnyGtkHeaderListModel *self = (TnyGtkHeaderListModel *)object; 
    803  
    804         g_static_rec_mutex_lock (self->iterator_lock); 
    805  
    806         if (self->add_timeout > 0) { 
    807                 g_source_remove (self->add_timeout); 
    808                 self->add_timeout = 0; 
     805        TnyGtkHeaderListModel *self = (TnyGtkHeaderListModel *) object; 
     806        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (self); 
     807 
     808        g_static_rec_mutex_lock (priv->iterator_lock); 
     809