Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 20 Dec 2014, 05:55
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Gtkdialog Development
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 17 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, ..., 15, 16, 17, 18, 19, ..., 53, 54, 55 Next
Author Message
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Sun 28 Aug 2011, 15:55    Post subject:  

I'm currently working towards making a source package release and I'd like to change something I recently added:

I want to change the checkbox and radiobutton menuitems from saving "0/1" to a file to "true/false" to make them consistent with other toggling widgets that save to file.

I'll wait a while before I do it to give people the time to object Razz

Regards,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
Dougal


Joined: 19 Oct 2005
Posts: 2505
Location: Hell more grotesque than any medieval woodcut

PostPosted: Sun 28 Aug 2011, 15:58    Post subject:  

Here's a modified version of technosaurus's example, which doesn't have the names hardcoded, so it doesn't need updating for different versions of gtk2...

Code:
#!/bin/sh

MAIN_DIALOG='
<vbox><hbox>'

n=0
while read i ; do
   MAIN_DIALOG="$MAIN_DIALOG
<pixmap icon_size=\"6\" tooltip-text=\"$i\"><input file stock=\"$i\"></input></pixmap> "
   n=$((n+1))
   if [ $((n%20)) -eq 0 ] ; then
      MAIN_DIALOG="$MAIN_DIALOG
</hbox><hbox>"
   fi
done <<_EOF
$(grep -F '#define GTK_STOCK' /usr/include/gtk-2.0/gtk/gtkstock.h | cut -d'"' -f2)
_EOF

export MAIN_DIALOG="$MAIN_DIALOG</hbox>
<button cancel></button>
</vbox>
"

gtkdialog3 --program=MAIN_DIALOG

_________________
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind
Back to top
View user's profile Send private message 
Dougal


Joined: 19 Oct 2005
Posts: 2505
Location: Hell more grotesque than any medieval woodcut

PostPosted: Sun 28 Aug 2011, 16:03    Post subject:  

thunor wrote:
Therefore you shouldn't assume that the theme icon name for gtk-dialog-authentication is going to be "gtk-dialog-authentication[.png]" because clearly on Slacko beta 1 it's "dialog-password[.png]".

Isn't the theme supposed to have also a symlink to it, with the proper stock name? Icon-themes are usually full of symlinks, as they don't have unique icons for everything, but need to support all the names.

_________________
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind
Back to top
View user's profile Send private message 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Sun 28 Aug 2011, 17:41    Post subject:  

Dougal

I think that there might be some confusion about what stock="" does and what icon="" does so I'll attempt to explain them:

<input file stock="gtk-new"></input> for example would load the image associated with the stock ID "gtk-new". It is a constant or a macro meant to hide the filename and also to deal with left-to-right and right-to-left variations of some images. Importantly the stock IDs do not change, they are not filenames, they are IDs and the images are possibly compiled-in.

<input file icon="gnumeric"></input> for example would load the file "gnumeric.png/svg/etc." from the current icon theme wherever that is located. My GTK+ 2 Crux theme has an IconTheme=Crux set but there's no such set of icons on my computer so GTK+ searches a default set of paths which results in "/usr/share/icons/hicolor/16x16/apps/gnumeric.png" being loaded. Importantly these are filenames minus the path and extension.

There is not going to be an issue using <input file stock="gtk-new"></input> across GTK+ builds because "gtk-new" here is an ID hiding the filename of the originating image, but there will be if you use <input file icon="gtk-new"></input> because in this case "gtk-new" is a filename.

What's been happening is that <input file icon="gtk-new"></input> has been used and it mostly worked because the originating filenames of the built-in images are mostly identical to the stock IDs (GTK+ apparently also counts built-in stock images as theme images) but on Slacko beta 1 the originating filenames of the built-in images are NOT the same as the stock IDs therefore "gtk-new" wouldn't be found as a theme icon UNLESS it does physically exist as a file somewhere within the paths GTK+ searches for theme icons.

Simply put, stock="" is for unchanging stock IDs, icon="" is for filenames [minus the path and extension] representing icons from the current theme and also within the default paths GTK+ searches for theme icons.

For the record, these are the [likely default] paths GTK+ is searching for theme icons on my lupu-520 (gtk_icon_theme_get_search_path() was used):
  • /root/.icons
  • /root/.local/share/icons
  • /usr/share/icons
  • /usr/local/share/icons -> ../lib/X11/mini-icons
  • /usr/share/pixmaps
  • /usr/local/share/pixmaps

