mirror of
https://github.com/transmission/transmission
synced 2024-12-25 09:13:06 +00:00
(trunk gtk) #2612 "Display new transfer window when adding magnet transfer" -- implemented in GTK+ for 2.00
This commit is contained in:
parent
f7d4377fa1
commit
e7e627c3e7
2 changed files with 22 additions and 23 deletions
|
@ -86,7 +86,7 @@ save_recent_destination( TrCore * core, const char * dir )
|
|||
struct AddData
|
||||
{
|
||||
TrCore * core;
|
||||
GtkWidget * list;
|
||||
GtkWidget * file_list;
|
||||
GtkWidget * run_check;
|
||||
GtkWidget * trash_check;
|
||||
GtkWidget * priority_combo;
|
||||
|
@ -101,7 +101,7 @@ removeOldTorrent( struct AddData * data )
|
|||
{
|
||||
if( data->gtor )
|
||||
{
|
||||
file_list_clear( data->list );
|
||||
file_list_clear( data->file_list );
|
||||
tr_torrent_set_remove_flag( data->gtor, TRUE );
|
||||
g_object_unref( G_OBJECT( data->gtor ) );
|
||||
data->gtor = NULL;
|
||||
|
@ -149,12 +149,20 @@ addResponseCB( GtkDialog * dialog,
|
|||
static void
|
||||
updateTorrent( struct AddData * o )
|
||||
{
|
||||
const gboolean isLocalFile = tr_ctorGetSourceFile( o->ctor ) != NULL;
|
||||
gtk_widget_set_sensitive( o->trash_check, isLocalFile );
|
||||
|
||||
if( !o->gtor )
|
||||
file_list_clear( o->list );
|
||||
else {
|
||||
{
|
||||
file_list_clear( o->file_list );
|
||||
gtk_widget_set_sensitive( o->file_list, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
tr_torrent * tor = tr_torrent_handle( o->gtor );
|
||||
tr_torrentSetDownloadDir( tor, o->downloadDir );
|
||||
file_list_set_torrent( o->list, tr_torrentId( tor ) );
|
||||
gtk_widget_set_sensitive( o->file_list, tr_torrentHasMetadata( tor ) );
|
||||
file_list_set_torrent( o->file_list, tr_torrentId( tor ) );
|
||||
tr_torrentVerify( tor );
|
||||
}
|
||||
}
|
||||
|
@ -173,14 +181,13 @@ sourceChanged( GtkFileChooserButton * b, gpointer gdata )
|
|||
char * filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( b ) );
|
||||
|
||||
/* maybe instantiate a torrent */
|
||||
if( data->filename || !data->gtor )
|
||||
if( filename || !data->gtor )
|
||||
{
|
||||
int err = 0;
|
||||
int new_file = 0;
|
||||
int err = 0;
|
||||
int new_file = 0;
|
||||
tr_torrent * torrent;
|
||||
|
||||
if( filename
|
||||
&& ( !data->filename || strcmp( filename, data->filename ) ) )
|
||||
if( filename && ( !data->filename || strcmp( filename, data->filename ) ) )
|
||||
{
|
||||
g_free( data->filename );
|
||||
data->filename = g_strdup( filename );
|
||||
|
@ -284,7 +291,7 @@ addSingleTorrentDialog( GtkWindow * parent, TrCore * core, tr_ctor * ctor )
|
|||
data->ctor = ctor;
|
||||
data->filename = g_strdup( tr_ctorGetSourceFile( ctor ) );
|
||||
data->downloadDir = g_strdup( str );
|
||||
data->list = file_list_new( core, 0 );
|
||||
data->file_list = file_list_new( core, 0 );
|
||||
str = _( "Mo_ve .torrent file to the trash" );
|
||||
data->trash_check = gtk_check_button_new_with_mnemonic( str );
|
||||
str = _( "_Start when added" );
|
||||
|
@ -337,7 +344,7 @@ addSingleTorrentDialog( GtkWindow * parent, TrCore * core, tr_ctor * ctor )
|
|||
|
||||
++row;
|
||||
col = 0;
|
||||
w = data->list;
|
||||
w = data->file_list;
|
||||
gtk_widget_set_size_request ( w, 466u, 300u );
|
||||
gtk_table_attach_defaults( GTK_TABLE( t ), w, col, col + 2, row, row + 1 );
|
||||
|
||||
|
|
|
@ -1055,20 +1055,12 @@ tr_core_add_from_url( TrCore * core, const char * url )
|
|||
|
||||
err = tr_ctorSetMetainfoFromMagnetLink( ctor, url );
|
||||
|
||||
if( err )
|
||||
{
|
||||
if( !err )
|
||||
tr_core_add_ctor( core, ctor );
|
||||
else {
|
||||
gtr_unrecognized_url_dialog( NULL, url );
|
||||
tr_ctorFree( ctor );
|
||||
}
|
||||
else
|
||||
{
|
||||
tr_session * session = tr_core_session( core );
|
||||
TrTorrent * gtor = tr_torrent_new_ctor( session, ctor, &err );
|
||||
if( !err )
|
||||
tr_core_add_torrent( core, gtor, FALSE );
|
||||
else
|
||||
g_message( "tr_torrent_new_ctor err %d", err );
|
||||
}
|
||||
|
||||
g_free( tmp );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue