2 * Copyright (C) 2011 Alberto Ruiz <aruiz@gnome.org>
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.
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.
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.
23 notify_font_name_cb (GObject *fontchooser, GParamSpec *pspec, gpointer data)
25 g_debug ("Changed font name %s", gtk_font_chooser_get_font_name (GTK_FONT_CHOOSER (fontchooser)));
29 notify_preview_text_cb (GObject *fontchooser, GParamSpec *pspec, gpointer data)
31 g_debug ("Changed preview text %s", gtk_font_chooser_get_preview_text (GTK_FONT_CHOOSER (fontchooser)));
35 main (int argc, char *argv[])
39 GtkWidget *fontchooser;
41 gtk_init (NULL, NULL);
43 fontchooser = gtk_font_chooser_new ();
45 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
46 gtk_widget_set_size_request (window, 600, 600);
47 box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
48 gtk_container_add (GTK_CONTAINER (window), box);
49 gtk_container_add (GTK_CONTAINER (box), fontchooser);
51 gtk_widget_show_all (window);
53 g_signal_connect (window, "delete-event",
54 G_CALLBACK (gtk_main_quit), NULL);
55 g_signal_connect (fontchooser, "notify::font-name",
56 G_CALLBACK (notify_font_name_cb), NULL);
57 g_signal_connect (fontchooser, "notify::preview-text",
58 G_CALLBACK (notify_preview_text_cb), NULL);
60 gtk_font_chooser_set_font_name (GTK_FONT_CHOOSER (fontchooser), "Bitstream Vera Sans 45");
61 gtk_font_chooser_set_preview_text (GTK_FONT_CHOOSER (fontchooser), "[user@host ~]$ ");
62 gtk_font_chooser_set_show_preview_entry (GTK_FONT_CHOOSER (fontchooser), FALSE);