[dia] Bug 603004 - Exporting a document to png without --size crashes



commit 93f1efad1e0336da83bd3789a0c8e505b0daac6c
Author: Hans Breuer <hans breuer org>
Date:   Fri Nov 27 22:47:45 2009 +0100

    Bug 603004 - Exporting a document to png without --size crashes
    
    Only show the size dialog when running interactive. Introduces a dependencies to app/ but crashing is worse.

 plug-ins/libart/export_png.c |    6 ++++--
 plug-ins/makefile.msc        |    2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/plug-ins/libart/export_png.c b/plug-ins/libart/export_png.c
index 358df17..2dc5619 100644
--- a/plug-ins/libart/export_png.c
+++ b/plug-ins/libart/export_png.c
@@ -39,6 +39,8 @@
 #include "message.h"
 #include "dialogs.h"
 
+/* ugly, but better tahn crashin on non-interactive use */
+#include "../../app/app_procs.h"
 
 /* parses a string of the form "[0-9]*x[0-9]*" and transforms it into
    two long values width and height. */
@@ -320,7 +322,7 @@ export_png(DiagramData *data, const gchar *filename,
      the same time will lead to confusion.
   */
 
-  if (export_png_dialog == NULL && user_data == NULL) {
+  if (export_png_dialog == NULL && user_data == NULL && app_is_interactive()) {
     /* Create a dialog */
     export_png_dialog = dialog_make(_("PNG Export Options"),
 				    _("Export"), NULL,
@@ -348,7 +350,7 @@ export_png(DiagramData *data, const gchar *filename,
   cbdata->data = data;
   cbdata->filename = g_strdup(filename);
 
-  if (user_data == NULL) {
+  if (user_data == NULL && app_is_interactive()) {
     /* Find the default size */
     width  = (guint32) ((ext->right - ext->left) * DPCM * data->paper.scaling);
     height = (guint32) ((ext->bottom - ext->top) * DPCM * data->paper.scaling);
diff --git a/plug-ins/makefile.msc b/plug-ins/makefile.msc
index ee56222..38c6223 100644
--- a/plug-ins/makefile.msc
+++ b/plug-ins/makefile.msc
@@ -82,7 +82,7 @@ OBJECTS = \
 
 !IFDEF OBJ_libart
 PKG_CFLAGS = $(PKG_CFLAGS) -DHAVE_LIBART -DHAVE_LIBPNG $(LIBART_CFLAGS) $(PNG_CFLAGS)
-PKG_LINK = $(PKG_LINK) $(LIBART_LIBS) $(PNG_LIBS)
+PKG_LINK = $(PKG_LINK) $(LIBART_LIBS) $(PNG_LIBS) ..\..\app\dia-app.lib
 OBJECTS = \
   dialibart.obj \
   export_png.obj \



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