GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Jul 31, 2014 5:23 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Gtk-WARNING and Gtk-CRITICAL messages
PostPosted: Mon Jun 03, 2013 7:53 pm 
Offline

Joined: Mon Jun 03, 2013 7:20 pm
Posts: 2
Hi,

I have made a gtk interface; it consists of 2 parts : at the top, a drawing aera which contains a webcam streaming. At the bottom, there are 2 hbox and each one contains
a frame within there are different buttons and gtk label.

The code works fine but I have the following messages at the execution :

Code:
(a.out:12887): Gtk-WARNING **: Attempting to add a widget with type GtkFrame to a container of type GtkWindow, but the widget is already inside a container of type GtkHBox, the GTK+ FAQ at http://library.gnome.org/devel/gtk-faq/stable/ explains how to reparent a widget.

(a.out:12887): Gtk-CRITICAL **: gtk_box_pack: assertion `child->parent == NULL' failed

(a.out:12887): Gtk-WARNING **: Attempting to add a widget with type GtkFrame to a container of type GtkWindow, but the widget is already inside a container of type GtkHBox, the GTK+ FAQ at http://library.gnome.org/devel/gtk-faq/stable/ explains how to reparent a widget.

(a.out:12887): Gtk-CRITICAL **: gtk_box_pack: assertion `child->parent == NULL' failed

(a.out:12887): Gtk-WARNING **: Attempting to add a widget with type GtkHBox to a container of type GtkWindow, but the widget is already inside a container of type GtkVBox, the GTK+ FAQ at http://library.gnome.org/devel/gtk-faq/stable/ explains how to reparent a widget.


I give you the part of the code from which problems come :

