X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gio%2Fgemblem.c;h=ed35eb2b01a2017d117b4e3f9a9e6b6e692f645e;hb=51fac05d73f8363de821eb0d6940dedca13a8c0f;hp=68afbab76190c145419c136998ed534e61903ff5;hpb=63adeda0861a26b38ec0adc76255666554c18951;p=platform%2Fupstream%2Fglib.git
diff --git a/gio/gemblem.c b/gio/gemblem.c
index 68afbab..ed35eb2 100644
--- a/gio/gemblem.c
+++ b/gio/gemblem.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 .
*/
#include
@@ -122,7 +120,8 @@ g_emblem_finalize (GObject *object)
{
GEmblem *emblem = G_EMBLEM (object);
- g_object_unref (emblem->icon);
+ if (emblem->icon)
+ g_object_unref (emblem->icon);
(*G_OBJECT_CLASS (g_emblem_parent_class)->finalize) (object);
}
@@ -220,8 +219,8 @@ g_emblem_new_with_origin (GIcon *icon,
*
* Gives back the icon from @emblem.
*
- * Returns: (transfer full): a #GIcon. The returned object belongs to the emblem
- * and should not be modified or freed.
+ * Returns: (transfer none): a #GIcon. The returned object belongs to
+ * the emblem and should not be modified or freed.
*
* Since: 2.18
*/
@@ -240,7 +239,7 @@ g_emblem_get_icon (GEmblem *emblem)
*
* Gets the origin of the emblem.
*
- * Returns: the origin of the emblem
+ * Returns: (transfer none): the origin of the emblem
*
* Since: 2.18
*/
@@ -349,6 +348,26 @@ g_emblem_from_tokens (gchar **tokens,
return G_ICON (emblem);
}
+static GVariant *
+g_emblem_serialize (GIcon *icon)
+{
+ GEmblem *emblem = G_EMBLEM (icon);
+ GVariant *icon_data;
+ GEnumValue *origin;
+ GVariant *result;
+
+ icon_data = g_icon_serialize (emblem->icon);
+ if (!icon_data)
+ return NULL;
+
+ origin = g_enum_get_value (g_type_class_peek (G_TYPE_EMBLEM_ORIGIN), emblem->origin);
+ result = g_variant_new_parsed ("('emblem', <(%v, {'origin': <%s>})>)",
+ icon_data, origin ? origin->value_nick : "unknown");
+ g_variant_unref (icon_data);
+
+ return result;
+}
+
static void
g_emblem_iface_init (GIconIface *iface)
{
@@ -356,4 +375,5 @@ g_emblem_iface_init (GIconIface *iface)
iface->equal = g_emblem_equal;
iface->to_tokens = g_emblem_to_tokens;
iface->from_tokens = g_emblem_from_tokens;
+ iface->serialize = g_emblem_serialize;
}