aboutsummaryrefslogtreecommitdiff
path: root/example/messagedialog.c
diff options
context:
space:
mode:
authorCody Russell <crussell@canonical.com>2010-05-12 23:21:36 +0200
committerCody Russell <crussell@canonical.com>2010-05-12 23:21:36 +0200
commita544da2cdf98dc1763a84626e13a1e2e5da98e83 (patch)
treee4a14450676f6e6bebaba97b2c53fbbac32adeb2 /example/messagedialog.c
parentac894c8ff8c842a8911fbae7998789ada1a080e6 (diff)
downloadayatana-ido-a544da2cdf98dc1763a84626e13a1e2e5da98e83.tar.gz
ayatana-ido-a544da2cdf98dc1763a84626e13a1e2e5da98e83.tar.bz2
ayatana-ido-a544da2cdf98dc1763a84626e13a1e2e5da98e83.zip
IdoMessageDialog - a morphing message dialog.
Diffstat (limited to 'example/messagedialog.c')
-rw-r--r--example/messagedialog.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/example/messagedialog.c b/example/messagedialog.c
new file mode 100644
index 0000000..bc24aff
--- /dev/null
+++ b/example/messagedialog.c
@@ -0,0 +1,57 @@
+#include <gtk/gtk.h>
+
+#include "idomessagedialog.h"
+
+static void
+response_cb (GtkDialog *dialog,
+ gint response,
+ gpointer user_data)
+{
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+static void
+button_clicked_cb (GtkWidget *button, gpointer data)
+{
+ GtkWidget *window = (GtkWidget *) data;
+ GtkWidget *dialog = ido_message_dialog_new (GTK_WINDOW (window),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_CLOSE,
+ "This is a test of the emergency broadcasting system");
+ gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog),
+ "If this had been an actual emergency, you'd be dead already");
+ g_signal_connect (G_OBJECT (dialog),
+ "response",
+ G_CALLBACK (response_cb), NULL);
+ gtk_widget_show (dialog);
+}
+
+int
+main (int argc, char *argv[])
+{
+ GtkWidget *window;
+ GtkWidget *vbox;
+ GtkWidget *button;
+
+ gtk_init (&argc, &argv);
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title (GTK_WINDOW (window), "Message Dialogs");
+ g_signal_connect (window, "destroy", gtk_main_quit, NULL);
+
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (window), vbox);
+
+ button = gtk_button_new_with_label ("Confirmation dialog");
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (button_clicked_cb),
+ window);
+ gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+
+ gtk_widget_show_all (window);
+
+ gtk_main ();
+
+ return 0;
+}