annotate audacious/skinwin.c @ 1810:df23110701d0 trunk

[svn] - load skins before creating the UI
author nenolod
date Wed, 04 Oct 2006 23:11:06 -0700
parents 6e477dd65024
children f18a5b617c34
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 #ifdef HAVE_CONFIG_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23 # include "config.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26 #include "skinwin.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28 #include <glib.h>
452
623391b6463b [svn] Make "Unarchived Winamp 2.x skin" &c translatable.
nenolod
parents: 451
diff changeset
29 #include <glib/gi18n.h>
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30 #include <gtk/gtk.h>
1640
6e477dd65024 [svn] - gtkquartz compatibility, pass 1
nenolod
parents: 1547
diff changeset
31
6e477dd65024 [svn] - gtkquartz compatibility, pass 1
nenolod
parents: 1547
diff changeset
32 #include "platform/smartinclude.h"
6e477dd65024 [svn] - gtkquartz compatibility, pass 1
nenolod
parents: 1547
diff changeset
33
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 #include <stdlib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35 #include <string.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 #include "main.h"
1547
697a073fd4f5 [svn] - dependency cleanup part 2
nenolod
parents: 1541
diff changeset
38 #include "widgets/widgetcore.h"
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39 #include "util.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40
653
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
41 #define EXTENSION_TARGETS 7
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
42
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
43 static gchar *ext_targets[EXTENSION_TARGETS] = { "bmp", "xpm", "png", "svg",
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
44 "gif", "jpg", "jpeg" };
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46 #define THUMBNAIL_WIDTH 90
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47 #define THUMBNAIL_HEIGHT 40
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50 enum SkinViewCols {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51 SKIN_VIEW_COL_PREVIEW,
453
257a8d2047fb [svn] added a new column in the treeview model to store the skin name
giacomo
parents: 452
diff changeset
52 SKIN_VIEW_COL_FORMATTEDNAME,
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53 SKIN_VIEW_COL_NAME,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 SKIN_VIEW_N_COLS
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58 GList *skinlist = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62 static gchar *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63 get_thumbnail_filename(const gchar * path)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65 gchar *basename, *pngname, *thumbname;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67 g_return_val_if_fail(path != NULL, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 basename = g_path_get_basename(path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70 pngname = g_strconcat(basename, ".png", NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72 thumbname = g_build_filename(bmp_paths[BMP_PATH_SKIN_THUMB_DIR],
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73 pngname, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75 g_free(basename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76 g_free(pngname);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78 return thumbname;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82 static GdkPixbuf *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 skin_get_preview(const gchar * path)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85 GdkPixbuf *preview = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86 gchar *dec_path, *preview_path;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87 gboolean is_archive = FALSE;
653
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
88 gint i = 0;
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
89 gchar buf[60]; /* gives us lots of room */
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90
653
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
91 if (file_is_archive(path))
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
92 {
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93 if (!(dec_path = archive_decompress(path)))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94 return NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96 is_archive = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97 }
653
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
98 else
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
99 {
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100 dec_path = g_strdup(path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102
653
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
103 for (i = 0; i < EXTENSION_TARGETS; i++)
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
104 {
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
105 sprintf(buf, "main.%s", ext_targets[i]);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
106
674
9e553cf3d756 [svn] - Really fix preview generation for PNG/SVG based skins.
nenolod
parents: 653
diff changeset
107 if ((preview_path = find_file_recursively(dec_path, buf)) != NULL)
653
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
108 break;
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
109 }
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
110
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
111 if (preview_path)
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 642
diff changeset
112 {
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113 preview = gdk_pixbuf_new_from_file(preview_path, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114 g_free(preview_path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
115 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
116
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117 if (is_archive)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
118 del_directory(dec_path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120 g_free(dec_path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122 return preview;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
126 static GdkPixbuf *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
127 skin_get_thumbnail(const gchar * path)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
128 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
129 GdkPixbuf *scaled = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
130 GdkPixbuf *preview;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
131 gchar *thumbname;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
132
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
133 g_return_val_if_fail(path != NULL, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
134
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
135 if (g_str_has_suffix(path, BMP_SKIN_THUMB_DIR_BASENAME))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
136 return NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
137
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
138 thumbname = get_thumbnail_filename(path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
139
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
140 if (g_file_test(thumbname, G_FILE_TEST_EXISTS)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
141 scaled = gdk_pixbuf_new_from_file(thumbname, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
142 g_free(thumbname);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
143 return scaled;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
144 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
145
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
146 if (!(preview = skin_get_preview(path))) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
147 g_free(thumbname);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
148 return NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
149 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
150
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
151 scaled = gdk_pixbuf_scale_simple(preview,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
152 THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
153 GDK_INTERP_BILINEAR);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
154 g_object_unref(preview);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
155
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
156 gdk_pixbuf_save(scaled, thumbname, "png", NULL, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
157 g_free(thumbname);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
158
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
159 return scaled;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
160 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
161
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
162 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
163 skinlist_add(const gchar * filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
164 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
165 SkinNode *node;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
166 gchar *basename;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
167
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
168 g_return_if_fail(filename != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
169
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
170 node = g_new0(SkinNode, 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
171 node->path = g_strdup(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
172
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
173 basename = g_path_get_basename(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
174
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
175 if (file_is_archive(filename)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
176 node->name = archive_basename(basename);
452
623391b6463b [svn] Make "Unarchived Winamp 2.x skin" &c translatable.
nenolod
parents: 451
diff changeset
177 node->desc = _("Archived Winamp 2.x skin");
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
178 g_free(basename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
179 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
180 else {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
181 node->name = basename;
452
623391b6463b [svn] Make "Unarchived Winamp 2.x skin" &c translatable.
nenolod
parents: 451
diff changeset
182 node->desc = _("Unarchived Winamp 2.x skin");
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
183 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
184
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
185 skinlist = g_list_prepend(skinlist, node);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
186 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
187
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
188 static gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
189 scan_skindir_func(const gchar * path, const gchar * basename, gpointer data)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
190 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
191 if (g_file_test(path, G_FILE_TEST_IS_REGULAR)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
192 if (file_is_archive(path)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
193 skinlist_add(path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
194 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
195 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
196 else if (g_file_test(path, G_FILE_TEST_IS_DIR)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
197 skinlist_add(path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
198 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
199
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
200 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
201 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
202
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
203 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
204 scan_skindir(const gchar * path)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
205 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
206 GError *error = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
207
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
208 g_return_if_fail(path != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
209
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
210 if (path[0] == '.')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
211 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
212
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
213 if (!dir_foreach(path, scan_skindir_func, NULL, &error)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
214 g_warning("Failed to open directory (%s): %s", path, error->message);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
215 g_error_free(error);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
216 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
217 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
218 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
219
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
220 static gint
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
221 skinlist_compare_func(gconstpointer a, gconstpointer b)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
222 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
223 g_return_val_if_fail(a != NULL && SKIN_NODE(a)->name != NULL, 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
224 g_return_val_if_fail(b != NULL && SKIN_NODE(b)->name != NULL, 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
225 return strcasecmp(SKIN_NODE(a)->name, SKIN_NODE(b)->name);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
226 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
227
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
228 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
229 skin_free_func(gpointer data)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
230 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
231 g_return_if_fail(data != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
232 g_free(SKIN_NODE(data)->name);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
233 g_free(SKIN_NODE(data)->path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
234 g_free(data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
235 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
236
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
237
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
238 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
239 skinlist_clear(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
240 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
241 if (!skinlist)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
242 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
243
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
244 g_list_foreach(skinlist, (GFunc) skin_free_func, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
245 g_list_free(skinlist);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
246 skinlist = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
247 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
248
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
249 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
250 skinlist_update(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
251 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
252 gchar *skinsdir;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
253
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
254 skinlist_clear();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
255
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
256 scan_skindir(bmp_paths[BMP_PATH_USER_SKIN_DIR]);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
257 scan_skindir(DATA_DIR G_DIR_SEPARATOR_S BMP_SKIN_DIR_BASENAME);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
258
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
259 skinsdir = getenv("SKINSDIR");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
260 if (skinsdir) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
261 gchar **dir_list = g_strsplit(skinsdir, ":", 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
262 gchar **dir;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
263
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
264 for (dir = dir_list; *dir; dir++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
265 scan_skindir(*dir);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
266 g_strfreev(dir_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
267 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
268
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
269 skinlist = g_list_sort(skinlist, skinlist_compare_func);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
270
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
271 g_assert(skinlist != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
272 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
273
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
274 void
962
a341792533a6 [svn] - Let's not let the user press the skin refresh button while already refreshing ;)
nhjm449
parents: 674
diff changeset
275 skin_view_update(GtkTreeView * treeview, GtkWidget * refresh_button)
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
276 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
277 GtkTreeSelection *selection = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
278 GtkListStore *store;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
279 GtkTreeIter iter, iter_current_skin;
642
880cd914c3fd [svn] Robustness fix; skinning dialog should deal with incorrect current skin setting gracefully. By external contributor Daniel Drake (Gentoo).
chainsaw
parents: 639
diff changeset
280 gboolean have_current_skin = FALSE;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
281 GtkTreePath *path;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
282
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
283 GdkPixbuf *thumbnail;
453
257a8d2047fb [svn] added a new column in the treeview model to store the skin name
giacomo
parents: 452
diff changeset
284 gchar *formattedname;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
285 gchar *name;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
286 GList *entry;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
287
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
288 gtk_widget_set_sensitive(GTK_WIDGET(treeview), FALSE);
962
a341792533a6 [svn] - Let's not let the user press the skin refresh button while already refreshing ;)
nhjm449
parents: 674
diff changeset
289 gtk_widget_set_sensitive(GTK_WIDGET(refresh_button), FALSE);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
290
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
291 store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
292
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
293 gtk_list_store_clear(store);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
294
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
295 skinlist_update();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
296
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
297 for (entry = skinlist; entry; entry = g_list_next(entry)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
298 thumbnail = skin_get_thumbnail(SKIN_NODE(entry->data)->path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
299
453
257a8d2047fb [svn] added a new column in the treeview model to store the skin name
giacomo
parents: 452
diff changeset
300 formattedname = g_strdup_printf("<big><b>%s</b></big>\n<i>%s</i>",
449
bf803441d49e [svn] new pango-based skin selection sexyness.
nenolod
parents: 0
diff changeset
301 SKIN_NODE(entry->data)->name, SKIN_NODE(entry->data)->desc);
453
257a8d2047fb [svn] added a new column in the treeview model to store the skin name
giacomo
parents: 452
diff changeset
302 name = SKIN_NODE(entry->data)->name;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
303
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
304 gtk_list_store_append(store, &iter);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
305 gtk_list_store_set(store, &iter,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
306 SKIN_VIEW_COL_PREVIEW, thumbnail,
453
257a8d2047fb [svn] added a new column in the treeview model to store the skin name
giacomo
parents: 452
diff changeset
307 SKIN_VIEW_COL_FORMATTEDNAME, formattedname,
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
308 SKIN_VIEW_COL_NAME, name, -1);
639
9d2c175e458e [svn] More skin-related fixups. One segfault fix by Michael Hanselmann and a fix by Daniel Drake to also display skins that lack a thumbnail.
chainsaw
parents: 453
diff changeset
309 if (thumbnail)
9d2c175e458e [svn] More skin-related fixups. One segfault fix by Michael Hanselmann and a fix by Daniel Drake to also display skins that lack a thumbnail.
chainsaw
parents: 453
diff changeset
310 g_object_unref(thumbnail);
453
257a8d2047fb [svn] added a new column in the treeview model to store the skin name
giacomo
parents: 452
diff changeset
311 g_free(formattedname);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
312
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
313 if (g_strstr_len(bmp_active_skin->path,
453
257a8d2047fb [svn] added a new column in the treeview model to store the skin name
giacomo
parents: 452
diff changeset
314 strlen(bmp_active_skin->path), name) ) {
642
880cd914c3fd [svn] Robustness fix; skinning dialog should deal with incorrect current skin setting gracefully. By external contributor Daniel Drake (Gentoo).
chainsaw
parents: 639
diff changeset
315 iter_current_skin = iter;
880cd914c3fd [svn] Robustness fix; skinning dialog should deal with incorrect current skin setting gracefully. By external contributor Daniel Drake (Gentoo).
chainsaw
parents: 639
diff changeset
316 have_current_skin = TRUE;
880cd914c3fd [svn] Robustness fix; skinning dialog should deal with incorrect current skin setting gracefully. By external contributor Daniel Drake (Gentoo).
chainsaw
parents: 639
diff changeset
317 }
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
318
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
319 while (gtk_events_pending())
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
320 gtk_main_iteration();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
321 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
322
642
880cd914c3fd [svn] Robustness fix; skinning dialog should deal with incorrect current skin setting gracefully. By external contributor Daniel Drake (Gentoo).
chainsaw
parents: 639
diff changeset
323 if (have_current_skin) {
880cd914c3fd [svn] Robustness fix; skinning dialog should deal with incorrect current skin setting gracefully. By external contributor Daniel Drake (Gentoo).
chainsaw
parents: 639
diff changeset
324 selection = gtk_tree_view_get_selection(treeview);
880cd914c3fd [svn] Robustness fix; skinning dialog should deal with incorrect current skin setting gracefully. By external contributor Daniel Drake (Gentoo).
chainsaw
parents: 639
diff changeset
325 gtk_tree_selection_select_iter(selection, &iter_current_skin);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
326
642
880cd914c3fd [svn] Robustness fix; skinning dialog should deal with incorrect current skin setting gracefully. By external contributor Daniel Drake (Gentoo).
chainsaw
parents: 639
diff changeset
327 path = gtk_tree_model_get_path(GTK_TREE_MODEL(store),
880cd914c3fd [svn] Robustness fix; skinning dialog should deal with incorrect current skin setting gracefully. By external contributor Daniel Drake (Gentoo).
chainsaw
parents: 639
diff changeset
328 &iter_current_skin);
880cd914c3fd [svn] Robustness fix; skinning dialog should deal with incorrect current skin setting gracefully. By external contributor Daniel Drake (Gentoo).
chainsaw
parents: 639
diff changeset
329 gtk_tree_view_scroll_to_cell(treeview, path, NULL, TRUE, 0.5, 0.5);
880cd914c3fd [svn] Robustness fix; skinning dialog should deal with incorrect current skin setting gracefully. By external contributor Daniel Drake (Gentoo).
chainsaw
parents: 639
diff changeset
330 gtk_tree_path_free(path);
880cd914c3fd [svn] Robustness fix; skinning dialog should deal with incorrect current skin setting gracefully. By external contributor Daniel Drake (Gentoo).
chainsaw
parents: 639
diff changeset
331 }
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
332
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
333 gtk_widget_set_sensitive(GTK_WIDGET(treeview), TRUE);
962
a341792533a6 [svn] - Let's not let the user press the skin refresh button while already refreshing ;)
nhjm449
parents: 674
diff changeset
334 gtk_widget_set_sensitive(GTK_WIDGET(refresh_button), TRUE);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
335 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
336
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
337
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
338 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
339 skin_view_on_cursor_changed(GtkTreeView * treeview,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
340 gpointer data)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
341 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
342 GtkTreeModel *model;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
343 GtkTreeSelection *selection;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
344 GtkTreeIter iter;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
345
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
346 GList *node;
453
257a8d2047fb [svn] added a new column in the treeview model to store the skin name
giacomo
parents: 452
diff changeset
347 gchar *name;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
348 gchar *comp = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
349
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
350 selection = gtk_tree_view_get_selection(treeview);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
351 if (!gtk_tree_selection_get_selected(selection, &model, &iter))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
352 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
353
453
257a8d2047fb [svn] added a new column in the treeview model to store the skin name
giacomo
parents: 452
diff changeset
354 gtk_tree_model_get(model, &iter, SKIN_VIEW_COL_NAME, &name, -1);
450
dd84f79979b4 [svn] Dissect the pango markup using scanf and various string delimiter hacks.
nenolod
parents: 449
diff changeset
355
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
356 for (node = skinlist; node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
357 comp = SKIN_NODE(node->data)->path;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
358 if (g_strrstr(comp, name))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
359 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
360 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
361
453
257a8d2047fb [svn] added a new column in the treeview model to store the skin name
giacomo
parents: 452
diff changeset
362 g_free(name);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
363
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
364 bmp_active_skin_load(comp);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
365 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
366
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
367
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
368 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
369 skin_view_realize(GtkTreeView * treeview)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
370 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
371 GtkListStore *store;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
372 GtkTreeViewColumn *column;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
373 GtkCellRenderer *renderer;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
374 GtkTreeSelection *selection;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
375
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
376 gtk_widget_show_all(GTK_WIDGET(treeview));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
377
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
378 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
379 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
380
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
381 store = gtk_list_store_new(SKIN_VIEW_N_COLS, GDK_TYPE_PIXBUF,
453
257a8d2047fb [svn] added a new column in the treeview model to store the skin name
giacomo
parents: 452
diff changeset
382 G_TYPE_STRING , G_TYPE_STRING);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
383 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
384
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
385 column = gtk_tree_view_column_new();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
386 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
387 gtk_tree_view_column_set_spacing(column, 16);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
388 gtk_tree_view_append_column(GTK_TREE_VIEW(treeview),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
389 GTK_TREE_VIEW_COLUMN(column));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
390
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
391 renderer = gtk_cell_renderer_pixbuf_new();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
392 gtk_tree_view_column_pack_start(column, renderer, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
393 gtk_tree_view_column_set_attributes(column, renderer, "pixbuf",
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
394 SKIN_VIEW_COL_PREVIEW, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
395
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
396 renderer = gtk_cell_renderer_text_new();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
397 gtk_tree_view_column_pack_start(column, renderer, TRUE);
449
bf803441d49e [svn] new pango-based skin selection sexyness.
nenolod
parents: 0
diff changeset
398 gtk_tree_view_column_set_attributes(column, renderer, "markup",
453
257a8d2047fb [svn] added a new column in the treeview model to store the skin name
giacomo
parents: 452
diff changeset
399 SKIN_VIEW_COL_FORMATTEDNAME, NULL);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
400
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
401 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
402 gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
403
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
404 g_signal_connect(treeview, "cursor-changed",
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
405 G_CALLBACK(skin_view_on_cursor_changed), NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
406 }