gtkdialog1-1.4

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#141 Post by goingnuts »

disciple wrote: Please provide it. Thanks
...
What if someone comes along in future who wants it, but you're not around anymore? Your effort would have been wasted, as someone else would need to redo it.
...
Is a patch OK?

The mcb is more a technique and it is described other places in this forum - but as it involves some specific new code for every binary you apply it too - I guess you are right - and I do see your point
Attachments
cdtool-2.1.8.mcb.tar.gz
modified source
(116.66 KiB) Downloaded 493 times
cdtool-2.1.8_mcb_patch.txt.gz
fake .gz-file - just rename to cdtool-2.1.8_mcb_patch.txt
run "patch -p0<cdtool-2.1.8_mcb_patch.txt"
run "./configure"
run ./build_mcb.sh"
(7.33 KiB) Downloaded 512 times

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#142 Post by disciple »

Yes, thanks, I generally prefer patches.

Actually, I think I wasn't 100% correct when I said you need to post the source with the binary. You need to either post the source or a written offer to provide the source to anyone who has the binary. (I also saw someone say that the source needs to be distributed with the binary, but not necessarily by you, and that if you provided a link to the original source that would suffice, along with patches for any changes. I'm not sure how true this is.)
Anyway, I think technically we should be distributing source with every .pet, in which case the GPL compliance around here is terrible. Providing patches should make most people happy though.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#143 Post by goingnuts »

disciple: Thanks for info!

Attached another demo: gtkman
Find man pages present on your system and text-format them for view in edit-widget. Need original man - busybox man will not work - so static build of man-1.6e also included.
Attachments
gtkman-0.1.pet
gtkdialog1 front end for man pages -
static build of man included
(26.91 KiB) Downloaded 537 times

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#144 Post by technosaurus »

Here is a static build with my musl toolkit (all pixbuff loaders are working except tiff ,... but only because it is kindof irrelevant here), I modified stringman.c to speed up the file search - you can now just export GTKDIALOG_PIXMAP_DIR and it will look there.

Code: Select all

char *find_pixmap(char *filename)
{
	char tmp[128];
	static char *line = NULL;
	static uint length = 0;
	FILE *locate;

	if (access(filename, R_OK) == 0)
		return filename;

	//snprintf(tmp, 127, "/usr/share/icons/Bluecurve/16x16/stock/%s",
	snprintf(tmp, 127, "/usr/share/pixmaps/%s", filename);
	tmp[127] = '\0';
	if (access(tmp, R_OK) == 0)
		return strdup(tmp);

	snprintf(tmp, 127, "/usr/share/mini-icons/%s", filename);
	tmp[127] = '\0';
	if (access(tmp, R_OK) == 0)
		return strdup(tmp);


	snprintf(tmp, 127, "%s/%s",getenv("GTKDIALOG_PIXMAP_DIR"), filename);
	tmp[127] = '\0';
	if (access(tmp, R_OK) == 0)
		return strdup(tmp);

	return 0;
}
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#145 Post by goingnuts »

Thanks for the patch for the find_pixmap!
Did you use the last source of gtkdialog1 (GtkDialog1-1.1)? Your binary has some problems with setting the wmclass I think - app name wont show in window title which make the app crash if you move mouse over jwm buttonbar. Might just be my jwm that has the problem - its P412 std jwm.
The button images also seems odd - no right margin.
Below same script running with your bin left and mine right.
A second thought: I think the wmclass is gdk/gtk/tinyX11 related. I think I made a hack for it - try look into my gdk/gtk-sources and search for wmclass...
Attachments
snap0004.png
(94.96 KiB) Downloaded 718 times

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#146 Post by technosaurus »

It was probably just a badly patched toolchain - I left out some extra utf8 stuff from tinyX11 and probably hacked something to make it compile. (I lost patience after fixing most of the compile errors and warnings in gdk, so the gtk side just got quick, hacky patches)
Btw, you can make the static gdk_pixbuf easier to work with by doing:

Code: Select all

ar x *.a (on the loaders)
and then adding those objects to libgdk_pixbuf.a with

Code: Select all

ar cru libgdk_pixbuf.a *.o
Side note: the gdk-pixbuf stuff reminded me that rox-1.2.2 can use imlib if available, it should work pretty similar. (the vfs stuff was interesting too)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#147 Post by amigo »

