Changeset 6978
- Timestamp:
- Oct 28, 2008, 7:49:33 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cli/cli.c
r6946 r6978 184 184 185 185 static void 186 scrapeDoneFunc( struct tr_handle* session UNUSED,187 long 188 const void *response,189 size_t 190 void *host )186 scrapeDoneFunc( tr_session * session UNUSED, 187 long response_code, 188 const void * response, 189 size_t response_byte_count, 190 void * host ) 191 191 { 192 192 tr_benc top, *files; … … 305 305 char ** argv ) 306 306 { 307 int error;308 tr_ handle *h;309 tr_ctor *ctor;310 tr_torrent * tor = NULL;307 int error; 308 tr_session * h; 309 tr_ctor * ctor; 310 tr_torrent * tor = NULL; 311 311 312 312 printf( "Transmission %s - http://www.transmissionbt.com/\n", -
trunk/daemon/daemon.c
r6977 r6978 30 30 #define MY_NAME "transmission-daemon" 31 31 32 static int closing = FALSE;33 static tr_ handle * mySession;34 static char * myConfigFilename = NULL;32 static int closing = FALSE; 33 static tr_session * mySession = NULL; 34 static char * myConfigFilename = NULL; 35 35 36 36 #define KEY_BLOCKLIST "blocklist-enabled" -
trunk/gtk/add-dialog.c
r6795 r6978 169 169 int new_file = 0; 170 170 tr_torrent * torrent; 171 tr_ handle * handle = tr_core_handle( data->core );171 tr_session * session = tr_core_session( data->core ); 172 172 173 173 if( filename … … 184 184 tr_ctorSetDeleteSource( data->ctor, FALSE ); 185 185 186 if( ( torrent = tr_torrentNew( handle, data->ctor, &err ) ) )186 if( ( torrent = tr_torrentNew( session, data->ctor, &err ) ) ) 187 187 { 188 188 removeOldTorrent( data ); … … 408 408 if( response == GTK_RESPONSE_ACCEPT ) 409 409 { 410 Gtk Widget * w = gtk_file_chooser_get_extra_widget(411 GTK_FILE_CHOOSER( dialog ));412 const gboolean showOptions = gtk_toggle_button_get_active(413 GTK_TOGGLE_BUTTON ( w ));410 GtkFileChooser * chooser = GTK_FILE_CHOOSER( dialog ); 411 GtkWidget * w = gtk_file_chooser_get_extra_widget( chooser ); 412 GtkToggleButton * tb = GTK_TOGGLE_BUTTON( w ); 413 const gboolean showOptions = gtk_toggle_button_get_active( tb ); 414 414 const pref_flag_t start = PREF_FLAG_DEFAULT; 415 const pref_flag_t prompt = 416 showOptions ? PREF_FLAG_TRUE : PREF_FLAG_FALSE; 417 GSList * l = gtk_file_chooser_get_filenames( 418 GTK_FILE_CHOOSER( dialog ) ); 415 const pref_flag_t prompt = showOptions 416 ? PREF_FLAG_TRUE 417 : PREF_FLAG_FALSE; 418 GSList * l = gtk_file_chooser_get_filenames( chooser ); 419 419 420 tr_core_add_list( core, l, start, prompt ); 420 421 } -
trunk/gtk/blocklist.c
r6939 r6978 140 140 { 141 141 emitProgress( core, FALSE, _( "Parsing blocklist..." ) ); 142 rules = tr_blocklistSetContent( tr_core_ handle( core ), filename2 );142 rules = tr_blocklistSetContent( tr_core_session( core ), filename2 ); 143 143 } 144 144 -
trunk/gtk/main.c
r6962 r6978 311 311 312 312 static tr_rpc_callback_status 313 onRPCChanged( tr_ handle * handleUNUSED,313 onRPCChanged( tr_session * session UNUSED, 314 314 tr_rpc_callback_type type, 315 315 struct tr_torrent * tor, … … 440 440 GtkWindow * win; 441 441 442 tr_ handle* h = tr_sessionInitFull(442 tr_session * h = tr_sessionInitFull( 443 443 configDir, 444 444 "gtk", … … 502 502 updateScheduledLimits( gpointer data ) 503 503 { 504 tr_ handle * tr = (tr_handle *)data;504 tr_session * tr = data; 505 505 static gboolean last_state = FALSE; 506 506 gboolean in_sched_state = FALSE; … … 642 642 643 643 /* start scheduled rate timer */ 644 updateScheduledLimits ( tr_core_ handle( cbdata->core ) );644 updateScheduledLimits ( tr_core_session( cbdata->core ) ); 645 645 g_timeout_add( 60 * 1000, updateScheduledLimits, 646 tr_core_ handle( cbdata->core ) );646 tr_core_session( cbdata->core ) ); 647 647 648 648 /* either show the window or iconify it */ … … 1098 1098 gpointer data ) 1099 1099 { 1100 struct cbdata * cbdata = data;1101 tr_ handle * tr = tr_core_handle( cbdata->core );1100 struct cbdata * cbdata = data; 1101 tr_session * tr = tr_core_session( cbdata->core ); 1102 1102 1103 1103 if( !strcmp( key, PREF_KEY_ENCRYPTION ) ) … … 1489 1489 { 1490 1490 GtkWidget * w = make_meta_ui( GTK_WINDOW( data->wind ), 1491 tr_core_ handle( data->core ) );1491 tr_core_session( data->core ) ); 1492 1492 gtk_widget_show_all( w ); 1493 1493 } -
trunk/gtk/makemeta-ui.c
r6897 r6978 32 32 typedef struct 33 33 { 34 GtkWidget * 35 GtkWidget * 36 GtkWidget * 37 GtkWidget * 38 GtkWidget * 39 GtkWidget * 40 GtkWidget * 41 GtkWidget * 42 43 tr_metainfo_builder * builder;44 tr_ handle * handle;34 GtkWidget * filename_entry; 35 GtkWidget * size_lb; 36 GtkWidget * pieces_lb; 37 GtkWidget * announce_list; 38 GtkWidget * comment_entry; 39 GtkWidget * progressbar; 40 GtkWidget * private_check; 41 GtkWidget * dialog; 42 43 tr_metainfo_builder * builder; 44 tr_session * session; 45 45 46 46 gboolean isBuilding; … … 304 304 if( ui->builder ) 305 305 tr_metaInfoBuilderFree( ui->builder ); 306 ui->builder = tr_metaInfoBuilderCreate( ui-> handle, filename );306 ui->builder = tr_metaInfoBuilderCreate( ui->session, filename ); 307 307 refreshFromBuilder( ui ); 308 308 } … … 365 365 366 366 GtkWidget* 367 make_meta_ui( GtkWindow * parent,368 tr_ handle * handle)367 make_meta_ui( GtkWindow * parent, 368 tr_session * session ) 369 369 { 370 370 int n; … … 374 374 MakeMetaUI * ui = g_new0 ( MakeMetaUI, 1 ); 375 375 376 ui-> handle = handle;376 ui->session = session; 377 377 378 378 d = gtk_dialog_new_with_buttons( _( -
trunk/gtk/makemeta-ui.h
r6795 r6978 17 17 #include <libtransmission/transmission.h> 18 18 19 GtkWidget* make_meta_ui( GtkWindow * parent,20 tr_ handle * handle);19 GtkWidget* make_meta_ui( GtkWindow * parent, 20 tr_session * session ); 21 21 22 22 #endif -
trunk/gtk/stats.c
r6795 r6978 62 62 tr_session_stats one, all; 63 63 64 tr_sessionGetStats( tr_core_ handle( ui->core ), &one );65 tr_sessionGetCumulativeStats( tr_core_ handle( ui->core ), &all );64 tr_sessionGetStats( tr_core_session( ui->core ), &one ); 65 tr_sessionGetCumulativeStats( tr_core_session( ui->core ), &all ); 66 66 67 67 setLabel( ui->one_up_lb, … … 104 104 if( response == TR_RESPONSE_CLEAR ) 105 105 { 106 tr_handle * handle = tr_core_handle( ui->core ); 107 tr_sessionClearStats( handle ); 106 tr_sessionClearStats( tr_core_session( ui->core ) ); 108 107 updateStats( ui ); 109 108 } -
trunk/gtk/tr-core.c
r6972 r6978 66 66 guint inhibit_cookie; 67 67 GtkTreeModel * model; 68 tr_ handle * handle;68 tr_session * session; 69 69 }; 70 70 … … 588 588 { 589 589 const uint16_t val = pref_int_get( key ); 590 tr_sessionSetPeerLimit( tr_core_ handle( core ), val );590 tr_sessionSetPeerLimit( tr_core_session( core ), val ); 591 591 } 592 592 else if( !strcmp( key, PREF_KEY_INHIBIT_HIBERNATION ) ) … … 675 675 676 676 TrCore * 677 tr_core_new( tr_ handle * h)677 tr_core_new( tr_session * session ) 678 678 { 679 679 TrCore * core = TR_CORE( g_object_new( TR_CORE_TYPE, NULL ) ); 680 680 681 core->priv-> handle = h;681 core->priv->session = session; 682 682 683 683 /* init from prefs & listen to pref changes */ … … 696 696 tr_core_close( TrCore * core ) 697 697 { 698 tr_ handle * handle = tr_core_handle( core );699 700 if( handle)701 { 702 core->priv-> handle= NULL;703 tr_sessionClose( handle);698 tr_session * session = tr_core_session( core ); 699 700 if( session ) 701 { 702 core->priv->session = NULL; 703 tr_sessionClose( session ); 704 704 } 705 705 } … … 711 711 } 712 712 713 tr_ handle*714 tr_core_ handle( TrCore * core )715 { 716 return isDisposed( core ) ? NULL : core->priv-> handle;713 tr_session * 714 tr_core_session( TrCore * core ) 715 { 716 return isDisposed( core ) ? NULL : core->priv->session; 717 717 } 718 718 … … 746 746 if( !isDisposed( core ) ) 747 747 { 748 tr_sessionGetSpeed( core->priv-> handle,748 tr_sessionGetSpeed( core->priv->session, 749 749 &setme->clientDownloadSpeed, 750 750 &setme->clientUploadSpeed ); … … 816 816 tr_ctor * ctor; 817 817 818 ctor = tr_ctorNew( tr_core_ handle( self ) );818 ctor = tr_ctorNew( tr_core_session( self ) ); 819 819 if( forcePaused ) 820 820 tr_ctorSetPaused( ctor, TR_FORCE, TRUE ); … … 822 822 pref_int_get( PREF_KEY_MAX_PEERS_PER_TORRENT ) ); 823 823 824 torrents = tr_sessionLoadTorrents ( tr_core_handle( 825 self ), ctor, &count ); 824 torrents = tr_sessionLoadTorrents ( tr_core_session( self ), ctor, &count ); 826 825 for( i = 0; i < count; ++i ) 827 826 tr_core_add_torrent( self, tr_torrent_new_preexisting( torrents[i] ) ); … … 856 855 gboolean doPrompt ) 857 856 { 858 tr_ handle * handle = tr_core_handle( core );859 860 if( filename && handle)857 tr_session * session = tr_core_session( core ); 858 859 if( filename && session ) 861 860 { 862 861 int err; 863 tr_ctor * ctor = tr_ctorNew( handle);862 tr_ctor * ctor = tr_ctorNew( session ); 864 863 tr_core_apply_defaults( ctor ); 865 864 tr_ctorSetPaused( ctor, TR_FORCE, !doStart ); … … 869 868 tr_ctorFree( ctor ); 870 869 } 871 else if( ( err = tr_torrentParse( handle, ctor, NULL ) ) )870 else if( ( err = tr_torrentParse( session, ctor, NULL ) ) ) 872 871 { 873 872 /* don't complain about .torrent files in the watch directory … … 886 885 else 887 886 { 888 tr_torrent * tor = tr_torrentNew( handle, ctor, &err );887 tr_torrent * tor = tr_torrentNew( session, ctor, &err ); 889 888 if( err ) 890 889 tr_core_errsig( core, err, filename ); … … 1194 1193 if( inhibit ) { 1195 1194 gboolean active = FALSE; 1196 tr_ handle * session = tr_core_handle( core );1195 tr_session * session = tr_core_session( core ); 1197 1196 tr_torrent * tor = NULL; 1198 1197 while(( tor = tr_torrentNext( session, tor ))) -
trunk/gtk/tr-core.h
r6935 r6978 98 98 GType tr_core_get_type( void ); 99 99 100 TrCore * tr_core_new( tr_ handle* );100 TrCore * tr_core_new( tr_session * ); 101 101 102 102 void tr_core_close( TrCore* ); … … 105 105 GtkTreeModel * tr_core_model( TrCore * self ); 106 106 107 tr_ handle * tr_core_handle( TrCore * self );107 tr_session * tr_core_session( TrCore * self ); 108 108 109 109 void tr_core_get_stats( const TrCore * core, -
trunk/gtk/tr-prefs.c
r6946 r6978 428 428 TrCore * core ) 429 429 { 430 const int n = tr_blocklistGetRuleCount( tr_core_ handle( core ) );430 const int n = tr_blocklistGetRuleCount( tr_core_session( core ) ); 431 431 char buf[512]; 432 432 … … 537 537 b = gtr_button_new_from_stock( GTK_STOCK_REFRESH, _( "_Update" ) ); 538 538 data->check = w; 539 g_object_set_data( G_OBJECT( b ), " handle",540 tr_core_ handle( TR_CORE( core ) ) );539 g_object_set_data( G_OBJECT( b ), "session", 540 tr_core_session( TR_CORE( core ) ) ); 541 541 g_signal_connect( b, "clicked", G_CALLBACK( onUpdateBlocklistCB ), data ); 542 542 gtk_box_pack_start( GTK_BOX( h ), b, FALSE, FALSE, 0 ); … … 1229 1229 1230 1230 static void 1231 testing_port_done( tr_ handle * handleUNUSED,1231 testing_port_done( tr_session * session UNUSED, 1232 1232 long response_code UNUSED, 1233 1233 const void * response, … … 1258 1258 data->label ), 1259 1259 "tr-port-spin" ); 1260 tr_ handle * handle= g_object_get_data( G_OBJECT(1260 tr_session * session = g_object_get_data( G_OBJECT( 1261 1261 data->label ), 1262 " handle" );1262 "session" ); 1263 1263 const int port = gtk_spin_button_get_value_as_int( spin ); 1264 1264 char url[256]; … … 1266 1266 "http://portcheck.transmissionbt.com/%d", 1267 1267 port ); 1268 tr_webRun( handle, url, NULL, testing_port_done, data );1268 tr_webRun( session, url, NULL, testing_port_done, data ); 1269 1269 } 1270 1270 return FALSE; … … 1347 1347 1348 1348 g_object_set_data( G_OBJECT( l ), "tr-port-spin", w2 ); 1349 g_object_set_data( G_OBJECT( l ), " handle",1350 tr_core_ handle( TR_CORE( core ) ) );1349 g_object_set_data( G_OBJECT( l ), "session", 1350 tr_core_session( TR_CORE( core ) ) ); 1351 1351 data->id = g_signal_connect( TR_CORE( 1352 1352 core ), "prefs-changed", -
trunk/gtk/tr-torrent.c
r6935 r6978 188 188 189 189 TrTorrent * 190 tr_torrent_new_ctor( tr_ handle * handle,191 tr_ctor *ctor,192 char **err )190 tr_torrent_new_ctor( tr_session * session, 191 tr_ctor * ctor, 192 char ** err ) 193 193 { 194 194 tr_torrent * tor; … … 203 203 tr_ctorGetDeleteSource( ctor, &doTrash ); 204 204 tr_ctorSetDeleteSource( ctor, FALSE ); 205 tor = tr_torrentNew( handle, ctor, &errcode );205 tor = tr_torrentNew( session, ctor, &errcode ); 206 206 207 207 if( tor && doTrash ) 208 208 { 209 const char * config = tr_sessionGetConfigDir( handle);209 const char * config = tr_sessionGetConfigDir( session ); 210 210 const char * source = tr_ctorGetSourceFile( ctor ); 211 211 const int is_internal = source && ( strstr( source, config ) == source ); -
trunk/gtk/tr-torrent.h
r6795 r6978 74 74 TrTorrent * tr_torrent_new_preexisting( tr_torrent * tor ); 75 75 76 TrTorrent * tr_torrent_new_ctor( tr_ handle * handle,77 tr_ctor *ctor,78 char **err );76 TrTorrent * tr_torrent_new_ctor( tr_session * session, 77 tr_ctor * ctor, 78 char ** err ); 79 79 80 80 void tr_torrent_set_remove_flag( TrTorrent *, -
trunk/gtk/tr-window.c
r6935 r6978 726 726 char up[32], down[32], ratio[32], buf[128]; 727 727 struct tr_session_stats stats; 728 tr_ handle * handle = tr_core_handle( p->core );728 tr_session * session = tr_core_session( p->core ); 729 729 730 730 /* update the stats */ … … 732 732 if( !strcmp( pch, "session-ratio" ) ) 733 733 { 734 tr_sessionGetStats( handle, &stats );734 tr_sessionGetStats( session, &stats ); 735 735 tr_strlratio( ratio, stats.ratio, sizeof( ratio ) ); 736 736 g_snprintf( buf, sizeof( buf ), _( "Ratio: %s" ), ratio ); … … 738 738 else if( !strcmp( pch, "session-transfer" ) ) 739 739 { 740 tr_sessionGetStats( handle, &stats );740 tr_sessionGetStats( session, &stats ); 741 741 tr_strlsize( up, stats.uploadedBytes, sizeof( up ) ); 742 742 tr_strlsize( down, stats.downloadedBytes, sizeof( down ) ); … … 749 749 else if( !strcmp( pch, "total-transfer" ) ) 750 750 { 751 tr_sessionGetCumulativeStats( handle, &stats );751 tr_sessionGetCumulativeStats( session, &stats ); 752 752 tr_strlsize( up, stats.uploadedBytes, sizeof( up ) ); 753 753 tr_strlsize( down, stats.downloadedBytes, sizeof( down ) ); … … 760 760 else /* default is total-ratio */ 761 761 { 762 tr_sessionGetCumulativeStats( handle, &stats );762 tr_sessionGetCumulativeStats( session, &stats ); 763 763 tr_strlratio( ratio, stats.ratio, sizeof( ratio ) ); 764 764 g_snprintf( buf, sizeof( buf ), _( "Ratio: %s" ), ratio ); … … 772 772 char buf[128]; 773 773 float u, d; 774 tr_ handle * handle = tr_core_handle( p->core );775 776 tr_sessionGetSpeed( handle, &d, &u );774 tr_session * session = tr_core_session( p->core ); 775 776 tr_sessionGetSpeed( session, &d, &u ); 777 777 tr_strlspeed( buf, d, sizeof( buf ) ); 778 778 gtk_label_set_text( GTK_LABEL( p->dl_lb ), buf ); … … 786 786 PrivateData * p = get_private_data( self ); 787 787 788 if( p && p->core && tr_core_ handle( p->core ) )788 if( p && p->core && tr_core_session( p->core ) ) 789 789 { 790 790 updateSpeeds( p );
Note: See TracChangeset
for help on using the changeset viewer.