[svn r872] fixed valuearray types trunk
authorrenatofilho
Wed Oct 24 23:47:06 2007 +0100 (2007-10-24)
branchtrunk
changeset 866640fc18c9f37
parent 865 3eeb6b565018
child 867 c6c57f6060bd
[svn r872] fixed valuearray types
myth-dbus/src/gmyth-dbus-common.h
myth-dbus/src/gmyth-dbus-server.c
myth-dbus/src/gmyth-dbus-server.xml
myth-dbus/src/main.c
     1.1 --- a/myth-dbus/src/gmyth-dbus-common.h	Wed Oct 24 20:01:02 2007 +0100
     1.2 +++ b/myth-dbus/src/gmyth-dbus-common.h	Wed Oct 24 23:47:06 2007 +0100
     1.3 @@ -1,7 +1,7 @@
     1.4  #ifndef __GMYTH_DBUS_COMMON_H__
     1.5  #define __GMYTH_DBUS_COMMON_H__
     1.6  
     1.7 -#define GMYTH_DBUS_SERVER_NAME      "/br/org/indt/GMyth"
     1.8 +#define GMYTH_DBUS_SERVER_NAME      "br.org.indt.GMyth"
     1.9  #define GMYTH_DBUS_SERVER_PATH      "/br/org/indt/GMyth"
    1.10  #define GMYTH_DBUS_SERVER_IFACE     "br.org.indt.GMyth"
    1.11  
    1.12 @@ -34,6 +34,8 @@
    1.13                              G_TYPE_STRING, \
    1.14                              G_TYPE_STRING, \
    1.15                              G_TYPE_STRING, \
    1.16 +                            G_TYPE_STRING, \
    1.17 +                            G_TYPE_STRING, \
    1.18                              G_TYPE_UINT64, \
    1.19                              G_TYPE_INVALID);
    1.20  
     2.1 --- a/myth-dbus/src/gmyth-dbus-server.c	Wed Oct 24 20:01:02 2007 +0100
     2.2 +++ b/myth-dbus/src/gmyth-dbus-server.c	Wed Oct 24 23:47:06 2007 +0100
     2.3 @@ -1,11 +1,6 @@
     2.4  /**
     2.5   * GMyth Library
     2.6   *
     2.7 - * @file gmyth/gmyth_backend_info.c
     2.8 - * 
     2.9 - * @brief <p> This component represents all the MythTV backend server
    2.10 - * 						configuration information.
    2.11 - *
    2.12   * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
    2.13   * @author Renato Filho  <renato.filho@indt.org.br>
    2.14   *
    2.15 @@ -40,7 +35,6 @@
    2.16  
    2.17  #define MYTH_DEFAULT_DB             "mythconverg"
    2.18  
    2.19 -
    2.20  typedef struct _GMythDbusServerPrivate GMythDbusServerPrivate;
    2.21  
    2.22  struct _GMythDbusServerPrivate
    2.23 @@ -71,7 +65,7 @@
    2.24                                                       GError **error);
    2.25  static gboolean gmyth_dbus_server_get_channel_info  (GObject *obj,
    2.26                                                       gint channel_id,
    2.27 -                                                     GValue **info,
    2.28 +                                                     GValueArray **info,
    2.29                                                       GError **error);
    2.30  static gboolean gmyth_dbus_server_file_exists       (GObject *obj,
    2.31                                                       const gchar *file_name,
    2.32 @@ -82,7 +76,7 @@
    2.33                                                       GError **error);
    2.34  static gboolean gmyth_dbus_server_get_recorded_info (GObject *obj,
    2.35                                                       const gchar *basename,
    2.36 -                                                     GValue **info,
    2.37 +                                                     GValueArray **info,
    2.38                                                       GError **error);
    2.39  static gboolean gmyth_dbus_server_get_program_list  (GObject *obj,
    2.40                                                       gint channel_id,
    2.41 @@ -294,6 +288,7 @@
    2.42      gboolean ret = FALSE;
    2.43      GMythSocket *socket;
    2.44  
    2.45 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
    2.46      priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
    2.47  
    2.48      g_return_val_if_fail (priv->myth_backend != NULL, FALSE);
    2.49 @@ -334,13 +329,14 @@
    2.50  static gboolean 
    2.51  gmyth_dbus_server_get_channel_info  (GObject *obj,
    2.52                                       gint channel_id,
    2.53 -                                     GValue **info,
    2.54 +                                     GValueArray **info,
    2.55                                       GError **error)
    2.56  {
    2.57      GType ch_type;
    2.58      GMythChannelInfo *ch_info;
    2.59      GMythDbusServerPrivate *priv;
    2.60  
    2.61 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
    2.62      priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
    2.63  
    2.64      g_return_val_if_fail (priv->myth_backend != NULL, FALSE);
    2.65 @@ -351,10 +347,12 @@
    2.66      ch_info = gmyth_epg_get_channel_info (priv->myth_epg, channel_id);
    2.67      if (ch_info)
    2.68      {
    2.69 -        *info = g_new0 (GValue, 1);
    2.70 -        g_value_init (*info, ch_type);
    2.71 -        g_value_set_static_boxed (*info, dbus_g_type_specialized_construct (ch_type));
    2.72 -        gmyth_dbus_server_parse_channel_info (ch_info, *info);
    2.73 +        GValue v = { 0, };
    2.74 +        g_value_init (&v, ch_type);
    2.75 +        g_value_take_boxed (&v, dbus_g_type_specialized_construct (ch_type));
    2.76 +        gmyth_dbus_server_parse_channel_info (ch_info, &v);
    2.77 +
    2.78 +        *info = g_value_get_boxed (&v);
    2.79          return TRUE;
    2.80      }
    2.81  
    2.82 @@ -372,6 +370,8 @@
    2.83      int len;
    2.84      GType ch_type;
    2.85      GMythDbusServerPrivate *priv;
    2.86 +
    2.87 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
    2.88      priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
    2.89  
    2.90      g_return_val_if_fail (priv->myth_backend != NULL, FALSE);
    2.91 @@ -391,7 +391,7 @@
    2.92          data = (GMythChannelInfo *) walk->data;
    2.93  
    2.94          g_value_init (&ch, ch_type);
    2.95 -        g_value_set_static_boxed (&ch, dbus_g_type_specialized_construct (ch_type));
    2.96 +        g_value_take_boxed (&ch, dbus_g_type_specialized_construct (ch_type));
    2.97          gmyth_dbus_server_parse_channel_info (data, &ch);
    2.98          g_ptr_array_add (*channels, g_value_get_boxed (&ch));
    2.99      }
   2.100 @@ -418,7 +418,7 @@
   2.101  
   2.102  static gboolean
   2.103  gmyth_dbus_server_get_program_list (GObject *obj,
   2.104 -                                    gint program_id,
   2.105 +                                    gint channel_id,
   2.106                                      const gchar *start_time,
   2.107                                      const gchar *end_time,
   2.108                                      GPtrArray **programs)
   2.109 @@ -431,6 +431,7 @@
   2.110      GTimeVal end_time_val;
   2.111      GMythDbusServerPrivate *priv;
   2.112  
   2.113 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   2.114      priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
   2.115  
   2.116      g_return_val_if_fail (priv->myth_backend, FALSE);
   2.117 @@ -440,9 +441,10 @@
   2.118      g_time_val_from_iso8601 (start_time, &start_time_val);
   2.119      g_time_val_from_iso8601 (end_time, &end_time_val);
   2.120  
   2.121 +    list = NULL;
   2.122      len = gmyth_epg_get_program_list (priv->myth_epg,
   2.123                                        &list,
   2.124 -                                      program_id,
   2.125 +                                      channel_id,
   2.126                                        &start_time_val,
   2.127                                        &end_time_val);
   2.128  
   2.129 @@ -459,8 +461,8 @@
   2.130          data = (GMythProgramInfo *) walk->data;
   2.131  
   2.132          g_value_init (&program, program_type);
   2.133 -        g_value_set_static_boxed (&program,
   2.134 -                                  dbus_g_type_specialized_construct (program_type));
   2.135 +        g_value_take_boxed (&program,
   2.136 +                            dbus_g_type_specialized_construct (program_type));
   2.137  
   2.138          start_str = g_time_val_to_iso8601 (data->startts);
   2.139          end_str = g_time_val_to_iso8601 (data->endts);
   2.140 @@ -481,7 +483,6 @@
   2.141      }
   2.142  
   2.143      gmyth_free_program_list (list);
   2.144 -
   2.145      return TRUE;
   2.146  }
   2.147  
   2.148 @@ -494,6 +495,7 @@
   2.149  
   2.150      start_str = g_time_val_to_iso8601 (info->start_time);
   2.151      end_str = g_time_val_to_iso8601 (info->end_time);
   2.152 +
   2.153      dbus_g_type_struct_set (val,
   2.154                              0, info->record_id,
   2.155                              1, info->program_id,
   2.156 @@ -507,7 +509,6 @@
   2.157                              9, info->basename->str,
   2.158                              10, info->filesize,
   2.159                              G_MAXUINT);
   2.160 -
   2.161      g_free (start_str);
   2.162      g_free (end_str);
   2.163  }
   2.164 @@ -515,13 +516,15 @@
   2.165  static gboolean
   2.166  gmyth_dbus_server_get_recorded_info (GObject *obj,
   2.167                                       const gchar *basename,
   2.168 -                                     GValue **info,
   2.169 +                                     GValueArray **info,
   2.170                                       GError **error)
   2.171  {
   2.172      GType record_type;
   2.173      GMythDbusServerPrivate *priv;
   2.174      RecordedInfo *record_info;
   2.175  
   2.176 +
   2.177 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   2.178      priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
   2.179  
   2.180      g_return_val_if_fail (priv->myth_backend, FALSE);
   2.181 @@ -534,14 +537,17 @@
   2.182  
   2.183      if (record_info)
   2.184      {
   2.185 -        *info = g_new0 (GValue, 1);
   2.186 -        g_value_init (*info, record_type);
   2.187 -        g_value_set_static_boxed (*info,
   2.188 -                                  dbus_g_type_specialized_construct (record_type));
   2.189 -        gmyth_dbus_server_parse_recorded_info (record_info, *info);
   2.190 +        GValue r = { 0, };
   2.191  
   2.192 +        g_value_init (&r, record_type);
   2.193 +        g_value_take_boxed (&r,
   2.194 +                            dbus_g_type_specialized_construct (record_type));
   2.195 +
   2.196 +        gmyth_dbus_server_parse_recorded_info (record_info, &r);
   2.197          gmyth_recorded_info_free (record_info);
   2.198  
   2.199 +        *info = g_value_get_boxed (&r);
   2.200 +
   2.201          return TRUE;
   2.202      }
   2.203  
   2.204 @@ -560,6 +566,7 @@
   2.205      GType record_type;
   2.206      GMythDbusServerPrivate *priv;
   2.207  
   2.208 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   2.209      priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
   2.210  
   2.211      g_return_val_if_fail (priv->myth_backend, FALSE);
   2.212 @@ -569,8 +576,8 @@
   2.213      len = gmyth_scheduler_get_recorded_list (priv->myth_scheduler,
   2.214                                               &list);
   2.215  
   2.216 +    record_type = GMYTH_DBUS_RECORD_G_TYPE;
   2.217      *records = g_ptr_array_sized_new (len);
   2.218 -    record_type = GMYTH_DBUS_RECORD_G_TYPE;
   2.219  
   2.220      for (walk = list; walk != NULL; walk = walk->next)
   2.221      {
   2.222 @@ -580,9 +587,11 @@
   2.223          data = (RecordedInfo *) walk->data;
   2.224  
   2.225          g_value_init (&record, record_type);
   2.226 -        g_value_set_static_boxed (&record,
   2.227 -                                  dbus_g_type_specialized_construct (record_type));
   2.228 +        g_value_take_boxed (&record,
   2.229 +                            dbus_g_type_specialized_construct (record_type));
   2.230 +
   2.231          gmyth_dbus_server_parse_recorded_info (data, &record);
   2.232 +
   2.233          g_ptr_array_add (*records, g_value_get_boxed (&record));
   2.234      }
   2.235  
   2.236 @@ -602,6 +611,7 @@
   2.237      GType schedule_type;
   2.238      GMythDbusServerPrivate *priv;
   2.239  
   2.240 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   2.241      priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
   2.242  
   2.243      g_return_val_if_fail (priv->myth_backend, FALSE);
   2.244 @@ -624,8 +634,8 @@
   2.245          data = (ScheduleInfo *) walk->data;
   2.246  
   2.247          g_value_init (&schedule, schedule_type);
   2.248 -        g_value_set_static_boxed (&schedule,
   2.249 -                                  dbus_g_type_specialized_construct (schedule_type));
   2.250 +        g_value_take_boxed (&schedule,
   2.251 +                            dbus_g_type_specialized_construct (schedule_type));
   2.252  
   2.253          start_str_time = g_time_val_to_iso8601 (data->start_time);
   2.254          end_str_time = g_time_val_to_iso8601 (data->end_time);
   2.255 @@ -668,6 +678,8 @@
   2.256  
   2.257      priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
   2.258  
   2.259 +    g_debug ("getting icon: %s", uri);
   2.260 +
   2.261      g_return_val_if_fail (priv->myth_backend, FALSE);
   2.262  
   2.263      if (!gmyth_util_file_exists (priv->myth_backend, uri))
   2.264 @@ -711,6 +723,7 @@
   2.265      guint icon_length;
   2.266      GMythDbusServerPrivate *priv;
   2.267  
   2.268 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   2.269      priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
   2.270      g_return_val_if_fail (priv->myth_backend, FALSE);
   2.271  
   2.272 @@ -759,6 +772,7 @@
   2.273      gboolean ret = FALSE;
   2.274      GMythDbusServerPrivate *priv;
   2.275  
   2.276 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   2.277      priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
   2.278  
   2.279      g_return_val_if_fail (priv->myth_backend, FALSE);
   2.280 @@ -819,6 +833,7 @@
   2.281      GTimeVal end_vtime;
   2.282      GMythDbusServerPrivate *priv;
   2.283  
   2.284 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   2.285      priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
   2.286  
   2.287      *schedule_id = 0;
   2.288 @@ -905,6 +920,7 @@
   2.289      GTimeVal end_vtime;
   2.290      GMythDbusServerPrivate *priv;
   2.291  
   2.292 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   2.293      priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
   2.294  
   2.295      g_return_val_if_fail (priv->myth_backend, FALSE);
     3.1 --- a/myth-dbus/src/gmyth-dbus-server.xml	Wed Oct 24 20:01:02 2007 +0100
     3.2 +++ b/myth-dbus/src/gmyth-dbus-server.xml	Wed Oct 24 23:47:06 2007 +0100
     3.3 @@ -40,12 +40,12 @@
     3.4      </method>
     3.5  
     3.6      <method name="GetRecordedList">
     3.7 -      <arg type="a(uuussssst)" name="records" direction="out" />
     3.8 +      <arg type="a(uuussssssst)" name="records" direction="out" />
     3.9      </method>
    3.10  
    3.11      <method name="GetRecordedInfo">
    3.12        <arg type="s" name="basename" direction="in" />
    3.13 -      <arg type="(uuussssst)" name="details" direction="out" />
    3.14 +      <arg type="(uuussssssst)" name="details" direction="out" />
    3.15      </method>
    3.16  
    3.17      <method name="GetScheduleList">
     4.1 --- a/myth-dbus/src/main.c	Wed Oct 24 20:01:02 2007 +0100
     4.2 +++ b/myth-dbus/src/main.c	Wed Oct 24 23:47:06 2007 +0100
     4.3 @@ -6,6 +6,8 @@
     4.4      GMythDbusServer *srv;
     4.5  
     4.6      g_type_init ();
     4.7 +    g_thread_init (NULL);
     4.8 +
     4.9  
    4.10      loop = g_main_loop_new (NULL, FALSE);
    4.11      srv = gmyth_dbus_server_start_dbus_service ();