Yes.
Code:
gtk_main ();
gtk_label_set_text(GTK_LABEL(labelZone1Temperature), "Temp");
gtk_label_set_text() won't be called until AFTER you call gtk_main_quit(). Once you enter the main GTK+ loop, the application is in a sort of "event driven" mode. That is, you're waiting for an action from the user at which point a callback function is called. A user clicks a button and it's your callback function for that button is called (thing OnClick in visual basic)
In fact, you may want to read this:
VB Programmer’s Intro to Linux Programming with GTK+It sounds like you want to update your labels periodically, without user interaction. In that case, you may want to use a timeout function. If you read about the
Main Event Loop in the GTK+ API, you'll see a function called g_timeout_add(). With this you can specify a function to call every x milliseconds. In this function, you can update your label.
For example:
Code:
gboolean
update_label (gpointer label)
{
gtk_label_set_text(GTK_LABEL(label), "Updated");
return FALSE: /* stop calling this function */
}
int
main (int argc, char *argv[])
{
GladeXML *xml;
GtkWidget *label, *window;
gtk_init(&argc, &argv);
xml = glade_xml_new ("src/energy-management.glade", NULL, NULL);
label = glade_xml_get_widget (xml, "labelZone1Temperature");
window = glade_xml_get_widget (xml, "window1");
/* connect signal handlers */
glade_xml_signal_autoconnect(xml);
gtk_label_set_text(GTK_LABEL(label), "Initial Value");
gtk_widget_show_all (window);
/* set timout for 5 seconds */
g_timeout_add(5000, (GSourceFunc)update_label, NULL);
gtk_main ();
return 0;
}
Please note... I just wrote that code off the top of my head. It probably doesn't quite work but hopefully it gives you the basic idea.