# HG changeset patch # User renatofilho # Date 1193266026 -3600 # Node ID 640fc18c9f37c036d0383a62f869b413c17f5ce5 # Parent 3eeb6b565018e89bf93e2fbc183164727394069f [svn r872] fixed valuearray types diff -r 3eeb6b565018 -r 640fc18c9f37 myth-dbus/src/gmyth-dbus-common.h --- a/myth-dbus/src/gmyth-dbus-common.h Wed Oct 24 20:01:02 2007 +0100 +++ b/myth-dbus/src/gmyth-dbus-common.h Wed Oct 24 23:47:06 2007 +0100 @@ -1,7 +1,7 @@ #ifndef __GMYTH_DBUS_COMMON_H__ #define __GMYTH_DBUS_COMMON_H__ -#define GMYTH_DBUS_SERVER_NAME "/br/org/indt/GMyth" +#define GMYTH_DBUS_SERVER_NAME "br.org.indt.GMyth" #define GMYTH_DBUS_SERVER_PATH "/br/org/indt/GMyth" #define GMYTH_DBUS_SERVER_IFACE "br.org.indt.GMyth" @@ -34,6 +34,8 @@ G_TYPE_STRING, \ G_TYPE_STRING, \ G_TYPE_STRING, \ + G_TYPE_STRING, \ + G_TYPE_STRING, \ G_TYPE_UINT64, \ G_TYPE_INVALID); diff -r 3eeb6b565018 -r 640fc18c9f37 myth-dbus/src/gmyth-dbus-server.c --- a/myth-dbus/src/gmyth-dbus-server.c Wed Oct 24 20:01:02 2007 +0100 +++ b/myth-dbus/src/gmyth-dbus-server.c Wed Oct 24 23:47:06 2007 +0100 @@ -1,11 +1,6 @@ /** * GMyth Library * - * @file gmyth/gmyth_backend_info.c - * - * @brief