Code:
int main( int argc, char *argv[] ) {

  /*********** GUI global variables ********************/

  GtkWidget *main_window;
  GtkWidget *frame_dialog_output;
  GtkWidget *frame_dialog_input; 
  GtkWidget *frame_webcam; 
  GtkWidget *alignment1; 
  GtkWidget *alignment2;   
  GtkWidget *vbox;
  GtkWidget *dialog; 
  GtkWidget *dialog_output;
  GtkWidget *dialog_input; 
  GtkWidget *fixed_output_text;
  GtkWidget *fixed_output;
  GtkWidget *fixed_state_text; 
  GtkWidget *fixed_state;   
  GtkWidget *fixed_clock;     
  GtkWidget *fixed_light;       
  GtkWidget *fixed_noise;         
  GtkWidget *fixed_reset;       
  GtkWidget *label1;           
  GtkWidget *label2;             

  struct S_GtkWidget* ptr_struct_GtkWidget;
  ptr_struct_GtkWidget= (struct S_GtkWidget*) malloc(sizeof(struct S_GtkWidget));

  gint homogeneous = FALSE;
  gint spacing = 0;
  gint expand = FALSE;
  gint fill = FALSE;
  gint padding = 0;
  const char* char_current_state="Awake";
  const char* output_current="101";   

  /*****************************************************/

  gtk_init (&argc, &argv);

  capture = cvCaptureFromCAM( CV_CAP_ANY );
  opencvImage = cvQueryFrame( capture );

  /*********************** Main Window ********************************/   

  main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title( GTK_WINDOW( main_window ), "WEBCAM - FPGA Nexys 3");

  g_signal_connect( G_OBJECT( main_window ), "destroy", G_CALLBACK (gtk_main_quit), NULL);

  /********************************************************************/

  /*********************** Label Widget *******************************/

  ptr_struct_GtkWidget->output_text=gtk_label_new("Binary : ");
  gtk_widget_set_size_request(ptr_struct_GtkWidget->output_text,50,30);     
  ptr_struct_GtkWidget->output=gtk_label_new(output_current);
  gtk_widget_set_size_request(ptr_struct_GtkWidget->output,50,30);     

  ptr_struct_GtkWidget->label_state=gtk_label_new("State :");
  gtk_widget_set_size_request(ptr_struct_GtkWidget->label_state,50,30);     
  ptr_struct_GtkWidget->label_current_state=gtk_label_new(char_current_state);
  gtk_widget_set_size_request(ptr_struct_GtkWidget->label_current_state,110,30);   

  ptr_struct_GtkWidget->clock=gtk_button_new_with_label("Clock");
  ptr_struct_GtkWidget->reset=gtk_button_new_with_label("Reset");
  ptr_struct_GtkWidget->light=gtk_toggle_button_new_with_label("Light");
  ptr_struct_GtkWidget->noise=gtk_toggle_button_new_with_label("Noise");   

  /********************************************************************/

  // Create a Fixed Container
  fixed_output_text = gtk_fixed_new();
  fixed_output = gtk_fixed_new();
  fixed_state_text = gtk_fixed_new(); 
  fixed_state = gtk_fixed_new();   
  fixed_clock = gtk_fixed_new();     
  fixed_light = gtk_fixed_new();       
  fixed_noise = gtk_fixed_new();         
  fixed_reset = gtk_fixed_new();       

  /*********************** Webcam Widget ******************************/     

  ptr_struct_GtkWidget->drawing_area = gtk_drawing_area_new();
  gtk_widget_set_size_request( ptr_struct_GtkWidget->drawing_area, opencvImage->width, opencvImage->height );

  /********************************************************************/

  g_signal_connect( G_OBJECT( ptr_struct_GtkWidget->drawing_area), "expose_event", G_CALLBACK (expose_event_callback), NULL);
  g_timeout_add( 100, ( GSourceFunc )time_handler, ( gpointer ) ptr_struct_GtkWidget->drawing_area );

  // Add webcam window
  vbox = gtk_vbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), ptr_struct_GtkWidget->drawing_area, expand, fill, padding);     
  gtk_container_add( GTK_CONTAINER(main_window), vbox);     

  // Add dialog 
  dialog = gtk_hbox_new (FALSE,0);   

  // create frame _dialog_output
  frame_dialog_output = gtk_frame_new(NULL);
  gtk_container_set_border_width (GTK_CONTAINER (frame_dialog_output), 12);
  gtk_frame_set_label_align (GTK_FRAME (frame_dialog_output), 0.05, 0.41);
  gtk_frame_set_shadow_type (GTK_FRAME (frame_dialog_output), GTK_SHADOW_ETCHED_OUT);

  alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment1);
  gtk_container_add (GTK_CONTAINER (frame_dialog_output), alignment1);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 7, 0);

  label1 = gtk_label_new ("<b>Output : </b>");
  gtk_widget_show (label1);
  gtk_frame_set_label_widget (GTK_FRAME (frame_dialog_output), label1);
  gtk_label_set_use_markup (GTK_LABEL (label1), TRUE);
  gtk_misc_set_padding (GTK_MISC (label1), 10, 0);

  // Add dialog output 
  dialog_output = gtk_hbox_new (FALSE,2);   

  gtk_box_pack_start (GTK_BOX (dialog), frame_dialog_output, expand, fill, padding);
  gtk_container_add( GTK_CONTAINER(main_window), frame_dialog_output);   
  gtk_container_add (GTK_CONTAINER (alignment1), dialog_output);

  // Position of and content of output labels
  gtk_fixed_put(GTK_FIXED (fixed_output_text), ptr_struct_GtkWidget->output_text, 3,5);
  gtk_widget_set_size_request(fixed_output_text, 40, 40);
  gtk_fixed_put(GTK_FIXED (fixed_output), ptr_struct_GtkWidget->output, 6,5);   
  gtk_widget_set_size_request(fixed_output, 40, 40);

  gtk_fixed_put (GTK_FIXED (fixed_state_text), ptr_struct_GtkWidget->label_state, 9,5);           
  gtk_widget_set_size_request(fixed_state_text, 40, 40);
  gtk_fixed_put (GTK_FIXED (fixed_state), ptr_struct_GtkWidget->label_current_state, 12,5);               
  gtk_widget_set_size_request(fixed_state, 127, 40);

  // Position and content of signals buttons
  gtk_fixed_put (GTK_FIXED (fixed_clock), ptr_struct_GtkWidget->clock, 30,0);
  gtk_fixed_put (GTK_FIXED (fixed_light), ptr_struct_GtkWidget->light, 31,0);   
  gtk_fixed_put (GTK_FIXED (fixed_noise), ptr_struct_GtkWidget->noise, 32,0);             
  gtk_fixed_put (GTK_FIXED (fixed_reset), ptr_struct_GtkWidget->reset, 33,0);                   

  gtk_container_add(GTK_CONTAINER( dialog_output), fixed_output_text);
  gtk_container_add(GTK_CONTAINER( dialog_output), fixed_output);
  gtk_container_add(GTK_CONTAINER( dialog_output), fixed_state_text);     
  gtk_container_add(GTK_CONTAINER( dialog_output), fixed_state);

  // Pack dialog_output to dialog hbox
  gtk_box_pack_start (GTK_BOX (dialog), dialog_output, expand, fill, padding);

  // Create frame _dialog_input
  frame_dialog_input = gtk_frame_new(NULL);
  gtk_container_set_border_width (GTK_CONTAINER (frame_dialog_input), 12);
  gtk_frame_set_label_align (GTK_FRAME (frame_dialog_input), 0.05, 0.41);
  gtk_frame_set_shadow_type (GTK_FRAME (frame_dialog_input), GTK_SHADOW_ETCHED_OUT);

  alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment2);
  gtk_container_add (GTK_CONTAINER (frame_dialog_input), alignment2);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment2), 4, 0, 6, 8);

  label2 = gtk_label_new ("<b>Signals : </b>");
  gtk_widget_show (label2);
  gtk_frame_set_label_widget (GTK_FRAME (frame_dialog_input), label2);
  gtk_label_set_use_markup (GTK_LABEL (label2), TRUE);
  gtk_misc_set_padding (GTK_MISC (label2), 10, 0);

  // Add dialog output 
  dialog_input = gtk_hbox_new (FALSE,2);     

  gtk_box_pack_start (GTK_BOX (dialog), frame_dialog_input, expand, fill, padding);
  gtk_container_add( GTK_CONTAINER(main_window), frame_dialog_input);   
  gtk_container_add (GTK_CONTAINER (alignment2), dialog_input);

  gtk_container_add(GTK_CONTAINER( dialog_input), fixed_clock);
  gtk_container_add(GTK_CONTAINER( dialog_input), fixed_light);
  gtk_container_add(GTK_CONTAINER( dialog_input), fixed_noise);
  gtk_container_add(GTK_CONTAINER( dialog_input), fixed_reset);

  // Pack dialog_input to dialog hbox
  gtk_box_pack_start (GTK_BOX (dialog), dialog_input, expand, fill, padding);

  // Pack dialog hbox to main vbox
  gtk_box_pack_start (GTK_BOX (vbox), dialog, expand, fill, padding);

  // Add dialog hbox to main window
  gtk_container_add( GTK_CONTAINER(main_window),dialog);

  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->clock), "pressed",  G_CALLBACK(input_signal),char_clock);     
  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->clock), "released", G_CALLBACK(update_state),ptr_struct_GtkWidget);
  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->clock), "released", G_CALLBACK(toggle_input_off),ptr_struct_GtkWidget->light);                 
  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->clock), "released", G_CALLBACK(toggle_input_off),ptr_struct_GtkWidget->noise);                     
  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->reset), "pressed", G_CALLBACK(input_signal),char_reset);         
  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->reset), "released", G_CALLBACK(update_state),ptr_struct_GtkWidget);                 
  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->reset), "released", G_CALLBACK(toggle_input_off),ptr_struct_GtkWidget->light);                 
  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->reset), "released", G_CALLBACK(toggle_input_off),ptr_struct_GtkWidget->noise);                     


  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->light), "toggled", G_CALLBACK(toggle_button_callback),char_light);         
  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->noise), "toggled", G_CALLBACK(toggle_button_callback),char_noise);         

  gtk_widget_show_all( main_window );
  gtk_main();
  cvReleaseCapture( &capture );

  return 0;
}


