25 |
|
|
26 |
#include "graveman.h" |
#include "graveman.h" |
27 |
|
|
28 |
GdkPixbuf *GDirIcone, *GFileIcone, *GCDIcone, *GAudioIcone, *GCDRWIcone, *GCDpetiteIcone, |
|
29 |
|
GHashTable *Gimages = NULL; |
30 |
|
|
31 |
|
/*GdkPixbuf *GDirIcone, *GFileIcone, *GCDIcone, *GAudioIcone, *GCDRWIcone, *GCDpetiteIcone, |
32 |
*GCDRWpetiteIcone, *GpetiteGraver, *GGraver, *GISOpetiteIcone, *GEraseCdrw, *GFileImage, |
*GCDRWpetiteIcone, *GpetiteGraver, *GGraver, *GISOpetiteIcone, *GEraseCdrw, *GFileImage, |
33 |
*GDVDpetiteIcone, *GDVDRWpetiteIcone, *GcharsetpetiteIcone, *GiconeOK, *GiconePASOK, *GiconeMITIGE, |
*GDVDpetiteIcone, *GDVDRWpetiteIcone, *GcharsetpetiteIcone, *GiconeOK, *GiconePASOK, *GiconeMITIGE, |
34 |
*GMenuAudio = NULL, *GMenuData = NULL, *GMenuCopy = NULL, *GMenuOther = NULL, *GMenuDvd = NULL; |
*GMenuAudio = NULL, *GMenuData = NULL, *GMenuCopy = NULL, *GMenuOther = NULL, *GMenuDvd = NULL;*/ |
35 |
|
|
36 |
|
Timages Lotherimages[] = { |
37 |
|
{ "DirIcon", "directory icon" }, |
38 |
|
{ "FileIcon", "file icon" }, |
39 |
|
{ "FileImage", "file image" }, |
40 |
|
{ "CDIcon", "cd icon" }, |
41 |
|
{ "AudioIcon", "audio icon" }, |
42 |
|
{ "CDRWIcon", "cdrw icon" }, |
43 |
|
{ "CDRWsmallIcon", "cdrw small icon" }, |
44 |
|
{ "DVDsmallIcon", "dvd small icon" }, |
45 |
|
{ "DVDRWsmallIcon", "dvdrw small icon" }, |
46 |
|
{ "CDsmallIcon", "cd small icon" }, |
47 |
|
{ "ISOsmallIcon", "iso small icon" }, |
48 |
|
{ "BurnsmallIcon", "burn small icon" }, |
49 |
|
{ "BurnIcon", "burn icon" }, |
50 |
|
{ "EraseCDRWIcon", "erase cdrw icon" }, |
51 |
|
{ "CharsetSmallIcon", "charset small icon" }, |
52 |
|
{ "OKIcon", "ok icon" }, |
53 |
|
{ "BADIcon", "bad icon" }, |
54 |
|
{ "WARNIcon", "warning icon" }, |
55 |
|
{ NULL } |
56 |
|
}; |
57 |
|
|
58 |
|
Timages Lmenuimages[] = { |
59 |
|
{ "Menu-Audio-", "menu audio icon" }, |
60 |
|
{ "Menu-Data-", "menu data icon" }, |
61 |
|
{ "Menu-Dvd-", "menu dvd icon" }, |
62 |
|
{ "Menu-Copy-", "menu copy icon" }, |
63 |
|
{ "Menu-Other-", "menu other icon" }, |
64 |
|
{ NULL } |
65 |
|
}; |
66 |
|
|
67 |
void load_all_images() |
/* charger toutes les images a partir du bon répertoire */ |
68 |
|
gboolean load_all_images() |
69 |
{ |
{ |
70 |
GDirIcone = create_pixbuf("folder5-petit.png"); |
GHashTable *Limagespath = get_imagespath_plus_from_theme(Lotherimages, conf_get_string("theme"), NULL, NULL); |
71 |
|
gchar *Lpath; |
72 |
|
gboolean Laumoinsun = FALSE; |
73 |
|
Timages *Lcurimage; |
74 |
|
|
75 |
|
if (!Limagespath) return FALSE; |
76 |
|
|
77 |
|
Gimages = _hash(); |
78 |
|
|
79 |
|
for (Lcurimage = Lotherimages; Lcurimage->code; Lcurimage++) { |
80 |
|
Lpath = g_hash_table_lookup(Limagespath, Lcurimage->code); |
81 |
|
if (!Lpath) continue; |
82 |
|
g_hash_table_insert(Gimages, Lcurimage->code, gdk_pixbuf_new_from_file((const gchar *)Lpath, NULL)); |
83 |
|
Laumoinsun = TRUE; |
84 |
|
|
85 |
|
g_free(Lpath); |
86 |
|
} |
87 |
|
|
88 |
|
g_hash_table_destroy(Limagespath); |
89 |
|
return Laumoinsun; |
90 |
|
|
91 |
|
/* GDirIcone = create_pixbuf("folder5-petit.png"); |
92 |
GFileIcone = create_pixbuf("stock_new.png"); |
GFileIcone = create_pixbuf("stock_new.png"); |
93 |
GFileImage = create_pixbuf("file_image.png"); |
GFileImage = create_pixbuf("file_image.png"); |
94 |
GCDIcone = create_pixbuf("gnome-dev-cdrom.png"); |
GCDIcone = create_pixbuf("gnome-dev-cdrom.png"); |
106 |
GiconeOK = create_pixbuf("petitok.png"); |
GiconeOK = create_pixbuf("petitok.png"); |
107 |
GiconePASOK = create_pixbuf("petitpasok.png"); |
GiconePASOK = create_pixbuf("petitpasok.png"); |
108 |
GiconeMITIGE = create_pixbuf("petitmitige.png"); |
GiconeMITIGE = create_pixbuf("petitmitige.png"); |
109 |
|
|
110 |
|
return TRUE;*/ |
111 |
} |
} |
112 |
|
|
113 |
void load_menu_images(gchar *Lquel) { |
GdkPixbuf *get_image(gchar *Aident) |
114 |
gchar Limgname[100]; |
{ |
115 |
if (G_IS_OBJECT(GMenuAudio)) g_object_unref(GMenuAudio); |
return (GdkPixbuf *) g_hash_table_lookup(Gimages, Aident); |
116 |
if (G_IS_OBJECT(GMenuData)) g_object_unref(GMenuData); |
} |
117 |
if (G_IS_OBJECT(GMenuDvd)) g_object_unref(GMenuDvd); |
|
118 |
if (G_IS_OBJECT(GMenuCopy)) g_object_unref(GMenuCopy); |
gboolean load_menu_images(gchar *Lquel) { |
119 |
if (G_IS_OBJECT(GMenuOther)) g_object_unref(GMenuOther); |
Timages *Lcurimages; |
120 |
|
GdkPixbuf *Limg; |
121 |
|
GHashTable *Limagespath = get_imagespath_plus_from_theme(Lmenuimages, |
122 |
|
conf_get_string("theme"), Lquel, NULL); |
123 |
|
Timages *Lcurimage; |
124 |
|
gboolean Laumoinsun = FALSE; |
125 |
|
gchar *Lpath; |
126 |
|
|
127 |
|
if (!Limagespath) return FALSE; |
128 |
|
|
129 |
|
if (Gimages) { |
130 |
|
for (Lcurimages = Lmenuimages; Lcurimages->code; Lcurimages++) { |
131 |
|
Limg = (GdkPixbuf *) g_hash_table_lookup(Gimages, Lcurimages->code); |
132 |
|
|
133 |
|
if (Limg) { |
134 |
|
g_object_unref(Limg); |
135 |
|
g_hash_table_remove(Gimages, Lcurimages->code); |
136 |
|
} |
137 |
|
} |
138 |
|
} |
139 |
|
|
140 |
|
for (Lcurimage = Lmenuimages; Lcurimage->code; Lcurimage++) { |
141 |
|
Lpath = g_hash_table_lookup(Limagespath, Lcurimage->code); |
142 |
|
if (!Lpath) continue; |
143 |
|
|
144 |
|
g_hash_table_insert(Gimages, Lcurimage->code, gdk_pixbuf_new_from_file((const gchar *)Lpath, NULL)); |
145 |
|
Laumoinsun = TRUE; |
146 |
|
|
147 |
g_snprintf(Limgname, sizeof(Limgname)-1, "menu-audio-%s.png", Lquel); |
g_free(Lpath); |
148 |
GMenuAudio = create_pixbuf(Limgname); |
} |
149 |
g_snprintf(Limgname, sizeof(Limgname)-1, "menu-data-%s.png", Lquel); |
|
150 |
GMenuData = create_pixbuf(Limgname); |
g_hash_table_destroy(Limagespath); |
151 |
g_snprintf(Limgname, sizeof(Limgname)-1, "menu-dvd-%s.png", Lquel); |
|
152 |
GMenuDvd = create_pixbuf(Limgname); |
return Laumoinsun; |
|
g_snprintf(Limgname, sizeof(Limgname)-1, "menu-copy-%s.png", Lquel); |
|
|
GMenuCopy = create_pixbuf(Limgname); |
|
|
g_snprintf(Limgname, sizeof(Limgname)-1, "menu-other-%s.png", Lquel); |
|
|
GMenuOther = create_pixbuf(Limgname); |
|
153 |
} |
} |
154 |
|
|
155 |
void prepare_menu_images(Tgrave *Ag) |
gboolean prepare_menu_images(Tgrave *Ag) |
156 |
{ |
{ |
157 |
gchar *Limg = conf_get_string("iconsize"); |
gchar *Limg = conf_get_string("iconsize"); |
158 |
gchar *Lcurrent = sc_grave_get_data(Ag, "_current_size"); |
gchar *Lcurrent = sc_grave_get_data(Ag, "_current_size"); |
159 |
|
gboolean Lstatus = TRUE; |
160 |
|
|
161 |
if (!Lcurrent || strcmp(Lcurrent, Limg)) { |
if (!Lcurrent || strcmp(Lcurrent, Limg)) { |
162 |
load_menu_images(Limg); |
Lstatus = load_menu_images(Limg); |
163 |
|
|
164 |
g_free(Lcurrent); |
g_free(Lcurrent); |
165 |
sc_grave_replace_data(Ag, g_strdup(Limg), "_current_size"); |
sc_grave_replace_data(Ag, g_strdup(Limg), "_current_size"); |
166 |
} |
} |
167 |
|
|
168 |
|
return Lstatus; |
169 |
} |
} |
170 |
|
|
171 |
|
|
172 |
void free_all_images() |
void free_all_images() |
173 |
{ |
{ |
174 |
g_object_unref(GiconeOK); |
/* g_object_unref(GiconeOK); |
175 |
g_object_unref(GiconePASOK); |
g_object_unref(GiconePASOK); |
176 |
g_object_unref(GiconeMITIGE); |
g_object_unref(GiconeMITIGE); |
177 |
g_object_unref(GcharsetpetiteIcone); |
g_object_unref(GcharsetpetiteIcone); |
194 |
g_object_unref(GFileImage); |
g_object_unref(GFileImage); |
195 |
g_object_unref(GFileIcone); |
g_object_unref(GFileIcone); |
196 |
g_object_unref(GDirIcone); |
g_object_unref(GDirIcone); |
197 |
|
*/ |
198 |
} |
} |
199 |
|
|
200 |
/* |
/* |