![]() |
![]() |
![]() |
libgebr Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
void GEBR_LOCK_FILE (const gchar *path
); void GEBR_UNLOCK_FILE (const gchar *path
); enum TimesType; gboolean g_key_file_has_key_woe (GKeyFile *key_file
,const gchar *group
,const gchar *key
); int g_strcmp0 (const char *str1
,const char *str2
); gboolean gebr_add_remove_ssh_key (gboolean remove
); gboolean gebr_append_filename_extension (GString *filename
,const gchar *extension
); const gchar * gebr_apply_pattern_on_address (const gchar *addr
); gchar * gebr_calculate_detailed_relative_time (GTimeVal *time1
,GTimeVal *time2
); gint gebr_calculate_number_of_processors (gint total_nprocs
,gdouble aggressive
); gchar * gebr_calculate_relative_time (GTimeVal *time1
,GTimeVal *time2
,TimesType *type
,gdouble *delta
); gboolean gebr_callback_true (void
); gint gebr_compute_diff_clock_to_me (const gchar *iso_time1
); gchar * gebr_compute_diff_iso_times (const gchar *iso_time1
,const gchar *iso_time2
); gboolean gebr_create_config_dirs (void
); gchar * gebr_create_id_with_current_time (); gchar * gebr_date_get_localized (const gchar *format
,const gchar *locale
); gboolean gebr_dir_has_files (const gchar *dir_path
); #define gebr_directory_foreach_file (filename, directory) #define gebr_directory_foreach_file_hyg (filename, directory, hygid) GList * gebr_double_list_to_list (GList *double_list
); #define gebr_foreach_gslist (element, list) #define gebr_foreach_gslist_hyg (element, list, hygid) gboolean gebr_g_key_file_has_key (GKeyFile *key_file
,const gchar *group
,const gchar *key
); gboolean gebr_g_key_file_load_boolean_key (GKeyFile *key_file
,const gchar *group
,const gchar *key
,gboolean default_value
); int gebr_g_key_file_load_int_key (GKeyFile *key_file
,const gchar *group
,const gchar *key
,int default_value
); GString * gebr_g_key_file_load_string_key (GKeyFile *key_file
,const gchar *group
,const gchar *key
,const gchar *default_value
); gboolean gebr_g_key_file_remove_key (GKeyFile *key_file
,const gchar *group
,const gchar *key
); gboolean gebr_g_string_ends_with (GString *string
,const gchar *val
); gchar * gebr_g_string_remove_accents (gchar *title
); void gebr_g_string_replace (GString *string
,const gchar *oldtext
,const gchar *newtext
); void gebr_g_string_replace_first_ref (GString *string
,const gchar *oldtext
,const gchar *newtext
); gboolean gebr_g_string_starts_with (GString *string
,const gchar *val
); gboolean gebr_generate_key (); gchar *** gebr_generate_paths_with_home (const gchar *home
); gchar * gebr_get_control_text_for_type (TimesType type
); gchar * gebr_get_host_from_address (const gchar *address
); gdouble gebr_get_lower_bound_for_type (TimesType type
); const gchar * gebr_get_nfsid (void
); gint gebr_get_number_of_time_controls (); gchar * gebr_get_user_from_address (const gchar *address
); #define gebr_glist_foreach (element, list) #define gebr_glist_foreach_hyg (element, list, hygid) GQueue * gebr_gqueue_push_tail_avoiding_duplicates (GQueue *queue
,const gchar *data
); void gebr_gtk_bookmarks_add_paths (const gchar *filename
,const gchar *uri_prefix
,gchar ***paths
); void gebr_gtk_bookmarks_remove_paths (const gchar *filename
,gchar ***paths
); gboolean gebr_gzfile_get_contents (const gchar *filename
,GString *contents
,gchar **error
); int gebr_home_mode (void
); gchar * gebr_id_random_create (gssize bytes
); gchar * gebr_key_filename (gboolean public
); gboolean gebr_kill_by_port (gint port
); gchar * gebr_locale_to_utf8 (const gchar *string
); gchar * gebr_lock_file (const gchar *path
,const gchar *content
); GString * gebr_make_temp_filename (const gchar *template
); GString * gebr_make_unique_filename (const gchar *template
); void gebr_pairstrfreev (gchar ***strv
); gboolean gebr_path_is_at_home (const gchar *path
); gboolean gebr_path_resolve_home_variable (GString *path
); void gebr_path_set_to (GString *path
,gboolean relative
); gboolean gebr_path_use_home_variable (GString *path
); const gchar * gebr_paths_get_value_by_key (const gchar ***paths
,const gchar *key
); gboolean gebr_realpath_equal (const gchar *path1
,const gchar *path2
); gchar * gebr_relativise_home_path (const gchar *path_string
,const gchar *mount_point
,const gchar *home
); gchar * gebr_relativise_old_home_path (const gchar *path_string
); gchar * gebr_relativise_path (const gchar *path_string
,const gchar *mount_point
,gchar ***pvector
); gchar * gebr_remove_path_prefix (const gchar *prefix
,const gchar *path
); gchar * gebr_resolve_relative_path (const char *path
,gchar ***pvector
); gboolean gebr_str_canonical_var_name (const gchar *keyword
,gchar **new_value
,GError **error
); gchar * gebr_str_escape (const gchar *str
); gchar * gebr_str_remove_trailing_zeros (gchar *str
); gchar * gebr_str_word_before_pos (const gchar *str
,gint *pos
); void gebr_string_freeall (GString *string
); gint gebr_strv_indexof (const gchar **strv
,const gchar *value
); gint gebr_system (const gchar *cmd
,...
); GString * gebr_temp_directory_create (void
); void gebr_temp_directory_destroy (GString *path
); gboolean gebr_utf8_is_asc_alnum (const gchar *str
); gchar * gebr_utf8_strstr (const gchar *haystack
,const gchar *needle
); const gchar * gebr_validate_float (const gchar *text_value
,const gchar *min
,const gchar *max
); const gchar * gebr_validate_int (const gchar *text_value
,const gchar *min
,const gchar *max
); gboolean gebr_validate_path (const gchar *path
,gchar ***paths
,gchar **err_msg
); gboolean gebr_verify_address_without_username (const gchar *address
); gboolean gebr_verify_starting_slash (const gchar *string
);
void GEBR_LOCK_FILE (const gchar *path
);
Locks the file pointed by path
. You must call GEBR_UNLOCK_FILE()
when done.
typedef enum { TIME_NONE, TIME_MOMENTS_AGO, TIME_HOURS_AGO, TIME_DAYS_AGO, TIME_WEEKS_AGO, TIME_MONTHS_AGO, TIME_YEARS_AGO, TIME_N_TYPES, } TimesType;
gboolean g_key_file_has_key_woe (GKeyFile *key_file
,const gchar *group
,const gchar *key
);
gboolean gebr_append_filename_extension (GString *filename
,const gchar *extension
);
gchar * gebr_calculate_detailed_relative_time (GTimeVal *time1
,GTimeVal *time2
);
gint gebr_calculate_number_of_processors (gint total_nprocs
,gdouble aggressive
);
Calculate real number of processors will be used
|
Number of processors of a server |
|
Aggressive percentage (slider) |
gchar * gebr_calculate_relative_time (GTimeVal *time1
,GTimeVal *time2
,TimesType *type
,gdouble *delta
);
|
The first date to compare |
|
The second date to compare |
Returns : |
A message (string) of the relative time and NULL if time2 is older than time1. |
gchar * gebr_compute_diff_iso_times (const gchar *iso_time1
,const gchar *iso_time2
);
gchar * gebr_date_get_localized (const gchar *format
,const gchar *locale
);
#define gebr_directory_foreach_file_hyg(filename, directory, hygid)
gboolean gebr_g_key_file_has_key (GKeyFile *key_file
,const gchar *group
,const gchar *key
);
gboolean gebr_g_key_file_load_boolean_key (GKeyFile *key_file
,const gchar *group
,const gchar *key
,gboolean default_value
);
int gebr_g_key_file_load_int_key (GKeyFile *key_file
,const gchar *group
,const gchar *key
,int default_value
);
GString * gebr_g_key_file_load_string_key (GKeyFile *key_file
,const gchar *group
,const gchar *key
,const gchar *default_value
);
gboolean gebr_g_key_file_remove_key (GKeyFile *key_file
,const gchar *group
,const gchar *key
);
gchar * gebr_g_string_remove_accents (gchar *title
);
Replace accented characters on a string to non accented characters. If character is non ASCII, it is replaced to ""
|
the text with accents to be removed |
void gebr_g_string_replace (GString *string
,const gchar *oldtext
,const gchar *newtext
);
Replace each reference of oldtext in string with newtext. If newtext if NULL, then each reference of oldtext found is removed.
|
The string to with the text. |
|
The text to be replaced. |
|
The text to replace oldtext. |
void gebr_g_string_replace_first_ref (GString *string
,const gchar *oldtext
,const gchar *newtext
);
gboolean gebr_g_string_starts_with (GString *string
,const gchar *val
);
gchar * gebr_get_host_from_address (const gchar *address
);
Get substring after the first @ and before the first space In case there's no @, get the substring before the first space
const gchar * gebr_get_nfsid (void
);
Returns : |
the NFSID of the calling process domain. |
gchar * gebr_get_user_from_address (const gchar *address
);
Get substring before the first @ from address
.
In case there's no @, get the returns the local user.
GQueue * gebr_gqueue_push_tail_avoiding_duplicates (GQueue *queue
,const gchar *data
);
void gebr_gtk_bookmarks_add_paths (const gchar *filename
,const gchar *uri_prefix
,gchar ***paths
);
Add bookmarks on filename
file with uri_prefix
and base paths set on vector paths
,
and include suffix (GeBR) on name to identify
void gebr_gtk_bookmarks_remove_paths (const gchar *filename
,gchar ***paths
);
Remove bookmarks according paths
for filename
gboolean gebr_gzfile_get_contents (const gchar *filename
,GString *contents
,gchar **error
);
|
The name of gzipped file |
|
a GString to fill the contents of file |
|
an error message or NULL |
Returns : |
FALSE if have some error, TRUE otherwise |
gchar * gebr_lock_file (const gchar *path
,const gchar *content
);
If content
is NULL
, returns the content of path
. Otherwise, content
is
written in path
in a safe way.
const gchar * gebr_paths_get_value_by_key (const gchar ***paths
,const gchar *key
);
gboolean gebr_realpath_equal (const gchar *path1
,const gchar *path2
);
Compares if path1
and path2
resolves to the same file. The equality is
decided by calling g_stat()
on both of them and comparing their inode ids.
|
the first path |
|
the second path |
Returns : |
TRUE if path1 points to the same file/directory as path2 .
FALSE otherwise, including if one or both of then does not exists in the
file system. |
gchar * gebr_relativise_home_path (const gchar *path_string
,const gchar *mount_point
,const gchar *home
);
Substitute home
with the prefix HOME
pvector
is a vector of pair of strings, the first entry is an
alias and the second is an absolute path.
gchar * gebr_relativise_old_home_path (const gchar *path_string
);
Change $HOME of path_string
to <HOME>
gchar * gebr_relativise_path (const gchar *path_string
,const gchar *mount_point
,gchar ***pvector
);
Substitute path
with the longest prefix in pvector
.
pvector
is a vector of pair of strings, the first entry is an
alias and the second is an absolute path.
gchar * gebr_remove_path_prefix (const gchar *prefix
,const gchar *path
);
Remove prefix
from path
gchar * gebr_resolve_relative_path (const char *path
,gchar ***pvector
);
Transfors a relative path in absolute path
gboolean gebr_str_canonical_var_name (const gchar *keyword
,gchar **new_value
,GError **error
);
|
The keyword to be canonized. (not modified) |
|
Returns a new alocated string with the canonized value of keyword. |
|
A GError (not used until now) |
Returns : |
TRUE if everthing is ok. False otherwise. |
gchar * gebr_str_escape (const gchar *str
);
Escapes all backslashes and quotes in a string. It is based on glib's g_strescape.
|
the string to be escaped |
Returns : |
a newly allocated string. |
gchar * gebr_str_remove_trailing_zeros (gchar *str
);
Modifies str
inplace by removing trailing zeros.
Returns : |
The same str , but modified. |
void gebr_string_freeall (GString *string
);
Equivalent to calling g_string_free(string, TRUE).
gboolean gebr_utf8_is_asc_alnum (const gchar *str
);
|
The string to check |
Returns : |
TRUE if str is ASC and alpha-numerical. |
gchar * gebr_utf8_strstr (const gchar *haystack
,const gchar *needle
);
Searches for needle
in haystack
and returns a pointer to the begging of
the substring or NULL
if it was not found.
const gchar * gebr_validate_float (const gchar *text_value
,const gchar *min
,const gchar *max
);
const gchar * gebr_validate_int (const gchar *text_value
,const gchar *min
,const gchar *max
);
gboolean gebr_validate_path (const gchar *path
,gchar ***paths
,gchar **err_msg
);
gboolean gebr_verify_address_without_username
(const gchar *address
);