Changeset 1355


Ignore:
Timestamp:
Jan 14, 2007, 11:35:25 AM (15 years ago)
Author:
titer
Message:

Show error string in the UI

Location:
branches/io
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/io/cli/transmissioncli.c

    r1354 r1355  
    228228        fprintf( stderr, "\r%s", string );
    229229
    230         if( s->error & TR_ETRACKER )
    231         {
    232             fprintf( stderr, "\n%s\n", s->trackerError );
     230        if( s->error )
     231        {
     232            fprintf( stderr, "\n%s\n", s->errorString );
    233233        }
    234234        else if( verboseLevel > 0 )
  • branches/io/gtk/main.c

    r1352 r1355  
    427427makewind_list(struct cbdata *data, GObject **sizehack) {
    428428  GType types[] = {
    429     /* info->name, info->totalSize, status,     error,      trackerError, */
     429    /* info->name, info->totalSize, status,     error,      errorString, */
    430430    G_TYPE_STRING, G_TYPE_UINT64,   G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING,
    431431    /* progress,  rateDownload, rateUpload,   eta,        peersTotal, */
     
    808808      gtk_list_store_set(GTK_LIST_STORE(data->model), &iter, MC_NAME, in->name,
    809809        MC_SIZE, in->totalSize, MC_STAT, st->status, MC_ERR, st->error,
    810         MC_TERR, st->trackerError, MC_PROG, st->progress,
     810        MC_TERR, st->errorString, MC_PROG, st->progress,
    811811        MC_DRATE, st->rateDownload, MC_URATE, st->rateUpload, MC_ETA, st->eta,
    812812        MC_PEERS, st->peersTotal, MC_UPEERS, st->peersUploading,
  • branches/io/libtransmission/internal.h

    r1354 r1355  
    151151    int               status;
    152152    int               error;
    153     char              trackerError[128];
     153    char              errorString[128];
    154154    int               finished;
    155155
  • branches/io/libtransmission/tracker.c

    r1354 r1355  
    732732    {
    733733        tr_err( "Tracker: Error - %s", bePeers->val.s.s );
    734         tor->error |= TR_ETRACKER;
    735         snprintf( tor->trackerError, sizeof( tor->trackerError ),
     734        tor->error = TR_ERROR_TC_ERROR;
     735        snprintf( tor->errorString, sizeof( tor->errorString ),
    736736                  "%s", bePeers->val.s.s );
    737737        tc->lastError = 1;
     
    743743    {
    744744        tr_err( "Tracker: Warning - %s", bePeers->val.s.s );
    745         snprintf( tor->trackerError, sizeof( tor->trackerError ),
     745        tor->error = TR_ERROR_TC_WARNING;
     746        snprintf( tor->errorString, sizeof( tor->errorString ),
    746747                  "%s", bePeers->val.s.s );
    747748    }
    748     else
    749     {
    750         tor->trackerError[0] = '\0';
    751     }
    752 
    753     tor->error &= ~TR_ETRACKER;
     749    else if( tor->error & TR_ERROR_TC_MASK )
     750    {
     751        tor->error = TR_OK;
     752    }
     753
    754754    tc->lastError = 0;
    755755    tc->allUnreachIfError = 0;
  • branches/io/libtransmission/transmission.c

    r1354 r1355  
    380380
    381381    tor->status  = TR_STATUS_CHECK;
     382    tor->error   = TR_OK;
    382383    tor->tracker = tr_trackerInit( tor );
    383384
     
    490491    s->status = tor->status;
    491492    s->error  = tor->error;
    492     memcpy( s->trackerError, tor->trackerError,
    493             sizeof( s->trackerError ) );
     493    memcpy( s->errorString, tor->errorString,
     494            sizeof( s->errorString ) );
    494495
    495496    tc = tor->tracker;
     
    798799            tr_err( "Fatal error, stopping download (%d)", ret );
    799800            torrentStop( tor );
     801            tor->error = ret;
     802            snprintf( tor->errorString, sizeof( tor->errorString ),
     803                      "%s", tr_errorString( ret ) );
    800804        }
    801805
  • branches/io/libtransmission/transmission.h

    r1354 r1355  
    6464#define TR_ERROR_IO_PERMISSIONS 0x80000002
    6565#define TR_ERROR_IO_OTHER       0x80000008
     66/* Misc */
     67#define TR_ERROR_TC_MASK        0x000000F0
     68#define TR_ERROR_TC_ERROR       0x80000010
     69#define TR_ERROR_TC_WARNING     0x80000020
    6670
    6771/***********************************************************************
     
    383387    int                 status;
    384388
    385 #define TR_ETRACKER 1
    386 #define TR_EINOUT   2
    387389    int                 error;
    388     char                trackerError[128];
     390    char                errorString[128];
    389391    int                 cannotConnect;
    390392   
  • branches/io/libtransmission/utils.c

    r920 r1355  
    335335    return ret;
    336336}
     337
     338char *
     339tr_errorString( int code )
     340{
     341    switch( code )
     342    {
     343        case TR_OK:
     344            return "No error";
     345        case TR_ERROR:
     346            return "Generic error";
     347        case TR_ERROR_ASSERT:
     348            return "Assert error";
     349        case TR_ERROR_IO_PARENT:
     350            return "Download folder does not exist";
     351        case TR_ERROR_IO_PERMISSIONS:
     352            return "Unsufficient permissions";
     353        case TR_ERROR_IO_OTHER:
     354            return "Generic I/O error";
     355    }
     356    return "Unknown error";
     357}
     358
  • branches/io/libtransmission/utils.h

    r920 r1355  
    7070 **********************************************************************/
    7171char * tr_dupstr( const char * base, int len );
     72
     73char * tr_errorString( int code );
    7274
    7375/***********************************************************************
  • branches/io/macosx/Torrent.m

    r1354 r1355  
    378378    }
    379379   
    380     if (fStat->error & TR_ETRACKER)
     380    if (fStat->error)
    381381    {
    382382        [fStatusString setString: [NSLocalizedString(@"Error: ", "Torrent -> status string") stringByAppendingString:
     
    928928- (BOOL) isError
    929929{
    930     return fStat->error & TR_ETRACKER;
     930    return fStat->error;
    931931}
    932932
    933933- (NSString *) errorMessage
    934934{
    935     [NSString stringWithUTF8String: fStat->trackerError];
     935    [NSString stringWithUTF8String: fStat->errorString];
    936936}
    937937
Note: See TracChangeset for help on using the changeset viewer.