Gtkdialog Development

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

Re: Window Icons

#441 Post by Geoffrey »

seaside wrote:Right now you can only set a gtkdialog's window dialog icon with a "gtk-stock-item" such as this-

Code: Select all

<window title="Example Window" icon-name="gtk-dialog-warning">
It would be really great to provide a customized icon with any pixmap that would show as the window icon as well as minimized in a tray.

Having this feature would give gtkdialog programs a nice professional and polished look.

Cheers,
s
Hi seaside,

You can add your own icon, vovchik and I discussed it a few post back, if you have the icon you wish to use, place it in any of the folders in /usr/share/icons/hicolor/.

System links also work, then run this command in the terminal to refresh the icon cache,

Code: Select all

gtk-update-icon-cache -f -i /usr/share/icons/hicolor
I've since found that petget refreshes the cache when a pet is installed
Example:

Code: Select all

<window title="A GTKDialog" icon-name="games48" resizable="false" decorated="true">
I placed a system link from /usr/local/lib/X11/themes/Ethereal/games48.png to /usr/share/icons/hicolor/48x48/apps, refreshed the cache and this is the result.

Geoffrey
Attachments
shot-1.jpg
icon on the GUI
(5.41 KiB) Downloaded 1368 times
shot-2.jpg
icon on taskbar
(3.5 KiB) Downloaded 1215 times

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

#442 Post by seaside »

Geoffrey,

Just a great find. :idea: :idea: Many, many thanks.

Yes, I see you had this discussion over the holidays and I must have just missed it,

Since installing pets updates the cache, it would seem that (for Puppy at least) including that gtkdialog feature implementation of
gtk_window_set_icon(GTK_WINDOW(window), create_pixbuf("pixname.ext"));
isn't necessary.

Vovchik would have to comment on the merits between the two ways of showing icons, as I have no clue.

Regards,
s
(This should definitely be in the gtkdialog tips and tricks section) :!:

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

#443 Post by vovchik »

Dear seaside,

The advantage of:

Code: Select all

gtk_window_set_icon(GTK_WINDOW(window), create_pixbuf("pixname.ext"));
is that you can use any old pixmap - a special one for instance - that isn't registered in the GTK icon system. But Geoffrey's workaround is also very useful. I think the user-selected window pixmap will be implemented in due course. I also like the idea of a tray item. Yad does that very nicely, and I have done that with an unreleased radio stream player in BaCon. It's also not hard to implement, and it's nice to be able to choose the pixmap.

With kind regards,
vovchik

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#444 Post by RSH »

GtkDialog-Feature? !

I would like to refer to the following.
http://murga-linux.com/puppy/viewtopic. ... 119#596119

My thought would be to create something in the style of <tree "selection_mode="3"> that gives back a tree like shown in the attached image.

Perhaps it could be tree also, but with selection_mode="5" (f.e.). I know, it seems to be easy to "hack" things like that (if you are familiar with bash), but it would be very useful for all non-bash-familiar-users/programmers, to handle this one just as easy as <tree selection_mode="3">

I am very familiar with pascal programming (older version, another OS) and I would surely be able to code stuff like that - if i could use "my" pascal system! Unfortunately, i can't.

As i see the code, you do have already everything to set this up.

Would you please "hack" this out to easy use for all non-bash-familiar-users/programmers?

Thank you!

RSH
Attachments
checkbox-tree.jpg
(66.63 KiB) Downloaded 1145 times
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

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

#445 Post by Argolance »

Hello,
Am I silly? :shock: :D
These are the code lines: 8)

Code: Select all

#!/bin/sh

GTKDIALOG=gtkdialog

export MAIN_DIALOG='
<window title="Example Window" icon-name="gtk-dialog-warning">
  <vbox>
    <frame Question:>
      <text>
        <label>How could I get stock icons ("gtk-dialog-warning" for example) and... others working?</label>
      </text>
    </frame>
    <hbox>
      <button ok></button>
      <button cancel></button>
    </hbox>
  </vbox>
</window>
'

case $1 in
	-d | --dump) echo "$MAIN_DIALOG" ;;
	*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac
Cordialement.
This is what I get! :?
Attachments
gtk_window.png
(9.19 KiB) Downloaded 1117 times

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

#446 Post by technosaurus »

You'll find that and a lot more here:
http://www.murga-linux.com/puppy/viewtopic.php?t=38608
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
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#447 Post by Argolance »

