Gnome Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# gnome-dentry

## Name

gnome-dentry -- Manipulation of .desktop files.

## Synopsis

    #include <gnome.h>

    struct      GnomeDesktopEntry;
    GnomeDesktopEntry* gnome_desktop_entry_load (const char *file);
    GnomeDesktopEntry* gnome_desktop_entry_load_flags
                                                (const char *file,
                                                 int clean_from_memory_after_load);
    GnomeDesktopEntry* gnome_desktop_entry_load_flags_conditional
                                                (const char *file,
                                                 int clean_from_memory_after_load,
                                                 int unconditional);
    GnomeDesktopEntry* gnome_desktop_entry_load_unconditional
                                                (const char *file);
    void        gnome_desktop_entry_save        (GnomeDesktopEntry *dentry);
    void        gnome_desktop_entry_free        (GnomeDesktopEntry *item);
    void        gnome_desktop_entry_destroy     (GnomeDesktopEntry *item);
    void        gnome_desktop_entry_launch      (GnomeDesktopEntry *item);
    void        gnome_desktop_entry_launch_with_args
                                                (GnomeDesktopEntry *item,
                                                 int the_argc,
                                                 char *the_argv[]);
    GnomeDesktopEntry* gnome_desktop_entry_copy (GnomeDesktopEntry *source);
    gchar*      gnome_is_program_in_path        (const gchar *program);

## Description

The routines in this module provide a way to load and save files in the format expected by the panel to create the menus and applet definitions.

## Details

### struct GnomeDesktopEntry

    typedef struct {
    	char *name;		/* These contain the translated name/comment */
    	char *comment;
    	int exec_length;	/* Length of `exec' vector.  Does not
    				   include the NULL terminator.  */
    	char **exec;		/* Command to execute.  Must be NULL
    				   terminated.  */
    	char *tryexec;		/* Test program to execute */
    	char *icon;		/* Icon name */
    	char *docpath;		/* Path to the documentation */
    	int   terminal;		/* flag: requires a terminal to run */
    	char *type;		/* type of this dentry */
    	char *location;		/* path of this dentry */
    	char *geometry;		/* geometry for this icon */

    	unsigned int multiple_args:1;
    	unsigned int is_kde:1;  /* If this is a .kdelink file */
    } GnomeDesktopEntry;

### gnome_desktop_entry_load ()

    GnomeDesktopEntry* gnome_desktop_entry_load (const char *file);

`file` : | a file name that contains a desktop entry.
Returns : | a newly created desktop entry loaded from `file` or NULL if the file does not exist or contains stale data.

### gnome_desktop_entry_load_flags ()

    GnomeDesktopEntry* gnome_desktop_entry_load_flags
                                                (const char *file,
                                                 int clean_from_memory_after_load);

`file` : | a file name that contains a desktop entry.
`clean_from_memory_after_load` : | flag
Returns : | a newly created desktop entry loaded from `file` or NULL if the file does not exist or contains stale data. if `clean_from_memory_after_load` is TRUE, then any data cached used by loading process is discarded after loading the desktop entry.

### gnome_desktop_entry_load_flags_conditional ()

    GnomeDesktopEntry* gnome_desktop_entry_load_flags_conditional
                                                (const char *file,
                                                 int clean_from_memory_after_load,
                                                 int unconditional);

`file` : | a file name that contains a desktop entry.
`clean_from_memory_after_load` : | flag
`unconditional` : | flag
Returns : | a newly created desktop entry loaded from `file` or NULL if the file does not exist. if `unconditional` is TRUE then the desktop entry is loaded even if it contains stale data, otherwise, NULL is returned if stale data is found (like, the program referenced not existing). if `clean_from_memory_after_load` is TRUE, then any data cached used by loading process is discarded after loading the desktop entry.

### gnome_desktop_entry_load_unconditional ()

    GnomeDesktopEntry* gnome_desktop_entry_load_unconditional
                                                (const char *file);

`file` : | file name where the desktop entry resides
Returns : | a newly created GnomeDesktopEntry loaded from `file` even if the file does not contain a valid desktop entry or NULL if the file does not exist.

### gnome_desktop_entry_save ()

    void        gnome_desktop_entry_save        (GnomeDesktopEntry *dentry);

Saves the desktop entry to disk

`dentry` : | A gnome desktop entry.

### gnome_desktop_entry_free ()

    void        gnome_desktop_entry_free        (GnomeDesktopEntry *item);

Releases the information used by `item`.

`item` : | a gnome desktop entry.

### gnome_desktop_entry_destroy ()

    void        gnome_desktop_entry_destroy     (GnomeDesktopEntry *item);

Erases the file that represents `item` and releases the memory used by `item`.

`item` : | a gnome deskop entry.

### gnome_desktop_entry_launch ()

    void        gnome_desktop_entry_launch      (GnomeDesktopEntry *item);

Launchs the program associated to the `item` desktop entry.

`item` : | a gnome desktop entry.

### gnome_desktop_entry_launch_with_args ()

    void        gnome_desktop_entry_launch_with_args
                                                (GnomeDesktopEntry *item,
                                                 int the_argc,
                                                 char *the_argv[]);

Launches the program associated with `item` with `the_argv` as its arguments.

`item` : | a gnome desktop entry.
`the_argc` : | the number of arguments to invoke the desktop entry with.
`the_argv` : | a vector of arguments for calling the program in `item`

### gnome_desktop_entry_copy ()

    GnomeDesktopEntry* gnome_desktop_entry_copy (GnomeDesktopEntry *source);

Makes a copy of a `source` GnomeDesktopEntry

`source` : | a GnomeDesktop entry.
Returns : | A copy of the `source` GnomeDesktopEntry

### gnome_is_program_in_path ()

    gchar*      gnome_is_program_in_path        (const gchar *program);

Looks for program in the PATH, if it is found, a g_strduped string with the full path name is returned.

`program` : | a program name.
Returns : | NULL if program is not on the path or a string allocated with g_malloc with the full path name of the program found

<<< Previous Page | Home | Up | Next Page >>>
gnome-defs | gnome-exec