r19357 - gnucash/trunk/src/report/report-system - #616606 - Get default report font from top level widget

Phil Longstaff plongstaff at code.gnucash.org
Sun Jul 11 14:33:16 EDT 2010


Author: plongstaff
Date: 2010-07-11 14:33:16 -0400 (Sun, 11 Jul 2010)
New Revision: 19357
Trac: http://svn.gnucash.org/trac/changeset/19357

Modified:
   gnucash/trunk/src/report/report-system/Makefile.am
   gnucash/trunk/src/report/report-system/gnc-report.c
Log:
#616606 - Get default report font from top level widget

Patch by Tao Wang


Modified: gnucash/trunk/src/report/report-system/Makefile.am
===================================================================
--- gnucash/trunk/src/report/report-system/Makefile.am	2010-07-10 15:29:10 UTC (rev 19356)
+++ gnucash/trunk/src/report/report-system/Makefile.am	2010-07-11 18:33:16 UTC (rev 19357)
@@ -17,7 +17,8 @@
   ${top_builddir}/src/gnc-module/libgnc-module.la \
   ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
   ${GUILE_LIBS} \
-  ${GLIB_LIBS}
+  ${GLIB_LIBS} \
+  ${GTK_LIBS}
 
 if BUILDING_FROM_SVN
 swig-report-system.c: report-system.i ${top_srcdir}/src/base-typemaps.i
@@ -29,7 +30,9 @@
   -I${top_srcdir}/src \
   -I${top_srcdir}/src/gnc-module \
   -I${top_srcdir}/src/app-utils \
-  ${GLIB_CFLAGS} ${GUILE_INCS}
+  ${GLIB_CFLAGS} \
+  ${GTK_CFLAGS} \
+  ${GUILE_INCS}
 
 gncscmdir = ${GNC_SHAREDIR}/scm
 gncscm_DATA = \

Modified: gnucash/trunk/src/report/report-system/gnc-report.c
===================================================================
--- gnucash/trunk/src/report/report-system/gnc-report.c	2010-07-10 15:29:10 UTC (rev 19356)
+++ gnucash/trunk/src/report/report-system/gnc-report.c	2010-07-11 18:33:16 UTC (rev 19357)
@@ -25,6 +25,7 @@
 #include "config.h"
 
 #include <glib.h>
+#include <gtk/gtk.h>
 #include <libguile.h>
 #include <stdio.h>
 #include <string.h>
@@ -198,5 +199,18 @@
 gchar*
 gnc_get_default_report_font_family(void)
 {
-    return g_strdup("Arial");
+    GList*          top_list;
+    GtkWidget*      top_widget;
+    GtkStyle*       top_widget_style;
+    const gchar*    default_font_family;
+
+    top_list = gtk_window_list_toplevels();
+    top_widget = GTK_WIDGET(top_list->data);
+    top_widget_style = gtk_rc_get_style(top_widget);
+    default_font_family = pango_font_description_get_family(top_widget_style->font_desc);
+
+    if (default_font_family == NULL)
+        return g_strdup("Arial");
+    else
+        return g_strdup(default_font_family);
 }



More information about the gnucash-changes mailing list