Hello,
Thank you for replying.
I already know this great topic, and learned a lot while looking at zigbert tips!!! But I didn't find the answer to my question. I know how to display my own icon in the window title bar but don't how to display some gtk stock icons like gtk-dialog-info or gtk-dialog-warning for example (which could be useful and used without having to add copies manually to /usr/share/icons/hicolor) though it curiously works quite well with gtk-preferences...

I was wondering if something like icon-stock-name=... would exist?
This was just a question...

Cordialement.
Attachments
gtk_stock_icons_test.png
(8.05 KiB) Downloaded 984 times

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

#448 Post by technosaurus »

It's in zigbert's first post, just search for stock
http://www.murga-linux.com/puppy/viewto ... 035#274035
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
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#449 Post by Argolance »

Hello,
Thank you for your patience.
I red the topic as seriously as I could: nada! :oops: For menuitem and buttons icons, no problem, solutions are there, and I know them...
But for window title bar icon, I tried to adapt several things... without success and din't see anything directly telling about! :?

No matter.
Have a good Sunday!

Regards.

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

#450 Post by technosaurus »

yeah sorry, I was misreading your post, the way I have always hacked it was make a symlink of my program to the name of the icon with no extension

Code: Select all

ln -s gtkdialog gtk-dialog-warning
#need an icon in jwm's icon path named gtk-dialog-warning.png (or xpm)
gtk-dialog-warning -P ....
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
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#451 Post by Argolance »

Merci... :)

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

#452 Post by technosaurus »

I switched out the find_pixmap code in my compile with this - speeds up not finding missing images with locate (especially if it is missing) and gives a convenient way to tell where the global gtkdialog images are (using an environment variable - GTKDIALOG_PIXMAP_DIR) - better suggestions welcome though
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].

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

#453 Post by Argolance »

Hello,
Did not test this yet... but guess that, at first sight, the small "amateur" I am finds these code lines impressive and somewhat "hermetic"... :shock: !

Thank you a lot!

sklimkin
Posts: 157
Joined: Wed 11 Jul 2012, 21:21
Location: Russia Moscow

gtkdialog-C-example

#454 Post by sklimkin »

The site http://code.google.com/p/gtkdialog/ wasn't updated for a long time.
Can be here will on a subject.
gtkdialog has many good examples bash-script.
The author Laszlo Pere has given possibility to do the program and in C-language, but an example of such program only one (and very small).
Program possibilities gtkdialog in this case are much poorer, than at bash-script.
Some users can write on bash-script worse, than on C-language (as I for example).
Considering it I has made an example in C-language.
Designs gtkdialog for C-language don't allow for example such things:
<window window_position = "1" title = "System Tools">
Or:
<action when = "file-activated"> echo File: $FILE </action>
It managed to be bypassed in such a way:
"<action> cat [echo $FILE] | zenity - text-info - width=720 - height=400 - title $FILE </action>"
But even with such restrictions it was interesting to me to make the program which doesn't demand heavy libraries (so I anyway think).
If will consider it possible add my example in/gtkdialog/examples/
Attachments
gtkdialog-c-lang.png
(89.2 KiB) Downloaded 1217 times
gtkdialog-C-example-32bit.tar.gz
gtkdialog example code C-language
(95.22 KiB) Downloaded 395 times

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#455 Post by oldyeller »

Hello Everyone,

I made me a notebook like menu for Manna OS, but iI have one problem that I need help with.

When I hit a button the menu stays open. How do I close it after hitting a button?

Code.
#! /bin/bash

