summaryrefslogtreecommitdiff
path: root/gtk/gtkicontheme.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2011-05-31 20:29:53 -0400
committerMatthias Clasen <mclasen@redhat.com>2011-05-31 20:29:53 -0400
commit5abadc6d950d76ee10793703a193bfb08aae904c (patch)
treeb9610b353fa2d5a15ccdea8aef83d619b7e92391 /gtk/gtkicontheme.c
parent0705474be6d30ae58f64f2112a2bc09d1e66195c (diff)
downloadgtk+-5abadc6d950d76ee10793703a193bfb08aae904c.tar.gz
GtkIconTheme: a small optimization
John Lindgren points out in bug 650202 that using judicious use of g_key_file_has_key() can save some cycles in application startup.
Diffstat (limited to 'gtk/gtkicontheme.c')
-rw-r--r--gtk/gtkicontheme.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index d3471d6ee8..ad55d02537 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -2570,32 +2570,20 @@ theme_subdir_load (GtkIconTheme *icon_theme,
g_free (context_string);
}
- max_size = g_key_file_get_integer (theme_file, subdir, "MaxSize", &error);
- if (error)
- {
- max_size = size;
-
- g_error_free (error);
- error = NULL;
- }
-
- min_size = g_key_file_get_integer (theme_file, subdir, "MinSize", &error);
- if (error)
- {
- min_size = size;
+ if (g_key_file_has_key (theme_file, subdir, "MaxSize", NULL))
+ max_size = g_key_file_get_integer (theme_file, subdir, "MaxSize", NULL);
+ else
+ max_size = size;
- g_error_free (error);
- error = NULL;
- }
-
- threshold = g_key_file_get_integer (theme_file, subdir, "Threshold", &error);
- if (error)
- {
- threshold = 2;
+ if (g_key_file_has_key (theme_file, subdir, "MinSize", NULL))
+ min_size = g_key_file_get_integer (theme_file, subdir, "MinSize", NULL);
+ else
+ min_size = size;
- g_error_free (error);
- error = NULL;
- }
+ if (g_key_file_has_key (theme_file, subdir, "Threshold", NULL))
+ threshold = g_key_file_get_integer (theme_file, subdir, "Threshold", NULL);
+ else
+ threshold = 2;
for (d = icon_theme->priv->dir_mtimes; d; d = d->next)
{