[svn r550] A lot of GObject fixes (using the GType casting), added inheritance to the GMythFile* modules, locks all the the STOP_RECORDING messages. trunk
authorrosfran
Fri Apr 13 20:07:32 2007 +0100 (2007-04-13)
branchtrunk
changeset 5457f0a3066f6ab
parent 544 bf01a0d21980
child 546 992abe7045a2
[svn r550] A lot of GObject fixes (using the GType casting), added inheritance to the GMythFile* modules, locks all the the STOP_RECORDING messages.
gmyth/src/gmyth_backendinfo.c
gmyth/src/gmyth_backendinfo.h
gmyth/src/gmyth_epg.h
gmyth/src/gmyth_file.c
gmyth/src/gmyth_file.h
gmyth/src/gmyth_file_local.h
gmyth/src/gmyth_file_transfer.c
gmyth/src/gmyth_file_transfer.h
gmyth/src/gmyth_livetv.h
gmyth/src/gmyth_monitor_handler.c
gmyth/src/gmyth_monitor_handler.h
gmyth/src/gmyth_programinfo.h
gmyth/src/gmyth_query.h
gmyth/src/gmyth_recorder.c
gmyth/src/gmyth_recorder.h
gmyth/src/gmyth_recprofile.h
gmyth/src/gmyth_scheduler.h
gmyth/src/gmyth_socket.h
gmyth/src/gmyth_stringlist.h
gmyth/src/gmyth_transcoder.h
gmyth/src/gmyth_tvchain.h
gmyth/src/gmyth_uri.h
     1.1 --- a/gmyth/src/gmyth_backendinfo.c	Fri Apr 13 14:54:52 2007 +0100
     1.2 +++ b/gmyth/src/gmyth_backendinfo.c	Fri Apr 13 20:07:32 2007 +0100
     1.3 @@ -283,9 +283,9 @@
     1.4  gmyth_backend_info_get_uri (GMythBackendInfo *backend_info)
     1.5  {
     1.6      GMythURI *uri = NULL;
     1.7 -    gchar* uri_str = g_strdup("");
     1.8 -    gchar *user_info = g_strdup("");
     1.9 -    gchar *db_data = g_strdup("");
    1.10 +    gchar* uri_str = NULL;
    1.11 +    gchar *user_info = NULL;
    1.12 +    gchar *db_data = NULL;
    1.13      
    1.14      if ( ( backend_info->username != NULL && strlen(backend_info->username) > 0 ) )
    1.15          user_info = g_strdup_printf( "%s:%s@", backend_info->username, backend_info->password );
    1.16 @@ -293,15 +293,15 @@
    1.17      if ( backend_info->db_name != NULL && strlen(backend_info->db_name) > 0 )
    1.18      {
    1.19          if ( ( g_strrstr( backend_info->db_name, "_" ) != NULL ) )
    1.20 -            db_data = backend_info->db_name;
    1.21 +            db_data = g_strdup( backend_info->db_name );
    1.22          else
    1.23              db_data = g_strdup_printf( "?%s&", backend_info->db_name );
    1.24      }
    1.25      //else if ( ( ( g_strrstr( backend_info->path, "livetv" ) != NULL ) || 
    1.26      //            ( g_strrstr( backend_info->path, "/?" ) != NULL ) )
    1.27      
    1.28 -    uri_str = g_strdup_printf( "myth://%s%s:%d/%s", user_info != NULL && strlen( user_info ) > 0 ? g_strdup( user_info ) : "", backend_info->hostname, 
    1.29 -            backend_info->port, db_data != NULL && strlen( db_data ) > 0 ? g_strdup( db_data ) : "");
    1.30 +    uri_str = g_strdup_printf( "myth://%s%s:%d/%s", user_info != NULL && strlen( user_info ) > 0 ? user_info : "", backend_info->hostname, 
    1.31 +            backend_info->port, db_data != NULL && strlen( db_data ) > 0 ? db_data : "");
    1.32      uri = gmyth_uri_new_with_value (uri_str);
    1.33  
    1.34      if ( user_info != NULL )
     2.1 --- a/gmyth/src/gmyth_backendinfo.h	Fri Apr 13 14:54:52 2007 +0100
     2.2 +++ b/gmyth/src/gmyth_backendinfo.h	Fri Apr 13 20:07:32 2007 +0100
     2.3 @@ -39,7 +39,7 @@
     2.4  #define GMYTH_BACKEND_INFO_TYPE               (gmyth_backend_info_get_type ())
     2.5  #define GMYTH_BACKEND_INFO(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_BACKEND_INFO_TYPE, GMythBackendInfo))
     2.6  #define GMYTH_BACKEND_INFO_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_BACKEND_INFO_TYPE, GMythBackendInfoClass))
     2.7 -#define IS_GMYTH_BACKEND_INFO(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_BACKEND_INFO_TYPE))
     2.8 +#define IS_GMYTH_BACKEND_INFO(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_BACKEND_INFO_TYPE))
     2.9  #define IS_GMYTH_BACKEND_INFO_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_BACKEND_INFO_TYPE))
    2.10  #define GMYTH_BACKEND_INFO_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_BACKEND_INFO_TYPE, GMythBackendInfoClass))
    2.11  
     3.1 --- a/gmyth/src/gmyth_epg.h	Fri Apr 13 14:54:52 2007 +0100
     3.2 +++ b/gmyth/src/gmyth_epg.h	Fri Apr 13 20:07:32 2007 +0100
     3.3 @@ -39,7 +39,7 @@
     3.4  #define GMYTH_EPG_TYPE               (gmyth_epg_get_type ())
     3.5  #define GMYTH_EPG(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_EPG_TYPE, GMythEPG))
     3.6  #define GMYTH_EPG_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_EPG_TYPE, GMythEPGClass))
     3.7 -#define IS_GMYTH_EPG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_EPG_TYPE))
     3.8 +#define IS_GMYTH_EPG(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_EPG_TYPE))
     3.9  #define IS_GMYTH_EPG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_EPG_TYPE))
    3.10  #define GMYTH_EPG_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_EPG_TYPE, GMythEPGClass))
    3.11  
     4.1 --- a/gmyth/src/gmyth_file.c	Fri Apr 13 14:54:52 2007 +0100
     4.2 +++ b/gmyth/src/gmyth_file.c	Fri Apr 13 20:07:32 2007 +0100
     4.3 @@ -68,6 +68,7 @@
     4.4  
     4.5  enum 
     4.6  {
     4.7 +    PROP_GMYTH_FILE_DUMMY,
     4.8      PROP_GMYTH_FILE_FILENAME,
     4.9      PROP_GMYTH_FILE_OFFSET,
    4.10      PROP_GMYTH_FILE_FILESIZE,
    4.11 @@ -85,7 +86,7 @@
    4.12  static void gmyth_file_dispose             (GObject *object);
    4.13  static void gmyth_file_finalize            (GObject *object);
    4.14  
    4.15 -G_DEFINE_TYPE(GMythFile, gmyth_file, GMYTH_FILE_TYPE)
    4.16 +G_DEFINE_TYPE(GMythFile, gmyth_file, G_TYPE_OBJECT)
    4.17  
    4.18  static void
    4.19  gmyth_file_class_init (GMythFileClass *klass)
    4.20 @@ -104,31 +105,36 @@
    4.21      
    4.22      g_object_class_install_property
    4.23            (gobject_class, PROP_GMYTH_FILE_FILENAME,
    4.24 -          g_param_spec_string ("filename", "Filename",
    4.25 +          g_param_spec_string ("filename", "filename",
    4.26                "The file name.",
    4.27 -              "", G_PARAM_READWRITE));
    4.28 +              "", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | 
    4.29 +                  G_PARAM_READABLE | G_PARAM_WRITABLE));
    4.30      
    4.31      g_object_class_install_property
    4.32            (gobject_class, PROP_GMYTH_FILE_OFFSET,
    4.33            g_param_spec_int64 ("file-offset", "file-offset",
    4.34 -                  "The offset (position) of this file", 0, G_MAXINT64, 0, G_PARAM_READWRITE));
    4.35 +                  "The offset (position) of this file", 0, G_MAXINT64, 0, G_PARAM_STATIC_NAME | 
    4.36 +                      G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
    4.37      
    4.38      g_object_class_install_property
    4.39            (gobject_class, PROP_GMYTH_FILE_FILESIZE,
    4.40            g_param_spec_uint64 ("file-size", "file-size",
    4.41                "The file size in bytes",
    4.42 -              0, G_MAXUINT64, 0, G_PARAM_READWRITE));
    4.43 +              0, G_MAXUINT64, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | 
    4.44 +                  G_PARAM_READABLE | G_PARAM_WRITABLE));
    4.45      
    4.46      g_object_class_install_property
    4.47            (gobject_class, PROP_GMYTH_FILE_BACKEND_INFO,
    4.48            g_param_spec_object ("backend-info", "backend-info",
    4.49                    "The Backend Information about the remote server", 
    4.50 -                  G_TYPE_OBJECT, G_PARAM_READWRITE));
    4.51 +                  G_TYPE_OBJECT, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | 
    4.52 +                      G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
    4.53      
    4.54      g_object_class_install_property
    4.55            (gobject_class, PROP_GMYTH_FILE_FILEID,
    4.56            g_param_spec_int ("file-id", "file-id",
    4.57 -                  "The file ID", 0, G_MAXINT, 0, G_PARAM_READWRITE));
    4.58 +                  "The file ID", 0, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | 
    4.59 +                      G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
    4.60    
    4.61     g_type_class_add_private (gobject_class, sizeof (GMythFilePrivate));
    4.62  
    4.63 @@ -137,10 +143,9 @@
    4.64  static void
    4.65  gmyth_file_init (GMythFile *file)
    4.66  { 
    4.67 -    GMythFilePrivate *priv;
    4.68      g_return_if_fail( file != NULL );
    4.69  
    4.70 -    priv = GMYTH_FILE_GET_PRIVATE(file);	
    4.71 +    file->priv = GMYTH_FILE_GET_PRIVATE(file);
    4.72  }
    4.73  
    4.74  static void
    4.75 @@ -193,24 +198,28 @@
    4.76  GMythFile*
    4.77  gmyth_file_new (GMythBackendInfo *backend_info)
    4.78  {
    4.79 -  GMythFile *file = GMYTH_FILE (g_object_new (GMYTH_FILE_TYPE, NULL));
    4.80 +  GMythFile *file = NULL;
    4.81 +
    4.82 +  g_return_val_if_fail (backend_info != NULL, NULL);
    4.83    
    4.84 -  g_object_set(G_OBJECT (file), "backend-info", &backend_info, NULL);
    4.85 +  GParameter * __params = g_new0 (GParameter, 1);
    4.86 +  GParameter * __params_it = __params;
    4.87    
    4.88 +  (__params_it->name = "backend-info", g_value_init (&__params_it->value, G_TYPE_OBJECT), 
    4.89 +          g_value_set_object (&__params_it->value, backend_info), __params_it++);
    4.90 +  file = g_object_newv (GMYTH_FILE_TYPE, __params_it - __params, __params);
    4.91 +
    4.92    return file;
    4.93  }
    4.94  
    4.95  gchar*
    4.96  gmyth_file_get_file_name (GMythFile *file)
    4.97  {
    4.98 -    gchar *filename;
    4.99 +    GMythFilePrivate *priv = GMYTH_FILE_GET_PRIVATE(file);
   4.100 +
   4.101 +    g_return_val_if_fail( file != NULL, NULL );
   4.102      
   4.103 -    g_return_val_if_fail( file != NULL, NULL );
   4.104 -    g_return_val_if_fail( filename != NULL, NULL );
   4.105 -    
   4.106 -    g_object_get(G_OBJECT (file), "filename", &filename, NULL);
   4.107 -
   4.108 -    return filename;
   4.109 +    return priv->filename;
   4.110  }
   4.111  
   4.112  void
   4.113 @@ -219,8 +228,11 @@
   4.114      g_return_if_fail( file != NULL );
   4.115      g_return_if_fail( filename != NULL );
   4.116      
   4.117 -    g_object_set (G_OBJECT (file), "filename", &filename, NULL);    
   4.118 -
   4.119 +    gchar* __temp2 = NULL;
   4.120 +    const gchar* __temp1 = NULL;
   4.121 +    file->priv->filename = (__temp2 = (__temp1 = filename, (__temp1 == NULL ? 
   4.122 +            NULL : g_strdup (__temp1))), (file->priv->filename == NULL ? 
   4.123 +            NULL : (file->priv->filename = (g_free (file->priv->filename), NULL))), __temp2);
   4.124  }
   4.125  
   4.126  /** 
   4.127 @@ -332,12 +344,9 @@
   4.128  gint64
   4.129  gmyth_file_get_offset (GMythFile *file)
   4.130  {
   4.131 -    GMythFilePrivate *priv;
   4.132 -
   4.133      g_return_val_if_fail (file != NULL, 0);
   4.134  
   4.135 -    priv = GMYTH_FILE_GET_PRIVATE (file);
   4.136 -    return priv->offset;
   4.137 +    return file->priv->offset;
   4.138  }
   4.139  
   4.140  /**
   4.141 @@ -369,10 +378,10 @@
   4.142                break;
   4.143            }
   4.144      
   4.145 -          //if (priv->filename != NULL) {
   4.146 -          //  g_free (priv->filename);
   4.147 -          //  priv->filename = NULL;
   4.148 -          //}
   4.149 +          if (priv->filename != NULL) {
   4.150 +            g_free (priv->filename);
   4.151 +            priv->filename = NULL;
   4.152 +          }
   4.153            priv->filename = g_value_dup_string (value);
   4.154            gmyth_debug( "Changed the filename to [%s]!", priv->filename );
   4.155            break;
   4.156 @@ -393,10 +402,10 @@
   4.157                break;
   4.158            }
   4.159      
   4.160 -          //if (priv->backend_info != NULL) {
   4.161 -          //  g_object_unref (priv->backend_info);
   4.162 -          // priv->backend_info = NULL;
   4.163 -          //}          
   4.164 +          if (priv->backend_info != NULL) {
   4.165 +            g_object_unref (priv->backend_info);
   4.166 +           priv->backend_info = NULL;
   4.167 +          }          
   4.168            priv->backend_info = g_value_get_object (value);
   4.169            gmyth_debug( "Changed the backend info to [%s]!", gmyth_backend_info_get_hostname( priv->backend_info ) );
   4.170            break;
     5.1 --- a/gmyth/src/gmyth_file.h	Fri Apr 13 14:54:52 2007 +0100
     5.2 +++ b/gmyth/src/gmyth_file.h	Fri Apr 13 20:07:32 2007 +0100
     5.3 @@ -47,7 +47,7 @@
     5.4  #define GMYTH_FILE_TYPE               (gmyth_file_get_type ())
     5.5  #define GMYTH_FILE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_FILE_TYPE, GMythFile))
     5.6  #define GMYTH_FILE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_TYPE, GMythFileClass))
     5.7 -#define IS_GMYTH_FILE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_FILE_TYPE))
     5.8 +#define IS_GMYTH_FILE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_FILE_TYPE))
     5.9  #define IS_GMYTH_FILE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_TYPE))
    5.10  #define GMYTH_FILE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_FILE_TYPE, GMythFileClass))
    5.11  
    5.12 @@ -65,6 +65,7 @@
    5.13  struct _GMythFile
    5.14  {
    5.15  	GObject 				parent;
    5.16 +	GMythFilePrivate        *priv;
    5.17  };
    5.18  
    5.19  struct _GMythFileClass
     6.1 --- a/gmyth/src/gmyth_file_local.h	Fri Apr 13 14:54:52 2007 +0100
     6.2 +++ b/gmyth/src/gmyth_file_local.h	Fri Apr 13 20:07:32 2007 +0100
     6.3 @@ -48,7 +48,7 @@
     6.4  #define GMYTH_FILE_LOCAL_TYPE               (gmyth_file_local_get_type ())
     6.5  #define GMYTH_FILE_LOCAL(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_FILE_LOCAL_TYPE, GMythFileLocal))
     6.6  #define GMYTH_FILE_LOCAL_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_LOCAL_TYPE, GMythFileLocalClass))
     6.7 -#define IS_GMYTH_FILE_LOCAL(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_FILE_LOCAL_TYPE))
     6.8 +#define IS_GMYTH_FILE_LOCAL(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_FILE_LOCAL_TYPE))
     6.9  #define IS_GMYTH_FILE_LOCAL_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_LOCAL_TYPE))
    6.10  #define GMYTH_FILE_LOCAL_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_FILE_LOCAL_TYPE, GMythFileLocalClass))
    6.11  
     7.1 --- a/gmyth/src/gmyth_file_transfer.c	Fri Apr 13 14:54:52 2007 +0100
     7.2 +++ b/gmyth/src/gmyth_file_transfer.c	Fri Apr 13 20:07:32 2007 +0100
     7.3 @@ -69,26 +69,20 @@
     7.4  };
     7.5  
     7.6  struct _GMythFileTransferPrivate {
     7.7 -	GMythRecorder *recorder;
     7.8 +	GMythRecorder  *recorder;
     7.9  	
    7.10 -	gboolean do_next_program_chain;
    7.11 -	gboolean disposed;
    7.12 -    gboolean livetv_wait;
    7.13 -    gint64 offset;
    7.14 -    guint64 filesize;
    7.15 +	gboolean       do_next_program_chain;
    7.16 +	gboolean       disposed;
    7.17 +    gboolean       livetv_wait;
    7.18  
    7.19 -	/* Myth URI structure */
    7.20 -	gchar                   *filename;
    7.21 -	GMythBackendInfo        *backend_info;
    7.22 -	
    7.23  	/* MythTV version number */	
    7.24 -	gint 					mythtv_version;
    7.25 +	gint           mythtv_version;
    7.26  
    7.27  	/* socket descriptors */
    7.28 -	GMythSocket 			*control_sock;
    7.29 -	GMythSocket 			*sock;
    7.30 -	GMutex 					*mutex;
    7.31 -	gint 					file_id;
    7.32 +	GMythSocket    *control_sock;
    7.33 +	GMythSocket    *sock;
    7.34 +	GMutex         *mutex;
    7.35 +	gint           file_id;
    7.36  };
    7.37  
    7.38  static void gmyth_file_transfer_class_init          (GMythFileTransferClass *klass);
    7.39 @@ -101,7 +95,7 @@
    7.40  static gboolean _control_acquire_context            (GMythFileTransfer *transfer, gboolean do_wait);
    7.41  static gboolean _control_release_context            (GMythFileTransfer *transfer);
    7.42  
    7.43 -G_DEFINE_TYPE(GMythFileTransfer, gmyth_file_transfer, G_TYPE_OBJECT)
    7.44 +G_DEFINE_TYPE(GMythFileTransfer, gmyth_file_transfer, GMYTH_FILE_TYPE)
    7.45  
    7.46  static void
    7.47  gmyth_file_transfer_class_init (GMythFileTransferClass *klass)
    7.48 @@ -137,11 +131,10 @@
    7.49  static void
    7.50  gmyth_file_transfer_init (GMythFileTransfer *transfer)
    7.51  { 
    7.52 -    GMythFileTransferPrivate *priv;
    7.53      g_return_if_fail( transfer != NULL );
    7.54  
    7.55 -    priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer);	
    7.56 -    priv->mutex = g_mutex_new();
    7.57 +    transfer->priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer);	
    7.58 +    transfer->priv->mutex = g_mutex_new();
    7.59    
    7.60      g_signal_connect ( G_OBJECT (transfer), "program-info-changed",
    7.61          (GCallback)(GMYTH_FILE_TRANSFER_GET_CLASS(transfer)->program_info_changed_handler),
    7.62 @@ -181,21 +174,11 @@
    7.63          priv->sock = NULL;
    7.64      }
    7.65  
    7.66 -    if (priv->backend_info != NULL ) {
    7.67 -        g_object_unref (priv->backend_info );
    7.68 -        priv->backend_info = NULL;
    7.69 -    }
    7.70 -
    7.71      if (priv->recorder != NULL ) {
    7.72          g_object_unref (priv->recorder );
    7.73          priv->recorder = NULL;
    7.74      }
    7.75 -
    7.76 -    if (priv->filename != NULL ) {
    7.77 -        g_free (priv->filename );
    7.78 -        priv->filename = NULL;
    7.79 -    }
    7.80 -
    7.81 +    
    7.82      G_OBJECT_CLASS (gmyth_file_transfer_parent_class)->dispose (object);
    7.83  }
    7.84  
    7.85 @@ -218,20 +201,27 @@
    7.86  GMythFileTransfer*
    7.87  gmyth_file_transfer_new (GMythBackendInfo *backend_info)
    7.88  {
    7.89 -  GMythFileTransfer *transfer = GMYTH_FILE_TRANSFER (g_object_new (GMYTH_FILE_TRANSFER_TYPE, NULL));
    7.90 -  GMythFileTransferPrivate *priv = GMYTH_FILE_TRANSFER_GET_PRIVATE (transfer);
    7.91 +    GMythFileTransfer *transfer = g_object_new (GMYTH_FILE_TRANSFER_TYPE, 
    7.92 +            "backend-info", backend_info, NULL);
    7.93 +    //GValue val = {0,};    
    7.94 +    //backend_info = g_object_ref( backend_info );
    7.95 +    gmyth_debug( "Creating FileTransfer BackendInfo hostname = %s", gmyth_backend_info_get_hostname(backend_info) );
    7.96 +    //GMythBackendInfo *backend_info = gmyth_backend_info_new_with_uri (uri_str);
    7.97 +    //g_value_init (&val, G_TYPE_OBJECT);
    7.98 +    //g_value_set_object (&val, backend_info);    
    7.99 +    //g_object_set (G_OBJECT (transfer), "backend-info", &val, NULL);
   7.100    
   7.101 -  priv->backend_info = g_object_ref (backend_info);
   7.102 -  return transfer;
   7.103 +    return transfer;
   7.104  }
   7.105  
   7.106 -
   7.107  gchar*
   7.108  gmyth_file_transfer_get_file_name (GMythFileTransfer *transfer)
   7.109  {
   7.110 -    GMythFileTransferPrivate *priv = GMYTH_FILE_TRANSFER_GET_PRIVATE (transfer);
   7.111 +    gchar *filename;
   7.112 +    
   7.113 +    g_object_get( G_OBJECT(transfer), "filename", &filename, NULL );
   7.114  
   7.115 -    return g_strdup (priv->filename);
   7.116 +    return filename;
   7.117  }
   7.118  
   7.119  /** 
   7.120 @@ -244,18 +234,22 @@
   7.121  GMythFileTransfer* 
   7.122  gmyth_file_transfer_new_with_uri (const gchar* uri_str)
   7.123  {
   7.124 -  GMythFileTransfer *transfer = GMYTH_FILE_TRANSFER (g_object_new (GMYTH_FILE_TRANSFER_TYPE, NULL));
   7.125 -  GMythFileTransferPrivate *priv = GMYTH_FILE_TRANSFER_GET_PRIVATE (transfer);
   7.126 +    GMythFileTransfer *transfer = GMYTH_FILE_TRANSFER (g_object_new (GMYTH_FILE_TRANSFER_TYPE, NULL));
   7.127 +    gmyth_debug( "URI str = %s", uri_str );
   7.128 +    //GMythBackendInfo *backend_info = gmyth_backend_info_new_with_uri (uri_str);
   7.129 +    GValue val = {0,};
   7.130 +    g_value_init (&val, G_TYPE_OBJECT);
   7.131 +    g_value_set_object (&val, gmyth_backend_info_new_with_uri (uri_str));
   7.132 +    g_object_set(G_OBJECT (transfer), "backend-info", &val, NULL);
   7.133  
   7.134 -  priv->backend_info = gmyth_backend_info_new_with_uri (uri_str);
   7.135 -  return transfer;
   7.136 +    return transfer;
   7.137  }
   7.138  
   7.139  /** 
   7.140   * Open a File Transfer connection in order to get a remote file.
   7.141   * 
   7.142   * @param transfer The actual File Transfer instance. 
   7.143 - * @param filename The file name of the remote file to be transfered to the client.
   7.144 + * @param filename The file name of the remote file to be transferred to the client.
   7.145   * 
   7.146   * @return <code>true</code>, if the connection opening had been done successfully. 
   7.147   */
   7.148 @@ -269,25 +263,23 @@
   7.149      g_return_val_if_fail (filename != NULL && strlen(filename) > 0, FALSE);
   7.150  
   7.151      priv = GMYTH_FILE_TRANSFER_GET_PRIVATE (transfer);
   7.152 -
   7.153 -    if (priv->filename != NULL)
   7.154 -    {
   7.155 -        gmyth_file_transfer_close (transfer);
   7.156 -    }
   7.157 -
   7.158 -    priv->filename = g_strdup( filename );
   7.159 +    
   7.160 +    //if ( )
   7.161 +    gmyth_debug( "Opening the FileTransfer... (%s)", filename );
   7.162 +    
   7.163 +    g_object_set( GMYTH_FILE(transfer), "filename", filename, NULL );
   7.164  
   7.165      /* configure the control socket */
   7.166      if (priv->control_sock == NULL) { 
   7.167          if (!_connect_to_backend (transfer)) {
   7.168 -            gmyth_debug ("Connection to backend failed (Control Socket).\n");
   7.169 +            gmyth_debug ("Connection to backend failed (Control Socket).");
   7.170              ret = FALSE;
   7.171          }
   7.172      } else {
   7.173 -        gmyth_debug("Remote transfer control socket already created.\n");
   7.174 +        gmyth_debug("Remote transfer control socket already created.");
   7.175      }
   7.176    
   7.177 -    gmyth_debug ("Got file with size = %lld.\n", priv->filesize);
   7.178 +    gmyth_debug ("Got file with size = %lld.\n", gmyth_file_get_filesize(GMYTH_FILE(transfer)));
   7.179  
   7.180      return ret;
   7.181  }
   7.182 @@ -307,13 +299,15 @@
   7.183      GMythStringList *strlist = NULL; 
   7.184      gboolean ret = TRUE;
   7.185      GMythFileTransferPrivate *priv;
   7.186 +    GMythBackendInfo *backend_info;
   7.187  
   7.188      g_return_val_if_fail (transfer != NULL, FALSE );
   7.189 +    
   7.190 +    g_object_get( GMYTH_FILE(transfer), "backend-info", &backend_info, NULL );
   7.191  
   7.192      priv = GMYTH_FILE_TRANSFER_GET_PRIVATE (transfer);
   7.193      _control_acquire_context (transfer, TRUE);
   7.194  
   7.195 -
   7.196      /* Creates the control socket */
   7.197  
   7.198      if (priv->control_sock != NULL) {
   7.199 @@ -326,7 +320,7 @@
   7.200    	priv->control_sock = gmyth_socket_new();
   7.201      // Connects the socket, send Mythtv ANN command and verify Mythtv protocol version 
   7.202  	if (!gmyth_socket_connect_to_backend (priv->control_sock,
   7.203 -    	    priv->backend_info->hostname, priv->backend_info->port, TRUE)) {
   7.204 +    	    backend_info->hostname, backend_info->port, TRUE)) {
   7.205  	
   7.206  	    g_object_unref (priv->control_sock);
   7.207  	    priv->control_sock = NULL;
   7.208 @@ -340,8 +334,8 @@
   7.209      }  
   7.210  
   7.211      priv->sock = gmyth_socket_new ();
   7.212 -	gmyth_socket_connect (priv->sock, priv->backend_info->hostname, priv->backend_info->port);
   7.213 -	gmyth_debug ("Connecting file transfer... (%s, %d)", priv->backend_info->hostname, priv->backend_info->port);	  
   7.214 +	gmyth_socket_connect (priv->sock, backend_info->hostname, backend_info->port);
   7.215 +	gmyth_debug ("Connecting file transfer... (%s, %d)", backend_info->hostname, backend_info->port);	  
   7.216    
   7.217  	strlist = gmyth_string_list_new();
   7.218  	hostname = gmyth_socket_get_local_hostname();
   7.219 @@ -352,7 +346,7 @@
   7.220  	    g_string_printf (base_str, "ANN FileTransfer %s", hostname->str);
   7.221  	
   7.222      gmyth_string_list_append_string (strlist, base_str );
   7.223 -	gmyth_string_list_append_char_array (strlist, priv->filename);
   7.224 +	gmyth_string_list_append_char_array (strlist, gmyth_file_get_file_name(GMYTH_FILE(transfer)));
   7.225  	
   7.226  	gmyth_socket_write_stringlist (priv->sock, strlist );
   7.227  	gmyth_socket_read_stringlist (priv->sock, strlist );
   7.228 @@ -361,13 +355,14 @@
   7.229  	priv->file_id = gmyth_string_list_get_int (strlist, 1);
   7.230  	
   7.231  	/* Myth URI stream file size - decoded using two 8-bytes sequences (64 bits/long long types) */
   7.232 -	priv->filesize = gmyth_util_decode_long_long (strlist, 2);
   7.233 +	gmyth_file_set_filesize( GMYTH_FILE(transfer), gmyth_util_decode_long_long (strlist, 2) );
   7.234  	
   7.235 -	gmyth_debug ( "[%s] ***** Received: recordernum = %d, filesize = %" G_GUINT64_FORMAT "\n", __FUNCTION__,
   7.236 -	          priv->file_id, priv->filesize );
   7.237 +	gmyth_debug ( "***** Received: recordernum = %d, filesize = %" G_GUINT64_FORMAT "\n",
   7.238 +	          priv->file_id, gmyth_file_get_filesize(GMYTH_FILE(transfer)) );
   7.239  	
   7.240 -	if (priv->filesize < 0 ) {
   7.241 -	    gmyth_debug ( "[%s] Got filesize equals to %llu is lesser than 0 [invalid stream file]\n", __FUNCTION__, priv->filesize);
   7.242 +	if ( gmyth_file_get_filesize(GMYTH_FILE(transfer)) < 0 ) {
   7.243 +	    gmyth_debug ( "Got filesize equals to %llu is lesser than 0 [invalid stream file]\n", 
   7.244 +                gmyth_file_get_filesize(GMYTH_FILE(transfer)) );
   7.245  	    g_object_unref (priv->sock);
   7.246  	    priv->sock = NULL;
   7.247  	    ret = FALSE;
   7.248 @@ -494,11 +489,6 @@
   7.249          priv->control_sock = NULL;
   7.250      } 
   7.251  
   7.252 -    if (priv->filename) {
   7.253 -        g_free (priv->filename);
   7.254 -        priv->filename = NULL;
   7.255 -    }
   7.256 -
   7.257      _control_release_context (transfer);
   7.258  }
   7.259  
   7.260 @@ -539,14 +529,13 @@
   7.261      if (pos > 0 )
   7.262          gmyth_string_list_append_uint64 (strlist, pos);
   7.263      else
   7.264 -        gmyth_string_list_append_uint64 (strlist, priv->offset);
   7.265 +        gmyth_string_list_append_uint64 (strlist, gmyth_file_get_offset( GMYTH_FILE(transfer) ) );
   7.266  
   7.267      gmyth_socket_sendreceive_stringlist (priv->control_sock, strlist);
   7.268  
   7.269      gint64 retval = gmyth_string_list_get_int64 (strlist, 0);
   7.270 -    priv->offset = retval;
   7.271 -    gmyth_debug ( "[%s] got reading position pointer from the streaming = %lld\n", 
   7.272 -        __FUNCTION__, retval );
   7.273 +    gmyth_file_set_offset( GMYTH_FILE(transfer), retval );
   7.274 +    gmyth_debug ( "Got reading position pointer from the streaming = %lld\n", retval );
   7.275  
   7.276      g_object_unref (strlist);
   7.277      g_string_free (query, TRUE);
   7.278 @@ -611,13 +600,13 @@
   7.279   * @return The actual block size (in bytes) returned by REQUEST_BLOCK message,
   7.280   * 				or the error code. 
   7.281   */
   7.282 -GMythFileTransferReadResult 
   7.283 +GMythFileReadResult 
   7.284  gmyth_file_transfer_read(GMythFileTransfer *transfer, GByteArray *data, gint size, gboolean read_unlimited)
   7.285  {
   7.286      gint bytes_sent = 0;
   7.287      gsize bytes_read = 0;
   7.288      gint64 total_read = 0;
   7.289 -    GMythFileTransferReadResult retval = GMYTH_FILE_TRANSFER_READ_OK;
   7.290 +    GMythFileReadResult retval = GMYTH_FILE_READ_OK;
   7.291      GMythFileTransferPrivate *priv;
   7.292  
   7.293      GError *error = NULL;
   7.294 @@ -636,7 +625,7 @@
   7.295      GString *query;
   7.296  
   7.297      g_return_val_if_fail (transfer != NULL, FALSE);
   7.298 -    g_return_val_if_fail (data != NULL, GMYTH_FILE_TRANSFER_READ_ERROR);
   7.299 +    g_return_val_if_fail (data != NULL, GMYTH_FILE_READ_ERROR);
   7.300  
   7.301      priv = GMYTH_FILE_TRANSFER_GET_PRIVATE (transfer);
   7.302  
   7.303 @@ -654,12 +643,12 @@
   7.304      io_cond_control = g_io_channel_get_buffer_condition( io_channel );
   7.305      if (priv->sock == NULL || ( io_status == G_IO_STATUS_ERROR ) ) {
   7.306          g_printerr( "gmyth_file_transfer_read(): Called with no raw socket.\n" );
   7.307 -        return GMYTH_FILE_TRANSFER_READ_ERROR;
   7.308 +        return GMYTH_FILE_READ_ERROR;
   7.309      }
   7.310  
   7.311      if (priv->control_sock == NULL || ( io_status_control == G_IO_STATUS_ERROR ) ) {
   7.312          g_printerr( "gmyth_file_transfer_read(): Called with no control socket.\n" );
   7.313 -        return GMYTH_FILE_TRANSFER_READ_ERROR;
   7.314 +        return GMYTH_FILE_READ_ERROR;
   7.315      }
   7.316  
   7.317      query = g_string_new (GMYTHTV_QUERY_HEADER);
   7.318 @@ -708,22 +697,24 @@
   7.319              gmyth_debug ("Error on io_channel");
   7.320              g_free (data_buffer);
   7.321              g_object_unref (strlist);
   7.322 -            retval = GMYTH_FILE_TRANSFER_READ_ERROR;
   7.323 +            retval = GMYTH_FILE_READ_ERROR;
   7.324              goto error;
   7.325          }
   7.326  
   7.327          /* append new data to the increasing byte array */
   7.328          data = g_byte_array_append (data, (const guint8*)data_buffer, bytes_read);
   7.329 -        priv->offset += bytes_read;
   7.330 +        gmyth_file_set_offset( GMYTH_FILE(transfer),  
   7.331 +                gmyth_file_get_offset( GMYTH_FILE(transfer) ) + bytes_read );
   7.332  
   7.333 -        if (!read_unlimited && (priv->filesize > 0) && (priv->offset == priv->filesize)) {
   7.334 -            retval = GMYTH_FILE_TRANSFER_READ_EOF;
   7.335 +        if ( !read_unlimited && ( gmyth_file_get_filesize( GMYTH_FILE(transfer) ) > 0 ) && 
   7.336 +                ( gmyth_file_get_offset( GMYTH_FILE(transfer) ) == gmyth_file_get_filesize( GMYTH_FILE(transfer) ) ) ) {
   7.337 +            retval = GMYTH_FILE_READ_EOF;
   7.338              goto error;
   7.339          }
   7.340          
   7.341          g_free (data_buffer);
   7.342      } else { 
   7.343 -        retval = GMYTH_FILE_TRANSFER_READ_ERROR;
   7.344 +        retval = GMYTH_FILE_READ_ERROR;
   7.345      }
   7.346  
   7.347      if (strlist!=NULL)
   7.348 @@ -744,11 +735,12 @@
   7.349  		if (priv->recorder != NULL &&
   7.350  			priv->do_next_program_chain)
   7.351  		{
   7.352 -		    retval = GMYTH_FILE_TRANSFER_READ_NEXT_PROG_CHAIN;
   7.353 +		    retval = GMYTH_FILE_READ_NEXT_PROG_CHAIN;
   7.354  	  		GMythProgramInfo *prog_info = gmyth_recorder_get_current_program_info (priv->recorder);
   7.355  	  		
   7.356  	  		if (prog_info != NULL && prog_info->pathname != NULL && strlen( prog_info->pathname->str ) > 0 &&
   7.357 -	  						g_ascii_strcasecmp( prog_info->pathname->str, priv->filename ) != 0 )
   7.358 +	  						g_ascii_strcasecmp( prog_info->pathname->str, 
   7.359 +                                    gmyth_file_get_file_name( GMYTH_FILE(transfer) ) ) != 0 )
   7.360  	  			ret = gmyth_file_transfer_open (transfer, g_strrstr( prog_info->pathname->str, "/" ) );
   7.361  	  		
   7.362  	  		if (prog_info != NULL )
   7.363 @@ -758,7 +750,7 @@
   7.364  				gmyth_debug( "Cannot change to the next program info!" );
   7.365  			else
   7.366  				gmyth_debug( "OK!!! MOVED to the next program info [%s]!", 
   7.367 -										priv->filename );						
   7.368 +										gmyth_file_get_file_name( GMYTH_FILE(transfer) ) );						
   7.369  		}
   7.370  
   7.371      } /* if */
   7.372 @@ -775,12 +767,12 @@
   7.373      }
   7.374    
   7.375      if ( total_read > 0 )
   7.376 -  	    priv->offset += total_read;  	
   7.377 +  	    gmyth_file_set_offset( GMYTH_FILE(transfer), 
   7.378 +                gmyth_file_get_offset( GMYTH_FILE(transfer) ) + total_read );  	
   7.379    	
   7.380      return retval;
   7.381  }
   7.382  
   7.383 -
   7.384  static void 
   7.385  _file_transfer_program_info_changed( GMythFileTransfer *transfer, 
   7.386  									gint msg_code, gpointer livetv_recorder )
   7.387 @@ -864,10 +856,11 @@
   7.388  guint64
   7.389  gmyth_file_transfer_get_filesize (GMythFileTransfer *transfer)
   7.390  {
   7.391 -    GMythFileTransferPrivate *priv;
   7.392 +    guint64 filesize;
   7.393 +    
   7.394 +    g_return_val_if_fail (transfer != NULL, 0);
   7.395 +    
   7.396 +    g_object_get( GMYTH_FILE(transfer), "file-size", &filesize, NULL );
   7.397  
   7.398 -    g_return_val_if_fail (transfer != NULL, 0);
   7.399 -
   7.400 -    priv = GMYTH_FILE_TRANSFER_GET_PRIVATE (transfer);
   7.401 -    return priv->filesize;
   7.402 +    return filesize;
   7.403  }
     8.1 --- a/gmyth/src/gmyth_file_transfer.h	Fri Apr 13 14:54:52 2007 +0100
     8.2 +++ b/gmyth/src/gmyth_file_transfer.h	Fri Apr 13 20:07:32 2007 +0100
     8.3 @@ -32,6 +32,7 @@
     8.4  #include <glib-object.h>
     8.5  #include <glib.h>
     8.6  
     8.7 +#include "gmyth_file.h"
     8.8  #include "gmyth_socket.h"
     8.9  #include "gmyth_uri.h"
    8.10  #include "gmyth_backendinfo.h"
    8.11 @@ -48,31 +49,23 @@
    8.12  #define GMYTH_FILE_TRANSFER_TYPE               (gmyth_file_transfer_get_type ())
    8.13  #define GMYTH_FILE_TRANSFER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransfer))
    8.14  #define GMYTH_FILE_TRANSFER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransferClass))
    8.15 -#define IS_GMYTH_FILE_TRANSFER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_FILE_TRANSFER_TYPE))
    8.16 +#define IS_GMYTH_FILE_TRANSFER(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_FILE_TRANSFER_TYPE))
    8.17  #define IS_GMYTH_FILE_TRANSFER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_TRANSFER_TYPE))
    8.18  #define GMYTH_FILE_TRANSFER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransferClass))
    8.19  
    8.20 -typedef enum {
    8.21 -    GMYTH_FILE_TRANSFER_READ_OK                 = 0,
    8.22 -	GMYTH_FILE_TRANSFER_READ_NEXT_PROG_CHAIN    = 1,
    8.23 -	GMYTH_FILE_TRANSFER_READ_ERROR              = 2,
    8.24 -	GMYTH_FILE_TRANSFER_READ_EOF                = 3
    8.25 -} GMythFileTransferReadResult;
    8.26 -
    8.27 -
    8.28  typedef struct _GMythFileTransfer         GMythFileTransfer;
    8.29  typedef struct _GMythFileTransferClass    GMythFileTransferClass;
    8.30  typedef struct _GMythFileTransferPrivate  GMythFileTransferPrivate;
    8.31  
    8.32  struct _GMythFileTransfer
    8.33  {
    8.34 -	GObject 				parent;
    8.35 +	GMythFile 				 parent;
    8.36 +    GMythFileTransferPrivate *priv;
    8.37  };
    8.38  
    8.39 -
    8.40  struct _GMythFileTransferClass
    8.41  {
    8.42 -	GObjectClass parent_class;
    8.43 +	GMythFileClass parent_class;
    8.44  
    8.45  	/* callbacks */
    8.46  	guint program_info_changed_handler_signal_id;
    8.47 @@ -90,7 +83,7 @@
    8.48                                  					     const gchar* filename);
    8.49  void                gmyth_file_transfer_close           (GMythFileTransfer *transfer);
    8.50  gboolean            gmyth_file_transfer_is_open         (GMythFileTransfer *transfer);
    8.51 -GMythFileTransferReadResult
    8.52 +GMythFileReadResult
    8.53                      gmyth_file_transfer_read            (GMythFileTransfer *transfer, 
    8.54                                                           GByteArray *data, 
    8.55                                                           gint size, 
     9.1 --- a/gmyth/src/gmyth_livetv.h	Fri Apr 13 14:54:52 2007 +0100
     9.2 +++ b/gmyth/src/gmyth_livetv.h	Fri Apr 13 20:07:32 2007 +0100
     9.3 @@ -43,7 +43,7 @@
     9.4  #define GMYTH_LIVETV_TYPE               (gmyth_livetv_get_type ())
     9.5  #define GMYTH_LIVETV(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_LIVETV_TYPE, GMythLiveTV))
     9.6  #define GMYTH_LIVETV_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_LIVETV_TYPE, GMythLiveTVClass))
     9.7 -#define IS_GMYTH_LIVETV(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_LIVETV_TYPE))
     9.8 +#define IS_GMYTH_LIVETV(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_LIVETV_TYPE))
     9.9  #define IS_GMYTH_LIVETV_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_LIVETV_TYPE))
    9.10  #define GMYTH_LIVETV_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_LIVETV_TYPE, GMythLiveTVClass))
    9.11  
    10.1 --- a/gmyth/src/gmyth_monitor_handler.c	Fri Apr 13 14:54:52 2007 +0100
    10.2 +++ b/gmyth/src/gmyth_monitor_handler.c	Fri Apr 13 20:07:32 2007 +0100
    10.3 @@ -149,18 +149,19 @@
    10.4  
    10.5  	monitor->allow_msgs_listener = FALSE;
    10.6  
    10.7 +    /* mutex to control access to the event socket consumer thread */
    10.8 +    if ( monitor->mutex != NULL )
    10.9 +    {
   10.10 +        g_mutex_unlock( monitor->mutex );
   10.11 +        g_mutex_free( monitor->mutex );
   10.12 +        monitor->mutex = NULL;
   10.13 +    }
   10.14 +
   10.15  	if (monitor->sid_io_watch != -1)
   10.16  	{
   10.17          g_source_remove (monitor->sid_io_watch);
   10.18  	}
   10.19  
   10.20 -    /* mutex to control access to the event socket consumer thread */
   10.21 -    if ( monitor->mutex != NULL )
   10.22 -    {
   10.23 -    	g_mutex_free( monitor->mutex );
   10.24 -  	    monitor->mutex = NULL;
   10.25 -    }
   10.26 -	
   10.27      if ( monitor->event_sock != NULL )  
   10.28      {
   10.29    	    g_object_unref( monitor->event_sock );
    11.1 --- a/gmyth/src/gmyth_monitor_handler.h	Fri Apr 13 14:54:52 2007 +0100
    11.2 +++ b/gmyth/src/gmyth_monitor_handler.h	Fri Apr 13 20:07:32 2007 +0100
    11.3 @@ -48,7 +48,7 @@
    11.4  #define GMYTH_MONITOR_HANDLER_TYPE               (gmyth_monitor_handler_get_type ())
    11.5  #define GMYTH_MONITOR_HANDLER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_MONITOR_HANDLER_TYPE, GMythMonitorHandler))
    11.6  #define GMYTH_MONITOR_HANDLER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_MONITOR_HANDLER_TYPE, GMythMonitorHandlerClass))
    11.7 -#define IS_GMYTH_MONITOR_HANDLER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_MONITOR_HANDLER_TYPE))
    11.8 +#define IS_GMYTH_MONITOR_HANDLER(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_MONITOR_HANDLER_TYPE))
    11.9  #define IS_GMYTH_MONITOR_HANDLER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_MONITOR_HANDLER_TYPE))
   11.10  #define GMYTH_MONITOR_HANDLER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_MONITOR_HANDLER_TYPE, GMythMonitorHandlerClass))
   11.11  
    12.1 --- a/gmyth/src/gmyth_programinfo.h	Fri Apr 13 14:54:52 2007 +0100
    12.2 +++ b/gmyth/src/gmyth_programinfo.h	Fri Apr 13 20:07:32 2007 +0100
    12.3 @@ -41,7 +41,7 @@
    12.4  #define GMYTH_PROGRAM_INFO_TYPE               (gmyth_program_info_get_type ())
    12.5  #define GMYTH_PROGRAM_INFO(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_PROGRAM_INFO_TYPE, GMythProgramInfo))
    12.6  #define GMYTH_PROGRAM_INFO_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_PROGRAM_INFO_TYPE, GMythProgramInfoClass))
    12.7 -#define IS_GMYTH_PROGRAM_INFO(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_PROGRAM_INFO_TYPE))
    12.8 +#define IS_GMYTH_PROGRAM_INFO(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_PROGRAM_INFO_TYPE))
    12.9  #define IS_GMYTH_PROGRAM_INFO_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_PROGRAM_INFO_TYPE))
   12.10  #define GMYTH_PROGRAM_INFO_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_PROGRAM_INFO_TYPE, GMythProgramInfoClass))
   12.11  
    13.1 --- a/gmyth/src/gmyth_query.h	Fri Apr 13 14:54:52 2007 +0100
    13.2 +++ b/gmyth/src/gmyth_query.h	Fri Apr 13 20:07:32 2007 +0100
    13.3 @@ -41,7 +41,7 @@
    13.4  #define GMYTH_QUERY_TYPE               (gmyth_query_get_type ())
    13.5  #define GMYTH_QUERY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_QUERY_TYPE, GMythQuery))
    13.6  #define GMYTH_QUERY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_QUERY_TYPE, GMythQueryClass))
    13.7 -#define IS_GMYTH_QUERY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_QUERY_TYPE))
    13.8 +#define IS_GMYTH_QUERY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_QUERY_TYPE))
    13.9  #define IS_GMYTH_QUERY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_QUERY_TYPE))
   13.10  #define GMYTH_QUERY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_QUERY_TYPE, GMythQueryClass))
   13.11  
    14.1 --- a/gmyth/src/gmyth_recorder.c	Fri Apr 13 14:54:52 2007 +0100
    14.2 +++ b/gmyth/src/gmyth_recorder.c	Fri Apr 13 20:07:32 2007 +0100
    14.3 @@ -106,9 +106,14 @@
    14.4  {
    14.5      if ( recorder != NULL && recorder->recorder_num != -1 )
    14.6      {
    14.7 +        g_mutex_lock( recorder->mutex );
    14.8 +
    14.9          gmyth_recorder_stop_playing(recorder);
   14.10 +        gmyth_recorder_stop_livetv(recorder);
   14.11          gmyth_recorder_finish_recording(recorder);
   14.12          gmyth_recorder_free_tuner(recorder);
   14.13 +
   14.14 +        g_mutex_unlock( recorder->mutex );
   14.15      }
   14.16  }
   14.17  
   14.18 @@ -283,8 +288,6 @@
   14.19  
   14.20      str_list = gmyth_string_list_new ();
   14.21      
   14.22 -    g_mutex_lock( recorder->mutex );
   14.23 -
   14.24      g_string_append_printf ( tmp_str, " %d", recorder->recorder_num );
   14.25  
   14.26      gmyth_string_list_append_string (str_list, tmp_str);
   14.27 @@ -303,7 +306,6 @@
   14.28      }
   14.29  
   14.30  cleanup:
   14.31 -    g_mutex_unlock( recorder->mutex );
   14.32      g_string_free (tmp_str, TRUE);
   14.33      g_object_unref (str_list);
   14.34  
   14.35 @@ -1033,8 +1035,6 @@
   14.36      GMythStringList *str_list = gmyth_string_list_new();
   14.37      GString *message = g_string_new("");
   14.38      
   14.39 -    g_mutex_lock( recorder->mutex );
   14.40 -
   14.41      g_string_printf( message, "%s %d", GMYTHTV_RECORDER_HEADER,
   14.42              recorder->recorder_num);
   14.43      gmyth_string_list_append_string(str_list, message);
   14.44 @@ -1057,8 +1057,6 @@
   14.45  
   14.46      gmyth_debug( "%s, stream is %s finished!\n", ret ? "YES" : "NO", ret ? "" : "NOT" );
   14.47      //g_static_mutex_unlock (&mutex);
   14.48 -    
   14.49 -    g_mutex_unlock( recorder->mutex );
   14.50  
   14.51      if ( str_list != NULL )
   14.52          g_object_unref (str_list);
   14.53 @@ -1085,8 +1083,6 @@
   14.54      GMythStringList *str_list = gmyth_string_list_new();
   14.55      GString *message = g_string_new("");
   14.56      
   14.57 -    g_mutex_lock( recorder->mutex );
   14.58 -
   14.59      g_string_printf( message, "%s %d", GMYTHTV_RECORDER_HEADER,
   14.60              recorder->recorder_num);
   14.61      gmyth_string_list_append_string(str_list, message);
   14.62 @@ -1108,7 +1104,6 @@
   14.63      }
   14.64  
   14.65      gmyth_debug( "%s, stream is %s stopped!\n", ret ? "YES" : "NO", ret ? "" : "NOT" );
   14.66 -    g_mutex_unlock ( recorder->mutex );
   14.67  
   14.68      if ( str_list != NULL )
   14.69          g_object_unref (str_list);
   14.70 @@ -1134,8 +1129,6 @@
   14.71      GMythStringList *str_list = gmyth_string_list_new();
   14.72      GString *message = g_string_new("");
   14.73      
   14.74 -    g_mutex_lock( recorder->mutex );
   14.75 -
   14.76      g_string_printf( message, "%s %d", "FREE_TUNER", recorder->recorder_num );
   14.77      gmyth_string_list_append_string(str_list, message);
   14.78  
   14.79 @@ -1155,7 +1148,6 @@
   14.80      }
   14.81  
   14.82      gmyth_debug( "%s, tuner is %s freed!\n", ret ? "YES" : "NO", ret ? "" : "NOT" );
   14.83 -    g_mutex_unlock ( recorder->mutex );
   14.84  
   14.85      if ( str_list != NULL )
   14.86          g_object_unref (str_list);
    15.1 --- a/gmyth/src/gmyth_recorder.h	Fri Apr 13 14:54:52 2007 +0100
    15.2 +++ b/gmyth/src/gmyth_recorder.h	Fri Apr 13 20:07:32 2007 +0100
    15.3 @@ -48,7 +48,7 @@
    15.4  #define GMYTH_RECORDER_TYPE               (gmyth_recorder_get_type ())
    15.5  #define GMYTH_RECORDER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_RECORDER_TYPE, GMythRecorder))
    15.6  #define GMYTH_RECORDER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_RECORDER_TYPE, GMythRecorderClass))
    15.7 -#define IS_GMYTH_RECORDER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_RECORDER_TYPE))
    15.8 +#define IS_GMYTH_RECORDER(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_RECORDER_TYPE))
    15.9  #define IS_GMYTH_RECORDER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_RECORDER_TYPE))
   15.10  #define GMYTH_RECORDER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_RECORDER_TYPE, GMythRecorderClass))
   15.11  
    16.1 --- a/gmyth/src/gmyth_recprofile.h	Fri Apr 13 14:54:52 2007 +0100
    16.2 +++ b/gmyth/src/gmyth_recprofile.h	Fri Apr 13 20:07:32 2007 +0100
    16.3 @@ -41,7 +41,7 @@
    16.4  #define GMYTH_RECPROFILE_TYPE               (gmyth_recprofile_get_type ())
    16.5  #define GMYTH_RECPROFILE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_RECPROFILE_TYPE, GMythRecProfile))
    16.6  #define GMYTH_RECPROFILE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_RECPROFILE_TYPE, GMythRecProfileClass))
    16.7 -#define IS_GMYTH_RECPROFILE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_RECPROFILE_TYPE))
    16.8 +#define IS_GMYTH_RECPROFILE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_RECPROFILE_TYPE))
    16.9  #define IS_GMYTH_RECPROFILE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_RECPROFILE_TYPE))
   16.10  #define GMYTH_RECPROFILE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_RECPROFILE_TYPE, GMythRecProfileClass))
   16.11  
    17.1 --- a/gmyth/src/gmyth_scheduler.h	Fri Apr 13 14:54:52 2007 +0100
    17.2 +++ b/gmyth/src/gmyth_scheduler.h	Fri Apr 13 20:07:32 2007 +0100
    17.3 @@ -41,7 +41,7 @@
    17.4  #define GMYTH_SCHEDULER_TYPE               (gmyth_scheduler_get_type ())
    17.5  #define GMYTH_SCHEDULER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_SCHEDULER_TYPE, GMythScheduler))
    17.6  #define GMYTH_SCHEDULER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_SCHEDULER_TYPE, GMythSchedulerClass))
    17.7 -#define IS_GMYTH_SCHEDULER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_SCHEDULER_TYPE))
    17.8 +#define IS_GMYTH_SCHEDULER(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_SCHEDULER_TYPE))
    17.9  #define IS_GMYTH_SCHEDULER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_SCHEDULER_TYPE))
   17.10  #define GMYTH_SCHEDULER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_SCHEDULER_TYPE, GMythSchedulerClass))
   17.11  
    18.1 --- a/gmyth/src/gmyth_socket.h	Fri Apr 13 14:54:52 2007 +0100
    18.2 +++ b/gmyth/src/gmyth_socket.h	Fri Apr 13 20:07:32 2007 +0100
    18.3 @@ -48,7 +48,7 @@
    18.4  #define GMYTH_SOCKET_TYPE               (gmyth_socket_get_type ())
    18.5  #define GMYTH_SOCKET(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_SOCKET_TYPE, GMythSocket))
    18.6  #define GMYTH_SOCKET_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_SOCKET_TYPE, GMythSocketClass))
    18.7 -#define IS_GMYTH_SOCKET(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_SOCKET_TYPE))
    18.8 +#define IS_GMYTH_SOCKET(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_SOCKET_TYPE))
    18.9  #define IS_GMYTH_SOCKET_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_SOCKET_TYPE))
   18.10  #define GMYTH_SOCKET_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_SOCKET_TYPE, GMythSocketClass))
   18.11  
    19.1 --- a/gmyth/src/gmyth_stringlist.h	Fri Apr 13 14:54:52 2007 +0100
    19.2 +++ b/gmyth/src/gmyth_stringlist.h	Fri Apr 13 20:07:32 2007 +0100
    19.3 @@ -43,7 +43,7 @@
    19.4  #define GMYTH_STRING_LIST_TYPE               (gmyth_string_list_get_type ())
    19.5  #define GMYTH_STRING_LIST(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_STRING_LIST_TYPE, GMythStringList))
    19.6  #define GMYTH_STRING_LIST_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_STRING_LIST_TYPE, GMythStringListClass))
    19.7 -#define IS_GMYTH_STRING_LIST(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_STRING_LIST_TYPE))
    19.8 +#define IS_GMYTH_STRING_LIST(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_STRING_LIST_TYPE))
    19.9  #define IS_GMYTH_STRING_LIST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_STRING_LIST_TYPE))
   19.10  #define GMYTH_STRING_LIST_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_STRING_LIST_TYPE, GMythStringListClass))
   19.11  
    20.1 --- a/gmyth/src/gmyth_transcoder.h	Fri Apr 13 14:54:52 2007 +0100
    20.2 +++ b/gmyth/src/gmyth_transcoder.h	Fri Apr 13 20:07:32 2007 +0100
    20.3 @@ -43,7 +43,7 @@
    20.4  #define GMYTH_TRANSCODER_TYPE               (gmyth_transcoder_get_type ())
    20.5  #define GMYTH_TRANSCODER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_TRANSCODER_TYPE, GMythTranscoder))
    20.6  #define GMYTH_TRANSCODER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_TRANSCODER_TYPE, GMythTranscoderClass))
    20.7 -#define IS_GMYTH_TRANSCODER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_TRANSCODER_TYPE))
    20.8 +#define IS_GMYTH_TRANSCODER(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_TRANSCODER_TYPE))
    20.9  #define IS_GMYTH_TRANSCODER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_TRANSCODER_TYPE))
   20.10  #define GMYTH_TRANSCODER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_TRANSCODER_TYPE, GMythTranscoderClass))
   20.11  
    21.1 --- a/gmyth/src/gmyth_tvchain.h	Fri Apr 13 14:54:52 2007 +0100
    21.2 +++ b/gmyth/src/gmyth_tvchain.h	Fri Apr 13 20:07:32 2007 +0100
    21.3 @@ -40,7 +40,7 @@
    21.4  #define GMYTH_TVCHAIN_TYPE               (gmyth_tvchain_get_type ())
    21.5  #define GMYTH_TVCHAIN(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_TVCHAIN_TYPE, GMythTVChain))
    21.6  #define GMYTH_TVCHAIN_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_TVCHAIN_TYPE, GMythTVChainClass))
    21.7 -#define IS_GMYTH_TVCHAIN(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_TVCHAIN_TYPE))
    21.8 +#define IS_GMYTH_TVCHAIN(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_TVCHAIN_TYPE))
    21.9  #define IS_GMYTH_TVCHAIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_TVCHAIN_TYPE))
   21.10  #define GMYTH_TVCHAIN_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_TVCHAIN_TYPE, GMythTVChainClass))
   21.11  
    22.1 --- a/gmyth/src/gmyth_uri.h	Fri Apr 13 14:54:52 2007 +0100
    22.2 +++ b/gmyth/src/gmyth_uri.h	Fri Apr 13 20:07:32 2007 +0100
    22.3 @@ -42,7 +42,7 @@
    22.4  #define GMYTH_URI_TYPE               (gmyth_uri_get_type ())
    22.5  #define GMYTH_URI(obj)          		 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_URI_TYPE, GMythURI))
    22.6  #define GMYTH_URI_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_URI_TYPE, GMythURIClass))
    22.7 -#define IS_GMYTH_URI(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_URI_TYPE))
    22.8 +#define IS_GMYTH_URI(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_URI_TYPE))
    22.9  #define IS_GMYTH_URI_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_URI_TYPE))
   22.10  #define GMYTH_URI_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_URI_TYPE, GMythURIClass))
   22.11