Techonosaurus, "rox-1.2.2 can use imlib if available" The older rox-1.0.0 used only imlib, but I didn't even know that 1.2.2 could use it. It may speed up loading of desktop icons and/or improve their rendering. Have you noticed either of these?

"the vfs stuff was interesting too" -Did you get this working? I always wanted it but couldn't get it to work.

About your patch to find_pixmap, There is a note in the TODO file about this function. What we really need there is to be using the users' chosen theme, if available. We now have gtkrc file being read, so 'themedir' gets set(hopefully).
The original code:

Code: Select all

snprintf(tmp, 127, "/usr/share/icons/Bluecurve/16x16/stock/%s",
should be getting 'themedir' from the rc file and subsituting that name for the original 'Bluecurve'.

I think it's okay to be able to set the environmental variable GTKDIALOG_PIXMAP_DIR and use that first if set. But, next it should try to use the themedir from the rc file. We now can specify the rcfile on the command-line, so that should be the second choice. Otherwise, the users' default ~/.gtkrc should be read. If themedir has still not been set, then it should look under /usr/share/pixmaps or /usr/share/mini-icons. Common practice would have only *.xpm images under /usr/share/pixmaps and only *.png (or *.svg) under /usr/share/mini-icons.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#148 Post by technosaurus »

@amigo - imlib and gdkpixbuf are much better suited to a shared library toolchain, so I have been trying to avoid them lately while playing with my static musl toolchain. However the way the modules work reduces the memory footprint significantly in a traditional shared library system (on par with the static builds) if you want to support multiple image types. ...btw before I forget ...
@goingnuts - do you still have the pre-gdk_pixbuf sources for gtkdialog 1?
Re: VFS in ROX-Filer, I did get it to work in the 2.X series - never tried it in 1.X IIRC it needed fuse, libavfs and lib{x,t}ar and was missing support for a widely used format (don't remember which)
Re:Themedir: I _think_ glade does that too ... I will check, it may be a simple cut/paste job.

Edit:... the gtkrc stuff seemed straight forward in the tutorial, but I didn't see anything in glade1 (glade2 may be backportable, but now I'm not sure where I saw gtkrc code)
http://www.gtk.org/tutorial1.2/gtk_tut-21.html#ss21.3
Edit2: AVFS-1.0.1 was released with xz support = good time to try a rox rebuild
Last edited by technosaurus on Wed 13 Jun 2012, 16:32, edited 1 time in total.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#149 Post by goingnuts »

technosaurus: don't know if this is what you need?
Attachments
gtkdlg1_source_020212.tar.gz
pre -gdkpixbuf gtkdialog 0.5.8.11 source
(157.61 KiB) Downloaded 492 times

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

swallow

#150 Post by goingnuts »

Coming back to the gtk-swallow-widget - present source below. Needs window ID of the window to swallow passed as argument - at the moment found by using xwininfo. Attached image of static mplayer (diet build found here) playing 2001-A_Space_Odyssey.avi and swallowed by the gtk-app.
Main problem now is to have the swallow-widget to launch the program you want to swallow and swallow it. Code below mainly produced by technosaurus:

Code: Select all

#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <stdio.h>

void destroy(GtkWidget *widget, gpointer data){ gtk_main_quit (); }   

int main (int argc, char *argv[]) {
   int wid;   char command[255];
   ///below takes passed windowID from argument ex. 0x400063
   sprintf(command,"echo %s", argv[1]);
   fscanf(popen(command, "r"),"%x",&wid);
   g_print ("The window ID is %i\n", wid);
  
   gtk_init (&argc, &argv);
/// Create a new window
   GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(destroy), NULL);
/// Create main container
   GtkWidget* vbox1 = gtk_vbox_new(FALSE, 0);
   gtk_container_add(GTK_CONTAINER(window), vbox1);
   //below just some playing around
    GtkWidget* toolbar;
    GtkWidget* icon;
    GtkWidget* button;
    
    toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL,GTK_TOOLBAR_BOTH);
    gtk_box_pack_start(GTK_BOX(vbox1), toolbar, FALSE, FALSE, 0);
    gtk_widget_show(toolbar);
 
