Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ TheIDE and Library: Releases and ChangeLogs » FileSel is now using icons from windows....
FileSel is now using icons from windows.... [message #10903] Fri, 03 August 2007 21:33 Go to next message
mirek is currently offline  mirek
Messages: 12050
Registered: November 2005
Ultimate Member
Looks a bit better...

Would be nice if somebody suggested some hint, link or even better, contributed the code how to do this in Linux.

...next step is to make that bar left and network browsing....
Re: FileSel is now using icons from windows.... [message #11111 is a reply to message #10903] Mon, 20 August 2007 16:53 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
I've got an idea of how to do this, but I haven't been able to test it yet. It's considerably more complicated than on Windows.

It should go something like this:
First check the standard icons paths/names as defined by the Tango project (I have seen these on their website, but it currently seems to be down Confused). This seems to be the standard adopted by KDE (it's where my icons are anyway), but I'm unsure about GNOME.

If the icon is not found fallback to Gtk icons by using GtkImage("gtk-home") etc. as defined here. This should be correct for Gnome, but appears to be less complete than the Windows selection or the Tango project.

This is not very pleasant, but seems to be the only Desktop agnostic way.

Edit: Actually it seems I'm mistaken about the KDE icons. Now I can't find them anywhere...

[Updated on: Mon, 20 August 2007 17:23]

Report message to a moderator

Re: FileSel is now using icons from windows.... [message #11112 is a reply to message #11111] Mon, 20 August 2007 17:53 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Found them Smile KDE doesn't actually follow Tango, though it is close.

Running
kde-config --path icon

gives:
/home/James/.kde/share/icons/
/usr/share/icons/
/opt/kde/share/icons/

So presumably the sequence should be:
1) Try and find the KDE icons (is it possible to determine whether GNOME or KDE is running?). This is further complicated by needing to determine which theme is running.
2) Optional: Try and find Tango icons
3) Use GetGtkImage.

It may be more trouble than it's worth to match icons on KDE. Anyone who really cares can set the GTK theme to match KDE, so perhaps you could just use the Gtk icons?

[Updated on: Mon, 20 August 2007 17:55]

Report message to a moderator

Re: FileSel is now using icons from windows.... [message #11113 is a reply to message #11112] Mon, 20 August 2007 18:29 Go to previous messageGo to next message
guido is currently offline  guido
Messages: 169
Registered: April 2006
Experienced Member
mrjt wrote on Mon, 20 August 2007 17:53


It may be more trouble than it's worth to match icons on KDE. Anyone who really cares can set the GTK theme to match KDE, so perhaps you could just use the Gtk icons?


Exactly!

http://library.gnome.org/devel/gtk/unstable/GtkIconTheme.htm l

has everything you should need (to know).

upp has picked gtk for x11 widget rendering, so using its icon theme api is the logical thing to do.
There is just no way to do the right thing for upp in case of KDE/GNOME theme mismatch. And KDE will screw the ISV with their bi-annual incompatible rewrites-from-scratch anyway.

Guido
Re: FileSel is now using icons from windows.... [message #11118 is a reply to message #11113] Mon, 20 August 2007 21:07 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12050
Registered: November 2005
Ultimate Member
Well, that is all good, BUT HOW do I get an icon for the file using GTK API?
Re: FileSel is now using icons from windows.... [message #11127 is a reply to message #11118] Tue, 21 August 2007 10:34 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Sorry, I thought you knew because it's used in Chameleon:

enum GtkIconSize {
	ICON_SIZE_INVALID,
	ICON_SIZE_MENU,
	ICON_SIZE_SMALL_TOOLBAR,
	ICON_SIZE_LARGE_TOOLBAR,
	ICON_SIZE_DND,
	ICON_SIZE_DIALOG
};

Image file_icon = GtkImage("gtk-file", ICON_SIZE_SMALL_TOOLBAR, 22);

You may have to fiddle with the sizes, and AFAIK GtkImage isn't currently exposed in Draw/Ch.h.

And to get the GTK theme to match QT/KDE you want this

James

[Updated on: Tue, 21 August 2007 10:40]

Report message to a moderator

Re: FileSel is now using icons from windows.... [message #11128 is a reply to message #11118] Tue, 21 August 2007 11:02 Go to previous messageGo to next message
waxblood is currently offline  waxblood
Messages: 95
Registered: January 2007
Member
A desktop-agnostic solution by freedesktop.org would be better...
Too bad I've tried a simple mime query on my Xubuntu Feisty and it didn't work...

xdg-mime query filetype structOgre_1_1Boxt.png
xdg-mime: no method available for quering MIME type of 'structOgre_1_1Box.png'


note: to try out the xdg- family of programs you have to install xdg-utils


Anyway, these are intresting links, especially if someone wants to install default icons for his apps
http://standards.freedesktop.org/icon-theme-spec/icon-theme- spec-latest.html

http://portland.freedesktop.org/xdg-utils-1.0/xdg-mime.html


Here are the standard names:
http://standards.freedesktop.org/icon-naming-spec/icon-namin g-spec-latest.html


David

Re: FileSel is now using icons from windows.... [message #11129 is a reply to message #11127] Tue, 21 August 2007 13:19 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12050
Registered: November 2005
Ultimate Member
mrjt wrote on Tue, 21 August 2007 04:34

Sorry, I thought you knew because it's used in Chameleon:

enum GtkIconSize {
	ICON_SIZE_INVALID,
	ICON_SIZE_MENU,
	ICON_SIZE_SMALL_TOOLBAR,
	ICON_SIZE_LARGE_TOOLBAR,
	ICON_SIZE_DND,
	ICON_SIZE_DIALOG
};

Image file_icon = GtkImage("gtk-file", ICON_SIZE_SMALL_TOOLBAR, 22);

You may have to fiddle with the sizes, and AFAIK GtkImage isn't currently exposed in Draw/Ch.h.

And to get the GTK theme to match QT/KDE you want this

James


Ah, sorry, I perhaps was not clear enough.

What works in Windows is that files are displayed with icons dedicated to their types. Means, .txt files have different icon than .xls and from .exe the icon is extracted.

This is what I would like to know how to implement in Ggnome...

Mirek
Re: FileSel is now using icons from windows.... [message #11135 is a reply to message #11129] Tue, 21 August 2007 20:20 Go to previous message
guido is currently offline  guido
Messages: 169
Registered: April 2006
Experienced Member
luzr wrote on Tue, 21 August 2007 13:19


What works in Windows is that files are displayed with icons dedicated to their types. Means, .txt files have different icon than .xls and from .exe the icon is extracted.

This is what I would like to know how to implement in Ggnome...

Mirek


GTK uses an in-tree copy of this:
http://webcvs.freedesktop.org/mime/xdgmime/

But GtkFileChooser doesn't expose any of it as a public API Sad

Guido
Previous Topic: TabCtrl now supports Insert and Remove of tabs
Next Topic: Multidisplay support (in Windows).
Goto Forum:
  


Current Time: Fri Oct 18 16:13:34 CEST 2019

Total time taken to generate the page: 0.01500 seconds