Add g_themed_icon_prepend_name

svn path=/trunk/; revision=6991
This commit is contained in:
Matthias Clasen
2008-06-10 16:45:54 +00:00
parent e12152159f
commit 0f370f9a04
6 changed files with 62 additions and 7 deletions

View File

@@ -368,7 +368,8 @@ g_themed_icon_get_names (GThemedIcon *icon)
* </para></note>
*/
void
g_themed_icon_append_name (GThemedIcon *icon, const char *iconname)
g_themed_icon_append_name (GThemedIcon *icon,
const char *iconname)
{
guint num_names;
@@ -383,6 +384,44 @@ g_themed_icon_append_name (GThemedIcon *icon, const char *iconname)
g_object_notify (G_OBJECT (icon), "names");
}
/**
* g_themed_icon_prepend_name:
* @icon: a #GThemedIcon
* @iconname: name of icon to prepend to list of icons from within @icon.
*
* Prepend a name to the list of icons from within @icon.
*
* <note><para>
* Note that doing so invalidates the hash computed by prior calls
* to g_icon_hash().
* </para></note>
*
* Since: 2.18
*/
void
g_themed_icon_prepend_name (GThemedIcon *icon,
const char *iconname)
{
guint num_names;
gchar **names;
gint i;
g_return_if_fail (G_IS_THEMED_ICON (icon));
g_return_if_fail (iconname != NULL);
num_names = g_strv_length (icon->names);
names = g_new (char*, num_names + 2);
for (i = 0; icon->names[i]; i++)
names[i + 1] = icon->names[i];
names[0] = g_strdup (iconname);
names[num_names + 1] = NULL;
g_free (icon->names);
icon->names = names;
g_object_notify (G_OBJECT (icon), "names");
}
static guint
g_themed_icon_hash (GIcon *icon)
{