Re: Need to add desktop link to gtk app???



Hi Robin,

GTK doesn't offer any APIs for desktop file manipulation. The .desktop
file spec is available over at freedesktop.org

It'd be really neat to have a library to manipulate these files, but
AFAIK nothing like this exists (yet). So, you'll need to create the
files by hand using just the standard C/GLib functions.

By "Linux 7.2" I'll assume you mean Red Hat 7.2 - Mozilla is not
involved in this process so that's OK. RH7.2 is really, really old and I
would not recommend using it, as currently desktop related stuff like
this is moving really quickly. For that reason, these instructions
assume GNOME 2.2 and higher, or KDE 3.1 and higher. They won't work for
gnome 1.4

Basically the process goes:

* Install an icon into the /usr/share/icons or ~/.icons directory. The
exact format, directory layout etc is described in the icon theme spec
(also available on freedesktop.org)

* Create a .desktop file in the desktop directory for each desktop. The
format is described in the spec and is straightforward - just create a
link then open up the file with a text editor to see how they work. The
directories are currently different for each desktop, but in version 2.4
Gnome will switch to using the KDE directory so they will share desktops
(in ~/Desktop iirc). You will therefore want to duplicate the .desktop
file in ~/.gnome-desktop and ~/Desktop in the transition period.

This is assuming that you want to create an application launcher.

Final note - if you're doing this for an application installer, don't.
Apps adding launchers for themselves to the desktop or panels
automatically is the last thing we need, icons can easily be dragged
from the menu if that's what the user wants, otherwise the user ends up
with a desktop cluttered with loads of icons. Just adding one to the
menu system is good enough.

thanks -mike

On Tue, 2003-07-29 at 20:12, robin_field us ibm com wrote:
Hi all,

I have a gtk app (not using any gnome APIs only gtk APIs, and I need
to programmatically add a desktop link with an icon but don't know how
to do this with gtk??  My OS is Linux 7.2, using mozilla 1.3.1,
desktop is GNOME but need it to work for KDE env's as well...  Any
help asap would be great.

Robin Field
IBM Lotus Principle Software Engineer.
-- 
Mike Hearn <m hearn signal qinetiq com>
QinetiQ - Malvern Technology Center




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]