2 * Copyright (c) 2007, 2008, 2009, Czirkos Zoltan <cirix@fw.hu>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 /*******************************************
26 typedef struct _gd_error_message
{
31 extern GList
*gd_errors
;
34 void gd_error_set_context(const char *format
, ...);
35 void gd_clear_error_flag();
36 void gd_install_log_handler();
37 gboolean
gd_has_new_error();
38 void gd_clear_errors();
48 /* returns a static string which contains the utf8 representation of the filename in system encoding*/
49 const char *gd_filename_to_utf8(const char *filename
);
51 /* tries to find a file in the gdash installation and returns a path (owned by this function, not to be g_free()d) */
52 const char *gd_find_file(const char *filename
);
54 /* wrap a text to specified width */
55 char *gd_wrap_text(const char *orig
, int width
);
56 /* count lines in text (number of \n's + 1) */
57 int gd_lines_in_text(const char *text
);
59 /* return current date in 2008-12-04 format */
60 const char *gd_get_current_date();
61 /* return current date in 2008-12-04 12:34 format */
62 const char *gd_get_current_date_time();
63 /* clamp integer into range */
64 int gd_clamp(int val
, int min
, int max
);