diff options
author | Matthias Clasen <mclasen@redhat.com> | 2012-02-09 07:57:11 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2012-02-09 08:08:23 -0500 |
commit | b4c31b070fc0ec5f94195fe26512d4466062c41c (patch) | |
tree | 0f9f1717a4bcebcd9363ec8e3b7aafdc902f2c2a /tests | |
parent | bc95f03f379de4a8f84201627e4348d4f1eacc9c (diff) | |
download | gtk+-b4c31b070fc0ec5f94195fe26512d4466062c41c.tar.gz |
widget-factory: add an about dialog
This is a first step towards making widget-factory an installed
demo.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/widget-factory.c | 28 | ||||
-rw-r--r-- | tests/widget-factory.ui | 3 |
2 files changed, 30 insertions, 1 deletions
diff --git a/tests/widget-factory.c b/tests/widget-factory.c index 3425122fab..6bb2761adc 100644 --- a/tests/widget-factory.c +++ b/tests/widget-factory.c @@ -22,6 +22,7 @@ * */ +#include "config.h" #include <gtk/gtk.h> static void @@ -35,6 +36,30 @@ dark_toggled (GtkCheckMenuItem *item, gpointer data) NULL); } +static void +show_about (GtkMenuItem *item, GtkWidget *window) +{ + const gchar *authors[] = { + "Andrea Cimitan", + "Cosimo Cecchi" + }; + + gtk_show_about_dialog (GTK_WINDOW (window), + "program-name", "GTK+ Widget Factory", + "version", g_strdup_printf ("%s,\nRunning against GTK+ %d.%d.%d", + PACKAGE_VERSION, + gtk_get_major_version (), + gtk_get_minor_version (), + gtk_get_micro_version ()), + "copyright", "(C) 1997-2009 The GTK+ Team", + "license-type", GTK_LICENSE_LGPL_2_1, + "website", "http://www.gtk.org", + "comments", "Program to demonstrate GTK+ themes and widgets", + "authors", authors, + "title", "About GTK+ Widget Factory", + NULL); +} + int main (int argc, char *argv[]) { @@ -58,6 +83,9 @@ main (int argc, char *argv[]) g_signal_connect (widget, "toggled", G_CALLBACK (dark_toggled), NULL); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (widget), dark); + widget = (GtkWidget*) gtk_builder_get_object (builder, "aboutmenuitem"); + g_signal_connect (widget, "activate", G_CALLBACK (show_about), window); + g_object_unref (G_OBJECT (builder)); gtk_widget_show (window); diff --git a/tests/widget-factory.ui b/tests/widget-factory.ui index 101e89ca01..fab054ab4f 100644 --- a/tests/widget-factory.ui +++ b/tests/widget-factory.ui @@ -54,6 +54,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property> <object class="GtkAccelGroup" id="accelgroup1"/> <object class="GtkWindow" id="window"> <property name="can_focus">False</property> + <property name="title">GTK+ Widget Factory</property> <signal name="destroy" handler="gtk_main_quit" swapped="no"/> <signal name="delete-event" handler="gtk_false" swapped="no"/> <child> @@ -390,7 +391,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property> <property name="visible">True</property> <property name="can_focus">False</property> <child> - <object class="GtkImageMenuItem" id="imagemenuitem10"> + <object class="GtkImageMenuItem" id="aboutmenuitem"> <property name="label">gtk-about</property> <property name="visible">True</property> <property name="can_focus">False</property> |