Top |
gboolean | (*XfceMatchFunc) () |
gchar ** | xfce_resource_dirs () |
gchar * | xfce_resource_lookup () |
gchar ** | xfce_resource_lookup_all () |
gchar ** | xfce_resource_match () |
gchar ** | xfce_resource_match_custom () |
void | xfce_resource_push_path () |
void | xfce_resource_pop_path () |
gchar * | xfce_resource_save_location () |
gboolean (*XfceMatchFunc) (const gchar *basedir
,const gchar *relpath
,gpointer user_data
);
Return value :
basedir |
basedir |
|
relpath |
relpath |
|
user_data |
additional user data passed to |
gchar **
xfce_resource_dirs (XfceResourceType type
);
Queries the list of possible directories for the specified type
. The
first element of the list is always the save location for type
. None
of the directories returned in the list are garantied to exist.
This function should be rarely used. You should consider using
xfce_resource_lookup()
or xfce_resource_match()
instead.
The returned list must be freed using g_strfreev()
.
Since: 4.2
gchar * xfce_resource_lookup (XfceResourceType type
,const gchar *filename
);
Looks for a resource of the specified type
whose relative path matches
filename
. filename
can either reference a regular file, in which case
it must not end with a slash character ('/'), or a directory, when
filename
contains a trailing slash character ('/').
The caller is responsible to free the returned string using g_free()
when no longer needed.
type |
type of resource to lookup. |
|
filename |
relative filename of the resource, e.g. "xfwm4/xfwmrc". |
the absolute path to the first file or directory in the
search path, that matches filename
or NULL
if no such
file or directory could be found.
[transfer full]
Since: 4.2
gchar ** xfce_resource_lookup_all (XfceResourceType type
,const gchar *filename
);
Similar to xfce_resource_lookup()
, but returns all resource of the specified type
,
that whose name is filename
.
The caller is responsible to free the returned string array using g_strfreev()
when no longer needed.
type |
type of the resource to lookup. |
|
filename |
relative file path. If |
Since: 4.2
gchar ** xfce_resource_match (XfceResourceType type
,const gchar *pattern
,gboolean unique
);
Tries to find all resources with the specified type
. The function will
look into all specified directories and return all filenames in these
directories. The returned filenames are given relative the base directories
specified by type
.
If pattern
contains a trailing slash, xfce_resource_match looks only for
directories that match pattern
, else it'll only look for regular files. In
case you are looking for directories, the returned entries will contain a
trailing slash as well, so you can easily use them with other resource
functions like xfce_resource_lookup or xfce_resource_save_location.
Example: xfce_resource_match (XFCE_RESOURCE_CONFIG, "foo/bar*") will probably return ("foo/bar", "foo/barbaz", ...).
type |
type of the resource to locate directories for. |
|
pattern |
only accept filenames that fit to the pattern. The pattern needs to be a valid GPattern. |
|
unique |
if |
string array of all the relative paths whose names matches the
given pattern
. The return value has to be freed using
g_strfreev()
when no longer needed.
[transfer full]
Since: 4.2
gchar ** xfce_resource_match_custom (XfceResourceType type
,gboolean unique
,XfceMatchFunc func
,gpointer user_data
);
Yet to be implemented!
type |
type of the resource to locate directories for. |
|
unique |
if |
|
func |
(scope call) : callback to determine if there was a match |
|
user_data |
caller defined data |
The caller is responsible to free
the returned string array using g_strfreev()
when no longer needed.
[transfer full]
Since: 4.2
void xfce_resource_push_path (XfceResourceType type
,const gchar *path
);
Appends path
to the search path list for type
. This function was
written primary for use within modules in larger applications, for example
MCS plugins.
For example, if you need to add a specific path to the search path list
in your MCS, you should call xfce_resource_push_path()
prior to calling
one of the resource search functions and call xfce_resource_pop_path()
right afterwards.
Since: 4.2
void
xfce_resource_pop_path (XfceResourceType type
);
Undoes the effect of the latest call to xfce_resource_push_path()
. You
should take special care to call xfce_resource_pop_path()
exactly same
times as xfce_resource_push_path()
, everything else might result in
unwanted and maybe even undefined behaviour. You have been warned!
Since: 4.2
gchar * xfce_resource_save_location (XfceResourceType type
,const gchar *relpath
,gboolean create
);
If relpath
contains a trailing slash ('/') character, xfce_resource_save_location()
finds the directory to save files into for the given type in the user's
home directory. All directories needed (including those given by
relpath
) will be created on demand if create
if TRUE
.
If relpath
does not end with a slash ('/') character, it is taken to be
the name of a file to return the save location for. All the directories
needed will be created on demand if create
is TRUE
.
Specifying NULL
or the empty string for relpath
allows you to discover
the base path for saving files of the specified type
, though normally
you should not need this.
type |
type of location to return. |
|
relpath |
relative path of the resource. |
|
create |
whether to create missing directory. |
the path where resources of the specified type
should be
saved or NULL
on error. The returned string should be freed
when no longer needed.
[transfer full]
Since: 4.2