GtkImage problem




I have the following code, which comiles and displays the image yet I get the
following errors



Compile error
passing argument 1 of 'gtk_image_set_from_file' from incompatible pointer
type

Runtime errors
(process:12275): GLib-GObject-CRITICAL **: gtype.c:2242: initialization
assertion failed, use IA__g_type_init() prior to this function

(process:12275): GLib-GObject-CRITICAL **: gtype.c:2242: initialization
assertion failed, use IA__g_type_init() prior to this function

(process:12275): GLib-GObject-CRITICAL **: gtype.c:2242: initialization
assertion failed, use IA__g_type_init() prior to this function

(process:12275): GLib-GObject-CRITICAL **: gtype.c:2242: initialization
assertion failed, use IA__g_type_init() prior to this function

(process:12275): GLib-GObject-CRITICAL **: g_type_add_interface_static:
assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:12275): GLib-GObject-CRITICAL **: gtype.c:2242: initialization
assertion failed, use IA__g_type_init() prior to this function

(process:12275): GLib-GObject-CRITICAL **: gtype.c:2242: initialization
assertion failed, use IA__g_type_init() prior to this function

(process:12275): GLib-GObject-CRITICAL **: g_object_new: assertion
`G_TYPE_IS_OBJECT (object_type)' failed

(testreference:12275): Gtk-CRITICAL **: gtk_widget_show: assertion
`GTK_IS_WIDGET (widget)' failed




#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>

#include <config.h>

#include <gtk/gtk.h>
#include <glade/glade.h>



/*
 * Standard gettext macros.
 */
#ifdef ENABLE_NLS
#  include <libintl.h>
#  undef _
#  define _(String) dgettext (PACKAGE, String)
#  ifdef gettext_noop
#    define N_(String) gettext_noop (String)
#  else
#    define N_(String) (String)
#  endif
#else
#  define textdomain(String) (String)
#  define gettext(String) (String)
#  define dgettext(Domain,Message) (Message)
#  define dcgettext(Domain,Message,Type) (Message)
#  define bindtextdomain(Domain,Directory) (Domain)
#  define _(String) (String)
#  define N_(String) (String)
#endif



#include "callbacks.h"

/* For testing propose use the local (not installed) glade file */
/* #define GLADE_FILE
PACKAGE_DATA_DIR"/testreference/glade/testreference.glade" */
#define GLADE_FILE "testreference.glade"
        

void create_window (GtkWidget *window, GtkWidget *image)
{
        
        GladeXML *gxml;
        
        gxml = glade_xml_new (GLADE_FILE, NULL, NULL);
        

        glade_xml_signal_autoconnect (gxml);
        window = glade_xml_get_widget (gxml, "window");
        image = glade_xml_get_widget (gxml, "image1");
}

void funcImage (GtkWidget *image)
{
        gtk_image_set_from_file (image, "/home/s/Pictures/space-05.jpg");
}

int
main (int argc, char *argv[])
{
        GtkWidget *window = NULL;
        GtkWidget *image = gtk_image_new();
         

#ifdef ENABLE_NLS
        bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
        textdomain (GETTEXT_PACKAGE);
#endif

        
        gtk_set_locale ();
        gtk_init (&argc, &argv);

        create_window (window,image);
        gtk_widget_show (window);
        funcImage(image);
        gtk_main ();
        
        return 0;
}
-- 
View this message in context: http://www.nabble.com/GtkImage-problem-tf3694858.html#a10332372
Sent from the Gtk+ - Apps Dev mailing list archive at Nabble.com.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]