export MAIN_DIALOG='
<window title="Manna Menu" icon-name="Bible">
<vbox>
<notebook labels="Bible Software|Books|Dictionaries">
<frame>
<hbox>
<button>
<input file>/usr/share/icons/hicolor/48x48/apps/bibletime.png</input>
<label>bibletime</label>
<action type="exec">bibletime</action>
</button>
<vbox>
<text wrap="true" width-chars="50"><label>An excellent stand alone program. There are a lot of books one can get for this and maps as well.</label></text>
</vbox>
</hbox>
<hbox>
<button>
<input file>/usr/share/pixmaps/75DE_BibleAnalyzer4.0.png</input>
<label>BibleAnalyzer</label>
<action type="exec">bibleanalyzer4.sh</action>
</button>
<vbox>
<text wrap="true" width-chars="50"><label>An excellent program to disect the Word and get more out of it. It has many ways in which one can do this. This has others resources one can buy.</label></text>
</vbox>
</hbox>
<hbox>
<button>
<input file>/usr/share/pixmaps/esword.png</input>
<label>e-sword</label>
<action type="exec">/usr/bin/e-Sword.sh</action>
</button>
<vbox>
<text wrap="true" width-chars="50"><label>There is a lot of free Bibles and other resources plus you can get step books (examples) as well. There is also bibles and books you can buy too.</label></text>
</vbox>
</hbox>
<hbox>
<button>
<input file>/usr/share/pixmaps/CB2C_theword.0.png</input>
<label>theWord</label>
<action type="exec">theword.sh</action>
</button>
<vbox>
<text wrap="true" width-chars="50"><label>This program is one in which you can open up more than just one book, bible or any other window. There is a lot of resources for this program on line to get.</label></text>
</vbox>
</hbox>
</frame>
<frame>
<vbox>
<text wrap="true" width-chars="50"><label>Books will be coming soon.</label></text>
</vbox>
</frame>
<frame>
<vbox>
<text wrap="true" width-chars="50"><label>Dictionaries will be coming soon as well. There will be more stuff added as time goes by.</label></text>
</vbox>
</frame>
</notebook>
<hbox>
<button cancel></button>
<button ok></button>
</hbox>
</vbox>
</window>
'

gtkdialog --program=MAIN_DIALOG
Any ideas?

thanks

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#456 Post by SFR »

oldyeller wrote:When I hit a button the menu stays open. How do I close it after hitting a button?
This is what you need, I believe:

Code: Select all

#! /bin/bash 

export MAIN_DIALOG=' 
  <button>
    <label>Launch Abiword</label>
    <action>abiword &</action>
    <action type="exit">exiting completed</action>
  </button>
'
gtkdialog --program=MAIN_DIALOG
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#457 Post by oldyeller »

Thanks SFR,

That worked!!! but didn't need to put launch in the <label>

Thanks

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#458 Post by oldyeller »

Hello again

I am have been trying to view+ and view- for my text but not sure if the code is right
#!/bin/sh

GTKDIALOG=gtkdialog

funcbtnCreate() {
echo '<button>
<label>'"$2"'</label>
<input file stock="'$3'"></input>
<action>echo "'"$4"' '$1'"</action>
<action type="'"$2"'">'$1'</action>
</button>'
}

export MAIN_DIALOG='
<window title="Text Advanced" resizable="false">
<vbox>
<vbox border-width="10" spacing="10">
<text use-markup="true">
<label>"<span fgcolor='"'black'"' bgcolor='"'white'"'> Text from file inside a scrollable vbox </span>"</label>
</text>
<vbox scrollable="true" width="600" height="300">
<text wrap="false" xalign="0">
<variable>txt0</variable>
<label>This is a static text.</label>
<input file>'/usr/local/Manna/t.txt'</input>
</text>
</vbox>
<hbox homogeneous="true">

'"$(funcbtnCreate txt0 viewmag gtk-view Bigger)"'
'"$(funcbtnCreate txt0 Enable gtk-yes Enabling)"'
'"$(funcbtnCreate txt0 Clear gtk-clear Clearing)"'
'"$(funcbtnCreate txt0 Fileselect gtk-file "Inserting into")"'
'"$(funcbtnCreate txt0 Refresh gtk-refresh Refreshing)"'
</hbox>

</vbox>
<hseparator></hseparator>
<hbox homogeneous="true">

<button use-stock="true" label="gtk-ok" has-focus="true"></button>
</hbox>
</vbox>
</window>
'

case $1 in
-d | --dump) echo "$MAIN_DIALOG" ;;
*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac
Any help would be great

Thanks

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

#459 Post by 8-bit »

I tried running your script from a terminal to see what was happening after changing the inputfile line to a file I had.
It displayed that file fine in the text window.
But... Instead of displaying the contents of a file from the File Selection button, it returns and displays the file name and that is being used as the input.
So that is strange.
Also, the $ variables I would have thought were command line variables given externally to the script.
But I have not worked with gtkdialog in a while, so take this reply for a grain of salt.

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#460 Post by oldyeller »

Hi 8-bit,

this code is form an example that I messed around with and had know idea what I was doing.

Here is my thought I want to be able to have books/text in a window that would be able to zoom-out/in so it could be read.

I am slowly learning how to do all of this though.

Post Reply