22 |
* |
* |
23 |
*/ |
*/ |
24 |
|
|
|
/* ce code a été a la base generé par glade-2 ! */ |
|
|
|
|
25 |
#include "graveman.h" |
#include "graveman.h" |
26 |
|
|
27 |
static GdkCursor *_cursor = NULL; |
static GdkCursor *_cursor = NULL; |
28 |
|
|
|
static GList *pixmaps_directories = NULL; |
|
|
|
|
|
/* Use this function to set the directory containing installed pixmaps. */ |
|
|
void add_pixmap_directory (const gchar *Adirectory) |
|
|
{ |
|
|
pixmaps_directories = g_list_prepend (pixmaps_directories, g_strdup (Adirectory)); |
|
|
} |
|
|
|
|
|
/* This is an internally used function to find pixmap files. */ |
|
|
static gchar* find_pixmap_file (const gchar *Afilename) |
|
|
{ |
|
|
GList *Lelem; |
|
|
|
|
|
/* We step through each of the pixmaps directory to find it. */ |
|
|
Lelem = pixmaps_directories; |
|
|
while (Lelem) |
|
|
{ |
|
|
gchar *Lpathname = g_strdup_printf ("%s%s%s", (gchar*)Lelem->data, |
|
|
G_DIR_SEPARATOR_S, Afilename); |
|
|
if (g_file_test (Lpathname, G_FILE_TEST_EXISTS)) |
|
|
return Lpathname; |
|
|
g_free (Lpathname); |
|
|
Lelem = Lelem->next; |
|
|
} |
|
|
return NULL; |
|
|
} |
|
|
|
|
|
/* This is an internally used function to create pixmaps. */ |
|
|
GtkWidget* create_pixmap (const gchar *Afilename) |
|
|
{ |
|
|
gchar *Lpathname = NULL; |
|
|
GtkWidget *Lpixmap; |
|
|
|
|
|
if (!Afilename || !*Afilename) return gtk_image_new (); |
|
|
|
|
|
if (!(Lpathname = find_pixmap_file (Afilename))) { |
|
|
_WARN(_("Image not found: %s"), Afilename); |
|
|
return gtk_image_new (); |
|
|
} |
|
|
Lpixmap = gtk_image_new_from_file (Lpathname); |
|
|
g_free (Lpathname); |
|
|
return Lpixmap; |
|
|
} |
|
|
|
|
|
/* This is an internally used function to create pixmaps. */ |
|
|
GdkPixbuf* create_pixbuf (const gchar *Afilename) |
|
|
{ |
|
|
gchar *Lpathname = NULL; |
|
|
GdkPixbuf *Lpixbuf; |
|
|
GError *Lerror = NULL; |
|
|
if (!Afilename || !*Afilename) return NULL; |
|
|
|
|
|
if (!(Lpathname = find_pixmap_file (Afilename))) |
|
|
{ |
|
|
_WARN(_("Image not found: %s"), Afilename); |
|
|
return NULL; |
|
|
} |
|
|
|
|
|
if (!(Lpixbuf = gdk_pixbuf_new_from_file (Lpathname, &Lerror))) { |
|
|
_WARN(_("Cannot load image: %s: %s"), Lpathname, Lerror->message); |
|
|
g_error_free (Lerror); |
|
|
} |
|
|
g_free (Lpathname); |
|
|
return Lpixbuf; |
|
|
} |
|
|
|
|
29 |
GtkWidget *glade_to_hash(GladeXML *Axml, GHashTable *Ahash, gchar *Akey) |
GtkWidget *glade_to_hash(GladeXML *Axml, GHashTable *Ahash, gchar *Akey) |
30 |
{ |
{ |
31 |
GtkWidget *Lobj = glade_xml_get_widget(Axml, Akey); |
GtkWidget *Lobj = glade_xml_get_widget(Axml, Akey); |