It seems I have to reparent the frame_dialog_output and frame_dialog_input frames. There is also a "Gtk-CRITICAL" warning about gtk_box_pack function. Maybe the
2 errors are linked.

Any help would be great.


Last edited by fabio12 on Thu Jun 06, 2013 10:51 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Gtk-WARNING and Gtk-CRITICAL messages
PostPosted: Wed Jun 05, 2013 7:13 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 734
Location: UK
Hello and welcome,

You are getting the errors because the GtkWindow as a container can only accept a single widget and what you are trying to do is insert many widgets into the GtkWindow.

What you can do is put another container widget which can contain many other widgets into the GtkWindow and then you can add your own widgets. You do not say which version of GTK+ you are using. If you are using GTK+ v3 then I would switch from using GtkBox, GtkVBox and GtkHBox to GtkGrid.

_________________
E.


Top
 Profile  
 
 Post subject: Re: Gtk-WARNING and Gtk-CRITICAL messages
PostPosted: Thu Jun 06, 2013 3:07 am 
Offline

Joined: Mon Jun 03, 2013 7:20 pm
Posts: 2
I have tried to follow your advise by using a main_container which contains the webcam_container and the dialog_container.

Then, I add the main_container to the main_window GtkWindow but I have still the following errors :

Code:
(a.out:6842): Gtk-WARNING **: Attempting to add a widget with type GtkFrame to a container of type GtkFixed, but the widget is already inside a container of type GtkHBox, the GTK+ FAQ at http://library.gnome.org/devel/gtk-faq/stable/ explains how to reparent a widget.

