Commit Graph

49 Commits

Author SHA1 Message Date
Timm Bäder
913b4fcc49 iconcache: Remove unused defines 2019-01-10 16:49:19 +01:00
Руслан Ижбулатов
0365dadad9 See if _MSC_VER is defined before checking its value 2018-06-10 21:21:25 +00:00
Emmanuele Bassi
a379ddefc3 Remove leading underscore from private symbols
There's no need to do that any more, as only explicitly annotated
symbols are exported.
2018-02-01 16:05:58 +01:00
Emmanuele Bassi
fe142b10bf Rename gtkiconcachevalidator.h
Follow the same convention for private headers as newer parts of GTK.
2018-02-01 16:01:38 +01:00
Emmanuele Bassi
e090c1f1a9 Rename gtkiconcache.h
The gtkiconcache.h header is private, so rename it to follow the naming
scheme for private headers.
2018-02-01 15:34:57 +01:00
Matthias Clasen
2ee7fb1818 Don't use g_print for debug output
The g_print documentation explicitly says not to do this, since
g_print is meant to be redirected by applications. Instead use
g_message for logging that can be triggered via GTK_DEBUG.
2016-02-28 21:40:23 -05:00
Matthias Clasen
bbd94b5a9f gtk: Strip newlines from g_warning and g_error
g_logv adds one for us already.
2016-02-28 12:23:12 -05:00
Руслан Ижбулатов
e44b420617 Ensure that the fstat fix is not applied on x86_64 2016-01-14 12:52:04 +00:00
Руслан Ижбулатов
59f1b87409 W32: Ensure that correct statting function is used by iconcache
With Mingw-w64 fstat() can be an inline function that
calls _fstat32() or _fstat64(), depending on some macros.
And if LFS is enabled, fstat() is defined to turn into
_fstat32i64() or _fstat64(). And some/all of the above
might also be macros as well. Side-step all that mess
and excplicitly re-define fstat as _fstat32, which is
guaranteed to use a version of "stat" struct that
has 32-bit size and time fields, which is what we want.

https://bugzilla.gnome.org/show_bug.cgi?id=760615
2016-01-14 09:44:22 +00:00
Benjamin Otte
d3bf602c60 iconcache: Remove unused function 2015-10-22 16:42:49 +02:00
Matthias Clasen
3526b08e01 Clean up debug features
Introduce a GTK_DEBUG_CHECK() macro and use it to check for
GTK_DEBUG flags everywhere. Also guard all such places by
2015-09-09 06:32:46 -04:00
Matthias Clasen
fc6f22c3ce Ignore gdk-pixbuf deprecations 2014-10-27 07:05:22 -04:00
Matthias Clasen
d1918bbb69 Avoid a compiler warning
The name_offset variable is indeed unused.
2014-06-20 15:54:51 -04:00
Matthias Clasen
b4d12fff4e GtkIconCache: Add api to find if directories are empty
This will help in not creating structs for tons of empty
directories.
2014-06-20 12:15:25 -04:00
Juan Pablo Ugarte
b5dff5e417 GtkIconCache: find_image_offset() return 0 if icon_name is NULL.
This avoid a crash calling gtk_about_dialog_set_logo_icon_name() with a NULL icon_name.
2013-11-28 16:56:11 -03:00
Alexander Larsson
280d606cd4 IconCache: Keep a ref on the GtkIconData
The icon data in GttkIconInfo->data is currently owned by the
IconThemeDir->icon_data hashtable. However, on e.g. a theme change
blow_themes() destroys the dirs and thus the data, meaning any
outstanding GtkIconInfo points to stale data.

We solve this by adding a refcount to GtkIconData and reffing it
from GtkIconInfo.

https://bugzilla.gnome.org/show_bug.cgi?id=702598
2013-06-19 09:40:19 +02:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Will Newton
96cfd3f8c7 iconcache: Always check return value of find_image_offset.
find_image_offset returns 0 if it failed to find a matching image.
Check this return value in _gtk_icon_cache_get_icon to avoid
making bad memory accesses later.

Signed-off-by: Will Newton <will.newton@imgtec.com>

https://bugzilla.gnome.org/show_bug.cgi?id=667745
2012-01-25 22:57:52 -05:00
Chun-wei Fan
5a13e08fa7 Bug 660730: Win32: Only use _fstat32 if available
_fstat32 is only introduced with msvcrt80.dll (i.e. Visual C++ 2005), in
which using this function will break compilation with MinGW, which links
against msvcrt.dll.  The msvcrt.lib in the Windows DDK which links to
a later incarnation of the msvcrt.dll in later Windows systems may have
this symbol defined, but that needs to be checked upon to be sure.

