Add g_themed_icon_prepend_name
authorMatthias Clasen <matthiasc@src.gnome.org>
Tue, 10 Jun 2008 16:45:54 +0000 (16:45 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 10 Jun 2008 16:45:54 +0000 (16:45 +0000)
svn path=/trunk/; revision=6991

docs/reference/ChangeLog
docs/reference/gio/gio-sections.txt
gio/ChangeLog
gio/gio.symbols
gio/gthemedicon.c
gio/gthemedicon.h

index e1783854949e287b9682edfe05dcbe98cb65d3aa..1d3dee2048dca43d51bf62a66708c9666d93b6ae 100644 (file)
@@ -1,3 +1,7 @@
+2008-06-10  Matthias Clasen  <mclasen@redhat.com>
+
+       * gio/gio-sections.txt: Add g_themed_icon_prepend_name
+
 2008-06-10 14:06:34  Tim Janik  <timj@imendio.com>
 
        * gobject/tmpl/gtype.sgml: fixed documentation regarding type checking
index 2bd491bb18124611c13af99abbf464416385786c..1c25bf4fa24914387e4e2acc87bbad312be3e129 100644 (file)
@@ -364,6 +364,7 @@ GThemedIcon
 g_themed_icon_new
 g_themed_icon_new_from_names
 g_themed_icon_new_with_default_fallbacks
+g_themed_icon_prepend_name
 g_themed_icon_append_name
 <SUBSECTION Standard>
 GThemedIconClass
index 8bf6de99bd31e23705d96fc5516fcc9f55abc538..68ab141c3eb63e7a4d418bb5147b8b3afbef8a76 100644 (file)
@@ -1,6 +1,12 @@
 2008-06-10  Matthias Clasen <mclasen@redhat.com>
 
-       ug 537392 – Additional colon in xattr name
+       * gio.symbols:
+       * gthemedicon.[hc] (g_themed_icon_prepend_name): New function,
+       to add a name to the front of the list.
+
+2008-06-10  Matthias Clasen <mclasen@redhat.com>
+
+       Bug 537392 – Additional colon in xattr name
 
        * glocalfileinfo.c (set_xattr): Skip the second colon of the prefix,
        too. Reported by  Alessandro Morandi 
index 202645edbac33169ea7857f8bab172dffd1d25a5..6a34fd4309e60a5ebc1f15cdfbb715a2c7d7e124 100644 (file)
@@ -633,6 +633,7 @@ g_themed_icon_new
 g_themed_icon_new_with_default_fallbacks
 g_themed_icon_new_from_names
 g_themed_icon_get_names
+g_themed_icon_prepend_name
 g_themed_icon_append_name
 #endif
 #endif
index d59f69697497cefac096ce50f25b9afa79cfcaf1..096a9004eb43e045f263a03e0528daacc0a61211 100644 (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)
 {
index 5fb8a6b4e4c9a54c2f6fe652781cc386ca97acfb..b2b82acf514e4af2809405fadeaeda9dffa2b570 100644 (file)
@@ -48,12 +48,16 @@ typedef struct _GThemedIconClass   GThemedIconClass;
 
 GType g_themed_icon_get_type (void) G_GNUC_CONST;
   
-GIcon *g_themed_icon_new (const char *iconname);
-GIcon *g_themed_icon_new_with_default_fallbacks (const char *iconname);
-GIcon *g_themed_icon_new_from_names (char **iconnames, int len);
-void   g_themed_icon_append_name (GThemedIcon *icon, const char *iconname);
+GIcon *g_themed_icon_new                        (const char  *iconname);
+GIcon *g_themed_icon_new_with_default_fallbacks (const char  *iconname);
+GIcon *g_themed_icon_new_from_names             (char       **iconnames, 
+                                                 int          len);
+void   g_themed_icon_prepend_name               (GThemedIcon *icon, 
+                                                 const char  *iconname);
+void   g_themed_icon_append_name                (GThemedIcon *icon, 
+                                                 const char  *iconname);
 
-const char * const *g_themed_icon_get_names (GThemedIcon *icon);
+const char * const *g_themed_icon_get_names     (GThemedIcon *icon);
 
 G_END_DECLS