Hey guys so I started learning C and GTK like a month a go and I started building my first gtk program and I here I am because I need some help from you
I decided to use glade for building interface of my program but there is like 10 tutorials which cover glade and gtk and I can not find example on how to display dialog, any dialog like filechooser or about
In Glade 3.8.0 Im using I creted window in that window I have button after that I have filechooserdialog and two buttons inside OK nad Cancel when I click button I wold like to show filechooserdialog and to get path and file name from it. Here is my code which I used from here
main (int argc,
gtk_init (&argc, &argv);
/* Construct a GtkBuilder instance and load our UI description */
builder = gtk_builder_new ();
gtk_builder_add_from_file (builder, "builder.glade", NULL);
/* Connect signal handlers to the constructed widgets. */
window = gtk_builder_get_object (builder, "window");
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
filedialog = gtk_builder_get_object (builder, "filechooserdialog");
button = gtk_builder_get_object (builder, "button1");
g_signal_connect (button, "clicked", G_CALLBACK (show_dialog), NULL);
button = gtk_builder_get_object (builder, "quit");
g_signal_connect (button, "clicked", G_CALLBACK (gtk_main_quit), NULL);
/* Destroy builder */
g_object_unref( G_OBJECT( builder ) );
So i found gtk_dialog_run() but I do not know how to use it do show dialog what argument do I need to pass to it ?
If I compare this code to gtk2 code example there is no gtk_widget_show( window ); and gtk_builder_connect_signals( builder, NULL ); is this ok/normal ?
There is several examples how to show dialog but they use
GtkWidget *dialog = gtk_file_chooser_dialog_new (_("Open image"),
which I do not need I would like to use filechoserdialog from glade. Many tnx in advice on any sugestion, cheers !