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)
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)
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)
+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
-.\"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.
<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>
<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>
static gboolean force_update = FALSE;
static gboolean quiet = FALSE;
+static gboolean index_only = FALSE;
#define CACHE_NAME "icon-theme.cache"
#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
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;
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 }
};
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;