[rygel-grilo] Get rid of unused functions



commit 79b856de8978bae5f8989542eadce0de62364e7d
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Tue May 4 12:34:11 2010 +0200

    Get rid of unused functions

 lib/media-server2-server.c |  285 --------------------------------------------
 1 files changed, 0 insertions(+), 285 deletions(-)
---
diff --git a/lib/media-server2-server.c b/lib/media-server2-server.c
index 8187640..c28107b 100644
--- a/lib/media-server2-server.c
+++ b/lib/media-server2-server.c
@@ -137,122 +137,6 @@ ptrarray_to_value (GPtrArray *array)
   return val;
 }
 
-/* Returns the unknown value for the property */
-static GValue *
-get_unknown_value (const gchar *property)
-{
-  GValue *val;
-  GPtrArray *ptrarray;
-
-  if (g_strcmp0 (property, MS2_PROP_URLS) == 0) {
-    ptrarray = g_ptr_array_sized_new (1);
-    g_ptr_array_add (ptrarray, g_strdup (MS2_UNKNOWN_STR));
-    val = ptrarray_to_value (ptrarray);
-  } else if (g_strcmp0 (property, MS2_PROP_CHILD_COUNT) == 0 ||
-             g_strcmp0 (property, MS2_PROP_SIZE) == 0 ||
-             g_strcmp0 (property, MS2_PROP_DURATION) == 0 ||
-             g_strcmp0 (property, MS2_PROP_BITRATE) == 0 ||
-             g_strcmp0 (property, MS2_PROP_SAMPLE_RATE) == 0 ||
-             g_strcmp0 (property, MS2_PROP_BITS_PER_SAMPLE) == 0 ||
-             g_strcmp0 (property, MS2_PROP_WIDTH) == 0 ||
-             g_strcmp0 (property, MS2_PROP_HEIGHT) == 0 ||
-             g_strcmp0 (property, MS2_PROP_COLOR_DEPTH) == 0 ||
-             g_strcmp0 (property, MS2_PROP_PIXEL_WIDTH) == 0 ||
-             g_strcmp0 (property, MS2_PROP_PIXEL_HEIGHT) == 0) {
-    val = int_to_value (MS2_UNKNOWN_INT);
-  } else {
-    val = str_to_value (MS2_UNKNOWN_STR);
-  }
-
-  return val;
-}
-
-/* Returns an array of properties values suitable to send as dbus reply */
-static GPtrArray *
-get_array_properties (GHashTable *properties,
-                      const gchar **filter)
-{
-  GPtrArray *prop_array;
-  gint i;
-  GValue *val;
-
-  prop_array = g_ptr_array_sized_new (g_strv_length ((gchar **) filter));
-  for (i = 0; filter[i]; i++) {
-    if (properties) {
-      val = g_hash_table_lookup (properties, filter[i]);
-      if (val) {
-        g_ptr_array_add (prop_array, val);
-      } else {
-        val = get_unknown_value (filter[i]);
-        g_hash_table_insert (properties, (gchar *) filter[i], val);
-        g_ptr_array_add (prop_array, val);
-      }
-    } else {
-      val = get_unknown_value (filter[i]);
-      g_ptr_array_add (prop_array, val);
-    }
-  }
-
-  return prop_array;
-}
-
-/* Returns an array of children, which consist of arrays of properties, suitable
-   to send as dbus reply */
-static GPtrArray *
-get_array_children (GList *children,
-                    const gchar **filter)
-{
-  GList *child;
-  GPtrArray *prop_array;
-  GPtrArray *children_array;
-
-  children_array = g_ptr_array_sized_new (g_list_length (children));
-  for (child = children; child; child = g_list_next (child)) {
-    prop_array = get_array_properties (child->data, filter);
-    g_ptr_array_add (children_array, prop_array);
-  }
-
-  return children_array;
-}
-
-/* Looks up for wrong keys, and report them */
-static const gchar *
-check_properties (const gchar **filter)
-{
-  const gchar **p;
-
-  for (p = filter; *p; p++) {
-    if (g_strcmp0 (*p, MS2_PROP_ID) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_PARENT) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_DISPLAY_NAME) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_TYPE) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_CHILD_COUNT) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_ICON) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_URLS) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_MIME_TYPE) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_SIZE) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_ARTIST) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_ALBUM) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_DATE) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_DLNA_PROFILE) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_DURATION) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_BITRATE) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_SAMPLE_RATE) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_BITS_PER_SAMPLE) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_WIDTH) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_HEIGHT) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_COLOR_DEPTH) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_PIXEL_WIDTH) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_PIXEL_HEIGHT) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_THUMBNAIL) != 0 &&
-        g_strcmp0 (*p, MS2_PROP_GENRE) != 0) {
-      return *p;
-    }
-  }
-
-  return NULL;
-}
-
 static gboolean
 lookup_in_strv (gchar **strv,
                 const gchar *needle)
@@ -915,175 +799,6 @@ ms2_server_init (MS2Server *server)
   server->priv = MS2_SERVER_GET_PRIVATE (server);
 }
 
