[Xfce4-commits] [apps/xfce4-terminal] 01/01: Respect Xfce monospace font setting

noreply at xfce.org noreply at xfce.org
Sun Mar 17 17:51:03 CET 2019


This is an automated email from the git hooks/post-receive script.

f   2   4   0   4       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-terminal.

commit 4119272d6e64de6b95a89f03c7176ac6cc6869ec
Author: Igor <f2404 at yandex.ru>
Date:   Sun Mar 17 12:50:14 2019 -0400

    Respect Xfce monospace font setting
    
    Fixes bug #15202
---
 configure.ac.in            |  1 +
 terminal/Makefile.am       |  2 ++
 terminal/terminal-screen.c | 22 ++++++++++++++++++----
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index 8d86bb0..1894bb5 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -95,6 +95,7 @@ XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.20.8])
 XDT_CHECK_PACKAGE([VTE], [vte-2.91], [0.38])
 XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.32.0])
 XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.10.0])
+XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.10.0])
 
 dnl ***********************************
 dnl *** Used to compress glade data ***
diff --git a/terminal/Makefile.am b/terminal/Makefile.am
index 71e2d3c..62a207f 100644
--- a/terminal/Makefile.am
+++ b/terminal/Makefile.am
@@ -57,6 +57,7 @@ xfce4_terminal_CFLAGS = \
 	$(LIBX11_CFLAGS) \
 	$(VTE_CFLAGS) \
 	$(LIBXFCE4UI_CFLAGS) \
+	$(XFCONF_CFLAGS) \
 	$(PLATFORM_CFLAGS)
 
 xfce4_terminal_LDFLAGS = \
@@ -70,6 +71,7 @@ xfce4_terminal_LDADD = \
 	$(LIBX11_LIBS) \
 	$(VTE_LIBS) \
 	$(LIBXFCE4UI_LIBS) \
+	$(XFCONF_LIBS) \
 	$(TERMINAL_LIBS)
 
 if HAVE_UTEMPTER
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 1fff34e..18cce01 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -44,6 +44,7 @@
 #include <sys/wait.h>
 
 #include <libxfce4ui/libxfce4ui.h>
+#include <xfconf/xfconf.h>
 
 #include <terminal/terminal-util.h>
 #include <terminal/terminal-enum-types.h>
@@ -2808,10 +2809,11 @@ terminal_screen_update_font (TerminalScreen *screen)
 {
   GtkWidget            *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (screen));
   gboolean              font_use_system, font_allow_bold;
-  gchar                *font_name;
+  gchar                *font_name = NULL;
   PangoFontDescription *font_desc;
   glong                 grid_w = 0, grid_h = 0;
   GSettings            *settings;
+  XfconfChannel        *channel;
 #if VTE_CHECK_VERSION (0, 51, 3)
   gdouble cell_width_scale, cell_height_scale;
 #endif
@@ -2827,9 +2829,21 @@ terminal_screen_update_font (TerminalScreen *screen)
 
   if (font_use_system)
     {
-      settings = g_settings_new ("org.gnome.desktop.interface");
-      font_name = g_settings_get_string (settings, "monospace-font-name");
-      g_object_unref (settings);
+      /* read Xfce settings */
+      xfconf_init (NULL);
+      channel = xfconf_channel_get ("xsettings");
+      if (xfconf_channel_has_property (channel, "/Gtk/MonospaceFontName"))
+        font_name = xfconf_channel_get_string (channel, "/Gtk/MonospaceFontName", "");
+      xfconf_shutdown ();
+
+      /* if font isn't set, read GNOME settings */
+      if (!IS_STRING (font_name))
+        {
+          g_free (font_name);
+          settings = g_settings_new ("org.gnome.desktop.interface");
+          font_name = g_settings_get_string (settings, "monospace-font-name");
+          g_object_unref (settings);
+        }
     }
   else
     g_object_get (G_OBJECT (screen->preferences), "font-name", &font_name, NULL);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list