]> Pileus Git - ~andy/gtk/commitdiff
Complain when there is no index.theme file in the specified directory,
authorMatthias Clasen <mclasen@redhat.com>
Tue, 23 Aug 2005 15:18:08 +0000 (15:18 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 23 Aug 2005 15:18:08 +0000 (15:18 +0000)
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.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-8
docs/reference/ChangeLog
docs/reference/gtk/gtk-update-icon-cache.1
docs/reference/gtk/gtk-update-icon-cache.xml
gtk/updateiconcache.c

index f932582284097a9824ee9fe95de6d74171d8827b..929e92f4ba56eaa0acc70ba84bedf0fafb955bba 100644 (file)
--- 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)
        
index f932582284097a9824ee9fe95de6d74171d8827b..929e92f4ba56eaa0acc70ba84bedf0fafb955bba 100644 (file)
@@ -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)
        
index f932582284097a9824ee9fe95de6d74171d8827b..929e92f4ba56eaa0acc70ba84bedf0fafb955bba 100644 (file)
@@ -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)
        
index 5b47fccb39a4fb3dad0bb89cbe123b300028114f..68916bb88dc837a74935ae24b26c2a85ec5b702f 100644 (file)
@@ -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 
index c9c2ca03b8c1d92d89cbde3dba597cabce967433..8f8707eab0f4bccc86a16ef41c3204b0b821a78a 100644 (file)
@@ -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.
index 40a847f4c7872629a6fad7c632618ad20ed38d8a..4c2afa4e0194a12007c99580cad12602e947ec41 100644 (file)
 <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>
index 9f5fd56b8627369cb225ba23c17c0f11b71fe4e4..2da6d00330ba82c993a1789d1288752b44d62e8a 100644 (file)
@@ -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;