See http://developer.gnome.org/gtk/2.24/gtk-Stock-Items.html and http://developer.gnome.org/gtk/2.24/GtkIconTheme.html.

Regards,
Thunor

Last edited by thunor on Sun 28 Aug 2011, 18:23; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Sun 28 Aug 2011, 18:00    Post subject:  

Dougal wrote:
Isn't the theme supposed to have also a symlink to it, with the proper stock name? Icon-themes are usually full of symlinks, as they don't have unique icons for everything, but need to support all the names.

Execute
Code:
find /usr -name "gtk-*[ps][nv]g"

and find out.

Regards,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
zigbert


Joined: 29 Mar 2006
Posts: 5813
Location: Valåmoen, Norway

PostPosted: Mon 29 Aug 2011, 02:40    Post subject:  

Thunor
Thank you for the explanation.


Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
01micko


Joined: 11 Oct 2008
Posts: 7841
Location: qld

PostPosted: Mon 29 Aug 2011, 07:28    Post subject:  

thunor wrote:
Simply put, stock="" is for unchanging stock IDs, icon="" is for filenames [minus the path and extension] representing icons from the current theme and also within the default paths GTK+ searches for theme icons.

[snip]


vovchik told me that ages ago!!! (about 2 years) [doh!]

ziggy.... hmmm... Laughing

At least this will please your weary eyes Wink (oh yes, Slacko B1 and PM2 Smile [hacked] )






...and thunors example with type=stock [line 13] and all -ltr$ removed from icon-names.txt



Thanks thunor.. and everyone else for sticking with it Wink

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
8-bit


Joined: 03 Apr 2007
Posts: 3398
Location: Oregon

PostPosted: Mon 29 Aug 2011, 12:32    Post subject:  

01micko,
First, I like your music interests as per the images! Smile

Second, that one line change in the gtk theme icons example was great!
With it, the original icon-names.txt file works fine and all displayable stock icons are displayed.
It saves a lot of guesswork as to if an icon will display properly in various puppy versions.
At least I hope it does.

I had found that appending the -ltr to some names in a script worked in some scripts but not others.

So kudos to you.

Just one question.

Are you going to become a Slacker? Laughing Laughing Laughing
Back to top
View user's profile Send private message 
Dougal


Joined: 19 Oct 2005
Posts: 2505
Location: Hell more grotesque than any medieval woodcut

PostPosted: Mon 29 Aug 2011, 15:30    Post subject:  

thunor wrote:
I think that there might be some confusion about what stock="" does and what icon="" does so I'll attempt to explain them:

<input file stock="gtk-new"></input> for example would load the image associated with the stock ID "gtk-new". It is a constant or a macro meant to hide the filename and also to deal with left-to-right and right-to-left variations of some images. Importantly the stock IDs do not change, they are not filenames, they are IDs and the images are possibly compiled-in.

<input file icon="gnumeric"></input> for example would load the file "gnumeric.png/svg/etc." from the current icon theme wherever that is located. My GTK+ 2 Crux theme has an IconTheme=Crux set but there's no such set of icons on my computer so GTK+ searches a default set of paths which results in "/usr/share/icons/hicolor/16x16/apps/gnumeric.png" being loaded. Importantly these are filenames minus the path and extension.

This was obvious from the names.

Quote:
There is not going to be an issue using <input file stock="gtk-new"></input> across GTK+ builds because "gtk-new" here is an ID hiding the filename of the originating image, but there will be if you use <input file icon="gtk-new"></input> because in this case "gtk-new" is a filename.

My point was that new stock items might be added with newer versions of gtk, to accommodate for newer technologies/standards, thus having them hardcoded will need updating. (the problem with my version is that you need the devx, though...)

Quote:
What's been happening is that <input file icon="gtk-new"></input> has been used and it mostly worked because the originating filenames of the built-in images are mostly identical to the stock IDs (GTK+ apparently also counts built-in stock images as theme images) but on Slacko beta 1 the originating filenames of the built-in images are NOT the same as the stock IDs therefore "gtk-new" wouldn't be found as a theme icon UNLESS it does physically exist as a file somewhere within the paths GTK+ searches for theme icons.

Of course the theme images have the same names: they are intended to override the builtin stock images. (Sure, you could just give them arbitrary names and just define them the right way in the theme index, but that is pointless and not human-friendly)

_________________
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 7841
Location: qld

PostPosted: Mon 29 Aug 2011, 15:43    Post subject:  

8-bit wrote:

Second, that one line change in the gtk theme icons example was great


