[grilo] core: Add Icon property to GrlSource



commit c8423dac910f41670754b0c18041854bcd64551d
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Dec 19 22:44:09 2013 +0100

    core: Add Icon property to GrlSource
    
    https://bugzilla.gnome.org/show_bug.cgi?id=657926
    
    Signed-off-by: Bastien Nocera <hadess hadess net>
    Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>

 doc/grilo/grilo-sections.txt |    1 +
 src/grl-source.c             |   40 ++++++++++++++++++++++++++++++++++++++++
 src/grl-source.h             |    3 +++
 3 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/doc/grilo/grilo-sections.txt b/doc/grilo/grilo-sections.txt
index 7438fc7..b5cbe29 100644
--- a/doc/grilo/grilo-sections.txt
+++ b/doc/grilo/grilo-sections.txt
@@ -76,6 +76,7 @@ grl_source_browse_sync
 grl_source_get_auto_split_threshold
 grl_source_get_caps
 grl_source_get_description
+grl_source_get_icon
 grl_source_get_id
 grl_source_get_media_from_uri
 grl_source_get_media_from_uri_sync
diff --git a/src/grl-source.c b/src/grl-source.c
index 60a1f4a..f85b565 100644
--- a/src/grl-source.c
+++ b/src/grl-source.c
@@ -64,6 +64,7 @@ enum {
   PROP_ID,
   PROP_NAME,
   PROP_DESC,
+  PROP_ICON,
   PROP_PLUGIN,
   PROP_RANK,
   PROP_AUTO_SPLIT_THRESHOLD,
@@ -89,6 +90,7 @@ struct _GrlSourcePrivate {
   GrlMediaType supported_media;
   guint auto_split_threshold;
   GrlPlugin *plugin;
+  GIcon *icon;
 };
 
 typedef struct {
@@ -321,6 +323,22 @@ grl_source_class_init (GrlSourceClass *source_class)
                                                         G_PARAM_CONSTRUCT |
                                                         G_PARAM_STATIC_STRINGS));
   /**
+   * GrlSource:source-icon:
+   *
+   * #GIcon representing the source
+   *
+   * Since: 0.2.0
+   */
+  g_object_class_install_property (gobject_class,
+                                   PROP_ICON,
+                                   g_param_spec_object ("source-icon",
+                                                        "Source icon",
+                                                        "Icon representing the source",
+                                                        G_TYPE_ICON,
+                                                        G_PARAM_READWRITE |
+                                                        G_PARAM_CONSTRUCT |
+                                                        G_PARAM_STATIC_STRINGS));
+  /**
    * GrlSource:plugin:
    *
    * Plugin the source belongs to
@@ -453,6 +471,7 @@ grl_source_finalize (GObject *object)
 {
   GrlSource *source = GRL_SOURCE (object);
 
+  g_clear_object (&source->priv->icon);
   g_free (source->priv->id);
   g_free (source->priv->name);
   g_free (source->priv->desc);
@@ -487,6 +506,10 @@ grl_source_set_property (GObject *object,
   case PROP_DESC:
     set_string_property (&source->priv->desc, value);
     break;
+  case PROP_ICON:
+    g_clear_object (&source->priv->icon);
+    source->priv->icon = g_value_dup_object (value);
+    break;
   case PROP_PLUGIN:
     g_clear_object (&source->priv->plugin);
     source->priv->plugin = g_value_dup_object (value);
@@ -526,6 +549,9 @@ grl_source_get_property (GObject *object,
   case PROP_DESC:
     g_value_set_string (value, source->priv->desc);
     break;
+  case PROP_ICON:
+    g_value_set_object (value, source->priv->icon);
+    break;
   case PROP_PLUGIN:
     g_value_set_object (value, source->priv->plugin);
     break;
@@ -2855,6 +2881,20 @@ grl_source_get_name (GrlSource *source)
 }
 
 /**
+ * grl_source_get_icon:
+ * @source: a source
+ *
+ * Returns: (transfer none): a #GIcon
+ */
+GIcon *
+grl_source_get_icon (GrlSource *source)
+{
+  g_return_val_if_fail (GRL_IS_SOURCE (source), NULL);
+
+  return source->priv->icon;
+}
+
+/**
  * grl_source_get_description:
  * @source: a source
  *
diff --git a/src/grl-source.h b/src/grl-source.h
index 621e2d2..c0f9141 100644
--- a/src/grl-source.h
+++ b/src/grl-source.h
@@ -36,6 +36,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
+#include <gio/gio.h>
 
 /* Macros */
 
@@ -622,6 +623,8 @@ const gchar *grl_source_get_id (GrlSource *source);
 
 const gchar *grl_source_get_name (GrlSource *source);
 
+GIcon *grl_source_get_icon (GrlSource *source);
+
 const gchar *grl_source_get_description (GrlSource *source);
 
 GrlPlugin *grl_source_get_plugin (GrlSource *source);


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