mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone
Blob Blame History Raw
From 5239a0d260109d33d1e436bc63fee4b6e58c44c8 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 18 Jun 2016 15:31:34 +0100
Subject: [PATCH] p2v: Use a monospace font for the run dialog.

(cherry picked from commit ca6fea7616f89775180ab686133052eca18f0e00)
---
 p2v/gui.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/p2v/gui.c b/p2v/gui.c
index a3b4af9..764b0f8 100644
--- a/p2v/gui.c
+++ b/p2v/gui.c
@@ -1448,6 +1448,20 @@ create_running_dialog (void)
       gtk_text_buffer_create_tag (buf, tag_name, "foreground", tags[i], NULL);
   }
 
+#if GTK_CHECK_VERSION(3,16,0)   /* gtk >= 3.16 */
+  /* XXX This only sets the "CSS" style.  It's not clear how to set
+   * the particular font.  However (by accident) this does at least
+   * set the widget to use a monospace font.
+   */
+  GtkStyleContext *context = gtk_widget_get_style_context (v2v_output);
+  gtk_style_context_add_class (context, "monospace");
+#else
+  PangoFontDescription *font;
+  font = pango_font_description_from_string ("Monospace 11");
+  gtk_widget_modify_font (v2v_output, font);
+  pango_font_description_free (font);
+#endif
+
   log_label = gtk_label_new (NULL);
   gtk_misc_set_alignment (GTK_MISC (log_label), 0., 0.5);
   gtk_misc_set_padding (GTK_MISC (log_label), 10, 10);
-- 
2.7.4