Well it's basically what thunor explained.. in 2 previous posts.. and of course vovchik's mention to me awhile ago.. Rolling Eyes I was just too dense to do it.. until the penny dropped! I do not deserve the kudos!

8-bit wrote:

I had found that appending the -ltr to some names in a script worked in some scripts but not others.


I found that with -ltr not all images displayed for me, (in thunor's menu example) so I removed it and they did.. just trial and error.

8-bit wrote:

Are you going to become a Slacker? Laughing Laughing Laughing


I guess once a month when I boot into Slackware I am... [shh... that could get me in trouble around here..]

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
8-bit


Joined: 03 Apr 2007
Posts: 3398
Location: Oregon

PostPosted: Mon 29 Aug 2011, 15:52    Post subject:  

Actually, I was thinking of your latest Puppy effort called "Slacko"
I have to wipe out a bunch of frugal puppy installs to make some room for Slaco so I can check it out.
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5813
Location: Valåmoen, Norway

PostPosted: Mon 29 Aug 2011, 16:50    Post subject:  

01micko wrote:
vovchik told me that ages ago!!! (about 2 years) [doh!]

ziggy.... hmmm... Laughing

Mick, uhhhmmmm......... Laughing
You missed something important. The labels in your screenshot are limited to the gtk-stock labels. ie. Pmusic uses its own definition of 'Undo' --> 'Go back in playlist history'.

All this is of course fixed in Pmusic 2.0.1 Smile


Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
zigbert


Joined: 29 Mar 2006
Posts: 5813
Location: Valåmoen, Norway

PostPosted: Mon 29 Aug 2011, 17:07    Post subject:  


_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Mon 29 Aug 2011, 18:24    Post subject:  

Added statusbar widget

  • The <label> or the <default> directives can be used to set an initial message in addition to both <input> and <input file>
  • The widget's variable will contain the current message
  • There is no default signal and the only signal I've found it to emit is "show" at start-up

Just something I've wanted to add for some time now; a simple widget but useful.

<statusbar> widget example:
Code:
#!/bin/sh

# NOTE: This example requires at least gtkdialog-0.7.21 (please visit
# http://code.google.com/p/gtkdialog/). Additionally if you are using
# Puppy Linux then you may find that an historical version of gtkdialog
# already exists in /usr/sbin, and if that is the case then you should
# modify the shell variable below to point to the new gtkdialog binary.

GTKDIALOG=gtkdialog

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

echo "This message originates from an input file" > inputfile

export MAIN_DIALOG='
<window title="stbStatusBar" resizable="false" border-width="0">
   <vbox spacing="0">
      <menubar>
         <menu label="_File" use-underline="true">
            <menuitem stock-id="gtk-quit" accel-key="0x51" accel-mods="4">
               <action>exit:Quit</action>
            </menuitem>
         </menu>
      </menubar>
      <hbox border-width="20" spacing="10">
         '"$(funcbtnCreate stb0 2 Disable gtk-no Disabling)"'
         '"$(funcbtnCreate stb0 2 Enable gtk-yes Enabling)"'
         '"$(funcbtnCreate stb0 2 Clear gtk-clear Clearing)"'
         '"$(funcbtnCreate stb0 2 Refresh gtk-refresh Refreshing)"'
         '"$(funcbtnCreate stb0 2 Save gtk-save Saving)"'
         '"$(funcbtnCreate stb0 2 Fileselect gtk-new "Inserting into")"'
      </hbox>
      <statusbar has-resize-grip="false">
         <label>This message originates from the label directive</label>
         <default>This message originates from the default directive</default>
         <variable>stb0</variable>
         <input>echo This message originates from an input command</input>
         <input file>inputfile</input>
         <sensitive>true</sensitive>
         <output file>outputfile</output>
      </statusbar>
   </vbox>
   <action signal="hide">exit:Exit</action>
</window>
'

$GTKDIALOG --center --program=MAIN_DIALOG

Regards,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
8-bit


Joined: 03 Apr 2007
Posts: 3398
Location: Oregon

PostPosted: Mon 29 Aug 2011, 19:27    Post subject:  

I would still like to see an example of how to use a mask with chooser or fileselect to show only files that fit that mask.

For example, if I am at a prompt and type "ls *.png" only png type files are shown.
If I instead type "ls c*" only files beginning with c are shown.

If one has a variety of file types in a directory and wants fileselect or chooser to display only certain file types, that is handy.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 17 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, ..., 15, 16, 17, 18, 19, ..., 53, 54, 55 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1260s ][ Queries: 13 (0.0180s) ][ GZIP on ]