Ticket #2378 (closed task: fixed)

Opened 4 years ago

Last modified 3 months ago

Drop data/pixmaps data/iconsets and use icon themes

Reported by: patrys@… Owned by: Jim++
Priority: normal Milestone: 0.14
Component: None Version:
Severity: normal Keywords: icontheme xdg
Cc: jagw40k@… Blocked By:
OS: All Blocking:

Description

Since gajim does not even use the proper directory for pixmaps, I'd like to request moving to themes.

Both GTK/GNOME and KDE make use of /usr/share/icons and there is a special folder called hicolor. hicolor is the default fallback dir if an icon could not be found elsewhere and that's where applications should drop their stock icons (/usr/share/icons/hicolor/XxY/apps/). All icons should be prefixed with application's name (ie. gajim.png, gajim-error.svg, etc.).

If you want to keep some stuff unthemable, things like the about image should be moved to /usr/share/pixmaps/gajim.

  1. It would make gajim easily themable with the rest of the desktop
  2. Accessing standard icons is easier as you don't have to know the size, extension or format (which means less code as GTK takes care of that, you only specify the desired size and GTK picks the best match)
  3. You don't care which theme is currently in use so you don't have to add another way to pick the right iconset in the UI
  4. Could also be done on Windows as GTK provides these directories as well

I'd also like to see the roster icons to be a part of the theme (like in Nautilus you don't have to provide your own iconset for folders and files). Desktop integrations is the main reason I choose Gajim over Psi.

Attachments

gajim-icontheme.patch (15.3 KB) - added by Patryk Zawadzki <patrys@…> 3 years ago.
first patch to use native gtk icon themes
gajim-icontheme2.patch (16.3 KB) - added by jim++ 3 years ago.
Same patch with fixs

Change History

Changed 4 years ago by nk

I just want to add, that as much as users like desktop intergrations, it's

also a very hard part for devs to do and I should know.. :$ :)

Changed 4 years ago by nk

  • type changed from enhancement to task

Changed 3 years ago by anonymous

[12:00:41 AM] nkour: see,  http://pygtk.org/docs/pygtk/class-

gtkiconfactory.html [12:00:54 AM] nkour: this holds iconsets which holds iconnames

Changed 3 years ago by anonymous

 http://pygtk.org/docs/pygtk/class-gtkiconsource.html which is wrapped in

iconset which is wrapped in iconfactory, provides the ability to use SVG and ignore sizes

Changed 3 years ago by patrys@…

Attaching the preliminary patch (currently against 20061027 snapshot).

To make it work:

Move all icons from pixmaps folder to /usr/share/icons/hicolor/*size*/apps/ and prefix them with "gajim-"

For example data/pixmaps/kbd_input.png becomes /usr/share/icons/hicolor/16x16/gajim-kbd_input.png

Then invoke:

gtk-update-icon-cache -f /usr/share/icons/hicolor/

to update the icon cache.

Changed 3 years ago by Patryk Zawadzki <patrys@…>

first patch to use native gtk icon themes

Changed 3 years ago by jim++

Isn't it /usr/share/icons/hicolor/16x16/apps/gajim-kbd_input.png ?

Changed 3 years ago by patrys@…

Yes it is. My bad.

Changed 3 years ago by asterix

it could be fine that if it doen't find icon in /usr/share/... it default to gajim actual pixmap folder. in this case we can use gajim without having to do make install

Changed 3 years ago by patrys@…

It's as easy as modifying the gtkgui_helpers.get_icon_* to print a warning that it is using a fallback and actually return the local file.

Still current pixmap directory structure should be modified to use something like 16x16/gajim-kbd_input.png

Changed 3 years ago by jim++

Same patch with fixs

Changed 3 years ago by jim++

Same patch but against svn. Correct two typo ('kbd_input.png' -> 'gajim-kbd_input', gtk_gui_helpers -> gtkgui_helpers) and correct calls from gajim.py to notify.popup().

I just saw some '.png' that shouldn't be there also.

Works fine with the icons I tested.

Changed 3 years ago by jim++

patrys, where will be the iconsets then ? They will not be ALL in the same folder with no subfolder I hope.

Changed 3 years ago by patrys@…

It does not touch the iconsets at all.