/// Create socket
   GtkWidget* gtk_socket = gtk_socket_new ();       
   gtk_widget_set_usize (gtk_socket, 400, 400);       
/// Pack socket in vbox container
   gtk_box_pack_start(GTK_BOX(vbox1), GTK_WIDGET(gtk_socket), TRUE, TRUE, 0);      
   gtk_widget_realize (gtk_socket);
   
   gtk_socket_steal (GTK_SOCKET (gtk_socket), wid);
/// Show the window and all widgets now that everything is ready
   gtk_widget_show_all(window);
   gtk_main ();       
   return 0;       
}
Attachments
snap0007.png
(161.44 KiB) Downloaded 591 times

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#151 Post by goingnuts »

Another demo: gtkmplayer - very simple frontend for mplayer.
Contains also code for some more advanced functions (select audio and video driver + set audio speed) - change flag in gtkmplayer source to view.
Using "mplayer -slave" and fifo /tmp/mplayer-control to pass commands from gtk-frontend to mplayer.
Attachments
gtkmplayer-0.1.pet
demo for gtkdialog1 - simple frontend for mplayer
(11.59 KiB) Downloaded 697 times

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#152 Post by goingnuts »

Yet another demo - backport/hack of SNS - Simple Network Setup - to use Gtkdialog1. Based on SNS from Puplite 5.0 kindly supplied by starhawk.
Attached pet is the first try and may not work and be buggy.
A bunch of helping progs attached as well, everything put in /bin to give preference for these applications and ease removal...
You will need Gtkdialog1 - get it in the first post.
Attachments
snap0008.png
(19.95 KiB) Downloaded 1402 times

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

Re: Backport gtkdialog 0.59.8 to use gtk1/gtk2: gtkdialog1-1.0

#153 Post by technosaurus »

goingnuts wrote:TODOS:
* <text> accept <input>command
* quotes in <action>command
* combobox <default>, accept <action append> and fill with command
* checkboxes: set value from variable/script[/url][/url]
* revise help text for --geometry
just checking on the TODOS
* quotes in <action>command
g_strescape(); ?
* revise help text for --geometry
from wary's gtkdialogX
Usage:
gtkdialog [OPTION...]
Create dialog boxes and windows according to the given dialog description.For more information try 'info gtkdialog'.

Help Options:
-h, --help Show help options
--help-all Show all help options
--help-gtk Show GTK+ Options

GTK+ Options
--class=CLASS Program class as used by the window manager
--name=NAME Program name as used by the window manager
--screen=SCREEN X screen to use
--sync Make X calls synchronous
--gtk-module=MODULES Load additional GTK+ modules
--g-fatal-warnings Make all warnings fatal

Application Options:
-v, --version Print version information and exit.
-d, --debug Debug mode prints the processed characters.
-p, --program=variable Get the GUI description from the environment.
-g, --glade-xml=filename Get the GUI description from this Glade file.
-f, --file=filename Get the GUI description from a regular file.
-i, --include=filename Include the given file when executing.
-e, --event-driven=filename Execute the file as an event driven program.
-s, --stdin Get the GUI description from standard input.
-w, --no-warning Suppress warning messages.
-G, --geometry=[XxY][+W+H] The placement and the size of the window.
-c, --center Center the windows on the screen.
--print-ir Print the internal representation and exit.
--space-expand=state The "expand" state for packing all widgets.
--space-fill=state The "fill" state for packing all widgets.
--display=DISPLAY X display to use
thats the lowest hanging fruit, for the rest I'd have to compare Xdialog (the unpatched gtk1 version) and gtkdialog2-4 (my sdialog program may help too)
another TODO?
SVG capability via librsvg's included gdkpixbuf-loader (its one of the only ones that isn't distributed with gdkpixbuf)
SVG would add a ton of capabilities

also I submitted a patch to gtkdialog-trunk that used some gtk2 builtins for refreshing, that Thunor cleaned up, but I had previously used native inotify (may require a kernel update though ... Edit: nope - inotify was introduce in 2.6.13) if anyone is interested in that.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#154 Post by goingnuts »

Thx for looking at this!
The quotes in <action>command seems to be related to the parser. gtkdialog-0.58.11 accepts

