Erreurs lors du lancement d'un programme GTK

Erreurs lors du lancement d'un programme GTK - Divers - Linux et OS Alternatifs

Marsh Posté le 14-04-2003 à 11:22:11    

J'utilise le petit sample donné par les tutorials GTK+ 1.2 (le voici :)
 

Code :
  1. /* example-start helloworld helloworld.c */
  2. #include <gtk/gtk.h>
  3. /* This is a callback function. The data arguments are ignored
  4. * in this example. More on callbacks below. */
  5. void hello( GtkWidget *widget,
  6.             gpointer   data )
  7. {
  8.     g_print ("Hello World\n" );
  9. }
  10. gint delete_event( GtkWidget *widget,
  11.                    GdkEvent  *event,
  12.                    gpointer   data )
  13. {
  14.     /* If you return FALSE in the "delete_event" signal handler,
  15.      * GTK will emit the "destroy" signal. Returning TRUE means
  16.      * you don't want the window to be destroyed.
  17.      * This is useful for popping up 'are you sure you want to quit?'
  18.      * type dialogs. */
  19.     g_print ("delete event occurred\n" );
  20.     /* Change TRUE to FALSE and the main window will be destroyed with
  21.      * a "delete_event". */
  22.     return(TRUE);
  23. }
  24. /* Another callback */
  25. void destroy( GtkWidget *widget,
  26.               gpointer   data )
  27. {
  28.     gtk_main_quit();
  29. }
  30. int main( int   argc,
  31.           char *argv[] )
  32. {
  33.     /* GtkWidget is the storage type for widgets */
  34.     GtkWidget *window;
  35.     GtkWidget *button;
  36.    
  37.     /* This is called in all GTK applications. Arguments are parsed
  38.      * from the command line and are returned to the application. */
  39.     gtk_init(&argc, &argv);
  40.    
  41.     /* create a new window */
  42.     window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  43.    
  44.     /* When the window is given the "delete_event" signal (this is given
  45.      * by the window manager, usually by the "close" option, or on the
  46.      * titlebar), we ask it to call the delete_event () function
  47.      * as defined above. The data passed to the callback
  48.      * function is NULL and is ignored in the callback function. */
  49.     gtk_signal_connect (GTK_OBJECT (window), "delete_event",
  50.                         GTK_SIGNAL_FUNC (delete_event), NULL);
  51.    
  52.     /* Here we connect the "destroy" event to a signal handler.   
  53.      * This event occurs when we call gtk_widget_destroy() on the window,
  54.      * or if we return FALSE in the "delete_event" callback. */
  55.     gtk_signal_connect (GTK_OBJECT (window), "destroy",
  56.                         GTK_SIGNAL_FUNC (destroy), NULL);
  57.    
  58.     /* Sets the border width of the window. */
  59.     gtk_container_set_border_width (GTK_CONTAINER (window), 10);
  60.    
  61.     /* Creates a new button with the label "Hello World". */
  62.     button = gtk_button_new_with_label ("Hello World" );
  63.    
  64.     /* When the button receives the "clicked" signal, it will call the
  65.      * function hello() passing it NULL as its argument.  The hello()
  66.      * function is defined above. */
  67.     gtk_signal_connect (GTK_OBJECT (button), "clicked",
  68.                         GTK_SIGNAL_FUNC (hello), NULL);
  69.    
  70.     /* This will cause the window to be destroyed by calling
  71.      * gtk_widget_destroy(window) when "clicked".  Again, the destroy
  72.      * signal could come from here, or the window manager. */
  73.     gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
  74.                                GTK_SIGNAL_FUNC (gtk_widget_destroy),
  75.                                GTK_OBJECT (window));
  76.    
  77.     /* This packs the button into the window (a gtk container). */
  78.     gtk_container_add (GTK_CONTAINER (window), button);
  79.    
  80.     /* The final step is to display this newly created widget. */
  81.     gtk_widget_show (button);
  82.    
  83.     /* and the window */
  84.     gtk_widget_show (window);
  85.    
  86.     /* All GTK applications must have a gtk_main(). Control ends here
  87.      * and waits for an event to occur (like a key press or
  88.      * mouse event). */
  89.     gtk_main ();
  90.    
  91.     return(0);
  92. }
  93. /* example-end */

