Learning GtkDialog (hopefully) -- and I have questions...

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
starhawk
Posts: 4906
Joined: Mon 22 Nov 2010, 06:04
Location: Everybody knows this is nowhere...

#16 Post by starhawk »

OK, RSH, I looked at your script example for GtkDialog... interesting. I get most of how it works, and I think I can put together an app-gathering shell script based on it... I'll bang it out and post the script up for debugging (which I'm sure it'll need plenty of ;) ).

starhawk
Posts: 4906
Joined: Mon 22 Nov 2010, 06:04
Location: Everybody knows this is nowhere...

#17 Post by starhawk »

OK, prototype script attached... let me know what I did wrong :P
Attachments
launcher-refresh.sh.gz
fake *.gz -- remove extension; do not use gunzip...
(7.34 KiB) Downloaded 183 times

starhawk
Posts: 4906
Joined: Mon 22 Nov 2010, 06:04
Location: Everybody knows this is nowhere...

#18 Post by starhawk »

RSH, have you had a chance to look at my script?

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

Program Launcher

#19 Post by seaside »

starhawk,

Technosaurus made a quick parsing utility for Desktop files which I've modified and added an icon finder that you may wish to use. The rest of the program categories could be added for each notebook.

Code: Select all

#!/bin/sh
# Program Launcher

iconfind() {
[ -f /usr/local/lib/X11/mini-icons/$ICON ] && ICON=/usr/local/lib/X11/mini-icons/$ICON 
[ -f /usr/local/lib/X11/pixmaps/$ICON ] && ICON=usr/local/lib/X11/pixmaps/$ICON 
[ -f /usr/share/pixmaps/$ICON ] && ICON=/usr/share/pixmaps/$ICON 
[ -f /usr/local/share/pixmaps/$ICON ] && ICON=/usr/local/share/pixmaps/$ICON 
#ICON=`find /usr -name "$ICON"  -print -quit` 
echo $ICON #exit
}
export -f iconfind


for DESKTOP_FILE in /usr/share/applications/*.desktop ; do
	ICON="" CATS="" NAME="" EXEC="" LINE="" #prevent carryover from previous file
	while read LINE || [ "$LINE" ]; do
		case $LINE in
			Name=*) NAME="${LINE#*=}"'' ;; 
			Icon=*) ICON="${LINE#*=}"'' 
			 [[ ! "$ICON" == */* ]]  &&  iconfind ;;
			Categories=*) CATS="${LINE#*=}"'' ;;
			Exec=*) EXEC="${LINE#*=}"'' ;;
		esac
	done < $DESKTOP_FILE
	
		case "$CATS" in
			FileManager|X-FilesystemMount|X-FilesystemFind|X-FilesystemUtility)	APPLIST_FILESYSTEM="$APPLIST_FILESYSTEM<button><label>$NAME</label><input file>$ICON</input><action>$EXEC</action></button>" ;;
			X-Graphic-paint|RasterGraphics|X-Graphic-draw|VectorGraphics|X-Graphic-flow|Chart|Flowchart|Presentation|X-Graphic-viewer|X-Graphic-camera|Photography|X-Graphic-scanner|Scanning|OCR|X-Graphic-print|X-Graphic-utility|X-GraphicUtility) APPLIST_GRAPHICS="$APPLIST_GRAPHICS<button><label>$NAME</label><input file>$ICON</input><action>$EXEC</action></button>" ;;
		esac
	
done


export LAUNCHER='
<window title="Program Launcher">
<vbox>
   <notebook labels="Filesystem|Graphic">
      <frame>
      <text use-markup="true"><label>"<b>Filesystem</b>"</label></text>
      '"$APPLIST_FILESYSTEM"'
      </frame>
      <frame>
       <text use-markup="true"><label>"<b>Graphic</b>"</label></text>
      '"$APPLIST_GRAPHICS"'
      </frame>
   </notebook>
   <hbox homogeneous="true">
   <button cancel></button>
   </hbox>
