From 673f0a86b96eeacfc12ed4e1cd5d87e9a7a54983 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 1 Feb 2005 13:55:08 +0000 Subject: [PATCH] Add a --quiet option. 2005-02-01 Matthias Clasen * gtk/updateiconcache.c (main): Add a --quiet option. --- ChangeLog | 4 ++++ ChangeLog.pre-2-10 | 4 ++++ ChangeLog.pre-2-8 | 4 ++++ docs/reference/ChangeLog | 5 +++++ docs/reference/gtk/gtk-update-icon-cache.1 | 13 ++++++++--- docs/reference/gtk/gtk-update-icon-cache.xml | 23 +++++++++++++++----- gtk/updateiconcache.c | 11 ++++++---- 7 files changed, 52 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7cd4312a5b..4a9b2ecee9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-02-01 Matthias Clasen + + * gtk/updateiconcache.c (main): Add a --quiet option. + 2005-02-01 Tor Lillqvist * gdk/win32/gdkkeys-win32.c (handle_special, set_shift_vks, diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 7cd4312a5b..4a9b2ecee9 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,7 @@ +2005-02-01 Matthias Clasen + + * gtk/updateiconcache.c (main): Add a --quiet option. + 2005-02-01 Tor Lillqvist * gdk/win32/gdkkeys-win32.c (handle_special, set_shift_vks, diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 7cd4312a5b..4a9b2ecee9 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,7 @@ +2005-02-01 Matthias Clasen + + * gtk/updateiconcache.c (main): Add a --quiet option. + 2005-02-01 Tor Lillqvist * gdk/win32/gdkkeys-win32.c (handle_special, set_shift_vks, diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index c0eb467c7c..4e2b45601e 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,8 @@ +2005-02-01 Matthias Clasen + + * gtk/gtk-update-icon-cache.xml: + * gtk/gtk-update-icon-cache.1: Document the --quiet option. + 2005-01-25 Matthias Clasen * gtk/tmpl/gtksocket.sgml: diff --git a/docs/reference/gtk/gtk-update-icon-cache.1 b/docs/reference/gtk/gtk-update-icon-cache.1 index b53c02d133..c9c2ca03b8 100644 --- a/docs/reference/gtk/gtk-update-icon-cache.1 +++ b/docs/reference/gtk/gtk-update-icon-cache.1 @@ -24,7 +24,7 @@ gtk-update-icon-cache \- Icon theme caching utility .ad l .hy 0 .HP 22 -\fBgtk\-update\-icon\-cache\fR [\-\-force] {iconpath} +\fBgtk\-update\-icon\-cache\fR [\-\-force] [\-\-quiet] {iconpath} .ad .hy @@ -39,8 +39,15 @@ If expects to be given the path to a icon theme directory, e\&.g\&. \fI/usr/shar .PP GTK+ can use the cache files created by \fBgtk\-update\-icon\-cache\fR to avoid a lot of system call and disk seek overhead when the application starts\&. Since the format of the cache files allows them to be mmap()ed shared between multiple applications, the overall memory consumption is reduced as well\&. -.PP -If called with the \-\-force argument, \fBgtk\-update\-icon\-cache\fR will overwrite an existing cache file even if it appears to be uptodate\&. +.SH "OPTIONS" + +.TP +\-\-force, \-f +Overwrite an existing cache file even if it appears to be uptodate\&. + +.TP +\-\-quiet, \-q +Turn off verbose output\&. .SH "BUGS" diff --git a/docs/reference/gtk/gtk-update-icon-cache.xml b/docs/reference/gtk/gtk-update-icon-cache.xml index e7baad89d5..40a847f4c7 100644 --- a/docs/reference/gtk/gtk-update-icon-cache.xml +++ b/docs/reference/gtk/gtk-update-icon-cache.xml @@ -14,6 +14,7 @@ gtk-update-icon-cache --force +--quiet iconpath @@ -35,11 +36,23 @@ to avoid a lot of system call and disk seek overhead when the application starts Since the format of the cache files allows them to be mmap()ed shared between multiple applications, the overall memory consumption is reduced as well. - -If called with the --force argument, -gtk-update-icon-cache will overwrite an existing cache -file even if it appears to be uptodate. - + + +Options + + + --force + -f + Overwrite an existing cache file even if it appears to be uptodate. + + + + --quiet + -q + Turn off verbose output. + + + Bugs diff --git a/gtk/updateiconcache.c b/gtk/updateiconcache.c index 5231a064b6..cdf6afa5bc 100644 --- a/gtk/updateiconcache.c +++ b/gtk/updateiconcache.c @@ -29,6 +29,9 @@ #include #include +static gboolean force_update = FALSE; +static gboolean quiet = FALSE; + #define CACHE_NAME "icon-theme.cache" #define HAS_SUFFIX_XPM (1 << 0) @@ -606,13 +609,13 @@ build_cache (const gchar *path) utime_buf.modtime = cache_stat.st_mtime; utime (path, &utime_buf); - g_printerr ("Cache file created successfully.\n"); + if (!quiet) + g_printerr ("Cache file created successfully.\n"); } -static gboolean force_update = FALSE; - static GOptionEntry args[] = { - { "force", 0, 0, G_OPTION_ARG_NONE, &force_update, "Overwrite an existing cache, even if uptodate", NULL }, + { "force", 'f', 0, G_OPTION_ARG_NONE, &force_update, "Overwrite an existing cache, even if uptodate", NULL }, + { "quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, "Turn off verbose output", NULL }, { NULL } };