[Gambas-user] Stock

Benoît Minisini g4mba5 at gmail.com
Sun Jan 3 16:01:29 CET 2021


Le 03/01/2021 à 14:46, Fabien Bodard a écrit :
> Le dim. 3 janv. 2021 à 02:30, Tony Morehen <tmorehen at ajm-software.com> a écrit :
>>
>> Why not use Picture["theme/..."] to access freedesktop icons? Instead of
>> "theme", you could use "themeicon", "freedesktop", "freedesktopicon",
>> "desktop", "desktopicon" or whatever.
>>
>> This could be done either as a re-write to the current picture class as
>> it won't impact current uses or as a sub-class of Picture in the
>> gb.desktop component.
>>
>> BTW, you don't need the "devices" sub-path.  Freedesktop icon names are
>> unique.  Benoit is right about theme icon names not being standardized.
>> Some are organized theme/class/size and some theme/size/class
> 
> Well you surely don't know that but the Stock code is really powerful
> and resolves these problems since many years now :-)
> 
> In the past I've begun to work on that when I've started to implement
> DesktopMime to get mime infos and by the way Mimetype Icon of the
> current theme.
> 
> So the class gets the current desktop theme, resolves the inheritance
> of the theme (and adapts to different structures) , try to find the
> icon in a degressive order, or svg.
> 
> So the problem is only on Icons names. But hard work have been done on
> these to have Symbolic links with standart names for devices and
> mimetype... truely its not perfect :-)
> 
> That's why Benoit made the map file. So for example for my device
> viewer, I will need to add entries for devices icons in this file and
> in the gb.form.stock.
> 
> I'm not a good programmer so fortunately Benoit keep an eye on my work
> and make correction and improvement on my work ... often ... too often
> :-D.
> 
> Regards,
> 
> Fabien
> 

I'd just want "icon:/..." to match standard Gambas only.

The Stock algorithm quickly described by Fabien is a way to use icon 
names that resolve to KDE / Gnome icon themes automagically in a 
desktop-agnostic way.

So I think that accessing icons directly (or almost directly) is a 
freedesktop thing and should be handled by a class in the 'gb.desktop' 
component.

Then we can add a handle to special icon urls in the Picture class of 
'gb.gui' that would pass the url path to the 'gb.desktop' class - 
exactly the same way as "icon:/" sends its path to the Stock class if it 
exists.

But I still find accessing desktop icons directly a bad idea, because 
they are not standardized:

- If you can't find an icon both in a KDE theme and in a Gnome theme, 
then for sure it is a specific icon. Your application may not work if 
the theme you use is not installed.

- If you can find it almost in every theme, then why not just add it to 
the icon map file in 'gb.form'? Tell me then, because I'm almost add all 
of them.

- Moreover, some features are added to the icon themes that make them a 
complete mess: monochrom versions of some icons, icons that are used 
only as indicators, strange sizes, and so on... Hard to handle that in a 
desktop-agnostic way.

Regards,

-- 
Benoît Minisini


More information about the User mailing list