Thanks to Dieter Verfaillie for pointing out this problem.
2011-10-12 11:39:06 +08:00
Benjamin Otte
78ddecab0c iconcache: Fix gcc warning 2011-10-03 18:29:53 +02: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
Tor Lillqvist
801875b805 Replace gtk_debug_flags with getter and setter functions
Preferrably should be made just into a local variable for libgtk like
_gdk_debug_flags for libgdk. But for now used by
gtk/tests/textbuffer.c and modules/printbackends/cups/gtkprintbackendcups.c.
2010-09-08 21:31:34 +03:00
Javier Jardón
0a07e9733b gtk/: fully remove gtkalias hacks
https://bugzilla.gnome.org/show_bug.cgi?id=623845
2010-07-10 02:51:26 +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
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
Michael Natterer
824e2c74bb remove unused variable.
2008-01-14  Michael Natterer  <mitch@imendio.com>

	* gtk/gtkiconcache.c (find_image_offset): remove unused variable.


svn path=/trunk/; revision=19367
2008-01-14 14:19:21 +00:00
Matthias Clasen
f9e4618bda Two optimizations for icon cache lookups.
2007-12-03  Matthias Clasen  <mclasen@redhat.com>

        Two optimizations for icon cache lookups.

        * gtk/gtkiconcache.[hc]:
        * gtk/gtkicontheme.c: Remember the directory index for
        subdirectories, instead of running over the directory list
        again and again.

        * gtk/gtkiconcache.c (find_image_offset): Remember the last
        chain and try it first; this helps with the the usage patterns
        in gtkicontheme.c, where the same icon is queried for a lot
        of subdirectories.