Code: Select all

<action>echo "You pressed the button with the label."</action>
whereas gtkdialog-0.59.8 does not (errors out with "Error in line 6, near token 'quoted string': syntax error").

This might be a nice way to force separation of the gktdialog GUI-code and the shell-code but makes translation of existing scripts somewhat more challenging. Looking into lexer.l and the difference between the two version is still black magic to me...

The

Code: Select all

-g,--geometry                     Set the position and/or size of the
                                   window, [XxY][+W+H].

is wrong for present version as the XxY sets the widthxheight and the +W+H sets position...

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#155 Post by 8-bit »

How compatible is this version of gtkdialog1 with programs written to use gtkdialog that comes with puppy?
I ask because I tried running a few of the examples that come with gtkdialog by first copying them to a temporary directory and then editing them to use gtkdialog1.
I did not find any that worked.
Most had syntax errors.
So will this fork of gtkdialog be compatible with the gtkdialog scripts that permeate puppy?

And is this mod a matter of lessening CPU load?

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#156 Post by goingnuts »

8-bit wrote:How compatible is this version of gtkdialog1 with programs written to use gtkdialog that comes with puppy?
I ask because I tried running a few of the examples that come with gtkdialog by first copying them to a temporary directory and then editing them to use gtkdialog1.
I did not find any that worked.
Most had syntax errors.
So will this fork of gtkdialog be compatible with the gtkdialog scripts that permeate puppy?

And is this mod a matter of lessening CPU load?
Its quite compatible but most scripts needs "fine tuning". A lot of the formating tags are not supported and one of the main issues is the <window> tag which must be converted to a <wtitle></wtitle> tag and no </window> in the end of script...

The strength is that you can compile for both gtk1 & gtk2 and use the same scripts.

Another advantage is that with gtk1 & tinyxlb & uclibc one can compile a static version at reasonable size. So resource demand is quite low and speed is good.

I haven't seen puppy gtk-scripts that worked out of the box but some of them are easy to "port". Using the -d (debug) switch is a great tool to debug when converting scripts to GtkDialog1.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#157 Post by technosaurus »

simple "stocks" stock quote program ported
the un-backslashed quotes was an issue, but I just removed them in my script... seems like g_strescape might fix it or we could just know to backslash them in the script

mostly though just needed to strip most things out of the insides of tags...
stuff like:hover-selection="true", rules_hint="true", tooltip="" ...

remove/replace window tags:
replace '<window title="name">...more tags ...</window>' with:
'<wtitle>name</wtitle>...more tags ...'
Attachments
stocks-0.1.pet
very basic ... could use:
action refresh to update
action launchwindow to change stock symbols
(2.12 KiB) Downloaded 915 times
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#158 Post by goingnuts »

technosaurus: Added your stock port under examples in first post - thx!

I did a quick test to see if the lexer.l rules could be used to filter out the "future" gtkdialog tags. By adding the following rule it seems that the <window some text> and the </window> can be ignored - but not tested intensively. Might work and be applicable with some of the other tags as well:

Code: Select all

 /* remove </window> future tag */
"</window>".* { ; }
 /* remove <window * > future tag */
"<window".*(.|\n).*">" { ; }

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#159 Post by technosaurus »

note: the variables don't get set after action completion, and before the next action

ex.
<action fileselection>FILEINFO</action>
<action>echo $FILEINFO</action>

was working on a mupdf gui when I noticed that it does wait for the 1st action to complete but the variable doesn't get set till some time after

tried refresh and Refresh: action in between but nada - any ideas?

(your mplayer frontend selected a file and then plays with a separate button works fine - but I was hoping to do a 1-step process)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#160 Post by technosaurus »

Posted a frontend for mupdf here:
http://www.murga-linux.com/puppy/viewto ... 689#659689

Its a decent example of how to control windows that use keyboard shortcuts

there is a static mupdf too, but it also needs xdotool which I haven't built statically yet
http://code.google.com/p/semicomplete/
(scottman's vlc-gtk uses xdotool too)

EDIT: also notice that the file selection is limited to 32 character long paths - I think it may be using a *tag_attribute (see stringman.c)
I would recommend [80] at least - gcc stores 0-80 length char[] in the same amount of code
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

Post Reply