Thread: GTK+ Application doesnt work
hey all!
im working on gtk gui, created glade, experiencing problems application. when compile it, displays warnings no errors, when start app getr empty window
here .xml file generated glade:
mainmenu.xml
-----------------------------------------------------code:<?xml version="1.0"?> <interface> <!-- interface-naming-policy project-wide --> <object class="gtkwindow" id="window1"> <child> <object class="gtkvbox" id="vbox1"> <property name="visible">true</property> <property name="orientation">vertical</property> <child> <object class="gtklabel" id="header1"> <property name="visible">true</property> <property name="yalign">0.4699999988079071</property> <property name="label" translatable="yes">willkommen!</property> <attributes> <attribute name="weight">bold</attribute> <attribute name="stretch">ultra-condensed</attribute> <attribute name="size">200</attribute> <attribute name="absolute-size">400</attribute> <attribute name="foreground">#c5db00000000</attribute> <attribute name="scale">140,000000</attribute> </attributes> </object> <packing> <property name="position">0</property> </packing> </child> <child> <placeholder/> </child> <child> <object class="gtkhbox" id="hbox1"> <property name="visible">true</property> <child> <placeholder/> </child> <child> <object class="gtkbutton" id="qsg"> <property name="label" translatable="yes">quick start guide</property> <property name="width_request">50</property> <property name="height_request">35</property> <property name="visible">true</property> <property name="can_focus">true</property> <property name="receives_default">true</property> </object> <packing> <property name="position">1</property> </packing> </child> <child> <placeholder/> </child> </object> <packing> <property name="position">2</property> </packing> </child> <child> <placeholder/> </child> <child> <object class="gtkhbox" id="hbox2"> <property name="visible">true</property> <child> <placeholder/> </child> <child> <object class="gtkbutton" id="tutorial"> <property name="label" translatable="yes">tutorial</property> <property name="height_request">35</property> <property name="visible">true</property> <property name="can_focus">true</property> <property name="receives_default">true</property> </object> <packing> <property name="position">1</property> </packing> </child> <child> <placeholder/> </child> </object> <packing> <property name="position">4</property> </packing> </child> <child> <placeholder/> </child> <child> <object class="gtkhbox" id="hbox3"> <property name="visible">true</property> <child> <placeholder/> </child> <child> <object class="gtkbutton" id="ballerst"> <property name="label" translatable="yes">ballabfolge erstellen</property> <property name="width_request">206</property> <property name="height_request">35</property> <property name="visible">true</property> <property name="can_focus">true</property> <property name="receives_default">true</property> </object> <packing> <property name="expand">false</property> <property name="fill">false</property> <property name="position">1</property> </packing> </child> <child> <placeholder/> </child> </object> <packing> <property name="position">6</property> </packing> </child> <child> <placeholder/> </child> <child> <object class="gtkhbox" id="hbox4"> <property name="visible">true</property> <child> <placeholder/> </child> <child> <object class="gtkbutton" id="ballload"> <property name="label" translatable="yes">ballabfolge laden</property> <property name="width_request">50</property> <property name="height_request">35</property> <property name="visible">true</property> <property name="can_focus">true</property> <property name="receives_default">true</property> </object> <packing> <property name="position">1</property> </packing> </child> <child> <placeholder/> </child> </object> <packing> <property name="position">8</property> </packing> </child> <child> <object class="gtkhbox" id="hbox5"> <property name="visible">true</property> <child> <object class="gtklabel" id="bwmlabel"> <property name="visible">true</property> <property name="label" translatable="yes">bwm</property> <property name="justify">fill</property> <property name="width_chars">5</property> <property name="angle">15.710000000000001</property> <attributes> <attribute name="style">normal</attribute> <attribute name="weight">light</attribute> <attribute name="variant">normal</attribute> <attribute name="stretch">ultra-condensed</attribute> <attribute name="gravity">south</attribute> </attributes> </object> <packing> <property name="position">0</property> </packing> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> </object> <packing> <property name="position">9</property> </packing> </child> </object> </child> </object> </interface>
, here corresponding c file.
mainmenu.c
i know script isnt structured, i'd happy if show me errors are.code:#include <gtk/gtk.h> gtkbuilder *builderqsg; void on_qsg_clicked (gtkbutton *button, gpointer user_data) { gtkwindow *qsgwindow; qsgwindow = gtk_widget (gtk_builder_get_object (builderqsg, "window1")); gtk_widget_hide(qsgwindow); } int main( int argc, char **argv ) { gtkbuilder *buildermain; gtkbuilder *builderqsg; gtkwidget *mainwindow; gtkwidget *qsgwindow; gtkwidget *label1; gtkbutton *qsg; gtkwidget *tutorial; gtkwidget *ballerst; gtkwidget *ballload; gtk_init( &argc, &argv ); buildermain = gtk_builder_new(); gtk_builder_add_from_file( buildermain, "mainmenu.xml", null ); builderqsg = gtk_builder_new(); gtk_builder_add_from_file( builderqsg, "qsgwindow.xml", null); mainwindow = gtk_widget( gtk_builder_get_object( buildermain, "window1" ) ); label1 = gtk_widget( gtk_builder_get_object( buildermain, "header1" ) ); qsg = gtk_widget( gtk_builder_get_object( buildermain, "qsg" ) ); tutorial = gtk_widget( gtk_builder_get_object( buildermain, "tutorial" ) ); ballerst = gtk_widget( gtk_builder_get_object( buildermain, "ballerst" ) ); ballload = gtk_widget( gtk_builder_get_object( buildermain, "ballload" ) ); gtk_builder_connect_signals (buildermain, null); g_object_unref( g_object (buildermain)); gtk_widget_show_all(mainwindow); gtk_window_fullscreen(mainwindow); g_signal_connect(qsg, "clicked", g_callback(on_qsg_clicked), null); gtk_widget_show_all(qsgwindow); gtk_main(); return 0; }
thanks!
bipmaol
sorry ignore post.
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk GTK+ Application doesnt work
Ubuntu
Comments
Post a Comment