]> Pileus Git - ~andy/gtk/blob - tests/testfontselection.c
GtkFontChooser: Fix segmentation fault in deprecated size list population
[~andy/gtk] / tests / testfontselection.c
1 /* testfontselection.c
2  * Copyright (C) 2011 Alberto Ruiz <aruiz@gnome.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include "config.h"
21
22 #include <gtk/gtk.h>
23
24
25 int
26 main (int argc, char *argv[])
27 {
28   GtkWidget *window;
29   GtkWidget *vbox;
30   GtkWidget *dialog;
31   GtkWidget *fontsel;
32   
33   gtk_init (NULL, NULL);
34     
35   dialog = gtk_font_selection_dialog_new (NULL);
36
37   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
38   gtk_widget_set_size_request (window, 300, 300);
39   vbox = gtk_vbox_new (TRUE, 6);
40   gtk_container_add (GTK_CONTAINER (window), vbox);
41
42   fontsel = gtk_font_selection_dialog_get_font_selection (GTK_FONT_SELECTION_DIALOG (dialog));
43   gtk_container_add (GTK_CONTAINER (vbox), gtk_font_selection_get_size_list (GTK_FONT_SELECTION (fontsel)));
44   gtk_container_add (GTK_CONTAINER (vbox), gtk_font_selection_get_family_list (GTK_FONT_SELECTION (fontsel)));
45   gtk_container_add (GTK_CONTAINER (vbox), gtk_font_selection_get_face_list (GTK_FONT_SELECTION (fontsel)));
46
47   gtk_widget_show_all (window);
48
49   gtk_dialog_run (GTK_DIALOG (dialog));
50
51   gtk_widget_destroy (dialog);
52   return 0;
53 }