Changeset 4848


Ignore:
Timestamp:
Jan 27, 2008, 8:12:10 PM (14 years ago)
Author:
charles
Message:

(gtk) #649: don't ask for confirmation on close when there are no active torrents.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/dialogs.c

    r4782 r4848  
    357357}
    358358
     359static gboolean
     360countActiveTorrents( GtkTreeModel  * model,
     361                     GtkTreePath   * path UNUSED,
     362                     GtkTreeIter   * iter,
     363                     gpointer        activeTorrentCount )
     364{
     365    int status = -1;
     366    gtk_tree_model_get( model, iter, MC_STATUS, &status, -1 );
     367    if( status != TR_STATUS_STOPPED )
     368        *(int*)activeTorrentCount += 1;
     369    return FALSE; /* keep iterating */
     370}
     371
    359372void
    360373askquit( TrCore          * core,
     
    366379    GtkWidget * wind;
    367380    GtkWidget * dontask;
     381    GtkTreeModel * model;
     382    int activeTorrentCount;
    368383
    369384    /* if the user doesn't want to be asked, don't ask */
     
    373388    }
    374389
    375     /* if there aren't any torrents, don't ask */
    376     if( !tr_torrentCount( tr_core_handle( core ) ) ) {
     390    /* if there aren't any active torrents, don't ask */
     391    model = tr_core_model( core );
     392    activeTorrentCount = 0;
     393    gtk_tree_model_foreach( model, countActiveTorrents, &activeTorrentCount );
     394    if( !activeTorrentCount ) {
    377395        func( cbdata );
    378396        return;
Note: See TracChangeset for help on using the changeset viewer.