Re: [Vala] gnome-desktop usage..



Shawn Ferris <shawnmferris yahoo com> writes:

Hi All -- Can someone help me with this.. I need to read (and at some point, create) desktop files.. I have 
this example and I don't receive an error that it couldn't open the file, but it doesn't seem to return a 
DesktopItem that actually represents the file. 

using GLib;
using Gnome;
using GnomeVFS;

class SMF : GLib.Object {


  public static void main () {

    GnomeVFS.init();

    weak DesktopItem di;

    try {
      var di = new DesktopItem.from_file(
        "test.desktop",
        DesktopItemLoadFlags.ONLY_IF_EXISTS
      );

Here scope of var di ends which shadows the DesktopItem di.
    } catch(GLib.Error err) {
      message( err.message );
    }

    if ( di != null ) {
      message( di.get_string("Name") );
    }

  }
}

and my desktop file, which I took from library.gnome.org is:

[Desktop Entry]
Version=1.0
Type=Application
Name=Foo Viewer
Comment=The best viewer for Foo objects available!
TryExec=fooview
Exec=fooview %F
Icon=fooview
MimeType=image/x-foo;
X-KDE-Library=libfooview
X-KDE-FactoryName=fooviewfactory
X-KDE-ServiceType=FooService

Am I missing something? 

As always, I appreciate any help!

Shawn




      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

-- 
I've probably left my head... somewhere. Please wait untill I find it.
Homepage (pl_PL): http://uzytkownik.jogger.pl/
(GNU/)Linux User: #425935 (see http://counter.li.org/)




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