Mercurial > audlegacy
annotate audacious/playlist_manager.c @ 2253:329fb2453c87 trunk
[svn] More copyright notice updates
author | kiyoshi |
---|---|
date | Wed, 03 Jan 2007 14:55:03 -0800 |
parents | d507d2c1f75c |
children | 32e570c6d808 |
rev | line source |
---|---|
2208
76b040158f94
[svn] - Center new windows so they don't get cut off by the edge of the screen.
nhjm449
parents:
2202
diff
changeset
|
1 /* Audacious - Cross-platform multimedia player |
2253 | 2 * Copyright (C) 2005-2007 Audacious development team. |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
3 * |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
6 * the Free Software Foundation; under version 2 of the License. |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
7 * |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
11 * GNU General Public License for more details. |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
12 * |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
13 * You should have received a copy of the GNU General Public License |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
14 * along with this program; if not, write to the Free Software |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
16 */ |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
17 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
18 #include "playlist_manager.h" |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
19 #include "ui_playlist.h" |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
20 #include "playlist.h" |
2237 | 21 #include "ui_main.h" |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
22 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
23 #include <glib.h> |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
24 #include <glib/gi18n.h> |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
25 #include <gtk/gtk.h> |
2209
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
26 #include <gdk/gdkkeysyms.h> |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
27 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
28 |
2202
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
29 #define DISABLE_MANAGER_UPDATE() g_object_set_data(G_OBJECT(listview),"opt1",GINT_TO_POINTER(1)) |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
30 #define ENABLE_MANAGER_UPDATE() g_object_set_data(G_OBJECT(listview),"opt1",GINT_TO_POINTER(0)) |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
31 |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
32 |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
33 static GtkWidget *playman_win = NULL; |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
34 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
35 |
2209
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
36 /* in this enum, place the columns according to visualization order |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
37 (information not displayed in columns should be placed right before PLLIST_NUMCOLS) */ |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
38 enum |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
39 { |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
40 PLLIST_COL_NAME = 0, |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
41 PLLIST_COL_ENTRIESNUM, |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
42 PLLIST_COL_PLPOINTER, |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
43 PLLIST_NUMCOLS |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
44 }; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
45 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
46 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
47 static void |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
48 playlist_manager_populate ( GtkListStore * store ) |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
49 { |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
50 GList *playlists = NULL; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
51 GtkTreeIter iter; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
52 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
53 playlists = playlist_get_playlists(); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
54 while ( playlists != NULL ) |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
55 { |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
56 GList *entries = NULL; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
57 gint entriesnum = 0; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
58 gchar *pl_name = NULL; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
59 Playlist *playlist = (Playlist*)playlists->data; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
60 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
61 PLAYLIST_LOCK(playlist->mutex); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
62 /* for each playlist, pick name and number of entries */ |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
63 pl_name = (gchar*)playlist_get_current_name( playlist ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
64 for (entries = playlist->entries; entries; entries = g_list_next(entries)) |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
65 entriesnum++; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
66 PLAYLIST_UNLOCK(playlist->mutex); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
67 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
68 gtk_list_store_append( store , &iter ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
69 gtk_list_store_set( store, &iter, |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
70 PLLIST_COL_NAME , pl_name , |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
71 PLLIST_COL_ENTRIESNUM , entriesnum , |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
72 PLLIST_COL_PLPOINTER , playlist , -1 ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
73 playlists = g_list_next(playlists); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
74 } |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
75 return; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
76 } |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
77 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
78 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
79 static void |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
80 playlist_manager_cb_new ( gpointer listview ) |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
81 { |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
82 GList *playlists = NULL; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
83 Playlist *newpl = NULL; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
84 GtkTreeIter iter; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
85 GtkListStore *store; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
86 gchar *pl_name = NULL; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
87 |
2202
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
88 /* this ensures that playlist_manager_update() will |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
89 not perform update, since we're already doing it here */ |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
90 DISABLE_MANAGER_UPDATE(); |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
91 |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
92 newpl = playlist_new(); |
2202
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
93 pl_name = (gchar*)playlist_get_current_name( newpl ); |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
94 playlists = playlist_get_playlists(); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
95 playlist_add_playlist( newpl ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
96 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
97 store = (GtkListStore*)gtk_tree_view_get_model( GTK_TREE_VIEW(listview) ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
98 gtk_list_store_append( store , &iter ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
99 gtk_list_store_set( store, &iter, |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
100 PLLIST_COL_NAME , pl_name , |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
101 PLLIST_COL_ENTRIESNUM , 0 , |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
102 PLLIST_COL_PLPOINTER , newpl , -1 ); |
2202
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
103 |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
104 ENABLE_MANAGER_UPDATE(); |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
105 |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
106 return; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
107 } |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
108 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
109 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
110 static void |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
111 playlist_manager_cb_del ( gpointer listview ) |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
112 { |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
113 GtkTreeSelection *listsel = gtk_tree_view_get_selection( GTK_TREE_VIEW(listview) ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
114 GtkTreeModel *store; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
115 GtkTreeIter iter; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
116 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
117 if ( gtk_tree_selection_get_selected( listsel , &store , &iter ) == TRUE ) |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
118 { |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
119 Playlist *playlist = NULL; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
120 gtk_tree_model_get( store, &iter, PLLIST_COL_PLPOINTER , &playlist , -1 ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
121 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
122 if ( gtk_tree_model_iter_n_children( store , NULL ) < 2 ) |
2221
e7ecc79293c8
[svn] - deletion of the last playlist is now handled directly in playlist_remove_playlist (patch by Joker) ; small code changes in playlist manager
giacomo
parents:
2209
diff
changeset
|
123 { |
e7ecc79293c8
[svn] - deletion of the last playlist is now handled directly in playlist_remove_playlist (patch by Joker) ; small code changes in playlist manager
giacomo
parents:
2209
diff
changeset
|
124 /* let playlist_manager_update() handle the deletion of the last playlist */ |
e7ecc79293c8
[svn] - deletion of the last playlist is now handled directly in playlist_remove_playlist (patch by Joker) ; small code changes in playlist manager
giacomo
parents:
2209
diff
changeset
|
125 playlist_remove_playlist( playlist ); |
e7ecc79293c8
[svn] - deletion of the last playlist is now handled directly in playlist_remove_playlist (patch by Joker) ; small code changes in playlist manager
giacomo
parents:
2209
diff
changeset
|
126 } |
e7ecc79293c8
[svn] - deletion of the last playlist is now handled directly in playlist_remove_playlist (patch by Joker) ; small code changes in playlist manager
giacomo
parents:
2209
diff
changeset
|
127 else |
e7ecc79293c8
[svn] - deletion of the last playlist is now handled directly in playlist_remove_playlist (patch by Joker) ; small code changes in playlist manager
giacomo
parents:
2209
diff
changeset
|
128 { |
e7ecc79293c8
[svn] - deletion of the last playlist is now handled directly in playlist_remove_playlist (patch by Joker) ; small code changes in playlist manager
giacomo
parents:
2209
diff
changeset
|
129 gtk_list_store_remove( (GtkListStore*)store , &iter ); |
e7ecc79293c8
[svn] - deletion of the last playlist is now handled directly in playlist_remove_playlist (patch by Joker) ; small code changes in playlist manager
giacomo
parents:
2209
diff
changeset
|
130 /* this ensures that playlist_manager_update() will |
e7ecc79293c8
[svn] - deletion of the last playlist is now handled directly in playlist_remove_playlist (patch by Joker) ; small code changes in playlist manager
giacomo
parents:
2209
diff
changeset
|
131 not perform update, since we're already doing it here */ |
e7ecc79293c8
[svn] - deletion of the last playlist is now handled directly in playlist_remove_playlist (patch by Joker) ; small code changes in playlist manager
giacomo
parents:
2209
diff
changeset
|
132 DISABLE_MANAGER_UPDATE(); |
e7ecc79293c8
[svn] - deletion of the last playlist is now handled directly in playlist_remove_playlist (patch by Joker) ; small code changes in playlist manager
giacomo
parents:
2209
diff
changeset
|
133 playlist_remove_playlist( playlist ); |
e7ecc79293c8
[svn] - deletion of the last playlist is now handled directly in playlist_remove_playlist (patch by Joker) ; small code changes in playlist manager
giacomo
parents:
2209
diff
changeset
|
134 ENABLE_MANAGER_UPDATE(); |
e7ecc79293c8
[svn] - deletion of the last playlist is now handled directly in playlist_remove_playlist (patch by Joker) ; small code changes in playlist manager
giacomo
parents:
2209
diff
changeset
|
135 } |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
136 } |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
137 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
138 return; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
139 } |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
140 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
141 |
2209
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
142 static void |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
143 playlist_manager_cb_lv_dclick ( GtkTreeView * lv , GtkTreePath * path , |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
144 GtkTreeViewColumn * col , gpointer userdata ) |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
145 { |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
146 GtkTreeModel *store; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
147 GtkTreeIter iter; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
148 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
149 store = gtk_tree_view_get_model( GTK_TREE_VIEW(lv) ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
150 if ( gtk_tree_model_get_iter( store , &iter , path ) == TRUE ) |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
151 { |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
152 Playlist *playlist = NULL; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
153 gtk_tree_model_get( store , &iter , PLLIST_COL_PLPOINTER , &playlist , -1 ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
154 playlist_select_playlist( playlist ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
155 } |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
156 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
157 return; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
158 } |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
159 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
160 |
2209
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
161 static void |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
162 playlist_manager_cb_lv_pmenu_rename ( GtkMenuItem *menuitem , gpointer lv ) |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
163 { |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
164 GtkTreeSelection *listsel = gtk_tree_view_get_selection( GTK_TREE_VIEW(lv) ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
165 GtkTreeModel *store; |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
166 GtkTreeIter iter; |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
167 |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
168 if ( gtk_tree_selection_get_selected( listsel , &store , &iter ) == TRUE ) |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
169 { |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
170 GtkTreePath *path = gtk_tree_model_get_path( GTK_TREE_MODEL(store) , &iter ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
171 GtkCellRenderer *rndrname = g_object_get_data( G_OBJECT(lv) , "rn" ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
172 /* set the name renderer to editable and start editing */ |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
173 g_object_set( G_OBJECT(rndrname) , "editable" , TRUE , NULL ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
174 gtk_tree_view_set_cursor_on_cell( GTK_TREE_VIEW(lv) , path , |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
175 gtk_tree_view_get_column( GTK_TREE_VIEW(lv) , PLLIST_COL_NAME ) , rndrname , TRUE ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
176 gtk_tree_path_free( path ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
177 } |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
178 } |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
179 |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
180 static void |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
181 playlist_manager_cb_lv_name_edited ( GtkCellRendererText *cell , gchar *path_string , |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
182 gchar *new_text , gpointer lv ) |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
183 { |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
184 /* this is currently used to change playlist names */ |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
185 GtkTreeModel *store = gtk_tree_view_get_model( GTK_TREE_VIEW(lv) );; |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
186 GtkTreeIter iter; |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
187 |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
188 if ( gtk_tree_model_get_iter_from_string( store , &iter , path_string ) == TRUE ) |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
189 { |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
190 Playlist *playlist = NULL; |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
191 gtk_tree_model_get( GTK_TREE_MODEL(store), &iter, PLLIST_COL_PLPOINTER , &playlist , -1 ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
192 playlist_set_current_name( playlist , new_text ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
193 gtk_list_store_set( GTK_LIST_STORE(store), &iter, PLLIST_COL_NAME , new_text , -1 ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
194 } |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
195 /* set the renderer uneditable again */ |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
196 g_object_set( G_OBJECT(cell) , "editable" , FALSE , NULL ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
197 } |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
198 |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
199 |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
200 static gboolean |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
201 playlist_manager_cb_lv_btpress ( GtkWidget *lv , GdkEventButton *event ) |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
202 { |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
203 if (( event->type == GDK_BUTTON_PRESS ) && ( event->button == 3 )) |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
204 { |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
205 GtkWidget *pmenu = (GtkWidget*)g_object_get_data( G_OBJECT(lv) , "menu" ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
206 gtk_menu_popup( GTK_MENU(pmenu) , NULL , NULL , NULL , NULL , |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
207 (event != NULL) ? event->button : 0, |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
208 gdk_event_get_time((GdkEvent*)event)); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
209 return TRUE; |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
210 } |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
211 |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
212 return FALSE; |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
213 } |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
214 |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
215 |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
216 static gboolean |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
217 playlist_manager_cb_keypress ( GtkWidget *win , GdkEventKey *event ) |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
218 { |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
219 switch (event->keyval) |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
220 { |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
221 case GDK_Escape: |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
222 gtk_widget_destroy( playman_win ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
223 return TRUE; |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
224 default: |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
225 return FALSE; |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
226 } |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
227 } |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
228 |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
229 |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
230 void |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
231 playlist_manager_ui_show ( void ) |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
232 { |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
233 GtkWidget *playman_vbox; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
234 GtkWidget *playman_pl_lv, *playman_pl_lv_frame, *playman_pl_lv_sw; |
2209
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
235 GtkCellRenderer *playman_pl_lv_textrndr_name, *playman_pl_lv_textrndr_entriesnum; |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
236 GtkTreeViewColumn *playman_pl_lv_col_name, *playman_pl_lv_col_entriesnum; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
237 GtkListStore *pl_store; |
2209
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
238 GtkWidget *playman_pl_lv_pmenu, *playman_pl_lv_pmenu_rename; |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
239 GtkWidget *playman_bbar_hbbox; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
240 GtkWidget *playman_bbar_bt_new, *playman_bbar_bt_del, *playman_bbar_bt_close; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
241 GdkGeometry playman_win_hints; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
242 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
243 if ( playman_win != NULL ) |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
244 { |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
245 gtk_window_present( GTK_WINDOW(playman_win) ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
246 return; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
247 } |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
248 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
249 playman_win = gtk_window_new( GTK_WINDOW_TOPLEVEL ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
250 gtk_window_set_type_hint( GTK_WINDOW(playman_win), GDK_WINDOW_TYPE_HINT_DIALOG ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
251 gtk_window_set_transient_for( GTK_WINDOW(playman_win) , GTK_WINDOW(mainwin) ); |
2208
76b040158f94
[svn] - Center new windows so they don't get cut off by the edge of the screen.
nhjm449
parents:
2202
diff
changeset
|
252 gtk_window_set_position( GTK_WINDOW(playman_win), GTK_WIN_POS_CENTER ); |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
253 gtk_window_set_title( GTK_WINDOW(playman_win), _("Playlist Manager") ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
254 gtk_container_set_border_width( GTK_CONTAINER(playman_win), 10 ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
255 g_signal_connect( G_OBJECT(playman_win) , "destroy" , |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
256 G_CALLBACK(gtk_widget_destroyed) , &playman_win ); |
2209
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
257 g_signal_connect( G_OBJECT(playman_win) , "key-press-event" , |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
258 G_CALLBACK(playlist_manager_cb_keypress) , NULL ); |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
259 playman_win_hints.min_width = 400; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
260 playman_win_hints.min_height = 250; |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
261 gtk_window_set_geometry_hints( GTK_WINDOW(playman_win) , GTK_WIDGET(playman_win) , |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
262 &playman_win_hints , GDK_HINT_MIN_SIZE ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
263 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
264 playman_vbox = gtk_vbox_new( FALSE , 0 ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
265 gtk_container_add( GTK_CONTAINER(playman_win) , playman_vbox ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
266 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
267 /* current liststore model |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
268 ---------------------------------------------- |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
269 G_TYPE_STRING -> playlist name |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
270 G_TYPE_UINT -> number of entries in playlist |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
271 G_TYPE_POINTER -> playlist pointer (Playlist*) |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
272 ---------------------------------------------- |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
273 */ |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
274 pl_store = gtk_list_store_new( PLLIST_NUMCOLS , G_TYPE_STRING , G_TYPE_UINT , G_TYPE_POINTER ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
275 playlist_manager_populate( pl_store ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
276 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
277 playman_pl_lv_frame = gtk_frame_new( NULL ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
278 playman_pl_lv = gtk_tree_view_new_with_model( GTK_TREE_MODEL(pl_store) ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
279 g_object_unref( pl_store ); |
2202
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
280 g_object_set_data( G_OBJECT(playman_win) , "lv" , playman_pl_lv ); |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
281 g_object_set_data( G_OBJECT(playman_pl_lv) , "opt1" , GINT_TO_POINTER(0) ); |
2209
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
282 playman_pl_lv_textrndr_entriesnum = gtk_cell_renderer_text_new(); /* uneditable */ |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
283 playman_pl_lv_textrndr_name = gtk_cell_renderer_text_new(); /* can become editable */ |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
284 g_signal_connect( G_OBJECT(playman_pl_lv_textrndr_name) , "edited" , |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
285 G_CALLBACK(playlist_manager_cb_lv_name_edited) , playman_pl_lv ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
286 g_object_set_data( G_OBJECT(playman_pl_lv) , "rn" , playman_pl_lv_textrndr_name ); |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
287 playman_pl_lv_col_name = gtk_tree_view_column_new_with_attributes( |
2209
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
288 _("Playlist") , playman_pl_lv_textrndr_name , "text" , PLLIST_COL_NAME , NULL ); |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
289 gtk_tree_view_column_set_expand( GTK_TREE_VIEW_COLUMN(playman_pl_lv_col_name) , TRUE ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
290 gtk_tree_view_append_column( GTK_TREE_VIEW(playman_pl_lv), playman_pl_lv_col_name ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
291 playman_pl_lv_col_entriesnum = gtk_tree_view_column_new_with_attributes( |
2209
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
292 _("Entries") , playman_pl_lv_textrndr_entriesnum , "text" , PLLIST_COL_ENTRIESNUM , NULL ); |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
293 gtk_tree_view_column_set_expand( GTK_TREE_VIEW_COLUMN(playman_pl_lv_col_entriesnum) , FALSE ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
294 gtk_tree_view_append_column( GTK_TREE_VIEW(playman_pl_lv), playman_pl_lv_col_entriesnum ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
295 playman_pl_lv_sw = gtk_scrolled_window_new( NULL , NULL ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
296 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(playman_pl_lv_sw) , |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
297 GTK_POLICY_NEVER , GTK_POLICY_ALWAYS ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
298 gtk_container_add( GTK_CONTAINER(playman_pl_lv_sw) , playman_pl_lv ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
299 gtk_container_add( GTK_CONTAINER(playman_pl_lv_frame) , playman_pl_lv_sw ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
300 gtk_box_pack_start( GTK_BOX(playman_vbox) , playman_pl_lv_frame , TRUE , TRUE , 0 ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
301 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
302 gtk_box_pack_start( GTK_BOX(playman_vbox) , gtk_hseparator_new() , FALSE , FALSE , 4 ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
303 |
2209
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
304 /* listview popup menu */ |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
305 playman_pl_lv_pmenu = gtk_menu_new(); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
306 playman_pl_lv_pmenu_rename = gtk_menu_item_new_with_mnemonic( _( "_Rename" ) ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
307 g_signal_connect( G_OBJECT(playman_pl_lv_pmenu_rename) , "activate" , |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
308 G_CALLBACK(playlist_manager_cb_lv_pmenu_rename) , playman_pl_lv ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
309 gtk_menu_shell_append( GTK_MENU_SHELL(playman_pl_lv_pmenu) , playman_pl_lv_pmenu_rename ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
310 gtk_widget_show_all( playman_pl_lv_pmenu ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
311 g_object_set_data( G_OBJECT(playman_pl_lv) , "menu" , playman_pl_lv_pmenu ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
312 g_signal_connect_swapped( G_OBJECT(playman_win) , "destroy" , |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
313 G_CALLBACK(gtk_widget_destroy) , playman_pl_lv_pmenu ); |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
314 |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
315 /* button bar */ |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
316 playman_bbar_hbbox = gtk_hbutton_box_new(); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
317 gtk_button_box_set_layout( GTK_BUTTON_BOX(playman_bbar_hbbox) , GTK_BUTTONBOX_START ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
318 playman_bbar_bt_new = gtk_button_new_from_stock( GTK_STOCK_NEW ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
319 playman_bbar_bt_del = gtk_button_new_from_stock( GTK_STOCK_DELETE ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
320 playman_bbar_bt_close = gtk_button_new_from_stock( GTK_STOCK_CLOSE ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
321 gtk_container_add( GTK_CONTAINER(playman_bbar_hbbox) , playman_bbar_bt_new ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
322 gtk_container_add( GTK_CONTAINER(playman_bbar_hbbox) , playman_bbar_bt_del ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
323 gtk_container_add( GTK_CONTAINER(playman_bbar_hbbox) , playman_bbar_bt_close ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
324 gtk_button_box_set_child_secondary( GTK_BUTTON_BOX(playman_bbar_hbbox) , |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
325 playman_bbar_bt_close , TRUE ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
326 gtk_box_pack_start( GTK_BOX(playman_vbox) , playman_bbar_hbbox , FALSE , FALSE , 0 ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
327 |
2209
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
328 g_signal_connect( G_OBJECT(playman_pl_lv) , "button-press-event" , |
ec7b60e91a14
[svn] - more work done on playlist manager: playlist renaming and keyboard shortcuts
giacomo
parents:
2208
diff
changeset
|
329 G_CALLBACK(playlist_manager_cb_lv_btpress) , NULL ); |
2201
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
330 g_signal_connect( G_OBJECT(playman_pl_lv) , "row-activated" , |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
331 G_CALLBACK(playlist_manager_cb_lv_dclick) , NULL ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
332 g_signal_connect_swapped( G_OBJECT(playman_bbar_bt_new) , "clicked" , |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
333 G_CALLBACK(playlist_manager_cb_new) , playman_pl_lv ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
334 g_signal_connect_swapped( G_OBJECT(playman_bbar_bt_del) , "clicked" , |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
335 G_CALLBACK(playlist_manager_cb_del) , playman_pl_lv ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
336 g_signal_connect_swapped( G_OBJECT(playman_bbar_bt_close) , "clicked" , |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
337 G_CALLBACK(gtk_widget_destroy) , playman_win ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
338 |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
339 gtk_widget_show_all( playman_win ); |
39e9c8e2745d
[svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents:
diff
changeset
|
340 } |
2202
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
341 |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
342 |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
343 void |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
344 playlist_manager_update ( void ) |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
345 { |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
346 /* this function is called whenever there is a change in playlist, such as |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
347 playlist created/deleted or entry added/deleted in a playlist; if the playlist |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
348 manager is active, it should be updated to keep consistency of information */ |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
349 |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
350 /* CAREFUL! this currently locks/unlocks all the playlists */ |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
351 |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
352 if ( playman_win != NULL ) |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
353 { |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
354 GtkWidget *lv = (GtkWidget*)g_object_get_data( G_OBJECT(playman_win) , "lv" ); |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
355 if ( GPOINTER_TO_INT(g_object_get_data(G_OBJECT(lv),"opt1")) == 0 ) |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
356 { |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
357 GtkListStore *store = (GtkListStore*)gtk_tree_view_get_model( GTK_TREE_VIEW(lv) ); |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
358 /* TODO: this re-populates everything... there's definitely room for optimization */ |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
359 gtk_list_store_clear( store ); |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
360 playlist_manager_populate( store ); |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
361 } |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
362 return; |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
363 } |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
364 else |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
365 return; /* if the playlist manager is not active, simply return */ |
d1804718c5cc
[svn] - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
giacomo
parents:
2201
diff
changeset
|
366 } |