summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2005-08-23 15:18:08 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2005-08-23 15:18:08 +0000
commit9dbd953842f0fdc194e24894b224dffbe8d60319 (patch)
treeef5f8f314c91948f5c56e864f7671466e435df55
parentd0ef4dec8156e0eae6ef9370ff78ebdc03670d65 (diff)
downloadgdk-pixbuf-9dbd953842f0fdc194e24894b224dffbe8d60319.tar.gz
Complain when there is no index.theme file in the specified directory,
2005-08-23 Matthias Clasen <mclasen@redhat.com> * gtk/updateiconcache.c: Complain when there is no index.theme file in the specified directory, unless --force is used. Also add an --index-only option to create caches without image data.
-rw-r--r--ChangeLog4
-rw-r--r--ChangeLog.pre-2-104
-rw-r--r--ChangeLog.pre-2-84
-rw-r--r--docs/reference/ChangeLog5
-rw-r--r--docs/reference/gtk/gtk-update-icon-cache.171
-rw-r--r--docs/reference/gtk/gtk-update-icon-cache.xml18
-rw-r--r--gtk/updateiconcache.c27
7 files changed, 84 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index f93258228..929e92f4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2005-08-23 Matthias Clasen <mclasen@redhat.com>
+ * gtk/updateiconcache.c: Complain when there is no index.theme file
+ in the specified directory, unless --force is used. Also add an
+ --index-only option to create caches without image data.
+
* gtk/gtkfilechooserdefault.c (shortcuts_append_desktop): Fix a
C99ism. (#314262, Robert Jeff Mitchell)
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index f93258228..929e92f4b 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,5 +1,9 @@
2005-08-23 Matthias Clasen <mclasen@redhat.com>
+ * gtk/updateiconcache.c: Complain when there is no index.theme file
+ in the specified directory, unless --force is used. Also add an
+ --index-only option to create caches without image data.
+
* gtk/gtkfilechooserdefault.c (shortcuts_append_desktop): Fix a
C99ism. (#314262, Robert Jeff Mitchell)
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index f93258228..929e92f4b 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,5 +1,9 @@
2005-08-23 Matthias Clasen <mclasen@redhat.com>
+ * gtk/updateiconcache.c: Complain when there is no index.theme file
+ in the specified directory, unless --force is used. Also add an
+ --index-only option to create caches without image data.
+
* gtk/gtkfilechooserdefault.c (shortcuts_append_desktop): Fix a
C99ism. (#314262, Robert Jeff Mitchell)
diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog
index 5b47fccb3..68916bb88 100644
--- a/docs/reference/ChangeLog
+++ b/docs/reference/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-23 Matthias Clasen <mclasen@redhat.com>
+
+ * gtk/gtk-update-icon-cache.xml:
+ * gtk/gtk-update-icon-cache.1: Updates.
+
2005-08-16 Matthias Clasen <mclasen@redhat.com>
* gtk/tmpl/gtktreemodel.sgml: Fix an
diff --git a/docs/reference/gtk/gtk-update-icon-cache.1 b/docs/reference/gtk/gtk-update-icon-cache.1
index c9c2ca03b..8f8707eab 100644
--- a/docs/reference/gtk/gtk-update-icon-cache.1
+++ b/docs/reference/gtk/gtk-update-icon-cache.1
@@ -1,56 +1,41 @@
-.\"Generated by db2man.xsl. Don't modify this, modify the source.
-.de Sh \" Subsection
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Ip \" List item
-.br
-.ie \\n(.$>=3 .ne \\$3
-.el .ne 3
-.IP "\\$1" \\$2
-..
-.TH "GTK-UPDATE-ICON-CA" 1 "" "" ""
-.SH NAME
-gtk-update-icon-cache \- Icon theme caching utility
-.SH "SYNOPSIS"
+.\" ** You probably do not want to edit this file directly **
+.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1).
+.\" Instead of manually editing it, you probably should edit the DocBook XML
+.\" source for it and then use the DocBook XSL Stylesheets to regenerate it.
+.TH "GTK\-UPDATE\-ICON\-CACH" "1" "08/23/2005" "" ""
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
.ad l
-.hy 0
+.SH "NAME"
+gtk\-update\-icon\-cache \- Icon theme caching utility
+.SH "SYNOPSIS"
.HP 22
-\fBgtk\-update\-icon\-cache\fR [\-\-force] [\-\-quiet] {iconpath}
-.ad
-.hy
-
+\fBgtk\-update\-icon\-cache\fR [\-\-force] [\-\-index\-only] [\-\-quiet] {iconpath}
.SH "DESCRIPTION"
-
.PP
- \fBgtk\-update\-icon\-cache\fR creates mmap()able cache files for icon themes\&.
-
+\fBgtk\-update\-icon\-cache\fR
+creates mmap()able cache files for icon themes.
.PP
-If expects to be given the path to a icon theme directory, e\&.g\&. \fI/usr/share/icons/hicolor\fR, and writes a \fIicon\-theme\&.cache\fR containing cached information about the icons in the directory tree below the given directory\&.
-
+If expects to be given the path to a icon theme directory containing an
+\fIindex.theme\fR, e.g.
+\fI/usr/share/icons/hicolor\fR, and writes a
+\fIicon\-theme.cache\fR
+containing cached information about the icons in the directory tree below the given directory.
.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\&.
-
+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.
.SH "OPTIONS"
-
.TP
\-\-force, \-f
-Overwrite an existing cache file even if it appears to be uptodate\&.
-
+Overwrite an existing cache file even if it appears to be uptodate.
+.TP
+\-\-index\-only, \-i
+Don't include image data in the cache.
.TP
\-\-quiet, \-q
-Turn off verbose output\&.
-
+Turn off verbose output.
.SH "BUGS"
-
.PP
-None known yet\&.
-
+None known yet.
diff --git a/docs/reference/gtk/gtk-update-icon-cache.xml b/docs/reference/gtk/gtk-update-icon-cache.xml
index 40a847f4c..4c2afa4e0 100644
--- a/docs/reference/gtk/gtk-update-icon-cache.xml
+++ b/docs/reference/gtk/gtk-update-icon-cache.xml
@@ -14,20 +14,20 @@
<cmdsynopsis>
<command>gtk-update-icon-cache</command>
<arg choice="opt">--force</arg>
+<arg choice="opt">--index-only</arg>
<arg choice="opt">--quiet</arg>
<arg choice="req">iconpath</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
-<para>
-<command>gtk-update-icon-cache</command> creates mmap()able cache files for
+<para><command>gtk-update-icon-cache</command> creates mmap()able cache files for
icon themes.
</para>
<para>
-If expects to be given the path to a icon theme directory, e.g.
-<filename>/usr/share/icons/hicolor</filename>, and writes a
-<filename>icon-theme.cache</filename> containing cached information
+If expects to be given the path to a icon theme directory containing an
+<filename>index.theme</filename>, e.g. <filename>/usr/share/icons/hicolor</filename>,
+and writes a <filename>icon-theme.cache</filename> containing cached information
about the icons in the directory tree below the given directory.
</para>
<para>
@@ -46,6 +46,14 @@ multiple applications, the overall memory consumption is reduced as well.
<listitem><para>Overwrite an existing cache file even if it appears to be uptodate.
</para></listitem>
</varlistentry>
+
+ <varlistentry>
+ <term>--index-only</term>
+ <term>-i</term>
+ <listitem><para>Don't include image data in the cache.
+ </para></listitem>
+ </varlistentry>
+
<varlistentry>
<term>--quiet</term>
<term>-q</term>
diff --git a/gtk/updateiconcache.c b/gtk/updateiconcache.c
index 9f5fd56b8..2da6d0033 100644
--- a/gtk/updateiconcache.c
+++ b/gtk/updateiconcache.c
@@ -40,6 +40,7 @@
static gboolean force_update = FALSE;
static gboolean quiet = FALSE;
+static gboolean index_only = FALSE;
#define CACHE_NAME "icon-theme.cache"
@@ -48,7 +49,7 @@ static gboolean quiet = FALSE;
#define HAS_SUFFIX_PNG (1 << 2)
#define HAS_ICON_FILE (1 << 3)
-#define CAN_CACHE_IMAGE_DATA(flags) (((flags) & HAS_SUFFIX_PNG) || ((flags) & HAS_SUFFIX_XPM))
+#define CAN_CACHE_IMAGE_DATA(flags) (!index_only && (((flags) & HAS_SUFFIX_PNG) || ((flags) & HAS_SUFFIX_XPM)))
#define MAJOR_VERSION 1
#define MINOR_VERSION 0
@@ -87,6 +88,22 @@ is_cache_up_to_date (const gchar *path)
return cache_stat.st_mtime >= path_stat.st_mtime;
}
+gboolean
+has_theme_index (const gchar *path)
+{
+ gboolean result;
+ gchar *index_path;
+
+ index_path = g_build_filename (path, "index.theme", NULL);
+
+ result = g_file_test (index_path, G_FILE_TEST_IS_REGULAR);
+
+ g_free (index_path);
+
+ return result;
+}
+
+
typedef struct
{
gboolean has_pixdata;
@@ -1191,6 +1208,7 @@ build_cache (const gchar *path)
static GOptionEntry args[] = {
{ "force", 'f', 0, G_OPTION_ARG_NONE, &force_update, "Overwrite an existing cache, even if uptodate", NULL },
+ { "index-only", 'i', 0, G_OPTION_ARG_NONE, &index_only, "Don't include image data in the cache", NULL },
{ "quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, "Turn off verbose output", NULL },
{ NULL }
};
@@ -1214,6 +1232,13 @@ main (int argc, char **argv)
path = g_locale_to_utf8 (path, -1, NULL, NULL, NULL);
#endif
+ if (!force_update && !has_theme_index (path))
+ {
+ g_printerr ("No theme index file in '%s'.\n"
+ "If you really want to create an icon cache here, use --force.\n", path);
+ return 1;
+ }
+
if (!force_update && is_cache_up_to_date (path))
return 0;