glib r6284 - trunk/gio
- From: alexl svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r6284 - trunk/gio
- Date: Wed, 9 Jan 2008 15:20:49 +0000 (GMT)
Author: alexl
Date: Wed Jan 9 15:20:49 2008
New Revision: 6284
URL: http://svn.gnome.org/viewvc/glib?rev=6284&view=rev
Log:
2008-01-09 Alexander Larsson <alexl redhat com>
* gio.symbols:
* gthemedicon.[ch]:
Add g_themed_icon_new_with_default_fallbacks
* gunixmounts.c:
Use default fallbacks for icons
Modified:
trunk/gio/ChangeLog
trunk/gio/gio.symbols
trunk/gio/gthemedicon.c
trunk/gio/gthemedicon.h
trunk/gio/gunixmounts.c
Modified: trunk/gio/gio.symbols
==============================================================================
--- trunk/gio/gio.symbols (original)
+++ trunk/gio/gio.symbols Wed Jan 9 15:20:49 2008
@@ -609,9 +609,10 @@
#if IN_HEADER(__G_THEMED_ICON_H__)
#if IN_FILE(__G_THEMED_ICON_C__)
g_themed_icon_get_type G_GNUC_CONST
-g_themed_icon_new
-g_themed_icon_new_from_names
-g_themed_icon_get_names
+g_themed_icon_new
+g_themed_icon_new_with_default_fallbacks
+g_themed_icon_new_from_names
+g_themed_icon_get_names
#endif
#endif
Modified: trunk/gio/gthemedicon.c
==============================================================================
--- trunk/gio/gthemedicon.c (original)
+++ trunk/gio/gthemedicon.c Wed Jan 9 15:20:49 2008
@@ -22,6 +22,8 @@
#include <config.h>
+#include <string.h>
+
#include "gthemedicon.h"
#include "gioalias.h"
@@ -141,6 +143,41 @@
return G_ICON (themed);
}
+GIcon *
+g_themed_icon_new_with_default_fallbacks (const char *iconname)
+{
+ GThemedIcon *themed;
+ int i, dashes;
+ const char *p;
+ char *dashp;
+ char *last;
+
+ g_return_val_if_fail (iconname != NULL, NULL);
+
+ themed = g_object_new (G_TYPE_THEMED_ICON, NULL);
+
+ dashes = 0;
+ p = iconname;
+ while (*p)
+ {
+ if (*p == '-')
+ dashes++;
+ p++;
+ }
+
+ themed->names = g_new (char *, dashes + 1 + 1);
+ i = 0;
+ themed->names[i++] = last = g_strdup (iconname);
+
+ while ((dashp = strrchr (last, '-')) != NULL)
+ themed->names[i++] = last = g_strndup (last, dashp - last);
+
+ themed->names[i++] = NULL;
+
+ return G_ICON (themed);
+}
+
+
/**
* g_themed_icon_get_names:
* @icon: a #GThemedIcon.
Modified: trunk/gio/gthemedicon.h
==============================================================================
--- trunk/gio/gthemedicon.h (original)
+++ trunk/gio/gthemedicon.h Wed Jan 9 15:20:49 2008
@@ -49,6 +49,7 @@
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);
const char * const *g_themed_icon_get_names (GThemedIcon *icon);
Modified: trunk/gio/gunixmounts.c
==============================================================================
--- trunk/gio/gunixmounts.c (original)
+++ trunk/gio/gunixmounts.c Wed Jan 9 15:20:49 2008
@@ -1769,7 +1769,7 @@
GIcon *
g_unix_mount_guess_icon (GUnixMountEntry *mount_entry)
{
- return g_themed_icon_new (type_to_icon (g_unix_mount_guess_type (mount_entry), FALSE));
+ return g_themed_icon_new_with_default_fallbacks (type_to_icon (g_unix_mount_guess_type (mount_entry), FALSE));
}
/**
@@ -1806,7 +1806,7 @@
GIcon *
g_unix_mount_point_guess_icon (GUnixMountPoint *mount_point)
{
- return g_themed_icon_new (type_to_icon (g_unix_mount_point_guess_type (mount_point), TRUE));
+ return g_themed_icon_new_with_default_fallbacks (type_to_icon (g_unix_mount_point_guess_type (mount_point), TRUE));
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]