1.1 --- a/myth-dbus/src/gmyth-dbus-server.c Wed Oct 24 20:01:02 2007 +0100
1.2 +++ b/myth-dbus/src/gmyth-dbus-server.c Wed Oct 24 23:47:06 2007 +0100
1.3 @@ -1,11 +1,6 @@
1.4 /**
1.5 * GMyth Library
1.6 *
1.7 - * @file gmyth/gmyth_backend_info.c
1.8 - *
1.9 - * @brief <p> This component represents all the MythTV backend server
1.10 - * configuration information.
1.11 - *
1.12 * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
1.13 * @author Renato Filho <renato.filho@indt.org.br>
1.14 *
1.15 @@ -40,7 +35,6 @@
1.16
1.17 #define MYTH_DEFAULT_DB "mythconverg"
1.18
1.19 -
1.20 typedef struct _GMythDbusServerPrivate GMythDbusServerPrivate;
1.21
1.22 struct _GMythDbusServerPrivate
1.23 @@ -71,7 +65,7 @@
1.24 GError **error);
1.25 static gboolean gmyth_dbus_server_get_channel_info (GObject *obj,
1.26 gint channel_id,
1.27 - GValue **info,
1.28 + GValueArray **info,
1.29 GError **error);
1.30 static gboolean gmyth_dbus_server_file_exists (GObject *obj,
1.31 const gchar *file_name,
1.32 @@ -82,7 +76,7 @@
1.33 GError **error);
1.34 static gboolean gmyth_dbus_server_get_recorded_info (GObject *obj,
1.35 const gchar *basename,
1.36 - GValue **info,
1.37 + GValueArray **info,
1.38 GError **error);
1.39 static gboolean gmyth_dbus_server_get_program_list (GObject *obj,
1.40 gint channel_id,
1.41 @@ -294,6 +288,7 @@
1.42 gboolean ret = FALSE;
1.43 GMythSocket *socket;
1.44
1.45 + g_debug ("%s:%d", __FUNCTION__, __LINE__);
1.46 priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
1.47
1.48 g_return_val_if_fail (priv->myth_backend != NULL, FALSE);
1.49 @@ -334,13 +329,14 @@
1.50 static gboolean
1.51 gmyth_dbus_server_get_channel_info (GObject *obj,
1.52 gint channel_id,
1.53 - GValue **info,
1.54 + GValueArray **info,
1.55 GError **error)
1.56 {
1.57 GType ch_type;
1.58 GMythChannelInfo *ch_info;
1.59 GMythDbusServerPrivate *priv;
1.60
1.61 + g_debug ("%s:%d", __FUNCTION__, __LINE__);
1.62 priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
1.63
1.64 g_return_val_if_fail (priv->myth_backend != NULL, FALSE);
1.65 @@ -351,10 +347,12 @@
1.66 ch_info = gmyth_epg_get_channel_info (priv->myth_epg, channel_id);
1.67 if (ch_info)
1.68 {
1.69 - *info = g_new0 (GValue, 1);
1.70 - g_value_init (*info, ch_type);
1.71 - g_value_set_static_boxed (*info, dbus_g_type_specialized_construct (ch_type));
1.72 - gmyth_dbus_server_parse_channel_info (ch_info, *info);
1.73 + GValue v = { 0, };
1.74 + g_value_init (&v, ch_type);
1.75 + g_value_take_boxed (&v, dbus_g_type_specialized_construct (ch_type));
1.76 + gmyth_dbus_server_parse_channel_info (ch_info, &v);
1.77 +
1.78 + *info = g_value_get_boxed (&v);
1.79 return TRUE;
1.80 }
1.81
1.82 @@ -372,6 +370,8 @@
1.83 int len;
1.84 GType ch_type;
1.85 GMythDbusServerPrivate *priv;
1.86 +
1.87 + g_debug ("%s:%d", __FUNCTION__, __LINE__);
1.88 priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
1.89
1.90 g_return_val_if_fail (priv->myth_backend != NULL, FALSE);
1.91 @@ -391,7 +391,7 @@
1.92 data = (GMythChannelInfo *) walk->data;
1.93
1.94 g_value_init (&ch, ch_type);
1.95 - g_value_set_static_boxed (&ch, dbus_g_type_specialized_construct (ch_type));
1.96 + g_value_take_boxed (&ch, dbus_g_type_specialized_construct (ch_type));
1.97 gmyth_dbus_server_parse_channel_info (data, &ch);
1.98 g_ptr_array_add (*channels, g_value_get_boxed (&ch));
1.99 }
1.100 @@ -418,7 +418,7 @@
1.101
1.102 static gboolean
1.103 gmyth_dbus_server_get_program_list (GObject *obj,
1.104 - gint program_id,
1.105 + gint channel_id,
1.106 const gchar *start_time,
1.107 const gchar *end_time,
1.108 GPtrArray **programs)
1.109 @@ -431,6 +431,7 @@
1.110 GTimeVal end_time_val;
1.111 GMythDbusServerPrivate *priv;
1.112
1.113 + g_debug ("%s:%d", __FUNCTION__, __LINE__);
1.114 priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
1.115
1.116 g_return_val_if_fail (priv->myth_backend, FALSE);
1.117 @@ -440,9 +441,10 @@
1.118 g_time_val_from_iso8601 (start_time, &start_time_val);
1.119 g_time_val_from_iso8601 (end_time, &end_time_val);
1.120
1.121 + list = NULL;
1.122 len = gmyth_epg_get_program_list (priv->myth_epg,
1.123 &list,
1.124 - program_id,
1.125 + channel_id,
1.126 &start_time_val,
1.127 &end_time_val);
1.128
1.129 @@ -459,8 +461,8 @@
1.130 data = (GMythProgramInfo *) walk->data;
1.131
1.132 g_value_init (&program, program_type);
1.133 - g_value_set_static_boxed (&program,
1.134 - dbus_g_type_specialized_construct (program_type));
1.135 + g_value_take_boxed (&program,
1.136 + dbus_g_type_specialized_construct (program_type));
1.137
1.138 start_str = g_time_val_to_iso8601 (data->startts);
1.139 end_str = g_time_val_to_iso8601 (data->endts);
1.140 @@ -481,7 +483,6 @@
1.141 }
1.142
1.143 gmyth_free_program_list (list);
1.144 -
1.145 return TRUE;
1.146 }
1.147
1.148 @@ -494,6 +495,7 @@
1.149
1.150 start_str = g_time_val_to_iso8601 (info->start_time);
1.151 end_str = g_time_val_to_iso8601 (info->end_time);
1.152 +
1.153 dbus_g_type_struct_set (val,
1.154 0, info->record_id,
1.155 1, info->program_id,
1.156 @@ -507,7 +509,6 @@
1.157 9, info->basename->str,
1.158 10, info->filesize,
1.159 G_MAXUINT);
1.160 -
1.161 g_free (start_str);
1.162 g_free (end_str);
1.163 }
1.164 @@ -515,13 +516,15 @@
1.165 static gboolean
1.166 gmyth_dbus_server_get_recorded_info (GObject *obj,
1.167 const gchar *basename,
1.168 - GValue **info,
1.169 + GValueArray **info,
1.170 GError **error)
1.171 {
1.172 GType record_type;
1.173 GMythDbusServerPrivate *priv;
1.174 RecordedInfo *record_info;
1.175
1.176 +
1.177 + g_debug ("%s:%d", __FUNCTION__, __LINE__);
1.178 priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
1.179
1.180 g_return_val_if_fail (priv->myth_backend, FALSE);
1.181 @@ -534,14 +537,17 @@
1.182
1.183 if (record_info)
1.184 {
1.185 - *info = g_new0 (GValue, 1);
1.186 - g_value_init (*info, record_type);
1.187 - g_value_set_static_boxed (*info,
1.188 - dbus_g_type_specialized_construct (record_type));
1.189 - gmyth_dbus_server_parse_recorded_info (record_info, *info);
1.190 + GValue r = { 0, };
1.191
1.192 + g_value_init (&r, record_type);
1.193 + g_value_take_boxed (&r,
1.194 + dbus_g_type_specialized_construct (record_type));
1.195 +
1.196 + gmyth_dbus_server_parse_recorded_info (record_info, &r);
1.197 gmyth_recorded_info_free (record_info);
1.198
1.199 + *info = g_value_get_boxed (&r);
1.200 +
1.201 return TRUE;
1.202 }
1.203
1.204 @@ -560,6 +566,7 @@
1.205 GType record_type;
1.206 GMythDbusServerPrivate *priv;
1.207
1.208 + g_debug ("%s:%d", __FUNCTION__, __LINE__);
1.209 priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
1.210
1.211 g_return_val_if_fail (priv->myth_backend, FALSE);
1.212 @@ -569,8 +576,8 @@
1.213 len = gmyth_scheduler_get_recorded_list (priv->myth_scheduler,
1.214 &list);
1.215
1.216 + record_type = GMYTH_DBUS_RECORD_G_TYPE;
1.217 *records = g_ptr_array_sized_new (len);
1.218 - record_type = GMYTH_DBUS_RECORD_G_TYPE;
1.219
1.220 for (walk = list; walk != NULL; walk = walk->next)
1.221 {
1.222 @@ -580,9 +587,11 @@
1.223 data = (RecordedInfo *) walk->data;
1.224
1.225 g_value_init (&record, record_type);
1.226 - g_value_set_static_boxed (&record,
1.227 - dbus_g_type_specialized_construct (record_type));
1.228 + g_value_take_boxed (&record,
1.229 + dbus_g_type_specialized_construct (record_type));
1.230 +
1.231 gmyth_dbus_server_parse_recorded_info (data, &record);
1.232 +
1.233 g_ptr_array_add (*records, g_value_get_boxed (&record));
1.234 }
1.235
1.236 @@ -602,6 +611,7 @@
1.237 GType schedule_type;
1.238 GMythDbusServerPrivate *priv;
1.239
1.240 + g_debug ("%s:%d", __FUNCTION__, __LINE__);
1.241 priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
1.242
1.243 g_return_val_if_fail (priv->myth_backend, FALSE);
1.244 @@ -624,8 +634,8 @@
1.245 data = (ScheduleInfo *) walk->data;
1.246
1.247 g_value_init (&schedule, schedule_type);
1.248 - g_value_set_static_boxed (&schedule,
1.249 - dbus_g_type_specialized_construct (schedule_type));
1.250 + g_value_take_boxed (&schedule,
1.251 + dbus_g_type_specialized_construct (schedule_type));
1.252
1.253 start_str_time = g_time_val_to_iso8601 (data->start_time);
1.254 end_str_time = g_time_val_to_iso8601 (data->end_time);
1.255 @@ -668,6 +678,8 @@
1.256
1.257 priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
1.258
1.259 + g_debug ("getting icon: %s", uri);
1.260 +
1.261 g_return_val_if_fail (priv->myth_backend, FALSE);
1.262
1.263 if (!gmyth_util_file_exists (priv->myth_backend, uri))
1.264 @@ -711,6 +723,7 @@
1.265 guint icon_length;
1.266 GMythDbusServerPrivate *priv;
1.267
1.268 + g_debug ("%s:%d", __FUNCTION__, __LINE__);
1.269 priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
1.270 g_return_val_if_fail (priv->myth_backend, FALSE);
1.271
1.272 @@ -759,6 +772,7 @@
1.273 gboolean ret = FALSE;
1.274 GMythDbusServerPrivate *priv;
1.275
1.276 + g_debug ("%s:%d", __FUNCTION__, __LINE__);
1.277 priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
1.278
1.279 g_return_val_if_fail (priv->myth_backend, FALSE);
1.280 @@ -819,6 +833,7 @@
1.281 GTimeVal end_vtime;
1.282 GMythDbusServerPrivate *priv;
1.283
1.284 + g_debug ("%s:%d", __FUNCTION__, __LINE__);
1.285 priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
1.286
1.287 *schedule_id = 0;
1.288 @@ -905,6 +920,7 @@
1.289 GTimeVal end_vtime;
1.290 GMythDbusServerPrivate *priv;
1.291
1.292 + g_debug ("%s:%d", __FUNCTION__, __LINE__);
1.293 priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
1.294
1.295 g_return_val_if_fail (priv->myth_backend, FALSE);