Changeset 3209 for trunk/gtk/tr_prefs.c


Ignore:
Timestamp:
Sep 28, 2007, 12:46:22 AM (15 years ago)
Author:
charles
Message:

now that the gtk+ prefs are unfucked, add an "ignore unencrypted peers" preference.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/tr_prefs.c

    r3206 r3209  
    88 * the Transmission project.
    99 *
    10  * $Id:$
     10 * $Id$
    1111 */
    1212
     
    4141    pref_flag_set_default   ( PREF_KEY_SYSTRAY, TRUE );
    4242    pref_flag_set_default   ( PREF_KEY_ASKQUIT, TRUE );
     43    pref_flag_set_default   ( PREF_KEY_ENCRYPTED_ONLY, FALSE );
    4344
    4445    pref_string_set_default ( PREF_KEY_ADDSTD, toractionname(TR_TOR_COPY) );
     
    130131new_path_chooser_button( const char * key, gpointer core )
    131132{
    132     GtkWidget * w = gtk_file_chooser_button_new( "asdf", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER );
     133    GtkWidget * w = gtk_file_chooser_button_new( NULL,
     134                                    GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER );
    133135    char * path = pref_string_get( key );
    134136    g_object_set_data_full( G_OBJECT(w), PREFS_KEY, g_strdup(key), g_free );
     
    155157new_action_combo( const char * key, gpointer core )
    156158{
     159    const char * s;
    157160    GtkTreeIter iter;
    158161    GtkCellRenderer * rend;
     
    161164
    162165    model = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_INT );
     166
     167    s = _("Use the torrent file where it is");
    163168    gtk_list_store_append( model, &iter );
    164     gtk_list_store_set( model, &iter, 1, TR_TOR_LEAVE, 0,
    165                         _("Use the torrent file where it is"), -1 );
     169    gtk_list_store_set( model, &iter, 1, TR_TOR_LEAVE, 0, s, -1 );
     170
     171    s = _("Keep a copy of the torrent file");
    166172    gtk_list_store_append( model, &iter );
    167     gtk_list_store_set( model, &iter, 1, TR_TOR_COPY, 0,
    168                         _("Keep a copy of the torrent file"), -1 );
     173    gtk_list_store_set( model, &iter, 1, TR_TOR_COPY, 0, s, -1 );
     174
     175    s = _("Keep a copy and remove the original");
    169176    gtk_list_store_append( model, &iter );
    170     gtk_list_store_set( model, &iter, 1, TR_TOR_MOVE, 0,
    171                         _("Keep a copy and remove the original"), -1 );
     177    gtk_list_store_set( model, &iter, 1, TR_TOR_MOVE, 0, s, -1 );
    172178
    173179    w = gtk_combo_box_new_with_model( GTK_TREE_MODEL(model) );
    174     gtk_combo_box_set_active( GTK_COMBO_BOX(w), pref_int_get(key) );
     180    gtk_combo_box_set_active( GTK_COMBO_BOX(w), tr_prefs_get_action(key) );
    175181    g_object_set_data_full( G_OBJECT(w), PREFS_KEY, g_strdup(key), g_free );
    176182    rend = gtk_cell_renderer_text_new( );
     
    186192{
    187193    int row = 0;
     194    const char * s;
    188195    GtkWidget * t;
    189196    GtkWidget * w;
    190197    GtkWidget * l;
    191     GtkWidget * dialog = gtk_dialog_new_with_buttons( _("Transmission: Preferences"), parent,
    192                                                       GTK_DIALOG_DESTROY_WITH_PARENT,
    193                                                       GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
    194                                                       NULL );
    195     gtk_window_set_role( GTK_WINDOW(dialog), "transmission-preferences-dialog" );
    196     g_signal_connect( dialog, "response", G_CALLBACK(response_cb), core );
     198    GtkWidget * d;
     199
     200    d = gtk_dialog_new_with_buttons( _("Transmission: Preferences"), parent,
     201                                     GTK_DIALOG_DESTROY_WITH_PARENT,
     202                                     GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
     203                                     NULL );
     204
     205    gtk_window_set_role( GTK_WINDOW(d), "transmission-preferences-dialog" );
     206    g_signal_connect( d, "response", G_CALLBACK(response_cb), core );
    197207
    198208    t = hig_workarea_create ();
     
    201211    hig_workarea_add_section_spacer (t, row, 4);
    202212
    203         w = new_check_button( _("_Limit Upload Speed"), PREF_KEY_UL_LIMIT_ENABLED, core );
     213        s = _("_Limit Upload Speed");
     214        w = new_check_button( s, PREF_KEY_UL_LIMIT_ENABLED, core );
    204215        hig_workarea_add_wide_control( t, &row, w );
    205216
    206217        w = new_spin_button( PREF_KEY_UL_LIMIT, core, 20, INT_MAX );
    207         l = hig_workarea_add_row( t, &row, _("Maximum _Upload Speed (KiB/s)"), w, NULL );
    208        
    209         w = new_check_button( _("Li_mit Download Speed"), PREF_KEY_DL_LIMIT_ENABLED, core );
     218        s = _("Maximum _Upload Speed (KiB/s)");
     219        l = hig_workarea_add_row( t, &row, s, w, NULL );
     220       
     221        s = _("Li_mit Download Speed");
     222        w = new_check_button( s, PREF_KEY_DL_LIMIT_ENABLED, core );
    210223        hig_workarea_add_wide_control( t, &row, w );
    211224
    212225        w = new_spin_button( PREF_KEY_DL_LIMIT, core, 1, INT_MAX );
    213         l = hig_workarea_add_row( t, &row, _("Maximum _Download Speed (KiB/s)"), w, NULL );
     226        s = _("Maximum _Download Speed (KiB/s)");
     227        l = hig_workarea_add_row( t, &row, s, w, NULL );
    214228
    215229    hig_workarea_add_section_divider( t, &row );
     
    217231    hig_workarea_add_section_spacer (t, row, 4);
    218232
    219         w = new_check_button( _("Al_ways prompt for download directory"), PREF_KEY_DIR_ASK, core );
     233        s = _("Al_ways prompt for download directory");
     234        w = new_check_button( s, PREF_KEY_DIR_ASK, core );
    220235        hig_workarea_add_wide_control( t, &row, w );
    221236
    222237        w = new_path_chooser_button( PREF_KEY_DIR_DEFAULT, core );
    223         l = hig_workarea_add_row( t, &row, _("Download Di_rectory"), w, NULL );
     238        s = _("Download Di_rectory");
     239        l = hig_workarea_add_row( t, &row, s, w, NULL );
    224240
    225241        w = new_action_combo( PREF_KEY_ADDSTD, core );
    226         l = hig_workarea_add_row( t, &row, _("For torrents added _normally:"), w, NULL );
     242        s = _("For torrents added _normally:");
     243        l = hig_workarea_add_row( t, &row, s, w, NULL );
    227244
    228245        w = new_action_combo( PREF_KEY_ADDIPC, core );
    229         l = hig_workarea_add_row( t, &row, _("For torrents added from _command-line:"), w, NULL );
     246        s = _("For torrents added from _command-line:");
     247        l = hig_workarea_add_row( t, &row, s, w, NULL );
    230248
    231249    hig_workarea_add_section_divider( t, &row );
     
    233251    hig_workarea_add_section_spacer (t, row, 2);
    234252       
    235         w = new_check_button( _("_Automatic Port Mapping via NAT-PMP or UPnP"), PREF_KEY_NAT, core );
     253        s = _("_Automatic Port Mapping via NAT-PMP or UPnP");
     254        w = new_check_button( s, PREF_KEY_NAT, core );
    236255        hig_workarea_add_wide_control( t, &row, w );
    237256
     
    243262    hig_workarea_add_section_spacer (t, row, 3);
    244263       
    245         w = new_check_button( _("Use Peer _Exchange if Possible"), PREF_KEY_PEX, core );
    246         hig_workarea_add_wide_control( t, &row, w );
    247        
    248         w = new_check_button( _("Display an Icon in the System _Tray"), PREF_KEY_SYSTRAY, core );
    249         hig_workarea_add_wide_control( t, &row, w );
    250        
    251         w = new_check_button( _("Confirm _quit"), PREF_KEY_ASKQUIT, core );
     264        s = _("Use Peer _Exchange if Possible");
     265        w = new_check_button( s, PREF_KEY_PEX, core );
     266        hig_workarea_add_wide_control( t, &row, w );
     267       
     268        s = _("_Ignore Unencrypted Peers");
     269        w = new_check_button( s, PREF_KEY_ENCRYPTED_ONLY, core );
     270        hig_workarea_add_wide_control( t, &row, w );
     271       
     272        s = _("Display an Icon in the System _Tray");
     273        w = new_check_button( s, PREF_KEY_SYSTRAY, core );
     274        hig_workarea_add_wide_control( t, &row, w );
     275       
     276        s = _("Confirm _quit");
     277        w = new_check_button( s, PREF_KEY_ASKQUIT, core );
    252278        hig_workarea_add_wide_control( t, &row, w );
    253279
    254280    hig_workarea_finish (t, &row);
    255     gtk_box_pack_start_defaults( GTK_BOX(GTK_DIALOG(dialog)->vbox), t );
    256     gtk_widget_show_all( GTK_DIALOG(dialog)->vbox );
    257     return dialog;
    258 }
     281    gtk_box_pack_start_defaults( GTK_BOX(GTK_DIALOG(d)->vbox), t );
     282    gtk_widget_show_all( GTK_DIALOG(d)->vbox );
     283    return d;
     284}
Note: See TracChangeset for help on using the changeset viewer.