Changeset 9242


Ignore:
Timestamp:
Oct 4, 2009, 2:32:38 AM (12 years ago)
Author:
charles
Message:

(trunk gtk) fix the editing of tracker URLs in the GTK+ client

Location:
trunk/gtk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/details.c

    r9188 r9242  
    8787    GtkListStore * trackers;
    8888    GtkTreeModel * trackers_filtered;
     89    GtkWidget * edit_trackers_button;
    8990    GtkWidget * tracker_view;
    9091    GtkWidget * scrape_check;
     
    17051706}
    17061707
    1707 //ccc
     1708#define TORRENT_PTR_KEY "torrent-pointer"
     1709
    17081710static void
    17091711refreshTracker( struct DetailsImpl * di, tr_torrent ** torrents, int n )
     
    17221724        stats[i] = tr_torrentTrackers( torrents[i], &statCount[i] );
    17231725
     1726    /* "edit trackers" button */
     1727    gtk_widget_set_sensitive( di->edit_trackers_button, n==1 );
     1728    if( n==1 )
     1729        g_object_set_data( G_OBJECT( di->edit_trackers_button ), TORRENT_PTR_KEY, torrents[0] );
     1730
    17241731    /* build the store if we don't already have it */
    17251732    if( store == NULL )
     
    17511758        for( i=0; i<inf->trackerCount; ++i ) {
    17521759            const tr_tracker_info * t = &inf->trackers[i];
    1753             g_string_append_printf( gstr, "%s\n", t->announce );
    17541760            if( tier != t->tier ) {
    17551761                tier = t->tier;
    17561762                g_string_append_c( gstr, '\n' );
    17571763            }
     1764            g_string_append_printf( gstr, "%s\n", t->announce );
    17581765        }
    17591766        if( gstr->len > 0 )
     
    18521859        char ** tracker_strings;
    18531860        tr_tracker_info * trackers;
     1861        tr_torrent * tor = g_object_get_data( G_OBJECT( dialog ), TORRENT_PTR_KEY );
    18541862
    18551863        /* build the array of trackers */
     
    18721880
    18731881        /* update the torrent */
    1874         tr_torrentSetAnnounceList( NULL, trackers, n );
     1882        tr_torrentSetAnnounceList( tor, trackers, n );
    18751883        di->trackers = NULL;
    18761884        di->tracker_buffer = NULL;
     
    18881896onEditTrackers( GtkButton * button, gpointer data )
    18891897{
    1890     GtkWidget *w, *d, *sw, *fr;
     1898    int row;
     1899    GtkWidget *w, *d, *fr, *t, *l, *sw;
    18911900    GtkWindow * win = GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( button ) ) );
    18921901    struct DetailsImpl * di = data;
     
    18971906                                     GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
    18981907                                     NULL );
     1908    g_object_set_data( G_OBJECT( d ), TORRENT_PTR_KEY,
     1909                       g_object_get_data( G_OBJECT( button ), TORRENT_PTR_KEY ) );
    18991910    g_signal_connect( d, "response",
    19001911                      G_CALLBACK( onEditTrackersResponse ), data );
    19011912
    1902     w = gtk_text_view_new_with_buffer( di->tracker_buffer );
    1903     gtr_widget_set_tooltip_text( w, _( "Transmission supports HTTP and HTTPS (SSL) trackers.  Torrents with multiple trackers are also supported -- trackers from the same server (with similar URLs) must be grouped together and those from different servers separated by a blank line." ) );
    1904     gtk_widget_set_size_request( w, 400, 300 );
    1905     sw = gtk_scrolled_window_new( NULL, NULL );
    1906     gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( sw ),
    1907                                     GTK_POLICY_AUTOMATIC,
    1908                                     GTK_POLICY_AUTOMATIC );
    1909     gtk_container_add( GTK_CONTAINER( sw ), w );
    1910     fr = gtk_frame_new( NULL );
    1911     gtk_frame_set_shadow_type( GTK_FRAME( fr ), GTK_SHADOW_IN );
    1912     gtk_container_add( GTK_CONTAINER( fr ), sw );
    1913 
    1914     gtk_box_pack_start( GTK_BOX( GTK_DIALOG( d )->vbox ), fr, TRUE, TRUE, GUI_PAD_SMALL );
     1913    row = 0;
     1914    t = hig_workarea_create( );
     1915    hig_workarea_add_section_title( t, &row, _( "Tracker Announce URLs" ) );
     1916
     1917        l = gtk_label_new( NULL );
     1918        gtk_label_set_markup( GTK_LABEL( l ), _( "To add a backup URL, add it on the line after the primary URL.\n"
     1919                                                 "To add another primary URL, add it after a blank line." ) );
     1920        gtk_label_set_justify( GTK_LABEL( l ), GTK_JUSTIFY_LEFT );
     1921        gtk_misc_set_alignment( GTK_MISC( l ), 0.0, 0.5 );
     1922        hig_workarea_add_wide_control( t, &row, l );
     1923
     1924        w = gtk_text_view_new_with_buffer( di->tracker_buffer );
     1925        gtk_widget_set_size_request( w, 500u, 66u );
     1926        fr = gtk_frame_new( NULL );
     1927        gtk_frame_set_shadow_type( GTK_FRAME( fr ), GTK_SHADOW_IN );
     1928        sw = gtk_scrolled_window_new( NULL, NULL );
     1929        gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( sw ),
     1930                                        GTK_POLICY_AUTOMATIC,
     1931                                        GTK_POLICY_AUTOMATIC );
     1932        gtk_container_add( GTK_CONTAINER( sw ), w );
     1933        gtk_container_add( GTK_CONTAINER( fr ), sw );
     1934        hig_workarea_add_wide_control( t, &row, fr );
     1935
     1936    hig_workarea_finish( t, &row );
     1937    gtk_box_pack_start( GTK_BOX( GTK_DIALOG( d )->vbox ), t, TRUE, TRUE, GUI_PAD_SMALL );
    19151938    gtk_widget_show_all( d );
    19161939}
     
    19601983      gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
    19611984
    1962       w = gtk_button_new_from_stock( GTK_STOCK_EDIT );
     1985      w = gtk_button_new_with_mnemonic( _( "_Edit URLs" ) );
     1986      gtk_button_set_image( GTK_BUTTON( w ), gtk_image_new_from_stock( GTK_STOCK_EDIT, GTK_ICON_SIZE_BUTTON ) );
    19631987      g_signal_connect( w, "clicked", G_CALLBACK( onEditTrackers ), di );
    19641988      gtk_box_pack_end( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
     1989      di->edit_trackers_button = w;
    19651990
    19661991    gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
  • trunk/gtk/makemeta-ui.c

    r9148 r9242  
    374374    int row = 0;
    375375    const char * str;
    376     GtkWidget * d, *t, *w, *l, *fr, *sw;
     376    GtkWidget * d, *t, *w, *l, *fr, *sw, *v;
    377377    GSList * slist;
    378378    MakeMetaUI * ui = g_new0 ( MakeMetaUI, 1 );
     
    430430
    431431        str = _( "_Trackers:" );
     432        v = gtk_vbox_new( FALSE, GUI_PAD_SMALL );
    432433        ui->announce_text_buffer = gtk_text_buffer_new( NULL );
    433434        w = gtk_text_view_new_with_buffer( ui->announce_text_buffer );
    434         gtr_widget_set_tooltip_text( w, _( "Transmission supports HTTP and HTTPS (SSL) trackers.  Torrents with multiple trackers are also supported -- trackers from the same server (with similar URLs) must be grouped together and those from different servers separated by a blank line." ) );
    435435        gtk_widget_set_size_request( w, -1, 80 );
    436436        sw = gtk_scrolled_window_new( NULL, NULL );
     
    442442        gtk_frame_set_shadow_type( GTK_FRAME( fr ), GTK_SHADOW_IN );
    443443        gtk_container_add( GTK_CONTAINER( fr ), sw );
    444         hig_workarea_add_tall_row( t, &row, str, fr, NULL );
     444        gtk_box_pack_start( GTK_BOX( v ), fr, TRUE, TRUE, 0 );
     445        l = gtk_label_new( NULL );
     446        gtk_label_set_markup( GTK_LABEL( l ), _( "To add a backup URL, add it on the line after the primary URL.\n"
     447                                                 "To add another primary URL, add it after a blank line." ) );
     448        gtk_label_set_justify( GTK_LABEL( l ), GTK_JUSTIFY_LEFT );
     449        gtk_misc_set_alignment( GTK_MISC( l ), 0.0, 0.5 );
     450        gtk_box_pack_start( GTK_BOX( v ), l, FALSE, FALSE, 0 );
     451        hig_workarea_add_tall_row( t, &row, str, v, NULL );
    445452
    446453        l = gtk_check_button_new_with_mnemonic( _( "Co_mment:" ) );
Note: See TracChangeset for help on using the changeset viewer.