/* vim: set ai et ts=4 sw=4: */ #ifndef __util_h__ #define __util_h__ #include #include //@@backport{{ gchar * la_utf8_regularize(const gchar * str); gchar *la_utf8_recover(const gchar * str, const gchar * codeset, gint endurance); gchar *la_str_to_utf8_with_fallback(const gchar * str, GSList * fallback_codesets, gchar ** used_codeset); gchar *la_str_to_utf8(const gchar * str); gchar *la_ltostr(gchar * buf, gint length, glong l); gchar *la_ltostr_new(glong l); glong la_strtol(const gchar * str, glong fallback); gchar *la_btostr(gchar * buf, gint length, gboolean b); gchar *la_btostr_new(gboolean b); gboolean la_strtob(const gchar * str, gboolean fallback); //@@}} #define LA_STR_IS_EMPTY(str) (((str) == NULL) || ((*(str)) == '\0')) #define LA_STR_IS_NOT_EMPTY(str) (((str) != NULL) && ((*(str)) != '\0')) gchar* find_pixmap_file(const gchar* filename); GtkWidget* create_pixmap(const gchar* filename); GtkWidget* create_pixmap_with_size(const gchar* filename, gint width, gint height); GdkPixbuf* create_pixbuf(const gchar* filename); GdkPixbuf* create_pixbuf_with_size(const gchar* filename, gint width, gint height); gboolean str_has_suffix(const gchar* str, const gchar* suffix, gboolean case_sensitive); #define str_has_suffix_case(str, suffix) str_has_suffix((str), (suffix), TRUE) #define str_has_suffix_nocase(str, suffix) str_has_suffix((str), (suffix), FALSE) gint strfindv(const gchar* str, const gchar** str_array, gboolean case_sensitive); #define strfindv_case(str, str_array) strfindv((str), (str_array), TRUE) #define strfindv_nocase(str, str_array) strfindv((str), (str_array), FALSE) gchar* format_size_str(gchar* buf, gint length, gulong size); gchar* format_time_str(gchar* buf, gint length, gulong sec); gulong file_length(const gchar* str); gchar* filename_to_utf8(const gchar* str); gchar* utf8_to_filename(const gchar* str); gchar* locale_to_utf8(const gchar* str); gchar* utf8_to_locale(const gchar* str); gchar* escape_str(const gchar* str); gint show_message_box(GtkWindow* parent, GtkMessageType type, GtkButtonsType buttons, const gchar* message); GList* array_to_list(gpointer* array); #define NVL(str) ((str) ? (str) : "") #define NVL2(str,def) ((str) ? (str) : (def)) #endif /*util.h*/