summaryrefslogtreecommitdiff
path: root/tests/testfontchooserdialog.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testfontchooserdialog.c')
-rw-r--r--tests/testfontchooserdialog.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/testfontchooserdialog.c b/tests/testfontchooserdialog.c
index bc76652522..1c58f129fa 100644
--- a/tests/testfontchooserdialog.c
+++ b/tests/testfontchooserdialog.c
@@ -20,6 +20,43 @@
#include <gtk/gtk.h>
#include "prop-editor.h"
+static void
+notify_font_cb (GtkFontChooser *fontchooser, GParamSpec *pspec, gpointer data)
+{
+ PangoFontFamily *family;
+ PangoFontFace *face;
+
+ g_debug ("Changed font name %s", gtk_font_chooser_get_font (fontchooser));
+
+ family = gtk_font_chooser_get_family (fontchooser);
+ face = gtk_font_chooser_get_face (fontchooser);
+ if (family)
+ {
+ g_debug (" Family: %s is-monospace:%s",
+ pango_font_family_get_name (family),
+ pango_font_family_is_monospace (family) ? "true" : "false");
+ }
+ else
+ g_debug (" No font family!");
+
+ if (face)
+ g_debug (" Face description: %s", pango_font_face_get_face_name (face));
+ else
+ g_debug (" No font face!");
+}
+
+static void
+notify_preview_text_cb (GObject *fontchooser, GParamSpec *pspec, gpointer data)
+{
+ g_debug ("Changed preview text %s", gtk_font_chooser_get_preview_text (GTK_FONT_CHOOSER (fontchooser)));
+}
+
+static void
+font_activated_cb (GtkFontChooser *chooser, const gchar *font_name, gpointer data)
+{
+ g_debug ("font-activated: %s", font_name);
+}
+
int
main (int argc, char *argv[])
{
@@ -33,6 +70,13 @@ main (int argc, char *argv[])
gtk_container_add (GTK_CONTAINER (window), font_button);
gtk_widget_show_all (window);
+ g_signal_connect (font_button, "notify::font",
+ G_CALLBACK (notify_font_cb), NULL);
+ g_signal_connect (font_button, "notify::preview-text",
+ G_CALLBACK (notify_preview_text_cb), NULL);
+ g_signal_connect (font_button, "font-activated",
+ G_CALLBACK (font_activated_cb), NULL);
+
g_signal_connect (window, "delete-event",
G_CALLBACK (gtk_main_quit), NULL);