Changeset 1615 for trunk


Ignore:
Timestamp:
Mar 31, 2007, 7:19:27 PM (15 years ago)
Author:
joshe
Message:

Add preference option to disable PEX.

Location:
trunk/gtk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/main.c

    r1585 r1615  
    172172static void
    173173prefschanged( GtkWidget * widget, int id, gpointer data );
     174static void
     175setpex( tr_torrent_t * tor, void * arg );
    174176static gboolean
    175177updatemodel(gpointer gdata);
     
    735737        PREF_ID_NAT,
    736738        PREF_ID_ICON,
     739        PREF_ID_PEX,
    737740    };
    738741    int ii;
     
    750753    tr_handle_t   * tr;
    751754    int             num;
     755    gboolean        boolval;
    752756
    753757    cbdata = data;
     
    796800            break;
    797801
     802        case PREF_ID_PEX:
     803            boolval = tr_prefs_get_bool_with_default( id );
     804            tr_torrentIterate( tr, setpex, &boolval );
     805            break;
     806
    798807        case PREF_ID_DIR:
    799808        case PREF_ID_ASKDIR:
     
    804813            break;
    805814    }
     815}
     816
     817void
     818setpex( tr_torrent_t * tor, void * arg )
     819{
     820    gboolean * val;
     821
     822    val = arg;
     823    tr_torrentDisablePex( tor, !(*val) );
    806824}
    807825
  • trunk/gtk/tr_prefs.c

    r1587 r1615  
    119119      N_("Attempt to bypass NAT or firewall to allow incoming peer connections") },
    120120
     121    /* PREF_ID_PEX */
     122    { "use-peer-exchange",      G_TYPE_BOOLEAN, PR_ENABLED,  NULL,
     123      N_("Use peer _exchange if possible"),
     124      N_("Perform Azureus or \xc2\xb5Torrent compatible peer exchange with any peers which support it") },
     125
    121126    /* PREF_ID_ICON */
    122127    { "use-tray-icon",          G_TYPE_BOOLEAN,
     
    178183    { FALSE, -1, FALSE }, { FALSE, -1, FALSE },
    179184    /* PREF_ID_NAT */
     185    { TRUE,  -1,                FALSE },
     186    /* PREF_ID_PEX */
    180187    { TRUE,  -1,                FALSE },
    181188    /* PREF_ID_ICON */
  • trunk/gtk/tr_prefs.h

    r1504 r1615  
    8484    PREF_ID_PORT,
    8585    PREF_ID_NAT,
     86    PREF_ID_PEX,
    8687    PREF_ID_ICON,
    8788    PREF_ID_ADDSTD,
  • trunk/gtk/tr_torrent.c

    r1576 r1615  
    3535
    3636#include "tr_backend.h"
     37#include "tr_prefs.h"
    3738#include "tr_torrent.h"
    3839#include "util.h"
     
    264265  tr_handle_t *back;
    265266  int errcode, trflags;
     267  gboolean boolval;
    266268
    267269  TR_IS_BACKEND(backend);
     
    295297    return NULL;
    296298  }
     299
     300  /* I should probably add a property for this but I've had enough
     301     with adding useless gtk glue to this program */
     302  boolval = tr_prefs_get_bool_with_default( PREF_ID_PEX );
     303  tr_torrentDisablePex( handle, !boolval );
    297304
    298305  ret = g_object_new(TR_TORRENT_TYPE, "torrent-handle", handle,
Note: See TracChangeset for help on using the changeset viewer.