diff options
author | Matthias Clasen <mclasen@redhat.com> | 2011-06-01 21:44:22 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2011-06-01 21:44:22 -0400 |
commit | cfffa32d4bf1f40f59029353be5f2d52c778826e (patch) | |
tree | 4cad03d68ca00071e5dcbd014d208f35af9a032a /demos | |
parent | bfa5d367b4f7f198935390277495868dd233619c (diff) | |
download | gtk+-cfffa32d4bf1f40f59029353be5f2d52c778826e.tar.gz |
gtk-demo: Add an app chooser button demo
Add a 'Mail' app chooser to the 'Pickers' example.
Diffstat (limited to 'demos')
-rw-r--r-- | demos/gtk-demo/pickers.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/demos/gtk-demo/pickers.c b/demos/gtk-demo/pickers.c index 838c718ef5..e1f82ca02e 100644 --- a/demos/gtk-demo/pickers.c +++ b/demos/gtk-demo/pickers.c @@ -1,7 +1,7 @@ -/* Pickers +/* Pickers * * These widgets are mainly intended for use in preference dialogs. - * They allow to select colors, fonts, files and directories. + * They allow to select colors, fonts, files, directories and applications. */ #include <gtk/gtk.h> @@ -18,14 +18,14 @@ do_pickers (GtkWidget *do_widget) gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget)); gtk_window_set_title (GTK_WINDOW (window), "Pickers"); - + g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); - + gtk_container_set_border_width (GTK_CONTAINER (window), 10); - table = gtk_table_new (4, 2, FALSE); + table = gtk_table_new (5, 2, FALSE); gtk_table_set_col_spacing (GTK_TABLE (table), 0, 10); gtk_table_set_row_spacings (GTK_TABLE (table), 3); gtk_container_add (GTK_CONTAINER (window), table); @@ -46,17 +46,24 @@ do_pickers (GtkWidget *do_widget) label = gtk_label_new ("File:"); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - picker = gtk_file_chooser_button_new ("Pick a File", + picker = gtk_file_chooser_button_new ("Pick a File", GTK_FILE_CHOOSER_ACTION_OPEN); gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3); gtk_table_attach_defaults (GTK_TABLE (table), picker, 1, 2, 2, 3); label = gtk_label_new ("Folder:"); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - picker = gtk_file_chooser_button_new ("Pick a Folder", + picker = gtk_file_chooser_button_new ("Pick a Folder", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4); gtk_table_attach_defaults (GTK_TABLE (table), picker, 1, 2, 3, 4); + + label = gtk_label_new ("Mail:"); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + picker = gtk_app_chooser_button_new ("x-scheme-handler/mailto"); + gtk_app_chooser_button_set_show_dialog_item (GTK_APP_CHOOSER_BUTTON (picker), TRUE); + gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 4, 5); + gtk_table_attach_defaults (GTK_TABLE (table), picker, 1, 2, 4, 5); } if (!gtk_widget_get_visible (window)) @@ -64,7 +71,7 @@ do_pickers (GtkWidget *do_widget) gtk_widget_show_all (window); } else - { + { gtk_widget_destroy (window); window = NULL; } |