[glib] emblemed-icon: allow passing a NULL emblem to g_emblemed_icon_new()



commit d28bce02dc62ac863ddafce8d525e6bc929db873
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Nov 10 12:03:11 2010 +0100

    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

 gio/gemblemedicon.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
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);
 }



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