This component represents all the MythTV backend server - * configuration information. - * * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia. * @author Renato Filho * @@ -40,7 +35,6 @@ #define MYTH_DEFAULT_DB "mythconverg" - typedef struct _GMythDbusServerPrivate GMythDbusServerPrivate; struct _GMythDbusServerPrivate @@ -71,7 +65,7 @@ GError **error); static gboolean gmyth_dbus_server_get_channel_info (GObject *obj, gint channel_id, - GValue **info, + GValueArray **info, GError **error); static gboolean gmyth_dbus_server_file_exists (GObject *obj, const gchar *file_name, @@ -82,7 +76,7 @@ GError **error); static gboolean gmyth_dbus_server_get_recorded_info (GObject *obj, const gchar *basename, - GValue **info, + GValueArray **info, GError **error); static gboolean gmyth_dbus_server_get_program_list (GObject *obj, gint channel_id, @@ -294,6 +288,7 @@ gboolean ret = FALSE; GMythSocket *socket; + g_debug ("%s:%d", __FUNCTION__, __LINE__); priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj); g_return_val_if_fail (priv->myth_backend != NULL, FALSE); @@ -334,13 +329,14 @@ static gboolean gmyth_dbus_server_get_channel_info (GObject *obj, gint channel_id, - GValue **info, + GValueArray **info, GError **error) { GType ch_type; GMythChannelInfo *ch_info; GMythDbusServerPrivate *priv; + g_debug ("%s:%d", __FUNCTION__, __LINE__); priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj); g_return_val_if_fail (priv->myth_backend != NULL, FALSE); @@ -351,10 +347,12 @@ ch_info = gmyth_epg_get_channel_info (priv->myth_epg, channel_id); if (ch_info) { - *info = g_new0 (GValue, 1); - g_value_init (*info, ch_type); - g_value_set_static_boxed (*info, dbus_g_type_specialized_construct (ch_type)); - gmyth_dbus_server_parse_channel_info (ch_info, *info); + GValue v = { 0, }; + g_value_init (&v, ch_type); + g_value_take_boxed (&v, dbus_g_type_specialized_construct (ch_type)); + gmyth_dbus_server_parse_channel_info (ch_info, &v); + + *info = g_value_get_boxed (&v); return TRUE; } @@ -372,6 +370,8 @@ int len; GType ch_type; GMythDbusServerPrivate *priv; + + g_debug ("%s:%d", __FUNCTION__, __LINE__); priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj); g_return_val_if_fail (priv->myth_backend != NULL, FALSE); @@ -391,7 +391,7 @@ data = (GMythChannelInfo *) walk->data; g_value_init (&ch, ch_type); - g_value_set_static_boxed (&ch, dbus_g_type_specialized_construct (ch_type)); + g_value_take_boxed (&ch, dbus_g_type_specialized_construct (ch_type)); gmyth_dbus_server_parse_channel_info (data, &ch); g_ptr_array_add (*channels, g_value_get_boxed (&ch)); } @@ -418,7 +418,7 @@ static gboolean gmyth_dbus_server_get_program_list (GObject *obj, - gint program_id, + gint channel_id, const gchar *start_time, const gchar *end_time, GPtrArray **programs) @@ -431,6 +431,7 @@ GTimeVal end_time_val; GMythDbusServerPrivate *priv; + g_debug ("%s:%d", __FUNCTION__, __LINE__); priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj); g_return_val_if_fail (priv->myth_backend, FALSE); @@ -440,9 +441,10 @@ g_time_val_from_iso8601 (start_time, &start_time_val); g_time_val_from_iso8601 (end_time, &end_time_val); + list = NULL; len = gmyth_epg_get_program_list (priv->myth_epg, &list, - program_id, + channel_id, &start_time_val, &end_time_val); @@ -459,8 +461,8 @@ data = (GMythProgramInfo *) walk->data; g_value_init (&program, program_type); - g_value_set_static_boxed (&program, - dbus_g_type_specialized_construct (program_type)); + g_value_take_boxed (&program, + dbus_g_type_specialized_construct (program_type)); start_str = g_time_val_to_iso8601 (data->startts); end_str = g_time_val_to_iso8601 (data->endts); @@ -481,7 +483,6 @@ } gmyth_free_program_list (list); - return TRUE; } @@ -494,6 +495,7 @@ start_str = g_time_val_to_iso8601 (info->start_time); end_str = g_time_val_to_iso8601 (info->end_time); + dbus_g_type_struct_set (val, 0, info->record_id, 1, info->program_id, @@ -507,7 +509,6 @@ 9, info->basename->str, 10, info->filesize, G_MAXUINT); - g_free (start_str); g_free (end_str); } @@ -515,13 +516,15 @@ static gboolean gmyth_dbus_server_get_recorded_info (GObject *obj, const gchar *basename, - GValue **info, + GValueArray **info, GError **error) { GType record_type; GMythDbusServerPrivate *priv; RecordedInfo *record_info; + + g_debug ("%s:%d", __FUNCTION__, __LINE__); priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj); g_return_val_if_fail (priv->myth_backend, FALSE); @@ -534,14 +537,17 @@ if (record_info) { - *info = g_new0 (GValue, 1); - g_value_init (*info, record_type); - g_value_set_static_boxed (*info, - dbus_g_type_specialized_construct (record_type)); - gmyth_dbus_server_parse_recorded_info (record_info, *info); + GValue r = { 0, }; + g_value_init (&r, record_type); + g_value_take_boxed (&r, + dbus_g_type_specialized_construct (record_type)); + + gmyth_dbus_server_parse_recorded_info (record_info, &r); gmyth_recorded_info_free (record_info); + *info = g_value_get_boxed (&r); + return TRUE; } @@ -560,6 +566,7 @@ GType record_type; GMythDbusServerPrivate *priv; + g_debug ("%s:%d", __FUNCTION__, __LINE__); priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj); g_return_val_if_fail (priv->myth_backend, FALSE); @@ -569,8 +576,8 @@ len = gmyth_scheduler_get_recorded_list (priv->myth_scheduler, &list); + record_type = GMYTH_DBUS_RECORD_G_TYPE; *records = g_ptr_array_sized_new (len); - record_type = GMYTH_DBUS_RECORD_G_TYPE; for (walk = list; walk != NULL; walk = walk->next) { @@ -580,9 +587,11 @@ data = (RecordedInfo *) walk->data; g_value_init (&record, record_type); - g_value_set_static_boxed (&record, - dbus_g_type_specialized_construct (record_type)); + g_value_take_boxed (&record, + dbus_g_type_specialized_construct (record_type)); + gmyth_dbus_server_parse_recorded_info (data, &record); + g_ptr_array_add (*records, g_value_get_boxed (&record)); } @@ -602,6 +611,7 @@ GType schedule_type; GMythDbusServerPrivate *priv; + g_debug ("%s:%d", __FUNCTION__, __LINE__); priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj); g_return_val_if_fail (priv->myth_backend, FALSE); @@ -624,8 +634,8 @@ data = (ScheduleInfo *) walk->data; g_value_init (&schedule, schedule_type); - g_value_set_static_boxed (&schedule, - dbus_g_type_specialized_construct (schedule_type)); + g_value_take_boxed (&schedule, + dbus_g_type_specialized_construct (schedule_type)); start_str_time = g_time_val_to_iso8601 (data->start_time); end_str_time = g_time_val_to_iso8601 (data->end_time); @@ -668,6 +678,8 @@ priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj); + g_debug ("getting icon: %s", uri); + g_return_val_if_fail (priv->myth_backend, FALSE); if (!gmyth_util_file_exists (priv->myth_backend, uri)) @@ -711,6 +723,7 @@ guint icon_length; GMythDbusServerPrivate *priv; + g_debug ("%s:%d", __FUNCTION__, __LINE__); priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj); g_return_val_if_fail (priv->myth_backend, FALSE); @@ -759,6 +772,7 @@ gboolean ret = FALSE; GMythDbusServerPrivate *priv; + g_debug ("%s:%d", __FUNCTION__, __LINE__); priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj); g_return_val_if_fail (priv->myth_backend, FALSE); @@ -819,6 +833,7 @@ GTimeVal end_vtime; GMythDbusServerPrivate *priv; + g_debug ("%s:%d", __FUNCTION__, __LINE__); priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj); *schedule_id = 0; @@ -905,6 +920,7 @@ GTimeVal end_vtime; GMythDbusServerPrivate *priv; + g_debug ("%s:%d", __FUNCTION__, __LINE__); priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj); g_return_val_if_fail (priv->myth_backend, FALSE); diff -r 3eeb6b565018 -r 640fc18c9f37 myth-dbus/src/gmyth-dbus-server.xml --- a/myth-dbus/src/gmyth-dbus-server.xml Wed Oct 24 20:01:02 2007 +0100 +++ b/myth-dbus/src/gmyth-dbus-server.xml Wed Oct 24 23:47:06 2007 +0100 @@ -40,12 +40,12 @@ - + - + diff -r 3eeb6b565018 -r 640fc18c9f37 myth-dbus/src/main.c --- a/myth-dbus/src/main.c Wed Oct 24 20:01:02 2007 +0100 +++ b/myth-dbus/src/main.c Wed Oct 24 23:47:06 2007 +0100 @@ -6,6 +6,8 @@ GMythDbusServer *srv; g_type_init (); + g_thread_init (NULL); + loop = g_main_loop_new (NULL, FALSE); srv = gmyth_dbus_server_start_dbus_service ();