[gnumeric] Print: avoid (silent) warnings from g_log to easy debugging.



commit f965dd77633e59720a88c2edfdea95bb145f780c
Author: Morten Welinder <terra gnome org>
Date:   Thu Mar 11 12:41:08 2010 -0500

    Print: avoid (silent) warnings from g_log to easy debugging.

 ChangeLog        |    6 ++++++
 src/print-info.c |   13 ++++++++++++-
 2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 411aa4c..13b1357 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-11  Morten Welinder  <terra gnome org>
+
+	* src/print-info.c (page_setup_set_paper): Avoid some calls to
+	g_log even if we block the warnings it would print.  This helps
+	debugging.
+
 2010-03-10  Morten Welinder  <terra gnome org>
 
 	* src/sheet-object-cell-comment.c (comment_view_button_released,
diff --git a/src/print-info.c b/src/print-info.c
index 616835b..d560967 100644
--- a/src/print-info.c
+++ b/src/print-info.c
@@ -979,6 +979,14 @@ print_info_set_margins (PrintInformation *pi,
 						 right, GTK_UNIT_POINTS);
 }
 
+static gboolean
+known_bad_paper (const char *paper)
+{
+	if (strcmp (paper, "") == 0)
+		return TRUE;
+	return FALSE;
+}
+
 
 static void
 paper_log_func (const gchar   *log_domain,
@@ -1032,7 +1040,10 @@ page_setup_set_paper (GtkPageSetup *page_setup, char const *paper)
 
 	/* Hack: gtk_paper_size_new warns on bad paper, so shut it up.  */
 	/* http://bugzilla.gnome.org/show_bug.cgi?id=493880 */
-	{
+	if (known_bad_paper (paper)) {
+		gtk_paper = NULL;
+		bad_paper = 1;
+	} else {
 		const char *domain = "Gtk";
 		guint handler = g_log_set_handler (domain, G_LOG_LEVEL_WARNING,
 						   paper_log_func, &bad_paper);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]