2313
|
1 /* Audacious - Cross-platform multimedia player
|
|
2 * Copyright (C) 2005-2007 Audacious development team
|
|
3 *
|
|
4 * Based on BMP:
|
|
5 * Copyright (C) 2003-2004 BMP development team
|
|
6 *
|
|
7 * Based on XMMS:
|
|
8 * Copyright (C) 1998-2003 XMMS development team
|
|
9 *
|
|
10 * This program is free software; you can redistribute it and/or modify
|
|
11 * it under the terms of the GNU General Public License as published by
|
|
12 * the Free Software Foundation; under version 2 of the License.
|
|
13 *
|
|
14 * This program is distributed in the hope that it will be useful,
|
|
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17 * GNU General Public License for more details.
|
|
18 *
|
|
19 * You should have received a copy of the GNU General Public License
|
|
20 * along with this program; if not, write to the Free Software
|
|
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
22 */
|
|
23
|
|
24 #ifndef UTIL_H
|
|
25 #define UTIL_H
|
|
26
|
|
27 #ifdef HAVE_CONFIG_H
|
|
28 # include "config.h"
|
|
29 #endif
|
|
30
|
|
31 #include <glib.h>
|
|
32 #include <gtk/gtk.h>
|
|
33
|
|
34 G_BEGIN_DECLS
|
|
35
|
|
36 #define NO_PLAY_BUTTON FALSE
|
|
37 #define PLAY_BUTTON TRUE
|
|
38
|
|
39 #define SWAP(a, b) { a^=b; b^=a; a^=b; }
|
|
40
|
|
41
|
|
42 typedef gboolean(*DirForeachFunc) (const gchar * path,
|
|
43 const gchar * basename,
|
|
44 gpointer user_data);
|
|
45
|
|
46
|
|
47 gchar *escape_shell_chars(const gchar * string);
|
|
48
|
|
49 gchar *find_file_recursively(const gchar * dirname, const gchar * file);
|
|
50 void del_directory(const gchar * dirname);
|
|
51 gboolean dir_foreach(const gchar * path, DirForeachFunc function,
|
|
52 gpointer user_data, GError ** error);
|
|
53
|
|
54 gchar *read_ini_string(const gchar * filename, const gchar * section,
|
|
55 const gchar * key);
|
|
56 GArray *read_ini_array(const gchar * filename, const gchar * section,
|
|
57 const gchar * key);
|
|
58
|
|
59 GArray *string_to_garray(const gchar * str);
|
|
60
|
|
61 void glist_movedown(GList * list);
|
|
62 void glist_moveup(GList * list);
|
|
63
|
|
64 GtkWidget *util_add_url_dialog_new(const gchar * caption, GCallback ok_func,
|
|
65 GCallback enqueue_func);
|
|
66 void util_menu_position(GtkMenu * menu, gint * x, gint * y,
|
|
67 gboolean * push_in, gpointer data);
|
|
68
|
|
69 void util_run_filebrowser(gboolean clear_pl_on_ok);
|
|
70 gboolean util_filechooser_is_dir(GtkFileChooser * filesel);
|
|
71
|
|
72 GdkFont *util_font_load(const gchar * name);
|
|
73 void util_set_cursor(GtkWidget * window);
|
|
74 gboolean text_get_extents(const gchar * fontname, const gchar * text,
|
|
75 gint * width, gint * height, gint * ascent,
|
|
76 gint * descent);
|
|
77
|
|
78 gboolean file_is_archive(const gchar * filename);
|
|
79 gchar *archive_decompress(const gchar * path);
|
|
80 gchar *archive_basename(const gchar * path);
|
|
81
|
|
82 guint gint_count_digits(gint n);
|
|
83
|
|
84 gchar *convert_title_text(gchar * text);
|
|
85
|
|
86 gchar *str_append(gchar * str, const gchar * add_str);
|
|
87 gchar *str_replace(gchar * str, gchar * new_str);
|
|
88 void str_replace_in(gchar ** str, gchar * new_str);
|
|
89
|
|
90 gboolean str_has_prefix_nocase(const gchar * str, const gchar * prefix);
|
|
91 gboolean str_has_suffix_nocase(const gchar * str, const gchar * suffix);
|
|
92 gboolean str_has_suffixes_nocase(const gchar * str, gchar * const *suffixes);
|
|
93 const gchar *str_skip_chars(const gchar * str, const gchar * chars);
|
|
94
|
|
95 gchar *filename_to_utf8(const gchar * filename);
|
|
96 gchar *str_to_utf8(const gchar * str);
|
|
97 gchar *str_to_utf8_fallback(const gchar * str);
|
|
98
|
|
99 #if ENABLE_NLS
|
|
100 gchar *bmp_menu_translate(const gchar * path, gpointer func_data);
|
|
101 #else
|
|
102 # define bmp_menu_translate NULL
|
|
103 #endif
|
|
104
|
|
105 GtkWidget *make_filebrowser(const gchar * title,
|
|
106 gboolean save);
|
|
107
|
|
108 typedef struct {
|
|
109 gint x;
|
|
110 gint y;
|
|
111 } MenuPos;
|
|
112
|
|
113 gchar *chardet_to_utf8(const gchar *str, gssize len,
|
|
114 gsize *arg_bytes_read, gsize *arg_bytes_write, GError **arg_error);
|
|
115
|
|
116 GdkPixmap *audacious_pixmap_resize(GdkWindow *src, GdkGC *src_gc, GdkPixmap *in, gint width, gint height);
|
|
117
|
|
118 /* XMMS names */
|
|
119
|
|
120 #define bmp_info_dialog(title, text, button_text, model, button_action, action_data) \
|
|
121 xmms_show_message(title, text, button_text, model, button_action, action_data)
|
|
122
|
|
123 #define bmp_usleep(usec) \
|
|
124 xmms_usleep(usec)
|
|
125
|
|
126 #define bmp_check_realtime_priority() \
|
|
127 xmms_check_realtime_priority()
|
|
128
|
|
129 GtkWidget *xmms_show_message(const gchar * title, const gchar * text,
|
|
130 const gchar * button_text, gboolean modal,
|
|
131 GtkSignalFunc button_action,
|
|
132 gpointer action_data);
|
|
133 gboolean xmms_check_realtime_priority(void);
|
|
134 void xmms_usleep(gint usec);
|
|
135
|
|
136 GdkImage *create_dblsize_image(GdkImage * img);
|
|
137
|
|
138 gchar *xmms_urldecode_path(const gchar * encoded_path);
|
|
139
|
|
140 GdkPixbuf *audacious_create_colorized_pixbuf(GdkPixbuf *src, gint red, gint green, gint blue);
|
|
141
|
|
142 G_END_DECLS
|
|
143
|
|
144 #endif
|