I am planning to do a second patch that moves the default iconset and transport icons to the icontheme and allows it to remain themeable (like gajim-tango can provide a tango specific icons) while still allowing an override with a local iconset (as most current iconsets are not targetted at any particular theme).

Changed 3 years ago by asterix

to sum up for this ticket:

  • update patch so that it falls back to gajim folder (maybe change the structure, but I don't see wht having a 16x16 folder)
  • update destination for images in make install

Changed 3 years ago by patrys@…

A simple workaround could be to use icon_theme.set_search_path('data/pixmaps') and make sure the pixmaps are arranged correctly there.

Changed 3 years ago by patrys@…

Oops, I mean append_search_path

Changed 3 years ago by patrys

  • os set to All

Bump? Everything is here, any reason not to commit?

Changed 23 months ago by Jim++

  • keywords icontheme added
  • owner changed from asterix to Jim++
  • summary changed from Drop data/pixmaps and use icon themes to Drop data/pixmaps data/iconsets and use icon themes

As far as I understand for the moment, this patch only adds complexity to the data dir. As icons in data/pixmaps are not themable and always have the same size, using gtk.IconTheme? doesn't have any interest.

gtk.IconSet? and gtk.IconSource? MAY be more useful for that, but I don't understand how to use render_icon() yet. Someone knows ?

On the other hand, I began to work on using gtk.IconTheme? for data/iconsets . Here we have differents size and themes, so it is useful. We could drop some code where we deal with that and let gtk do it. But after firsts tests, it seems it is slow. I will test more and see if it worth the price or if iconset code only need some cleanups (see #3643).

Changed 23 months ago by Jim++

  • keywords xdg added

Changed 4 months ago by Oxayotl

  • cc jagw40k@… added

I do think this patch could be very useful to allow more "eccentric" icons themes. I'm currently maintaining this theme :  http://gnome-look.org/content/show.php?content=81153 , and since some icons (ie upload.png) that are mixed with gtk_themable icons, fits very poorly in my theme style, the only solution to get a clean look is to over-ride the icon with another one, which is not a clean solution, requires the user to have the right to modify the install directory (which usually means having root privileges) and needs to be done after every update. This patch would allow a clean user-specific theming.

Changed 4 months ago by jagw40k@…

The usual place to put the native icons, at least in Gnome software, is in /usr/share/[i]program/i/icons/hicolor/, with the usual [i]size/ix[i]size/i/[i]folder/i (with folder = [actions|status|places|…]) hierarchy. That's how by example Nautilus, Rhythmbox, Brasero, Banshee, and Empathy do.

Some other software, like nm-applet, put their icons in /usr/share/icons/hicolor, but that's quite rare.

Some other software do just put all theirs icons in /usr/share/pixmaps, but to me it seems this folder should normally only be used by images that are not icons, so I strongly recommend no to do things this way.

I think the first solution is the best one.

Changed 4 months ago by Yann Leboulanger <asterix@…>

(In [dab0360d56e9]) base of using icon themes. see #2378

Changed 4 months ago by brubru

Hi, Asterix.

What is the goal with your last patches (dab0360d56e9) and (c511ae2b2235) ?

Do you want to install icons in PREFIX/share/icons or having them in PREFIX/share/gajim/icons (or maybe in PREFIX/share/gajim/data/icons) ?

Because I was preparing a patches series to cleanup autoconf/automake and the way datadir directory is set to gajim, but those changes borked mines :-(. So I wanted to know where icons will finally lives to fix my patches.

If they're going to be in PREFIX/share/icons, it would be easy to set the ICON_DIR like we do for LOCALEDIR: in defs.py.

If they'll live under PREFIX/share/gajim/, I prefer to re-put them under data/ since my patches would works relative to the data directory and not his parent which may not be PREFIX/share/gajim.

Changed 4 months ago by asterix

As jagw40k@… explained, icons folder should be in PREFIX/share/gajim/

Changed 4 months ago by brubru

Ok, I will see how I can update my patches. Thanks.

Changed 3 months ago by Yann Leboulanger <asterix@…>

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to 0.14

(In [0260bb80d4e2]) finish using icon theme. Fixes #2378

Add/Change #2378 (Drop data/pixmaps data/iconsets and use icon themes)

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
Next status will be 'needinfo'
 
Note: See TracTickets for help on using tickets.