Changeset 10351


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

(trunk gtk) #3011 "'Edit Trackers' dialog not reset after Cancel" -- fixed in trunk for 2.00

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/details.c

    r10332 r10351  
    19001900}
    19011901
     1902static void
     1903populate_tracker_buffer( GtkTextBuffer * buffer, const tr_torrent * tor )
     1904{
     1905    int i;
     1906    int tier = 0;
     1907    GString * gstr = g_string_new( NULL );
     1908    const tr_info * inf = tr_torrentInfo( tor );
     1909    for( i=0; i<inf->trackerCount; ++i ) {
     1910        const tr_tracker_info * t = &inf->trackers[i];
     1911        if( tier != t->tier ) {
     1912            tier = t->tier;
     1913            g_string_append_c( gstr, '\n' );
     1914        }
     1915        g_string_append_printf( gstr, "%s\n", t->announce );
     1916    }
     1917    if( gstr->len > 0 )
     1918        g_string_truncate( gstr, gstr->len-1 );
     1919    gtk_text_buffer_set_text( buffer, gstr->str, -1 );
     1920    g_string_free( gstr, TRUE );
     1921}
     1922
    19021923#define TORRENT_PTR_KEY "torrent-pointer"
    19031924
     
    19471968    if( ( di->tracker_buffer == NULL ) && ( n == 1 ) )
    19481969    {
    1949         int tier = 0;
    1950         GString * gstr = g_string_new( NULL );
    1951         const tr_info * inf = tr_torrentInfo( torrents[0] );
    1952         for( i=0; i<inf->trackerCount; ++i ) {
    1953             const tr_tracker_info * t = &inf->trackers[i];
    1954             if( tier != t->tier ) {
    1955                 tier = t->tier;
    1956                 g_string_append_c( gstr, '\n' );
    1957             }
    1958             g_string_append_printf( gstr, "%s\n", t->announce );
    1959         }
    1960         if( gstr->len > 0 )
    1961             g_string_truncate( gstr, gstr->len-1 );
    19621970        di->tracker_buffer = gtk_text_buffer_new( NULL );
    1963         gtk_text_buffer_set_text( di->tracker_buffer, gstr->str, -1 );
    1964         g_string_free( gstr, TRUE );
     1971        populate_tracker_buffer( di->tracker_buffer, torrents[0] );
    19651972    }
    19661973
     
    20992106    }
    21002107
     2108    if( response == GTK_RESPONSE_CANCEL )
     2109    {
     2110        tr_torrent * tor = g_object_get_data( G_OBJECT( dialog ), TORRENT_PTR_KEY );
     2111        populate_tracker_buffer( di->tracker_buffer, tor );
     2112    }
     2113
    21012114    if( do_destroy )
    21022115        gtk_widget_destroy( GTK_WIDGET( dialog ) );
Note: See TracChangeset for help on using the changeset viewer.