[gtk+/win32-theme] win32-theme: The theme class is case insensitive, so treat it as such
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/win32-theme] win32-theme: The theme class is case insensitive, so treat it as such
- Date: Wed, 16 Nov 2011 12:09:39 +0000 (UTC)
commit f6189b4e6d9f811b5355753a7c35baf54b0dd059
Author: Alexander Larsson <alexl redhat com>
Date: Wed Nov 16 12:17:02 2011 +0100
win32-theme: The theme class is case insensitive, so treat it as such
We always lower the strings so that lookups with different cases
get the same HTHEME.
gtk/gtkwin32theme.c | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkwin32theme.c b/gtk/gtkwin32theme.c
index aec62f9..f215017 100644
--- a/gtk/gtkwin32theme.c
+++ b/gtk/gtkwin32theme.c
@@ -144,21 +144,29 @@ lookup_htheme_by_classname (const char *class)
{
HTHEME theme;
guint16 *wclass;
+ char *lower;
- theme = (HTHEME) g_hash_table_lookup (hthemes_by_class, class);
- if (theme)
- return theme;
+ lower = g_ascii_strdown (class, -1);
- wclass = g_utf8_to_utf16 (class, -1, NULL, NULL, NULL);
+ theme = (HTHEME) g_hash_table_lookup (hthemes_by_class, lower);
+ if (theme)
+ {
+ g_free (lower);
+ return theme;
+ }
+ wclass = g_utf8_to_utf16 (lower, -1, NULL, NULL, NULL);
theme = open_theme_data (NULL, wclass);
-
g_free (wclass);
if (theme == NULL)
- return NULL;
-
- g_hash_table_insert (hthemes_by_class, g_strdup (class), theme);
+ {
+ g_free (lower);
+ return NULL;
+ }
+
+ /* Takes ownership of lower: */
+ g_hash_table_insert (hthemes_by_class, lower, theme);
return theme;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]