From ac01b8fc64a4fe0094ae5a8a57bdfed9793cb300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Sat, 4 Dec 2010 16:07:53 +0000 Subject: [PATCH] [GB.GTK] * BUG: Fix a bad code path in event management, which leads to warnings from the GTK+ library when displaying the printer configuration dialog. git-svn-id: svn://localhost/gambas/trunk@3342 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- gb.gtk/src/gapplication.cpp | 6 +++++- gb.gtk/src/gprinter.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gb.gtk/src/gapplication.cpp b/gb.gtk/src/gapplication.cpp index e900af313..e067c07d6 100644 --- a/gb.gtk/src/gapplication.cpp +++ b/gb.gtk/src/gapplication.cpp @@ -295,16 +295,18 @@ static void gambas_handle_event(GdkEvent *event) //fprintf(stderr, "type: %s\n", G_OBJECT_TYPE_NAME(widget)); if (!strcmp(G_OBJECT_TYPE_NAME(gtk_widget_get_toplevel(widget)), "GtkPrintUnixDialog")) { - //fprintf(stderr, "event: %d\n", event->type); if (event->type == GDK_MAP) { + //fprintf(stderr, "event: MAP!\n"); widget = gtk_window_get_default_widget(GTK_WINDOW(gtk_widget_get_toplevel(widget))); if (widget && GTK_IS_BUTTON(widget)) { gApplication::_close_next_window = false; gtk_button_clicked(GTK_BUTTON(widget)); + goto __HANDLE_EVENT; //g_timeout_add(0, (GSourceFunc)close_dialog, GTK_BUTTON(widget)); } + //fprintf(stderr, "event: MAP! <<< end\n"); } } } @@ -314,6 +316,8 @@ static void gambas_handle_event(GdkEvent *event) goto __HANDLE_EVENT; widget = gtk_get_event_widget(event); + if (!widget) + goto __HANDLE_EVENT; grab = gtk_grab_get_current(); if (grab) diff --git a/gb.gtk/src/gprinter.cpp b/gb.gtk/src/gprinter.cpp index dfecc1763..c8a6b5c88 100644 --- a/gb.gtk/src/gprinter.cpp +++ b/gb.gtk/src/gprinter.cpp @@ -66,7 +66,7 @@ static void cb_end(GtkPrintOperation *operation, GtkPrintContext *context, gPrin #if DEBUG_ME fprintf(stderr, "cb_end\n"); #endif - if (printer->onEnd) + if (printer->_preview && printer->onEnd) (*printer->onEnd)(printer); }