[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Graveman-cvs] Changes to graveman/current/src/images.c
From: |
sylvain cresto |
Subject: |
[Graveman-cvs] Changes to graveman/current/src/images.c |
Date: |
Tue, 19 Apr 2005 21:00:43 -0400 |
Index: graveman/current/src/images.c
diff -u graveman/current/src/images.c:1.11 graveman/current/src/images.c:1.12
--- graveman/current/src/images.c:1.11 Thu Mar 3 23:06:26 2005
+++ graveman/current/src/images.c Wed Apr 20 01:00:31 2005
@@ -25,15 +25,70 @@
#include "graveman.h"
-GdkPixbuf *GDirIcone, *GFileIcone, *GCDIcone, *GAudioIcone, *GCDRWIcone,
*GCDpetiteIcone,
+
+GHashTable *Gimages = NULL;
+
+/*GdkPixbuf *GDirIcone, *GFileIcone, *GCDIcone, *GAudioIcone, *GCDRWIcone,
*GCDpetiteIcone,
*GCDRWpetiteIcone, *GpetiteGraver, *GGraver, *GISOpetiteIcone, *GEraseCdrw,
*GFileImage,
*GDVDpetiteIcone, *GDVDRWpetiteIcone, *GcharsetpetiteIcone, *GiconeOK,
*GiconePASOK, *GiconeMITIGE,
- *GMenuAudio = NULL, *GMenuData = NULL, *GMenuCopy = NULL, *GMenuOther =
NULL, *GMenuDvd = NULL;
+ *GMenuAudio = NULL, *GMenuData = NULL, *GMenuCopy = NULL, *GMenuOther =
NULL, *GMenuDvd = NULL;*/
+Timages Lotherimages[] = {
+ { "DirIcon", "directory icon" },
+ { "FileIcon", "file icon" },
+ { "FileImage", "file image" },
+ { "CDIcon", "cd icon" },
+ { "AudioIcon", "audio icon" },
+ { "CDRWIcon", "cdrw icon" },
+ { "CDRWsmallIcon", "cdrw small icon" },
+ { "DVDsmallIcon", "dvd small icon" },
+ { "DVDRWsmallIcon", "dvdrw small icon" },
+ { "CDsmallIcon", "cd small icon" },
+ { "ISOsmallIcon", "iso small icon" },
+ { "BurnsmallIcon", "burn small icon" },
+ { "BurnIcon", "burn icon" },
+ { "EraseCDRWIcon", "erase cdrw icon" },
+ { "CharsetSmallIcon", "charset small icon" },
+ { "OKIcon", "ok icon" },
+ { "BADIcon", "bad icon" },
+ { "WARNIcon", "warning icon" },
+ { NULL }
+ };
+
+Timages Lmenuimages[] = {
+ { "Menu-Audio-", "menu audio icon" },
+ { "Menu-Data-", "menu data icon" },
+ { "Menu-Dvd-", "menu dvd icon" },
+ { "Menu-Copy-", "menu copy icon" },
+ { "Menu-Other-", "menu other icon" },
+ { NULL }
+ };
-void load_all_images()
+/* charger toutes les images a partir du bon répertoire */
+gboolean load_all_images()
{
- GDirIcone = create_pixbuf("folder5-petit.png");
+ GHashTable *Limagespath = get_imagespath_plus_from_theme(Lotherimages,
conf_get_string("theme"), NULL, NULL);
+ gchar *Lpath;
+ gboolean Laumoinsun = FALSE;
+ Timages *Lcurimage;
+
+ if (!Limagespath) return FALSE;
+
+ Gimages = _hash();
+
+ for (Lcurimage = Lotherimages; Lcurimage->code; Lcurimage++) {
+ Lpath = g_hash_table_lookup(Limagespath, Lcurimage->code);
+ if (!Lpath) continue;
+ g_hash_table_insert(Gimages, Lcurimage->code,
gdk_pixbuf_new_from_file((const gchar *)Lpath, NULL));
+ Laumoinsun = TRUE;
+
+ g_free(Lpath);
+ }
+
+ g_hash_table_destroy(Limagespath);
+ return Laumoinsun;
+
+/* GDirIcone = create_pixbuf("folder5-petit.png");
GFileIcone = create_pixbuf("stock_new.png");
GFileImage = create_pixbuf("file_image.png");
GCDIcone = create_pixbuf("gnome-dev-cdrom.png");
@@ -51,45 +106,72 @@
GiconeOK = create_pixbuf("petitok.png");
GiconePASOK = create_pixbuf("petitpasok.png");
GiconeMITIGE = create_pixbuf("petitmitige.png");
+
+ return TRUE;*/
}
-void load_menu_images(gchar *Lquel) {
- gchar Limgname[100];
- if (G_IS_OBJECT(GMenuAudio)) g_object_unref(GMenuAudio);
- if (G_IS_OBJECT(GMenuData)) g_object_unref(GMenuData);
- if (G_IS_OBJECT(GMenuDvd)) g_object_unref(GMenuDvd);
- if (G_IS_OBJECT(GMenuCopy)) g_object_unref(GMenuCopy);
- if (G_IS_OBJECT(GMenuOther)) g_object_unref(GMenuOther);
+GdkPixbuf *get_image(gchar *Aident)
+{
+ return (GdkPixbuf *) g_hash_table_lookup(Gimages, Aident);
+}
+
+gboolean load_menu_images(gchar *Lquel) {
+ Timages *Lcurimages;
+ GdkPixbuf *Limg;
+ GHashTable *Limagespath = get_imagespath_plus_from_theme(Lmenuimages,
+ conf_get_string("theme"), Lquel, NULL);
+ Timages *Lcurimage;
+ gboolean Laumoinsun = FALSE;
+ gchar *Lpath;
+
+ if (!Limagespath) return FALSE;
+
+ if (Gimages) {
+ for (Lcurimages = Lmenuimages; Lcurimages->code; Lcurimages++) {
+ Limg = (GdkPixbuf *) g_hash_table_lookup(Gimages, Lcurimages->code);
+
+ if (Limg) {
+ g_object_unref(Limg);
+ g_hash_table_remove(Gimages, Lcurimages->code);
+ }
+ }
+ }
+
+ for (Lcurimage = Lmenuimages; Lcurimage->code; Lcurimage++) {
+ Lpath = g_hash_table_lookup(Limagespath, Lcurimage->code);
+ if (!Lpath) continue;
+
+ g_hash_table_insert(Gimages, Lcurimage->code,
gdk_pixbuf_new_from_file((const gchar *)Lpath, NULL));
+ Laumoinsun = TRUE;
- g_snprintf(Limgname, sizeof(Limgname)-1, "menu-audio-%s.png", Lquel);
- GMenuAudio = create_pixbuf(Limgname);
- g_snprintf(Limgname, sizeof(Limgname)-1, "menu-data-%s.png", Lquel);
- GMenuData = create_pixbuf(Limgname);
- g_snprintf(Limgname, sizeof(Limgname)-1, "menu-dvd-%s.png", Lquel);
- GMenuDvd = create_pixbuf(Limgname);
- 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);
+ g_free(Lpath);
+ }
+
+ g_hash_table_destroy(Limagespath);
+
+ return Laumoinsun;
}
-void prepare_menu_images(Tgrave *Ag)
+gboolean prepare_menu_images(Tgrave *Ag)
{
gchar *Limg = conf_get_string("iconsize");
gchar *Lcurrent = sc_grave_get_data(Ag, "_current_size");
+ gboolean Lstatus = TRUE;
if (!Lcurrent || strcmp(Lcurrent, Limg)) {
- load_menu_images(Limg);
+ Lstatus = load_menu_images(Limg);
g_free(Lcurrent);
sc_grave_replace_data(Ag, g_strdup(Limg), "_current_size");
}
+
+ return Lstatus;
}
void free_all_images()
{
- g_object_unref(GiconeOK);
+/* g_object_unref(GiconeOK);
g_object_unref(GiconePASOK);
g_object_unref(GiconeMITIGE);
g_object_unref(GcharsetpetiteIcone);
@@ -112,7 +194,7 @@
g_object_unref(GFileImage);
g_object_unref(GFileIcone);
g_object_unref(GDirIcone);
-
+*/
}
/*
- [Graveman-cvs] Changes to graveman/current/src/images.c,
sylvain cresto <=