summaryrefslogtreecommitdiff
path: root/gtk/gtkiconcache.c
Commit message (Collapse)AuthorAgeFilesLines
* Avoid a compiler warningMatthias Clasen2014-06-201-2/+0
| | | | The name_offset variable is indeed unused.
* GtkIconCache: Add api to find if directories are emptyMatthias Clasen2014-06-201-0/+42
| | | | | This will help in not creating structs for tons of empty directories.
* GtkIconCache: find_image_offset() return 0 if icon_name is NULL.Juan Pablo Ugarte2013-11-281-0/+3
| | | | This avoid a crash calling gtk_about_dialog_set_logo_icon_name() with a NULL icon_name.
* IconCache: Keep a ref on the GtkIconDataAlexander Larsson2013-06-191-0/+1
| | | | | | | | | | | | 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
* Change FSF AddressJavier Jardón2012-02-271-3/+1
|
* iconcache: Always check return value of find_image_offset.Will Newton2012-01-251-0/+3
| | | | | | | | | | 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
* Bug 660730: Win32: Only use _fstat32 if availableChun-wei Fan2011-10-121-0/+6
| | | | | | | | | | _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.
* iconcache: Fix gcc warningBenjamin Otte2011-10-031-6/+7
|
* Bug 660730: Use GStatBuf for portabilityChun-wei Fan2011-10-031-3/+8
| | | | | | | | | | | | 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
* Replace gtk_debug_flags with getter and setter functionsTor Lillqvist2010-09-081-1/+1
| | | | | | 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.
* gtk/: fully remove gtkalias hacksJavier Jardón2010-07-101-1/+0
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=623845
* Use g_mapped_file_unref()Ryan Lortie2009-06-181-2/+2
| | | | | - drop deprecated use of g_mapped_file_free() - bump glib version requirement
* Include "config.h" instead of <config.h> Command used: find -nameJohan Dahlin2008-06-221-1/+1
| | | | | | | | | | | | 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
* remove unused variable.Michael Natterer2008-01-141-1/+0
| | | | | | | | | 2008-01-14 Michael Natterer <mitch@imendio.com> * gtk/gtkiconcache.c (find_image_offset): remove unused variable. svn path=/trunk/; revision=19367
* Two optimizations for icon cache lookups.Matthias Clasen2007-12-031-22/+33
| | | | | | | | | | | | | | | | | | | 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
* Turn off icon cache validation by defaultMatthias Clasen2007-09-141-5/+10
| | | | svn path=/trunk/; revision=18823
* missing #include <ctype.h>.Yevgen Muntyan2007-05-231-1/+0
| | | | | | | | | | | | | | | | | | | 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
* Remove debug spewMatthias Clasen2007-05-011-2/+1
| | | | svn path=/trunk/; revision=17756
* Add an icon cache validator.Matthias Clasen2007-05-011-11/+14
| | | | | | | | | | | | | | | | | 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
* Apply a cleanup patch by Kjartan Maraas (#341812)Matthias Clasen2006-10-081-1/+1
| | | | | | 2006-10-08 Matthias Clasen <mclasen@redhat.com> * Apply a cleanup patch by Kjartan Maraas (#341812)
* Commit a patch by Behdad to fix typos, omissions and other errors in theMatthias Clasen2006-09-101-0/+2
| | | | | | | | 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)
* Don't leak the keyfile parser in the error case.Matthias Clasen2006-03-311-1/+1
| | | | | | | | | | | | 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.
* Store builtin stock icons in an icon cache, instead of populating a hashMatthias Clasen2005-11-041-4/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Remove an accidentally leftover duplicate pixbuf creation. (#314700,Matthias Clasen2005-08-291-2/+0
| | | | | | | | 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)
* Add a note regarding icon theme changes.Matthias Clasen2005-08-221-1/+17
| | | | | | | | | | | | | 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)
* updated <io.h> for open() use G_PI instead of M_PIHans Breuer2005-07-031-0/+3
| | | | | | | | | | | | | | | | | | | 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()
* Use GMappedFile.Matthias Clasen2005-06-271-65/+17
| | | | | | | | | 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
* Remove a leftover debugging envvar.Matthias Clasen2005-06-231-4/+1
| | | | | | | 2005-06-23 Matthias Clasen <mclasen@redhat.com> * gtk/gtkiconcache.c (_gtk_icon_cache_new_for_path): Remove a leftover debugging envvar.
* Handle missing MAP_FAILED. (#308449, Georg Schwarz)Matthias Clasen2005-06-211-0/+4
| | | | | | | 2005-06-20 Matthias Clasen <mclasen@redhat.com> * xdgmimecache.c: Handle missing MAP_FAILED. (#308449, Georg Schwarz)
* Use the same function as in updateiconcache.c. (spotted by MortenMatthias Clasen2005-04-091-2/+2
| | | | | | | 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)
* Make PLT-reduction work with gcc4, and don't include everything inMatthias Clasen2005-03-201-1/+1
| | | | | | | | | | | | | | | | | | 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.
* Update spec.Anders Carlsson2005-03-151-8/+161
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* gtk/gtkaccelmap.[ch] gtk/gtkfilechooser.[ch] gtk/gtkfilesel.cTor Lillqvist2004-12-121-13/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* *** empty log message ***Matthias Clasen2004-10-211-7/+8
|
* Implement for cached themes.Matthias Clasen2004-10-211-3/+31
| | | | | | | | | | | | | | | | | | 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.
* Make it compile without mmap() and add some more checks. (#155973, MortenMatthias Clasen2004-10-211-13/+20
| | | | | | | 2004-10-21 Matthias Clasen <mclasen@redhat.com> * gtk/gtkiconcache.c: Make it compile without mmap() and add some more checks. (#155973, Morten Welinder)
* Implement icon theme caching. (#154034, Martijn Vernooij, caching schemaMatthias Clasen2004-10-191-0/+280
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.