[maemo-commits] [maemo-commits] r13758 - in projects/haf/trunk/sapwood: . src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Tue Sep 11 17:45:55 EEST 2007
- Previous message: [maemo-commits] r13757 - in projects/haf/trunk/sapwood: . src
- Next message: [maemo-commits] r13759 - projects/haf/trunk/sapwood
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: tko Date: 2007-09-11 17:45:47 +0300 (Tue, 11 Sep 2007) New Revision: 13758 Modified: projects/haf/trunk/sapwood/ChangeLog projects/haf/trunk/sapwood/src/sapwood-rc-style.c projects/haf/trunk/sapwood/src/sapwood-render.c projects/haf/trunk/sapwood/src/theme-pixbuf.h Log: Report options mismatches with gtkrc line references 2007-09-11 Tommi Komulainen <tommi.komulainen at nokia.com> * src/sapwood-render.c (theme_pixbuf_equal, theme_pixbuf_canonicalize): Move options checking to canonicalization which can be reported to the user more conveniently. * src/theme-pixbuf.h (theme_pixbuf_canonicalize): Add return value to indicate mismatch in options. * src/sapwood-rc-style.c (validate_pixbuf, CHECK_IMAGE, theme_parse_image): Turn the old macro to a function and add warning about options mismatch. Modified: projects/haf/trunk/sapwood/ChangeLog =================================================================== --- projects/haf/trunk/sapwood/ChangeLog 2007-09-11 14:06:46 UTC (rev 13757) +++ projects/haf/trunk/sapwood/ChangeLog 2007-09-11 14:45:47 UTC (rev 13758) @@ -1,5 +1,16 @@ 2007-09-11 Tommi Komulainen <tommi.komulainen at nokia.com> + * src/sapwood-render.c (theme_pixbuf_equal, theme_pixbuf_canonicalize): + Move options checking to canonicalization which can be reported to the + user more conveniently. + * src/theme-pixbuf.h (theme_pixbuf_canonicalize): Add return value to + indicate mismatch in options. + * src/sapwood-rc-style.c (validate_pixbuf, CHECK_IMAGE, + theme_parse_image): Turn the old macro to a function and add warning + about options mismatch. + +2007-09-11 Tommi Komulainen <tommi.komulainen at nokia.com> + Replace GCache of pixmaps with hash of refcounted ThemePixbufs. Since we already have 1:1 mapping between ThemePixbuf and Modified: projects/haf/trunk/sapwood/src/sapwood-rc-style.c =================================================================== --- projects/haf/trunk/sapwood/src/sapwood-rc-style.c 2007-09-11 14:06:46 UTC (rev 13757) +++ projects/haf/trunk/sapwood/src/sapwood-rc-style.c 2007-09-11 14:45:47 UTC (rev 13758) @@ -589,6 +589,31 @@ } } +static void +validate_pixbuf (GScanner *scanner, ThemePixbuf **theme_pb, const char *name) +{ + if (!*theme_pb) + return; + + if (!(*theme_pb)->basename) + { + g_scanner_warn (scanner, "%sborder (or %sstretch) without valid %sfile", name, name, name); + theme_pixbuf_unref (*theme_pb); + *theme_pb = NULL; + } + else + { + gboolean warn = FALSE; + + *theme_pb = theme_pixbuf_canonicalize (*theme_pb, &warn); + + if (warn) + g_scanner_warn (scanner, "file %s previously referenced with different" + " border or stretch values. Ignoring the new values.", + (*theme_pb)->basename); + } +} + static guint theme_parse_image(GtkSettings *settings, GScanner *scanner, @@ -695,25 +720,12 @@ token = g_scanner_get_next_token(scanner); -#define CHECK_IMAGE(image, name) G_STMT_START{ \ - if (image && !image->basename) \ - { \ - g_scanner_warn (scanner, #name " image options specified without filename"); \ - theme_pixbuf_unref (image); \ - image = NULL; \ - } \ - else if (image) \ - image = theme_pixbuf_canonicalize (image); \ -}G_STMT_END + validate_pixbuf(scanner, &data->background, ""); + validate_pixbuf(scanner, &data->overlay, "overlay_"); + validate_pixbuf(scanner, &data->gap, "gap_"); + validate_pixbuf(scanner, &data->gap_start, "gap_start_"); + validate_pixbuf(scanner, &data->gap_end, "gap_end_"); - CHECK_IMAGE(data->background, "Background"); - CHECK_IMAGE(data->overlay, "Overlay"); - CHECK_IMAGE(data->gap, "Gap"); - CHECK_IMAGE(data->gap_start, "Gap start"); - CHECK_IMAGE(data->gap_end, "Gap end"); - -#undef CHECK_IMAGE - if (token != G_TOKEN_RIGHT_CURLY) { /* error - cleanup for exit */ Modified: projects/haf/trunk/sapwood/src/sapwood-render.c =================================================================== --- projects/haf/trunk/sapwood/src/sapwood-render.c 2007-09-11 14:06:46 UTC (rev 13757) +++ projects/haf/trunk/sapwood/src/sapwood-render.c 2007-09-11 14:45:47 UTC (rev 13758) @@ -103,32 +103,18 @@ !g_str_equal (a->basename, b->basename)) return FALSE; - if (a->border_bottom != b->border_bottom || - a->border_top != b->border_top || - a->border_left != b->border_left || - a->border_right != b->border_right) - { - g_warning ("file: %s", a->basename); - if (a->border_bottom != b->border_bottom) - g_warning ("border_bottom differs"); - if (a->border_top != b->border_top) - g_warning ("border_top differs"); - if (a->border_left != b->border_left) - g_warning ("border_left differs"); - if (a->border_right != b->border_right) - g_warning ("border_right differs"); - } - return TRUE; } ThemePixbuf * -theme_pixbuf_canonicalize (ThemePixbuf *theme_pb) +theme_pixbuf_canonicalize (ThemePixbuf *theme_pb, gboolean *warn) { ThemePixbuf *canon; g_assert (theme_pb->pixmap == NULL); + *warn = FALSE; + if (!pixbuf_hash) pixbuf_hash = g_hash_table_new (theme_pixbuf_hash, theme_pixbuf_equal); @@ -141,6 +127,13 @@ } else { + if (theme_pb->border_bottom != canon->border_bottom || + theme_pb->border_top != canon->border_top || + theme_pb->border_left != canon->border_left || + theme_pb->border_right != canon->border_right || + theme_pb->stretch != canon->stretch) + *warn = TRUE; + theme_pixbuf_ref (canon); theme_pixbuf_unref (theme_pb); } Modified: projects/haf/trunk/sapwood/src/theme-pixbuf.h =================================================================== --- projects/haf/trunk/sapwood/src/theme-pixbuf.h 2007-09-11 14:06:46 UTC (rev 13757) +++ projects/haf/trunk/sapwood/src/theme-pixbuf.h 2007-09-11 14:45:47 UTC (rev 13758) @@ -179,7 +179,8 @@ ThemePixbuf *theme_pixbuf_new (void) G_GNUC_INTERNAL; void theme_pixbuf_unref (ThemePixbuf *theme_pb) G_GNUC_INTERNAL; -ThemePixbuf *theme_pixbuf_canonicalize (ThemePixbuf *theme_pb) G_GNUC_INTERNAL; +ThemePixbuf *theme_pixbuf_canonicalize (ThemePixbuf *theme_pb, + gboolean *warn) G_GNUC_INTERNAL; void theme_pixbuf_set_filename (ThemePixbuf *theme_pb, const char *filename) G_GNUC_INTERNAL; gboolean theme_pixbuf_get_geometry (ThemePixbuf *theme_pb,
- Previous message: [maemo-commits] r13757 - in projects/haf/trunk/sapwood: . src
- Next message: [maemo-commits] r13759 - projects/haf/trunk/sapwood
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]