Lines 1-177
Link Here
|
1 |
--- beep/dirbrowser.c.orig Sat Feb 7 18:04:24 2004 |
|
|
2 |
+++ beep/dirbrowser.c Sat Feb 7 18:18:23 2004 |
3 |
@@ -263,15 +263,17 @@ |
4 |
static gchar *bmp_db_sanify_tag(gchar * value) |
5 |
{ |
6 |
|
7 |
- if (!value) |
8 |
- return "(unknown)"; |
9 |
- |
10 |
+ GString *chunk; |
11 |
gchar *frag = NULL; |
12 |
gchar **branches; |
13 |
guint ctr = 0; |
14 |
gboolean bracket_open = FALSE; |
15 |
|
16 |
- GString *chunk = g_string_new(NULL); |
17 |
+ if (!value) |
18 |
+ return "(unknown)"; |
19 |
+ |
20 |
+ |
21 |
+ chunk = g_string_new(NULL); |
22 |
branches = g_strsplit(g_strstrip(value), " ", 0); |
23 |
|
24 |
while (frag || (ctr == 0)) { |
25 |
@@ -346,6 +348,7 @@ |
26 |
GList *list = NULL; |
27 |
gboolean first = TRUE; |
28 |
gchar *from_real; |
29 |
+ GdkPixbuf *buf_dir, *buf_file, *buf_cda; |
30 |
|
31 |
from = g_locale_from_utf8(from, -1, NULL, NULL, NULL); |
32 |
from_real = bmp_db_get_path_real(from, model, &parent_iter); |
33 |
@@ -353,18 +356,19 @@ |
34 |
|
35 |
/* It's not really a waste creating both beforehand since we will |
36 |
* certainly need the folder one at least once, and most probably |
37 |
- * the audio one too anyway */ |
38 |
- GdkPixbuf *buf_dir = gdk_pixbuf_new_from_inline(sizeof(folder_pixbuf), |
39 |
+ * the audio one too anyway. |
40 |
+ */ |
41 |
+ buf_dir = gdk_pixbuf_new_from_inline(sizeof(folder_pixbuf), |
42 |
folder_pixbuf, |
43 |
TRUE, |
44 |
NULL); |
45 |
|
46 |
- GdkPixbuf *buf_file = gdk_pixbuf_new_from_inline(sizeof(audio_pixbuf), |
47 |
+ buf_file = gdk_pixbuf_new_from_inline(sizeof(audio_pixbuf), |
48 |
audio_pixbuf, |
49 |
TRUE, |
50 |
NULL); |
51 |
|
52 |
- GdkPixbuf *buf_cda = gdk_pixbuf_new_from_inline(sizeof(cda_pixbuf), |
53 |
+ buf_cda = gdk_pixbuf_new_from_inline(sizeof(cda_pixbuf), |
54 |
cda_pixbuf, |
55 |
TRUE, |
56 |
NULL); |
57 |
@@ -654,6 +658,7 @@ |
58 |
|
59 |
GtkTreeModel *model; |
60 |
GtkTreeView *treeview; |
61 |
+ GtkWidget *store; |
62 |
|
63 |
treeview = gtk_tree_selection_get_tree_view(sel); |
64 |
model = gtk_tree_view_get_model(treeview); |
65 |
@@ -681,7 +686,7 @@ |
66 |
paths = paths->next; |
67 |
} |
68 |
|
69 |
- GtkWidget *store = |
70 |
+ store = |
71 |
GTK_WIDGET(bmp_db_return_filestore_model_fresh(paths_f)); |
72 |
|
73 |
gtk_tree_view_set_model(user_data, GTK_TREE_MODEL(store)); |
74 |
@@ -706,6 +711,7 @@ |
75 |
|
76 |
struct stat statbuf; |
77 |
GtkTreeModel *model; |
78 |
+ gboolean valid; |
79 |
|
80 |
model = gtk_tree_view_get_model(treeview); |
81 |
paths = bmp_db_get_paths_from_selection(treeview); |
82 |
@@ -735,7 +741,7 @@ |
83 |
if (gtk_tree_model_iter_children(model, &iter_child, &iter)) { |
84 |
if (click_play) |
85 |
playlist_clear(); |
86 |
- gboolean valid = TRUE; |
87 |
+ valid = TRUE; |
88 |
while (valid) { |
89 |
gtk_tree_model_get(GTK_TREE_MODEL(model), &iter_child, |
90 |
FILENAME_COL, &node_name, -1); |
91 |
@@ -1308,12 +1314,15 @@ |
92 |
{ |
93 |
|
94 |
GtkTreeStore *file_store; |
95 |
- |
96 |
+ GtkTreeModel *sort_model; |
97 |
+ gdouble length_pl, frac; |
98 |
+ int ctr=0; |
99 |
+ GList *files; |
100 |
|
101 |
file_store = |
102 |
gtk_tree_store_new(5, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT, |
103 |
G_TYPE_STRING, G_TYPE_INT); |
104 |
- GtkTreeModel *sort_model = |
105 |
+ sort_model = |
106 |
gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(file_store)); |
107 |
|
108 |
|
109 |
@@ -1321,17 +1330,16 @@ |
110 |
bmp_db_mdb_sort_func, NULL, NULL); |
111 |
|
112 |
|
113 |
- gdouble length_pl = g_list_length(paths); |
114 |
+ length_pl = g_list_length(paths); |
115 |
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar_db), 0.0); |
116 |
|
117 |
- int ctr = 0; |
118 |
|
119 |
while (paths) { |
120 |
|
121 |
gchar *path = paths->data; |
122 |
ctr++; |
123 |
|
124 |
- GList *files = bmp_db_return_files_from_path(path); |
125 |
+ files = bmp_db_return_files_from_path(path); |
126 |
|
127 |
while (files) { |
128 |
gchar *title; |
129 |
@@ -1356,7 +1364,7 @@ |
130 |
files = files->next; |
131 |
} |
132 |
|
133 |
- gdouble frac = 1 / length_pl; |
134 |
+ frac = 1 / length_pl; |
135 |
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar_db), |
136 |
frac * ctr); |
137 |
while (gtk_events_pending()) { |
138 |
@@ -1411,15 +1419,17 @@ |
139 |
GtkWidget *treeview = NULL; |
140 |
GtkWidget *label_header; |
141 |
GtkWidget *paned; |
142 |
+ GtkWidget *fstore; |
143 |
+ GList *paths = NULL; |
144 |
+ PangoAttrList *attrs; |
145 |
+ PangoAttribute *attr; |
146 |
+ GtkTreeSelection *sel; |
147 |
|
148 |
if (!window) { |
149 |
|
150 |
/* create window, etc */ |
151 |
/* yes this is all messed up */ |
152 |
|
153 |
- PangoAttrList *attrs; |
154 |
- PangoAttribute *attr; |
155 |
- |
156 |
window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
157 |
gtk_window_set_title(GTK_WINDOW(window), "bmp :: Add Files..."); |
158 |
gtk_container_set_border_width(GTK_CONTAINER(window), 8); |
159 |
@@ -1489,17 +1499,15 @@ |
160 |
G_CALLBACK(bmp_db_keypress), window); |
161 |
|
162 |
gtk_container_add(GTK_CONTAINER(sw), treeview); |
163 |
- GtkWidget *fstore; |
164 |
|
165 |
/* FIXME: clean up variables, move them to start */ |
166 |
|
167 |
/* FIXME: paths is not freed, and is resetted every iteration */ |
168 |
- GList *paths = NULL; |
169 |
paths = g_list_append(paths, g_strdup(g_get_home_dir())); |
170 |
fstore = bmp_db_return_filestore_fresh(paths); |
171 |
gtk_container_add(GTK_CONTAINER(sw_right), fstore); |
172 |
|
173 |
- GtkTreeSelection *sel = |
174 |
+ sel = |
175 |
gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); |
176 |
g_signal_connect(G_OBJECT(sel), "changed", |
177 |
G_CALLBACK(bmp_db_row_activated), fstore); |