Changeset 5450 for trunk/gtk/tr-prefs.c


Ignore:
Timestamp:
Mar 30, 2008, 3:20:18 AM (14 years ago)
Author:
charles
Message:

(gtk) better support for older versions of glib

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/tr-prefs.c

    r5449 r5450  
    1717#include <third-party/miniupnp/miniwget.h>
    1818#include <libtransmission/transmission.h>
     19#include <libtransmission/utils.h>
    1920#include "conf.h"
    2021#include "hig.h"
     
    310311    char * text = NULL;
    311312    gchar * filename = NULL;
     313    gchar * filename2 = NULL;
    312314    int fd = -1;
    313315    int ok = 1;
     
    333335    {
    334336        GError * err = NULL;
    335         fd = g_file_open_tmp( "transmission-blockfile-XXXXXX.gz", &filename, &err );
     337        fd = g_file_open_tmp( "transmission-blockfile-XXXXXX", &filename, &err );
    336338        if( err ) {
    337339            g_snprintf( data->secondary, sizeof( data->secondary ),
     
    348350    if( ok && !data->abortFlag )
    349351    {
     352        filename2 = g_strdup_printf( "%s.txt", filename );
    350353        g_snprintf( data->secondary, sizeof( data->secondary ),
    351354                    _( "Uncompressing blocklist..." ) );
    352355        g_idle_add( blocklistDialogSetSecondary, data );
    353         char * cmd = g_strdup_printf( "gunzip %s", filename );
     356        char * cmd = g_strdup_printf( "zcat %s > %s ", filename, filename2 );
     357        tr_dbg( "%s", cmd );
    354358        system( cmd );
    355359        g_free( cmd );
     
    360364                    _( "Parsing blocklist..." ) );
    361365        g_idle_add( blocklistDialogSetSecondary, data );
    362         filename[ strlen(filename) - 3 ] = '\0';
    363         rules = tr_blocklistSetContent( tr_core_handle( data->core ), filename );
     366        rules = tr_blocklistSetContent( tr_core_handle( data->core ), filename2 );
    364367    }
    365368    if( ok && !data->abortFlag )
     
    373376    free( text );
    374377    /* g_free( data ); */
    375     unlink( filename );
     378    if( filename2 ) {
     379        unlink( filename2 );
     380        g_free( filename2 );
     381    }
     382    if( filename ) {
     383        unlink( filename );
     384        g_free( filename );
     385    }
    376386    return NULL;
    377387}
Note: See TracChangeset for help on using the changeset viewer.