Changeset 5283


Ignore:
Timestamp:
Mar 18, 2008, 4:18:22 PM (14 years ago)
Author:
charles
Message:

(gtk) fix open dialog error reported by Lacrocivious

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/open-dialog.c

    r5276 r5283  
    2121    TrCore * core;
    2222    GtkWidget * list;
    23     GtkToggleButton * run_check;
    24     GtkToggleButton * trash_check;
     23    GtkWidget * run_check;
     24    GtkWidget * trash_check;
    2525    char * filename;
    2626    char * destination;
     
    5252            deleteOldTorrent( data );
    5353        else {
    54             if( gtk_toggle_button_get_active( data->run_check ) )
     54            if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( data->run_check ) ) )
    5555                tr_torrentStart( tr_torrent_handle( data->gtor ) );
    5656            tr_core_add_torrent( data->core, data->gtor );
    57             if( gtk_toggle_button_get_active( data->trash_check ) )
     57            if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( data->trash_check ) ) )
    5858                tr_file_trash_or_unlink( data->filename );
    5959        }
     
    157157    if( tr_ctorGetDestination( ctor, TR_FORCE, &str ) )
    158158        g_assert_not_reached( );
     159
    159160    data = g_new0( struct OpenData, 1 );
    160161    data->core = core;
     
    162163    data->filename = g_strdup( tr_ctorGetSourceFile( ctor ) );
    163164    data->destination = g_strdup( str );
     165    data->list = file_list_new( NULL );
     166    data->trash_check = gtk_check_button_new_with_mnemonic( _( "_Trash original torrent file" ) );
     167    data->run_check = gtk_check_button_new_with_mnemonic( _( "_Start when added" ) );
     168
    164169    g_signal_connect( G_OBJECT( d ), "response",
    165170                      G_CALLBACK( openResponseCB ), data );
     
    208213    ++row;
    209214    col = 0;
    210     w = file_list_new( NULL );
     215    w = data->list;
    211216    gtk_widget_set_size_request ( w, 466u, 300u );
    212     data->list = w;
    213217    gtk_table_attach_defaults( GTK_TABLE( t ), w, col, col+2, row, row+1 );
    214218
     
    221225    ++row;
    222226    col = 0;
    223     w = gtk_check_button_new_with_mnemonic( _( "_Trash original torrent file" ) );
    224     data->trash_check = GTK_TOGGLE_BUTTON( w );
     227    w = data->trash_check;
    225228    if( tr_ctorGetDeleteSource( ctor, &flag ) )
    226229        g_assert_not_reached( );
     
    230233    ++row;
    231234    col = 0;
    232     w = gtk_check_button_new_with_mnemonic( _( "_Start when added" ) );
    233     data->run_check = GTK_TOGGLE_BUTTON( w );
     235    w = data->run_check;
    234236    if( tr_ctorGetPaused( ctor, TR_FORCE, &flag ) )
    235237        g_assert_not_reached( );
     
    263265{
    264266    GtkWidget * w;
     267    GtkFileFilter * filter;
     268
    265269
    266270    w = gtk_file_chooser_dialog_new( _( "Select Torrents" ), parent,
     
    275279    gtk_file_chooser_set_select_multiple( GTK_FILE_CHOOSER( w ), TRUE );
    276280
     281    filter = gtk_file_filter_new( );
     282    gtk_file_filter_set_name( filter, _( "Torrent files" ) );
     283    gtk_file_filter_add_pattern( filter, "*.torrent" );
     284    gtk_file_chooser_add_filter( GTK_FILE_CHOOSER( w ), filter );
     285
     286    filter = gtk_file_filter_new( );
     287    gtk_file_filter_set_name( filter, _( "All files" ) );
     288    gtk_file_filter_add_pattern( filter, "*" );
     289    gtk_file_chooser_add_filter( GTK_FILE_CHOOSER( w ), filter );
     290
    277291    g_signal_connect( w, "response", G_CALLBACK(onOpenDialogResponse), core );
    278292
Note: See TracChangeset for help on using the changeset viewer.