Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

choices.h File Reference

Interface to the ROX choices system. More...


Functions

void choices_init (void)
GPtrArray * choices_list_dirs (const char *dir)
void choices_free_list (GPtrArray *list)
gchar * choices_find_path_load (const char *leaf, const char *dir)
gchar * choices_find_path_save (const char *leaf, const char *dir, gboolean create)
void rox_choices_init (void)
gchar * rox_choices_load (const char *leaf, const char *dir, const char *domain)
gchar * rox_choices_save (const char *leaf, const char *dir, const char *domain)
GPtrArray * rox_choices_list_dirs (const char *dir, const char *domain)
void rox_choices_free_list (GPtrArray *list)


Detailed Description

Interface to the ROX choices system.

This declares both the original ROX choices system controlled by $CHOICESPATH and the new XDG based system. The original was from ROX-Filer and was by Thomas Leonard <tal197@users.sourceforge.net>.

These functions are deprecated and should not be used in new code:

Version:
Id
choices.h,v 1.7 2006/10/06 16:29:38 stephen Exp
Author:
Thomas Leonard, Stephen Watson.

Function Documentation

gchar* choices_find_path_load const char *  leaf,
const char *  dir
 

Get the pathname of a choices file to load. Eg:

choices_find_path_load("menus", "ROX-Filer") -> "/usr/local/share/Choices/ROX-Filer/menus".

The return values may be NULL - use built-in defaults - otherwise g_free() the result.

Deprecated:
Use rox_choices_load() instead.
Parameters:
[in] leaf last part of file name (may include a relative directory part)
[in] dir directory to locate in $CHOICESPATH, normally the name of the program
Returns:
path to file (pass to g_free() when done) or NULL

gchar* choices_find_path_save const char *  leaf,
const char *  dir,
gboolean  create
 

Returns the pathname of a file to save to, or NULL if saving is disabled. If 'create' is TRUE then intermediate directories will be created (set this to FALSE if you just want to find out where a saved file would go without actually altering the filesystem).

g_free() the result.

Deprecated:
Use rox_choices_save() instead
Parameters:
[in] leaf last part of file name (may include a relative directory part)
[in] dir directory to locate in $CHOICESPATH, normally the name of the program
[in] create if non-zero create missing directories
Returns:
path to file (pass to g_free() when done) or NULL

void choices_free_list GPtrArray *  list  ) 
 

Free the data returned by choices_list_dirs().

Parameters:
[in,out] list Return value from choices_list_dirs().
Deprecated:
use rox_choices_free_list() instead.

void choices_init void   ) 
 

Checks $CHOICESPATH to construct the directory list table for the old choices_system. You must call this before using any other choices_* functions.

If the environment variable does not exist then the defaults are used.

Deprecated:
This is called by rox_init_with_domain() and you should call that in preference to this.

GPtrArray* choices_list_dirs const char *  dir  ) 
 

Returns an array of the directories in CHOICESPATH which contain a subdirectory called 'dir'.

Lower-indexed results should override higher-indexed ones.

Free the list using choices_free_list().

Parameters:
[in] dir directory to search for.
Returns:
pointer array of results.
Deprecated:
use rox_choices_list_dirs() instead.

void rox_choices_free_list GPtrArray *  list  ) 
 

Free the data returned by rox_choices_list_dirs().

Parameters:
[in,out] list Return value from rox_choices_list_dirs().

void rox_choices_init void   ) 
 

Checks $CHOICESPATH to construct the directory list table for the old choices_system. This is called to support the old choices system and should not be used in new code.

If the environment variable does not exist then the defaults are used.

Deprecated:
This is called by rox_init_with_domain() and you should call that in preference to this.

GPtrArray* rox_choices_list_dirs const char *  domain,
const char *  dir
 

Returns an array of the directories in XDG_CONFIG_DIRS which contain a subdirectory called 'domain/dir'.

Lower-indexed results should override higher-indexed ones.

Free the list using rox_choices_free_list().

Parameters:
[in] dir directory to search for.
[in] domain domain of the programs author, or email address. Used to uniquely identify programs with similar names.
Returns:
pointer array of results.

gchar* rox_choices_load const char *  leaf,
const char *  dir,
const char *  domain
 

Get the pathname of a choices file to load. Eg:

rox_choices_load("menus", "ROX-Filer", "rox.sourceforge.net") -> "/etc/xdg/rox.sourceforge.net/ROX-Filer/menus" or "/home/user/.config/rox.sourceforge.net/ROX-Filer/menus".

The return values may be NULL - use built-in defaults - otherwise g_free() the result.

This uses rox_basedir_load_config_path(), falling back on choices_find_path_load() if that does not return a result.

Parameters:
[in] leaf last part of file name (may include a relative directory part)
[in] dir directory to locate in $XDG_CONFIG_HOME, $XDG_CONFIG_DIRS or $CHOICESPATH, normally the name of the program
[in] domain domain of the programs author, or email address. Used to uniquely identify programs with similar names.
Returns:
path to file (pass to g_free() when done) or NULL

gchar* rox_choices_save const char *  leaf,
const char *  dir,
const char *  domain
 

Returns the pathname of a file to save to, or NULL if saving is disabled.

g_free() the result.

Parameters:
[in] leaf last part of file name (may include a relative directory part)
[in] dir directory to locate in $XDG_CONFIG_HOME or $XDG_CONFIG_DIRS, normally the name of the program
[in] domain domain of the programs author, or email address. Used to uniquly identify programs with similar names.
Returns:
path to file (pass to g_free() when done) or NULL


Generated on Fri Nov 24 16:19:59 2006 for ROX-CLib by  doxygen 1.4.4