X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gio%2Fgemblem.c;h=ed35eb2b01a2017d117b4e3f9a9e6b6e692f645e;hb=958da1e9dc82fbb91862501226b8928faf2f9558;hp=1df712b6ae559ea2b06aaf2f0e4429236e90b276;hpb=d8ca6404229e5b64d2bf2e1a3660ad9fe7feefdd;p=platform%2Fupstream%2Fglib.git diff --git a/gio/gemblem.c b/gio/gemblem.c index 1df712b..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); } @@ -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; }