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 Oct 23, 2014 5:11 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Gtk warnings
PostPosted: Fri Apr 15, 2011 7:50 am 
Offline
Familiar Face

Joined: Thu Mar 31, 2011 1:10 pm
Posts: 11
Hi all, I have some warning during mine gtk application esecution :

(testgtk:5403): GLib-GObject-WARNING **: invalid cast from `GtkProgressBar' to `GtkMisc'
(testgtk:5403): Gtk-CRITICAL **: gtk_misc_set_alignment: assertion `GTK_IS_MISC (misc)' failed
(testgtk:5403): Gtk-CRITICAL **: gtk_entry_set_text: assertion `GTK_IS_ENTRY (entry)' failed
(testgtk:5403): Gtk-CRITICAL **: gtk_misc_set_alignment: assertion `GTK_IS_MISC (misc)' failed
(testgtk:5403): Gtk-CRITICAL **: gtk_box_pack: assertion `GTK_IS_WIDGET (child)' failed
(testgtk:5403): Gtk-CRITICAL **: gtk_widget_show: assertion `GTK_IS_WIDGET (widget)' failed
(testgtk:5403): Gtk-CRITICAL **: gtk_misc_set_alignment: assertion `GTK_IS_MISC (misc)' failed
(testgtk:5403): Gtk-CRITICAL **: gtk_box_pack: assertion `GTK_IS_WIDGET (child)' failed
(testgtk:5403): Gtk-CRITICAL **: gtk_widget_show: assertion `GTK_IS_WIDGET (widget)' failed

I suppose is gtk_misc_set_alignment(), how could fix these warnings ?

