annotate audacious/util.h @ 916:4be0046a09e4 trunk

[svn] - more work here
author nenolod
date Wed, 05 Apr 2006 11:07:10 -0700
parents 2d8234ea45e8
children 4be4d74db123
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
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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
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
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117 GtkWidget *make_filebrowser(const gchar * title,
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 /* Not sure this should be here? */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121 char *mkdtemp(char *path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123 typedef struct {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124 gint x;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125 gint y;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
126 } MenuPos;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
127
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
128
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
129 #endif