X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gio%2Fgbytesicon.c;h=413e8bd963a9ca1717b19b82e1c65343356d49d7;hb=853692bdfd9f8a87aed70d21f643dc13b57c92d1;hp=2f4b557af7791f87016b15072a19d29131b27f40;hpb=9cc222c0bfc65034143753a64b081b7811ee48f1;p=platform%2Fupstream%2Fglib.git
diff --git a/gio/gbytesicon.c b/gio/gbytesicon.c
index 2f4b557..413e8bd 100644
--- a/gio/gbytesicon.c
+++ b/gio/gbytesicon.c
@@ -13,9 +13,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see .
*
* Author: Ryan Lortie
*/
@@ -34,7 +32,7 @@
/**
* SECTION:gbytesicon
- * @short_description: An icon stored in memory as a #GBytes
+ * @short_description: An icon stored in memory as a GBytes
* @include: gio/gio.h
* @see_also: #GIcon, #GLoadableIcon, #GBytes
*
@@ -110,7 +108,7 @@ g_bytes_icon_finalize (GObject *object)
icon = G_BYTES_ICON (object);
- g_object_unref (icon->bytes);
+ g_bytes_unref (icon->bytes);
G_OBJECT_CLASS (g_bytes_icon_parent_class)->finalize (object);
}
@@ -189,7 +187,7 @@ g_bytes_icon_hash (GIcon *icon)
static gboolean
g_bytes_icon_equal (GIcon *icon1,
- GIcon *icon2)
+ GIcon *icon2)
{
GBytesIcon *bytes1 = G_BYTES_ICON (icon1);
GBytesIcon *bytes2 = G_BYTES_ICON (icon2);
@@ -197,11 +195,21 @@ g_bytes_icon_equal (GIcon *icon1,
return g_bytes_equal (bytes1->bytes, bytes2->bytes);
}
+static GVariant *
+g_bytes_icon_serialize (GIcon *icon)
+{
+ GBytesIcon *bytes_icon = G_BYTES_ICON (icon);
+
+ return g_variant_new ("(sv)", "bytes",
+ g_variant_new_from_bytes (G_VARIANT_TYPE_BYTESTRING, bytes_icon->bytes, TRUE));
+}
+
static void
g_bytes_icon_icon_iface_init (GIconIface *iface)
{
iface->hash = g_bytes_icon_hash;
iface->equal = g_bytes_icon_equal;
+ iface->serialize = g_bytes_icon_serialize;
}
static GInputStream *
@@ -213,6 +221,9 @@ g_bytes_icon_load (GLoadableIcon *icon,
{
GBytesIcon *bytes_icon = G_BYTES_ICON (icon);
+ if (type)
+ *type = NULL;
+
return g_memory_input_stream_new_from_bytes (bytes_icon->bytes);
}
@@ -228,6 +239,7 @@ g_bytes_icon_load_async (GLoadableIcon *icon,
task = g_task_new (icon, cancellable, callback, user_data);
g_task_return_pointer (task, g_memory_input_stream_new_from_bytes (bytes_icon->bytes), g_object_unref);
+ g_object_unref (task);
}
static GInputStream *