Here the main code
Code:
   GtkWidget *logo;
   GtkWidget *img_pannello;
   GtkWidget *testo2,*testo2a;
   GtkWidget *testo3;
   GtkWidget *window;
   GtkWidget *button_exit;
   GtkWidget *sep;
   GtkWidget *spazio, *spazio2, *spazio3;
   GtkWidget *frame;
   GtkWidget *box1;
   gtk_init (&argc, &argv);

   g_thread_init (NULL);
   gdk_threads_init ();
   
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   
   g_signal_connect (window, "delete-event", G_CALLBACK (delete_event), NULL); 
   g_signal_connect (window, "destroy", G_CALLBACK (delete_event), NULL);
   
   gtk_container_set_border_width (GTK_CONTAINER (window), 10);

   gtk_window_set_title (GTK_WINDOW (window), "MINE APP");
   box1 = gtk_vbox_new (FALSE, 0);
   gtk_container_set_border_width (GTK_CONTAINER (box1), 0);
   gtk_container_add (GTK_CONTAINER (window), box1);

   logo = gtk_image_new_from_file("images/b.jpg");
   gtk_box_pack_start (GTK_BOX(box1), logo, TRUE, TRUE, 5);
   gtk_widget_show (logo);

   img_pannello = gtk_image_new_from_file("images/a.jpg");
   gtk_box_pack_start (GTK_BOX(box1), img_pannello, TRUE, TRUE, 10);
   gtk_widget_show (img_pannello);
   
   /* frame */
   frame = gtk_frame_new (NULL);
   gtk_frame_set_label(GTK_FRAME(frame), "Mine app");
   gtk_box_pack_start (GTK_BOX(box1), frame, TRUE, TRUE, 10);
   gtk_widget_show (frame);

   pdata = g_malloc( sizeof(ProgressData) );

   pdata->pbar = gtk_progress_bar_new();
   gtk_progress_set_format_string (GTK_PROGRESS (pdata->pbar), "%p%%");

   pdata->timer = gtk_timeout_add (50, progress_timeout, pdata->pbar);

   gtk_progress_set_show_text (GTK_PROGRESS (pdata->pbar),TRUE);

   gtk_misc_set_alignment (GTK_MISC (pdata->pbar), 0, .5);
   gtk_box_pack_start (GTK_BOX(box1), pdata->pbar, TRUE, TRUE, 5);
   gtk_widget_show (pdata->pbar);

   spazio3 = gtk_label_new("");
   gtk_misc_set_alignment (GTK_MISC (spazio3), 0, .5);
   gtk_box_pack_start (GTK_BOX(box1), spazio3, TRUE, TRUE, 5);
   gtk_widget_show (spazio3);

   /* label */
   testo2 = gtk_label_new("Path:");
   gtk_misc_set_alignment (GTK_MISC (testo2), 0, .5);
   gtk_box_pack_start (GTK_BOX(box1), testo2, TRUE, TRUE, 0);
   gtk_widget_show (testo2);
   separatore = gtk_hseparator_new ();

   widget_path_server = gtk_entry_new();
   gtk_box_pack_start (GTK_BOX (box1), widget_path_server, TRUE, TRUE, 0);
   gtk_widget_show (widget_path_server);
   /* segnale click pulsante */
   g_signal_connect(GTK_OBJECT(widget_path_server), "activate", GTK_SIGNAL_FUNC(Install), NULL);

   spazio = gtk_label_new("");
   gtk_misc_set_alignment (GTK_MISC (space), 0, .5);
   gtk_box_pack_start (GTK_BOX(box1), space, TRUE, TRUE, 5);
   gtk_widget_show (spazio);

   testo2a = gtk_label_new("Path2:");
   gtk_misc_set_alignment (GTK_MISC (testo2a), 0, .5);
   gtk_box_pack_start (GTK_BOX(box1), testo2a, TRUE, TRUE, 0);
   gtk_widget_show (testo2a);

   widget_path_client = gtk_entry_new();
   gtk_box_pack_start (GTK_BOX (box1), widget_path_client, TRUE, TRUE, 0);
   gtk_widget_show (widget_path_client);

   g_signal_connect(GTK_OBJECT(widget_path_client), "activate", GTK_SIGNAL_FUNC(Install), NULL);

   spazio2 = gtk_label_new("");
   gtk_misc_set_alignment (GTK_MISC (spazio2), 0, .5);
   gtk_box_pack_start (GTK_BOX(box1), spazio2, TRUE, TRUE, 5);
   gtk_widget_show (spazio2);
   
   testo3 = gtk_label_new("entry me :");
   gtk_misc_set_alignment (GTK_MISC (testo3), 0, .5);
   gtk_box_pack_start (GTK_BOX(box1), testo3, TRUE, TRUE, 0);
   gtk_widget_show (testo3);

   getPathInstall(widget_path_server,widget_path_client);
   
   widget_rmi_ip = gtk_entry_new();
   gtk_box_pack_start(GTK_BOX(box1), ip, TRUE, TRUE, 0);
   getLocalIp();
   gtk_widget_show(widget_rmi_ip);
   g_signal_connect(GTK_OBJECT(ip), "activate", GTK_SIGNAL_FUNC(Install), NULL);

   gtk_misc_set_alignment (GTK_MISC (install1), 0, .5);
   gtk_box_pack_start (GTK_BOX(box1), install1, TRUE, TRUE, 0);
   gtk_widget_show (install1);
   
   gtk_misc_set_alignment (GTK_MISC (install2), 0, .5);
   gtk_box_pack_start (GTK_BOX(box1), install2, TRUE, TRUE, 0);
   gtk_widget_show (install2);

   separatore = gtk_hseparator_new ();
   gtk_box_pack_start (GTK_BOX (box1), sep, TRUE, TRUE, 10);
   gtk_widget_show (separatore);

   button = gtk_button_new_with_label ("Mine App");
   gtk_box_pack_start (GTK_BOX (box1), button, TRUE, TRUE, 10);
   gtk_widget_show (button);
   g_signal_connect_swapped (button, "clicked", G_CALLBACK (Install), window);

   button_exit = gtk_button_new_with_label ("Exit");
   gtk_box_pack_start (GTK_BOX (box1), button_exit, TRUE, TRUE, 2);
   gtk_widget_show (button_exit);
   g_signal_connect_swapped (button_exit, "clicked", G_CALLBACK (gtk_widget_destroy), window);   
   gtk_widget_show (button_exit);

   gtk_widget_show (box1);   
   gtk_widget_show (window);

   gtk_main ();
   
    return 0;
}


Top
 Profile  
 
 Post subject: Re: Gtk warnings
PostPosted: Fri Apr 15, 2011 8:21 am 
Offline
Familiar Face

Joined: Tue Apr 12, 2011 12:48 pm
Posts: 8
Location: PL
these warnings exists because pdata->pbar is not a GtkMisc. i'm not sure: is GtkProgressBar an implementation of the GtkMisc?


Top
 Profile  
 
 Post subject: Re: Gtk warnings
PostPosted: Fri Apr 15, 2011 9:17 am 
Offline
Familiar Face

Joined: Thu Mar 31, 2011 1:10 pm
Posts: 11
rafal_rr wrote:
these warnings exists because pdata->pbar is not a GtkMisc. i'm not sure: is GtkProgressBar an implementation of the GtkMisc?


Is not an implementation :

Code:
typedef struct _ProgressData {
    GtkWidget *window;
    GtkWidget *pbar;
    int timer;
} ProgressData;

ProgressData *pdata;


Top
 Profile  
 
 Post subject: Re: Gtk warnings
PostPosted: Fri Apr 15, 2011 2:16 pm 
Offline
Familiar Face

Joined: Thu Mar 31, 2011 1:10 pm
Posts: 11
So I should fix this ?


Top
 Profile  
 
 Post subject: Re: Gtk warnings
PostPosted: Fri Apr 15, 2011 2:58 pm 
Offline
Familiar Face

Joined: Thu Mar 31, 2011 1:10 pm
Posts: 11
solved : no alignment needed for progress bar is aligned anyway.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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