From: Cosimo Cecchi Date: Wed, 10 Nov 2010 11:03:11 +0000 (+0100) Subject: emblemed-icon: allow passing a NULL emblem to g_emblemed_icon_new() X-Git-Tag: 2.27.4~52 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d28bce02dc62ac863ddafce8d525e6bc929db873;p=platform%2Fupstream%2Fglib.git emblemed-icon: allow passing a NULL emblem to g_emblemed_icon_new() So that if we already have a list of emblems we know we want to add to the icon, we can use e.g. a for loop to add them all, without picking the first and looping from the second. https://bugzilla.gnome.org/show_bug.cgi?id=634504 --- diff --git a/gio/gemblemedicon.c b/gio/gemblemedicon.c index af26c83..0364cba 100644 --- a/gio/gemblemedicon.c +++ b/gio/gemblemedicon.c @@ -95,7 +95,7 @@ g_emblemed_icon_init (GEmblemedIcon *emblemed) /** * g_emblemed_icon_new: * @icon: a #GIcon - * @emblem: a #GEmblem + * @emblem: (allow-none): a #GEmblem, or %NULL * * Creates a new emblemed icon for @icon with the emblem @emblem. * @@ -111,12 +111,12 @@ g_emblemed_icon_new (GIcon *icon, g_return_val_if_fail (G_IS_ICON (icon), NULL); g_return_val_if_fail (!G_IS_EMBLEM (icon), NULL); - g_return_val_if_fail (G_IS_EMBLEM (emblem), NULL); emblemed = G_EMBLEMED_ICON (g_object_new (G_TYPE_EMBLEMED_ICON, NULL)); emblemed->icon = g_object_ref (icon); - - g_emblemed_icon_add_emblem (emblemed, emblem); + + if (emblem != NULL) + g_emblemed_icon_add_emblem (emblemed, emblem); return G_ICON (emblemed); }