annotate src/audacious/ui_playlist_manager.c @ 3471:95d8ceb5e1d7 trunk

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