1.1 --- a/gmyth/src/gmyth_file.c Thu Apr 12 14:58:13 2007 +0100
1.2 +++ b/gmyth/src/gmyth_file.c Fri Apr 13 20:07:32 2007 +0100
1.3 @@ -68,6 +68,7 @@
1.4
1.5 enum
1.6 {
1.7 + PROP_GMYTH_FILE_DUMMY,
1.8 PROP_GMYTH_FILE_FILENAME,
1.9 PROP_GMYTH_FILE_OFFSET,
1.10 PROP_GMYTH_FILE_FILESIZE,
1.11 @@ -85,7 +86,7 @@
1.12 static void gmyth_file_dispose (GObject *object);
1.13 static void gmyth_file_finalize (GObject *object);
1.14
1.15 -G_DEFINE_TYPE(GMythFile, gmyth_file, GMYTH_FILE_TYPE)
1.16 +G_DEFINE_TYPE(GMythFile, gmyth_file, G_TYPE_OBJECT)
1.17
1.18 static void
1.19 gmyth_file_class_init (GMythFileClass *klass)
1.20 @@ -104,31 +105,36 @@
1.21
1.22 g_object_class_install_property
1.23 (gobject_class, PROP_GMYTH_FILE_FILENAME,
1.24 - g_param_spec_string ("filename", "Filename",
1.25 + g_param_spec_string ("filename", "filename",
1.26 "The file name.",
1.27 - "", G_PARAM_READWRITE));
1.28 + "", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB |
1.29 + G_PARAM_READABLE | G_PARAM_WRITABLE));
1.30
1.31 g_object_class_install_property
1.32 (gobject_class, PROP_GMYTH_FILE_OFFSET,
1.33 g_param_spec_int64 ("file-offset", "file-offset",
1.34 - "The offset (position) of this file", 0, G_MAXINT64, 0, G_PARAM_READWRITE));
1.35 + "The offset (position) of this file", 0, G_MAXINT64, 0, G_PARAM_STATIC_NAME |
1.36 + G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
1.37
1.38 g_object_class_install_property
1.39 (gobject_class, PROP_GMYTH_FILE_FILESIZE,
1.40 g_param_spec_uint64 ("file-size", "file-size",
1.41 "The file size in bytes",
1.42 - 0, G_MAXUINT64, 0, G_PARAM_READWRITE));
1.43 + 0, G_MAXUINT64, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB |
1.44 + G_PARAM_READABLE | G_PARAM_WRITABLE));
1.45
1.46 g_object_class_install_property
1.47 (gobject_class, PROP_GMYTH_FILE_BACKEND_INFO,
1.48 g_param_spec_object ("backend-info", "backend-info",
1.49 "The Backend Information about the remote server",
1.50 - G_TYPE_OBJECT, G_PARAM_READWRITE));
1.51 + G_TYPE_OBJECT, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
1.52 + G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
1.53
1.54 g_object_class_install_property
1.55 (gobject_class, PROP_GMYTH_FILE_FILEID,
1.56 g_param_spec_int ("file-id", "file-id",
1.57 - "The file ID", 0, G_MAXINT, 0, G_PARAM_READWRITE));
1.58 + "The file ID", 0, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
1.59 + G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
1.60
1.61 g_type_class_add_private (gobject_class, sizeof (GMythFilePrivate));
1.62
1.63 @@ -137,10 +143,9 @@
1.64 static void
1.65 gmyth_file_init (GMythFile *file)
1.66 {
1.67 - GMythFilePrivate *priv;
1.68 g_return_if_fail( file != NULL );
1.69
1.70 - priv = GMYTH_FILE_GET_PRIVATE(file);
1.71 + file->priv = GMYTH_FILE_GET_PRIVATE(file);
1.72 }
1.73
1.74 static void
1.75 @@ -193,24 +198,28 @@
1.76 GMythFile*
1.77 gmyth_file_new (GMythBackendInfo *backend_info)
1.78 {
1.79 - GMythFile *file = GMYTH_FILE (g_object_new (GMYTH_FILE_TYPE, NULL));
1.80 + GMythFile *file = NULL;
1.81 +
1.82 + g_return_val_if_fail (backend_info != NULL, NULL);
1.83
1.84 - g_object_set(G_OBJECT (file), "backend-info", &backend_info, NULL);
1.85 + GParameter * __params = g_new0 (GParameter, 1);
1.86 + GParameter * __params_it = __params;
1.87
1.88 + (__params_it->name = "backend-info", g_value_init (&__params_it->value, G_TYPE_OBJECT),
1.89 + g_value_set_object (&__params_it->value, backend_info), __params_it++);
1.90 + file = g_object_newv (GMYTH_FILE_TYPE, __params_it - __params, __params);
1.91 +
1.92 return file;
1.93 }
1.94
1.95 gchar*
1.96 gmyth_file_get_file_name (GMythFile *file)
1.97 {
1.98 - gchar *filename;
1.99 + GMythFilePrivate *priv = GMYTH_FILE_GET_PRIVATE(file);
1.100 +
1.101 + g_return_val_if_fail( file != NULL, NULL );
1.102
1.103 - g_return_val_if_fail( file != NULL, NULL );
1.104 - g_return_val_if_fail( filename != NULL, NULL );
1.105 -
1.106 - g_object_get(G_OBJECT (file), "filename", &filename, NULL);
1.107 -
1.108 - return filename;
1.109 + return priv->filename;
1.110 }
1.111
1.112 void
1.113 @@ -219,8 +228,11 @@
1.114 g_return_if_fail( file != NULL );
1.115 g_return_if_fail( filename != NULL );
1.116
1.117 - g_object_set (G_OBJECT (file), "filename", &filename, NULL);
1.118 -
1.119 + gchar* __temp2 = NULL;
1.120 + const gchar* __temp1 = NULL;
1.121 + file->priv->filename = (__temp2 = (__temp1 = filename, (__temp1 == NULL ?
1.122 + NULL : g_strdup (__temp1))), (file->priv->filename == NULL ?
1.123 + NULL : (file->priv->filename = (g_free (file->priv->filename), NULL))), __temp2);
1.124 }
1.125
1.126 /**
1.127 @@ -332,12 +344,9 @@
1.128 gint64
1.129 gmyth_file_get_offset (GMythFile *file)
1.130 {
1.131 - GMythFilePrivate *priv;
1.132 -
1.133 g_return_val_if_fail (file != NULL, 0);
1.134
1.135 - priv = GMYTH_FILE_GET_PRIVATE (file);
1.136 - return priv->offset;
1.137 + return file->priv->offset;
1.138 }
1.139
1.140 /**
1.141 @@ -369,10 +378,10 @@
1.142 break;
1.143 }
1.144
1.145 - //if (priv->filename != NULL) {
1.146 - // g_free (priv->filename);
1.147 - // priv->filename = NULL;
1.148 - //}
1.149 + if (priv->filename != NULL) {
1.150 + g_free (priv->filename);
1.151 + priv->filename = NULL;
1.152 + }
1.153 priv->filename = g_value_dup_string (value);
1.154 gmyth_debug( "Changed the filename to [%s]!", priv->filename );
1.155 break;
1.156 @@ -393,10 +402,10 @@
1.157 break;
1.158 }
1.159
1.160 - //if (priv->backend_info != NULL) {
1.161 - // g_object_unref (priv->backend_info);
1.162 - // priv->backend_info = NULL;
1.163 - //}
1.164 + if (priv->backend_info != NULL) {
1.165 + g_object_unref (priv->backend_info);
1.166 + priv->backend_info = NULL;
1.167 + }
1.168 priv->backend_info = g_value_get_object (value);
1.169 gmyth_debug( "Changed the backend info to [%s]!", gmyth_backend_info_get_hostname( priv->backend_info ) );
1.170 break;