00001
00002
00003
00004
00005 #ifdef HAVE_CONFIG_H
00006 # include <config.h>
00007 #endif
00008
00009 #include <sys/types.h>
00010 #include <sys/stat.h>
00011 #include <unistd.h>
00012 #include <string.h>
00013 #include <stdio.h>
00014
00015 #include <gtk/gtk.h>
00016 #include <glade/glade.h>
00017
00018 #include "support.h"
00019
00020 GtkWidget*
00021 lookup_widget ( GtkWidget *widget,
00022 const gchar *widget_name )
00023 {
00024 GtkWidget * found_widget;
00025 found_widget = glade_xml_get_widget( glade_get_widget_tree( widget ), widget_name );
00026 if ( !found_widget )
00027 g_warning ( "Widget not found: %s", widget_name );
00028 return found_widget;
00029 }
00030
00031
00032 GdkPixbuf*
00033 create_pixbuf ( const gchar *filename )
00034 {
00035 gchar *pathname;
00036 GdkPixbuf *pixbuf;
00037 GError *error = NULL;
00038
00039 if ( !filename || !filename[ 0 ] )
00040 return NULL;
00041
00042 pathname = g_strconcat( DATADIR, "/", PACKAGE, "/", filename, NULL );
00043 pixbuf = gdk_pixbuf_new_from_file ( pathname, &error );
00044 if ( !pixbuf )
00045 {
00046 fprintf ( stderr, "Failed to load pixbuf file: %s: %s\n",
00047 pathname, error->message );
00048 g_error_free ( error );
00049 }
00050 g_free ( pathname );
00051 return pixbuf;
00052 }