annotate audacious/util.h @ 2257:af716dc0cdb9 trunk

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