-/****************** INTERNAL PUBLIC API (NOT TO BE EXPORTED) ******************/
-
-/*
- * ms2_server_get_properties:
- * @server: a #MS2Server
- * @id: media identifier to obtain properties from
- * @filter: @NULL-terminated array of requested properties
- * @context: DBus context to send the reply through
- * @error: a #GError location to store the error ocurring, or @NULL to ignore
- *
- * Sends a #GPtrArray of properties values through DBus.
- *
- * Returns: @TRUE if success
- */
-gboolean
-ms2_server_get_properties (MS2Server *server,
-                           const gchar *id,
-                           const gchar **filter,
-                           DBusGMethodInvocation *context,
-                           GError **error)
-{
-  GError *prop_error = NULL;
-  GError *send_error = NULL;
-  GHashTable *properties = NULL;
-  GPtrArray *prop_array = NULL;
-  const gchar *wrong_prop;
-
-  /* Check if peer has defined a function to retrieve properties */
-  if (!server->priv->get_properties) {
-    send_error = g_error_new_literal (MS2_ERROR,
-                                      MS2_ERROR_GENERAL,
-                                      "Unable to get properties");
-  } else {
-    /* Validate filter */
-    wrong_prop = check_properties (filter);
-
-    if (!wrong_prop) {
-      properties = server->priv->get_properties (server,
-                                                 id,
-                                                 filter,
-                                                 server->priv->data,
-                                                 &prop_error);
-      if (prop_error) {
-        send_error = g_error_new_literal (MS2_ERROR,
-                                          MS2_ERROR_GENERAL,
-                                          prop_error->message);
-        g_error_free (prop_error);
-      }
-    } else {
-      send_error = g_error_new (MS2_ERROR,
-                                MS2_ERROR_GENERAL,
-                                "Wrong property \"%s\"",
-                                wrong_prop);
-    }
-  }
-
-  /* Check if there was an error */
-  if (send_error) {
-    if (error) {
-      *error = g_error_copy (send_error);
-    }
-
-    dbus_g_method_return_error (context, send_error);
-    g_error_free (send_error);
-    return TRUE;
-  }
-
-  /* Convert properties table in a type suitable to send through DBus (in this
-     case, in a gptrarray of gvalues) */
-  prop_array = get_array_properties (properties, filter);
-  dbus_g_method_return (context, prop_array);
-
-  /* Free content */
-  if (properties) {
-    g_hash_table_unref (properties);
-  } else {
-    g_ptr_array_foreach (prop_array, (GFunc) free_value, NULL);
-  }
-  g_ptr_array_free (prop_array, TRUE);
-
-  return TRUE;
-}
-
-/*
- * ms2_server_get_children:
- * @server: a #MS2Server
- * @id: container identifier to get children from
- * @offset: number of children to skip in the result
- * @max_count: maximum number of children to return, or -1 for no limit
- * @filter: @NULL-terminated array of requested properties
- * @context: DBus context to send the reply through
- * @error: a #GError location to store the error ocurring, or @NULL to ignore
- *
- * Sends a #GPtrArray of children through DBus. Each child is in its turn a
- * #GPtrArray of properties values.
- *
- * Returns: @TRUE if success
- */
-gboolean
-ms2_server_get_children (MS2Server *server,
-                         const gchar *id,
-                         guint offset,
-                         gint max_count,
-                         const gchar **filter,
-                         DBusGMethodInvocation *context,
-                         GError **error)
-{
-  GError *children_error = NULL;
-  GError *send_error = NULL;
-  GPtrArray *children_array = NULL;
-  GList *children = NULL;
-  const gchar *wrong_prop;
-
-  /* Check if peer has defined a function to retrieve children */
-  if (!server->priv->get_children) {
-    send_error = g_error_new_literal (MS2_ERROR,
-                                      MS2_ERROR_GENERAL,
-                                      "Unable to get children");
-  } else {
-    /* Validate filter */
-    wrong_prop = check_properties (filter);
-
-    if (!wrong_prop) {
-      children =
-        server->priv->get_children (server,
-                                    id,
-                                    offset,
-                                    max_count < 0? G_MAXINT: max_count,
-                                    filter,
-                                    server->priv->data,
-                                    &children_error);
-      if (children_error) {
-        send_error = g_error_new_literal (MS2_ERROR,
-                                          MS2_ERROR_GENERAL,
-                                          children_error->message);
-        g_error_free (children_error);
-      }
-    } else {
-      send_error = g_error_new (MS2_ERROR,
-                                MS2_ERROR_GENERAL,
-                                "Wrong property \"%s\"",
-                                wrong_prop);
-    }
-  }
-
-  /* Check if there was an error */
-  if (send_error) {
-    if (error) {
-      *error = g_error_copy (send_error);
-    }
-
-    dbus_g_method_return_error (context, send_error);
-    g_error_free (send_error);
-    return TRUE;
-  }
-
-  /* Convert children list in a type suitable to send through DBUS (in this
-     case, in a gptrarray of gptrarray o gvalues) */
-  children_array = get_array_children (children, filter);
-  dbus_g_method_return (context, children_array);
-
-  /* Free content */
-  g_ptr_array_free (children_array, TRUE);
-  g_list_foreach (children, (GFunc) g_hash_table_unref, NULL);
-  g_list_free (children);
-
-  return TRUE;
-}
-
 /********************* PUBLIC API *********************/
 
 /**



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]