annotate audacious/util.h @ 2184:7d40f0a290b9 trunk

[svn] - break out string-related functions from util.c
author nenolod
date Wed, 20 Dec 2006 06:45:56 -0800
parents f18a5b617c34
children c108a98794b1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1 /* BMP - Cross-platform multimedia player
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
2 * Copyright (C) 2003-2004 BMP development team.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
3 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
4 * Based on XMMS:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
5 * Copyright (C) 1998-2003 XMMS development team.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
2105
f18a5b617c34 [svn] - move to GPLv2-only. Based on my interpretation of the license, we are
nenolod
parents: 2074
diff changeset
9 * the Free Software Foundation; under version 2 of the License.
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 * GNU General Public License for more details.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
1459
705d4c089fce [svn] Fix postal code.
chainsaw
parents: 1458
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21 #ifndef UTIL_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 #define UTIL_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25 # include "config.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28 #include <glib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29 #include <gtk/gtk.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30
1737
73f4c2c89c23 [svn] - lets be C++ friendly
nenolod
parents: 1734
diff changeset
31 G_BEGIN_DECLS
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33 #define NO_PLAY_BUTTON FALSE
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 #define PLAY_BUTTON TRUE
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36 #define SWAP(a, b) { a^=b; b^=a; a^=b; }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39 typedef gboolean(*DirForeachFunc) (const gchar * path,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40 const gchar * basename,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41 gpointer user_data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
43
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44 gchar *escape_shell_chars(const gchar * string);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46 gchar *find_file_recursively(const gchar * dirname, const gchar * file);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47 void del_directory(const gchar * dirname);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48 gboolean dir_foreach(const gchar * path, DirForeachFunc function,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49 gpointer user_data, GError ** error);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51 gchar *read_ini_string(const gchar * filename, const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 const gchar * key);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53 GArray *read_ini_array(const gchar * filename, const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 const gchar * key);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56 GArray *string_to_garray(const gchar * str);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58 void glist_movedown(GList * list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 void glist_moveup(GList * list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61 void util_item_factory_popup(GtkItemFactory * ifactory, guint x, guint y,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62 guint mouse_button, guint32 time);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63 void util_item_factory_popup_with_data(GtkItemFactory * ifactory,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 gpointer data,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65 GtkDestroyNotify destroy, guint x,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66 guint y, guint mouse_button,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67 guint32 time);
86
2d8234ea45e8 [svn] - Add a few things to the main menu.
nenolod
parents: 0
diff changeset
68 GtkWidget *util_add_url_dialog_new(const gchar * caption, GCallback ok_func,
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 GCallback enqueue_func);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70 void util_menu_position(GtkMenu * menu, gint * x, gint * y,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 gboolean * push_in, gpointer data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73 void util_run_filebrowser(gboolean clear_pl_on_ok);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74 gboolean util_filechooser_is_dir(GtkFileChooser * filesel);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76 GdkFont *util_font_load(const gchar * name);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77 void util_set_cursor(GtkWidget * window);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78 gboolean text_get_extents(const gchar * fontname, const gchar * text,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79 gint * width, gint * height, gint * ascent,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80 gint * descent);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82 gboolean file_is_archive(const gchar * filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 gchar *archive_decompress(const gchar * path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84 gchar *archive_basename(const gchar * path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86 guint gint_count_digits(gint n);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
88 gchar *convert_title_text(gchar * text);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
89
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90 gchar *str_append(gchar * str, const gchar * add_str);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91 gchar *str_replace(gchar * str, gchar * new_str);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 void str_replace_in(gchar ** str, gchar * new_str);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94 gboolean str_has_prefix_nocase(const gchar * str, const gchar * prefix);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95 gboolean str_has_suffix_nocase(const gchar * str, const gchar * suffix);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96 gboolean str_has_suffixes_nocase(const gchar * str, gchar * const *suffixes);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97 const gchar *str_skip_chars(const gchar * str, const gchar * chars);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
99 gchar *filename_to_utf8(const gchar * filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100 gchar *str_to_utf8(const gchar * str);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 gchar *str_to_utf8_fallback(const gchar * str);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
103 #if ENABLE_NLS
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
104 gchar *bmp_menu_translate(const gchar * path, gpointer func_data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
105 #else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
106 # define bmp_menu_translate NULL
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
107 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
108
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109 GtkItemFactory *create_menu(GtkItemFactoryEntry *entries,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
110 guint n_entries,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
111 GtkAccelGroup *accel);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
112
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113 void make_submenu(GtkItemFactory *menu,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114 const gchar *item_path,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
115 GtkItemFactory *submenu);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
116
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents: 1649
diff changeset
117 GtkWidget *make_filebrowser(const gchar * title,
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
118 gboolean save);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120 typedef struct {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121 gint x;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122 gint y;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123 } MenuPos;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124
1105
4be4d74db123 [svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents: 86
diff changeset
125 gchar *chardet_to_utf8(const gchar *str, gssize len,
4be4d74db123 [svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents: 86
diff changeset
126 gsize *arg_bytes_read, gsize *arg_bytes_write, GError **arg_error);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
127
1851
aceb472cce6c [svn] - add audacious_pixmap_resize() for resizing a skin pixmap on demand.
nenolod
parents: 1750
diff changeset
128 GdkPixmap *audacious_pixmap_resize(GdkWindow *src, GdkGC *src_gc, GdkPixmap *in, gint width, gint height);
aceb472cce6c [svn] - add audacious_pixmap_resize() for resizing a skin pixmap on demand.
nenolod
parents: 1750
diff changeset
129
1734
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
130 /* XMMS names */
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
131
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
132 #define bmp_info_dialog(title, text, button_text, model, button_action, action_data) \
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
133 xmms_show_message(title, text, button_text, model, button_action, action_data)
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
134
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
135 #define bmp_usleep(usec) \
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
136 xmms_usleep(usec)
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
137
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
138 #define bmp_check_realtime_priority() \
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
139 xmms_check_realtime_priority()
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
140
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
141 GtkWidget *xmms_show_message(const gchar * title, const gchar * text,
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
142 const gchar * button_text, gboolean modal,
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
143 GtkSignalFunc button_action,
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
144 gpointer action_data);
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
145 gboolean xmms_check_realtime_priority(void);
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
146 void xmms_usleep(gint usec);
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
147
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1890
diff changeset
148 GdkImage *create_dblsize_image(GdkImage * img);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1890
diff changeset
149
2074
c725daec3849 [svn] - move xmms_urldecode_path() back into main binary
nenolod
parents: 1938
diff changeset
150 gchar *xmms_urldecode_path(const gchar * encoded_path);
c725daec3849 [svn] - move xmms_urldecode_path() back into main binary
nenolod
parents: 1938
diff changeset
151
c725daec3849 [svn] - move xmms_urldecode_path() back into main binary
nenolod
parents: 1938
diff changeset
152
1734
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
153 G_END_DECLS
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
154
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
155 #endif