ui/gtk/image.c

branch
newapi
changeset 174
0358f1d9c506
parent 167
161511838ea6
child 253
087cc9216f28
equal deleted inserted replaced
173:809581724cc7 174:0358f1d9c506
27 */ 27 */
28 28
29 #include <stdio.h> 29 #include <stdio.h>
30 #include <stdlib.h> 30 #include <stdlib.h>
31 #include <string.h> 31 #include <string.h>
32 #include <ucx/map.h> 32 #include <cx/map.h>
33 33
34 #include "toolkit.h" 34 #include "toolkit.h"
35 #include "image.h" 35 #include "image.h"
36 #include "../common/properties.h" 36 #include "../common/properties.h"
37 37
38 static UcxMap *image_map; 38 static CxMap *image_map;
39 39
40 static GtkIconTheme *icon_theme; 40 static GtkIconTheme *icon_theme;
41 41
42 void ui_image_init(void) { 42 void ui_image_init(void) {
43 image_map = ucx_map_new(8); 43 image_map = cxHashMapCreateSimple(CX_STORE_POINTERS);
44 44
45 icon_theme = gtk_icon_theme_get_default(); 45 icon_theme = gtk_icon_theme_get_default();
46 } 46 }
47 47
48 // **** deprecated functions **** 48 // **** deprecated functions ****
49 49
50 GdkPixbuf* ui_get_image(const char *name) { 50 GdkPixbuf* ui_get_image(const char *name) {
51 UiImage *img = ucx_map_cstr_get(image_map, name); 51 UiImage *img = cxMapGet(image_map, name);
52 if(img) { 52 if(img) {
53 return img->pixbuf; 53 return img->pixbuf;
54 } else { 54 } else {
55 //ui_add_image(name, name); 55 //ui_add_image(name, name);
56 //return ucx_map_cstr_get(image_map, name); 56 //return ucx_map_cstr_get(image_map, name);
123 } 123 }
124 124
125 UiImage *img = malloc(sizeof(UiImage)); 125 UiImage *img = malloc(sizeof(UiImage));
126 img->pixbuf = pixbuf; 126 img->pixbuf = pixbuf;
127 if(name) { 127 if(name) {
128 ucx_map_cstr_put(image_map, name, img); 128 cxMapPut(image_map, name, img);
129 } 129 }
130 return img; 130 return img;
131 } 131 }
132 132
133 void ui_free_image(UiImage *img) { 133 void ui_free_image(UiImage *img) {

mercurial