Changeset 5996


Ignore:
Timestamp:
Jun 2, 2008, 3:07:26 PM (14 years ago)
Author:
charles
Message:

make the `new torrent' dialog a little prettier

Location:
trunk/gtk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/details.c

    r5989 r5996  
    11171117    hig_workarea_add_section_title( t, &row, _( "Trackers" ) );
    11181118
    1119         w = tracker_list_new( gtor, GTK_POS_RIGHT );
     1119        w = tracker_list_new( gtor );
    11201120        hig_workarea_add_wide_control( t, &row, w );
    11211121
  • trunk/gtk/main.c

    r5987 r5996  
    700700
    701701    b = gtk_alignment_new(0.0, 1.0, 0.01, 0.01);
    702     w = gtk_button_new_with_label( _( "_Quit Now" ) );
    703     gtk_button_set_image( GTK_BUTTON(w), gtk_image_new_from_stock( GTK_STOCK_QUIT, GTK_ICON_SIZE_BUTTON ) );
     702    w = tr_button_new_from_stock( GTK_STOCK_QUIT, _( "_Quit Now" ) );
    704703    g_signal_connect(w, "clicked", G_CALLBACK(do_exit_cb), NULL);
    705704    gtk_container_add(GTK_CONTAINER(b), w);
  • trunk/gtk/makemeta-ui.c

    r5995 r5996  
    306306{
    307307    int row = 0;
    308     GtkWidget *d, *t, *w, *h, *h2, *v, *focusMe, *extras;
     308    GtkWidget *b1, *b2, *d, *t, *w, *h, *h2, *v, *focusMe, *extras;
    309309    GtkBox * main_vbox;
    310310    MakeMetaUI * ui = g_new0 ( MakeMetaUI, 1 );
    311311    ui->handle = handle;
     312    int width, height;
    312313
    313314    d = gtk_dialog_new_with_buttons( _("New Torrent"),
     
    345346        gtk_box_pack_start_defaults( GTK_BOX( h ), v );
    346347        v = gtk_vbox_new( FALSE, GUI_PAD_SMALL );
    347         w = tr_button_new_from_stock( GTK_STOCK_DIRECTORY, _( "F_older" ) );
     348        w = b1 = tr_button_new_from_stock( GTK_STOCK_DIRECTORY, _( "F_older" ) );
    348349        focusMe = w;
    349350        g_signal_connect( w, "clicked", G_CALLBACK( onChooseDirectoryClicked ), ui );
    350351        gtk_box_pack_start_defaults( GTK_BOX( v ), w );
    351         w = tr_button_new_from_stock( GTK_STOCK_FILE, _( "_File" ) );
     352        w = b2 = tr_button_new_from_stock( GTK_STOCK_FILE, _( "_File" ) );
    352353        g_signal_connect( w, "clicked", G_CALLBACK( onChooseFileClicked ), ui );
    353354        gtk_box_pack_start_defaults( GTK_BOX( v ), w );
     
    358359    hig_workarea_add_section_title( t, &row, _( "Trackers" ) );
    359360
    360         w = tracker_list_new( NULL, GTK_POS_RIGHT );
     361        w = tracker_list_new( NULL );
    361362        ui->announce_list = w;
    362363        hig_workarea_add_wide_control( t, &row, w );
     364        tracker_list_get_button_size( w, &width, &height );
     365        gtk_widget_set_size_request( b1, width, height );
     366        gtk_widget_set_size_request( b2, width, height );
    363367
    364368    hig_workarea_add_section_divider( t, &row );
  • trunk/gtk/tracker-list.c

    r5991 r5996  
    251251
    252252GtkWidget*
    253 tracker_list_new( TrTorrent * gtor, GtkPositionType buttonPos )
     253tracker_list_new( TrTorrent * gtor )
    254254{
    255255    GtkWidget * w;
     
    266266    page->gtor = gtor;
    267267
    268     if( buttonPos == GTK_POS_LEFT || buttonPos == GTK_POS_RIGHT )
    269     {
    270         top = gtk_hbox_new( FALSE, GUI_PAD );
    271         box = gtk_vbox_new( FALSE, GUI_PAD );
    272         buttons = gtk_vbox_new( TRUE, GUI_PAD );
    273     }
    274     else
    275     {
    276         top = gtk_vbox_new( FALSE, GUI_PAD );
    277         box = gtk_hbox_new( FALSE, 0 );
    278         buttons = gtk_hbox_new( TRUE, GUI_PAD );
    279     }
     268    top = gtk_hbox_new( FALSE, GUI_PAD );
     269    box = gtk_vbox_new( FALSE, GUI_PAD );
     270    buttons = gtk_vbox_new( TRUE, GUI_PAD );
    280271
    281272    m = tracker_model_new( tr_torrent_handle( gtor ) );
     
    345336    }
    346337
    347    
    348     if( buttonPos == GTK_POS_LEFT || buttonPos == GTK_POS_RIGHT ) {
    349         gtk_box_pack_start( GTK_BOX( box ), buttons, FALSE, FALSE, 0 );
    350     } else {
    351         gtk_box_pack_end( GTK_BOX( box ), buttons, FALSE, FALSE, 0 );
    352     }
    353 
    354     if( buttonPos == GTK_POS_LEFT || buttonPos == GTK_POS_TOP ) {
    355         gtk_box_pack_start( GTK_BOX( top ), box, FALSE, FALSE, 0 );
    356         gtk_box_pack_start_defaults( GTK_BOX( top ), fr );
    357     } else {
    358         gtk_box_pack_start_defaults( GTK_BOX( top ), fr );
    359         gtk_box_pack_start( GTK_BOX( top ), box, FALSE, FALSE, 0 );
    360     }
     338    gtk_box_pack_start( GTK_BOX( box ), buttons, FALSE, FALSE, 0 );
     339    gtk_box_pack_start_defaults( GTK_BOX( top ), fr );
     340    gtk_box_pack_start( GTK_BOX( top ), box, FALSE, FALSE, 0 );
    361341
    362342    onTrackerSelectionChanged( sel, page );
     
    392372}
    393373
     374void
     375tracker_list_get_button_size( GtkWidget  * list,
     376                              gint       * width,
     377                              gint       * height )
     378{
     379    struct tracker_page * page = g_object_get_data( G_OBJECT( list ), "page" );
     380    GtkRequisition req;
     381    gtk_widget_size_request( page->remove_button, &req );
     382    if( width ) *width = req.width;
     383    if( height ) *height = req.height;
     384}
  • trunk/gtk/tracker-list.h

    r5989 r5996  
    55#include "tr-torrent.h"
    66
    7 GtkWidget* tracker_list_new( TrTorrent        * gtor,
    8                              GtkPositionType    buttonsPosition );
     7GtkWidget* tracker_list_new( TrTorrent * gtor );
     8
     9void tracker_list_get_button_size( GtkWidget  * list,
     10                                   gint       * width,
     11                                   gint       * height );
    912
    1013/**
  • trunk/gtk/util.c

    r5991 r5996  
    484484                          const char * mnemonic )
    485485{
    486     GtkWidget * button = gtk_button_new( );
    487     GtkWidget * label = gtk_label_new_with_mnemonic( mnemonic );
    488     gtk_label_set_mnemonic_widget( GTK_LABEL( label ), GTK_WIDGET( button ) );
    489 
    490486    GtkWidget * image = gtk_image_new_from_stock( stock, GTK_ICON_SIZE_BUTTON );
    491     GtkWidget * hbox = gtk_hbox_new( FALSE, GUI_PAD );
    492     GtkWidget * align = gtk_alignment_new( 0.5, 0.5, 0.0, 0.0 );
    493 
    494     gtk_box_pack_start( GTK_BOX( hbox ), image, FALSE, FALSE, 0 );
    495     gtk_box_pack_end( GTK_BOX( hbox ), label, FALSE, FALSE, 0 );
    496 
    497     gtk_container_add( GTK_CONTAINER( align ), hbox );
    498     gtk_container_add( GTK_CONTAINER( button ), align );
    499     gtk_widget_show_all( align );
    500 
     487    GtkWidget * button = gtk_button_new_with_mnemonic( mnemonic );
     488    gtk_button_set_image( GTK_BUTTON( button ), image );
    501489    return button;
    502490}
Note: See TracChangeset for help on using the changeset viewer.