Gtkdialog Development

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#406 Post by thunor »

vovchik wrote:Dear thunor,

Would it be possible to add the following:

Code: Select all

gtk_window_set_icon_from_file(long,char*,void*)
to the window code so as to allow for user-defined pixmaps as window/taskbar icons? I have used that gtk call in progs in C and Bacon myself, so I know it is a cinch. All that is needed, apart from the imported function, is an appropriate tag_attr, which, along side the existing icon-name="gtk-xxxx" could be something like pixmap="path to img". Any thoughts?

With kind regards,
vovchik
I've created a feature request for it :)

Regards,
Thunor

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#407 Post by Argolance »

Hello Thunor,
This is what I noticed while testing/working with latest scripts given as examples 'v/hscale_advanced' from svn repository.

Wary 5.2.2 - gtk 2 24 8 - gtkdialog version 0.8.0 (C) 2003-2007 Laszlo Pere, 2011 Thunor. Could not compile gtkdialog version 0.8.1 from svn repository.
Console:
/usr/include/gtk-2.0/gtk/gtkinputdialog.h:64: error: duplicate member 'GSEAL'
/usr/include/gtk-2.0/gtk/gtkinputdialog.h:65: error: duplicate member 'GSEAL'
/usr/include/gtk-2.0/gtk/gtkinputdialog.h:65: error: duplicate member '({anonymous})'
/usr/include/gtk-2.0/gtk/gtkinputdialog.h:67: error: duplicate member 'GSEAL'
/usr/include/gtk-2.0/gtk/gtkinputdialog.h:67: error: duplicate member '({anonymous})'
/usr/include/gtk-2.0/gtk/gtkinputdialog.h:67: error: duplicate member '({anonymous})'
/usr/include/gtk-2.0/gtk/gtkinputdialog.h:68: error: duplicate member 'GSEAL'
/usr/include/gtk-2.0/gtk/gtkinputdialog.h:68: error: duplicate member '({anonymous})'
/usr/include/gtk-2.0/gtk/gtkinputdialog.h:68: error: duplicate member '({anonymous})'
/usr/include/gtk-2.0/gtk/gtkinputdialog.h:68: error: duplicate member '({anonymous})'
make[3]: *** [gtkdialog.o] Error 1
make[3]: Leaving directory `/root/gtkdialog/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/root/gtkdialog/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/gtkdialog'
make: *** [all] Error 2
  • - Floating point value=point (example: 0.20) works with en locale, doesn't work when=comma (example: 0,20)
    - Floating point value=point (example: 0.20) doesn't work with es, de, es locales, works when=comma (example: 0,20)
Just for info (... looking at what you explained about my previous-solved problem, I well understand that this is 'normal'l) :)
Puppy 431 - gtk 2 14 7 - gtkdialog version 0.8.1 (C) 2003-2007 Laszlo Pere, 2011 Thunor (self compiled from svn repository: november 21)
  • - Floating point value=point (example: 0.20) doesn't work with en, es, de, fr locales.
Console:
(gtkdialog:26888): Gtk-CRITICAL **: IA__gtk_hscale_new_with_range: assertion `step != 0.0' failed