(a.out:6842): Gtk-CRITICAL **: gtk_box_pack: assertion `child->parent == NULL' failed

(a.out:6842): Gtk-WARNING **: Attempting to add a widget with type GtkFrame to a container of type GtkFixed, but the widget is already inside a container of type GtkHBox, the GTK+ FAQ at http://library.gnome.org/devel/gtk-faq/stable/ explains how to reparent a widget.

(a.out:6842): Gtk-CRITICAL **: gtk_box_pack: assertion `child->parent == NULL' failed

(a.out:6842): Gtk-WARNING **: Attempting to add a widget with type GtkVBox to a container of type GtkFixed, but the widget is already inside a container of type GtkFixed, the GTK+ FAQ at http://library.gnome.org/devel/gtk-faq/stable/ explains how to reparent a widget.


Here is the modified main function :

Code:
int main( int argc, char *argv[] ) {

  /*********** GUI global variables ********************/

  GtkWidget *main_window;
  GtkWidget *main_container;
  GtkWidget *webcam_container;
  GtkWidget *dialog_container;
  GtkWidget *frame_dialog_output;
  GtkWidget *frame_dialog_input; 
  GtkWidget *frame_webcam; 
  GtkWidget *alignment1; 
  GtkWidget *alignment2;   
  GtkWidget *vbox;
  GtkWidget *dialog; 
  GtkWidget *dialog_output;
  GtkWidget *dialog_input; 
  GtkWidget *fixed_output_text;
  GtkWidget *fixed_output;
  GtkWidget *fixed_state_text; 
  GtkWidget *fixed_state;   
  GtkWidget *fixed_clock;     
  GtkWidget *fixed_light;       
  GtkWidget *fixed_noise;         
  GtkWidget *fixed_reset;       
  GtkWidget *label1;           
  GtkWidget *label2;             

  struct S_GtkWidget* ptr_struct_GtkWidget;
  ptr_struct_GtkWidget= (struct S_GtkWidget*) malloc(sizeof(struct S_GtkWidget));

  gint homogeneous = FALSE;
  gint spacing = 0;
  gint expand = FALSE;
  gint fill = FALSE;
  gint padding = 0;
  const char* char_current_state="Awake";
  const char* output_current="101";   

  /*****************************************************/

  gtk_init (&argc, &argv);

  capture = cvCaptureFromCAM( CV_CAP_ANY );
  opencvImage = cvQueryFrame( capture );

  /*********************** Main Window ********************************/   

  main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title( GTK_WINDOW( main_window ), "WEBCAM - FPGA Nexys 3");

  g_signal_connect( G_OBJECT( main_window ), "destroy", G_CALLBACK (gtk_main_quit), NULL);

  /********************************************************************/

  /*********************** Label Widget *******************************/

  ptr_struct_GtkWidget->output_text=gtk_label_new("Binary : ");
  gtk_widget_set_size_request(ptr_struct_GtkWidget->output_text,50,30);     
  ptr_struct_GtkWidget->output=gtk_label_new(output_current);
  gtk_widget_set_size_request(ptr_struct_GtkWidget->output,50,30);     

  ptr_struct_GtkWidget->label_state=gtk_label_new("State :");
  gtk_widget_set_size_request(ptr_struct_GtkWidget->label_state,50,30);     
  ptr_struct_GtkWidget->label_current_state=gtk_label_new(char_current_state);
  gtk_widget_set_size_request(ptr_struct_GtkWidget->label_current_state,110,30);   

  ptr_struct_GtkWidget->clock=gtk_button_new_with_label("Clock");
  ptr_struct_GtkWidget->reset=gtk_button_new_with_label("Reset");
  ptr_struct_GtkWidget->light=gtk_toggle_button_new_with_label("Light");
  ptr_struct_GtkWidget->noise=gtk_toggle_button_new_with_label("Noise");   

  /********************************************************************/

  // Create a Fixed Container
  fixed_output_text = gtk_fixed_new();
  fixed_output = gtk_fixed_new();
  fixed_state_text = gtk_fixed_new(); 
  fixed_state = gtk_fixed_new();   
  fixed_clock = gtk_fixed_new();     
  fixed_light = gtk_fixed_new();       
  fixed_noise = gtk_fixed_new();         
  fixed_reset = gtk_fixed_new();       

  /*********************** Webcam Widget ******************************/     

  ptr_struct_GtkWidget->drawing_area = gtk_drawing_area_new();
  gtk_widget_set_size_request( ptr_struct_GtkWidget->drawing_area, opencvImage->width, opencvImage->height );

  /********************************************************************/

  g_signal_connect( G_OBJECT( ptr_struct_GtkWidget->drawing_area), "expose_event", G_CALLBACK (expose_event_callback), NULL);
  g_timeout_add( 100, ( GSourceFunc )time_handler, ( gpointer ) ptr_struct_GtkWidget->drawing_area );

  // First main container
  main_container = gtk_fixed_new();

  // First container : webcam_container
  webcam_container = gtk_fixed_new();

  // Add vbox webcam
  vbox = gtk_vbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), ptr_struct_GtkWidget->drawing_area, expand, fill, padding);     
  gtk_container_add( GTK_CONTAINER(webcam_container), vbox);     
  gtk_container_add( GTK_CONTAINER(main_container), webcam_container);
 
  // Second container : dialog_container
  dialog_container = gtk_fixed_new();

  // Add dialog hbox
  dialog = gtk_hbox_new (FALSE,0);   

  // create frame _dialog_output
  frame_dialog_output = gtk_frame_new(NULL);
  gtk_container_set_border_width (GTK_CONTAINER (frame_dialog_output), 12);
  gtk_frame_set_label_align (GTK_FRAME (frame_dialog_output), 0.05, 0.41);
  gtk_frame_set_shadow_type (GTK_FRAME (frame_dialog_output), GTK_SHADOW_ETCHED_OUT);

  alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment1);
  gtk_container_add (GTK_CONTAINER (frame_dialog_output), alignment1);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 7, 0);

  label1 = gtk_label_new ("<b>Output : </b>");
  gtk_widget_show (label1);
  gtk_frame_set_label_widget (GTK_FRAME (frame_dialog_output), label1);
  gtk_label_set_use_markup (GTK_LABEL (label1), TRUE);
  gtk_misc_set_padding (GTK_MISC (label1), 10, 0);

  // Add dialog output 
  dialog_output = gtk_hbox_new (FALSE,2);   

  gtk_box_pack_start (GTK_BOX (dialog), frame_dialog_output, expand, fill, padding);
  gtk_container_add( GTK_CONTAINER(dialog_container), frame_dialog_output);   
  gtk_container_add (GTK_CONTAINER (alignment1), dialog_output);

  // Position of and content of output labels
  gtk_fixed_put(GTK_FIXED (fixed_output_text), ptr_struct_GtkWidget->output_text, 3,5);
  gtk_widget_set_size_request(fixed_output_text, 40, 40);
  gtk_fixed_put(GTK_FIXED (fixed_output), ptr_struct_GtkWidget->output, 6,5);   
  gtk_widget_set_size_request(fixed_output, 40, 40);

  gtk_fixed_put (GTK_FIXED (fixed_state_text), ptr_struct_GtkWidget->label_state, 9,5);           
  gtk_widget_set_size_request(fixed_state_text, 40, 40);
  gtk_fixed_put (GTK_FIXED (fixed_state), ptr_struct_GtkWidget->label_current_state, 12,5);               
  gtk_widget_set_size_request(fixed_state, 127, 40);

  // Position and content of signals buttons
  gtk_fixed_put (GTK_FIXED (fixed_clock), ptr_struct_GtkWidget->clock, 30,0);
  gtk_fixed_put (GTK_FIXED (fixed_light), ptr_struct_GtkWidget->light, 31,0);   
  gtk_fixed_put (GTK_FIXED (fixed_noise), ptr_struct_GtkWidget->noise, 32,0);             
  gtk_fixed_put (GTK_FIXED (fixed_reset), ptr_struct_GtkWidget->reset, 33,0);                   

  gtk_container_add(GTK_CONTAINER( dialog_output), fixed_output_text);
  gtk_container_add(GTK_CONTAINER( dialog_output), fixed_output);
  gtk_container_add(GTK_CONTAINER( dialog_output), fixed_state_text);     
  gtk_container_add(GTK_CONTAINER( dialog_output), fixed_state);

  // Pack dialog_output to dialog hbox
  gtk_box_pack_start (GTK_BOX (dialog), dialog_output, expand, fill, padding);

  // Create frame _dialog_input
  frame_dialog_input = gtk_frame_new(NULL);
  gtk_container_set_border_width (GTK_CONTAINER (frame_dialog_input), 12);
  gtk_frame_set_label_align (GTK_FRAME (frame_dialog_input), 0.05, 0.41);
  gtk_frame_set_shadow_type (GTK_FRAME (frame_dialog_input), GTK_SHADOW_ETCHED_OUT);

  alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment2);
  gtk_container_add (GTK_CONTAINER (frame_dialog_input), alignment2);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment2), 4, 0, 6, 8);

  label2 = gtk_label_new ("<b>Signals : </b>");
  gtk_widget_show (label2);
  gtk_frame_set_label_widget (GTK_FRAME (frame_dialog_input), label2);
  gtk_label_set_use_markup (GTK_LABEL (label2), TRUE);
  gtk_misc_set_padding (GTK_MISC (label2), 10, 0);

  // Add dialog output 
  dialog_input = gtk_hbox_new (FALSE,2);     

  gtk_box_pack_start (GTK_BOX (dialog), frame_dialog_input, expand, fill, padding);
  gtk_container_add( GTK_CONTAINER(dialog_container), frame_dialog_input);   
  gtk_container_add (GTK_CONTAINER (alignment2), dialog_input);

  gtk_container_add(GTK_CONTAINER( dialog_input), fixed_clock);
  gtk_container_add(GTK_CONTAINER( dialog_input), fixed_light);
  gtk_container_add(GTK_CONTAINER( dialog_input), fixed_noise);
  gtk_container_add(GTK_CONTAINER( dialog_input), fixed_reset);

  // Pack dialog_input to dialog hbox
  gtk_box_pack_start (GTK_BOX (dialog), dialog_input, expand, fill, padding);

  // Pack dialog hbox to main vbox
  gtk_box_pack_start (GTK_BOX (vbox), dialog, expand, fill, padding);

  // Add dialog vbox to dialog_container
  gtk_container_add( GTK_CONTAINER(dialog_container), vbox);

  // Add dialog_container to main container
  gtk_container_add( GTK_CONTAINER(main_container), dialog_container);
 
  // Add main_container to main_window
  gtk_container_add( GTK_CONTAINER(main_window), main_container);

  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->clock), "pressed",  G_CALLBACK(input_signal),char_clock);     
  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->clock), "released", G_CALLBACK(update_state),ptr_struct_GtkWidget);
  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->clock), "released", G_CALLBACK(toggle_input_off),ptr_struct_GtkWidget->light);                 
  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->clock), "released", G_CALLBACK(toggle_input_off),ptr_struct_GtkWidget->noise);                     
  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->reset), "pressed", G_CALLBACK(input_signal),char_reset);         
  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->reset), "released", G_CALLBACK(update_state),ptr_struct_GtkWidget);                 
  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->reset), "released", G_CALLBACK(toggle_input_off),ptr_struct_GtkWidget->light);                 
  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->reset), "released", G_CALLBACK(toggle_input_off),ptr_struct_GtkWidget->noise);                     


  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->light), "toggled", G_CALLBACK(toggle_button_callback),char_light);         
  g_signal_connect(G_OBJECT(ptr_struct_GtkWidget->noise), "toggled", G_CALLBACK(toggle_button_callback),char_noise);         

  gtk_widget_show_all( main_window );
  gtk_main();
  cvReleaseCapture( &capture );

  return 0;
}


