[svn r185] Some fixes to FileTransfer using URI. trunk
authorrosfran
Mon Dec 04 19:57:37 2006 +0000 (2006-12-04)
branchtrunk
changeset 1842dedc1bb30ba
parent 183 58bc1bd585e3
child 185 1b4e66e09d43
[svn r185] Some fixes to FileTransfer using URI.
gmyth/src/gmyth_file_transfer.c
gmyth/src/gmyth_file_transfer.h
gmyth/src/gmyth_monitor_handler.c
     1.1 --- a/gmyth/src/gmyth_file_transfer.c	Mon Dec 04 15:10:05 2006 +0000
     1.2 +++ b/gmyth/src/gmyth_file_transfer.c	Mon Dec 04 19:57:37 2006 +0000
     1.3 @@ -179,22 +179,30 @@
     1.4  }
     1.5  
     1.6  gboolean
     1.7 -gmyth_file_transfer_open ( GMythFileTransfer *transfer )
     1.8 +gmyth_file_transfer_open ( GMythFileTransfer *transfer, const gchar* filename )
     1.9  {
    1.10    gboolean ret = TRUE;
    1.11    
    1.12    g_return_val_if_fail( transfer != NULL, FALSE );
    1.13    
    1.14 +  if ( filename != NULL )
    1.15 +  {
    1.16 +		transfer->uri = gmyth_uri_new_with_value ( filename );
    1.17 +  	transfer->hostname = g_string_new( gmyth_uri_get_host(transfer->uri) );
    1.18 +  	transfer->port = gmyth_uri_get_port( transfer->uri );
    1.19 +  	transfer->filename = filename;
    1.20 +  	gmyth_backend_info_set_path ( transfer->backend_info, filename );
    1.21 +  }
    1.22 +  
    1.23    if ( transfer->backend_info != NULL )
    1.24    {
    1.25 +  	//transfer->uri = gmyth_backend_info_full_uri( ) 
    1.26  	  transfer->hostname = g_string_new ( gmyth_backend_info_get_hostname(transfer->backend_info) );
    1.27  	  transfer->port = gmyth_backend_info_get_port (transfer->backend_info);
    1.28 -  } else {
    1.29 -	  gmyth_debug ("[%s] URI: %s\n", __FUNCTION__, transfer->uri->uri->str);
    1.30 -	  transfer->hostname = g_string_new ( gmyth_uri_get_host(transfer->uri) );
    1.31 -	  transfer->port = gmyth_uri_get_port (transfer->uri);
    1.32    }
    1.33 -
    1.34 +  
    1.35 +  gmyth_debug ("[%s] URI: %s\n", __FUNCTION__, transfer->uri->uri->str);
    1.36 +	 
    1.37    gmyth_debug ("hostname: %s, port %d\n", transfer->hostname->str, transfer->port);
    1.38    
    1.39    /* configure the control socket */
    1.40 @@ -225,7 +233,7 @@
    1.41    g_return_val_if_fail (transfer->port > 0, FALSE);
    1.42  
    1.43    base_str = g_string_new ("");
    1.44 -  path_dir = ( transfer->uri != NULL ? gmyth_uri_get_path (transfer->uri) : 
    1.45 +  path_dir = ( transfer->filename != NULL ? transfer->filename : 
    1.46    				gmyth_backend_info_get_path( transfer->backend_info ) );
    1.47  
    1.48    /* Creates the control socket */
     2.1 --- a/gmyth/src/gmyth_file_transfer.h	Mon Dec 04 15:10:05 2006 +0000
     2.2 +++ b/gmyth/src/gmyth_file_transfer.h	Mon Dec 04 19:57:37 2006 +0000
     2.3 @@ -95,13 +95,14 @@
     2.4  	gint file_id;
     2.5  };
     2.6  
     2.7 -GType          gmyth_file_transfer_get_type        (void);
     2.8 +GType          		 gmyth_file_transfer_get_type        (void);
     2.9  
    2.10  GMythFileTransfer* gmyth_file_transfer_new ( const GMythBackendInfo *backend_info );
    2.11  
    2.12  GMythFileTransfer* gmyth_file_transfer_new_with_uri ( const gchar* uri_str );
    2.13  
    2.14 -gboolean gmyth_file_transfer_open (GMythFileTransfer *transfer);
    2.15 +gboolean 					 gmyth_file_transfer_open ( GMythFileTransfer *transfer, 
    2.16 +							const gchar* filename );
    2.17  
    2.18  void gmyth_file_transfer_close (GMythFileTransfer *transfer);
    2.19  
     3.1 --- a/gmyth/src/gmyth_monitor_handler.c	Mon Dec 04 15:10:05 2006 +0000
     3.2 +++ b/gmyth/src/gmyth_monitor_handler.c	Mon Dec 04 19:57:37 2006 +0000
     3.3 @@ -318,6 +318,8 @@
     3.4  {
     3.5  	gboolean ret = TRUE;
     3.6  	
     3.7 +	if (!g_thread_supported ()) g_thread_init (NULL);
     3.8 +	
     3.9    monitor_th = g_thread_create( (GThreadFunc)myth_control_sock_listener, 
    3.10    					monitor->event_sock->sd_io_ch, TRUE, NULL );
    3.11