Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct _MarlinIconInfo
- {
- GObject parent;
- guint64 last_use_time;
- gboolean is_first_ref;
- GdkPixbuf *pixbuf;
- char *display_name;
- char *icon_name;
- };
- typedef struct _MarlinIconInfo MarlinIconInfo;
- MarlinIconInfo *
- marlin_icon_info_lookup (GIcon *icon, int size)
- {
- MarlinIconInfo *icon_info;
- GdkPixbuf *pixbuf = NULL;
- g_return_val_if_fail (icon && G_IS_ICON (icon), NULL);
- if (G_IS_LOADABLE_ICON (icon)) {
- LoadableIconKey lookup_key;
- LoadableIconKey *key;
- if (loadable_icon_cache == NULL) {
- loadable_icon_cache =
- g_hash_table_new_full ((GHashFunc)loadable_icon_key_hash,
- (GEqualFunc)loadable_icon_key_equal,
- (GDestroyNotify) loadable_icon_key_free,
- (GDestroyNotify) destroy_cache_entry);
- }
- lookup_key.icon = icon;
- lookup_key.size = size;
- icon_info = g_hash_table_lookup (loadable_icon_cache, &lookup_key);
- if (icon_info != NULL) {
- //g_message ("CACHED %s stream %s\n", G_STRFUNC, g_icon_to_string (icon));
- return g_object_ref (icon_info);
- }
- char *str_icon = g_icon_to_string (icon);
- pixbuf = gdk_pixbuf_new_from_file_at_size (str_icon, size, size, NULL);
- icon_info = marlin_icon_info_new_for_pixbuf (pixbuf);
- if (pixbuf != NULL) {
- key = loadable_icon_key_new (icon, size);
- g_hash_table_insert (loadable_icon_cache, key, g_object_ref (icon_info));
- g_free (str_icon);
- }
- return icon_info;
- //snip
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement