Mercurial > pidgin.yaz
comparison libpurple/imgstore.c @ 16514:e4a1980c0090
disapproval of revision '2f959ba8a0fdac370ac610e60f6a4cd09525d928'
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Fri, 27 Apr 2007 14:25:10 +0000 |
parents | 2ae39a056179 |
children | e340dc515178 |
comparison
equal
deleted
inserted
replaced
16513:2ae39a056179 | 16514:e4a1980c0090 |
---|---|
69 purple_imgstore_add_with_id(gpointer data, size_t size, const char *filename) | 69 purple_imgstore_add_with_id(gpointer data, size_t size, const char *filename) |
70 { | 70 { |
71 PurpleStoredImage *img = purple_imgstore_add(data, size, filename); | 71 PurpleStoredImage *img = purple_imgstore_add(data, size, filename); |
72 img->id = ++nextid; | 72 img->id = ++nextid; |
73 | 73 |
74 g_hash_table_insert(imgstore, &(img->id), img); | 74 g_hash_table_insert(imgstore, GINT_TO_POINTER(img->id), img); |
75 | 75 |
76 return img->id; | 76 return img->id; |
77 } | 77 } |
78 | 78 |
79 PurpleStoredImage *purple_imgstore_find_by_id(int id) { | 79 PurpleStoredImage *purple_imgstore_find_by_id(int id) { |
80 PurpleStoredImage *img = g_hash_table_lookup(imgstore, &id); | 80 PurpleStoredImage *img = g_hash_table_lookup(imgstore, GINT_TO_POINTER(id)); |
81 | 81 |
82 if (img != NULL) | 82 if (img != NULL) |
83 purple_debug_misc("imgstore", "retrieved image id %d\n", img->id); | 83 purple_debug_misc("imgstore", "retrieved image id %d\n", img->id); |
84 | 84 |
85 return img; | 85 return img; |
153 if (img->refcount == 0) | 153 if (img->refcount == 0) |
154 { | 154 { |
155 purple_signal_emit(purple_imgstore_get_handle(), | 155 purple_signal_emit(purple_imgstore_get_handle(), |
156 "image-deleting", img); | 156 "image-deleting", img); |
157 if (img->id) | 157 if (img->id) |
158 g_hash_table_remove(imgstore, &img->id); | 158 g_hash_table_remove(imgstore, GINT_TO_POINTER(img->id)); |
159 | 159 |
160 g_free(img->data); | 160 g_free(img->data); |
161 g_free(img->filename); | 161 g_free(img->filename); |
162 g_free(img); | 162 g_free(img); |
163 } | 163 } |