annotate audacious/util.h @ 1777:17e38b5c8e2f trunk

[svn] - support for the [skin.hints:mainwinTextWidth] property.
author nenolod
date Wed, 04 Oct 2006 02:22:04 -0700
parents 636e7651c09d
children aceb472cce6c
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
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10 * (at your option) any later version.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15 * GNU General Public License for more details.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
1459
705d4c089fce [svn] Fix postal code.
chainsaw
parents: 1458
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 #ifndef UTIL_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23 #define UTIL_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25 #ifdef HAVE_CONFIG_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26 # include "config.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29 #include <glib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30 #include <gtk/gtk.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31
1737
73f4c2c89c23 [svn] - lets be C++ friendly
nenolod
parents: 1734
diff changeset
32 G_BEGIN_DECLS
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 #define NO_PLAY_BUTTON FALSE
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35 #define PLAY_BUTTON TRUE
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 #define SWAP(a, b) { a^=b; b^=a; a^=b; }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40 typedef gboolean(*DirForeachFunc) (const gchar * path,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41 const gchar * basename,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42 gpointer user_data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
43
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45 gchar *escape_shell_chars(const gchar * string);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47 gchar *find_file_recursively(const gchar * dirname, const gchar * file);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48 void del_directory(const gchar * dirname);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49 gboolean dir_foreach(const gchar * path, DirForeachFunc function,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50 gpointer user_data, GError ** error);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 gchar *read_ini_string(const gchar * filename, const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53 const gchar * key);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 GArray *read_ini_array(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
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57 GArray *string_to_garray(const gchar * str);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 void glist_movedown(GList * list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60 void glist_moveup(GList * list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62 void util_item_factory_popup(GtkItemFactory * ifactory, guint x, guint y,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63 guint mouse_button, guint32 time);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 void util_item_factory_popup_with_data(GtkItemFactory * ifactory,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65 gpointer data,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66 GtkDestroyNotify destroy, guint x,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67 guint y, guint mouse_button,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68 guint32 time);
86
2d8234ea45e8 [svn] - Add a few things to the main menu.
nenolod
parents: 0
diff changeset
69 GtkWidget *util_add_url_dialog_new(const gchar * caption, GCallback ok_func,
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70 GCallback enqueue_func);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 void util_menu_position(GtkMenu * menu, gint * x, gint * y,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72 gboolean * push_in, gpointer data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74 void util_run_filebrowser(gboolean clear_pl_on_ok);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75 gboolean util_filechooser_is_dir(GtkFileChooser * filesel);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77 GdkFont *util_font_load(const gchar * name);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78 void util_set_cursor(GtkWidget * window);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79 gboolean text_get_extents(const gchar * fontname, const gchar * text,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80 gint * width, gint * height, gint * ascent,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81 gint * descent);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 gboolean file_is_archive(const gchar * filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84 gchar *archive_decompress(const gchar * path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85 gchar *archive_basename(const gchar * path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87 guint gint_count_digits(gint n);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
88
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
89 gchar *convert_title_text(gchar * text);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91 gchar *str_append(gchar * str, const gchar * add_str);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 gchar *str_replace(gchar * str, gchar * new_str);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93 void str_replace_in(gchar ** str, gchar * new_str);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95 gboolean str_has_prefix_nocase(const gchar * str, const gchar * prefix);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96 gboolean str_has_suffix_nocase(const gchar * str, const gchar * suffix);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97 gboolean str_has_suffixes_nocase(const gchar * str, gchar * const *suffixes);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98 const gchar *str_skip_chars(const gchar * str, const gchar * chars);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
99
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100 gchar *filename_to_utf8(const gchar * filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 gchar *str_to_utf8(const gchar * str);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102 gchar *str_to_utf8_fallback(const gchar * str);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
103
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
104 #if ENABLE_NLS
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
105 gchar *bmp_menu_translate(const gchar * path, gpointer func_data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
106 #else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
107 # define bmp_menu_translate NULL
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
108 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
110 GtkItemFactory *create_menu(GtkItemFactoryEntry *entries,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
111 guint n_entries,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
112 GtkAccelGroup *accel);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114 void make_submenu(GtkItemFactory *menu,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
115 const gchar *item_path,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
116 GtkItemFactory *submenu);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents: 1649
diff changeset
118 GtkWidget *make_filebrowser(const gchar * title,
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119 gboolean save);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121 /* Not sure this should be here? */
1750
636e7651c09d [svn] - avoid conflict of mkdtemp() declaration between util.h and stdlib.h.
yaz
parents: 1737
diff changeset
122 #ifndef HAVE_MKDTEMP
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123 char *mkdtemp(char *path);
1750
636e7651c09d [svn] - avoid conflict of mkdtemp() declaration between util.h and stdlib.h.
yaz
parents: 1737
diff changeset
124 #endif
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
126 typedef struct {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
127 gint x;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
128 gint y;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
129 } MenuPos;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
130
1105
4be4d74db123 [svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents: 86
diff changeset
131 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
132 gsize *arg_bytes_read, gsize *arg_bytes_write, GError **arg_error);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
133
1734
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
134 /* XMMS names */
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
135
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
136 #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
137 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
138
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
139 #define bmp_usleep(usec) \
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
140 xmms_usleep(usec)
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
141
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
142 #define bmp_check_realtime_priority() \
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
143 xmms_check_realtime_priority()
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
144
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
145 GtkWidget *xmms_show_message(const gchar * title, const gchar * text,
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
146 const gchar * button_text, gboolean modal,
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
147 GtkSignalFunc button_action,
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
148 gpointer action_data);
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
149 gboolean xmms_check_realtime_priority(void);
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
150 void xmms_usleep(gint usec);
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
151
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
152 G_END_DECLS
43c197f55dda [svn] - merge libaudacious (public) and audacious util APIs
nenolod
parents: 1653
diff changeset
153
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
154 #endif