gtk+ r19468 - in branches/gtk-2-12: . gtk



Author: matthiasc
Date: Tue Feb  5 22:24:07 2008
New Revision: 19468
URL: http://svn.gnome.org/viewvc/gtk+?rev=19468&view=rev

Log:
2008-02-05  Matthias Clasen  <mclasen redhat com>

        Merge from trunk:

        * gtk/updateiconcache.c: Ignore images in the toplevel theme
        directory, avoiding one source of invalid caches that
        has been spotted in the wild.

        * gtk/updateiconcache.c: Install a printerr handler that
        prepends the program name, since gtk-update-icon-cache output
        often appears in the middle of other output, e.g. rpm
        update logs.




Modified:
   branches/gtk-2-12/ChangeLog
   branches/gtk-2-12/gtk/updateiconcache.c

Modified: branches/gtk-2-12/gtk/updateiconcache.c
==============================================================================
--- branches/gtk-2-12/gtk/updateiconcache.c	(original)
+++ branches/gtk-2-12/gtk/updateiconcache.c	Tue Feb  5 22:24:07 2008
@@ -623,6 +623,10 @@
 	  continue;
 	}
 
+      /* ignore images in the toplevel directory */
+      if (subdir == NULL)
+        continue;
+
       retval = g_file_test (path, G_FILE_TEST_IS_REGULAR);
       if (retval)
 	{
@@ -744,7 +748,7 @@
 static void
 add_string (const gchar *n, int offset)
 {
-  g_hash_table_insert (string_pool, n, GINT_TO_POINTER (offset));
+  g_hash_table_insert (string_pool, (gpointer) n, GINT_TO_POINTER (offset));
 }
 
 static gboolean
@@ -1473,7 +1477,7 @@
   if (!validate_file (tmp_cache_path))
     {
       g_printerr (_("The generated cache was invalid.\n"));
-      g_unlink (tmp_cache_path);
+      //g_unlink (tmp_cache_path);
       exit (1);
     }
 
@@ -1575,6 +1579,32 @@
   { NULL }
 };
 
+static void
+printerr_handler (const gchar *string)
+{
+  const gchar *charset;
+
+  fputs (g_get_prgname (), stderr);
+  fputs (": ", stderr);
+  if (g_get_charset (&charset))
+    fputs (string, stderr); /* charset is UTF-8 already */
+  else
+    {
+      gchar *result;
+
+      result = g_convert_with_fallback (string, -1, charset, "UTF-8", "?", NULL, NULL, NULL);
+      
+      if (result)
+        {
+          fputs (result, stderr);
+          g_free (result);
+        }
+   
+      fflush (stderr);
+    }
+}
+
+
 int
 main (int argc, char **argv)
 {
@@ -1583,6 +1613,8 @@
 
   if (argc < 2)
     return 0;
+
+  g_set_printerr_handler (printerr_handler);
   
   setlocale (LC_ALL, "");
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]