[goffice] avoid gtk bug #664587



commit d30d43c7d84a3a9ce75b93cd4dfa12a6bc4a868f
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Wed Nov 23 11:17:47 2011 -0700

     avoid gtk bug #664587
    
    2011-10-27  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* goffice/gtk/goffice-gtk.c (recent_func_log_func): new
    	(go_gtk_file_sel_dialog): avoid gtk bug #664587

 ChangeLog                 |    5 +++++
 goffice/gtk/goffice-gtk.c |   18 ++++++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 283e159..fa2d115 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-27  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* goffice/gtk/goffice-gtk.c (recent_func_log_func): new
+	(go_gtk_file_sel_dialog): avoid gtk bug #664587
+
 2011-11-21  Morten Welinder  <terra gnome org>
 
 	* goffice/utils/go-glib-extras.c (go_guess_encoding): Plug leak.
diff --git a/goffice/gtk/goffice-gtk.c b/goffice/gtk/goffice-gtk.c
index 8d4cb93..0873c81 100644
--- a/goffice/gtk/goffice-gtk.c
+++ b/goffice/gtk/goffice-gtk.c
@@ -559,6 +559,16 @@ gu_delete_handler (GtkDialog *dialog,
 	return TRUE; /* Do not destroy */
 }
 
+static void
+recent_func_log_func (G_GNUC_UNUSED const gchar   *log_domain,
+		      G_GNUC_UNUSED GLogLevelFlags log_level,
+		      G_GNUC_UNUSED const gchar   *message,
+		      G_GNUC_UNUSED gpointer       user_data)
+{
+	/* We just want to suppress the warnings */
+	/* http://bugzilla.gnome.org/show_bug.cgi?id=664587 */
+}
+
 /**
  * go_gtk_file_sel_dialog :
  * @toplevel : #GtkWindow
@@ -573,6 +583,8 @@ go_gtk_file_sel_dialog (GtkWindow *toplevel, GtkWidget *w)
 {
 	gboolean result = FALSE;
 	gulong delete_handler;
+	guint log_handler;
+	const char *domain = "Gtk";
 
 	g_return_val_if_fail (GTK_IS_WINDOW (toplevel), FALSE);
 	g_return_val_if_fail (GTK_IS_FILE_CHOOSER (w), FALSE);
@@ -586,7 +598,13 @@ go_gtk_file_sel_dialog (GtkWindow *toplevel, GtkWidget *w)
 
 	gtk_widget_show (w);
 	gtk_grab_add (w);
+
+	/* Hack: the gtk file dialog warns when it can't access a new file, so shut it up.  */
+	/* http://bugzilla.gnome.org/show_bug.cgi?id=664587 */
+	log_handler = g_log_set_handler (domain, G_LOG_LEVEL_WARNING,
+					 recent_func_log_func, NULL);
 	gtk_main ();
+	g_log_remove_handler (domain, log_handler);
 
 	g_signal_handler_disconnect (w, delete_handler);
 



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