(gtkdialog:26888): Gtk-CRITICAL **: IA__gtk_range_set_value: assertion `GTK_IS_RANGE (range)' failed
**
ERROR:variables.c:113:variables_new_with_widget: assertion failed: (widget != NULL)
/root/gtkdialog/examples/hscale/hscale_advanced_point: line 103: 26888 Aborted
$GTKDIALOG --program=MAIN_DIALOG
Script completed hit RETURN to close window.
  • - Floating point value=comma (example: 0,20) works with en, es, de, fr locales.
I am tearing my hair!
Any idea?

Regards.

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#408 Post by thunor »

Argolance wrote:I am tearing my hair!
Any idea?

Regards.
Hi Argolance

I'm overloaded with things to do in my life. It looks like your GTK+ headers need looking at so you should focus your attention on that. "GSEAL" is not in Gtkdialog anywhere.

Just give me a very simple Gtkdialog example of what you want to do in your native locale and if it errors then show me the output.

Cheers,
Thunor

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#409 Post by Argolance »

Hello thunor,
I'm overloaded with things to do in my life.
I read that somewhere on a thread... Sorry to stole a bit of your precious time. Good luck and success for what you are doing and thank you very much for your kind attention...

While running the script below with Wary 5.2.2 - gtk 2 24 8 - gtkdialog version 0.8.0 (C) 2003-2007 Laszlo Pere, 2011 Thunor. Fresh install out of the box (live cd + save.3fs file)

Code: Select all

#!/bin/sh

GTKDIALOG=gtkdialog

export MAIN_DIALOG="
<window title=\" HScale comma test \" resizable=\"false\">
	<vbox>
			<frame hscale widget>
				<hscale value-pos=\"0\" space-expand=\"true\" space-fill=\"true\" width-request=\"200\" height-request=\"20\" range-min=\"0,0\" range-max=\"30,0\" range-step=\"0,1\" range-value=\"15,0\">
				<variable>VARIABLE</variable>
				</hscale>
			</frame>
		<hbox homogeneous=\"true\">
			<button ok></button>
		</hbox>
	</vbox>
	<action signal=\"hide\">exit:Exit</action> 
</window>
"

case $1 in
	-d | --dump) echo "$MAIN_DIALOG" ;;
	*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac
  • - Floating value=point (example: 0.1) works when Puppy is configured for en locales countries (en_US, en_GB...), doesn't work when floating value=comma (example: 0,1... see error message above in my previous post)
    - Floating value=point (example: 0.1) doesn't work when Puppy is configured for locales fr, es, de, es (fr_CA, es_ES... see error message above in my previous post), works when floating value=comma (example: 0,1)
And vice-versa with this same script where points (.) are replaced with commas (,): (example: 0,1)

Code: Select all

#!/bin/sh

GTKDIALOG=gtkdialog

export MAIN_DIALOG="
<window title=\" HScale point test \" resizable=\"false\">
	<vbox>
			<frame hscale widget>
				<hscale value-pos=\"0\" space-expand=\"true\" space-fill=\"true\" width-request=\"200\" height-request=\"20\" range-min=\"0.0\" range-max=\"30.0\" range-step=\"0.1\" range-value=\"15,0\">
				<variable>VARIABLE</variable>
				</hscale>
			</frame>
		<hbox homogeneous=\"true\">
			<button ok></button>
		</hbox>
	</vbox>
	<action signal=\"hide\">exit:Exit</action> 
</window>
"

case $1 in
	-d | --dump) echo "$MAIN_DIALOG" ;;
	*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac
More: Could not compile gtkdialog version 0.8.1 from svn repository, devx_wary_5.2.2.sfs installed.: See error message in my previous post.

Hope this is clear!

Best regards.

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#410 Post by thunor »

I asked Francois to test it on his Ubuntu computer.

I then thought why don't I change my lupu-520 system to French so I did that and it worked fine.

So, can you compile gtkdialog-0.8.0 on your computer? Download the source package and try it. All I've done between 0.8.0 and 0.8.1 is to remove a dodgy strlen() call from the XML-from-envar loading routine and update some examples. Nothing else.
Attachments
argolance-hscale-comma-issue.png
HScale works in French using comma delimiters on lupu-520
(35.2 KiB) Downloaded 1513 times

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#411 Post by Argolance »

Hello,
HScale works in French using comma delimiters on lupu-520
... Yes, and with Wary too! Here is not the problem I tried to explain above. This script using comma doesn't work in English (setup country locale en_US for example)... unless replacing commas to points.
Inversly, HScale using point delimiters works fine in English but not in French (setup country locale fr_FR). The same in es, de, etc...
I then thought why don't I change my lupu-520 system to French so I did that and it worked fine.
But did you simply try this "comma" script with English en_* locale?

I have got this problem with too different PCs running Wary 5.2.2... and pemasu, who tested my scripts (using the same hscale code!) encountered this issue to!

Best regards

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#412 Post by thunor »

I got a reply from Francois:
For me your code are ok
extract of my export cmd:
declare -x LANG="fr_FR.UTF-8"
declare -x LANGUAGE="fr_FR:en"

tested on Ubuntu 11.04 32bits
and gtkdialog version 0.8.0 (C) 2003-2007 Laszlo Pere, 2011 Thunor
I think that you should get another French user with the same distribution as you to test your example. Also try another locale that uses commas. I'm guessing that your GTK+ is unwell and it might be a good idea to post this problem in a wary 5.2.2 thread, perhaps this one.

Good luck,
Thunor
Attachments
hscale.gif
(61.4 KiB) Downloaded 1452 times

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#413 Post by thunor »

Ok sorry, I misunderstood what you are explaining.

I see now. It shouldn't matter if it's written with decimal points or decimal commas, it should just work across any locales without modification.

I need to do some tests on the Gtkdialog code.

I'll have a look tomorrow.

Regards,
Thunor

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#414 Post by Argolance »

Hello,
Thank you! Great animated gif!
and it might be a good idea to post this problem in a wary 5.2.2 thread, perhaps this one.
This is what I did at the same time I sent my previous post in this one...

It's time for me to go to bed now... :wink:

Regards

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#415 Post by Argolance »

Hello,
I discovered your latest post after sending mine!
Ok sorry, I misunderstood what you are explaining.
I guess my explanations were probably not very clear: I sincerely tried though! Sorry! Pleased that you finally understood what is the issue.

"See" you soon!

Regards.

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#416 Post by thunor »

I just had to have a look :D

I understand now what I need to do: The C functions cannot be expected to extract doubles from strings that could contain either separators in any locale. The string needs to match the locale. Therefore if you want portable Gtkdialog pseudo-XML then I'm going to have to convert the separators within the strings to match the locale! Blimey...

Bed time (and think time)...

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#417 Post by Argolance »

Hello,
@ thunor
Did you sleep with one eye opened or like a log?
I understand now what I need to do
:D
For a long time, I noticed something else which has perhaps (in)directly something to do with the issue related above and concerning the latest release of JWM. In my xerrs.log, I am always getting these errors lines:
JWM: warning: invalid tray opacity: 0.8
JWM: warning: invalid menu opacity: 0.8
Tray and menu opacity did not work properly anymore!

:wink: Bed time (and think time)... I then thought why don't I replace points of the opacity values with commas in the /root/.jwm/jwmrc-theme?
So I did that.
And it worked fine! :D :D

Code: Select all

. <TrayStyle>

	<Background>#777777</Background>

	<Opacity>0,5</Opacity>

</TrayStyle>
Regards!

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#418 Post by thunor »

I've had a good think about this now.

The problem is that the C functions such as atof() and strtod() will be expecting the correct decimal separator for the user's locale, but the application will have been written using any locale which is unknown.

There are two ways I can currently think of to deal with this:

1. Pass the XML's locale as an option to gtkdialog on the command-line e.g. gtkdialog --source-locale=fr_FR -p MAIN_DIALOG. I've identified about 16 places within Gtkdialog's C code that will require modification for this, and I'll also need to add the code to support the "--source-locale" option. Is there a problem with this method? Well, there are a multitude of LC_* variables affecting localisation and I'm not realistically going to be able to support all those on the command-line. Also this doesn't deal with what the application developer is doing outside of Gtkdialog i.e. reading and writing files with decimal separators or using commands that output decimal separators.

2. Deal with this in the application script. The application developer reads LC_NUMERIC, LC_ALL and/or LANG and then decides which decimal separator to use within the script. So instead of hardcoding "0,1" in your XML you would instead set DS="," and then use "0${DS}1". If you the developer are reading and writing files and using commands that include decimal separators then you should be writing your application to deal with the user's locale.

Now, you might expect me to prefer method 2 as then I don't have to do any work :P But if you think about it, the XML/script and the developer's brain must operate in the user's locale, not expect the user's C library, executables and shell to be adjusted to deal with your script.

Let me know what you think or infact anyone who has an opinion on the matter.

Regards,
Thunor

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#419 Post by thunor »

Hi Argolance

I think we're posting at the same time again :) I've only just noticed that you posted before me.

I like to have a problem to sleep on. My head hits the pillow, I think how I'm going to solve the problem, I find a solution, and then I'm asleep :P

So then, using your opacity issue as an example, if the value within jwmrc-theme was modified using the wrong decimal separator by some Gtkdialog application then the application developer should make sure that he is using the correct decimal separator for the user's locale.

[EDIT] Since Puppy Linux is built so much from Gtkdialog apps, I'm sure that other folk have already trodden this path. It might be new for us to think about but I'm certain somebody has already dealt with this before.

Regards,
Thunor

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#420 Post by thunor »

This is how you could approach it:

Code: Select all

#!/bin/sh 

GTKDIALOG=gtkdialog 

funcDecimalMarkGet() {
	local language

	## LC_ALL takes precedence over LC_NUMERIC
	## and if both are null then use LANG.
	language=$LC_ALL
	if [ -z "$language" ]; then language=$LC_NUMERIC; fi
	if [ -z "$language" ]; then language=$LANG; fi

	## language[_territory][.codeset][@modifier]
	language=${language%@*}
	language=${language%.*}
	language=${language%_*}
	language=`echo $language | tr A-Z a-z`

	## This'll do for a start.
	case "$language" in
		en | jp | cn ) echo '.' ;;
		*) echo ',' ;;
	esac
}

DM=`funcDecimalMarkGet`

MAIN_DIALOG='
<window title="Decimal Mark Test" resizable="true"> 
	<vbox> 
		<frame hscale widget>
			<hscale space-expand="true" space-fill="true"
				width-request="200" height-request="20"
				value-pos="0"
				range-min="0'$DM'3" range-max="30'$DM'7"
				range-step="0'$DM'1" range-value="15'$DM'5">
				<variable>HSCALE</variable>
			</hscale>
		</frame> 
		<hbox homogeneous="true">
			<button ok></button>
		</hbox>
	</vbox>
	<action signal="hide">exit:Exit</action>
</window>
'

export DM
export MAIN_DIALOG

$GTKDIALOG --program=MAIN_DIALOG
Regards,
Thunor
Last edited by thunor on Wed 30 Nov 2011, 22:49, edited 1 time in total.

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#421 Post by Argolance »

Hello thunor!
Had to leave home (far from my Toutou/Puppy, I am running Windows 7! :evil: ), so sorry for replying so late!
Well...
Thanks for brain storming and code lines I will test when I am back on Saturday...
I guess I didn't mind it would be so complicate. I am wondering why this doesn't happen while running Puppy 431, running gtk 2 14 7 and gtkdialog version 0.8.1 (C) 2003-2007 Laszlo Pere, 2011 Thunor (self compiled from svn repository: november 21)
As reported above, when delimiter=comma inside the script, all seems working fine with any locale. Tested with en, es, de, fr locales. (Delemiter=point doesn't work with en, es, de, fr locales).

Strange thing indeed!

Best regards.

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#422 Post by Argolance »

Hello Thunor,
Back home I tried code lines given above and as expected, this seems working perfectly, as well running Puppy/Toutou 4.31 as Wary 5.2.2 with any locales: great! :D
[EDIT on 2011/12/08]... unfortunately not with any locales as said above! :oops:
I am trying to go further!
Thank you so much!
Cordialement.
Last edited by Argolance on Thu 08 Dec 2011, 11:54, edited 1 time in total.

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#423 Post by Geoffrey »

I was wondering if it is at all possible to give "fileselect" an option so it is able to select both files and directories and still have the ability to create a newfolder.

I have noticed if "fs-folder="/" is omitted that if fs-action="file" is used that a folder can be selected if it is highlighted and OK is selected, if the folder is double clicked it functions as it should.

Code: Select all

export TEST='	
<window width-request="300" title="This should only select files" resizable="false" decorated="true">
<vbox>
   <hbox>
	<entry fs-action="file" 
		  fs-title="Select a file ">
	<variable>TEST</variable>
	</entry>
	<button>
		<input file stock="gtk-open"></input>
		<action>fileselect:TEST</action>
	</button>
   </hbox>
</vbox>			
</window>'
gtkdialog --program=TEST
Geoffrey

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#424 Post by thunor »

@argolance: You're welcome.

Hi Geoffrey
Geoffrey wrote:I was wondering if it is at all possible to give "fileselect" an option so it is able to select both files and directories and still have the ability to create a newfolder.
Unfortunately no. These are the actions and I've offered them all: http://developer.gnome.org/gtk/2.24/Gtk ... oserAction
Geoffrey wrote:I have noticed if "fs-folder="/" is omitted that if fs-action="file" is used that a folder can be selected if it is highlighted and OK is selected, if the folder is double clicked it functions as it should.
I can't work out what you are saying there. Because fs-action="file", having a folder selected in the list and pressing OK (or double-clicking it) will open the folder which is how it should work. For me there's no difference between the two methods and I have to either select a file and press OK or press Cancel for the dialog to close. I can't select a folder, press OK and have the dialog close.

Regards,
Thunor

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#425 Post by vovchik »

Deat thunor,

Playmusic is a very little app. I am glad you are having fun playing with your own foster child (gtkdialog) and am waiting to see your gtkdialog game!

With kind regards,
vovchik

Post Reply