Mercurial > audlegacy-plugins
comparison src/streambrowser/gui/streambrowser_win.c @ 2757:4ec0e13208de
added shoutcast icon; fixed some small bugs
| author | Calin Crisan ccrisan@gmail.com |
|---|---|
| date | Tue, 01 Jul 2008 21:13:22 +0300 |
| parents | 6d6a3eb67510 |
| children | d45b4beadf6c |
comparison
equal
deleted
inserted
replaced
| 2736:4d9540bcd7e2 | 2757:4ec0e13208de |
|---|---|
| 200 } | 200 } |
| 201 | 201 |
| 202 static GtkWidget *gtk_streamdir_tree_view_new() | 202 static GtkWidget *gtk_streamdir_tree_view_new() |
| 203 { | 203 { |
| 204 GtkWidget *tree_view = gtk_tree_view_new(); | 204 GtkWidget *tree_view = gtk_tree_view_new(); |
| 205 | 205 |
| 206 GtkTreeStore *store = gtk_tree_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); | 206 GtkTreeStore *store = gtk_tree_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); |
| 207 gtk_tree_view_set_model(GTK_TREE_VIEW(tree_view), GTK_TREE_MODEL(store)); | 207 gtk_tree_view_set_model(GTK_TREE_VIEW(tree_view), GTK_TREE_MODEL(store)); |
| 208 | 208 |
| 209 // todo: why doesn't the tree view allow to be resized? | 209 // todo: why doesn't the tree view allow to be resized? |
| 210 //gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree_view), FALSE); | 210 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree_view), TRUE); |
| 211 gtk_tree_view_set_headers_clickable(GTK_TREE_VIEW(tree_view), TRUE); | 211 gtk_tree_view_set_headers_clickable(GTK_TREE_VIEW(tree_view), TRUE); |
| 212 //gtk_tree_view_set_reorderable(GTK_TREE_VIEW(tree_view), TRUE); | 212 gtk_tree_view_set_reorderable(GTK_TREE_VIEW(tree_view), TRUE); |
| 213 gtk_tree_view_set_fixed_height_mode(GTK_TREE_VIEW(tree_view), FALSE); | 213 gtk_tree_view_set_fixed_height_mode(GTK_TREE_VIEW(tree_view), FALSE); |
| 214 | 214 |
| 215 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view), -1, "", cell_renderer_pixbuf, "pixbuf", 0, NULL); | 215 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view), -1, "", cell_renderer_pixbuf, "pixbuf", 0, NULL); |
| 216 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view), -1, "Stream name", cell_renderer_text, "text", 1, NULL); | 216 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view), -1, "Stream name", cell_renderer_text, "text", 1, NULL); |
| 217 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view), -1, "Now playing", cell_renderer_text, "text", 2, NULL); | 217 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view), -1, "Now playing", cell_renderer_text, "text", 2, NULL); |
| 218 | 218 |
| 219 g_signal_connect(G_OBJECT(tree_view), "cursor-changed", G_CALLBACK(on_tree_view_cursor_changed), NULL); | 219 g_signal_connect(G_OBJECT(tree_view), "cursor-changed", G_CALLBACK(on_tree_view_cursor_changed), NULL); |
| 220 | 220 |
| 221 return tree_view; | 221 return tree_view; |
| 222 } | 222 } |
| 223 | 223 |
| 236 { | 236 { |
| 237 if (page_num < 0) | 237 if (page_num < 0) |
| 238 return FALSE; | 238 return FALSE; |
| 239 | 239 |
| 240 /* update the current selected stream */ | 240 /* update the current selected stream */ |
| 241 | |
| 242 /* | |
| 241 streamdir_gui_t *streamdir_gui = g_list_nth_data(streamdir_gui_list, page_num); | 243 streamdir_gui_t *streamdir_gui = g_list_nth_data(streamdir_gui_list, page_num); |
| 242 update_function(streamdir_gui->streamdir, NULL, NULL); | 244 update_function(streamdir_gui->streamdir, NULL, NULL); |
| 245 */ | |
| 246 | |
| 247 /* clear the search box */ | |
| 248 gtk_entry_set_text(GTK_ENTRY(search_entry), ""); | |
| 243 | 249 |
| 244 return TRUE; | 250 return TRUE; |
| 245 } | 251 } |
| 246 | 252 |
| 247 static gboolean on_tree_view_cursor_changed(GtkTreeView *tree_view, gpointer data) | 253 static gboolean on_tree_view_cursor_changed(GtkTreeView *tree_view, gpointer data) |
| 248 { | 254 { |
| 249 GtkTreePath *path; | 255 GtkTreePath *path; |
| 250 GtkTreeViewColumn *focus_column; | 256 GtkTreeViewColumn *focus_column; |
| 251 | 257 |
| 258 /* obtain the current category */ | |
| 252 gtk_tree_view_get_cursor(tree_view, &path, &focus_column); | 259 gtk_tree_view_get_cursor(tree_view, &path, &focus_column); |
| 253 | 260 |
| 254 if (path == NULL) | 261 if (path == NULL) |
| 255 return TRUE; | 262 return TRUE; |
| 256 | 263 |
| 257 gint *indices = gtk_tree_path_get_indices(path); | 264 gint *indices = gtk_tree_path_get_indices(path); |
| 258 if (gtk_tree_path_get_depth(path) != 1) { | 265 if (gtk_tree_path_get_depth(path) != 1) { |
| 259 gtk_tree_path_free(path); | 266 gtk_tree_path_free(path); |
| 260 return TRUE; | 267 return TRUE; |
| 261 } | 268 } |
| 265 gtk_tree_path_free(path); | 272 gtk_tree_path_free(path); |
| 266 | 273 |
| 267 streamdir_gui_t *streamdir_gui = find_streamdir_gui_by_tree_view(tree_view); | 274 streamdir_gui_t *streamdir_gui = find_streamdir_gui_by_tree_view(tree_view); |
| 268 if (streamdir_gui == NULL) | 275 if (streamdir_gui == NULL) |
| 269 return TRUE; | 276 return TRUE; |
| 270 | 277 |
| 278 /* issue an update on the current category */ | |
| 271 update_function(streamdir_gui->streamdir, category_get_by_index(streamdir_gui->streamdir, category_index), NULL); | 279 update_function(streamdir_gui->streamdir, category_get_by_index(streamdir_gui->streamdir, category_index), NULL); |
| 280 | |
| 281 /* clear the search box */ | |
| 282 gtk_entry_set_text(GTK_ENTRY(search_entry), ""); | |
| 272 | 283 |
| 273 return TRUE; | 284 return TRUE; |
| 274 } | 285 } |
| 275 | 286 |
| 276 static gboolean on_add_button_clicked(GtkButton *button, gpointer data) | 287 static gboolean on_add_button_clicked(GtkButton *button, gpointer data) |
