Changeset 1723

Show
Ignore:
Timestamp:
03/14/07 20:00:07
Author:
pvanhoof
Message:

API change for tny_folder_store_remove

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r1722 r1723  
     12007-03-14  Philip Van Hoof  <pvanhoof@gnome.org> 
     2 
     3        * tny_folder_store_remove now specifies and its implementation will 
     4        unsubscribe all the observers of the folder being removed. 
     5 
     6        * This was a major API change 
     7 
    182007-03-14  Sergio Villar Senin  <svillar@igalia.com> 
    29 
  • trunk/libtinymail-camel/tny-camel-folder-priv.h

    r1719 r1723  
    3434        guint folder_changed_id; 
    3535        guint headers_managed; 
    36         GStaticRecMutex *folder_lock
     36        GStaticRecMutex *folder_lock, *obs_lock
    3737        CamelFolder *folder; 
    3838        gchar *folder_name; 
  • trunk/libtinymail-camel/tny-camel-folder.c

    r1720 r1723  
    8181                return; 
    8282 
     83        g_static_rec_mutex_lock (priv->obs_lock); 
     84 
    8385        iter = tny_list_create_iterator (priv->sobservers); 
    8486        while (!tny_iterator_is_done (iter)) 
     
    9092        } 
    9193        g_object_unref (G_OBJECT (iter)); 
     94 
     95        g_static_rec_mutex_unlock (priv->obs_lock); 
     96 
    9297} 
    9398 
     
    100105        if (!priv->observers) 
    101106                return; 
     107 
     108        g_static_rec_mutex_lock (priv->obs_lock); 
    102109 
    103110        iter = tny_list_create_iterator (priv->observers); 
     
    110117        } 
    111118        g_object_unref (G_OBJECT (iter)); 
     119 
     120        g_static_rec_mutex_unlock (priv->obs_lock); 
     121 
    112122} 
    113123 
     
    22312241                        CamelException subex = CAMEL_EXCEPTION_INITIALISER; 
    22322242 
     2243                        g_static_rec_mutex_lock (cpriv->obs_lock); 
     2244                        if (cpriv->observers) { 
     2245                                g_object_unref (G_OBJECT (cpriv->observers)); 
     2246                                cpriv->observers = NULL; 
     2247                        } 
     2248                        if (cpriv->sobservers) { 
     2249                                g_object_unref (G_OBJECT (cpriv->sobservers)); 
     2250                                cpriv->sobservers = NULL; 
     2251                        } 
     2252                        g_static_rec_mutex_unlock (priv->obs_lock); 
     2253 
    22332254                        if (camel_store_supports_subscriptions (store)) 
    22342255                                camel_store_subscribe_folder (store, cfolname, &subex); 
     
    27832804        g_assert (TNY_IS_FOLDER_OBSERVER (observer)); 
    27842805 
    2785         /* TNY TODO: locking */ 
    2786  
     2806        g_static_rec_mutex_lock (priv->obs_lock); 
    27872807        if (!priv->observers) 
    27882808                priv->observers = tny_simple_list_new (); 
    2789  
    27902809        tny_list_prepend (priv->observers, G_OBJECT (observer)); 
     2810        g_static_rec_mutex_unlock (priv->obs_lock); 
    27912811 
    27922812        determine_push_email (priv); 
     
    28122832                return; 
    28132833 
     2834        g_static_rec_mutex_lock (priv->obs_lock); 
    28142835        tny_list_remove (priv->observers, G_OBJECT (observer)); 
     2836        g_static_rec_mutex_unlock (priv->obs_lock); 
    28152837 
    28162838        determine_push_email (priv); 
     
    28522874        g_assert (TNY_IS_FOLDER_STORE_OBSERVER (observer)); 
    28532875 
    2854         /* TNY TODO: locking */ 
    2855  
     2876        g_static_rec_mutex_lock (priv->obs_lock); 
    28562877        if (!priv->sobservers) 
    28572878                priv->sobservers = tny_simple_list_new (); 
    2858  
    28592879        tny_list_prepend (priv->sobservers, G_OBJECT (observer)); 
     2880        g_static_rec_mutex_unlock (priv->obs_lock); 
    28602881 
    28612882        return; 
     
    28792900                return; 
    28802901 
     2902        g_static_rec_mutex_lock (priv->obs_lock); 
    28812903        tny_list_remove (priv->sobservers, G_OBJECT (observer)); 
     2904        g_static_rec_mutex_unlock (priv->obs_lock); 
    28822905 
    28832906        return; 
     
    29552978        TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 
    29562979 
    2957         g_static_rec_mutex_lock (priv->folder_lock); 
    2958         priv->dont_fkill = FALSE; 
    2959  
     2980 
     2981        g_static_rec_mutex_lock (priv->obs_lock); 
    29602982        if (priv->observers) 
    29612983                g_object_unref (G_OBJECT (priv->observers)); 
    29622984        if (priv->sobservers) 
    29632985                g_object_unref (G_OBJECT (priv->sobservers)); 
     2986        g_static_rec_mutex_unlock (priv->obs_lock); 
     2987 
     2988        g_static_rec_mutex_lock (priv->folder_lock); 
     2989        priv->dont_fkill = FALSE; 
    29642990 
    29652991        if (priv->account && TNY_IS_CAMEL_STORE_ACCOUNT (priv->account)) 
     
    30033029        g_static_rec_mutex_free (priv->folder_lock); 
    30043030        priv->folder_lock = NULL; 
     3031 
     3032        g_static_rec_mutex_free (priv->obs_lock); 
     3033        priv->obs_lock = NULL; 
     3034 
    30053035 
    30063036        if (priv->folder_name) 
     
    31503180        priv->folder_lock = g_new0 (GStaticRecMutex, 1); 
    31513181        g_static_rec_mutex_init (priv->folder_lock); 
     3182        priv->obs_lock = g_new0 (GStaticRecMutex, 1); 
     3183        g_static_rec_mutex_init (priv->obs_lock); 
    31523184 
    31533185        return; 
  • trunk/libtinymail-camel/tny-camel-store-account.c

    r1688 r1723  
    393393        g_assert (TNY_IS_CAMEL_FOLDER (folder)); 
    394394 
     395        /* TNY TODO: Support non-TnyCamelFolder TnyFolder implementations too */ 
     396 
    395397        if (!_tny_session_check_operation (apriv->session, err,  
    396398                        TNY_FOLDER_STORE_ERROR, TNY_FOLDER_STORE_ERROR_REMOVE_FOLDER)) 
     
    425427        g_assert (CAMEL_IS_STORE (store)); 
    426428        g_assert (cpriv->folder_name != NULL); 
     429 
     430        g_static_rec_mutex_lock (cpriv->obs_lock); 
     431        if (cpriv->observers) { 
     432                g_object_unref (G_OBJECT (cpriv->observers)); 
     433                cpriv->observers = NULL; 
     434        } 
     435        if (cpriv->sobservers) { 
     436                g_object_unref (G_OBJECT (cpriv->sobservers)); 
     437                cpriv->sobservers = NULL; 
     438        } 
     439        g_static_rec_mutex_unlock (cpriv->obs_lock); 
    427440 
    428441        if (camel_store_supports_subscriptions (store)) 
  • trunk/libtinymail/tny-folder-store.c

    r1716 r1723  
    8080 * not do this for you, leaving the @folder instance in an unusable state. The  
    8181 * id of the @folder instance will be blanked once really deleted from the 
    82  * service. 
    83  * 
     82 * service. All the #TnyFolderObservers and #TnyFolderStoreObservers of @folder, 
     83 * but of course not of @self, will automatically be unsubscribed. 
     84 *  
    8485 * Example: 
    8586 * <informalexample><programlisting>