annotate audacious/ui_playlist.c @ 2269:18228302c204 trunk

[svn] Make a string in ui_playist.c translatable, and update po/
author kiyoshi
date Thu, 04 Jan 2007 13:56:51 -0800
parents 8c9e27a834fd
children 05ea2b608e3d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1 /* Audacious - Cross-platform multimedia player
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2 * Copyright (C) 2005-2006 Audacious development team.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
3 *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
4 * BMP - Cross-platform multimedia player
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
5 * Copyright (C) 2003-2004 BMP development team.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
6 *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
7 * Based on XMMS:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
8 * Copyright (C) 1998-2003 XMMS development team.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
9 *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
2105
f18a5b617c34 [svn] - move to GPLv2-only. Based on my interpretation of the license, we are
nenolod
parents: 2095
diff changeset
12 * the Free Software Foundation; under version 2 of the License.
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
13 *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
17 * GNU General Public License for more details.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
18 *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
22 */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
23
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
24 #include "ui_playlist.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
25
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
26 #include <glib.h>
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
27 #include <glib/gi18n.h>
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
28 #include <gdk/gdk.h>
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
29 #include <gdk/gdkkeysyms.h>
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
30 #include <gtk/gtk.h>
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
31 #include <string.h>
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
32
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
33 #include "platform/smartinclude.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
34
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
35 #include <unistd.h>
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
36 #include <errno.h>
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
37
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
38 #include "libaudacious/util.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
39
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
40 #include "dnd.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
41 #include "dock.h"
2236
ae7c17c4ef8b [svn] - rename equalizer.c to ui_equalizer.c
nenolod
parents: 2232
diff changeset
42 #include "ui_equalizer.h"
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
43 #include "hints.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
44 #include "input.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
45 #include "main.h"
2237
d507d2c1f75c [svn] - rename mainwin.c to ui_main.c and such
nenolod
parents: 2236
diff changeset
46 #include "ui_main.h"
2232
ac2ea05e60a0 [svn] - migration from gtkitemfactory to actions and uimanager; main menu has been ported, still much work and test to do
giacomo
parents: 2228
diff changeset
47 #include "ui_manager.h"
2260
8960824f6706 [svn] - ported ui_equalizer.c to ui_manager.c framework
giacomo
parents: 2259
diff changeset
48 #include "actions-playlist.h"
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
49 #include "playback.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
50 #include "playlist.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
51 #include "playlist_container.h"
2201
39e9c8e2745d [svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents: 2183
diff changeset
52 #include "playlist_manager.h"
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
53 #include "util.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
54
2205
cc6a05baa156 [svn] - added audacious stock icons; source files wanting to use them must include icons-stock.h; removed obsolete pixmaps.h
giacomo
parents: 2201
diff changeset
55 #include "icons-stock.h"
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
56 #include "images/audacious_playlist.xpm"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
57
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
58 GtkWidget *playlistwin;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
59
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
60 PlayList_List *playlistwin_list = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
61 PButton *playlistwin_shade, *playlistwin_close;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
62
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
63 static gboolean playlistwin_resizing = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
64
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
65 static GdkPixmap *playlistwin_bg;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
66 static GdkBitmap *playlistwin_mask = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
67 static GdkGC *playlistwin_gc;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
68
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
69 static gboolean playlistwin_hint_flag = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
70
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
71 static PlaylistSlider *playlistwin_slider = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
72 static TextBox *playlistwin_time_min, *playlistwin_time_sec;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
73 static TextBox *playlistwin_info, *playlistwin_sinfo;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
74 static SButton *playlistwin_srew, *playlistwin_splay;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
75 static SButton *playlistwin_spause, *playlistwin_sstop;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
76 static SButton *playlistwin_sfwd, *playlistwin_seject;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
77 static SButton *playlistwin_sscroll_up, *playlistwin_sscroll_down;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
78
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
79 static GList *playlistwin_wlist = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
80
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
81 void playlistwin_select_search_cbt_cb( GtkWidget *called_cbt ,
2144
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
82 gpointer other_cbt );
2145
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
83 static gboolean playlistwin_select_search_kp_cb( GtkWidget *entry , GdkEventKey *event ,
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
84 gpointer searchdlg_win );
2144
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
85
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
86 static void playlistwin_draw_frame(void);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
87
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
88
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
89 gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
90 playlistwin_is_shaded(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
91 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
92 return cfg.playlist_shaded;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
93 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
94
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
95 gint
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
96 playlistwin_get_width(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
97 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
98 cfg.playlist_width /= PLAYLISTWIN_WIDTH_SNAP;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
99 cfg.playlist_width *= PLAYLISTWIN_WIDTH_SNAP;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
100 return cfg.playlist_width;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
101 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
102
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
103 gint
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
104 playlistwin_get_height_unshaded(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
105 {
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 2048
diff changeset
106 gint height;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
107 cfg.playlist_height /= PLAYLISTWIN_HEIGHT_SNAP;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
108 cfg.playlist_height *= PLAYLISTWIN_HEIGHT_SNAP;
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 2048
diff changeset
109 height = cfg.playlist_height;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
110 return height;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
111 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
112
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
113 gint
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
114 playlistwin_get_height_shaded(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
115 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
116 return PLAYLISTWIN_SHADED_HEIGHT;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
117 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
118
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
119 gint
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
120 playlistwin_get_height(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
121 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
122 if (playlistwin_is_shaded())
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
123 return playlistwin_get_height_shaded();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
124 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
125 return playlistwin_get_height_unshaded();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
126 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
127
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
128 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
129 playlistwin_get_size(gint * width, gint * height)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
130 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
131 if (width)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
132 *width = playlistwin_get_width();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
133
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
134 if (height)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
135 *height = playlistwin_get_height();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
136 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
137
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
138 static void
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
139 playlistwin_update_info(Playlist *playlist)
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
140 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
141 gchar *text, *sel_text, *tot_text;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
142 gulong selection, total;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
143 gboolean selection_more, total_more;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
144
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
145 playlist_get_total_time(playlist, &total, &selection, &total_more, &selection_more);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
146
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
147 if (selection > 0 || (selection == 0 && !selection_more)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
148 if (selection > 3600)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
149 sel_text =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
150 g_strdup_printf("%lu:%-2.2lu:%-2.2lu%s", selection / 3600,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
151 (selection / 60) % 60, selection % 60,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
152 (selection_more ? "+" : ""));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
153 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
154 sel_text =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
155 g_strdup_printf("%lu:%-2.2lu%s", selection / 60,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
156 selection % 60, (selection_more ? "+" : ""));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
157 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
158 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
159 sel_text = g_strdup("?");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
160 if (total > 0 || (total == 0 && !total_more)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
161 if (total > 3600)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
162 tot_text =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
163 g_strdup_printf("%lu:%-2.2lu:%-2.2lu%s", total / 3600,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
164 (total / 60) % 60, total % 60,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
165 total_more ? "+" : "");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
166 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
167 tot_text =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
168 g_strdup_printf("%lu:%-2.2lu%s", total / 60, total % 60,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
169 total_more ? "+" : "");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
170 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
171 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
172 tot_text = g_strdup("?");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
173 text = g_strconcat(sel_text, "/", tot_text, NULL);
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
174 textbox_set_text(playlistwin_info, text ? text : "");
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
175 g_free(text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
176 g_free(tot_text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
177 g_free(sel_text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
178 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
179
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
180 static void
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
181 playlistwin_update_sinfo(Playlist *playlist)
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
182 {
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
183 gchar *posstr, *timestr, *title, *info;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
184 gint pos, time;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
185
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
186 pos = playlist_get_position(playlist);
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
187 title = playlist_get_songtitle(playlist, pos);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
188
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
189 if (!title) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
190 textbox_set_text(playlistwin_sinfo, "");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
191 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
192 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
193
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
194 convert_title_text(title);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
195
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
196 time = playlist_get_songtime(playlist, pos);
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
197
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
198 if (cfg.show_numbers_in_pl)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
199 posstr = g_strdup_printf("%d. ", pos + 1);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
200 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
201 posstr = g_strdup("");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
202
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
203 if (time != -1) {
1800
61f531908dd0 [svn] - Put ()'s around the time in the shaded playlist text.
nhjm449
parents: 1775
diff changeset
204 timestr = g_strdup_printf(" (%d:%-2.2d)", time / 60000,
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
205 (time / 1000) % 60);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
206 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
207 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
208 timestr = g_strdup("");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
209
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
210 info = g_strdup_printf("%s%s%s", posstr, title, timestr);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
211
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
212 g_free(posstr);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
213 g_free(title);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
214 g_free(timestr);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
215
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
216 textbox_set_text(playlistwin_sinfo, info ? info : "");
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
217 g_free(info);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
218 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
219
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
220 gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
221 playlistwin_item_visible(gint index)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
222 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
223 if (index >= playlistwin_list->pl_first
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
224 && index <
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
225 (playlistwin_list->pl_first + playlistwin_list->pl_num_visible))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
226 return TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
227 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
228 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
229
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
230 gint
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
231 playlistwin_get_toprow(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
232 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
233 if (playlistwin_list)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
234 return (playlistwin_list->pl_first);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
235 return (-1);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
236 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
237
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
238 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
239 playlistwin_set_toprow(gint toprow)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
240 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
241 if (playlistwin_list)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
242 playlistwin_list->pl_first = toprow;
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
243 playlistwin_update_list(playlist_get_active());
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
244 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
245
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
246 void
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
247 playlistwin_update_list(Playlist *playlist)
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
248 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
249 g_return_if_fail(playlistwin_list != NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
250
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
251 widget_draw(WIDGET(playlistwin_list));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
252 widget_draw(WIDGET(playlistwin_slider));
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
253 playlistwin_update_info(playlist);
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
254 playlistwin_update_sinfo(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
255 /* mainwin_update_jtf(); */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
256 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
257
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
258 #if 0
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
259 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
260 playlistwin_redraw_list(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
261 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
262 g_return_if_fail(playlistwin_list != NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
263
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
264 draw_widget(playlistwin_list);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
265 draw_widget(playlistwin_slider);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
266 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
267 #endif
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
268
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
269 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
270 playlistwin_set_mask(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
271 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
272 GdkGC *gc;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
273 GdkColor pattern;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
274
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
275 if (playlistwin_mask)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
276 g_object_unref(playlistwin_mask);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
277
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
278 playlistwin_mask =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
279 gdk_pixmap_new(playlistwin->window, playlistwin_get_width(),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
280 playlistwin_get_height(), 1);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
281 gc = gdk_gc_new(playlistwin_mask);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
282 pattern.pixel = 1;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
283 gdk_gc_set_foreground(gc, &pattern);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
284 gdk_draw_rectangle(playlistwin_mask, gc, TRUE, 0, 0,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
285 playlistwin_get_width(), playlistwin_get_height());
2163
ac8a7d286616 [svn] - gdk_image_destroy -> g_object_unref
nenolod
parents: 2153
diff changeset
286 g_object_unref(gc);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
287
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
288 gtk_widget_shape_combine_mask(playlistwin, playlistwin_mask, 0, 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
289 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
290
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
291 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
292 playlistwin_set_geometry_hints(gboolean shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
293 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
294 GdkGeometry geometry;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
295 GdkWindowHints mask;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
296
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
297 geometry.min_width = PLAYLISTWIN_MIN_WIDTH;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
298 geometry.max_width = G_MAXUINT16;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
299
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
300 geometry.width_inc = PLAYLISTWIN_WIDTH_SNAP;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
301 geometry.height_inc = PLAYLISTWIN_HEIGHT_SNAP;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
302
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
303 if (shaded) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
304 geometry.min_height = PLAYLISTWIN_SHADED_HEIGHT;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
305 geometry.max_height = PLAYLISTWIN_SHADED_HEIGHT;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
306 geometry.base_height = PLAYLISTWIN_SHADED_HEIGHT;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
307 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
308 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
309 geometry.min_height = PLAYLISTWIN_MIN_HEIGHT;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
310 geometry.max_height = G_MAXUINT16;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
311 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
312
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
313 mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_RESIZE_INC;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
314
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
315 gtk_window_set_geometry_hints(GTK_WINDOW(playlistwin),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
316 playlistwin, &geometry, mask);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
317 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
318
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
319 void
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
320 playlistwin_set_sinfo_font(gchar *font)
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
321 {
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
322 gchar *tmp = NULL, *tmp2 = NULL;
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
323
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
324 if(!font)
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
325 return;
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
326
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
327 tmp = g_strdup(font);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
328 if(!tmp)
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
329 return;
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
330
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
331 *strrchr(tmp, ' ') = '\0';
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
332 tmp2 = g_strdup_printf("%s 8", tmp);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
333 if(!tmp2)
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
334 return;
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
335 textbox_set_xfont(playlistwin_sinfo, cfg.mainwin_use_xfont, tmp2);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
336
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
337 g_free(tmp); g_free(tmp2);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
338 }
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
339
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
340 void
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
341 playlistwin_set_sinfo_scroll(gboolean scroll)
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
342 {
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
343 GtkWidget *item;
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
344
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
345 if(playlistwin_is_shaded())
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
346 textbox_set_scroll(playlistwin_sinfo, cfg.autoscroll);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
347 else
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
348 textbox_set_scroll(playlistwin_sinfo, FALSE);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
349 }
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
350
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
351 void
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
352 playlistwin_set_shade(gboolean shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
353 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
354 cfg.playlist_shaded = shaded;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
355
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
356 if (shaded) {
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
357 playlistwin_set_sinfo_font(cfg.playlist_font);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
358 playlistwin_set_sinfo_scroll(cfg.autoscroll);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
359 widget_show(WIDGET(playlistwin_sinfo));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
360 playlistwin_shade->pb_nx = 128;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
361 playlistwin_shade->pb_ny = 45;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
362 playlistwin_shade->pb_px = 150;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
363 playlistwin_shade->pb_py = 42;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
364 playlistwin_close->pb_nx = 138;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
365 playlistwin_close->pb_ny = 45;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
366 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
367 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
368 widget_hide(WIDGET(playlistwin_sinfo));
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
369 playlistwin_set_sinfo_scroll(FALSE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
370 playlistwin_shade->pb_nx = 157;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
371 playlistwin_shade->pb_ny = 3;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
372 playlistwin_shade->pb_px = 62;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
373 playlistwin_shade->pb_py = 42;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
374 playlistwin_close->pb_nx = 167;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
375 playlistwin_close->pb_ny = 3;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
376 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
377
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
378 dock_shade(dock_window_list, GTK_WINDOW(playlistwin),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
379 playlistwin_get_height());
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
380
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
381 playlistwin_set_geometry_hints(cfg.playlist_shaded);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
382
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
383 gtk_window_resize(GTK_WINDOW(playlistwin),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
384 playlistwin_get_width(),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
385 playlistwin_get_height());
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
386
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
387 playlistwin_set_mask();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
388
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
389 widget_draw(WIDGET(playlistwin_list));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
390 widget_draw(WIDGET(playlistwin_slider));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
391
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
392 draw_playlist_window(TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
393 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
394
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
395 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
396 playlistwin_set_shade_menu(gboolean shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
397 {
2232
ac2ea05e60a0 [svn] - migration from gtkitemfactory to actions and uimanager; main menu has been ported, still much work and test to do
giacomo
parents: 2228
diff changeset
398 GtkAction *action = gtk_action_group_get_action(
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
399 toggleaction_group_others , "roll up playlist editor" );
2232
ac2ea05e60a0 [svn] - migration from gtkitemfactory to actions and uimanager; main menu has been ported, still much work and test to do
giacomo
parents: 2228
diff changeset
400 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , shaded );
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
401
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
402 playlistwin_set_shade(shaded);
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
403 playlistwin_update_list(playlist_get_active());
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
404 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
405
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
406 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
407 playlistwin_shade_toggle(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
408 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
409 playlistwin_set_shade_menu(!cfg.playlist_shaded);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
410 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
411
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
412 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
413 playlistwin_release(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
414 GdkEventButton * event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
415 gpointer callback_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
416 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
417 if (event->button == 3)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
418 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
419
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
420 gdk_pointer_ungrab(GDK_CURRENT_TIME);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
421 playlistwin_resizing = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
422 gdk_flush();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
423
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
424 if (dock_is_moving(GTK_WINDOW(playlistwin)))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
425 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
426 dock_move_release(GTK_WINDOW(playlistwin));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
427
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
428 if (cfg.playlist_transparent)
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
429 playlistwin_update_list(playlist_get_active());
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
430 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
431 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
432 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
433 handle_release_cb(playlistwin_wlist, widget, event);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
434 draw_playlist_window(FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
435 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
436 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
437
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
438 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
439 playlistwin_scroll(gint num)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
440 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
441 playlistwin_list->pl_first += num;
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
442 playlistwin_update_list(playlist_get_active());
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
443 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
444
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
445 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
446 playlistwin_scroll_up_pushed(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
447 {
2026
f15664434382 [svn] rewrite scan thread with g_cond_wait():
yaz
parents: 1938
diff changeset
448 playlistwin_scroll(-3);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
449 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
450
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
451 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
452 playlistwin_scroll_down_pushed(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
453 {
2026
f15664434382 [svn] rewrite scan thread with g_cond_wait():
yaz
parents: 1938
diff changeset
454 playlistwin_scroll(3);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
455 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
456
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
457 static void
2139
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
458 playlistwin_select_all(void)
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
459 {
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
460 Playlist *playlist = playlist_get_active();
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
461
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
462 playlist_select_all(playlist, TRUE);
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
463 playlistwin_list->pl_prev_selected = 0;
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
464 playlistwin_list->pl_prev_min = 0;
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
465 playlistwin_list->pl_prev_max = playlist_get_length(playlist) - 1;
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
466 playlistwin_update_list(playlist);
2139
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
467 }
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
468
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
469 static void
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
470 playlistwin_select_none(void)
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
471 {
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
472 playlist_select_all(playlist_get_active(), FALSE);
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
473 playlistwin_list->pl_prev_selected = -1;
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
474 playlistwin_list->pl_prev_min = -1;
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
475 playlistwin_update_list(playlist_get_active());
2139
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
476 }
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
477
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
478 static void
2129
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
479 playlistwin_select_search(void)
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
480 {
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
481 Playlist *playlist = playlist_get_active();
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
482 GtkWidget *searchdlg_win, *searchdlg_table;
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
483 GtkWidget *searchdlg_hbox, *searchdlg_logo, *searchdlg_helptext;
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
484 GtkWidget *searchdlg_entry_track_name, *searchdlg_label_track_name;
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
485 GtkWidget *searchdlg_entry_album_name, *searchdlg_label_album_name;
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
486 GtkWidget *searchdlg_entry_file_name, *searchdlg_label_file_name;
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
487 GtkWidget *searchdlg_entry_performer, *searchdlg_label_performer;
2139
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
488 GtkWidget *searchdlg_checkbt_clearprevsel;
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
489 GtkWidget *searchdlg_checkbt_newplaylist;
2144
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
490 GtkWidget *searchdlg_checkbt_autoenqueue;
2129
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
491 gint result;
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
492
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
493 /* create dialog */
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
494 searchdlg_win = gtk_dialog_new_with_buttons(
2269
18228302c204 [svn] Make a string in ui_playist.c translatable, and update po/
kiyoshi
parents: 2267
diff changeset
495 _("Search entries in active playlist") , GTK_WINDOW(mainwin) ,
2129
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
496 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT ,
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
497 GTK_STOCK_CANCEL , GTK_RESPONSE_REJECT , GTK_STOCK_OK , GTK_RESPONSE_ACCEPT , NULL );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
498 /* help text and logo */
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
499 searchdlg_hbox = gtk_hbox_new( FALSE , 4 );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
500 searchdlg_logo = gtk_image_new_from_stock( GTK_STOCK_FIND , GTK_ICON_SIZE_DIALOG );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
501 searchdlg_helptext = gtk_label_new( _("Select entries in playlist by filling one or more "
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
502 "fields. Fields use regular expressions syntax, case-insensitive. If you don't know how "
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
503 "regular expressions work, simply insert a literal portion of what you're searching for.") );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
504 gtk_label_set_line_wrap( GTK_LABEL(searchdlg_helptext) , TRUE );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
505 gtk_box_pack_start( GTK_BOX(searchdlg_hbox) , searchdlg_logo , FALSE , FALSE , 0 );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
506 gtk_box_pack_start( GTK_BOX(searchdlg_hbox) , searchdlg_helptext , FALSE , FALSE , 0 );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
507 /* track name */
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
508 searchdlg_label_track_name = gtk_label_new( _("Track name: ") );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
509 searchdlg_entry_track_name = gtk_entry_new();
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
510 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_track_name) , 0 , 0.5 );
2145
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
511 g_signal_connect( G_OBJECT(searchdlg_entry_track_name) , "key-press-event" ,
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
512 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win );
2129
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
513 /* album name */
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
514 searchdlg_label_album_name = gtk_label_new( _("Album name: ") );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
515 searchdlg_entry_album_name = gtk_entry_new();
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
516 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_album_name) , 0 , 0.5 );
2145
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
517 g_signal_connect( G_OBJECT(searchdlg_entry_album_name) , "key-press-event" ,
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
518 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win );
2129
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
519 /* artist */
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
520 searchdlg_label_performer = gtk_label_new( _("Artist: ") );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
521 searchdlg_entry_performer = gtk_entry_new();
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
522 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_performer) , 0 , 0.5 );
2145
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
523 g_signal_connect( G_OBJECT(searchdlg_entry_performer) , "key-press-event" ,
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
524 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win );
2129
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
525 /* file name */
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
526 searchdlg_label_file_name = gtk_label_new( _("Filename: ") );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
527 searchdlg_entry_file_name = gtk_entry_new();
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
528 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_file_name) , 0 , 0.5 );
2145
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
529 g_signal_connect( G_OBJECT(searchdlg_entry_file_name) , "key-press-event" ,
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
530 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win );
2139
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
531 /* some options that control behaviour */
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
532 searchdlg_checkbt_clearprevsel = gtk_check_button_new_with_label(
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
533 _("Clear previous selection before searching") );
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
534 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_clearprevsel) , TRUE );
2144
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
535 searchdlg_checkbt_autoenqueue = gtk_check_button_new_with_label(
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
536 _("Automatically toggle queue for matching entries") );
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
537 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_autoenqueue) , FALSE );
2139
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
538 searchdlg_checkbt_newplaylist = gtk_check_button_new_with_label(
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
539 _("Create a new playlist with matching entries") );
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
540 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_newplaylist) , FALSE );
2144
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
541 g_signal_connect( G_OBJECT(searchdlg_checkbt_autoenqueue) , "clicked" ,
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
542 G_CALLBACK(playlistwin_select_search_cbt_cb) , searchdlg_checkbt_newplaylist );
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
543 g_signal_connect( G_OBJECT(searchdlg_checkbt_newplaylist) , "clicked" ,
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
544 G_CALLBACK(playlistwin_select_search_cbt_cb) , searchdlg_checkbt_autoenqueue );
2129
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
545 /* place fields in searchdlg_table */
2144
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
546 searchdlg_table = gtk_table_new( 8 , 2 , FALSE );
2129
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
547 gtk_table_set_row_spacing( GTK_TABLE(searchdlg_table) , 0 , 8 );
2139
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
548 gtk_table_set_row_spacing( GTK_TABLE(searchdlg_table) , 4 , 8 );
2129
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
549 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_hbox ,
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
550 0 , 2 , 0 , 1 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
551 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_track_name ,
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
552 0 , 1 , 1 , 2 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
553 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_track_name ,
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
554 1 , 2 , 1 , 2 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
555 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_album_name ,
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
556 0 , 1 , 2 , 3 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
557 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_album_name ,
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
558 1 , 2 , 2 , 3 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
559 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_performer ,
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
560 0 , 1 , 3 , 4 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
561 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_performer ,
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
562 1 , 2 , 3 , 4 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
563 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_file_name ,
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
564 0 , 1 , 4 , 5 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
565 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_file_name ,
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
566 1 , 2 , 4 , 5 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 );
2139
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
567 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_clearprevsel ,
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
568 0 , 2 , 5 , 6 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 );
2144
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
569 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_autoenqueue ,
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
570 0 , 2 , 6 , 7 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 );
2139
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
571 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_newplaylist ,
2144
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
572 0 , 2 , 7 , 8 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 );
2129
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
573
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
574 gtk_container_set_border_width( GTK_CONTAINER(searchdlg_table) , 5 );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
575 gtk_container_add( GTK_CONTAINER(GTK_DIALOG(searchdlg_win)->vbox) , searchdlg_table );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
576 gtk_widget_show_all( searchdlg_win );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
577 result = gtk_dialog_run( GTK_DIALOG(searchdlg_win) );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
578 switch(result)
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
579 {
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
580 case GTK_RESPONSE_ACCEPT:
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
581 {
2139
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
582 gint matched_entries_num = 0;
2129
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
583 /* create a TitleInput tuple with user search data */
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
584 TitleInput *tuple = g_malloc(sizeof(TitleInput));
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
585 gchar *searchdata = NULL;
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
586 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_track_name) );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
587 tuple->track_name = ( strcmp(searchdata,"") ) ? g_strdup(searchdata) : NULL;
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
588 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_album_name) );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
589 tuple->album_name = ( strcmp(searchdata,"") ) ? g_strdup(searchdata) : NULL;
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
590 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_performer) );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
591 tuple->performer = ( strcmp(searchdata,"") ) ? g_strdup(searchdata) : NULL;
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
592 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_file_name) );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
593 tuple->file_name = ( strcmp(searchdata,"") ) ? g_strdup(searchdata) : NULL;
2139
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
594 /* check if previous selection should be cleared before searching */
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
595 if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_clearprevsel)) == TRUE )
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
596 playlistwin_select_none();
2129
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
597 /* now send this tuple to the real search function */
2139
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
598 matched_entries_num = playlist_select_search( playlist , tuple , 0 );
2129
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
599 /* we do not need the tuple and its data anymore */
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
600 if ( tuple->track_name != NULL ) g_free( tuple->track_name );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
601 if ( tuple->album_name != NULL ) g_free( tuple->album_name );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
602 if ( tuple->performer != NULL ) g_free( tuple->performer );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
603 if ( tuple->file_name != NULL ) g_free( tuple->file_name );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
604 g_free( tuple );
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
605 playlistwin_update_list(playlist_get_active());
2139
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
606 /* check if a new playlist should be created after searching */
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
607 if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_newplaylist)) == TRUE )
fcd1f54efdb9 [svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents: 2129
diff changeset
608 playlist_new_from_selected();
2144
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
609 /* check if matched entries should be queued */
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
610 else if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_autoenqueue)) == TRUE )
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
611 playlist_queue(playlist_get_active());
2129
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
612 break;
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
613 }
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
614 default:
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
615 break;
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
616 }
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
617 /* done here :) */
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
618 gtk_widget_destroy( searchdlg_win );
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
619 }
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
620
0d845907c0b9 [svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents: 2105
diff changeset
621 static void
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
622 playlistwin_inverse_selection(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
623 {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
624 playlist_select_invert_all(playlist_get_active());
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
625 playlistwin_list->pl_prev_selected = -1;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
626 playlistwin_list->pl_prev_min = -1;
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
627 playlistwin_update_list(playlist_get_active());
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
628 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
629
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
630 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
631 playlistwin_resize(gint width, gint height)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
632 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
633 gboolean redraw;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
634
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
635 g_return_if_fail(width > 0 && height > 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
636
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
637 cfg.playlist_width = width;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
638
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
639 if (!cfg.playlist_shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
640 cfg.playlist_height = height;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
641 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
642 height = cfg.playlist_height;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
643
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
644 /* FIXME: why the fsck are we doing this manually? */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
645 /* adjust widget positions and sizes */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
646
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
647 widget_resize(WIDGET(playlistwin_list), width - 31, height - 58);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
648
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
649 widget_move(WIDGET(playlistwin_slider), width - 15, 20);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
650 widget_resize(WIDGET(playlistwin_slider), 8, height - 58);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
651
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
652 widget_resize(WIDGET(playlistwin_sinfo), width - 35, 14);
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
653 playlistwin_update_sinfo(playlist_get_active());
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
654
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
655 widget_move(WIDGET(playlistwin_shade), width - 21, 3);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
656 widget_move(WIDGET(playlistwin_close), width - 11, 3);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
657 widget_move(WIDGET(playlistwin_time_min), width - 82, height - 15);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
658 widget_move(WIDGET(playlistwin_time_sec), width - 64, height - 15);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
659 widget_move(WIDGET(playlistwin_info), width - 143, height - 28);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
660 widget_move(WIDGET(playlistwin_srew), width - 144, height - 16);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
661 widget_move(WIDGET(playlistwin_splay), width - 138, height - 16);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
662 widget_move(WIDGET(playlistwin_spause), width - 128, height - 16);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
663 widget_move(WIDGET(playlistwin_sstop), width - 118, height - 16);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
664 widget_move(WIDGET(playlistwin_sfwd), width - 109, height - 16);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
665 widget_move(WIDGET(playlistwin_seject), width - 100, height - 16);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
666 widget_move(WIDGET(playlistwin_sscroll_up), width - 14, height - 35);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
667 widget_move(WIDGET(playlistwin_sscroll_down), width - 14, height - 30);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
668
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
669 g_object_unref(playlistwin_bg);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
670 playlistwin_bg = gdk_pixmap_new(playlistwin->window, width, height, -1);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
671 playlistwin_set_mask();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
672
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
673 widget_list_lock(playlistwin_wlist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
674
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
675 widget_list_change_pixmap(playlistwin_wlist, playlistwin_bg);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
676 playlistwin_draw_frame();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
677 widget_list_draw(playlistwin_wlist, &redraw, TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
678 widget_list_clear_redraw(playlistwin_wlist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
679
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
680 widget_list_unlock(playlistwin_wlist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
681
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
682 gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
683 gdk_window_clear(playlistwin->window);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
684 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
685
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
686
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
687
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
688 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
689 playlistwin_motion(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
690 GdkEventMotion * event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
691 gpointer callback_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
692 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
693 GdkEvent *gevent;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
694
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
695 if (dock_is_moving(GTK_WINDOW(playlistwin))) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
696 dock_move_motion(GTK_WINDOW(playlistwin), event);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
697 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
698 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
699 handle_motion_cb(playlistwin_wlist, widget, event);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
700 draw_playlist_window(FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
701 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
702 gdk_flush();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
703
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
704 while ((gevent = gdk_event_get()) != NULL) gdk_event_free(gevent);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
705 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
706
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
707 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
708 playlistwin_enter(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
709 GdkEventMotion * event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
710 gpointer callback_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
711 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
712 playlistwin_list->pl_tooltips = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
713 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
714
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
715 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
716 playlistwin_leave(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
717 GdkEventMotion * event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
718 gpointer callback_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
719 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
720 playlistwin_list->pl_tooltips = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
721 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
722
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
723 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
724 playlistwin_show_filebrowser(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
725 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
726 util_run_filebrowser(NO_PLAY_BUTTON);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
727 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
728
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
729 #if 0
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
730 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
731 playlistwin_add_dir_handler(const gchar * dir)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
732 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
733 g_free(cfg.filesel_path);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
734 cfg.filesel_path = g_strdup(dir);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
735 playlist_add_dir(dir);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
736 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
737 #endif
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
738
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
739 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
740 playlistwin_fileinfo(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
741 {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
742 Playlist *playlist = playlist_get_active();
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
743
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
744 /* Show the first selected file, or the current file if nothing is
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
745 * selected */
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
746 GList *list = playlist_get_selected(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
747 if (list) {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
748 playlist_fileinfo(playlist, GPOINTER_TO_INT(list->data));
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
749 g_list_free(list);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
750 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
751 else
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
752 playlist_fileinfo_current(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
753 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
754
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
755 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
756 show_playlist_save_error(GtkWindow * parent,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
757 const gchar * filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
758 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
759 GtkWidget *dialog;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
760
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
761 g_return_if_fail(GTK_IS_WINDOW(parent));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
762 g_return_if_fail(filename != NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
763
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
764 dialog = gtk_message_dialog_new(GTK_WINDOW(parent),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
765 GTK_DIALOG_DESTROY_WITH_PARENT,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
766 GTK_MESSAGE_ERROR,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
767 GTK_BUTTONS_OK,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
768 _("Error writing playlist \"%s\": %s"),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
769 filename, strerror(errno));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
770
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
771 gtk_dialog_run(GTK_DIALOG(dialog));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
772 gtk_widget_destroy(dialog);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
773 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
774
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
775 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
776 show_playlist_overwrite_prompt(GtkWindow * parent,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
777 const gchar * filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
778 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
779 GtkWidget *dialog;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
780 gint result;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
781
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
782 g_return_val_if_fail(GTK_IS_WINDOW(parent), FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
783 g_return_val_if_fail(filename != NULL, FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
784
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
785 dialog = gtk_message_dialog_new(GTK_WINDOW(parent),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
786 GTK_DIALOG_DESTROY_WITH_PARENT,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
787 GTK_MESSAGE_QUESTION,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
788 GTK_BUTTONS_YES_NO,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
789 _("%s already exist. Continue?"),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
790 filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
791
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
792 result = gtk_dialog_run(GTK_DIALOG(dialog));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
793 gtk_widget_destroy(dialog);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
794
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
795 return (result == GTK_RESPONSE_YES);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
796 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
797
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
798 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
799 show_playlist_save_format_error(GtkWindow * parent,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
800 const gchar * filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
801 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
802 const gchar *markup =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
803 N_("<b><big>Unable to save playlist.</big></b>\n\n"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
804 "Unknown file type for '%s'.\n");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
805
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
806 GtkWidget *dialog;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
807
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
808 g_return_if_fail(GTK_IS_WINDOW(parent));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
809 g_return_if_fail(filename != NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
810
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
811 dialog =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
812 gtk_message_dialog_new_with_markup(GTK_WINDOW(parent),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
813 GTK_DIALOG_DESTROY_WITH_PARENT,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
814 GTK_MESSAGE_ERROR,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
815 GTK_BUTTONS_OK,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
816 _(markup),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
817 filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
818 gtk_dialog_run(GTK_DIALOG(dialog));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
819 gtk_widget_destroy(dialog);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
820 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
821
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
822 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
823 playlistwin_save_playlist(const gchar * filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
824 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
825 PlaylistContainer *plc;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
826 gchar *ext = strrchr(filename, '.') + 1;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
827
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
828 plc = playlist_container_find(ext);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
829 if (plc == NULL) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
830 show_playlist_save_format_error(GTK_WINDOW(playlistwin), filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
831 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
832 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
833
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
834 str_replace_in(&cfg.playlist_path, g_path_get_dirname(filename));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
835
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
836 if (g_file_test(filename, G_FILE_TEST_IS_REGULAR))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
837 if (!show_playlist_overwrite_prompt(GTK_WINDOW(playlistwin), filename))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
838 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
839
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
840 if (!playlist_save(playlist_get_active(), filename))
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
841 show_playlist_save_error(GTK_WINDOW(playlistwin), filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
842 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
843
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
844 #if 0
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
845 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
846 playlistwin_save_current(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
847 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
848 const gchar *filename;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
849
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
850 if (!(filename = playlist_get_current_name()))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
851 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
852
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
853 playlistwin_save_playlist(filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
854 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
855 #endif
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
856
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
857 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
858 playlistwin_load_playlist(const gchar * filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
859 {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
860 Playlist *playlist = playlist_get_active();
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
861
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
862 g_return_if_fail(filename != NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
863
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
864 str_replace_in(&cfg.playlist_path, g_strdup(filename));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
865
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
866 playlist_clear(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
867 mainwin_clear_song_info();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
868 mainwin_set_info_text();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
869
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
870 playlist_load(playlist, filename);
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
871 playlist_set_current_name(playlist, filename);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
872 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
873
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
874 static gchar *
1762
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
875 playlist_file_selection_load(const gchar * title,
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
876 const gchar * default_filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
877 {
1762
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
878 static GtkWidget *dialog = NULL;
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
879 GtkWidget *button;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
880 gchar *filename;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
881
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
882 g_return_val_if_fail(title != NULL, NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
883
1762
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
884 if(!dialog) {
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
885 dialog = gtk_file_chooser_dialog_new(title, GTK_WINDOW(mainwin),
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
886 GTK_FILE_CHOOSER_ACTION_OPEN, NULL, NULL);
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
887
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
888 if (default_filename)
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
889 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
890 default_filename);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
891
1762
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
892 button = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL,
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
893 GTK_RESPONSE_REJECT);
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
894 gtk_button_set_use_stock(GTK_BUTTON(button), TRUE);
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
895 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
896
1762
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
897 button = gtk_dialog_add_button(GTK_DIALOG(dialog),
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
898 GTK_STOCK_OPEN,
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
899 GTK_RESPONSE_ACCEPT);
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
900 gtk_button_set_use_stock(GTK_BUTTON(button), TRUE);
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
901 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
902 }
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
903
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
904 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
905 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
906 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
907 filename = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
908
1762
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
909 gtk_widget_hide(dialog);
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
910 return filename;
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
911 }
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
912
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
913 static gchar *
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
914 playlist_file_selection_save(const gchar * title,
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
915 const gchar * default_filename)
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
916 {
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
917 static GtkWidget *dialog = NULL;
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
918 GtkWidget *button;
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
919 gchar *filename;
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
920
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
921 g_return_val_if_fail(title != NULL, NULL);
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
922
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
923 if(!dialog) {
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
924 dialog = gtk_file_chooser_dialog_new(title, GTK_WINDOW(mainwin),
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
925 GTK_FILE_CHOOSER_ACTION_SAVE, NULL, NULL);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
926
1762
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
927 if (default_filename)
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
928 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
929 default_filename);
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
930
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
931 button = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL,
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
932 GTK_RESPONSE_REJECT);
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
933 gtk_button_set_use_stock(GTK_BUTTON(button), TRUE);
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
934 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
935
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
936 button = gtk_dialog_add_button(GTK_DIALOG(dialog),
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
937 GTK_STOCK_SAVE,
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
938 GTK_RESPONSE_ACCEPT);
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
939 gtk_button_set_use_stock(GTK_BUTTON(button), TRUE);
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
940 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
941 }
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
942
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
943 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
944 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
945 else
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
946 filename = NULL;
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
947
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
948 gtk_widget_hide(dialog);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
949 return filename;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
950 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
951
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
952 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
953 playlistwin_select_playlist_to_load(const gchar * default_filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
954 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
955 gchar *filename =
1762
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
956 playlist_file_selection_load(_("Load Playlist"), default_filename);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
957
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
958 if (filename) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
959 playlistwin_load_playlist(filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
960 g_free(filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
961 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
962 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
963
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
964 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
965 playlistwin_select_playlist_to_save(const gchar * default_filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
966 {
1762
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
967 gchar *dot = NULL, *basename = NULL;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
968 gchar *filename =
1762
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
969 playlist_file_selection_save(_("Save Playlist"), default_filename);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
970
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
971 if (filename) {
1762
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
972 /* Default to xspf if no filename has extension */
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
973 basename = g_path_get_basename(filename);
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
974 dot = strrchr(basename, '.');
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
975 if( dot == NULL || dot == basename) {
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
976 gchar *oldname = filename;
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
977 filename = g_strconcat(oldname, ".xspf", NULL);
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
978 g_free(oldname);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
979 }
1762
5170463d8cc9 [svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents: 1653
diff changeset
980 g_free(basename);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
981
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
982 playlistwin_save_playlist(filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
983 g_free(filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
984 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
985 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
986
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
987 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
988 inside_sensitive_widgets(gint x, gint y)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
989 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
990 return (widget_contains(WIDGET(playlistwin_list), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
991 widget_contains(WIDGET(playlistwin_slider), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
992 widget_contains(WIDGET(playlistwin_close), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
993 widget_contains(WIDGET(playlistwin_shade), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
994 widget_contains(WIDGET(playlistwin_time_min), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
995 widget_contains(WIDGET(playlistwin_time_sec), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
996 widget_contains(WIDGET(playlistwin_info), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
997 widget_contains(WIDGET(playlistwin_srew), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
998 widget_contains(WIDGET(playlistwin_splay), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
999 widget_contains(WIDGET(playlistwin_spause), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1000 widget_contains(WIDGET(playlistwin_sstop), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1001 widget_contains(WIDGET(playlistwin_sfwd), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1002 widget_contains(WIDGET(playlistwin_seject), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1003 widget_contains(WIDGET(playlistwin_sscroll_up), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1004 widget_contains(WIDGET(playlistwin_sscroll_down), x, y));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1005 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1006
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1007 #define REGION_L(x1,x2,y1,y2) \
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1008 (event->x >= (x1) && event->x < (x2) && \
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1009 event->y >= cfg.playlist_height - (y1) && \
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1010 event->y < cfg.playlist_height - (y2))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1011
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1012 #define REGION_R(x1,x2,y1,y2) \
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1013 (event->x >= playlistwin_get_width() - (x1) && \
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1014 event->x < playlistwin_get_width() - (x2) && \
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1015 event->y >= cfg.playlist_height - (y1) && \
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1016 event->y < cfg.playlist_height - (y2))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1017
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1018 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1019 playlistwin_scrolled(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1020 GdkEventScroll * event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1021 gpointer callback_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1022 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1023
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1024 if (event->direction == GDK_SCROLL_DOWN)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1025 playlistwin_scroll(cfg.scroll_pl_by);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1026
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1027 if (event->direction == GDK_SCROLL_UP)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1028 playlistwin_scroll(-cfg.scroll_pl_by);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1029
2028
88bbe66923fe [svn] - make wheel scroll trigger scan thread
yaz
parents: 2026
diff changeset
1030 g_cond_signal(cond_scan);
88bbe66923fe [svn] - make wheel scroll trigger scan thread
yaz
parents: 2026
diff changeset
1031
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1032 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1033
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1034 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1035 playlistwin_press(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1036 GdkEventButton * event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1037 gpointer callback_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1038 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1039 gboolean grab = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1040 gint xpos, ypos;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1041 GtkWidget *_menu;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1042 GtkRequisition req;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1043
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1044 gtk_window_get_position(GTK_WINDOW(playlistwin), &xpos, &ypos);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1045
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1046 if (event->button == 1 && !cfg.show_wm_decorations &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1047 ((!cfg.playlist_shaded &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1048 event->x > playlistwin_get_width() - 20 &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1049 event->y > cfg.playlist_height - 20) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1050 (cfg.playlist_shaded &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1051 event->x >= playlistwin_get_width() - 31 &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1052 event->x < playlistwin_get_width() - 22))) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1053
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1054 /* NOTE: Workaround for bug #214 */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1055 if (event->type != GDK_2BUTTON_PRESS &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1056 event->type != GDK_3BUTTON_PRESS) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1057 /* resize area */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1058 playlistwin_resizing = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1059 gtk_window_begin_resize_drag(GTK_WINDOW(widget),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1060 GDK_WINDOW_EDGE_SOUTH_EAST,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1061 event->button,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1062 event->x + xpos, event->y + ypos,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1063 event->time);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1064 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1065 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1066 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1067 else if (event->button == 1 && REGION_L(12, 37, 29, 11)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1068 /* ADD button menu */
2261
bdb2983612f0 [svn] - given some decent namespacing to playlist menus (part 1); removed last references to obsolete mainwin_accel
giacomo
parents: 2260
diff changeset
1069 gtk_widget_size_request(playlistwin_pladd_menu, &req);
bdb2983612f0 [svn] - given some decent namespacing to playlist menus (part 1); removed last references to obsolete mainwin_accel
giacomo
parents: 2260
diff changeset
1070 ui_manager_popup_menu_show(GTK_MENU(playlistwin_pladd_menu),
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1071 xpos + 12,
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1072 (ypos + playlistwin_get_height()) - 8 - req.height,
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1073 event->button,
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1074 event->time);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1075 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1076 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1077 else if (event->button == 1 && REGION_L(41, 66, 29, 11)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1078 /* SUB button menu */
2261
bdb2983612f0 [svn] - given some decent namespacing to playlist menus (part 1); removed last references to obsolete mainwin_accel
giacomo
parents: 2260
diff changeset
1079 gtk_widget_size_request(playlistwin_pldel_menu, &req);
bdb2983612f0 [svn] - given some decent namespacing to playlist menus (part 1); removed last references to obsolete mainwin_accel
giacomo
parents: 2260
diff changeset
1080 ui_manager_popup_menu_show(GTK_MENU(playlistwin_pldel_menu),
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1081 xpos + 40,
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1082 (ypos + playlistwin_get_height()) - 8 - req.height,
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1083 event->button,
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1084 event->time);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1085 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1086 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1087 else if (event->button == 1 && REGION_L(70, 95, 29, 11)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1088 /* SEL button menu */
2261
bdb2983612f0 [svn] - given some decent namespacing to playlist menus (part 1); removed last references to obsolete mainwin_accel
giacomo
parents: 2260
diff changeset
1089 gtk_widget_size_request(playlistwin_plsel_menu, &req);
bdb2983612f0 [svn] - given some decent namespacing to playlist menus (part 1); removed last references to obsolete mainwin_accel
giacomo
parents: 2260
diff changeset
1090 ui_manager_popup_menu_show(GTK_MENU(playlistwin_plsel_menu),
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1091 xpos + 68,
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1092 (ypos + playlistwin_get_height()) - 8 - req.height,
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1093 event->button,
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1094 event->time);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1095 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1096 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1097 else if (event->button == 1 && REGION_L(99, 124, 29, 11)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1098 /* MISC button menu */
2261
bdb2983612f0 [svn] - given some decent namespacing to playlist menus (part 1); removed last references to obsolete mainwin_accel
giacomo
parents: 2260
diff changeset
1099 gtk_widget_size_request(playlistwin_plsort_menu, &req);
bdb2983612f0 [svn] - given some decent namespacing to playlist menus (part 1); removed last references to obsolete mainwin_accel
giacomo
parents: 2260
diff changeset
1100 ui_manager_popup_menu_show(GTK_MENU(playlistwin_plsort_menu),
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1101 xpos + 100,
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1102 (ypos + playlistwin_get_height()) - 8 - req.height,
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1103 event->button,
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1104 event->time);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1105 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1106 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1107 else if (event->button == 1 && REGION_R(46, 23, 29, 11)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1108 /* LIST button menu */
2261
bdb2983612f0 [svn] - given some decent namespacing to playlist menus (part 1); removed last references to obsolete mainwin_accel
giacomo
parents: 2260
diff changeset
1109 gtk_widget_size_request(playlistwin_pllist_menu, &req);
bdb2983612f0 [svn] - given some decent namespacing to playlist menus (part 1); removed last references to obsolete mainwin_accel
giacomo
parents: 2260
diff changeset
1110 ui_manager_popup_menu_show(GTK_MENU(playlistwin_pllist_menu),
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1111 xpos + playlistwin_get_width() - req.width - 12,
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1112 (ypos + playlistwin_get_height()) - 8 - req.height,
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1113 event->button,
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1114 event->time);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1115 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1116 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1117 else if (event->button == 1 && REGION_R(82, 54, 15, 9)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1118 if (cfg.timer_mode == TIMER_ELAPSED)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1119 cfg.timer_mode = TIMER_REMAINING;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1120 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1121 cfg.timer_mode = TIMER_ELAPSED;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1122 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1123 else if (event->button == 2 && (event->type == GDK_BUTTON_PRESS) &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1124 widget_contains(WIDGET(playlistwin_list), event->x, event->y)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1125 gtk_selection_convert(widget, GDK_SELECTION_PRIMARY,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1126 GDK_TARGET_STRING, event->time);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1127 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1128 else if (event->button == 1 && event->type == GDK_BUTTON_PRESS &&
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1934
diff changeset
1129 !inside_sensitive_widgets(event->x, event->y) && (cfg.easy_move || event->y < 14))
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1130 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1131 dock_move_press(dock_window_list, GTK_WINDOW(playlistwin), event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1132 FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1133 gtk_window_present(GTK_WINDOW(playlistwin));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1134 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1135 else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1136 !inside_sensitive_widgets(event->x, event->y)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1137 && event->y < 14) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1138 /* double click on title bar */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1139 playlistwin_shade_toggle();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1140 if (dock_is_moving(GTK_WINDOW(playlistwin)))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1141 dock_move_release(GTK_WINDOW(playlistwin));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1142 return TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1143 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1144 else if (event->button == 3 &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1145 !(widget_contains(WIDGET(playlistwin_list), event->x, event->y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1146 (event->y >= cfg.playlist_height - 29 &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1147 event->y < cfg.playlist_height - 11 &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1148 ((event->x >= 12 && event->x < 37) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1149 (event->x >= 41 && event->x < 66) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1150 (event->x >= 70 && event->x < 95) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1151 (event->x >= 99 && event->x < 124) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1152 (event->x >= playlistwin_get_width() - 46 &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1153 event->x < playlistwin_get_width() - 23))))) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1154 /*
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1155 * Pop up the main menu a few pixels down to avoid
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1156 * anything to be selected initially.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1157 */
2232
ac2ea05e60a0 [svn] - migration from gtkitemfactory to actions and uimanager; main menu has been ported, still much work and test to do
giacomo
parents: 2228
diff changeset
1158 ui_manager_popup_menu_show(GTK_MENU(mainwin_general_menu), event->x_root,
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1159 event->y_root + 2, 3, event->time);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1160 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1161 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1162 else if (event->button == 3 &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1163 widget_contains(WIDGET(playlistwin_list), event->x, event->y)) {
2246
a04dcf29737d [svn] - no more menu_popup() in ui_playlist.c, now it uses ui_manager_popup_menu_show() from ui_manager framework
giacomo
parents: 2245
diff changeset
1164 ui_manager_popup_menu_show(GTK_MENU(playlistwin_popup_menu),
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1165 event->x_root, event->y_root + 5,
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1166 event->button, event->time);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1167 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1168 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1169 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1170 handle_press_cb(playlistwin_wlist, widget, event);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1171 draw_playlist_window(FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1172 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1173
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1174 if (grab)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1175 gdk_pointer_grab(playlistwin->window, FALSE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1176 GDK_BUTTON_MOTION_MASK | GDK_BUTTON_RELEASE_MASK |
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1177 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1178 GDK_BUTTON1_MOTION_MASK, NULL, NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1179 GDK_CURRENT_TIME);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1180
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1181 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1182 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1183
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1184 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1185 playlistwin_focus_in(GtkWidget * widget, GdkEvent * event, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1186 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1187 playlistwin_close->pb_allow_draw = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1188 playlistwin_shade->pb_allow_draw = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1189 draw_playlist_window(TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1190 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1191 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1192
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1193 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1194 playlistwin_focus_out(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1195 GdkEventButton * event, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1196 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1197 playlistwin_close->pb_allow_draw = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1198 playlistwin_shade->pb_allow_draw = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1199 draw_playlist_window(TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1200 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1201 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1202
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1203 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1204 playlistwin_configure(GtkWidget * window,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1205 GdkEventConfigure * event, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1206 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1207 if (!GTK_WIDGET_VISIBLE(window))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1208 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1209
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1210 cfg.playlist_x = event->x;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1211 cfg.playlist_y = event->y;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1212
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1213 if (playlistwin_resizing) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1214 if (event->width != playlistwin_get_width() ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1215 event->height != playlistwin_get_height())
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1216 playlistwin_resize(event->width, event->height);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1217 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1218 return TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1219 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1220
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1221 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1222 playlistwin_set_back_pixmap(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1223 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1224 gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1225 gdk_window_clear(playlistwin->window);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1226 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1227
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1228 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1229 playlistwin_delete(GtkWidget * w, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1230 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1231 playlistwin_hide();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1232 return TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1233 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1234
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1235 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1236 playlistwin_keypress_up_down_handler(PlayList_List * pl,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1237 gboolean up, guint state)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1238 {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1239 Playlist *playlist = playlist_get_active();
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1240
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1241 if ((state & GDK_MOD1_MASK) && (state & GDK_SHIFT_MASK))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1242 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1243 if (!(state & GDK_MOD1_MASK))
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1244 playlist_select_all(playlist, FALSE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1245
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1246 if (pl->pl_prev_selected == -1 ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1247 (!playlistwin_item_visible(pl->pl_prev_selected) &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1248 !(state & GDK_SHIFT_MASK && pl->pl_prev_min != -1))) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1249 pl->pl_prev_selected = pl->pl_first;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1250 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1251 else if (state & GDK_SHIFT_MASK) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1252 if (pl->pl_prev_min == -1) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1253 pl->pl_prev_max = pl->pl_prev_selected;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1254 pl->pl_prev_min = pl->pl_prev_selected;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1255 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1256 pl->pl_prev_max += (up ? -1 : 1);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1257 pl->pl_prev_max =
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1258 CLAMP(pl->pl_prev_max, 0, playlist_get_length(playlist) - 1);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1259
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1260 pl->pl_first = MIN(pl->pl_first, pl->pl_prev_max);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1261 pl->pl_first = MAX(pl->pl_first, pl->pl_prev_max -
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1262 pl->pl_num_visible + 1);
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1263 playlist_select_range(playlist, pl->pl_prev_min, pl->pl_prev_max, TRUE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1264 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1265 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1266 else if (state & GDK_MOD1_MASK) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1267 if (up)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1268 playlist_list_move_up(pl);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1269 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1270 playlist_list_move_down(pl);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1271 if (pl->pl_prev_min < pl->pl_first)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1272 pl->pl_first = pl->pl_prev_min;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1273 else if (pl->pl_prev_max >= (pl->pl_first + pl->pl_num_visible))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1274 pl->pl_first = pl->pl_prev_max - pl->pl_num_visible + 1;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1275 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1276 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1277 else if (up)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1278 pl->pl_prev_selected--;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1279 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1280 pl->pl_prev_selected++;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1281
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1282 pl->pl_prev_selected =
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1283 CLAMP(pl->pl_prev_selected, 0, playlist_get_length(playlist) - 1);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1284
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1285 if (pl->pl_prev_selected < pl->pl_first)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1286 pl->pl_first--;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1287 else if (pl->pl_prev_selected >= (pl->pl_first + pl->pl_num_visible))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1288 pl->pl_first++;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1289
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1290 playlist_select_range(playlist, pl->pl_prev_selected, pl->pl_prev_selected, TRUE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1291 pl->pl_prev_min = -1;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1292 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1293
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1294 /* FIXME: Handle the keys through menu */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1295
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1296 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1297 playlistwin_keypress(GtkWidget * w, GdkEventKey * event, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1298 {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1299 Playlist *playlist = playlist_get_active();
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1300
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1301 guint keyval;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1302 gboolean refresh = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1303
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1304 if (cfg.playlist_shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1305 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1306
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1307 switch (keyval = event->keyval) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1308 case GDK_KP_Up:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1309 case GDK_KP_Down:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1310 case GDK_Up:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1311 case GDK_Down:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1312 playlistwin_keypress_up_down_handler(playlistwin_list,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1313 keyval == GDK_Up
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1314 || keyval == GDK_KP_Up,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1315 event->state);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1316 refresh = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1317 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1318 case GDK_Page_Up:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1319 playlistwin_scroll(-playlistwin_list->pl_num_visible);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1320 refresh = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1321 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1322 case GDK_Page_Down:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1323 playlistwin_scroll(playlistwin_list->pl_num_visible);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1324 refresh = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1325 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1326 case GDK_Home:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1327 playlistwin_list->pl_first = 0;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1328 refresh = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1329 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1330 case GDK_End:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1331 playlistwin_list->pl_first =
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1332 playlist_get_length(playlist) - playlistwin_list->pl_num_visible;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1333 refresh = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1334 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1335 case GDK_Return:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1336 if (playlistwin_list->pl_prev_selected > -1
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1337 && playlistwin_item_visible(playlistwin_list->pl_prev_selected)) {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1338 playlist_set_position(playlist, playlistwin_list->pl_prev_selected);
2228
894f7aa46f83 [svn] - bmp_playback_* -> playback_* -- i knew something smelled rotten here, hmm.
nenolod
parents: 2226
diff changeset
1339 if (!playback_get_playing())
894f7aa46f83 [svn] - bmp_playback_* -> playback_* -- i knew something smelled rotten here, hmm.
nenolod
parents: 2226
diff changeset
1340 playback_initiate();
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1341 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1342 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1343 case GDK_3:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1344 if (event->state & GDK_CONTROL_MASK)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1345 playlistwin_fileinfo();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1346 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1347 case GDK_Delete:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1348 if (event->state & GDK_CONTROL_MASK)
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1349 playlist_delete(playlist, TRUE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1350 else
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1351 playlist_delete(playlist, FALSE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1352 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1353 case GDK_Insert:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1354 if (event->state & GDK_MOD1_MASK)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1355 mainwin_show_add_url_window();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1356 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1357 playlistwin_show_filebrowser();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1358 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1359 case GDK_Left:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1360 case GDK_KP_Left:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1361 case GDK_KP_7:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1362 if (playlist_get_current_length(playlist) != -1)
2228
894f7aa46f83 [svn] - bmp_playback_* -> playback_* -- i knew something smelled rotten here, hmm.
nenolod
parents: 2226
diff changeset
1363 playback_seek(CLAMP
894f7aa46f83 [svn] - bmp_playback_* -> playback_* -- i knew something smelled rotten here, hmm.
nenolod
parents: 2226
diff changeset
1364 (playback_get_time() - 5000, 0,
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1365 playlist_get_current_length(playlist)) / 1000);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1366 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1367 case GDK_Right:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1368 case GDK_KP_Right:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1369 case GDK_KP_9:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1370 if (playlist_get_current_length(playlist) != -1)
2228
894f7aa46f83 [svn] - bmp_playback_* -> playback_* -- i knew something smelled rotten here, hmm.
nenolod
parents: 2226
diff changeset
1371 playback_seek(CLAMP
894f7aa46f83 [svn] - bmp_playback_* -> playback_* -- i knew something smelled rotten here, hmm.
nenolod
parents: 2226
diff changeset
1372 (playback_get_time() + 5000, 0,
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1373 playlist_get_current_length(playlist)) / 1000);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1374 break;
2048
7bc2489db782 [svn] Numpad 4 and 6 liked to prev and next respectively to be more consistant with the main window
nazca
parents: 2043
diff changeset
1375 case GDK_KP_4:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1376 playlist_prev(playlist);
2048
7bc2489db782 [svn] Numpad 4 and 6 liked to prev and next respectively to be more consistant with the main window
nazca
parents: 2043
diff changeset
1377 break;
7bc2489db782 [svn] Numpad 4 and 6 liked to prev and next respectively to be more consistant with the main window
nazca
parents: 2043
diff changeset
1378 case GDK_KP_6:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1379 playlist_next(playlist);
2048
7bc2489db782 [svn] Numpad 4 and 6 liked to prev and next respectively to be more consistant with the main window
nazca
parents: 2043
diff changeset
1380 break;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1381
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1382 case GDK_Escape:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1383 mainwin_minimize_cb();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1384 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1385 default:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1386 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1387 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1388
2026
f15664434382 [svn] rewrite scan thread with g_cond_wait():
yaz
parents: 1938
diff changeset
1389 if (refresh) {
f15664434382 [svn] rewrite scan thread with g_cond_wait():
yaz
parents: 1938
diff changeset
1390 g_cond_signal(cond_scan);
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
1391 playlistwin_update_list(playlist_get_active());
2026
f15664434382 [svn] rewrite scan thread with g_cond_wait():
yaz
parents: 1938
diff changeset
1392 }
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1393
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1394 return TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1395 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1396
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1397 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1398 playlistwin_draw_frame(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1399 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1400 gboolean focus =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1401 gtk_window_has_toplevel_focus(GTK_WINDOW(playlistwin)) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1402 !cfg.dim_titlebar;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1403
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1404 if (cfg.playlist_shaded) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1405 skin_draw_playlistwin_shaded(bmp_active_skin,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1406 playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1407 playlistwin_get_width(), focus);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1408 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1409 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1410 skin_draw_playlistwin_frame(bmp_active_skin,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1411 playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1412 playlistwin_get_width(),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1413 cfg.playlist_height, focus);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1414 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1415 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1416
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1417 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1418 draw_playlist_window(gboolean force)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1419 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1420 gboolean redraw;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1421 GList *wl;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1422 Widget *w;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1423
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1424 if (force)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1425 playlistwin_draw_frame();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1426
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1427 widget_list_lock(playlistwin_wlist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1428 widget_list_draw(playlistwin_wlist, &redraw, force);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1429
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1430 if (redraw || force) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1431 if (force) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1432 gdk_window_clear(playlistwin->window);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1433 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1434 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1435 for (wl = playlistwin_wlist; wl; wl = g_list_next(wl)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1436 w = WIDGET(wl->data);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1437 if (w->redraw && w->visible) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1438 gdk_window_clear_area(playlistwin->window, w->x, w->y,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1439 w->width, w->height);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1440 w->redraw = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1441 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1442 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1443 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1444
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1445 gdk_flush();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1446 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1447
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1448 widget_list_unlock(playlistwin_wlist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1449 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1450
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1451
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1452 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1453 playlistwin_hide_timer(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1454 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1455 textbox_set_text(playlistwin_time_min, " ");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1456 textbox_set_text(playlistwin_time_sec, " ");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1457 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1458
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1459 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1460 playlistwin_set_time(gint time, gint length, TimerMode mode)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1461 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1462 gchar *text, sign;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1463
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1464 if (mode == TIMER_REMAINING && length != -1) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1465 time = length - time;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1466 sign = '-';
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1467 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1468 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1469 sign = ' ';
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1470
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1471 time /= 1000;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1472
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1473 if (time < 0)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1474 time = 0;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1475 if (time > 99 * 60)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1476 time /= 60;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1477
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1478 text = g_strdup_printf("%c%-2.2d", sign, time / 60);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1479 textbox_set_text(playlistwin_time_min, text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1480 g_free(text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1481
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1482 text = g_strdup_printf("%-2.2d", time % 60);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1483 textbox_set_text(playlistwin_time_sec, text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1484 g_free(text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1485 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1486
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1487 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1488 playlistwin_drag_motion(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1489 GdkDragContext * context,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1490 gint x, gint y,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1491 GtkSelectionData * selection_data,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1492 guint info, guint time, gpointer user_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1493 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1494 playlistwin_list->pl_drag_motion = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1495 playlistwin_list->drag_motion_x = x;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1496 playlistwin_list->drag_motion_y = y;
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
1497 playlistwin_update_list(playlist_get_active());
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1498 playlistwin_hint_flag = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1499 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1500
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1501 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1502 playlistwin_drag_end(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1503 GdkDragContext * context, gpointer user_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1504 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1505 playlistwin_list->pl_drag_motion = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1506 playlistwin_hint_flag = FALSE;
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
1507 playlistwin_update_list(playlist_get_active());
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1508 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1509
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1510 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1511 playlistwin_drag_data_received(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1512 GdkDragContext * context,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1513 gint x, gint y,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1514 GtkSelectionData *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1515 selection_data, guint info,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1516 guint time, gpointer user_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1517 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1518 gint pos;
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1519 Playlist *playlist = playlist_get_active();
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1520
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1521 g_return_if_fail(selection_data != NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1522
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1523 if (!selection_data->data) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1524 g_message("Received no DND data!");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1525 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1526 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1527
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1528 if (widget_contains(WIDGET(playlistwin_list), x, y)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1529 pos = (y - WIDGET(playlistwin_list)->y) /
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1530 playlistwin_list->pl_fheight + playlistwin_list->pl_first;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1531
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1532 pos = MIN(pos, playlist_get_length(playlist));
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1533 playlist_ins_url(playlist, (gchar *) selection_data->data, pos);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1534 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1535 else
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1536 playlist_add_url(playlist, (gchar *) selection_data->data);
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1537 }
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1538
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1539 static void
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1540 local_playlist_prev(void)
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1541 {
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1542 playlist_prev(playlist_get_active());
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1543 }
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1544
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1545 static void
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1546 local_playlist_next(void)
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1547 {
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1548 playlist_next(playlist_get_active());
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1549 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1550
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1551 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1552 playlistwin_create_widgets(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1553 {
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
1554 gchar *font = NULL, *tmp = NULL;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1555 /* This function creates the custom widgets used by the playlist editor */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1556
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1557 /* text box for displaying song title in shaded mode */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1558 playlistwin_sinfo =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1559 create_textbox(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
1560 4, 4, playlistwin_get_width() - 35, TRUE, SKIN_TEXT);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
1561
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
1562 playlistwin_set_sinfo_font(cfg.playlist_font);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1563
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1564 if (!cfg.playlist_shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1565 widget_hide(WIDGET(playlistwin_sinfo));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1566
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1567 /* shade/unshade window push button */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1568 if (cfg.playlist_shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1569 playlistwin_shade =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1570 create_pbutton(&playlistwin_wlist, playlistwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1571 playlistwin_gc, playlistwin_get_width() - 21, 3,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1572 9, 9, 128, 45, 150, 42,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1573 playlistwin_shade_toggle, SKIN_PLEDIT);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1574 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1575 playlistwin_shade =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1576 create_pbutton(&playlistwin_wlist, playlistwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1577 playlistwin_gc, playlistwin_get_width() - 21, 3,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1578 9, 9, 157, 3, 62, 42, playlistwin_shade_toggle,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1579 SKIN_PLEDIT);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1580
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1581 playlistwin_shade->pb_allow_draw = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1582
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1583 /* close window push button */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1584 playlistwin_close =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1585 create_pbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1586 playlistwin_get_width() - 11, 3, 9, 9,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1587 cfg.playlist_shaded ? 138 : 167,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1588 cfg.playlist_shaded ? 45 : 3, 52, 42,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1589 playlistwin_hide, SKIN_PLEDIT);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1590 playlistwin_close->pb_allow_draw = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1591
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1592 /* playlist list box */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1593 playlistwin_list =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1594 create_playlist_list(&playlistwin_wlist, playlistwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1595 playlistwin_gc, 12, 20,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1596 playlistwin_get_width() - 31,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1597 cfg.playlist_height - 58);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1598 playlist_list_set_font(cfg.playlist_font);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1599
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1600 /* playlist list box slider */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1601 playlistwin_slider =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1602 create_playlistslider(&playlistwin_wlist, playlistwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1603 playlistwin_gc, playlistwin_get_width() - 15,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1604 20, cfg.playlist_height - 58, playlistwin_list);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1605 /* track time (minute) */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1606 playlistwin_time_min =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1607 create_textbox(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1608 playlistwin_get_width() - 82,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1609 cfg.playlist_height - 15, 15, FALSE, SKIN_TEXT);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1610
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1611 /* track time (second) */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1612 playlistwin_time_sec =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1613 create_textbox(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1614 playlistwin_get_width() - 64,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1615 cfg.playlist_height - 15, 10, FALSE, SKIN_TEXT);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1616
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1617 /* playlist information (current track length / total track length) */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1618 playlistwin_info =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1619 create_textbox(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1620 playlistwin_get_width() - 143,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1621 cfg.playlist_height - 28, 90, FALSE, SKIN_TEXT);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1622
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1623 /* mini play control buttons at right bottom corner */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1624
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1625 /* rewind button */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1626 playlistwin_srew =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1627 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1628 playlistwin_get_width() - 144,
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1629 cfg.playlist_height - 16, 8, 7, local_playlist_prev);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1630
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1631 /* play button */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1632 playlistwin_splay =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1633 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1634 playlistwin_get_width() - 138,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1635 cfg.playlist_height - 16, 10, 7, mainwin_play_pushed);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1636
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1637 /* pause button */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1638 playlistwin_spause =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1639 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1640 playlistwin_get_width() - 128,
2228
894f7aa46f83 [svn] - bmp_playback_* -> playback_* -- i knew something smelled rotten here, hmm.
nenolod
parents: 2226
diff changeset
1641 cfg.playlist_height - 16, 10, 7, playback_pause);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1642
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1643 /* stop button */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1644 playlistwin_sstop =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1645 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1646 playlistwin_get_width() - 118,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1647 cfg.playlist_height - 16, 9, 7, mainwin_stop_pushed);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1648
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1649 /* forward button */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1650 playlistwin_sfwd =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1651 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1652 playlistwin_get_width() - 109,
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1653 cfg.playlist_height - 16, 8, 7, local_playlist_next);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1654
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1655 /* eject button */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1656 playlistwin_seject =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1657 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1658 playlistwin_get_width() - 100,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1659 cfg.playlist_height - 16, 9, 7, mainwin_eject_pushed);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1660
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1661
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1662 playlistwin_sscroll_up =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1663 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1664 playlistwin_get_width() - 14,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1665 cfg.playlist_height - 35, 8, 5,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1666 playlistwin_scroll_up_pushed);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1667 playlistwin_sscroll_down =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1668 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1669 playlistwin_get_width() - 14,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1670 cfg.playlist_height - 30, 8, 5,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1671 playlistwin_scroll_down_pushed);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1672
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1673 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1674
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1675 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1676 selection_received(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1677 GtkSelectionData * selection_data, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1678 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1679 if (selection_data->type == GDK_SELECTION_TYPE_STRING &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1680 selection_data->length > 0)
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1681 playlist_add_url(playlist_get_active(), (gchar *) selection_data->data);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1682 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1683
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1684 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1685 playlistwin_create_window(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1686 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1687 GdkPixbuf *icon;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1688
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1689 playlistwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1690 gtk_window_set_title(GTK_WINDOW(playlistwin), _("Audacious Playlist Editor"));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1691 gtk_window_set_wmclass(GTK_WINDOW(playlistwin), "playlist", "Audacious");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1692 gtk_window_set_role(GTK_WINDOW(playlistwin), "playlist");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1693 gtk_window_set_default_size(GTK_WINDOW(playlistwin),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1694 playlistwin_get_width(),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1695 playlistwin_get_height());
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1696 gtk_window_set_resizable(GTK_WINDOW(playlistwin), TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1697 playlistwin_set_geometry_hints(cfg.playlist_shaded);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1698 dock_window_list = dock_window_set_decorated(dock_window_list,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1699 GTK_WINDOW(playlistwin),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1700 cfg.show_wm_decorations);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1701
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1702 gtk_window_set_transient_for(GTK_WINDOW(playlistwin),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1703 GTK_WINDOW(mainwin));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1704 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(playlistwin), TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1705
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1706 icon = gdk_pixbuf_new_from_xpm_data((const gchar **) bmp_playlist_icon);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1707 gtk_window_set_icon(GTK_WINDOW(playlistwin), icon);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1708 g_object_unref(icon);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1709
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1710 gtk_widget_set_app_paintable(playlistwin, TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1711
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1712 if (cfg.playlist_x != -1 && cfg.save_window_position)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1713 gtk_window_move(GTK_WINDOW(playlistwin),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1714 cfg.playlist_x, cfg.playlist_y);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1715
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1716 gtk_widget_add_events(playlistwin, GDK_POINTER_MOTION_MASK |
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1717 GDK_FOCUS_CHANGE_MASK | GDK_BUTTON_MOTION_MASK |
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1718 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1719 GDK_SCROLL_MASK | GDK_VISIBILITY_NOTIFY_MASK);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1720 gtk_widget_realize(playlistwin);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1721
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1722 util_set_cursor(playlistwin);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1723
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1724 g_signal_connect(playlistwin, "delete_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1725 G_CALLBACK(playlistwin_delete), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1726 g_signal_connect(playlistwin, "button_press_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1727 G_CALLBACK(playlistwin_press), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1728 g_signal_connect(playlistwin, "button_release_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1729 G_CALLBACK(playlistwin_release), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1730 g_signal_connect(playlistwin, "scroll_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1731 G_CALLBACK(playlistwin_scrolled), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1732 g_signal_connect(playlistwin, "motion_notify_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1733 G_CALLBACK(playlistwin_motion), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1734 g_signal_connect(playlistwin, "enter_notify_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1735 G_CALLBACK(playlistwin_enter), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1736 g_signal_connect(playlistwin, "leave_notify_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1737 G_CALLBACK(playlistwin_leave), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1738 g_signal_connect_after(playlistwin, "focus_in_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1739 G_CALLBACK(playlistwin_focus_in), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1740 g_signal_connect_after(playlistwin, "focus_out_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1741 G_CALLBACK(playlistwin_focus_out), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1742 g_signal_connect(playlistwin, "configure_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1743 G_CALLBACK(playlistwin_configure), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1744 g_signal_connect(playlistwin, "style_set",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1745 G_CALLBACK(playlistwin_set_back_pixmap), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1746
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1747 bmp_drag_dest_set(playlistwin);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1748
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1749 /* DnD stuff */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1750 g_signal_connect(playlistwin, "drag-leave",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1751 G_CALLBACK(playlistwin_drag_end), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1752 g_signal_connect(playlistwin, "drag-data-delete",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1753 G_CALLBACK(playlistwin_drag_end), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1754 g_signal_connect(playlistwin, "drag-end",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1755 G_CALLBACK(playlistwin_drag_end), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1756 g_signal_connect(playlistwin, "drag-drop",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1757 G_CALLBACK(playlistwin_drag_end), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1758 g_signal_connect(playlistwin, "drag-data-received",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1759 G_CALLBACK(playlistwin_drag_data_received), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1760 g_signal_connect(playlistwin, "drag-motion",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1761 G_CALLBACK(playlistwin_drag_motion), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1762
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1763 g_signal_connect(playlistwin, "key_press_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1764 G_CALLBACK(playlistwin_keypress), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1765 g_signal_connect(playlistwin, "selection_received",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1766 G_CALLBACK(selection_received), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1767
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1768 playlistwin_set_mask();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1769 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1770
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1771 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1772 playlistwin_create(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1773 {
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
1774 Playlist *playlist;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1775 playlistwin_create_window();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1776
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1777 /* create GC and back pixmap for custom widget to draw on */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1778 playlistwin_gc = gdk_gc_new(playlistwin->window);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1779 playlistwin_bg = gdk_pixmap_new(playlistwin->window,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1780 playlistwin_get_width(),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1781 playlistwin_get_height_unshaded(), -1);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1782 gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1783
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1784 playlistwin_create_widgets();
2140
299651a8f107 [svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents: 2139
diff changeset
1785 playlistwin_update_info(playlist_get_active());
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1786
2257
af716dc0cdb9 [svn] - do not create GtkAccelGroup anymore; use ui_manager_get_accel_group to get accelerator groups from ui_manager
giacomo
parents: 2246
diff changeset
1787 gtk_window_add_accel_group(GTK_WINDOW(playlistwin), ui_manager_get_accel_group());
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1788 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1789
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1790
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1791 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1792 playlistwin_show(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1793 {
2232
ac2ea05e60a0 [svn] - migration from gtkitemfactory to actions and uimanager; main menu has been ported, still much work and test to do
giacomo
parents: 2228
diff changeset
1794 GtkAction *action = gtk_action_group_get_action(
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
1795 toggleaction_group_others , "show playlist editor" );
2232
ac2ea05e60a0 [svn] - migration from gtkitemfactory to actions and uimanager; main menu has been ported, still much work and test to do
giacomo
parents: 2228
diff changeset
1796 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , TRUE );
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1797
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1798 tbutton_set_toggled(mainwin_pl, TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1799 cfg.playlist_visible = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1800
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1801 playlistwin_set_toprow(0);
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1802 playlist_check_pos_current(playlist_get_active());
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1803
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1804 gtk_widget_show(playlistwin);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1805 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1806
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1807 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1808 playlistwin_hide(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1809 {
2232
ac2ea05e60a0 [svn] - migration from gtkitemfactory to actions and uimanager; main menu has been ported, still much work and test to do
giacomo
parents: 2228
diff changeset
1810 GtkAction *action = gtk_action_group_get_action(
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
1811 toggleaction_group_others , "show playlist editor" );
2232
ac2ea05e60a0 [svn] - migration from gtkitemfactory to actions and uimanager; main menu has been ported, still much work and test to do
giacomo
parents: 2228
diff changeset
1812 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , FALSE );
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1813
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1814 gtk_widget_hide(playlistwin);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1815 tbutton_set_toggled(mainwin_pl, FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1816 cfg.playlist_visible = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1817
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1818 gtk_window_present(GTK_WINDOW(mainwin));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1819 gtk_widget_grab_focus(mainwin);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1820 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1821
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1822 void action_playlist_track_info(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1823 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1824 playlistwin_fileinfo();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1825 }
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1826
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
1827 void action_queue_toggle(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1828 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1829 playlist_queue(playlist_get_active());
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1830 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1831
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1832 void action_playlist_sort_by_playlist_entry(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1833 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1834 Playlist *playlist = playlist_get_active();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1835
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1836 playlist_sort(playlist, PLAYLIST_SORT_PLAYLIST);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1837 playlistwin_update_list(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1838 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1839
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1840 void action_playlist_sort_by_track_number(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1841 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1842 Playlist *playlist = playlist_get_active();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1843
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1844 playlist_sort(playlist, PLAYLIST_SORT_TRACK);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1845 playlistwin_update_list(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1846 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1847
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1848 void action_playlist_sort_by_title(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1849 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1850 Playlist *playlist = playlist_get_active();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1851
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1852 playlist_sort(playlist, PLAYLIST_SORT_TITLE);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1853 playlistwin_update_list(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1854 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1855
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1856 void action_playlist_sort_by_artist(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1857 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1858 Playlist *playlist = playlist_get_active();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1859
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1860 playlist_sort(playlist, PLAYLIST_SORT_ARTIST);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1861 playlistwin_update_list(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1862 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1863
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1864 void action_playlist_sort_by_full_path(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1865 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1866 Playlist *playlist = playlist_get_active();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1867
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1868 playlist_sort(playlist, PLAYLIST_SORT_PATH);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1869 playlistwin_update_list(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1870 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1871
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1872 void action_playlist_sort_by_date(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1873 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1874 Playlist *playlist = playlist_get_active();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1875
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1876 playlist_sort(playlist, PLAYLIST_SORT_DATE);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1877 playlistwin_update_list(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1878 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1879
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1880 void action_playlist_sort_by_filename(void)
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1881 {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1882 Playlist *playlist = playlist_get_active();
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1883
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1884 playlist_sort(playlist, PLAYLIST_SORT_FILENAME);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1885 playlistwin_update_list(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1886 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1887
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1888 void action_playlist_sort_selected_by_playlist_entry(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1889 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1890 Playlist *playlist = playlist_get_active();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1891
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1892 playlist_sort_selected(playlist, PLAYLIST_SORT_PLAYLIST);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1893 playlistwin_update_list(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1894 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1895
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1896 void action_playlist_sort_selected_by_track_number(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1897 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1898 Playlist *playlist = playlist_get_active();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1899
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1900 playlist_sort_selected(playlist, PLAYLIST_SORT_TRACK);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1901 playlistwin_update_list(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1902 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1903
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1904 void action_playlist_sort_selected_by_title(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1905 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1906 Playlist *playlist = playlist_get_active();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1907
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1908 playlist_sort_selected(playlist, PLAYLIST_SORT_TITLE);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1909 playlistwin_update_list(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1910 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1911
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1912 void action_playlist_sort_selected_by_artist(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1913 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1914 Playlist *playlist = playlist_get_active();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1915
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1916 playlist_sort_selected(playlist, PLAYLIST_SORT_ARTIST);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1917 playlistwin_update_list(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1918 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1919
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1920 void action_playlist_sort_selected_by_full_path(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1921 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1922 Playlist *playlist = playlist_get_active();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1923
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1924 playlist_sort_selected(playlist, PLAYLIST_SORT_PATH);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1925 playlistwin_update_list(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1926 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1927
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1928 void action_playlist_sort_selected_by_date(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1929 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1930 Playlist *playlist = playlist_get_active();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1931
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1932 playlist_sort_selected(playlist, PLAYLIST_SORT_DATE);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1933 playlistwin_update_list(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1934 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1935
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1936 void action_playlist_sort_selected_by_filename(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1937 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1938 Playlist *playlist = playlist_get_active();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1939
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1940 playlist_sort_selected(playlist, PLAYLIST_SORT_FILENAME);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1941 playlistwin_update_list(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1942 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1943
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1944 void action_playlist_randomize_list(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1945 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1946 Playlist *playlist = playlist_get_active();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1947
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1948 playlist_random(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1949 playlistwin_update_list(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1950 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1951
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1952 void action_playlist_reverse_list(void)
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1953 {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1954 Playlist *playlist = playlist_get_active();
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1955
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1956 playlist_reverse(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1957 playlistwin_update_list(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1958 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1959
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
1960 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1961 action_playlist_clear_queue(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1962 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1963 playlist_clear_queue(playlist_get_active());
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1964 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1965
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
1966 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1967 action_playlist_remove_unavailable(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1968 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1969 playlist_remove_dead_files(playlist_get_active());
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1970 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1971
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
1972 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1973 action_playlist_remove_dupes_by_title(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1974 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1975 playlist_remove_duplicates(playlist_get_active(), PLAYLIST_DUPS_TITLE);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1976 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1977
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
1978 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1979 action_playlist_remove_dupes_by_filename(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1980 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1981 playlist_remove_duplicates(playlist_get_active(), PLAYLIST_DUPS_FILENAME);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1982 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1983
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
1984 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1985 action_playlist_remove_dupes_by_full_path(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1986 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1987 playlist_remove_duplicates(playlist_get_active(), PLAYLIST_DUPS_PATH);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1988 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1989
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
1990 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
1991 action_playlist_remove_all(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1992 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1993 playlist_clear(playlist_get_active());
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1994
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1995 /* XXX -- should this really be coupled here? -nenolod */
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1996 mainwin_clear_song_info();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1997 mainwin_set_info_text();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1998 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
1999
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
2000 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
2001 action_playlist_remove_selected(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2002 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2003 playlist_delete(playlist_get_active(), FALSE);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2004 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2005
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
2006 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
2007 action_playlist_remove_unselected(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2008 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2009 playlist_delete(playlist_get_active(), TRUE);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2010 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2011
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
2012 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
2013 action_playlist_add_files(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2014 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2015 util_run_filebrowser(NO_PLAY_BUTTON);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2016 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2017
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2018 void add_medium(void); /* XXX */
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2019
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
2020 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
2021 action_playlist_add_cd(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2022 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2023 add_medium();
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2024 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2025
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
2026 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
2027 action_playlist_add_url(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2028 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2029 mainwin_show_add_url_window();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2030 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2031
2259
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2032 void
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2033 action_playlist_new( void )
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2034 {
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2035 Playlist *new_pl = playlist_new();
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2036 playlist_add_playlist(new_pl);
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2037 playlist_select_playlist(new_pl);
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2038 }
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2039
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2040 void
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2041 action_playlist_prev( void )
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2042 {
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2043 playlist_select_prev();
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2044 }
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2045
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2046 void
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2047 action_playlist_next( void )
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2048 {
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2049 playlist_select_next();
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2050 }
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2051
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2052 void
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2053 action_playlist_delete( void )
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2054 {
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2055 playlist_remove_playlist( playlist_get_active() );
3668594b4fc8 [svn] - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate)
giacomo
parents: 2257
diff changeset
2056 }
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2057
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
2058 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
2059 action_playlist_save_list(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2060 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2061 Playlist *playlist = playlist_get_active();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2062
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2063 playlistwin_select_playlist_to_save(playlist_get_current_name(playlist));
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2064 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2065
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
2066 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
2067 action_playlist_save_default_list(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2068 {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2069 Playlist *playlist = playlist_get_active();
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2070
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2071 playlist_save(playlist, bmp_paths[BMP_PATH_PLAYLIST_FILE]);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2072 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2073
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
2074 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
2075 action_playlist_load_list(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2076 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2077 Playlist *playlist = playlist_get_active();
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2078
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2079 playlistwin_select_playlist_to_load(playlist_get_current_name(playlist));
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2080 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2081
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
2082 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
2083 action_playlist_refresh_list(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2084 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2085 Playlist *playlist = playlist_get_active();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2086
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2087 playlist_read_info_selection(playlist);
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2088 playlistwin_update_list(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2089 }
2144
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
2090
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
2091 void
2201
39e9c8e2745d [svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents: 2183
diff changeset
2092 action_open_list_manager(void)
39e9c8e2745d [svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents: 2183
diff changeset
2093 {
39e9c8e2745d [svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents: 2183
diff changeset
2094 playlist_manager_ui_show();
39e9c8e2745d [svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents: 2183
diff changeset
2095 }
39e9c8e2745d [svn] - added initial code for playlist manager, that allows to create, delete and switch playlists
giacomo
parents: 2183
diff changeset
2096
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
2097 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
2098 action_playlist_search_and_select(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2099 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2100 playlistwin_select_search();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2101 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2102
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
2103 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
2104 action_playlist_invert_selection(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2105 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2106 playlistwin_inverse_selection();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2107 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2108
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
2109 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
2110 action_playlist_select_none(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2111 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2112 playlistwin_select_none();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2113 }
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2114
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
2115 void
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
2116 action_playlist_select_all(void)
2153
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2117 {
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2118 playlistwin_select_all();
ba578fefe36a [svn] - port playlist editor to XML interface description
nenolod
parents: 2145
diff changeset
2119 }
2144
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
2120
2267
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
2121
8c9e27a834fd [svn] - namespace for playlist menus (part 3, hopefully the last); separated concepts and actions for current_track_info and playlist_track_info, the second still needs some work
giacomo
parents: 2261
diff changeset
2122
2144
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
2123 /* playlistwin_select_search callback functions
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
2124 placed here to avoid making the code messier :) */
2245
6fb65026a8c7 [svn] - port playlist uimanager code to giacomo's ui_manager framework
nenolod
parents: 2237
diff changeset
2125 void
2144
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
2126 playlistwin_select_search_cbt_cb( GtkWidget *called_cbt , gpointer other_cbt )
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
2127 {
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
2128 if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(called_cbt) ) == TRUE )
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
2129 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(other_cbt) , FALSE );
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
2130 return;
b76039eeb6f0 [svn] - added auto-enqueue option for search-in-playlist
giacomo
parents: 2140
diff changeset
2131 }
2145
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
2132
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
2133 static gboolean
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
2134 playlistwin_select_search_kp_cb( GtkWidget *entry , GdkEventKey *event ,
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
2135 gpointer searchdlg_win )
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
2136 {
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
2137 switch (event->keyval)
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
2138 {
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
2139 case GDK_Return:
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
2140 gtk_dialog_response( GTK_DIALOG(searchdlg_win) , GTK_RESPONSE_ACCEPT );
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
2141 return TRUE;
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
2142 default:
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
2143 return FALSE;
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
2144 }
e2c6696c1d9a [svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents: 2144
diff changeset
2145 }