Re: [Gimp-developer] Hacking on the mail plugin

2009-10-05 Thread Sven Neumann
Hi,

On Sun, 2009-10-04 at 16:59 -0500, Chris Mohler wrote:

 So, I've written a replacement plug-in that works pretty well.
 However, the only filetype supported is still .XCF.

I don't quite understand where this limitation comes from. If you allow
the user to enter any filename, then GIMP will select a save procedure
that matches the file extension. That should work for all file-types
that GIMP knows about, not only for XCF. If it indeed does only work for
XCF, then that's a regression in the plug-in API that should be reported
and fixed for 2.8.


Sven


___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Hacking on the mail plugin

2009-10-04 Thread Sven Neumann
On Sat, 2009-10-03 at 21:27 -0500, Chris Mohler wrote:
 However, I can not for the life of me figure out why my call to
 g_spawn_async throws a segfault every time.  

Well, you pass it a pointer to xdgargs which was previously allocated on
the stack like this:

  gchar *xdgargs[sizeof (gchar)];

This should probably read

  gchar *xdgargs[4];

instead, since you want to store three arguments plus a trailing NULL.

And please make sure that you convert your tabs to spaces before you
submit your patch. Thanks.


Sven


___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Hacking on the mail plugin

2009-10-04 Thread Chris Mohler
On Sun, Oct 4, 2009 at 1:25 PM, Sven Neumann s...@gimp.org wrote:

 This should probably read

  gchar *xdgargs[4];

(sorry forgot to reply-all)

Oops (facepalm).  Thanks.

So, I've written a replacement plug-in that works pretty well.
However, the only filetype supported is still .XCF.

Looking at the new api docs, it seems possible to raise a GimpDialog
that contains something like a toggle for Native XCF or Export and
also the new 'gimp_export_dialog_new' widget.  Does this sound
reasonable?

Thanks,
Chris
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Hacking on the mail plugin

2009-10-04 Thread Chris Mohler
On Sun, Oct 4, 2009 at 4:59 PM, Chris Mohler cr33...@gmail.com wrote:

 Looking at the new api docs, it seems possible to raise a GimpDialog
 that contains something like a toggle for Native XCF or Export and
 also the new 'gimp_export_dialog_new' widget.  Does this sound
 reasonable?

Also - is there some way to grab a list of all of the file types
supported by GIMP automatically?  I've taken a look in the
app/dialogs/file-save-dialog, but I'm beginning to doubt that a call
like 'gimp-plug_in_manager-export_procs' is possible from a
plug-in...

Thanks,
Chris
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


[Gimp-developer] Hacking on the mail plugin

2009-10-03 Thread Chris Mohler
OK, so I thought bug 596066
(https://bugzilla.gnome.org/show_bug.cgi?id=596066) might be easy
enough for me, an admitted novice in C.

However, I can not for the life of me figure out why my call to
g_spawn_async throws a segfault every time.  I would be most grateful
if someone could point out the problem (I'm sure it's a newbie error
on my part).

This patch has known problems.  Due to the new import/export structure
(I think), it will only work on native .XCF files right now., and the
file must be saved.  There is some legacy code from the original
sendmail plugin hanging around that isn't doing much.  And the
segfault of course :)  And finally, xdg-email is broken, and needs to
be patched in order for Evolution or Thunderbird to even accept
attachments.  You can grab the patch for xdg-email from launchpad
(filed upstream also):
https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/408350

The git patch is attached.

Thanks!
Chris

PS - is there any reason to maintain backwards compatibility with the
original mail plugin?  The attached patch was a heavy-handed attack
just to see if I could get it working with xdg-utils - I have not
really settled on the best approach yet.
From 099cf07983d1dbc82510952b2a2bce798b7ef62f Mon Sep 17 00:00:00 2001
From: Chris Mohler cr33...@gmail.com
Date: Sat, 3 Oct 2009 21:10:35 -0500
Subject: [PATCH] Update mail plugin to use xdg-email

This is a work-in-progress patch to use xdg-email instead of sendmail.  There are known problems.
---
 plug-ins/common/mail.c |  501 +++-
 1 files changed, 30 insertions(+), 471 deletions(-)

diff --git a/plug-ins/common/mail.c b/plug-ins/common/mail.c
index 8f5625a..19b8e71 100644
--- a/plug-ins/common/mail.c
+++ b/plug-ins/common/mail.c
@@ -102,8 +102,8 @@ static const guint8 mail_icon[] =
 };
 
 
-#ifndef SENDMAIL
-#define SENDMAIL /usr/lib/sendmail
+#ifndef XDGEMAIL
+#define XDGEMAIL /usr/bin/xdg-email
 #endif
 
 #define BUFFER_SIZE 256
@@ -114,10 +114,6 @@ static const guint8 mail_icon[] =
 typedef struct
 {
   gchar filename[BUFFER_SIZE];
-  gchar receipt[BUFFER_SIZE];
-  gchar from[BUFFER_SIZE];
-  gchar subject[BUFFER_SIZE];
-  gchar comment[BUFFER_SIZE];
 } m_info;
 
 
@@ -128,26 +124,11 @@ static void   run  (const gchar  *name,
 gint *nreturn_vals,
 GimpParam   **return_vals);
 
-static GimpPDBStatusType  save_image   (const gchar  *filename,
+static GimpPDBStatusType  save_image   (gchar 		 *filename,
 gint32image_ID,
 gint32drawable_ID,
 gint32run_mode);
 
-static gboolean   save_dialog  (void);
-static void   mail_entry_callback  (GtkWidget*widget,
-gchar*data);
-static void   mesg_body_callback   (GtkTextBuffer*buffer,
-gpointer  data);
-
-static gboolean   valid_file   (const gchar  *filename);
-static void   create_headers   (FILE *mailpipe);
-static gchar* find_extension   (const gchar  *filename);
-static gboolean   to64 (const gchar  *filename,
-FILE *outfile,
-GError  **error);
-static FILE * sendmail_pipe(gchar   **cmd,
-GPid *pid);
-
 
 const GimpPlugInInfo PLUG_IN_INFO =
 {
@@ -159,11 +140,9 @@ const GimpPlugInInfo PLUG_IN_INFO =
 
 static m_info mail_info =
 {
-  , , , , 
+  
 };
 
-static gchar *mesg_body = NULL;
-
 
 MAIN ()
 
@@ -176,16 +155,11 @@ query (void)
 { GIMP_PDB_IMAGE,image, Input image },
 { GIMP_PDB_DRAWABLE, drawable,  Drawable to save },
 { GIMP_PDB_STRING,   filename,  The name of the file to save the image in },
-{ GIMP_PDB_STRING,   to-address,The email address to send to },
-{ GIMP_PDB_STRING,   from-address,  The email address for the From: field },
-{ GIMP_PDB_STRING,   subject,   The subject },
-{ GIMP_PDB_STRING,   comment,   The Comment },
-{ GIMP_PDB_INT32,encapsulation, ignored }
   };
 
   gimp_install_procedure (PLUG_IN_PROC,
   N_(Send the image by email),
-  You need to have sendmail installed,
+  You need to have xdg-utils installed,
   Adrian Likins, Reagan Blundell,
   Adrian Likins, Reagan Blundell, Daniel Risacher,