| Top |  |  |  |  | 
| Common Libfm utilities.Common Libfm utilities. — Common utility functions used by libfm and libfm-gtk. | 
| const char * | (*FmAppCommandParseCallback) () | 
| int | fm_app_command_parse () | 
| char * | fm_canonicalize_filename () | 
| char * | fm_file_size_to_str () | 
| char * | fm_file_size_to_str2 () | 
| const char * | fm_get_home_dir () | 
| gboolean | fm_key_file_get_bool () | 
| gboolean | fm_key_file_get_int () | 
| gboolean | fm_run_in_default_main_context () | 
| void | fm_strcatv () | 
| char * | fm_strdup_replace () | 
| char * | fm_uri_subpath_to_native_subpath () | 
const char * (*FmAppCommandParseCallback) (char opt,gpointer user_data);
The handler which converts key char into string representation.
See also: fm_app_command_parse().
Since: 1.0.0
int fm_app_command_parse (const char *cmd,const FmAppCommandParseOption *opts,char **ret,gpointer user_data);
This function parses line that contains some %<char> commands and does
substitutions on them using callbacks provided by caller. Only options
in opts
 and %% will be expanded, all other %<char> sequences will
be skipped.
| cmd | line to parse | |
| opts | plain list of possible options | |
| ret | pointer for resulting string, string should be freed by caller. | [out][transfer full] | 
| user_data | caller data to pass to callback | 
Since: 1.0.0
char * fm_canonicalize_filename (const char *filename,const char *cwd);
Makes a canonical name with full path from filename
. Returned string
should be freed by caller after usage.
Since: 0.1.0
char * fm_file_size_to_str (char *buf,size_t buf_size,goffset size,gboolean si_prefix);
Converts size
 into text representation of form "21.4 kiB" for example.
| buf | pointer to array to make a string | |
| buf_size | size of  | |
| size | number to convert | |
| si_prefix | 
 | 
Since: 0.1.0
char * fm_file_size_to_str2 (char *buf,size_t buf_size,goffset size,char size_units);
Converts size
 into text representation of form "21.4 kiB" for example.
The size_units
 defines which unit will be selected to convert (similar
to ones that 'du' utility uses):
b : bytes
k : KiB (1024 bytes)
m : MiB (1048576 bytes)
g : GiB (1073741824 bytes)
K : kB (1000 bytes)
M : MB (1000000 bytes)
G : GB (1000000000 bytes)
h : adaptive in IEC units
H : adaptive in SI units
| buf | pointer to array to make a string | |
| buf_size | size of  | |
| size | number to convert | |
| size_units | type of units to convert | 
Since: 0.1.0
const char *
fm_get_home_dir (void);
Retrieves valid path to home dir of user.
Since: 1.0.2
gboolean fm_key_file_get_bool (GKeyFile *kf,const char *grp,const char *key,gboolean *val);
Lookups key
 in kf
 and stores found value in val
 if the key
 was found.
Since: 0.1.0
gboolean fm_key_file_get_int (GKeyFile *kf,const char *grp,const char *key,int *val);
Lookups key
 in kf
 and stores found value in val
 if the key
 was found.
Since: 0.1.0
gboolean fm_run_in_default_main_context (GSourceFunc func,gpointer data);
Runs func
 once in global main loop with supplied data
.
Since: 1.0.2
void fm_strcatv (char ***strvp,char * const *astrv);
Appends string list astrv
 to strvp
 replacing it.
Since: 1.2.0
char * fm_strdup_replace (char *str,char *old_str,char *new_str);
Replaces every occurence of old_str
 in str
 with new_str
 and returns
resulted string. Returned string should be freed with g_free() after
usage.
Before 1.0.0 this API had name fm_str_replace.
Since: 0.1.16
char * fm_uri_subpath_to_native_subpath (const char *subpath,GError **error);
Converts escaped URI subpath into file path in native encoding.
Since: 1.2.0
struct FmAppCommandParseOption {
    char opt;
    FmAppCommandParseCallback callback;
};
Element of correspondence for substitutions by fm_app_command_parse().