0
|
1 /* BMP - Cross-platform multimedia player
|
|
2 * Copyright (C) 2003-2004 BMP development team.
|
|
3 *
|
|
4 * Based on XMMS:
|
|
5 * Copyright (C) 1998-2003 XMMS development team.
|
|
6 *
|
|
7 * This program is free software; you can redistribute it and/or modify
|
|
8 * it under the terms of the GNU General Public License as published by
|
|
9 * the Free Software Foundation; either version 2 of the License, or
|
|
10 * (at your option) any later version.
|
|
11 *
|
|
12 * This program is distributed in the hope that it will be useful,
|
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 * GNU General Public License for more details.
|
|
16 *
|
|
17 * You should have received a copy of the GNU General Public License
|
|
18 * along with this program; if not, write to the Free Software
|
|
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
20 */
|
|
21
|
|
22 #ifndef UTIL_H
|
|
23 #define UTIL_H
|
|
24
|
|
25 #ifdef HAVE_CONFIG_H
|
|
26 # include "config.h"
|
|
27 #endif
|
|
28
|
|
29 #include <glib.h>
|
|
30 #include <gtk/gtk.h>
|
|
31
|
|
32
|
|
33 #define NO_PLAY_BUTTON FALSE
|
|
34 #define PLAY_BUTTON TRUE
|
|
35
|
|
36 #define SWAP(a, b) { a^=b; b^=a; a^=b; }
|
|
37
|
|
38
|
|
39 typedef gboolean(*DirForeachFunc) (const gchar * path,
|
|
40 const gchar * basename,
|
|
41 gpointer user_data);
|
|
42
|
|
43
|
|
44 gchar *escape_shell_chars(const gchar * string);
|
|
45
|
|
46 gchar *find_file_recursively(const gchar * dirname, const gchar * file);
|
|
47 void del_directory(const gchar * dirname);
|
|
48 gboolean dir_foreach(const gchar * path, DirForeachFunc function,
|
|
49 gpointer user_data, GError ** error);
|
|
50
|
|
51 gchar *read_ini_string(const gchar * filename, const gchar * section,
|
|
52 const gchar * key);
|
|
53 GArray *read_ini_array(const gchar * filename, const gchar * section,
|
|
54 const gchar * key);
|
|
55
|
|
56 GArray *string_to_garray(const gchar * str);
|
|
57
|
|
58 void glist_movedown(GList * list);
|
|
59 void glist_moveup(GList * list);
|
|
60
|
|
61 void util_item_factory_popup(GtkItemFactory * ifactory, guint x, guint y,
|
|
62 guint mouse_button, guint32 time);
|
|
63 void util_item_factory_popup_with_data(GtkItemFactory * ifactory,
|
|
64 gpointer data,
|
|
65 GtkDestroyNotify destroy, guint x,
|
|
66 guint y, guint mouse_button,
|
|
67 guint32 time);
|
86
|
68 GtkWidget *util_add_url_dialog_new(const gchar * caption, GCallback ok_func,
|
0
|
69 GCallback enqueue_func);
|
|
70 void util_menu_position(GtkMenu * menu, gint * x, gint * y,
|
|
71 gboolean * push_in, gpointer data);
|
|
72
|
|
73 void util_run_filebrowser(gboolean clear_pl_on_ok);
|
|
74 gboolean util_filechooser_is_dir(GtkFileChooser * filesel);
|
|
75
|
|
76 GdkFont *util_font_load(const gchar * name);
|
|
77 void util_set_cursor(GtkWidget * window);
|
|
78 gboolean text_get_extents(const gchar * fontname, const gchar * text,
|
|
79 gint * width, gint * height, gint * ascent,
|
|
80 gint * descent);
|
|
81
|
|
82 gboolean file_is_archive(const gchar * filename);
|
|
83 gchar *archive_decompress(const gchar * path);
|
|
84 gchar *archive_basename(const gchar * path);
|
|
85
|
|
86 guint gint_count_digits(gint n);
|
|
87
|
|
88 gchar *convert_title_text(gchar * text);
|
|
89
|
|
90 gchar *str_append(gchar * str, const gchar * add_str);
|
|
91 gchar *str_replace(gchar * str, gchar * new_str);
|
|
92 void str_replace_in(gchar ** str, gchar * new_str);
|
|
93
|
|
94 gboolean str_has_prefix_nocase(const gchar * str, const gchar * prefix);
|
|
95 gboolean str_has_suffix_nocase(const gchar * str, const gchar * suffix);
|
|
96 gboolean str_has_suffixes_nocase(const gchar * str, gchar * const *suffixes);
|
|
97 const gchar *str_skip_chars(const gchar * str, const gchar * chars);
|
|
98
|
|
99 gchar *filename_to_utf8(const gchar * filename);
|
|
100 gchar *str_to_utf8(const gchar * str);
|
|
101 gchar *str_to_utf8_fallback(const gchar * str);
|
|
102
|
|
103 #if ENABLE_NLS
|
|
104 gchar *bmp_menu_translate(const gchar * path, gpointer func_data);
|
|
105 #else
|
|
106 # define bmp_menu_translate NULL
|
|
107 #endif
|
|
108
|
|
109 GtkItemFactory *create_menu(GtkItemFactoryEntry *entries,
|
|
110 guint n_entries,
|
|
111 GtkAccelGroup *accel);
|
|
112
|
|
113 void make_submenu(GtkItemFactory *menu,
|
|
114 const gchar *item_path,
|
|
115 GtkItemFactory *submenu);
|
|
116
|
|
117 GtkWidget *make_filebrowser(const gchar * title,
|
|
118 gboolean save);
|
|
119
|
|
120 /* Not sure this should be here? */
|
|
121 char *mkdtemp(char *path);
|
|
122
|
|
123 typedef struct {
|
|
124 gint x;
|
|
125 gint y;
|
|
126 } MenuPos;
|
|
127
|
|
128
|
|
129 #endif
|