Changeset 10350


Ignore:
Timestamp:
Mar 10, 2010, 7:16:22 PM (12 years ago)
Author:
charles
Message:

(1.9x gtk) #3011 "'Edit Trackers' dialog not reset after Cancel" -- fixed in 1.9x for 1.92

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.9x/gtk/details.c

    r10231 r10350  
    18201820}
    18211821
     1822static void
     1823populate_tracker_buffer( GtkTextBuffer * buffer, const tr_torrent * tor )
     1824{
     1825    int i;
     1826    int tier = 0;
     1827    GString * gstr = g_string_new( NULL );
     1828    const tr_info * inf = tr_torrentInfo( tor );
     1829    for( i=0; i<inf->trackerCount; ++i ) {
     1830        const tr_tracker_info * t = &inf->trackers[i];
     1831        if( tier != t->tier ) {
     1832            tier = t->tier;
     1833            g_string_append_c( gstr, '\n' );
     1834        }
     1835        g_string_append_printf( gstr, "%s\n", t->announce );
     1836    }
     1837    if( gstr->len > 0 )
     1838        g_string_truncate( gstr, gstr->len-1 );
     1839    gtk_text_buffer_set_text( buffer, gstr->str, -1 );
     1840    g_string_free( gstr, TRUE );
     1841}
     1842
    18221843#define TORRENT_PTR_KEY "torrent-pointer"
    18231844
     
    18671888    if( ( di->tracker_buffer == NULL ) && ( n == 1 ) )
    18681889    {
    1869         int tier = 0;
    1870         GString * gstr = g_string_new( NULL );
    1871         const tr_info * inf = tr_torrentInfo( torrents[0] );
    1872         for( i=0; i<inf->trackerCount; ++i ) {
    1873             const tr_tracker_info * t = &inf->trackers[i];
    1874             if( tier != t->tier ) {
    1875                 tier = t->tier;
    1876                 g_string_append_c( gstr, '\n' );
    1877             }
    1878             g_string_append_printf( gstr, "%s\n", t->announce );
    1879         }
    1880         if( gstr->len > 0 )
    1881             g_string_truncate( gstr, gstr->len-1 );
    18821890        di->tracker_buffer = gtk_text_buffer_new( NULL );
    1883         gtk_text_buffer_set_text( di->tracker_buffer, gstr->str, -1 );
    1884         g_string_free( gstr, TRUE );
     1891        populate_tracker_buffer( di->tracker_buffer, torrents[0] );
    18851892    }
    18861893
     
    20192026    }
    20202027
     2028    if( response == GTK_RESPONSE_CANCEL )
     2029    {
     2030        tr_torrent * tor = g_object_get_data( G_OBJECT( dialog ), TORRENT_PTR_KEY );
     2031        populate_tracker_buffer( di->tracker_buffer, tor );
     2032    }
     2033
    20212034    if( do_destroy )
    20222035        gtk_widget_destroy( GTK_WIDGET( dialog ) );
Note: See TracChangeset for help on using the changeset viewer.