annotate src/audacious/ui_playlist_manager.c @ 3701:e766d3aec087

Remove non-existant function.
author William Pitcock <nenolod@atheme.org>
date Sun, 07 Oct 2007 00:32:35 -0500
parents 8d7775f48a4d
children a3fc19130dce
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,
3623
3625e0085d7f Change PLLIST_COL_PLPOINTER to PLLIST_PLPOINTER for consistency
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3622
diff changeset
44 PLLIST_PLPOINTER,
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
45 PLLIST_TEXT_WEIGHT,
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
46 PLLIST_NUMCOLS
2313
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
3625
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
50 static GtkTreeIter
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
51 playlist_manager_populate ( GtkListStore * store )
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
52 {
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
53 GList *playlists = NULL;
3624
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
54 Playlist *active, *iter_playlist, *next_playlist;
3625
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
55 GtkTreeIter iter, insert, next, active_iter;
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
56 gboolean valid, have_active_iter;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
57
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
58 active = playlist_get_active();
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
59 playlists = playlist_get_playlists();
3624
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
60 valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL(store) , &iter );
3625
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
61 have_active_iter = FALSE;
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
62 while ( playlists != NULL )
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
63 {
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
64 GList *entries = NULL;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
65 gint entriesnum = 0;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
66 gchar *pl_name = NULL;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
67 Playlist *playlist = (Playlist*)playlists->data;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
68
3468
440877c9360e Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents: 3123
diff changeset
69 PLAYLIST_LOCK(playlist);
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
70 /* for each playlist, pick name and number of entries */
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
71 pl_name = (gchar*)playlist_get_current_name( playlist );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
72 for (entries = playlist->entries; entries; entries = g_list_next(entries))
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
73 entriesnum++;
3468
440877c9360e Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents: 3123
diff changeset
74 PLAYLIST_UNLOCK(playlist);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
75
3624
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
76 /* update the tree model conservatively */
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
77
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
78 if ( !valid )
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
79 {
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
80 /* append */
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
81 gtk_list_store_append( store , &insert );
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
82 goto store_set;
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
83 }
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
84
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
85 gtk_tree_model_get( GTK_TREE_MODEL(store) , &iter ,
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
86 PLLIST_PLPOINTER , &iter_playlist , -1 );
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
87
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
88 if ( playlist == iter_playlist )
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
89 {
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
90 /* already have - just update */
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
91 insert = iter;
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
92 valid = gtk_tree_model_iter_next( GTK_TREE_MODEL(store) , &iter );
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
93 goto store_set;
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
94 }
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
95
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
96 /* handle movement/deletion/insertion of single elements */
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
97 if ( gtk_tree_model_iter_next( GTK_TREE_MODEL(store) , &next ) )
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
98 {
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
99 gtk_tree_model_get( GTK_TREE_MODEL(store) , &next ,
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
100 PLLIST_PLPOINTER , &next_playlist , -1 );
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
101 if ( playlist == next_playlist )
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
102 {
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
103 /* remove */
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
104 gtk_list_store_remove( store , &iter );
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
105 iter = next;
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
106 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
107 goto next_playlist;
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
108 }
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
109 }
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
110
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
111 /* insert */
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
112 gtk_list_store_insert_before( store , &insert , &iter );
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
113
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
114 store_set:
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
115 gtk_list_store_set( store, &insert,
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
116 PLLIST_COL_NAME , pl_name ,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
117 PLLIST_COL_ENTRIESNUM , entriesnum ,
3623
3625e0085d7f Change PLLIST_COL_PLPOINTER to PLLIST_PLPOINTER for consistency
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3622
diff changeset
118 PLLIST_PLPOINTER , playlist ,
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
119 PLLIST_TEXT_WEIGHT , playlist == active ?
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
120 PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL ,
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
121 -1 );
3625
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
122 if ( !have_active_iter && playlist == active )
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
123 {
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
124 active_iter = insert;
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
125 have_active_iter = TRUE;
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
126 }
3624
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
127
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
128 next_playlist:
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
129 playlists = g_list_next(playlists);
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
130 }
3624
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
131
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
132 while (valid)
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
133 {
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
134 /* remove any other elements */
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
135 next = iter;
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
136 valid = gtk_tree_model_iter_next( GTK_TREE_MODEL(store) , &next );
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
137 gtk_list_store_remove( store , &iter );
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
138 iter = next;
a4e559e0c61e Handle playlist movement/insertion/removal better in manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3623
diff changeset
139 }
3625
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
140
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
141 if ( !have_active_iter )
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
142 gtk_tree_model_get_iter_first( GTK_TREE_MODEL(store) , &active_iter );
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
143
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
144 return active_iter;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
145 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
146
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
147
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
148 static void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
149 playlist_manager_cb_new ( gpointer listview )
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
150 {
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
151 GList *playlists = NULL;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
152 Playlist *newpl = NULL;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
153 GtkTreeIter iter;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
154 GtkListStore *store;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
155 gchar *pl_name = NULL;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
156
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
157 /* this ensures that playlist_manager_update() will
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
158 not perform update, since we're already doing it here */
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
159 DISABLE_MANAGER_UPDATE();
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
160
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
161 newpl = playlist_new();
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
162 pl_name = (gchar*)playlist_get_current_name( newpl );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
163 playlists = playlist_get_playlists();
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
164 playlist_add_playlist( newpl );
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
165
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
166 store = (GtkListStore*)gtk_tree_view_get_model( GTK_TREE_VIEW(listview) );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
167 gtk_list_store_append( store , &iter );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
168 gtk_list_store_set( store, &iter,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
169 PLLIST_COL_NAME , pl_name ,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
170 PLLIST_COL_ENTRIESNUM , 0 ,
3623
3625e0085d7f Change PLLIST_COL_PLPOINTER to PLLIST_PLPOINTER for consistency
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3622
diff changeset
171 PLLIST_PLPOINTER , newpl ,
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
172 PLLIST_TEXT_WEIGHT , PANGO_WEIGHT_NORMAL ,
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
173 -1 );
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
174
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
175 ENABLE_MANAGER_UPDATE();
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
176
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
177 return;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
178 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
179
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
180
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
181 static void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
182 playlist_manager_cb_del ( gpointer listview )
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
183 {
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
184 GtkTreeSelection *listsel = gtk_tree_view_get_selection( GTK_TREE_VIEW(listview) );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
185 GtkTreeModel *store;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
186 GtkTreeIter iter;
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
187 Playlist *active;
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
188 gboolean was_active;
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_selection_get_selected( listsel , &store , &iter ) == TRUE )
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
191 {
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
192 Playlist *playlist = NULL;
3623
3625e0085d7f Change PLLIST_COL_PLPOINTER to PLLIST_PLPOINTER for consistency
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3622
diff changeset
193 gtk_tree_model_get( store, &iter, PLLIST_PLPOINTER , &playlist , -1 );
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
194
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
195 active = playlist_get_active();
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
196 was_active = ( playlist == active );
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
197
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
198 if ( gtk_tree_model_iter_n_children( store , NULL ) < 2 )
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
199 {
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
200 /* let playlist_manager_update() handle the deletion of the last playlist */
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
201 playlist_remove_playlist( playlist );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
202 }
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
203 else
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
204 {
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
205 gtk_list_store_remove( (GtkListStore*)store , &iter );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
206 /* this ensures that playlist_manager_update() will
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
207 not perform update, since we're already doing it here */
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
208 DISABLE_MANAGER_UPDATE();
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
209 playlist_remove_playlist( playlist );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
210 ENABLE_MANAGER_UPDATE();
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
211 }
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
212
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
213 if ( was_active && gtk_tree_model_get_iter_first( store , &iter ) )
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
214 {
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
215 /* update bolded playlist */
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
216 active = playlist_get_active();
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
217 do {
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
218 gtk_tree_model_get( store , &iter ,
3623
3625e0085d7f Change PLLIST_COL_PLPOINTER to PLLIST_PLPOINTER for consistency
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3622
diff changeset
219 PLLIST_PLPOINTER , &playlist , -1 );
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
220 gtk_list_store_set( GTK_LIST_STORE(store) , &iter ,
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
221 PLLIST_TEXT_WEIGHT , playlist == active ?
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
222 PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL ,
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
223 -1 );
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
224 } while ( gtk_tree_model_iter_next( store , &iter ) );
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
225 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
226 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
227
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
228 return;
2313
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 static void
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
233 playlist_manager_cb_lv_dclick ( GtkTreeView * listview , GtkTreePath * path ,
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
234 GtkTreeViewColumn * col , gpointer userdata )
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
235 {
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
236 GtkTreeModel *store;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
237 GtkTreeIter iter;
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
238 Playlist *playlist = NULL, *active;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
239
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
240 store = gtk_tree_view_get_model( GTK_TREE_VIEW(listview) );
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
241 if ( gtk_tree_model_get_iter( store , &iter , path ) == TRUE )
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
242 {
3623
3625e0085d7f Change PLLIST_COL_PLPOINTER to PLLIST_PLPOINTER for consistency
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3622
diff changeset
243 gtk_tree_model_get( store , &iter , PLLIST_PLPOINTER , &playlist , -1 );
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
244 DISABLE_MANAGER_UPDATE();
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
245 playlist_select_playlist( playlist );
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
246 ENABLE_MANAGER_UPDATE();
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
247 }
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
248
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
249 if ( gtk_tree_model_get_iter_first( store , &iter ) )
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
250 {
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
251 /* update bolded playlist */
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
252 active = playlist_get_active();
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
253 do {
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
254 gtk_tree_model_get( store , &iter ,
3623
3625e0085d7f Change PLLIST_COL_PLPOINTER to PLLIST_PLPOINTER for consistency
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3622
diff changeset
255 PLLIST_PLPOINTER , &playlist , -1 );
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
256 gtk_list_store_set( GTK_LIST_STORE(store) , &iter ,
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
257 PLLIST_TEXT_WEIGHT , playlist == active ?
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
258 PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL ,
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
259 -1 );
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
260 } while ( gtk_tree_model_iter_next( store , &iter ) );
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
261 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
262
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
263 return;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
264 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
265
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
266
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
267 static void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
268 playlist_manager_cb_lv_pmenu_rename ( GtkMenuItem *menuitem , gpointer lv )
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
269 {
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
270 GtkTreeSelection *listsel = gtk_tree_view_get_selection( GTK_TREE_VIEW(lv) );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
271 GtkTreeModel *store;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
272 GtkTreeIter iter;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
273
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
274 if ( gtk_tree_selection_get_selected( listsel , &store , &iter ) == TRUE )
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
275 {
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
276 GtkTreePath *path = gtk_tree_model_get_path( GTK_TREE_MODEL(store) , &iter );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
277 GtkCellRenderer *rndrname = g_object_get_data( G_OBJECT(lv) , "rn" );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
278 /* set the name renderer to editable and start editing */
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
279 g_object_set( G_OBJECT(rndrname) , "editable" , TRUE , NULL );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
280 gtk_tree_view_set_cursor_on_cell( GTK_TREE_VIEW(lv) , path ,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
281 gtk_tree_view_get_column( GTK_TREE_VIEW(lv) , PLLIST_COL_NAME ) , rndrname , TRUE );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
282 gtk_tree_path_free( path );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
283 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
284 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
285
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
286 static void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
287 playlist_manager_cb_lv_name_edited ( GtkCellRendererText *cell , gchar *path_string ,
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
288 gchar *new_text , gpointer listview )
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
289 {
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
290 /* this is currently used to change playlist names */
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
291 GtkTreeModel *store = gtk_tree_view_get_model( GTK_TREE_VIEW(listview) );
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
292 GtkTreeIter iter;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
293
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
294 if ( gtk_tree_model_get_iter_from_string( store , &iter , path_string ) == TRUE )
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
295 {
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
296 Playlist *playlist = NULL;
3623
3625e0085d7f Change PLLIST_COL_PLPOINTER to PLLIST_PLPOINTER for consistency
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3622
diff changeset
297 gtk_tree_model_get( GTK_TREE_MODEL(store), &iter, PLLIST_PLPOINTER , &playlist , -1 );
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
298 DISABLE_MANAGER_UPDATE();
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
299 playlist_set_current_name( playlist , new_text );
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
300 ENABLE_MANAGER_UPDATE();
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
301 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
302 }
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
303 /* set the renderer uneditable again */
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
304 g_object_set( G_OBJECT(cell) , "editable" , FALSE , NULL );
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
305 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
306
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
307
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
308 static gboolean
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
309 playlist_manager_cb_lv_btpress ( GtkWidget *lv , GdkEventButton *event )
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
310 {
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
311 if (( event->type == GDK_BUTTON_PRESS ) && ( event->button == 3 ))
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
312 {
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
313 GtkWidget *pmenu = (GtkWidget*)g_object_get_data( G_OBJECT(lv) , "menu" );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
314 gtk_menu_popup( GTK_MENU(pmenu) , NULL , NULL , NULL , NULL ,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
315 (event != NULL) ? event->button : 0,
3465
0dd74d0da472 the less gdk calls, the better
Tomasz Mon <desowin@gmail.com>
parents: 3123
diff changeset
316 event->time);
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
317 return TRUE;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
318 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
319
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
320 return FALSE;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
321 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
322
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
323
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
324 static gboolean
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
325 playlist_manager_cb_keypress ( GtkWidget *win , GdkEventKey *event )
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
326 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
327 switch (event->keyval)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
328 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
329 case GDK_Escape:
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
330 gtk_widget_destroy( playman_win );
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
331 return TRUE;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
332 default:
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
333 return FALSE;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
334 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
335 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
336
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
337
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
338 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
339 playlist_manager_ui_show ( void )
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
340 {
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
341 GtkWidget *playman_vbox;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
342 GtkWidget *playman_pl_lv, *playman_pl_lv_frame, *playman_pl_lv_sw;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
343 GtkCellRenderer *playman_pl_lv_textrndr_name, *playman_pl_lv_textrndr_entriesnum;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
344 GtkTreeViewColumn *playman_pl_lv_col_name, *playman_pl_lv_col_entriesnum;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
345 GtkListStore *pl_store;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
346 GtkWidget *playman_pl_lv_pmenu, *playman_pl_lv_pmenu_rename;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
347 GtkWidget *playman_bbar_hbbox;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
348 GtkWidget *playman_bbar_bt_new, *playman_bbar_bt_del, *playman_bbar_bt_close;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
349 GdkGeometry playman_win_hints;
3625
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
350 GtkTreeIter active_iter;
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
351 GtkTreePath *active_path;
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 )
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
354 {
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
355 gtk_window_present( GTK_WINDOW(playman_win) );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
356 return;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
357 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
358
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
359 playman_win = gtk_window_new( GTK_WINDOW_TOPLEVEL );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
360 gtk_window_set_type_hint( GTK_WINDOW(playman_win), GDK_WINDOW_TYPE_HINT_DIALOG );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
361 gtk_window_set_transient_for( GTK_WINDOW(playman_win) , GTK_WINDOW(mainwin) );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
362 gtk_window_set_position( GTK_WINDOW(playman_win), GTK_WIN_POS_CENTER );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
363 gtk_window_set_title( GTK_WINDOW(playman_win), _("Playlist Manager") );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
364 gtk_container_set_border_width( GTK_CONTAINER(playman_win), 10 );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
365 g_signal_connect( G_OBJECT(playman_win) , "destroy" ,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
366 G_CALLBACK(gtk_widget_destroyed) , &playman_win );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
367 g_signal_connect( G_OBJECT(playman_win) , "key-press-event" ,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
368 G_CALLBACK(playlist_manager_cb_keypress) , NULL );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
369 playman_win_hints.min_width = 400;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
370 playman_win_hints.min_height = 250;
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
371 gtk_window_set_geometry_hints( GTK_WINDOW(playman_win) , GTK_WIDGET(playman_win) ,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
372 &playman_win_hints , GDK_HINT_MIN_SIZE );
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
373
2809
490638dcef74 [svn] - Made stuff prettier
mf0102
parents: 2808
diff changeset
374 playman_vbox = gtk_vbox_new( FALSE , 10 );
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
375 gtk_container_add( GTK_CONTAINER(playman_win) , playman_vbox );
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
376
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
377 /* current liststore model
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
378 ----------------------------------------------
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
379 G_TYPE_STRING -> playlist name
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
380 G_TYPE_UINT -> number of entries in playlist
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
381 G_TYPE_POINTER -> playlist pointer (Playlist*)
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
382 PANGO_TYPE_WEIGHT -> font weight
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
383 ----------------------------------------------
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
384 */
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
385 pl_store = gtk_list_store_new( PLLIST_NUMCOLS ,
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
386 G_TYPE_STRING , G_TYPE_UINT , G_TYPE_POINTER , PANGO_TYPE_WEIGHT );
3625
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
387 active_iter = playlist_manager_populate( pl_store );
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
388
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
389 playman_pl_lv_frame = gtk_frame_new( NULL );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
390 playman_pl_lv = gtk_tree_view_new_with_model( GTK_TREE_MODEL(pl_store) );
3625
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
391
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
392 g_object_set_data( G_OBJECT(playman_win) , "lv" , playman_pl_lv );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
393 g_object_set_data( G_OBJECT(playman_pl_lv) , "opt1" , GINT_TO_POINTER(0) );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
394 playman_pl_lv_textrndr_entriesnum = gtk_cell_renderer_text_new(); /* uneditable */
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
395 playman_pl_lv_textrndr_name = gtk_cell_renderer_text_new(); /* can become editable */
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
396 g_object_set( G_OBJECT(playman_pl_lv_textrndr_entriesnum) , "weight-set" , TRUE , NULL );
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
397 g_object_set( G_OBJECT(playman_pl_lv_textrndr_name) , "weight-set" , TRUE , NULL );
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
398 g_signal_connect( G_OBJECT(playman_pl_lv_textrndr_name) , "edited" ,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
399 G_CALLBACK(playlist_manager_cb_lv_name_edited) , playman_pl_lv );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
400 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
401 playman_pl_lv_col_name = gtk_tree_view_column_new_with_attributes(
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
402 _("Playlist") , playman_pl_lv_textrndr_name ,
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
403 "text" , PLLIST_COL_NAME ,
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
404 "weight", PLLIST_TEXT_WEIGHT ,
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
405 NULL );
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
406 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
407 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
408 playman_pl_lv_col_entriesnum = gtk_tree_view_column_new_with_attributes(
3622
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
409 _("Entries") , playman_pl_lv_textrndr_entriesnum ,
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
410 "text" , PLLIST_COL_ENTRIESNUM ,
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
411 "weight", PLLIST_TEXT_WEIGHT ,
3f6d23bc3f8d Make active playlist bold in playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3471
diff changeset
412 NULL );
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
413 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
414 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
415 playman_pl_lv_sw = gtk_scrolled_window_new( NULL , NULL );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
416 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(playman_pl_lv_sw) ,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
417 GTK_POLICY_NEVER , GTK_POLICY_ALWAYS );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
418 gtk_container_add( GTK_CONTAINER(playman_pl_lv_sw) , playman_pl_lv );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
419 gtk_container_add( GTK_CONTAINER(playman_pl_lv_frame) , playman_pl_lv_sw );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
420 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
421
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
422 /* listview popup menu */
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
423 playman_pl_lv_pmenu = gtk_menu_new();
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
424 playman_pl_lv_pmenu_rename = gtk_menu_item_new_with_mnemonic( _( "_Rename" ) );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
425 g_signal_connect( G_OBJECT(playman_pl_lv_pmenu_rename) , "activate" ,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
426 G_CALLBACK(playlist_manager_cb_lv_pmenu_rename) , playman_pl_lv );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
427 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
428 gtk_widget_show_all( playman_pl_lv_pmenu );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
429 g_object_set_data( G_OBJECT(playman_pl_lv) , "menu" , playman_pl_lv_pmenu );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
430 g_signal_connect_swapped( G_OBJECT(playman_win) , "destroy" ,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
431 G_CALLBACK(gtk_widget_destroy) , playman_pl_lv_pmenu );
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
432
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
433 /* button bar */
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
434 playman_bbar_hbbox = gtk_hbutton_box_new();
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
435 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
436 gtk_button_box_set_spacing(GTK_BUTTON_BOX(playman_bbar_hbbox), 5);
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
437 playman_bbar_bt_close = gtk_button_new_from_stock( GTK_STOCK_CLOSE );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
438 playman_bbar_bt_del = gtk_button_new_from_stock( GTK_STOCK_DELETE );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
439 playman_bbar_bt_new = gtk_button_new_from_stock( GTK_STOCK_NEW );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
440 gtk_container_add( GTK_CONTAINER(playman_bbar_hbbox) , playman_bbar_bt_close );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
441 gtk_container_add( GTK_CONTAINER(playman_bbar_hbbox) , playman_bbar_bt_del );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
442 gtk_container_add( GTK_CONTAINER(playman_bbar_hbbox) , playman_bbar_bt_new );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
443 gtk_button_box_set_child_secondary( GTK_BUTTON_BOX(playman_bbar_hbbox) ,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
444 playman_bbar_bt_close , TRUE );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
445 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
446
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
447 g_signal_connect( G_OBJECT(playman_pl_lv) , "button-press-event" ,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
448 G_CALLBACK(playlist_manager_cb_lv_btpress) , NULL );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
449 g_signal_connect( G_OBJECT(playman_pl_lv) , "row-activated" ,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
450 G_CALLBACK(playlist_manager_cb_lv_dclick) , NULL );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
451 g_signal_connect_swapped( G_OBJECT(playman_bbar_bt_new) , "clicked" ,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
452 G_CALLBACK(playlist_manager_cb_new) , playman_pl_lv );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
453 g_signal_connect_swapped( G_OBJECT(playman_bbar_bt_del) , "clicked" ,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
454 G_CALLBACK(playlist_manager_cb_del) , playman_pl_lv );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
455 g_signal_connect_swapped( G_OBJECT(playman_bbar_bt_close) , "clicked" ,
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
456 G_CALLBACK(gtk_widget_destroy) , playman_win );
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
457
3625
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
458 /* have active playlist selected and scrolled to */
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
459 active_path = gtk_tree_model_get_path( GTK_TREE_MODEL(pl_store) ,
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
460 &active_iter );
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
461 gtk_tree_view_set_cursor( GTK_TREE_VIEW(playman_pl_lv) ,
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
462 active_path , NULL , FALSE );
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
463 gtk_tree_view_scroll_to_cell( GTK_TREE_VIEW(playman_pl_lv) ,
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
464 active_path , NULL , TRUE , 0.5 , 0.0 );
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
465 gtk_tree_path_free( active_path );
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
466
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
467 g_object_unref( pl_store );
8d7775f48a4d Select and scroll to active playlist when opening playlist manager
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3624
diff changeset
468
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
469 gtk_widget_show_all( playman_win );
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
470 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
471
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
472
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
473 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
474 playlist_manager_update ( void )
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
475 {
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
476 /* this function is called whenever there is a change in playlist, such as
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
477 playlist created/deleted or entry added/deleted in a playlist; if the playlist
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
478 manager is active, it should be updated to keep consistency of information */
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
479
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
480 /* CAREFUL! this currently locks/unlocks all the playlists */
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
481
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
482 if ( playman_win != NULL )
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
483 {
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
484 GtkWidget *lv = (GtkWidget*)g_object_get_data( G_OBJECT(playman_win) , "lv" );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
485 if ( GPOINTER_TO_INT(g_object_get_data(G_OBJECT(lv),"opt1")) == 0 )
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
486 {
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
487 GtkListStore *store = (GtkListStore*)gtk_tree_view_get_model( GTK_TREE_VIEW(lv) );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
488 playlist_manager_populate( store );
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
489 }
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
490 return;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
491 }
2808
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
492 else
dbc3f9e18c71 [svn] - More button reordering
mf0102
parents: 2659
diff changeset
493 return; /* if the playlist manager is not active, simply return */
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
494 }