As suggested I've done: gtk_image_set_from_file (GTK_IMAGE(image),
"/home/s/Pictures/space-05.jpg");

However, the image is no longer displayed and I get these errors




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

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

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

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

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

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

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

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

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

(testreference:7344): GLib-GObject-CRITICAL **: g_type_instance_get_private:
assertion `instance != NULL && instance->g_class != NULL' failed

(testreference:7344): Gtk-CRITICAL **: gtk_image_set_from_file: assertion
`GTK_IS_IMAGE (image)' failed 





beginner.c wrote:
> 
> 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#a10341226
Sent from the Gtk+ - Apps Dev mailing list archive at Nabble.com.

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to