svn path=/trunk/; revision=19099
2007-12-03 17:44:27 +00:00
Matthias Clasen
5f8cd8b9fb Turn off icon cache validation by default
svn path=/trunk/; revision=18823
2007-09-14 02:11:01 +00:00
Yevgen Muntyan
1a534510aa missing #include <ctype.h>.
2007-05-23  Yevgen Muntyan  <muntyan@tamu.edu>

	* gtk/gtkprintunixdialog.c: missing #include <ctype.h>.

	* gtk/gtkhandlebox.c (gtk_handle_box_paint):
	* gtk/gtkpagesetupunixdialog.c (_gtk_load_custom_papers):
	* gtk/gtkstatusbar.c (gtk_statusbar_get_context_id):
	* gtk/gtkiconcache.c (_gtk_icon_cache_new_for_path):
	* gtk/gtktrayicon-x11.c (gtk_tray_icon_send_dock_request):
	* gtk/gtkpreview.c (gtk_preview_finalize):
	* gtk/gtknotebook.c (gtk_notebook_set_group_id):
	* tests/testnotebookdnd.c (window_creation_function):
	* tests/testiconview.c (do_popup_menu):
	Fixed some compiler warnings (#440689).

svn path=/trunk/; revision=17898
2007-05-23 15:06:03 +00:00
Matthias Clasen
a5cbbdef91 Remove debug spew
svn path=/trunk/; revision=17756
2007-05-01 22:01:16 +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
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
f45a35921a Commit a patch by Behdad to fix typos, omissions and other errors in the
2006-09-10  Matthias Clasen  <mclasen@redhat.com>

        * Commit a patch by Behdad to fix typos, omissions and other
        errors in the symbol aliasing, and add checks for local PLT
        entries.  (#354687, Behdad Esfahbod)
2006-09-10 06:39:16 +00:00
Matthias Clasen
082d4176d5 Don't leak the keyfile parser in the error case.
2006-03-31  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkicontheme.c (load_icon_data): Don't leak the keyfile
	parser in the error case.

	* gtk/gtkicontheme.c (load_icon_data, free_unthemed_icon)
	(icon_data_free, load_themes):
	* gtk/gtkiconcache.c (_gtk_icon_cache_get_icon_data): Use the slice
	allocator for GtkIconData and UnthemedIcon structs.
2006-03-31 05:17:56 +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
97ef14b224 Remove an accidentally leftover duplicate pixbuf creation. (#314700,
2005-08-29  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkiconcache.c (_gtk_icon_cache_get_icon): Remove an
	accidentally leftover duplicate pixbuf creation.  (#314700,
	Kjartan Maraas)
2005-08-29 05:06:18 +00:00
Matthias Clasen
97ec1cdf4f Add a note regarding icon theme changes.
2005-08-22  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkicontheme.c (gtk_icon_theme_load_icon): Add a note
	regarding icon theme changes.

	* gtk/gtkiconcache.c (_gtk_icon_cache_get_icon): When returning
	pixbufs which are backed by the mmapped memory of an icon cache,
	increase the refcount of the icon cache, so that the memory is not
	munmapped away underneath the pixbuf upon icon theme changes.
	(#314170, Kjartan Maraas)
2005-08-22 16:38:46 +00:00
Hans Breuer
19e9165d64 updated <io.h> for open() use G_PI instead of M_PI
2005-07-03  Hans Breuer  <hans@breuer.org>

	* **/makefile.msc[.in] : updated
	* gtk/gtkiconcache.c : <io.h> for open()
	* gtk/gtkstyle.c : use G_PI instead of M_PI

	* gdk/win32/gdkcursor-win32.c : implement gdk_cursor_new_from_name()
	by mapping the lower case win32 api name to the respective cursor.
	E.g. pass "wait" to get the IDC_WAIT cursor. Also allows to load
	cursors from named resources in the executable.
	(gdk_cursor_get_image) : just return NULL for now.

	* gdk/win32/gdkgeometry-win32.c : implement gdk_window_move_region()
	by delegation to ScollWindowEx(), untested.

	* gdk/win32/gdkwindow-win32.c : stub for gdk_window_set_urgency_hint()
2005-07-03 15:47:42 +00:00
Matthias Clasen
d4c43a42ad Use GMappedFile.
2005-06-27  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkiconcache.c (_gtk_icon_cache_new_for_path): Use
	GMappedFile.

	* configure.in: Require GLib 2.7.1
2005-06-27 04:49:03 +00:00
Matthias Clasen
350a050c77 Remove a leftover debugging envvar.
2005-06-23  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkiconcache.c (_gtk_icon_cache_new_for_path): Remove
	a leftover debugging envvar.
2005-06-23 17:05:17 +00:00
Matthias Clasen
a4768daec1 Handle missing MAP_FAILED. (#308449, Georg Schwarz)
2005-06-20  Matthias Clasen  <mclasen@redhat.com>

	* xdgmimecache.c: Handle missing MAP_FAILED.  (#308449, Georg
	Schwarz)
2005-06-21 03:36:52 +00:00
Matthias Clasen
7cbd85cda2 Use the same function as in updateiconcache.c. (spotted by Morten
2005-04-08  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkiconcache.c (icon_name_hash): Use the same function
	as in updateiconcache.c.  (spotted by Morten Welinder)
2005-04-09 02:12:34 +00:00
Matthias Clasen
cca8dd6347 Make PLT-reduction work with gcc4, and don't include everything in
2005-03-20  Matthias Clasen  <mclasen@redhat.com>

	Make PLT-reduction work with gcc4, and don't include
	everything in gdkalias.h:

	* gtk/grk.symbols: Group symbols by header and source file.
	* gtk/makegtkalias.pl: Protect definitions by the same
	preprocessor symbols used to guard the headers. Move
	the alias declarations to a separate file which is
	produced when calling makegtkalias.pl -def
	* gdk/Makefile.am (gtkaliasdef.c): Add a rule to generate
	this file.
	* gtk/*.c: Include gtkalias.h after the other headers,
	include gtkaliasdef.c at the bottom.
	* gtk/*.h: Small cleanups.
2005-03-20 07:01:23 +00:00
Anders Carlsson
3fc42d7ab9 Update spec.
2005-03-15  Anders Carlsson  <andersca@imendio.com>

	* docs/iconcache.txt:
	Update spec.

	* gtk/gtkiconcache.c: (find_image_offset),
	(_gtk_icon_cache_get_icon_flags), (_gtk_icon_cache_add_icons),
	(_gtk_icon_cache_get_icon), (_gtk_icon_cache_get_icon_data):
	* gtk/gtkiconcache.h:
	Update to be able to fetch pixbuf data and icon metadata.

	* gtk/gtkicontheme.c: (theme_lookup_icon), (gtk_icon_info_free),
	(icon_info_ensure_scale_and_pixbuf):
	Use new cache functions.

	* gtk/updateiconcache.c: (foreach_remove_func), (load_icon_data),
	(maybe_cache_image_data), (scan_directory), (write_pixdata),
	(get_image_meta_data_size), (get_image_pixel_data_size),
	(get_image_data_size), (get_single_node_size), (get_bucket_size),
	(write_bucket), (main):
	Update to write pixbuf data as well as information from .icon
	files.
2005-03-15 13:18:25 +00:00
Tor Lillqvist
f3da170539 gtk/gtkaccelmap.[ch] gtk/gtkfilechooser.[ch] gtk/gtkfilesel.c
2004-12-12  Tor Lillqvist  <tml@iki.fi>

	* gtk/gtkaccelmap.[ch]
	* gtk/gtkfilechooser.[ch]
	* gtk/gtkfilesel.c
	* gtk/gtkfilesystemwin32.c
	* gtk/gtkiconfactory.[ch]
	* gtk/gtkicontheme.[ch]
	* gtk/gtkimage.[ch]
	* gtk/gtkimmodule.c
	* gtk/gtkmodules.c
	* gtk/gtkrc.[ch]
	* gtk/gtkuimanager.[ch]
	* gtk/gtkwindow.[ch]
	* gtk/updateiconcache.c
	* gtk/gtk.symbols: Use gstdio wrappers. On Windows, convert
	environment variables referring to pathnames from locale encoding
	to UTF-8. As in GLib, in order to preserve Windows DLL ABI
	stability, add binary compatibility versions of functions that
	take file names as arguments, or return file names. Add a _utf8
	suffix to the "real" such functions on Windows. The ABI
	compatibility versions keep the old name.

	* gtk/Makefile.am: Strip PRIVATE symbols from the GNU import
	library.

	* gtk/gtkiconcache.c (_gtk_icon_cache_new_for_path): Implement
	file mapping on Win32.

	* gtk/updateiconcache.c: Don't crash if invoked without
	argument. Use binary mode when opening file.

	* modules/engines/ms-windows/Theme/gtk-2.0/Makefile.am: Install
	gtkrc in correct place, in <datadir>/themes/MS-Windows/gtk-2.0.
2004-12-12 21:09:13 +00:00
Matthias Clasen
92b3cda495 *** empty log message *** 2004-10-21 19:01:29 +00:00
Matthias Clasen
a34d841d79 Implement for cached themes.
2004-10-21  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkicontheme.c (gtk_icon_theme_has_icon): Implement for
	cached themes.

	* gtk/gtkiconcache.h:
	* gtk/gtkiconcache.c (_gtk_icon_cache_has_icon): New function.

	* gtk/updateiconcache.c (scan_directory): Don't skip .icon
	files which are listed before their images.
	(foreach_remove_func): Instead filter lonely .icon files out
	here.

	* gtk/gtkicontheme.c (theme_dir_get_icon_suffix): Filter out
	the HAS_ICON_FILE flag.
2004-10-21 18:44:08 +00:00
Matthias Clasen
1cf454c93b Make it compile without mmap() and add some more checks. (#155973, Morten
2004-10-21  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkiconcache.c: Make it compile without mmap() and
	add some more checks.  (#155973, Morten Welinder)
2004-10-21 05:19:27 +00:00
Matthias Clasen
6fc2b8118a Implement icon theme caching. (#154034, Martijn Vernooij, caching schema
2004-10-19  Matthias Clasen  <mclasen@redhat.com>

	Implement icon theme caching.  (#154034, Martijn Vernooij,
	caching schema proposed by Owen Taylor, initial implementation
	by Anders Carlsson)

	* gtk/gtkdebug.h:
	* gtk/gtkmain.c: Add a "icontheme" debug flag.

	* gtk/Makefile.am (gtk_c_sources): Add gtkiconcache.c
	(gtk_private_h_sources): Add gtkiconcache.h
	(bin_PROGRAMS): Add gtk-update-icon-cache

	* gtk/gtkicontheme.c: Use icon caches if they are available.
	Currently, GTK+ uses the cache to get information about the
	available sizes, image file formats and .icon files. The
	actual image data, and the .icon file contents are not
	cached yet.

	* gtk/updateiconcache.c: A cmdline utility for generating
	icon cache files.

	* gtk/gtkiconcache.h:
	* gtk/gtkiconcache.c: The glue code to mmap an icon cache
	file and manage the information it contains.
2004-10-19 18:45:41 +00:00