J'ai créé moi-même mon thème GTK et je l'ai appliqué par l'intermédiare de gtk-switch (qui me l'accepte, et qui me fait une prévisualisation correcte). Mais quand je lance mon programme GTK, le thème n'est pas appliqué et me sort ces erreurs :
 
 

gdk_imlib ERROR: gdk has not connected to the display
 
Gdk-CRITICAL **: file gdkwindow.c: line 1406 (gdk_window_get_visual): assertion  
`window != NULL' failed.
 
Gtk-CRITICAL **: file gtkwidget.c: line 4258 (gtk_widget_push_visual): assertion
 `visual != NULL' failed.
 
Gtk-CRITICAL **: file gtkwidget.c: line 4242 (gtk_widget_push_colormap): asserti
on `cmap != NULL' failed.
 
Gtk-WARNING **: Unable to locate image file in pixmap_path: "option.png" line 27
 
Gtk-WARNING **: Unable to locate image file in pixmap_path: "button_3.png" line  
51
 
Gtk-WARNING **: Unable to locate image file in pixmap_path: "button_2.png" line  
61
 
Gtk-WARNING **: Unable to locate image file in pixmap_path: "button_4.png" line  
71
 
Gtk-WARNING **: Unable to locate image file in pixmap_path: "button_4.png" line  
81
 
Gtk-WARNING **: Unable to locate image file in pixmap_path: "button_1.png" line  
91
 
Gtk-WARNING **: Unable to locate image file in pixmap_path: "button_1.png" line  
101
 
Gtk-WARNING **: Unable to locate image file in pixmap_path: "button_3.png" line  
112
 
Gtk-WARNING **: Unable to locate image file in pixmap_path: "button_3.png" line  
122
 
Gtk-WARNING **: Unable to locate image file in pixmap_path: "prg_ban.png" line 1
41
 
Gtk-WARNING **: Unable to locate image file in pixmap_path: "BD_BACKGROUND.BMP"  
line 157
 
Gtk-WARNING **: Unable to locate image file in pixmap_path: "transparent.png" li
ne 172
 
Gtk-WARNING **: Unable to locate image file in pixmap_path: "option1.png" line 2
01
 
Gtk-WARNING **: Unable to locate image file in pixmap_path: "option2.png" line 2
09
 
Gtk-WARNING **: Unable to locate image file in pixmap_path: "option1.png" line 2
18
 
Gtk-WARNING **: Unable to locate image file in pixmap_path: "option2.png" line 2
27

Vous pouvez m'aider SVP ?  
 :hello:

Reply

Marsh Posté le 14-04-2003 à 11:22:11   

Reply

Marsh Posté le 14-04-2003 à 13:31:10    

Ce forum semble mort...
Un p'tit up quand même...
 :bounce:

Reply

Marsh Posté le 14-04-2003 à 13:36:52    

j avais ce type de msg suivi d un sgv kan je quittais mon applis gtk 2 :D


---------------
:: Light is Right ::
Reply

Marsh Posté le 14-04-2003 à 14:10:45    

tomate77 a écrit :

j avais ce type de msg suivi d un sgv kan je quittais mon applis gtk 2 :D

et tu as fait koa pour les faire disparaitre ?

Reply

Marsh Posté le 14-04-2003 à 14:20:52    

c bon, j'ai trouvé, c pa'ce ke je l'ai compilé en static  :o  On peut pas appliquer de theme si on compile nos softs en static !?

Reply

Marsh Posté le 14-04-2003 à 15:00:06    

Le Sot Zi a écrit :

et tu as fait koa pour les faire disparaitre ?


j ai remplace gtk_main_quit() par exit() [:ddr555]


---------------
:: Light is Right ::
Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed