Changeset 2151


Ignore:
Timestamp:
Jun 18, 2007, 4:52:03 AM (15 years ago)
Author:
charles
Message:

fix the bug Lacrocivious found in the gtk+ "create torrent" dialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/makemeta-ui.c

    r2149 r2151  
    159159}
    160160
    161 static void
    162 file_mode_toggled_cb (GtkToggleButton *togglebutton, gpointer user_data)
    163 {
    164     if( gtk_toggle_button_get_active( togglebutton ) )
    165     {
    166         GtkFileChooserButton * w = GTK_FILE_CHOOSER_BUTTON(user_data);
    167         gtk_file_chooser_set_action( GTK_FILE_CHOOSER( w ), GTK_FILE_CHOOSER_ACTION_OPEN );
    168     }
    169 }
    170 
    171 static void
    172 dir_mode_toggled_cb (GtkToggleButton *togglebutton, gpointer user_data)
    173 {
    174     if( gtk_toggle_button_get_active( togglebutton ) )
    175     {
    176         GtkFileChooserButton * w = GTK_FILE_CHOOSER_BUTTON(user_data);
    177         gtk_file_chooser_set_action( GTK_FILE_CHOOSER( w ), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER );
    178     }
    179 }
    180 
    181161/***
    182162****
     
    222202    gtk_label_set_markup ( GTK_LABEL(ui->pieces_lb), buf );
    223203    g_free( pch );
     204}
     205
     206static void
     207file_chooser_shown_cb( GtkWidget *w, gpointer folder_toggle )
     208{
     209    const gboolean isFolder = gtk_toggle_button_get_active( folder_toggle );
     210    gtk_file_chooser_set_action (GTK_FILE_CHOOSER(w), isFolder
     211        ? GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
     212        : GTK_FILE_CHOOSER_ACTION_OPEN );
    224213}
    225214
     
    257246
    258247        g_snprintf( name, sizeof(name), "%s:", _("_File"));
    259         w = gtk_file_chooser_button_new( _("File or Directory to Add to the New Torrent"),
    260                                          GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER );
     248
     249        w = gtk_file_chooser_dialog_new (_("File or Directory to Add to the New Torrent"),
     250                                         NULL,
     251                                         GTK_FILE_CHOOSER_ACTION_OPEN,
     252                                         GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
     253                                         GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
     254                                         NULL);
     255        g_signal_connect( w, "map", G_CALLBACK(file_chooser_shown_cb), rb_dir );
     256        w = gtk_file_chooser_button_new_with_dialog( w );
    261257        g_signal_connect( w, "selection-changed", G_CALLBACK(file_selection_changed_cb), ui );
    262         g_signal_connect( rb_file, "toggled", G_CALLBACK(file_mode_toggled_cb), w );
    263         g_signal_connect( rb_dir, "toggled", G_CALLBACK(dir_mode_toggled_cb), w );
    264258        hig_workarea_add_row (t, &row, name, w, NULL);
    265259
Note: See TracChangeset for help on using the changeset viewer.