# HG changeset patch # User rosfran # Date 1165262257 0 # Node ID 2dedc1bb30ba747011b65b832bce768a5a84e4a1 # Parent 58bc1bd585e30134fd69a8220e5972e4f0fe3051 [svn r185] Some fixes to FileTransfer using URI. diff -r 58bc1bd585e3 -r 2dedc1bb30ba gmyth/src/gmyth_file_transfer.c --- a/gmyth/src/gmyth_file_transfer.c Mon Dec 04 15:10:05 2006 +0000 +++ b/gmyth/src/gmyth_file_transfer.c Mon Dec 04 19:57:37 2006 +0000 @@ -179,22 +179,30 @@ } gboolean -gmyth_file_transfer_open ( GMythFileTransfer *transfer ) +gmyth_file_transfer_open ( GMythFileTransfer *transfer, const gchar* filename ) { gboolean ret = TRUE; g_return_val_if_fail( transfer != NULL, FALSE ); + if ( filename != NULL ) + { + transfer->uri = gmyth_uri_new_with_value ( filename ); + transfer->hostname = g_string_new( gmyth_uri_get_host(transfer->uri) ); + transfer->port = gmyth_uri_get_port( transfer->uri ); + transfer->filename = filename; + gmyth_backend_info_set_path ( transfer->backend_info, filename ); + } + if ( transfer->backend_info != NULL ) { + //transfer->uri = gmyth_backend_info_full_uri( ) transfer->hostname = g_string_new ( gmyth_backend_info_get_hostname(transfer->backend_info) ); transfer->port = gmyth_backend_info_get_port (transfer->backend_info); - } else { - gmyth_debug ("[%s] URI: %s\n", __FUNCTION__, transfer->uri->uri->str); - transfer->hostname = g_string_new ( gmyth_uri_get_host(transfer->uri) ); - transfer->port = gmyth_uri_get_port (transfer->uri); } - + + gmyth_debug ("[%s] URI: %s\n", __FUNCTION__, transfer->uri->uri->str); + gmyth_debug ("hostname: %s, port %d\n", transfer->hostname->str, transfer->port); /* configure the control socket */ @@ -225,7 +233,7 @@ g_return_val_if_fail (transfer->port > 0, FALSE); base_str = g_string_new (""); - path_dir = ( transfer->uri != NULL ? gmyth_uri_get_path (transfer->uri) : + path_dir = ( transfer->filename != NULL ? transfer->filename : gmyth_backend_info_get_path( transfer->backend_info ) ); /* Creates the control socket */ diff -r 58bc1bd585e3 -r 2dedc1bb30ba gmyth/src/gmyth_file_transfer.h --- a/gmyth/src/gmyth_file_transfer.h Mon Dec 04 15:10:05 2006 +0000 +++ b/gmyth/src/gmyth_file_transfer.h Mon Dec 04 19:57:37 2006 +0000 @@ -95,13 +95,14 @@ gint file_id; }; -GType gmyth_file_transfer_get_type (void); +GType gmyth_file_transfer_get_type (void); GMythFileTransfer* gmyth_file_transfer_new ( const GMythBackendInfo *backend_info ); GMythFileTransfer* gmyth_file_transfer_new_with_uri ( const gchar* uri_str ); -gboolean gmyth_file_transfer_open (GMythFileTransfer *transfer); +gboolean gmyth_file_transfer_open ( GMythFileTransfer *transfer, + const gchar* filename ); void gmyth_file_transfer_close (GMythFileTransfer *transfer); diff -r 58bc1bd585e3 -r 2dedc1bb30ba gmyth/src/gmyth_monitor_handler.c --- a/gmyth/src/gmyth_monitor_handler.c Mon Dec 04 15:10:05 2006 +0000 +++ b/gmyth/src/gmyth_monitor_handler.c Mon Dec 04 19:57:37 2006 +0000 @@ -318,6 +318,8 @@ { gboolean ret = TRUE; + if (!g_thread_supported ()) g_thread_init (NULL); + monitor_th = g_thread_create( (GThreadFunc)myth_control_sock_listener, monitor->event_sock->sd_io_ch, TRUE, NULL );