Created
September 6, 2016 03:50
-
-
Save ptomato/2295a299923f527ed1075dd0590e96e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <gtk/gtk.h> | |
#include <stdio.h> | |
static GtkWidget *mainWindow = NULL; | |
void | |
prompt_window (void) | |
{ | |
GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (mainWindow), | |
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
GTK_MESSAGE_INFO, | |
GTK_BUTTONS_YES_NO, | |
"What's the answer?"); | |
gtk_dialog_run (GTK_DIALOG (dialog)); | |
gtk_widget_destroy (dialog); | |
} | |
void | |
main_button_press (void) | |
{ | |
prompt_window (); | |
prompt_window (); | |
} | |
int | |
main (int argc, | |
char **argv) | |
{ | |
gtk_init (&argc, &argv); | |
mainWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); | |
GtkWidget *button = gtk_button_new_with_label ("Show two dialogs"); | |
g_signal_connect (G_OBJECT (mainWindow), "destroy", | |
G_CALLBACK (gtk_main_quit), NULL); | |
g_signal_connect (G_OBJECT (button), "clicked", | |
G_CALLBACK (main_button_press), NULL); | |
gtk_container_add (GTK_CONTAINER (mainWindow), button); | |
gtk_widget_show_all (mainWindow); | |
gtk_main (); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment