diff options
author | Anders Carlsson <andersca@imendio.com> | 2005-03-15 13:18:25 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@src.gnome.org> | 2005-03-15 13:18:25 +0000 |
commit | 3fc42d7ab9602fc8f9e41c09de427f2e76950286 (patch) | |
tree | 192c8012b453689152e3a8d6c9e67b5c5ccc774c /gtk/gtkicontheme.c | |
parent | 7c12edeb935bf74a68025896e29b6ee01896d49d (diff) | |
download | gtk+-3fc42d7ab9602fc8f9e41c09de427f2e76950286.tar.gz |
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.
Diffstat (limited to 'gtk/gtkicontheme.c')
-rw-r--r-- | gtk/gtkicontheme.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index 06740a7c42..b5000fd5c7 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -47,8 +47,6 @@ #define DEFAULT_THEME_NAME "hicolor" -typedef struct _GtkIconData GtkIconData; - typedef enum { ICON_THEME_DIR_FIXED, @@ -113,6 +111,9 @@ struct _GtkIconInfo #endif GdkPixbuf *builtin_pixbuf; + /* Cache pixbuf (if there is any) */ + GdkPixbuf *cache_pixbuf; + GtkIconData *data; /* Information about the directory where @@ -151,17 +152,6 @@ typedef struct GList *dirs; } IconTheme; -struct _GtkIconData -{ - gboolean has_embedded_rect; - gint x0, y0, x1, y1; - - GdkPoint *attach_points; - gint n_attach_points; - - gchar *display_name; -}; - typedef struct { IconThemeDirType type; @@ -1901,7 +1891,9 @@ theme_lookup_icon (IconTheme *theme, if (min_dir->icon_data != NULL) icon_info->data = g_hash_table_lookup (min_dir->icon_data, icon_name); - + else + icon_info->data = _gtk_icon_cache_get_icon_data (min_dir->cache, icon_name, min_dir->subdir); + if (icon_info->data == NULL && min_dir->cache && has_icon_file) { @@ -1923,6 +1915,12 @@ theme_lookup_icon (IconTheme *theme, g_free (icon_file_path); } + if (min_dir->cache) + { + icon_info->cache_pixbuf = _gtk_icon_cache_get_icon (min_dir->cache, icon_name, + min_dir->subdir); + } + icon_info->dir_type = min_dir->type; icon_info->dir_size = min_dir->size; icon_info->threshold = min_dir->threshold; @@ -2334,6 +2332,8 @@ gtk_icon_info_free (GtkIconInfo *icon_info) g_object_unref (icon_info->builtin_pixbuf); if (icon_info->pixbuf) g_object_unref (icon_info->pixbuf); + if (icon_info->cache_pixbuf) + g_object_unref (icon_info->cache_pixbuf); g_free (icon_info); } @@ -2519,8 +2519,11 @@ icon_info_ensure_scale_and_pixbuf (GtkIconInfo *icon_info, */ if (icon_info->builtin_pixbuf) source_pixbuf = g_object_ref (icon_info->builtin_pixbuf); + else if (icon_info->cache_pixbuf) + source_pixbuf = g_object_ref (icon_info->cache_pixbuf); else { + source_pixbuf = gdk_pixbuf_new_from_file (icon_info->filename, &icon_info->load_error); if (!source_pixbuf) |