Tuesday, October 31, 2006

Patch for Xdialog (Yes! Made in Brasil)

Ok, ok, ok... I know I was in vacations, but the day wasn't very pretty, and I felt like taking a coding time. :D

Some weeks ago I wrote a small plugin for Xfce to configure the network in Kwort Linux; I was going to use Zenity, but then I saw again Xdialog and surprise... GTK2 based interface!

Well... Nowadays a program which keeps being maintained using gtk1 is something very weird. So I decided to use Xdialog. The problem was when I needed an extra button... Dialog provides that feature, but Xdialog didn't and I really needed it.

So I mailed Thierry Godefroy asking him if he didn't had a patch which provides that feature... I guess he was very, very occupied, because he didn't even answered.

When I saw the code the first time some weeks ago I said "This will be hard to understand to implement it by myself", and today when I started to look at the code it wasn't that hard. So some hours latter I understanded the code and started to write some things...

So, this is what this command:
Xdialog --stdout --extra-button --extra-label "Extra Button" --inputbox "Type your input. Hit Extra Button to get 3 as return value" 0 0

will show:

So... Here's the patch, I hope someone finds it useful like me:



Anonymous said...

Hey, a screenshot would be nice :)

Nomius said...

Added :)

Thanks for the screenshot idea Martín :)

Anonymous said...


thanks for your patch, it is working well. I have two comments:
1) You seem to be missing an
include "extra.xpm"
in interface.c
2) In the original dialog, the extra button appears in the middle (e.g. between "OK" and "Cancel"). With your Xdialog patch, the extra button appears on the left. It think it would be nice if the button was in the middle in Xdialog as well, for better compatibility.

Nomius said...

Thanks for your comment. Could you provide a fix to that?
That would be great.
Thanks again for reporting that.