After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 634504 - emblemed-icon: allow passing a NULL emblem to g_emblemed_icon_new()
emblemed-icon: allow passing a NULL emblem to g_emblemed_icon_new()
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-11-10 11:09 UTC by Cosimo Cecchi
Modified: 2010-11-10 18:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
emblemed-icon: allow passing a NULL emblem to g_emblemed_icon_new() (1.43 KB, patch)
2010-11-10 11:09 UTC, Cosimo Cecchi
committed Details | Review

Description Cosimo Cecchi 2010-11-10 11:09:17 UTC
This is useful when you already have a list of emblems you know you want to attach to a GEmblemedIcon.
If we don't allow NULL in the constructor you have to write this code:

GList *emblems, l;
GIcon *emblemed, *original;

icon = g_emblemed_icon_new (original, emblems->data);

for (l = emblems->next; l != NULL; l = l->next)
  g_emblemed_icon_add_emblem (icon, l->data);

which is less clear and more subtle than

icon = g_emblemed_icon_new (original, NULL);

for (l = emblems; l != NULL; l = l->next)
  g_emblemed_icon_add_emblem (icon, l->data);
Comment 1 Cosimo Cecchi 2010-11-10 11:09:19 UTC
Created attachment 174185 [details] [review]
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.
Comment 2 Matthias Clasen 2010-11-10 17:00:55 UTC
Review of attachment 174185 [details] [review]:

Makes sense to me. Please add an ", or %NULL" to the human-readable docs for the argument as well.
Comment 3 Cosimo Cecchi 2010-11-10 18:10:17 UTC
Attachment 174185 [details] pushed as d28bce0 - emblemed-icon: allow passing a NULL emblem to g_emblemed_icon_new()