Changeset 2297

Show
Ignore:
Timestamp:
06/28/07 17:58:05
Author:
pvanhoof
Message:

Fixing the connection-status-changed signal of TnyAccount

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r2296 r2297  
    22 
    33        * Slowing down the STATUS commands 
    4         * Detecting connection changes 
     4        * Detecting connection changes with the connection_status_changed 
     5        signal on TnyAccount 
    56 
    67        * This was a major API change 
  • trunk/libtinymail/tny-account.c

    r2225 r2297  
    900900                        NULL, NULL, 
    901901                        g_cclosure_marshal_VOID__INT,  
    902                         G_TYPE_NONE, 0); 
     902                        G_TYPE_NONE, 1, G_TYPE_INT); 
    903903 
    904904                initialized = TRUE; 
  • trunk/tests/c-demo/tny-demoui-summary-view.c

    r2267 r2297  
    243243} 
    244244 
     245static void 
     246on_constatus_changed (TnyAccount *a, TnyConnectionStatus status, gpointer user_data) 
     247{ 
     248        gchar *str = NULL; 
     249 
     250        if (status == TNY_CONNECTION_STATUS_DISCONNECTED) 
     251                str = "disconnected"; 
     252 
     253        if (status == TNY_CONNECTION_STATUS_CONNECTED) 
     254                str = "connected"; 
     255         
     256        if (status == TNY_CONNECTION_STATUS_CONNECTED_BROKEN) 
     257        { 
     258                tny_camel_account_set_online (TNY_CAMEL_ACCOUNT (a), FALSE, NULL); 
     259                str = "con broken"; 
     260        } 
     261 
     262        if (status == TNY_CONNECTION_STATUS_DISCONNECTED_BROKEN) 
     263                str = "discon broken"; 
     264 
     265        g_print ("CON EVENT FOR %s: %s\n", 
     266                tny_account_get_name (a), str); 
     267 
     268} 
     269 
    245270static void  
    246271reload_accounts (TnySummaryView *self) 
     
    250275        GtkTreeModel *sortable, *maccounts, *mailbox_model; 
    251276        TnyFolderStoreQuery *query; 
    252  
     277        TnyIterator *aiter = NULL; 
    253278 
    254279        /* Show only subscribed folders */ 
     
    285310 
    286311        priv->current_accounts = TNY_LIST (g_object_ref (G_OBJECT (accounts))); 
     312 
     313        aiter = tny_list_create_iterator (accounts); 
     314        while (!tny_iterator_is_done (aiter)) 
     315        { 
     316                GObject *a = tny_iterator_get_current (aiter); 
     317                 
     318                g_signal_connect (a, "connection-status-changed", 
     319                        G_CALLBACK (on_constatus_changed), self); 
     320 
     321                g_object_unref (a); 
     322                tny_iterator_next (aiter); 
     323        } 
     324 
     325        g_object_unref (aiter); 
    287326 
    288327        tny_account_store_get_accounts (account_store, TNY_LIST (maccounts),