Commit Graph

57 Commits

Author SHA1 Message Date
Руслан Ижбулатов
8e80fd1ab9 Make sure icon cache has /-separated subdirs only (v2 - use g_build_path)
https://bugzilla.gnome.org/show_bug.cgi?id=692955
2013-02-21 19:42:46 +01:00
Matthias Clasen
9ebeb4e68a Bump GLib dependency to 2.35
And drop deprecated g_type_init() calls.
2012-11-04 13:01:38 -05:00
Benjamin Otte
12683da8f7 gtk: Make functions static that don't need to be non-static
Also remove the starting underscore from function names where
appropriate, as those functions are static now and not exported anymore.

This is part of a bunch of fixes for gcc complaining about
-Wmissing-declarations.
2012-10-02 19:32:51 +02:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Javier Jardón
d005b01319 gtk/*: Use g_list_free_full() convenience function 2012-01-05 04:22:43 +01:00
Chun-wei Fan
eb8c2dfae2 Bug 660730: Use GStatBuf for portability
Thanks to Kean Johnston for pointing this out.

There are a few places in GTK that use "struct stat",
and then g_stat(), rather than using GStatBuf.This breaks things on
Windows. Since the size of struct stat can vary depending on other
flags specified, this has the potential to cause overwrites and is
trivial to fix.

Based on patch submitted by Kean Johnston
2011-10-03 23:25:33 +08:00
Colin Walters
466d688fea updateiconcache: Don't translate g_warning/g_error 2011-04-29 10:24:21 -04:00
Matthias Clasen
d9fcc4c630 Silence new gcc warnings
gcc 4.6.0 has started to warn about set-but-unused variables.
So don't do that, then.
2011-01-23 21:51:38 -05:00
Tor Lillqvist
4e59750ac0 No fsync on Windows 2010-11-24 14:36:29 +02:00
Colin Walters
6c6b493926 iconcache: Ensure we don't lose data on power loss
fsync() should ensure our data hits disk; since corrupt icon
caches break all apps, we need to ensure it's valid.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=635307
2010-11-22 20:49:59 +01:00
Christian Dywan
6b9a3c9057 Bug 584638 - Build of gtkupdateiconcache without NLS breaks
Wrap textdomain calls in updateiconcache.c in NLS conditionals.
2009-09-03 11:30:12 +02:00
Christian Persch
e8dcf330cc Preserve errno, and always use g_strerror()
Bug #592461.
2009-08-24 15:30:00 +02:00
Ryan Lortie
6fe357965a Use g_mapped_file_unref()
- drop deprecated use of g_mapped_file_free()
  - bump glib version requirement
2009-06-18 15:11:57 -04:00
Matthias Clasen
3f20ccd710 Add a missing newline
There was a missing newline in one of the g_printerr messages
in updateiconcache.c. String change.
2009-06-12 10:21:42 -04:00
Matthias Clasen
0fd185fa6d Make gtk-update-icon-cache not fall over leftover temp files
When called with the --force option, try to remove the .icon-theme.cache
file before giving up. This fixes rh#500163.
2009-05-11 12:02:06 -04:00
Tor Lillqvist
b97d6816c8 Enclose ?: expression with parens so cast covers all of it.
2008-08-05  Tor Lillqvist  <tml@novell.com>

	* gtk/updateiconcache.c (write_bucket): Enclose ?: expression
	with parens so cast covers all of it.


svn path=/trunk/; revision=20996
2008-08-04 23:38:06 +00:00
Federico Mena Quintero
5bd03f2b44 Remove the old icon cache if regenerating it would cause it to be empty
Signed-off-by: Federico Mena Quintero <federico@novell.com>

svn path=/trunk/; revision=20865
2008-07-18 19:28:13 +00:00
Johan Dahlin
d97cdbdf53 Include "config.h" instead of <config.h> Command used: find -name
2008-06-21  Johan Dahlin  <jdahlin@async.com.br>

    * *.[ch]: Include "config.h" instead of <config.h>
    Command used:
    find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g'
    Rubberstamped by Mitch and Tim


svn path=/trunk/; revision=20669
2008-06-22 14:28:52 +00:00
Tor Lillqvist
3610acff8a Bug 536990 - updateiconcache.c: 'close ()' is redundant
2008-06-07  Tor Lillqvist  <tml@novell.com>

	Bug 536990 - updateiconcache.c: 'close ()' is redundant

	* gtk/updateiconcache.c (build_cache): Drop redundant close()
	calls. fclose() on a fdopen()ed strema closes the underlying file
	descriptor.


svn path=/trunk/; revision=20327
2008-06-07 04:19:54 +00:00
Tor Lillqvist
727a9145f6 Use g_open().
2008-06-03  Tor Lillqvist  <tml@novell.com>

	* gtk/updateiconcache.c (build_cache): Use g_open().


svn path=/trunk/; revision=20303
2008-06-03 11:04:33 +00:00
Tor Lillqvist
776c50947e Bug 535526 - updateiconcache.c: using open/close without prototype
2008-05-29  Tor Lillqvist  <tml@novell.com>

	Bug 535526 - updateiconcache.c: using open/close without prototype

	* gtk/updateiconcache.c: Include <io.h> if _MSC_VER. Also, use
	g_utime() instead of utime() for UTF-8 pathname support on Windows
	when available.


svn path=/trunk/; revision=20238
2008-05-29 18:22:38 +00:00
Tor Lillqvist
ff89f9050d Use simpler mode for open() on Windows. (No S_I?GRP and S_I?OTH bits are
2008-05-27  Tor Lillqvist  <tml@novell.com>

	* gtk/updateiconcache.c (build_cache): Use simpler mode for open()
	on Windows. (No S_I?GRP and S_I?OTH bits are defined in
	<sys/stat.h> on Windows, and the mode used in open() doesn't
	matter much as there are no rwxrwxrwx bits on Windows anyway.)
	Open file in binary mode. Passing "b" to fdopen() later isn't
	enough.


svn path=/trunk/; revision=20190
2008-05-27 13:03:49 +00:00
Cody Russell
6b06d71c2a Bug 523562 - gtk-update-icon-cache core dumps when run concurrently and
2008-05-25  Cody Russell  <bratsche@gnome.org>

        Bug 523562 - gtk-update-icon-cache core dumps when run concurrently and
        when options are missing

        * gtk/updateiconcache.c: Open the cache file (O_CREAT | O_EXCL) so     
        that other processes that try to open it will fail gracefully.  Also
        fix a crasher caused by lack of a NULL check.  Report and patch
        by Erwann Chenede.


svn path=/trunk/; revision=20167
2008-05-25 23:41:43 +00:00
Matthias Clasen
d03a5fb35c Ignore images in the toplevel theme directory, avoiding one source of
2008-02-05  Matthias Clasen  <mclasen@redhat.com>

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



svn path=/trunk/; revision=19466
2008-02-05 22:20:12 +00:00
Matthias Clasen
d9efa71c84 Fix the build
svn path=/trunk/; revision=19465
2008-02-05 21:43:26 +00:00
Matthias Clasen
c4be17ba1b Install a printerr handler that prepends the program name, since
2008-02-05  Matthias Clasen  <mclasen@redhat.com>

        * 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.


svn path=/trunk/; revision=19464
2008-02-05 18:35:54 +00:00
Michael Natterer
63af2cd041 use the right type for "subparser_data" and remove the (gpointer*) cast.
2008-01-30  Michael Natterer  <mitch@imendio.com>

	* gtk/gtkbuilderparser.c (parse_custom): use the right type for
	"subparser_data" and remove the (gpointer*) cast. Fixes bogus
	aliasing warning.

	* gtk/updateiconcache.c (add_string): cast const gchar* to
	gpointer when inserting in a GHashTable.

	* tests/testcalendar.c (calendar_detail_cb): remove const from
	return value since it's a newly allocated string.

	(calendar_update_details): free the detail.


svn path=/trunk/; revision=19431
2008-01-30 15:06:06 +00:00
Matthias Clasen
030529e04b Avoid double-free problems
svn path=/trunk/; revision=18906
2007-10-12 04:31:04 +00:00
Matthias Clasen
1e85985083 Don't use image->attach_points where image->n_attach_points was meant.
2007-09-07  Matthias Clasen  <mclasen@redhat.com>

        * gtk/updateiconcache.c (get_image_meta_data_size): Don't
        use image->attach_points where image->n_attach_points was meant.
        Pointed out by Albert Chin.


svn path=/trunk/; revision=18756
2007-09-07 19:57:33 +00:00
Matthias Clasen
2a80113304 Add an icon cache validator.
2007-05-01  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkiconcachvalidator.[hc]: Add an icon cache validator.

        * gtk/updateiconcache.c: Validate the generated cache before
        moving it in place. Also add a --validate option to validate
        an existing icon cache.

        * gtk/gtkiconcache.c: Validate icon caches before using them.

        * gtk/Makefile.am: Integrate it.


svn path=/trunk/; revision=17753
2007-05-01 20:00:17 +00:00
Matthias Clasen
82ce59cd0f Remove unnecessary NULL checks before g_free(). (#369666, Morten Welinder,
2007-03-09  Matthias Clasen <mclasen@redhat.com>

        * Everywhere: Remove unnecessary NULL checks before
        g_free().  (#369666, Morten Welinder, Djihed Afifi)

        * configure.in: Check for ftw.h



svn path=/trunk/; revision=17444
2007-03-09 21:57:37 +00:00
Matthias Clasen
d775d73c83 Handle symlinked .icon files intelligently; also avoid storing duplicate
2007-02-15  Matthias Clasen  <mclasen@redhat.com>

        * gtk/updateiconcache.c: Handle symlinked .icon files
        intelligently; also avoid storing duplicate strings.



svn path=/trunk/; revision=17298
2007-02-15 16:56:11 +00:00
Matthias Clasen
84cb26f73f Check the mtime of all directories, not just the toplevel, if ftw() is
2007-01-26  Matthias Clasen  <mclasen@redhat.com>

        * gtk/updateiconcache.c: Check the mtime of all directories,
        not just the toplevel, if ftw() is available.  (#331671, Behdad
        Esfahbod)

        * configure.in: Check for ftw.h.



svn path=/trunk/; revision=17221
2007-01-27 04:27:38 +00:00
Matthias Clasen
7bf87cf25a Include locale.h
svn path=/trunk/; revision=17026
2007-01-02 23:23:32 +00:00
Matthias Clasen
78c7c07f3b Call setlocale().
2007-01-02  Matthias Clasen  <mclasen@redhat.com>

        * gtk/updateiconcache.c (main): Call setlocale().

        * gtk/gtkfilesel.c:
        * gtk/gtkfilesystemunix.c:
        * gtk/gtkfilesystemwin32.c:
        * gtk/gtkfilechoosersettings.c:
        * gtk/updateiconcache.c: Consistently use folder instead of
        directory in translated messages.  (#344584, Javier F. Serrador)



svn path=/trunk/; revision=17024
2007-01-02 19:52:48 +00:00
Matthias Clasen
07e7719441 Apply a cleanup patch by Kjartan Maraas (#341812)
2006-10-08  Matthias Clasen  <mclasen@redhat.com>

	* Apply a cleanup patch by Kjartan Maraas  (#341812)
2006-10-08 05:07:55 +00:00
Matthias Clasen
485e607bfe Improve wording. String change! (#355128, David Lodge)
2006-09-10  Matthias Clasen  <mclasen@redhat.com>

	* gtk/updateiconcache.c: Improve wording. String change! (#355128,
	David Lodge)
2006-09-10 05:01:32 +00:00
Matthias Clasen
eb6f79d516 Marks strings for translation. (#314278, Claudio Saavedra) `
2006-06-19  Matthias Clasen  <mclasen@redhat.com>

	* gtk/updateiconcache.c: Marks strings for translation.  (#314278,
	Claudio Saavedra)
`
2006-06-19 22:32:03 +00:00
Matthias Clasen
8007463815 Don't create a big string, since Visual C++ doesn't like strings longer
2005-11-23  Matthias Clasen  <mclasen@redhat.com>

	* gtk/updateiconcache.c (write_csource): Don't create a big
	string, since Visual C++ doesn't like strings longer than 64k.
	(#322238, Kazuki IWAMOTO
2005-11-23 15:09:47 +00:00
Tor Lillqvist
30edb63134 Can't rename a file if the target exists on Win32. First rename the target
2005-11-06  Tor Lillqvist  <tml@novell.com>

	* gtk/updateiconcache.c (build_cache): Can't rename a file if the
	target exists on Win32. First rename the target temporarily, then
	if the renaming of the source to target fails, restore the
	original name for the target.

	* gtk/Makefile.am: Use EXEEXT in the dependency on gtk-update-icon-cache.
2005-11-06 06:27:01 +00:00
Matthias Clasen
b983d1c6a7 Store builtin stock icons in an icon cache, instead of populating a hash
2005-11-04  Matthias Clasen  <mclasen@redhat.com>

        Store builtin stock icons in an icon cache, instead of
        populating a hash table with pixbufs at startup, to save both
        memory and startup time.

        * gtk/stock-icons/*: Reorganize the icons in a directory structure
        suitable for gtk-update-icon-cache, and rename them to match the
        stock ids.

        * gtk/gtkiconcache.[hc]: Support non-mmapped icon caches, and
        add _gtk_icon_cache_has_icon_in_directory().

        * gtk/updateiconcache.c: Support a --source <VARIABLE> argument
        to store the contents of the icon cache in a C header.

        * gtk/gtkbuiltincache.h: Generated private header which contains
        the icon cache for the builtin icons.

        * gtk/gtkicontheme.c: Create a GtkIconCache for the builtin
        icons, and use that in addition to the hash table whenever
        builtin icons are searched.

        * gtk/gtkiconfactory.c: Add GTK_ICON_SOURCE_STATIC_ICON_NAME and
        use it for static stock ids.
        (get_default_icons): Don't add the builtin
        icons to the icon theme, just register the stock ids.
        (render_fallback_image): Take the fallback image out of the
        builtin icon cache.

        * gtk/Makefile.am: Remove stock-icons from SUBDIRS and add
        the necessary machinery to rebuild gtkbuiltincache.h.
2005-11-04 15:43:40 +00:00
Matthias Clasen
7d416fec1b Fix a use-after-free bug. (#316256, Alexander Nedotsukov)
2005-09-14  Matthias Clasen  <mclasen@redhat.com>

	* gtk/updateiconcache.c (foreach_remove_func): Fix
	a use-after-free bug.  (#316256, Alexander Nedotsukov)
2005-09-14 03:11:05 +00:00
Matthias Clasen
f906e82a93 Add a separate --ignore-theme-index option to avoid overloading --force.
2005-08-26  Matthias Clasen  <mclasen@redhat.com>

	* gtk/updateiconcache.c: Add a separate --ignore-theme-index option
	to avoid overloading --force.  (JP Rosevaar)
2005-08-26 19:05:31 +00:00
Matthias Clasen
9dbd953842 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.
2005-08-23 15:18:08 +00:00
Tor Lillqvist
c92959a448 Use g_path_get_dirname() instead of the nonportable <libgen.h> and
2005-08-15  Tor Lillqvist  <tml@novell.com>

	* gtk/updateiconcache.c: Use g_path_get_dirname() instead of
	the nonportable <libgen.h> and dirname().
2005-08-15 14:53:00 +00:00
Matthias Clasen
7ab6652629 Small fix for svg icons. 2005-08-15 03:57:04 +00:00
Matthias Clasen
329fc5da74 Store only one copy of the pixel data for symlinked icons. To achieve
2005-08-14  Matthias Clasen  <mclasen@redhat.com>

	* gtk/updateiconcache.c: Store only one copy of the pixel data
	for symlinked icons. To achieve this, maintain a hashtable
	mapping pathnames to pixel data, and share the pixel data for
	all symlinks resolving to the same pathname. When writing out
	the image data, write out the pixel data only the first time
	it is met, and store the offset pointing to the first copy
	for use in all later cases.
	This reduces the size of the Bluecurve icon cache from 40
	to 13MB. (#312972)
2005-08-15 03:52:34 +00:00
Ivan, Wong Yat Cheung
47b096e223 Fix #300218:
2005-04-11  Ivan, Wong Yat Cheung  <email@ivanwong.info>

	Fix #300218:

	* gdk/win32/gdkselection-win32.c (gdk_selection_convert): Fix
	C99ism.

	* gtk/updateiconcache.c: Guard inclusion of unistd.h and
	utime.h.
2005-04-11 18:59:05 +00:00
Matthias Clasen
af8b86b8a1 Avoid unaligned access. (#172947)
2005-04-07  Matthias Clasen  <mclasen@redhat.com>

	* gtk/updateiconcache.c (write_card16, write_card32): Avoid
	unaligned access.  (#172947)

	* gtk/gtkfilechooserdefault.c (file_list_build_popup_menu):
	Consistently use the term "Bookmarks" in the UI.  (#166906,
	Sebastian Bacher)
2005-04-07 19:10:11 +00:00
Matthias Clasen
dd893da822 Some fixes from Morten Welinder (#172947):
2005-04-07  Matthias Clasen  <mclasen@redhat.com>

	Some fixes from Morten Welinder (#172947):

	* gtk/updateiconcache.c (icon_name_hash): Make this compiler-
	and platform-independent.
	(is_cache_up_to_date): Don't compare mtimes is a stat call failed.
	(build_cache): Error out if a stat fails.
2005-04-07 18:46:19 +00:00