Changeset 5646


Ignore:
Timestamp:
Apr 19, 2008, 12:41:32 AM (15 years ago)
Author:
charles
Message:

gtk/cli/daemon/remote/proxy: add command-line argument --config-dir / -g to override the default config dir

Location:
trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/cli/transmissioncli.1

    r5409 r5646  
    5757The options are as follows:
    5858.Bl -tag -width Ds
     59.It Fl g, Fl -config-dir Ar directory
     60Where to look for configuration files.
    5961.It Fl c, Fl -create-from Ar source-file
    6062Create torrent from the specified source file.
  • trunk/cli/transmissioncli.c

    r5588 r5646  
    4444
    4545const char * USAGE =
    46 "Usage: %s [-car[-m]] [-dfinpsuv] [-h] file.torrent [output-dir]\n\n"
     46"Usage: %s [-car[-m]] [-dfginpsuv] [-h] file.torrent [output-dir]\n\n"
    4747"Options:\n"
     48"  -h, --help                Print this help and exit\n"
     49"  -i, --info                Print metainfo and exit\n"
     50"  -s, --scrape              Print counts of seeders/leechers and exit\n"
     51"  -V, --version             Print the version number and exit\n"
    4852"  -c, --create-from <file>  Create torrent from the specified source file.\n"
    49 "  -a, --announce <url> Used in conjunction with -c.\n"
    50 "  -r, --private        Used in conjunction with -c.\n"
    51 "  -m, --comment <text> Adds an optional comment when creating a torrent.\n"
    52 "  -d, --download <int> Maximum download rate (-1 = no limit, default = -1)\n"
    53 "  -f, --finish <shell script> Command you wish to run on completion\n"
    54 "  -h, --help           Print this help and exit\n"
    55 "  -i, --info           Print metainfo and exit\n"
    56 "  -n  --nat-traversal  Attempt NAT traversal using NAT-PMP or UPnP IGD\n"
    57 "  -p, --port <int>     Port we should listen on (default = %d)\n"
    58 "  -s, --scrape         Print counts of seeders/leechers and exit\n"
    59 "  -u, --upload <int>   Maximum upload rate (-1 = no limit, default = 20)\n"
    60 "  -v, --verbose <int>  Verbose level (0 to 2, default = 0)\n"
    61 "  -V, --version        Print the version number and exit\n"
    62 "  -y, --recheck        Force a recheck of the torrent data\n";
     53"  -a, --announce <url>      Used in conjunction with -c.\n"
     54"  -g, --config-dir <path>   Where to look for configuration files\n"
     55"  -r, --private             Used in conjunction with -c.\n"
     56"  -m, --comment <text>      Adds an optional comment when creating a torrent.\n"
     57"  -d, --download <int>      Max download rate (-1 = no limit, default = -1)\n"
     58"  -f, --finish <script>     Command you wish to run on completion\n"
     59"  -n  --nat-traversal       Attempt NAT traversal using NAT-PMP or UPnP IGD\n"
     60"  -p, --port <int>          Port we should listen on (default = %d)\n"
     61"  -u, --upload <int>        Maximum upload rate (-1 = no limit, default = 20)\n"
     62"  -v, --verbose <int>       Verbose level (0 to 2, default = 0)\n"
     63"  -y, --recheck             Force a recheck of the torrent data\n";
    6364
    6465static int           showHelp      = 0;
     
    8081static char          * finishCall   = NULL;
    8182static char          * announce     = NULL;
     83static char          * configdir    = NULL;
    8284static char          * sourceFile   = NULL;
    8385static char          * comment      = NULL;
     
    145147        bindPort = -1;
    146148
     149    if( configdir == NULL )
     150        configdir = strdup( tr_getDefaultConfigDir( ) );
     151
    147152    /* Initialize libtransmission */
    148     h = tr_initFull( TR_DEFAULT_CONFIG_DIR,
     153    h = tr_initFull( configdir,
    149154                     "cli",                         /* tag */
    150155                     1,                             /* pex enabled */
     
    378383    for( ;; )
    379384    {
    380         static struct option long_options[] =
    381           { { "help",     no_argument,          NULL, 'h' },
    382             { "info",     no_argument,          NULL, 'i' },
    383             { "scrape",   no_argument,          NULL, 's' },
    384             { "private",  no_argument,          NULL, 'r' },
    385             { "version",  no_argument,          NULL, 'V' },
    386             { "verbose",  required_argument,    NULL, 'v' },
    387             { "port",     required_argument,    NULL, 'p' },
    388             { "upload",   required_argument,    NULL, 'u' },
    389             { "download", required_argument,    NULL, 'd' },
    390             { "finish",   required_argument,    NULL, 'f' },
    391             { "create-from", required_argument, NULL, 'c' },
    392             { "comment",  required_argument,    NULL, 'm' },
    393             { "announce", required_argument,    NULL, 'a' },
    394             { "nat-traversal", no_argument,     NULL, 'n' },
    395             { "recheck",  no_argument,          NULL, 'y' },
    396             { "output-dir", required_argument,  NULL, 'o' },
     385        static const struct option long_options[] = {
     386            { "announce",      required_argument, NULL, 'a' },
     387            { "create-from",   required_argument, NULL, 'c' },
     388            { "download",      required_argument, NULL, 'd' },
     389            { "finish",        required_argument, NULL, 'f' },
     390            { "config-dir",    required_argument, NULL, 'g' },
     391            { "help",          no_argument,       NULL, 'h' },
     392            { "info",          no_argument,       NULL, 'i' },
     393            { "comment",       required_argument, NULL, 'm' },
     394            { "nat-traversal", no_argument,       NULL, 'n' },
     395            { "output-dir",    required_argument, NULL, 'o' },
     396            { "port",          required_argument, NULL, 'p' },
     397            { "private",       no_argument,       NULL, 'r' },
     398            { "scrape",        no_argument,       NULL, 's' },
     399            { "upload",        required_argument, NULL, 'u' },
     400            { "verbose",       required_argument, NULL, 'v' },
     401            { "version",       no_argument,       NULL, 'V' },
     402            { "recheck",       no_argument,       NULL, 'y' },
    397403            { 0, 0, 0, 0} };
    398 
    399         int c, optind = 0;
    400         c = getopt_long( argc, argv, "hisrVv:p:u:d:f:c:m:a:no:y",
    401                          long_options, &optind );
     404        int optind = 0;
     405        int c = getopt_long( argc, argv,
     406                             "a:c:d:f:g:him:no:p:rsu:v:Vy",
     407                             long_options, &optind );
    402408        if( c < 0 )
    403409        {
     
    406412        switch( c )
    407413        {
    408             case 'h':
    409                 showHelp = 1;
    410                 break;
    411             case 'i':
    412                 showInfo = 1;
    413                 break;
    414             case 's':
    415                 showScrape = 1;
    416                 break;
    417             case 'r':
    418                 isPrivate = 1;
    419                 break;
    420             case 'v':
    421                 verboseLevel = atoi( optarg );
    422                 break;
    423             case 'V':
    424                 showVersion = 1;
    425                 break;
    426             case 'p':
    427                 bindPort = atoi( optarg );
    428                 break;
    429             case 'u':
    430                 uploadLimit = atoi( optarg );
    431                 break;
    432             case 'd':
    433                 downloadLimit = atoi( optarg );
    434                 break;
    435             case 'f':
    436                 finishCall = optarg;
    437                 break;
    438             case 'c':
    439                 sourceFile = optarg;
    440                 break;
    441             case 'm':
    442                 comment = optarg;
    443                 break;
    444             case 'a':
    445                 announce = optarg;
    446                 break;
    447             case 'n':
    448                 natTraversal = 1;
    449                 break;
    450             case 'y':
    451                 recheckData = 1;
    452                 break;
    453             case 'o':
    454                 savePath = optarg;
    455             default:
    456                 return 1;
     414            case 'a': announce = optarg; break;
     415            case 'c': sourceFile = optarg; break;
     416            case 'd': downloadLimit = atoi( optarg ); break;
     417            case 'f': finishCall = optarg; break;
     418            case 'g': configdir = strdup( optarg ); break;
     419            case 'h': showHelp = 1; break;
     420            case 'i': showInfo = 1; break;
     421            case 'm': comment = optarg; break;
     422            case 'n': natTraversal = 1; break;
     423            case 'o': savePath = optarg;
     424            case 'p': bindPort = atoi( optarg ); break;
     425            case 'r': isPrivate = 1; break;
     426            case 's': showScrape = 1; break;
     427            case 'u': uploadLimit = atoi( optarg ); break;
     428            case 'v': verboseLevel = atoi( optarg ); break;
     429            case 'V': showVersion = 1; break;
     430            case 'y': recheckData = 1; break;
     431            default: return 1;
    457432        }
    458433    }
  • trunk/daemon/client.c

    r5511 r5646  
    137137    struct con       * con;
    138138
    139     assert( NULL != gl_base );
     139    assert( gl_base );
     140    assert( path );
    140141    assert( 0 > gl_proxy );
    141     assert( NULL != path );
    142142
    143143    gl_proxy = 0;
  • trunk/daemon/daemon.c

    r5167 r5646  
    5151
    5252static void usage       ( const char *, ... );
    53 static void readargs    ( int, char **, int *, int *, char **, char ** );
    54 static int  trylocksock ( const char * );
     53static void readargs    ( int, char **, int *, int *, char **, char **, char ** );
     54static int  trylocksock ( const char * configdir, const char * sockpath );
    5555static int  getsock     ( const char * );
    5656static void exitcleanup ( void );
     
    6969    struct event_base * evbase;
    7070    int                 nofork, debug, sockfd;
    71     char              * sockpath, * pidfile;
     71    char              * configdir, * sockpath, * pidfile;
    7272
    7373    setmyname( argv[0] );
    74     readargs( argc, argv, &nofork, &debug, &sockpath, &pidfile );
    75 
    76     if( !nofork )
    77     {
    78         if( 0 > daemon( 1, 0 ) )
    79         {
     74    readargs( argc, argv, &nofork, &debug, &configdir, &sockpath, &pidfile );
     75
     76    if( !nofork ) {
     77        if( 0 > daemon( 1, 0 ) ) {
    8078            errnomsg( "failed to daemonize" );
    8179            exit( 1 );
     
    8482    }
    8583
     84    if( configdir == NULL )
     85        configdir = (char*) tr_getDefaultConfigDir( );
     86
    8687    atexit( exitcleanup );
    87     sockfd = trylocksock( sockpath );
     88    sockfd = trylocksock( configdir, sockpath );
    8889    if( 0 > sockfd )
    8990    {
     
    9798    evbase = event_init();
    9899    setupsigs( evbase );
    99     torrent_init( evbase );
     100    torrent_init( configdir, evbase );
    100101    server_init( evbase );
    101102    server_debug( debug );
     
    129130  "  -d --debug                Print data send and received, implies -f\n"
    130131  "  -f --foreground           Run in the foreground and log to stderr\n"
     132  "  -g --config-dir <path>    Where to look for configuration files\n"
    131133  "  -h --help                 Display this message and exit\n"
    132134  "  -p --pidfile <path>       Save the process id in a file at <path>\n"
     
    139141
    140142void
    141 readargs( int argc, char ** argv, int * nofork, int * debug, char ** sock,
    142           char ** pidfile )
    143 {
    144     char optstr[] = "dfhp:s:";
     143readargs( int argc, char ** argv, int * nofork, int * debug,
     144          char ** configdir, char ** sock, char ** pidfile )
     145{
     146    char optstr[] = "dfg:hp:s:";
    145147    struct option longopts[] =
    146148    {
    147149        { "debug",              no_argument,       NULL, 'd' },
    148150        { "foreground",         no_argument,       NULL, 'f' },
     151        { "config-dir",         required_argument, NULL, 'g' },
    149152        { "help",               no_argument,       NULL, 'h' },
    150153        { "pidfile",            required_argument, NULL, 'p' },
     
    158161    *sock      = NULL;
    159162    *pidfile   = NULL;
    160 
    161     while( 0 <= ( opt = getopt_long( argc, argv, optstr, longopts, NULL ) ) )
    162     {
    163         switch( opt )
    164         {
    165             case 'd':
    166                 *debug = 1;
    167                 /* FALLTHROUGH */
    168             case 'f':
    169                 *nofork = 1;
    170                 break;
    171             case 'p':
    172                 *pidfile = optarg;
    173                 break;
    174             case 's':
    175                 *sock   = optarg;
    176                 break;
    177             default:
    178                 usage( NULL );
    179                 break;
     163    *configdir = NULL;
     164
     165    while( 0 <= ( opt = getopt_long( argc, argv, optstr, longopts, NULL ) ) ) {
     166        switch( opt ) {
     167            case 'd': *debug = 1; /* FALLTHROUGH */
     168            case 'f': *nofork = 1; break;
     169            case 'g': *configdir = strdup( optarg ); break;
     170            case 'p': *pidfile = optarg; break;
     171            case 's': *sock   = optarg; break;
     172            default: usage( NULL ); break;
    180173        }
    181174    }
     
    205198
    206199int
    207 trylocksock( const char * sockpath )
    208 {
     200trylocksock( const char * configdir, const char * sockpath )
     201{
     202    int  fd;
    209203    char path[MAXPATHLEN];
    210     int  fd;
    211 
    212     confpath( path, sizeof path, NULL, CONF_PATH_TYPE_DAEMON );
     204
     205    confpath( path, sizeof path, configdir, NULL, CONF_PATH_TYPE_DAEMON );
    213206    if( 0 > mkdir( path, 0777 ) && EEXIST != errno )
    214207    {
     
    217210    }
    218211
    219     confpath( path, sizeof path, CONF_FILE_LOCK, 0 );
     212    confpath( path, sizeof path, configdir, CONF_FILE_LOCK, 0 );
    220213    if( !getlock( path ) )
    221214        return -1;
    222215    strlcpy( gl_lockpath, path, sizeof gl_lockpath );
    223216
    224     if( NULL == sockpath )
    225     {
    226         confpath( path, sizeof path, CONF_FILE_SOCKET, 0 );
     217    if( !sockpath )
     218    {
     219        confpath( path, sizeof path, configdir, CONF_FILE_SOCKET, 0 );
    227220        sockpath = path;
    228221    }
  • trunk/daemon/misc.c

    r5517 r5646  
    7878
    7979void
    80 confpath( char * buf, size_t len, const char * file, enum confpathtype type )
    81 {
    82     strlcpy( buf, tr_getDefaultConfigDir(), len );
     80confpath( char               * buf,
     81          size_t               len,
     82          const char         * configDir,
     83          const char         * file,
     84          enum confpathtype    type )
     85{
     86    strlcpy( buf, configDir, len );
    8387
    8488    switch( type )
  • trunk/daemon/misc.h

    r5151 r5646  
    137137void         setmyname ( const char * );
    138138const char * getmyname ( void );
    139 void         confpath  ( char *, size_t, const char *, enum confpathtype );
     139void         confpath  ( char *, size_t, const char *, const char *, enum confpathtype );
    140140void         absolutify( char *, size_t, const char * );
    141141int          writefile ( const char *, uint8_t *, ssize_t );
  • trunk/daemon/proxy.c

    r4390 r5646  
    4343
    4444static void              usage    ( const char *, ... );
    45 static enum confpathtype readargs ( int, char **, char ** );
    46 static int               makesock ( enum confpathtype, const char * );
     45static enum confpathtype readargs ( int, char **, char **, char ** );
     46static int               makesock ( enum confpathtype, const char *, const char * );
    4747static void              inread   ( struct bufferevent *, void * );
    4848static void              noop     ( struct bufferevent *, void * );
     
    6363    struct event_base  * base;
    6464    enum confpathtype    type;
     65    char               * configdir;
    6566    char               * sockpath;
    6667    int                  sockfd;
    6768
    6869    setmyname( argv[0] );
    69     type = readargs( argc, argv, &sockpath );
     70    type = readargs( argc, argv, &configdir, &sockpath );
     71    if( configdir == NULL )
     72        configdir = strdup( tr_getDefaultConfigDir( ) );
     73
    7074    base = event_init();
    7175
    72     sockfd = makesock( type, sockpath );
     76    sockfd = makesock( type, configdir, sockpath );
    7377    if( 0 > sockfd )
    7478    {
     
    133137  "\n"
    134138  "  -h --help                 Display this message and exit\n"
     139  "  -g --config-dir <path>    Where to look for configuration files\n"
    135140  "  -t --type daemon          Use the daemon frontend, transmission-daemon\n"
    136141  "  -t --type gtk             Use the GTK+ frontend, transmission\n"
     
    141146
    142147enum confpathtype
    143 readargs( int argc, char ** argv, char ** sockpath )
    144 {
    145     char optstr[] = "ht:";
     148readargs( int argc, char ** argv, char ** configdir, char ** sockpath )
     149{
     150    char optstr[] = "g:ht:";
    146151    struct option longopts[] =
    147152    {
     153        { "config-dir",         required_argument, NULL, 'g' },
    148154        { "help",               no_argument,       NULL, 'h' },
    149155        { "type",               required_argument, NULL, 't' },
     
    153159    int opt;
    154160
    155     type      = CONF_PATH_TYPE_DAEMON;
    156     *sockpath = NULL;
     161    type       = CONF_PATH_TYPE_DAEMON;
     162    *configdir = NULL;
     163    *sockpath  = NULL;
    157164
    158165    while( 0 <= ( opt = getopt_long( argc, argv, optstr, longopts, NULL ) ) )
     
    160167        switch( opt )
    161168        {
     169            case 'g':
     170                *configdir = strdup( optarg );
     171                break;
     172
    162173            case 't':
    163174                if( 0 == strcasecmp( "daemon", optarg ) )
     
    194205
    195206int
    196 makesock( enum confpathtype type, const char * path )
     207makesock( enum confpathtype type,
     208          const char * configdir,
     209          const char * sockpath )
    197210{
    198211    struct sockaddr_un sa;
     
    201214    memset( &sa, 0, sizeof sa );
    202215    sa.sun_family = AF_LOCAL;
    203     if( NULL == path )
    204     {
    205         confpath( sa.sun_path, sizeof sa.sun_path, CONF_FILE_SOCKET, type );
     216    if( !sockpath )
     217    {
     218        confpath( sa.sun_path, sizeof sa.sun_path, configdir, CONF_FILE_SOCKET, type );
    206219    }
    207220    else
    208221    {
    209         strlcpy( sa.sun_path, path, sizeof sa.sun_path );
     222        strlcpy( sa.sun_path, sockpath, sizeof sa.sun_path );
    210223    }
    211224
  • trunk/daemon/remote.c

    r5514 r5646  
    7575    int               pex;
    7676    const char *      crypto;
     77    const char *      configdir;
    7778};
    7879
     
    145146    struct event_base * evbase;
    146147    struct opts         o;
    147     char                sockpath[MAXPATHLEN];
    148148
    149149    setmyname( argv[0] );
     150
    150151    if( 0 > readargs( argc, argv, &o ) )
    151     {
    152152        exit( 1 );
    153     }
     153
     154    if( o.configdir == NULL )
     155        o.configdir = strdup( tr_getDefaultConfigDir( ) );
    154156
    155157    signal( SIGPIPE, SIG_IGN );
     
    164166    else
    165167    {
    166         if( NULL == o.sock )
    167         {
    168             confpath( sockpath, sizeof sockpath, CONF_FILE_SOCKET, o.type );
     168        if( o.sock )
     169            client_new_sock( o.sock );
     170        else {
     171            char sockpath[MAXPATHLEN];
     172            confpath( sockpath, sizeof sockpath, o.configdir, CONF_FILE_SOCKET, o.type );
    169173            client_new_sock( sockpath );
    170         }
    171         else
    172         {
    173             client_new_sock( o.sock );
    174174        }
    175175    }
     
    245245  "  -E --disable-pex          Disable peer exchange\n"
    246246  "  -f --folder <path>        Folder to set for new torrents\n"
     247  "  -g --config-dir <path>    Where to look for configuration files\n"
    247248  "  -h --help                 Display this message and exit\n"
    248249  "  -i --info                 List all torrents with info hashes\n"
     
    272273readargs( int argc, char ** argv, struct opts * opts )
    273274{
    274     char optstr[] = "a:c:d:DeEf:hilmMp:qr:s:S:t:u:Uxv:";
     275    char optstr[] = "a:c:d:DeEf:g:hilmMp:qr:s:S:t:u:Uxv:";
    275276    struct option longopts[] =
    276277    {
     
    282283        { "disable-pex",        no_argument,       NULL, 'E' },
    283284        { "folder",             required_argument, NULL, 'f' },
     285        { "config-dir",         required_argument, NULL, 'g' },
    284286        { "help",               no_argument,       NULL, 'h' },
    285287        { "info",               no_argument,       NULL, 'i' },
     
    307309    opts->map = -1;
    308310    opts->pex = -1;
     311    opts->configdir = NULL;
    309312    SLIST_INIT( &opts->start );
    310313    SLIST_INIT( &opts->stop );
     
    347350            case 'f':
    348351                absolutify( opts->dir, sizeof opts->dir, optarg );
     352                break;
     353            case 'g':
     354                opts->configdir = strdup( optarg );
    349355                break;
    350356            case 'i':
  • trunk/daemon/torrents.c

    r5643 r5646  
    105105
    106106void
    107 torrent_init( struct event_base * base )
     107torrent_init( const char * configdir, struct event_base * base )
    108108{
    109109    assert( NULL == gl_handle && NULL == gl_base );
    110110
    111111    gl_base   = base;
    112     gl_handle = tr_init( tr_getDefaultConfigDir(), "daemon" );
    113 
    114     confpath( gl_state, sizeof gl_state, CONF_FILE_STATE, 0 );
     112    gl_handle = tr_init( configdir, "daemon" );
     113
     114    confpath( gl_state, sizeof gl_state, configdir, CONF_FILE_STATE, 0 );
    115115    strlcpy( gl_newstate, gl_state, sizeof gl_state );
    116116    strlcat( gl_newstate, ".new", sizeof gl_state );
  • trunk/daemon/torrents.h

    r5579 r5646  
    3232struct event_base;
    3333
    34 void         torrent_init                ( struct event_base * );
     34void         torrent_init                ( const char * configDir, struct event_base * );
    3535int          torrent_add_file            ( const char *, const char *, int );
    3636int          torrent_add_data            ( uint8_t *, size_t, const char *, int );
  • trunk/daemon/transmission-daemon.1

    r4758 r5646  
    5656Save the daemon's process ID in
    5757.Ar pid-file .
     58.It Fl g, Fl -config-dir Ar directory
     59Where to look for configuration files.
    5860.It Fl s Fl -socket Ar socket-file
    5961Create the unix-domain socket file at
  • trunk/daemon/transmission-proxy.1

    r4758 r5646  
    4242or
    4343.Xr transmission 1 .
     44.It Fl g, Fl -config-dir Ar directory
     45Where to look for configuration files.
    4446.It Fl h Fl -help
    4547Print command-line option descriptions.
  • trunk/daemon/transmission-remote.1

    r5141 r5646  
    117117.Ar directory
    118118as the default location for newly added torrents to download files to.
     119.It Fl g, Fl -config-dir Ar directory
     120Where to look for configuration files.
    119121.It Fl h Fl -help
    120122Print command-line option descriptions.
  • trunk/gtk/main.c

    r5637 r5646  
    276276    gboolean startminimized = FALSE;
    277277    char * domain = "transmission";
    278     const char * configDir = tr_getDefaultConfigDir( );
     278    char * configDir = NULL;
    279279
    280280    GOptionEntry entries[] = {
     
    287287          _( "Start minimized in system tray"), NULL },
    288288#endif
     289        { "config-dir", 'g', 0, G_OPTION_ARG_FILENAME, &configDir,
     290          _( "Where to look for configuration files" ), NULL },
    289291        { NULL, 0, 0, 0, NULL, NULL, NULL }
    290292    };
     
    308310        return 0;
    309311    }
     312    if( !configDir )
     313        configDir = (char*) tr_getDefaultConfigDir( );
    310314
    311315    tr_notify_init( );
     
    326330        ( didlock || cf_lock( &err ) ) )
    327331    {
    328         cbdata->core = tr_core_new( );
     332        tr_handle * h = tr_initFull( configDir,
     333                                     "gtk",
     334                                     pref_flag_get( PREF_KEY_PEX ),
     335                                     pref_flag_get( PREF_KEY_NAT ),
     336                                     pref_int_get( PREF_KEY_PORT ),
     337                                     pref_flag_get( PREF_KEY_ENCRYPTED_ONLY )
     338                                         ? TR_ENCRYPTION_REQUIRED
     339                                         : TR_ENCRYPTION_PREFERRED,
     340                                     pref_flag_get( PREF_KEY_UL_LIMIT_ENABLED ),
     341                                     pref_int_get( PREF_KEY_UL_LIMIT ),
     342                                     pref_flag_get( PREF_KEY_DL_LIMIT_ENABLED ),
     343                                     pref_int_get( PREF_KEY_DL_LIMIT ),
     344                                     pref_int_get( PREF_KEY_MAX_PEERS_GLOBAL ),
     345                                     pref_int_get( PREF_KEY_MSGLEVEL ),
     346                                     TRUE, /* message queueing */
     347                                     pref_flag_get( PREF_KEY_BLOCKLIST_ENABLED ),
     348                                     pref_int_get( PREF_KEY_PEER_SOCKET_TOS ) );
     349        cbdata->core = tr_core_new( h );
    329350
    330351        /* create main window now to be a parent to any error dialogs */
  • trunk/gtk/tr-core.c

    r5637 r5646  
    458458tr_core_init( GTypeInstance * instance, gpointer g_class UNUSED )
    459459{
    460     tr_handle * h;
    461460    TrCore * self = (TrCore *) instance;
    462461    GtkListStore * store;
     
    479478                                                  struct TrCorePrivate );
    480479
    481 
    482     h = tr_initFull( tr_getDefaultConfigDir( ),
    483                      "gtk",
    484                      pref_flag_get( PREF_KEY_PEX ),
    485                      pref_flag_get( PREF_KEY_NAT ),
    486                      pref_int_get( PREF_KEY_PORT ),
    487                      pref_flag_get( PREF_KEY_ENCRYPTED_ONLY )
    488                          ? TR_ENCRYPTION_REQUIRED
    489                          : TR_ENCRYPTION_PREFERRED,
    490                      pref_flag_get( PREF_KEY_UL_LIMIT_ENABLED ),
    491                      pref_int_get( PREF_KEY_UL_LIMIT ),
    492                      pref_flag_get( PREF_KEY_DL_LIMIT_ENABLED ),
    493                      pref_int_get( PREF_KEY_DL_LIMIT ),
    494                      pref_int_get( PREF_KEY_MAX_PEERS_GLOBAL ),
    495                      pref_int_get( PREF_KEY_MSGLEVEL ),
    496                      TRUE, /* message queueing */
    497                      pref_flag_get( PREF_KEY_BLOCKLIST_ENABLED ),
    498                      pref_int_get( PREF_KEY_PEER_SOCKET_TOS ) );
    499 
    500480    /* create the model used to store torrent data */
    501481    g_assert( ALEN( types ) == MC_ROW_COUNT );
     
    503483
    504484    p->model    = GTK_TREE_MODEL( store );
    505     p->handle   = h;
    506485    p->nextid   = 1;
    507486}
     
    538517
    539518TrCore *
    540 tr_core_new( void )
     519tr_core_new( tr_handle * h )
    541520{
    542521    TrCore * core = TR_CORE( g_object_new( TR_CORE_TYPE, NULL ) );
     522    core->priv->handle   = h;
    543523
    544524    /* init from prefs & listen to pref changes */
  • trunk/gtk/tr-core.h

    r5637 r5646  
    9090GType tr_core_get_type( void );
    9191
    92 TrCore * tr_core_new( void );
     92TrCore * tr_core_new( tr_handle * );
    9393
    9494void tr_core_close( TrCore* );
  • trunk/gtk/transmission.1

    r5311 r5646  
    5454.It Fl m Fl -minimized
    5555Start minimized in system tray
     56.It Fl g, Fl -config-dir Ar directory
     57Where to look for configuration files
    5658.El
    5759.Pp
Note: See TracChangeset for help on using the changeset viewer.