</vbox>
</window>'
gtkdialog -p LAUNCHER 
Probably needs work to get the icons lined up nicely.

Cheers,
s

starhawk
Posts: 4906
Joined: Mon 22 Nov 2010, 06:04
Location: Everybody knows this is nowhere...

#20 Post by starhawk »

seaside, that's interesting -- I like the Icon Finder part -- but I'm afraid I don't think it'll work for me. I want the GtkNotebook to update whenever someone runs a "fixmenus" style script -- such as the one attached to my last post. The script you posted doesn't allow for that :(

Can someone PLEASE look at my script and tell me if there are any bugs?

User avatar
Bert
Posts: 1103
Joined: Fri 30 Jun 2006, 20:09

#21 Post by Bert »

Hi Starhawk,

Is the script already supposed to run?
I tried it in Quirky Tahr, but it refuses to start up.
Looked briefly at your code and could not find the reason.
Could be me though, not seeing the obvious :)

Anyway, great start of what looked like a crazy endeavor at first!
[url=http://pupsearch.weebly.com/][img]http://pupsearch.weebly.com/uploads/7/4/6/4/7464374/125791.gif[/img][/url]
[url=https://startpage.com/do/search?q=host%3Awww.murga-linux.com%2F][img]http://i.imgur.com/XJ9Tqc7.png[/img][/url]

starhawk
Posts: 4906
Joined: Mon 22 Nov 2010, 06:04
Location: Everybody knows this is nowhere...

#22 Post by starhawk »

Bert -- not sure why it didn't work* -- it /should/ run -- obviously it needs debugging!

Can you see anything in the code that would either (a) not work as needed or (b) not work at all? The idea is that it reads through the pile of *.desktop files at /usr/share/applications and compiles a list, which it then categorizes and dumps into a set of text files. (The text files are later read by the Launcher app, which should be fun...)

*I have a hunch, actually. I wrote it in pristine Slacko 56 -- meaning boot from RAM, with work saved to a flash drive, lol -- so maybe Quirky has a different GtkDialog version?

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#23 Post by sc0ttman »

starhawk wrote:Bert -- not sure why it didn't work* -- it /should/ run -- obviously it needs debugging!

Can you see anything in the code that would either (a) not work as needed or (b) not work at all? The idea is that it reads through the pile of *.desktop files at /usr/share/applications and compiles a list, which it then categorizes and dumps into a set of text files. (The text files are later read by the Launcher app, which should be fun...)

*I have a hunch, actually. I wrote it in pristine Slacko 56 -- meaning boot from RAM, with work saved to a flash drive, lol -- so maybe Quirky has a different GtkDialog version?
In your script, you probably need to change

if [ `$i".desktop" |

to

if [ `cat $i".desktop" |
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

#24 Post by L18L »

starhawk wrote:Bert -- not sure why it didn't work* -- it /should/ run --
You can see it running if you launch it from console. :wink:

Code: Select all

# ./laun*
Rebuilding SmallScreen Launcher application-list files...
./launcher-refresh.sh: line 51: Abiword-wordprocessor.desktop: command not found
./launcher-refresh.sh: line 51: ALSA-sound-Wizard.desktop: command not found
./launcher-refresh.sh: line 51: Bcrypt-file-encryption.desktop: command not found
./launcher-refresh.sh: line 51: BootFlash-usb-installer.desktop: command not fou...................

Code: Select all

# egrep --help | grep egrep
Usage: egrep [OPTION]... PATTERN [FILE]...
Example: egrep -i 'hello world' menu.h main.c
Invocation as 'egrep' is deprecated; use 'grep -E' instead.
#
hope that helps.

starhawk
Posts: 4906
Joined: Mon 22 Nov 2010, 06:04
Location: Everybody knows this is nowhere...

#25 Post by starhawk »

Thanks both of you! I'll change those.

Post Reply