From 5ac329c376c06914061a499faad0e0a57a6ca99e Mon Sep 17 00:00:00 2001 From: Phil Longstaff Date: Sun, 11 Jul 2010 18:33:16 +0000 Subject: [PATCH] #616606 - Get default report font from top level widget Patch by Tao Wang git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19357 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/report/report-system/Makefile.am | 7 +++++-- src/report/report-system/gnc-report.c | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/report/report-system/Makefile.am b/src/report/report-system/Makefile.am index 5570804086..db6495dace 100644 --- a/src/report/report-system/Makefile.am +++ b/src/report/report-system/Makefile.am @@ -17,7 +17,8 @@ libgncmod_report_system_la_LIBADD = \ ${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 @@ AM_CPPFLAGS = \ -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 = \ diff --git a/src/report/report-system/gnc-report.c b/src/report/report-system/gnc-report.c index 1a7cffc88f..52b7378f50 100644 --- a/src/report/report-system/gnc-report.c +++ b/src/report/report-system/gnc-report.c @@ -25,6 +25,7 @@ #include "config.h" #include +#include #include #include #include @@ -198,5 +199,18 @@ gnc_report_name( SCM report ) 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); }