Anyone could see what's wrong ?

Thanks

ps : I don't know my gtk version but I use the following compile script :

g++ $CFLAGS -I/usr/include/gtk-2.0/ -I/usr/include/glib-2.0/ -I/usr/lib/glib-2.0/include/ -I/usr/local/include/opencv/ \
-I/usr/include/cairo/ -I/usr/include/pango-1.0/ -I/usr/lib/gtk-2.0/include/ -I/usr/include/atk-1.0/ -L/usr/local/lib/ \
-lcvaux -lhighgui -lcxcore -ldepp -ldmgr main.c


Top
 Profile  
 
 Post subject: Re: Gtk-WARNING and Gtk-CRITICAL messages
PostPosted: Thu Jun 06, 2013 5:45 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 734
Location: UK
Looking closer at your code you have many more problems.

To get the exact version of GTK+ you have have a look at the tips before posting section http://www.gtkforums.com/viewtopic.php?f=3&t=178057 there is a part which shows you how to get the version number.

The reason for your new errors is that you are now placing a Widget into more than one container. When a container gains ownership of a widget it also takes control over the memory management therefore two or more containers can not control one section of memory.

Why are you using GtkFixed? This is a special case widget that should only be used if really needed and can give you maintenance problems in the future. From the GTK+ documentation
Quote:
For most applications, you should not use this container! It keeps you from having to learn about the other GTK+ containers, but it results in broken applications. With GtkFixed, the following things will result in truncated text, overlapping widgets, and other display bugs:
I have done much more complex user interfaces with out the need to use GtkFixed. You can probable half your code by not using GtkFixed and use standard containers and make things easier for yourself.

For your buttons you are now using deprecated signals "pressed" and "released" (since v2.8 August 2005). You should use "clicked" for simple button clicks or "button-press-event" and "button-released-event" instead.

_________________
E.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group