annotate audacious/ui_playlist.c @ 2139:fcd1f54efdb9 trunk

[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
author giacomo
date Sat, 16 Dec 2006 02:52:03 -0800
parents 0d845907c0b9
children 299651a8f107
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"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
42 #include "equalizer.h"
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"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
46 #include "mainwin.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
47 #include "playback.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
48 #include "playlist.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
49 #include "playlist_container.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
50 #include "util.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
51
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
52 #include "pixmaps.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
53 #include "images/audacious_playlist.xpm"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
54
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
55
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
56 #define ITEM_SEPARATOR {"/-", NULL, NULL, 0, "<Separator>", NULL}
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
57
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
58
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
59 enum {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
60 ADD_URL, ADD_DIR, ADD_FILES,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
61 SUB_MISC, SUB_ALL, SUB_CROP, SUB_SELECTED,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
62 SUB_DUPLICATE_BYTITLE, SUB_DUPLICATE_BYFILENAME, SUB_DUPLICATE_BYPATH,
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
63 SEL_SEARCH, SEL_INV, SEL_ZERO, SEL_ALL,
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
64 MISC_SORT, MISC_FILEINFO, MISC_MISCOPTS,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
65 PLIST_NEW, PLIST_SAVE_AS, PLIST_LOAD,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
66 SEL_LOOKUP, CLOSE_PL_WINDOW, MOVE_UP, PLIST_SAVE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
67 MISC_QUEUE, PLIST_CQUEUE, PLIST_JTF, PLIST_JTT,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
68 PLAYLISTWIN_REMOVE_DEAD_FILES,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
69 PLAYLISTWIN_REFRESH, PLIST_DEFAULTSAVE, MISC_FILEPOPUP
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
70 };
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
71
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
72 enum {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
73 PLAYLISTWIN_SORT_BYTITLE, PLAYLISTWIN_SORT_BYFILENAME,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
74 PLAYLISTWIN_SORT_BYPATH, PLAYLISTWIN_SORT_BYDATE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
75 PLAYLISTWIN_SORT_BYARTIST, PLAYLISTWIN_SORT_SEL_BYARTIST,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
76 PLAYLISTWIN_SORT_SEL_BYTITLE, PLAYLISTWIN_SORT_SEL_BYFILENAME,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
77 PLAYLISTWIN_SORT_SEL_BYPATH, PLAYLISTWIN_SORT_SEL_BYDATE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
78 PLAYLISTWIN_SORT_RANDOMIZE, PLAYLISTWIN_SORT_REVERSE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
79 PLAYLISTWIN_SORT_BYTRACK, PLAYLISTWIN_SORT_SEL_BYTRACK,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
80 PLAYLISTWIN_SORT_BYPLAYLIST, PLAYLISTWIN_SORT_SEL_BYPLAYLIST
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
81 };
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
82
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
83 GtkWidget *playlistwin;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
84
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
85 PlayList_List *playlistwin_list = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
86 PButton *playlistwin_shade, *playlistwin_close;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
87
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
88 static gboolean playlistwin_resizing = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
89
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
90 static GtkItemFactory *playlistwin_popup_menu;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
91 static GtkItemFactory *pladd_menu, *pldel_menu;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
92 static GtkItemFactory *plsel_menu, *plsort_menu;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
93 static GtkItemFactory *pllist_menu;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
94
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
95 static GdkPixmap *playlistwin_bg;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
96 static GdkBitmap *playlistwin_mask = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
97 static GdkGC *playlistwin_gc;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
98
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
99 static GtkAccelGroup *playlistwin_accel;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
100
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
101 static gboolean playlistwin_hint_flag = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
102
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
103 static PlaylistSlider *playlistwin_slider = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
104 static TextBox *playlistwin_time_min, *playlistwin_time_sec;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
105 static TextBox *playlistwin_info, *playlistwin_sinfo;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
106 static SButton *playlistwin_srew, *playlistwin_splay;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
107 static SButton *playlistwin_spause, *playlistwin_sstop;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
108 static SButton *playlistwin_sfwd, *playlistwin_seject;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
109 static SButton *playlistwin_sscroll_up, *playlistwin_sscroll_down;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
110
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
111 static GList *playlistwin_wlist = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
112
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
113 static void plsort_menu_callback(gpointer cb_data, guint action,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
114 GtkWidget * w);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
115 static void playlistwin_sub_menu_callback(gpointer cb_data, guint action,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
116 GtkWidget * w);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
117 static void playlistwin_popup_menu_callback(gpointer cb_data, guint action,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
118 GtkWidget * w);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
119
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
120 static GtkItemFactoryEntry playlistwin_popup_menu_entries[] = {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
121 {N_("/View Track Details"), NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
122 playlistwin_popup_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
123 MISC_FILEINFO, "<ImageItem>", my_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
124
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
125 {N_("/Show Popup Info"), NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
126 playlistwin_popup_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
127 MISC_FILEPOPUP, "<ToggleItem>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
128
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
129 ITEM_SEPARATOR,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
130
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
131 {N_("/Remove Selected"), "Delete",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
132 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
133 SUB_SELECTED, "<StockItem>", GTK_STOCK_REMOVE},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
134
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
135 {N_("/Remove Unselected"), NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
136 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
137 SUB_CROP, "<StockItem>", GTK_STOCK_REMOVE},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
138
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
139 {N_("/Remove All"), NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
140 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
141 SUB_ALL, "<StockItem>", GTK_STOCK_CLEAR},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
142
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
143 ITEM_SEPARATOR,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
144
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
145 {N_("/Queue Toggle"), "q",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
146 playlistwin_popup_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
147 MISC_QUEUE, "<ImageItem>", queuetoggle_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
148 };
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
149
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
150 static GtkItemFactoryEntry pladd_menu_entries[] = {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
151 {N_("/Add CD..."), "<shift>c",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
152 mainwin_general_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
153 MAINWIN_GENERAL_ADDCD, "<StockItem>", GTK_STOCK_CDROM},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
154
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
155 {N_("/Add Internet Address..."), "<control>h",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
156 mainwin_general_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
157 MAINWIN_GENERAL_PLAYLOCATION, "<StockItem>", GTK_STOCK_NETWORK},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
158
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
159 {N_("/Add Files..."), "f",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
160 mainwin_general_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
161 MAINWIN_GENERAL_PLAYFILE, "<StockItem>", GTK_STOCK_ADD},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
162 };
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
163
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
164 static GtkItemFactoryEntry pldel_menu_entries[] = {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
165 {N_("/Clear Queue"), "<shift>Q",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
166 playlistwin_popup_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
167 PLIST_CQUEUE, "<StockItem>", GTK_STOCK_CANCEL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
168
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
169 ITEM_SEPARATOR,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
170
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
171 {N_("/Remove Unavailable Files"), NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
172 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
173 PLAYLISTWIN_REMOVE_DEAD_FILES, "<ImageItem>", removeunavail_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
174
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
175 {N_("/Remove Duplicates"), NULL, NULL, 0, "<Branch>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
176 {N_("/Remove Duplicates/By Title"), NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
177 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
178 SUB_DUPLICATE_BYTITLE, "<ImageItem>", removedups_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
179 {N_("/Remove Duplicates/By Filename"), NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
180 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
181 SUB_DUPLICATE_BYFILENAME, "<ImageItem>", removedups_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
182 {N_("/Remove Duplicates/By Path + Filename"), NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
183 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
184 SUB_DUPLICATE_BYPATH, "<ImageItem>", removedups_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
185
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
186 ITEM_SEPARATOR,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
187
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
188 {N_("/Remove All"), NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
189 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
190 SUB_ALL, "<StockItem>", GTK_STOCK_CLEAR},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
191
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
192 {N_("/Remove Unselected"), NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
193 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
194 SUB_CROP, "<StockItem>", GTK_STOCK_REMOVE},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
195
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
196 {N_("/Remove Selected"), "Delete",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
197 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
198 SUB_SELECTED, "<StockItem>", GTK_STOCK_REMOVE}
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
199 };
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
200
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
201 static GtkItemFactoryEntry pllist_menu_entries[] = {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
202 {N_("/New List"), "<shift>N",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
203 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
204 PLIST_NEW, "<StockItem>", GTK_STOCK_NEW},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
205
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
206 ITEM_SEPARATOR,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
207
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
208 {N_("/Load List"), "o",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
209 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
210 PLIST_LOAD, "<StockItem>", GTK_STOCK_OPEN},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
211
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
212 {N_("/Save List"), "<shift>S",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
213 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
214 PLIST_SAVE, "<StockItem>", GTK_STOCK_SAVE},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
215
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
216 {N_("/Save Default List"), "<alt>S",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
217 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
218 PLIST_DEFAULTSAVE, "<StockItem>", GTK_STOCK_SAVE},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
219
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
220 ITEM_SEPARATOR,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
221
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
222 {N_("/Update View"), "F5",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
223 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
224 PLAYLISTWIN_REFRESH, "<StockItem>", GTK_STOCK_REFRESH}
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
225 };
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
226
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
227 static GtkItemFactoryEntry plsel_menu_entries[] = {
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
228 {N_("/Search and Select"), 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
229 playlistwin_sub_menu_callback,
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
230 SEL_SEARCH, "<StockItem>", GTK_STOCK_FIND},
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
231
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
232 ITEM_SEPARATOR,
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
233
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
234 {N_("/Invert Selection"), NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
235 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
236 SEL_INV, "<ImageItem>", selectinvert_pixbuf},
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
237
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
238 ITEM_SEPARATOR,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
239
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
240 {N_("/Select None"),"<Ctrl><Shift>A",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
241 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
242 SEL_ZERO, "<ImageItem>", selectnone_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
243
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
244 {N_("/Select All"), "<Ctrl>A",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
245 playlistwin_sub_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
246 SEL_ALL, "<ImageItem>", selectall_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
247 };
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
248
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
249 static GtkItemFactoryEntry plsort_menu_entries[] = {
1934
886b479afe63 [svn] - assign Control+Shift+R keybinding. to Randomize Playlist. Closes #529
nenolod
parents: 1825
diff changeset
250 {N_("/Randomize List"), "<Ctrl><Shift>R", plsort_menu_callback,
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
251 PLAYLISTWIN_SORT_RANDOMIZE, "<ImageItem>", randomizepl_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
252 {N_("/Reverse List"), NULL, plsort_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
253 PLAYLISTWIN_SORT_REVERSE, "<ImageItem>", invertpl_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
254 ITEM_SEPARATOR,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
255 {N_("/Sort List"), NULL, NULL, 0, "<Branch>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
256 {N_("/Sort List/By Title"), NULL, plsort_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
257 PLAYLISTWIN_SORT_BYTITLE, "<ImageItem>", sortbytitle_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
258 {N_("/Sort List/By Artist"), NULL, plsort_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
259 PLAYLISTWIN_SORT_BYARTIST, "<ImageItem>", sortbytitle_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
260 {N_("/Sort List/By Filename"), NULL, plsort_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
261 PLAYLISTWIN_SORT_BYFILENAME, "<ImageItem>", sortbyfilename_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
262 {N_("/Sort List/By Path + Filename"), NULL, plsort_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
263 PLAYLISTWIN_SORT_BYPATH, "<ImageItem>", sortbypathfile_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
264 {N_("/Sort List/By Date"), NULL, plsort_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
265 PLAYLISTWIN_SORT_BYDATE, "<ImageItem>", sortbydate_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
266 {N_("/Sort List/By Track Number"), NULL, plsort_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
267 PLAYLISTWIN_SORT_BYTRACK, "<ImageItem>", sortbytitle_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
268 {N_("/Sort List/By Playlist Entry"), NULL, plsort_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
269 PLAYLISTWIN_SORT_BYPLAYLIST, "<ImageItem>", sortbytitle_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
270 {N_("/Sort Selection"), NULL, NULL, 0, "<Branch>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
271 {N_("/Sort Selection/By Title"), NULL, plsort_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
272 PLAYLISTWIN_SORT_SEL_BYTITLE, "<ImageItem>", sortbytitle_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
273 {N_("/Sort Selection/By Artist"), NULL, plsort_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
274 PLAYLISTWIN_SORT_SEL_BYARTIST, "<ImageItem>", sortbytitle_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
275 {N_("/Sort Selection/By Filename"), NULL, plsort_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
276 PLAYLISTWIN_SORT_SEL_BYFILENAME, "<ImageItem>", sortbyfilename_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
277 {N_("/Sort Selection/By Path + Filename"), NULL, plsort_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
278 PLAYLISTWIN_SORT_SEL_BYPATH, "<ImageItem>", sortbypathfile_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
279 {N_("/Sort Selection/By Date"), NULL, plsort_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
280 PLAYLISTWIN_SORT_SEL_BYDATE, "<ImageItem>", sortbydate_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
281 {N_("/Sort Selection/By Track Number"), NULL, plsort_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
282 PLAYLISTWIN_SORT_SEL_BYTRACK, "<ImageItem>", sortbytitle_pixbuf},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
283 {N_("/Sort Selection/By Playlist Entry"), NULL, plsort_menu_callback,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
284 PLAYLISTWIN_SORT_SEL_BYPLAYLIST, "<ImageItem>", sortbytitle_pixbuf}
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
285 };
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
286
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
287
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
288 static void playlistwin_draw_frame(void);
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 gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
292 playlistwin_is_shaded(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
293 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
294 return cfg.playlist_shaded;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
295 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
296
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
297 gint
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
298 playlistwin_get_width(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
299 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
300 cfg.playlist_width /= PLAYLISTWIN_WIDTH_SNAP;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
301 cfg.playlist_width *= PLAYLISTWIN_WIDTH_SNAP;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
302 return cfg.playlist_width;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
303 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
304
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
305 gint
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
306 playlistwin_get_height_unshaded(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
307 {
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 2048
diff changeset
308 gint height;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
309 cfg.playlist_height /= PLAYLISTWIN_HEIGHT_SNAP;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
310 cfg.playlist_height *= PLAYLISTWIN_HEIGHT_SNAP;
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 2048
diff changeset
311 height = cfg.playlist_height;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
312 return height;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
313 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
314
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
315 gint
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
316 playlistwin_get_height_shaded(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
317 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
318 return PLAYLISTWIN_SHADED_HEIGHT;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
319 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
320
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
321 gint
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
322 playlistwin_get_height(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
323 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
324 if (playlistwin_is_shaded())
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
325 return playlistwin_get_height_shaded();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
326 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
327 return playlistwin_get_height_unshaded();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
328 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
329
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
330 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
331 playlistwin_get_size(gint * width, gint * height)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
332 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
333 if (width)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
334 *width = playlistwin_get_width();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
335
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
336 if (height)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
337 *height = playlistwin_get_height();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
338 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
339
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
340 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
341 playlistwin_update_info(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
342 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
343 gchar *text, *sel_text, *tot_text;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
344 gulong selection, total;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
345 gboolean selection_more, total_more;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
346
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
347 playlist_get_total_time(playlist_get_active(), &total, &selection, &total_more, &selection_more);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
348
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
349 if (selection > 0 || (selection == 0 && !selection_more)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
350 if (selection > 3600)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
351 sel_text =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
352 g_strdup_printf("%lu:%-2.2lu:%-2.2lu%s", selection / 3600,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
353 (selection / 60) % 60, selection % 60,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
354 (selection_more ? "+" : ""));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
355 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
356 sel_text =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
357 g_strdup_printf("%lu:%-2.2lu%s", selection / 60,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
358 selection % 60, (selection_more ? "+" : ""));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
359 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
360 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
361 sel_text = g_strdup("?");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
362 if (total > 0 || (total == 0 && !total_more)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
363 if (total > 3600)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
364 tot_text =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
365 g_strdup_printf("%lu:%-2.2lu:%-2.2lu%s", total / 3600,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
366 (total / 60) % 60, total % 60,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
367 total_more ? "+" : "");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
368 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
369 tot_text =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
370 g_strdup_printf("%lu:%-2.2lu%s", total / 60, total % 60,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
371 total_more ? "+" : "");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
372 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
373 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
374 tot_text = g_strdup("?");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
375 text = g_strconcat(sel_text, "/", tot_text, NULL);
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
376 textbox_set_text(playlistwin_info, text ? text : "");
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
377 g_free(text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
378 g_free(tot_text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
379 g_free(sel_text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
380 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
381
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
382 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
383 playlistwin_update_sinfo(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
384 {
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
385 gchar *posstr, *timestr, *title, *info;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
386 gint pos, time;
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
387 Playlist *playlist = playlist_get_active();
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
388
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
389 pos = playlist_get_position(playlist);
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
390 title = playlist_get_songtitle(playlist, pos);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
391
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
392 if (!title) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
393 textbox_set_text(playlistwin_sinfo, "");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
394 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
395 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
396
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
397 convert_title_text(title);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
398
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
399 time = playlist_get_songtime(playlist, pos);
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
400
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
401 if (cfg.show_numbers_in_pl)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
402 posstr = g_strdup_printf("%d. ", pos + 1);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
403 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
404 posstr = g_strdup("");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
405
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
406 if (time != -1) {
1800
61f531908dd0 [svn] - Put ()'s around the time in the shaded playlist text.
nhjm449
parents: 1775
diff changeset
407 timestr = g_strdup_printf(" (%d:%-2.2d)", time / 60000,
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
408 (time / 1000) % 60);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
409 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
410 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
411 timestr = g_strdup("");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
412
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
413 info = g_strdup_printf("%s%s%s", posstr, title, timestr);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
414
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
415 g_free(posstr);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
416 g_free(title);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
417 g_free(timestr);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
418
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
419 textbox_set_text(playlistwin_sinfo, info ? info : "");
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
420 g_free(info);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
421 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
422
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
423 gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
424 playlistwin_item_visible(gint index)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
425 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
426 if (index >= playlistwin_list->pl_first
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
427 && index <
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
428 (playlistwin_list->pl_first + playlistwin_list->pl_num_visible))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
429 return TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
430 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
431 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
432
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
433 gint
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
434 playlistwin_get_toprow(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
435 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
436 if (playlistwin_list)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
437 return (playlistwin_list->pl_first);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
438 return (-1);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
439 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
440
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
441 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
442 playlistwin_set_toprow(gint toprow)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
443 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
444 if (playlistwin_list)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
445 playlistwin_list->pl_first = toprow;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
446 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
447 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
448
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
449 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
450 playlistwin_update_list(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
451 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
452 g_return_if_fail(playlistwin_list != NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
453
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
454 widget_draw(WIDGET(playlistwin_list));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
455 widget_draw(WIDGET(playlistwin_slider));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
456 playlistwin_update_info();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
457 playlistwin_update_sinfo();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
458 /* mainwin_update_jtf(); */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
459 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
460
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
461 #if 0
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
462 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
463 playlistwin_redraw_list(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
464 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
465 g_return_if_fail(playlistwin_list != NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
466
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
467 draw_widget(playlistwin_list);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
468 draw_widget(playlistwin_slider);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
469 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
470 #endif
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
471
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
472 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
473 playlistwin_set_mask(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
474 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
475 GdkGC *gc;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
476 GdkColor pattern;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
477
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
478 if (playlistwin_mask)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
479 g_object_unref(playlistwin_mask);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
480
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
481 playlistwin_mask =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
482 gdk_pixmap_new(playlistwin->window, playlistwin_get_width(),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
483 playlistwin_get_height(), 1);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
484 gc = gdk_gc_new(playlistwin_mask);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
485 pattern.pixel = 1;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
486 gdk_gc_set_foreground(gc, &pattern);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
487 gdk_draw_rectangle(playlistwin_mask, gc, TRUE, 0, 0,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
488 playlistwin_get_width(), playlistwin_get_height());
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
489 gdk_gc_destroy(gc);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
490
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
491 gtk_widget_shape_combine_mask(playlistwin, playlistwin_mask, 0, 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
492 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
493
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
494 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
495 playlistwin_set_geometry_hints(gboolean shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
496 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
497 GdkGeometry geometry;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
498 GdkWindowHints mask;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
499
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
500 geometry.min_width = PLAYLISTWIN_MIN_WIDTH;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
501 geometry.max_width = G_MAXUINT16;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
502
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
503 geometry.width_inc = PLAYLISTWIN_WIDTH_SNAP;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
504 geometry.height_inc = PLAYLISTWIN_HEIGHT_SNAP;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
505
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
506 if (shaded) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
507 geometry.min_height = PLAYLISTWIN_SHADED_HEIGHT;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
508 geometry.max_height = PLAYLISTWIN_SHADED_HEIGHT;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
509 geometry.base_height = PLAYLISTWIN_SHADED_HEIGHT;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
510 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
511 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
512 geometry.min_height = PLAYLISTWIN_MIN_HEIGHT;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
513 geometry.max_height = G_MAXUINT16;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
514 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
515
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
516 mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_RESIZE_INC;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
517
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
518 gtk_window_set_geometry_hints(GTK_WINDOW(playlistwin),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
519 playlistwin, &geometry, mask);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
520 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
521
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
522 void
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
523 playlistwin_set_sinfo_font(gchar *font)
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
524 {
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
525 gchar *tmp = NULL, *tmp2 = NULL;
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
526
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
527 if(!font)
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
528 return;
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
529
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
530 tmp = g_strdup(font);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
531 if(!tmp)
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
532 return;
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
533
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
534 *strrchr(tmp, ' ') = '\0';
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
535 tmp2 = g_strdup_printf("%s 8", tmp);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
536 if(!tmp2)
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
537 return;
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
538 textbox_set_xfont(playlistwin_sinfo, cfg.mainwin_use_xfont, tmp2);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
539
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
540 g_free(tmp); g_free(tmp2);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
541 }
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
542
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
543 void
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
544 playlistwin_set_sinfo_scroll(gboolean scroll)
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
545 {
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
546 GtkWidget *item;
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
547
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
548 if(playlistwin_is_shaded())
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
549 textbox_set_scroll(playlistwin_sinfo, cfg.autoscroll);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
550 else
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
551 textbox_set_scroll(playlistwin_sinfo, FALSE);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
552 }
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
553
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
554 void
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
555 playlistwin_set_shade(gboolean shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
556 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
557 cfg.playlist_shaded = shaded;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
558
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
559 if (shaded) {
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
560 playlistwin_set_sinfo_font(cfg.playlist_font);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
561 playlistwin_set_sinfo_scroll(cfg.autoscroll);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
562 widget_show(WIDGET(playlistwin_sinfo));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
563 playlistwin_shade->pb_nx = 128;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
564 playlistwin_shade->pb_ny = 45;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
565 playlistwin_shade->pb_px = 150;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
566 playlistwin_shade->pb_py = 42;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
567 playlistwin_close->pb_nx = 138;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
568 playlistwin_close->pb_ny = 45;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
569 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
570 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
571 widget_hide(WIDGET(playlistwin_sinfo));
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
572 playlistwin_set_sinfo_scroll(FALSE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
573 playlistwin_shade->pb_nx = 157;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
574 playlistwin_shade->pb_ny = 3;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
575 playlistwin_shade->pb_px = 62;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
576 playlistwin_shade->pb_py = 42;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
577 playlistwin_close->pb_nx = 167;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
578 playlistwin_close->pb_ny = 3;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
579 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
580
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
581 dock_shade(dock_window_list, GTK_WINDOW(playlistwin),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
582 playlistwin_get_height());
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
583
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
584 playlistwin_set_geometry_hints(cfg.playlist_shaded);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
585
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
586 gtk_window_resize(GTK_WINDOW(playlistwin),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
587 playlistwin_get_width(),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
588 playlistwin_get_height());
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
589
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
590 playlistwin_set_mask();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
591
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
592 widget_draw(WIDGET(playlistwin_list));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
593 widget_draw(WIDGET(playlistwin_slider));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
594
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
595 draw_playlist_window(TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
596 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
597
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
598 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
599 playlistwin_set_shade_menu(gboolean shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
600 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
601 GtkWidget *item;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
602
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
603 item = gtk_item_factory_get_widget(mainwin_view_menu,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
604 "/Roll up Playlist Editor");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
605 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), shaded);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
606
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
607 playlistwin_set_shade(shaded);
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
608 playlistwin_update_list();
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
609 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
610
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
611 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
612 playlistwin_shade_toggle(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
613 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
614 playlistwin_set_shade_menu(!cfg.playlist_shaded);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
615 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
616
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
617 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
618 playlistwin_release(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
619 GdkEventButton * event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
620 gpointer callback_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
621 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
622 if (event->button == 3)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
623 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
624
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
625 gdk_pointer_ungrab(GDK_CURRENT_TIME);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
626 playlistwin_resizing = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
627 gdk_flush();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
628
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
629 if (dock_is_moving(GTK_WINDOW(playlistwin)))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
630 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
631 dock_move_release(GTK_WINDOW(playlistwin));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
632
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
633 if (cfg.playlist_transparent)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
634 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
635 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
636 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
637 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
638 handle_release_cb(playlistwin_wlist, widget, event);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
639 draw_playlist_window(FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
640 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
641 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
642
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
643 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
644 playlistwin_scroll(gint num)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
645 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
646 playlistwin_list->pl_first += num;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
647 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
648 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
649
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
650 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
651 playlistwin_scroll_up_pushed(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
652 {
2026
f15664434382 [svn] rewrite scan thread with g_cond_wait():
yaz
parents: 1938
diff changeset
653 playlistwin_scroll(-3);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
654 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
655
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
656 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
657 playlistwin_scroll_down_pushed(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
658 {
2026
f15664434382 [svn] rewrite scan thread with g_cond_wait():
yaz
parents: 1938
diff changeset
659 playlistwin_scroll(3);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
660 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
661
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
662 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
663 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
664 {
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
665 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
666
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
667 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
668 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
669 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
670 playlistwin_list->pl_prev_max = playlist_get_length(playlist) - 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
671 playlistwin_update_list();
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
672 }
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
673
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
674 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
675 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
676 {
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
677 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
678 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
679 playlistwin_list->pl_prev_min = -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
680 playlistwin_update_list();
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
681 }
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
682
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
683 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
684 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
685 {
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
686 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
687 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
688 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
689 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
690 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
691 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
692 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
693 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
694 GtkWidget *searchdlg_checkbt_newplaylist;
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
695 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
696
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
697 /* 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
698 searchdlg_win = gtk_dialog_new_with_buttons(
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
699 "Search entries in active playlist" , GTK_WINDOW(mainwin) ,
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
700 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
701 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
702 /* 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
703 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
704 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
705 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
706 "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
707 "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
708 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
709 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
710 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
711 /* 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
712 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
713 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
714 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_track_name) , 0 , 0.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
715 /* 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
716 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
717 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
718 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_album_name) , 0 , 0.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
719 /* 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
720 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
721 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
722 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_performer) , 0 , 0.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
723 /* 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
724 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
725 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
726 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_file_name) , 0 , 0.5 );
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
727 /* 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
728 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
729 _("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
730 gtk_toggle_button_set_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
731 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
732 _("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
733 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_newplaylist) , 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
734 /* place fields in searchdlg_table */
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
735 searchdlg_table = gtk_table_new( 7 , 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
736 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
737 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
738 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
739 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
740 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
741 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
742 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
743 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
744 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
745 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
746 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
747 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
748 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
749 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
750 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
751 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
752 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
753 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
754 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
755 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
756 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
757 0 , 2 , 5 , 6 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 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
758 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_newplaylist ,
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
759 0 , 2 , 6 , 7 , 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
760
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
761 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
762 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
763 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
764 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
765 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
766 {
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
767 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
768 {
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
769 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
770 /* 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
771 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
772 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
773 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
774 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
775 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
776 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
777 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
778 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
779 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
780 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
781 /* 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
782 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
783 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
784 /* 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
785 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
786 /* 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
787 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
788 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
789 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
790 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
791 g_free( tuple );
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
792 playlistwin_update_list();
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
793 /* 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
794 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
795 playlist_new_from_selected();
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
796 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
797 }
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
798 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
799 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
800 }
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
801 /* 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
802 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
803 }
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
804
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
805 static void
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
806 playlistwin_inverse_selection(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
807 {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
808 playlist_select_invert_all(playlist_get_active());
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
809 playlistwin_list->pl_prev_selected = -1;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
810 playlistwin_list->pl_prev_min = -1;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
811 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
812 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
813
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
814 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
815 playlistwin_resize(gint width, gint height)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
816 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
817 gboolean redraw;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
818
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
819 g_return_if_fail(width > 0 && height > 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
820
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
821 cfg.playlist_width = width;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
822
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
823 if (!cfg.playlist_shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
824 cfg.playlist_height = height;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
825 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
826 height = cfg.playlist_height;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
827
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
828 /* FIXME: why the fsck are we doing this manually? */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
829 /* adjust widget positions and sizes */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
830
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
831 widget_resize(WIDGET(playlistwin_list), width - 31, height - 58);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
832
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
833 widget_move(WIDGET(playlistwin_slider), width - 15, 20);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
834 widget_resize(WIDGET(playlistwin_slider), 8, height - 58);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
835
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
836 widget_resize(WIDGET(playlistwin_sinfo), width - 35, 14);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
837 playlistwin_update_sinfo();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
838
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
839 widget_move(WIDGET(playlistwin_shade), width - 21, 3);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
840 widget_move(WIDGET(playlistwin_close), width - 11, 3);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
841 widget_move(WIDGET(playlistwin_time_min), width - 82, height - 15);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
842 widget_move(WIDGET(playlistwin_time_sec), width - 64, height - 15);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
843 widget_move(WIDGET(playlistwin_info), width - 143, height - 28);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
844 widget_move(WIDGET(playlistwin_srew), width - 144, height - 16);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
845 widget_move(WIDGET(playlistwin_splay), width - 138, height - 16);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
846 widget_move(WIDGET(playlistwin_spause), width - 128, height - 16);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
847 widget_move(WIDGET(playlistwin_sstop), width - 118, height - 16);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
848 widget_move(WIDGET(playlistwin_sfwd), width - 109, height - 16);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
849 widget_move(WIDGET(playlistwin_seject), width - 100, height - 16);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
850 widget_move(WIDGET(playlistwin_sscroll_up), width - 14, height - 35);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
851 widget_move(WIDGET(playlistwin_sscroll_down), width - 14, height - 30);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
852
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
853 g_object_unref(playlistwin_bg);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
854 playlistwin_bg = gdk_pixmap_new(playlistwin->window, width, height, -1);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
855 playlistwin_set_mask();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
856
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
857 widget_list_lock(playlistwin_wlist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
858
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
859 widget_list_change_pixmap(playlistwin_wlist, playlistwin_bg);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
860 playlistwin_draw_frame();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
861 widget_list_draw(playlistwin_wlist, &redraw, TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
862 widget_list_clear_redraw(playlistwin_wlist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
863
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
864 widget_list_unlock(playlistwin_wlist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
865
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
866 gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
867 gdk_window_clear(playlistwin->window);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
868 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
869
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
870
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
871
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
872 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
873 playlistwin_motion(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
874 GdkEventMotion * event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
875 gpointer callback_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
876 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
877 GdkEvent *gevent;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
878
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
879 if (dock_is_moving(GTK_WINDOW(playlistwin))) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
880 dock_move_motion(GTK_WINDOW(playlistwin), event);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
881 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
882 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
883 handle_motion_cb(playlistwin_wlist, widget, event);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
884 draw_playlist_window(FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
885 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
886 gdk_flush();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
887
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
888 while ((gevent = gdk_event_get()) != NULL) gdk_event_free(gevent);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
889 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
890
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
891 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
892 playlistwin_enter(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
893 GdkEventMotion * event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
894 gpointer callback_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
895 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
896 playlistwin_list->pl_tooltips = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
897 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
898
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
899 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
900 playlistwin_leave(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
901 GdkEventMotion * event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
902 gpointer callback_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
903 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
904 playlistwin_list->pl_tooltips = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
905 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
906
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
907 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
908 playlistwin_show_filebrowser(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
909 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
910 util_run_filebrowser(NO_PLAY_BUTTON);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
911 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
912
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
913 #if 0
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
914 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
915 playlistwin_add_dir_handler(const gchar * dir)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
916 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
917 g_free(cfg.filesel_path);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
918 cfg.filesel_path = g_strdup(dir);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
919 playlist_add_dir(dir);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
920 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
921 #endif
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
922
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
923 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
924 playlistwin_fileinfo(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
925 {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
926 Playlist *playlist = playlist_get_active();
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
927
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
928 /* Show the first selected file, or the current file if nothing is
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
929 * selected */
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
930 GList *list = playlist_get_selected(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
931 if (list) {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
932 playlist_fileinfo(playlist, GPOINTER_TO_INT(list->data));
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
933 g_list_free(list);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
934 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
935 else
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
936 playlist_fileinfo_current(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
937 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
938
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
939 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
940 menu_set_item_sensitive(GtkItemFactory * item_factory,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
941 const gchar * path,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
942 gboolean sensitive)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
943 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
944 GtkWidget *item = gtk_item_factory_get_widget(item_factory, path);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
945 gtk_widget_set_sensitive(item, sensitive);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
946 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
947
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
948 /* FIXME: broken */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
949 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
950 playlistwin_set_sensitive_sortmenu(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
951 {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
952 gboolean set = playlist_get_num_selected(playlist_get_active()) > 1;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
953 menu_set_item_sensitive(plsort_menu, "/Sort Selection/By Title", set);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
954 menu_set_item_sensitive(plsort_menu, "/Sort Selection/By Filename", set);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
955 menu_set_item_sensitive(plsort_menu, "/Sort Selection/By Path + Filename", set);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
956 menu_set_item_sensitive(plsort_menu, "/Sort Selection/By Date", set);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
957 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
958
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
959 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
960 show_playlist_save_error(GtkWindow * parent,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
961 const gchar * filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
962 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
963 GtkWidget *dialog;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
964
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
965 g_return_if_fail(GTK_IS_WINDOW(parent));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
966 g_return_if_fail(filename != NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
967
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
968 dialog = gtk_message_dialog_new(GTK_WINDOW(parent),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
969 GTK_DIALOG_DESTROY_WITH_PARENT,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
970 GTK_MESSAGE_ERROR,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
971 GTK_BUTTONS_OK,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
972 _("Error writing playlist \"%s\": %s"),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
973 filename, strerror(errno));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
974
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
975 gtk_dialog_run(GTK_DIALOG(dialog));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
976 gtk_widget_destroy(dialog);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
977 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
978
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
979 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
980 show_playlist_overwrite_prompt(GtkWindow * parent,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
981 const gchar * filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
982 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
983 GtkWidget *dialog;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
984 gint result;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
985
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
986 g_return_val_if_fail(GTK_IS_WINDOW(parent), FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
987 g_return_val_if_fail(filename != NULL, FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
988
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
989 dialog = gtk_message_dialog_new(GTK_WINDOW(parent),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
990 GTK_DIALOG_DESTROY_WITH_PARENT,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
991 GTK_MESSAGE_QUESTION,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
992 GTK_BUTTONS_YES_NO,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
993 _("%s already exist. Continue?"),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
994 filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
995
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
996 result = gtk_dialog_run(GTK_DIALOG(dialog));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
997 gtk_widget_destroy(dialog);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
998
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
999 return (result == GTK_RESPONSE_YES);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1000 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1001
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1002 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1003 show_playlist_save_format_error(GtkWindow * parent,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1004 const gchar * filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1005 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1006 const gchar *markup =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1007 N_("<b><big>Unable to save playlist.</big></b>\n\n"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1008 "Unknown file type for '%s'.\n");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1009
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1010 GtkWidget *dialog;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1011
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1012 g_return_if_fail(GTK_IS_WINDOW(parent));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1013 g_return_if_fail(filename != NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1014
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1015 dialog =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1016 gtk_message_dialog_new_with_markup(GTK_WINDOW(parent),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1017 GTK_DIALOG_DESTROY_WITH_PARENT,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1018 GTK_MESSAGE_ERROR,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1019 GTK_BUTTONS_OK,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1020 _(markup),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1021 filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1022 gtk_dialog_run(GTK_DIALOG(dialog));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1023 gtk_widget_destroy(dialog);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1024 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1025
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1026 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1027 playlistwin_save_playlist(const gchar * filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1028 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1029 PlaylistContainer *plc;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1030 gchar *ext = strrchr(filename, '.') + 1;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1031
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1032 plc = playlist_container_find(ext);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1033 if (plc == NULL) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1034 show_playlist_save_format_error(GTK_WINDOW(playlistwin), filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1035 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1036 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1037
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1038 str_replace_in(&cfg.playlist_path, g_path_get_dirname(filename));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1039
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1040 if (g_file_test(filename, G_FILE_TEST_IS_REGULAR))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1041 if (!show_playlist_overwrite_prompt(GTK_WINDOW(playlistwin), filename))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1042 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1043
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1044 if (!playlist_save(playlist_get_active(), filename))
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1045 show_playlist_save_error(GTK_WINDOW(playlistwin), filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1046 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1047
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1048 #if 0
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1049 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1050 playlistwin_save_current(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1051 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1052 const gchar *filename;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1053
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1054 if (!(filename = playlist_get_current_name()))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1055 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1056
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1057 playlistwin_save_playlist(filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1058 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1059 #endif
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1060
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1061 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1062 playlistwin_load_playlist(const gchar * filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1063 {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1064 Playlist *playlist = playlist_get_active();
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1065
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1066 g_return_if_fail(filename != NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1067
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1068 str_replace_in(&cfg.playlist_path, g_strdup(filename));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1069
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1070 playlist_clear(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1071 mainwin_clear_song_info();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1072 mainwin_set_info_text();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1073
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1074 playlist_load(playlist, filename);
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1075 playlist_set_current_name(playlist, filename);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1076 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1077
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1078 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
1079 playlist_file_selection_load(const gchar * title,
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1080 const gchar * default_filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1081 {
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
1082 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
1083 GtkWidget *button;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1084 gchar *filename;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1085
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1086 g_return_val_if_fail(title != NULL, NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1087
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
1088 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
1089 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
1090 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
1091
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
1092 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
1093 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
1094 default_filename);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1095
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
1096 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
1097 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
1098 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
1099 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1100
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
1101 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
1102 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
1103 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
1104 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
1105 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
1106 }
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1107
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1108 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1109 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1110 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1111 filename = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1112
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
1113 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
1114 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
1115 }
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
1116
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
1117 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
1118 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
1119 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
1120 {
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
1121 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
1122 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
1123 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
1124
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
1125 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
1126
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
1127 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
1128 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
1129 GTK_FILE_CHOOSER_ACTION_SAVE, NULL, NULL);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1130
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
1131 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
1132 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
1133 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
1134
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
1135 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
1136 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
1137 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
1138 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
1139
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
1140 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
1141 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
1142 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
1143 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
1144 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
1145 }
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
1146
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
1147 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
1148 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
1149 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
1150 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
1151
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
1152 gtk_widget_hide(dialog);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1153 return filename;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1154 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1155
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1156 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1157 playlistwin_select_playlist_to_load(const gchar * default_filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1158 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1159 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
1160 playlist_file_selection_load(_("Load Playlist"), default_filename);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1161
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1162 if (filename) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1163 playlistwin_load_playlist(filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1164 g_free(filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1165 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1166 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1167
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1168 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1169 playlistwin_select_playlist_to_save(const gchar * default_filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1170 {
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
1171 gchar *dot = NULL, *basename = NULL;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1172 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
1173 playlist_file_selection_save(_("Save Playlist"), default_filename);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1174
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1175 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
1176 /* 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
1177 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
1178 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
1179 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
1180 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
1181 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
1182 g_free(oldname);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1183 }
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
1184 g_free(basename);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1185
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1186 playlistwin_save_playlist(filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1187 g_free(filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1188 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1189 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1190
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1191 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1192 inside_sensitive_widgets(gint x, gint y)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1193 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1194 return (widget_contains(WIDGET(playlistwin_list), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1195 widget_contains(WIDGET(playlistwin_slider), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1196 widget_contains(WIDGET(playlistwin_close), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1197 widget_contains(WIDGET(playlistwin_shade), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1198 widget_contains(WIDGET(playlistwin_time_min), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1199 widget_contains(WIDGET(playlistwin_time_sec), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1200 widget_contains(WIDGET(playlistwin_info), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1201 widget_contains(WIDGET(playlistwin_srew), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1202 widget_contains(WIDGET(playlistwin_splay), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1203 widget_contains(WIDGET(playlistwin_spause), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1204 widget_contains(WIDGET(playlistwin_sstop), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1205 widget_contains(WIDGET(playlistwin_sfwd), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1206 widget_contains(WIDGET(playlistwin_seject), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1207 widget_contains(WIDGET(playlistwin_sscroll_up), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1208 widget_contains(WIDGET(playlistwin_sscroll_down), x, y));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1209 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1210
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1211 #define REGION_L(x1,x2,y1,y2) \
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1212 (event->x >= (x1) && event->x < (x2) && \
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1213 event->y >= cfg.playlist_height - (y1) && \
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1214 event->y < cfg.playlist_height - (y2))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1215
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1216 #define REGION_R(x1,x2,y1,y2) \
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1217 (event->x >= playlistwin_get_width() - (x1) && \
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1218 event->x < playlistwin_get_width() - (x2) && \
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1219 event->y >= cfg.playlist_height - (y1) && \
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1220 event->y < cfg.playlist_height - (y2))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1221
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1222 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1223 playlistwin_scrolled(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1224 GdkEventScroll * event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1225 gpointer callback_data)
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 if (event->direction == GDK_SCROLL_DOWN)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1229 playlistwin_scroll(cfg.scroll_pl_by);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1230
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1231 if (event->direction == GDK_SCROLL_UP)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1232 playlistwin_scroll(-cfg.scroll_pl_by);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1233
2028
88bbe66923fe [svn] - make wheel scroll trigger scan thread
yaz
parents: 2026
diff changeset
1234 g_cond_signal(cond_scan);
88bbe66923fe [svn] - make wheel scroll trigger scan thread
yaz
parents: 2026
diff changeset
1235
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1236 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1237
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1238
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1239
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1240
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1241 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1242 playlistwin_press(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1243 GdkEventButton * event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1244 gpointer callback_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1245 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1246 gboolean grab = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1247 gint xpos, ypos;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1248 GtkWidget *_menu;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1249 GtkRequisition req;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1250
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1251 gtk_window_get_position(GTK_WINDOW(playlistwin), &xpos, &ypos);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1252
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1253 if (event->button == 1 && !cfg.show_wm_decorations &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1254 ((!cfg.playlist_shaded &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1255 event->x > playlistwin_get_width() - 20 &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1256 event->y > cfg.playlist_height - 20) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1257 (cfg.playlist_shaded &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1258 event->x >= playlistwin_get_width() - 31 &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1259 event->x < playlistwin_get_width() - 22))) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1260
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1261 /* NOTE: Workaround for bug #214 */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1262 if (event->type != GDK_2BUTTON_PRESS &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1263 event->type != GDK_3BUTTON_PRESS) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1264 /* resize area */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1265 playlistwin_resizing = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1266 gtk_window_begin_resize_drag(GTK_WINDOW(widget),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1267 GDK_WINDOW_EDGE_SOUTH_EAST,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1268 event->button,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1269 event->x + xpos, event->y + ypos,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1270 event->time);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1271 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1272 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1273 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1274 else if (event->button == 1 && REGION_L(12, 37, 29, 11)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1275 /* ADD button menu */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1276
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1277 _menu = GTK_WIDGET(pladd_menu->widget);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1278 if (!GTK_WIDGET_REALIZED(_menu)) gtk_widget_realize(_menu);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1279 gtk_widget_size_request(_menu, &req);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1280 gtk_item_factory_popup_with_data(pladd_menu,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1281 NULL, NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1282 xpos+12,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1283 (ypos + playlistwin_get_height()) - 8 - req.height, 1, event->time);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1284 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1285 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1286 else if (event->button == 1 && REGION_L(41, 66, 29, 11)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1287 /* SUB button menu */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1288 _menu = GTK_WIDGET(pldel_menu->widget);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1289 if (!GTK_WIDGET_REALIZED(_menu)) gtk_widget_realize(_menu);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1290 gtk_widget_size_request(_menu, &req);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1291 gtk_item_factory_popup_with_data(pldel_menu,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1292 NULL, NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1293 xpos+40,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1294 (ypos + playlistwin_get_height()) - 8 - req.height, 1, event->time);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1295 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1296 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1297 else if (event->button == 1 && REGION_L(70, 95, 29, 11)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1298 /* SEL button menu */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1299 _menu = GTK_WIDGET(plsel_menu->widget);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1300 if (!GTK_WIDGET_REALIZED(_menu)) gtk_widget_realize(_menu);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1301 gtk_widget_size_request(_menu, &req);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1302 gtk_item_factory_popup_with_data(plsel_menu,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1303 NULL, NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1304 xpos+68,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1305 (ypos + playlistwin_get_height()) - 8 - req.height, 1, event->time);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1306
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1307 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1308 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1309 else if (event->button == 1 && REGION_L(99, 124, 29, 11)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1310 /* MISC button menu */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1311 _menu = GTK_WIDGET(plsort_menu->widget);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1312 if (!GTK_WIDGET_REALIZED(_menu)) gtk_widget_realize(_menu);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1313 gtk_widget_size_request(_menu, &req);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1314 gtk_item_factory_popup_with_data(plsort_menu,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1315 NULL, NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1316 xpos+100,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1317 (ypos + playlistwin_get_height()) - 8 - req.height, 1, event->time);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1318 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1319 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1320 else if (event->button == 1 && REGION_R(46, 23, 29, 11)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1321 /* LIST button menu */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1322 _menu = GTK_WIDGET(pllist_menu->widget);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1323 if (!GTK_WIDGET_REALIZED(_menu)) gtk_widget_realize(_menu);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1324 gtk_widget_size_request(_menu, &req);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1325 gtk_item_factory_popup_with_data(pllist_menu,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1326 NULL, NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1327 xpos + playlistwin_get_width() - req.width - 12,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1328 (ypos + playlistwin_get_height()) - 8 - req.height, 1, event->time);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1329 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1330 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1331 else if (event->button == 1 && REGION_R(82, 54, 15, 9)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1332 if (cfg.timer_mode == TIMER_ELAPSED)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1333 cfg.timer_mode = TIMER_REMAINING;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1334 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1335 cfg.timer_mode = TIMER_ELAPSED;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1336 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1337 else if (event->button == 2 && (event->type == GDK_BUTTON_PRESS) &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1338 widget_contains(WIDGET(playlistwin_list), event->x, event->y)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1339 gtk_selection_convert(widget, GDK_SELECTION_PRIMARY,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1340 GDK_TARGET_STRING, event->time);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1341 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1342 else if (event->button == 1 && event->type == GDK_BUTTON_PRESS &&
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1934
diff changeset
1343 !inside_sensitive_widgets(event->x, event->y) && (cfg.easy_move || event->y < 14))
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1344 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1345 dock_move_press(dock_window_list, GTK_WINDOW(playlistwin), event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1346 FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1347 gtk_window_present(GTK_WINDOW(playlistwin));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1348 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1349 else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1350 !inside_sensitive_widgets(event->x, event->y)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1351 && event->y < 14) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1352 /* double click on title bar */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1353 playlistwin_shade_toggle();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1354 if (dock_is_moving(GTK_WINDOW(playlistwin)))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1355 dock_move_release(GTK_WINDOW(playlistwin));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1356 return TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1357 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1358 else if (event->button == 3 &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1359 !(widget_contains(WIDGET(playlistwin_list), event->x, event->y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1360 (event->y >= cfg.playlist_height - 29 &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1361 event->y < cfg.playlist_height - 11 &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1362 ((event->x >= 12 && event->x < 37) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1363 (event->x >= 41 && event->x < 66) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1364 (event->x >= 70 && event->x < 95) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1365 (event->x >= 99 && event->x < 124) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1366 (event->x >= playlistwin_get_width() - 46 &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1367 event->x < playlistwin_get_width() - 23))))) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1368 /*
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1369 * Pop up the main menu a few pixels down to avoid
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1370 * anything to be selected initially.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1371 */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1372 util_item_factory_popup(mainwin_general_menu, event->x_root,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1373 event->y_root + 2, 3, event->time);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1374 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1375 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1376 else if (event->button == 3 &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1377 widget_contains(WIDGET(playlistwin_list), event->x, event->y)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1378 /* popup menu */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1379 playlistwin_set_sensitive_sortmenu();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1380 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1381 GtkWidget *item = gtk_item_factory_get_widget(playlistwin_popup_menu, "/Show Popup Info");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1382 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), cfg.show_filepopup_for_tuple);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1383 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1384 gtk_item_factory_popup(playlistwin_popup_menu,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1385 event->x_root, event->y_root + 5,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1386 3, event->time);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1387 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1388 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1389 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1390 handle_press_cb(playlistwin_wlist, widget, event);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1391 draw_playlist_window(FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1392 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1393
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1394 if (grab)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1395 gdk_pointer_grab(playlistwin->window, FALSE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1396 GDK_BUTTON_MOTION_MASK | GDK_BUTTON_RELEASE_MASK |
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1397 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1398 GDK_BUTTON1_MOTION_MASK, NULL, NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1399 GDK_CURRENT_TIME);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1400
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1401 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1402 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1403
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1404 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1405 playlistwin_focus_in(GtkWidget * widget, GdkEvent * event, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1406 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1407 playlistwin_close->pb_allow_draw = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1408 playlistwin_shade->pb_allow_draw = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1409 draw_playlist_window(TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1410 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1411 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1412
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1413 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1414 playlistwin_focus_out(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1415 GdkEventButton * event, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1416 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1417 playlistwin_close->pb_allow_draw = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1418 playlistwin_shade->pb_allow_draw = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1419 draw_playlist_window(TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1420 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1421 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1422
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1423 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1424 playlistwin_configure(GtkWidget * window,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1425 GdkEventConfigure * event, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1426 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1427 if (!GTK_WIDGET_VISIBLE(window))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1428 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1429
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1430 cfg.playlist_x = event->x;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1431 cfg.playlist_y = event->y;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1432
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1433 if (playlistwin_resizing) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1434 if (event->width != playlistwin_get_width() ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1435 event->height != playlistwin_get_height())
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1436 playlistwin_resize(event->width, event->height);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1437 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1438 return TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1439 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1440
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1441 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1442 playlistwin_set_back_pixmap(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1443 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1444 gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1445 gdk_window_clear(playlistwin->window);
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 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1449 playlistwin_delete(GtkWidget * w, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1450 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1451 playlistwin_hide();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1452 return TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1453 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1454
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1455 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1456 playlistwin_keypress_up_down_handler(PlayList_List * pl,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1457 gboolean up, guint state)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1458 {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1459 Playlist *playlist = playlist_get_active();
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1460
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1461 if ((state & GDK_MOD1_MASK) && (state & GDK_SHIFT_MASK))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1462 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1463 if (!(state & GDK_MOD1_MASK))
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1464 playlist_select_all(playlist, FALSE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1465
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1466 if (pl->pl_prev_selected == -1 ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1467 (!playlistwin_item_visible(pl->pl_prev_selected) &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1468 !(state & GDK_SHIFT_MASK && pl->pl_prev_min != -1))) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1469 pl->pl_prev_selected = pl->pl_first;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1470 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1471 else if (state & GDK_SHIFT_MASK) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1472 if (pl->pl_prev_min == -1) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1473 pl->pl_prev_max = pl->pl_prev_selected;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1474 pl->pl_prev_min = pl->pl_prev_selected;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1475 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1476 pl->pl_prev_max += (up ? -1 : 1);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1477 pl->pl_prev_max =
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1478 CLAMP(pl->pl_prev_max, 0, playlist_get_length(playlist) - 1);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1479
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1480 pl->pl_first = MIN(pl->pl_first, pl->pl_prev_max);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1481 pl->pl_first = MAX(pl->pl_first, pl->pl_prev_max -
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1482 pl->pl_num_visible + 1);
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1483 playlist_select_range(playlist, pl->pl_prev_min, pl->pl_prev_max, TRUE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1484 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1485 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1486 else if (state & GDK_MOD1_MASK) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1487 if (up)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1488 playlist_list_move_up(pl);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1489 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1490 playlist_list_move_down(pl);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1491 if (pl->pl_prev_min < pl->pl_first)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1492 pl->pl_first = pl->pl_prev_min;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1493 else if (pl->pl_prev_max >= (pl->pl_first + pl->pl_num_visible))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1494 pl->pl_first = pl->pl_prev_max - pl->pl_num_visible + 1;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1495 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1496 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1497 else if (up)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1498 pl->pl_prev_selected--;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1499 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1500 pl->pl_prev_selected++;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1501
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1502 pl->pl_prev_selected =
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1503 CLAMP(pl->pl_prev_selected, 0, playlist_get_length(playlist) - 1);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1504
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1505 if (pl->pl_prev_selected < pl->pl_first)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1506 pl->pl_first--;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1507 else if (pl->pl_prev_selected >= (pl->pl_first + pl->pl_num_visible))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1508 pl->pl_first++;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1509
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1510 playlist_select_range(playlist, pl->pl_prev_selected, pl->pl_prev_selected, TRUE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1511 pl->pl_prev_min = -1;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1512 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1513
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1514 /* FIXME: Handle the keys through menu */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1515
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1516 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1517 playlistwin_keypress(GtkWidget * w, GdkEventKey * event, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1518 {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1519 Playlist *playlist = playlist_get_active();
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1520
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1521 guint keyval;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1522 gboolean refresh = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1523
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1524 if (cfg.playlist_shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1525 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1526
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1527 switch (keyval = event->keyval) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1528 case GDK_KP_Up:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1529 case GDK_KP_Down:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1530 case GDK_Up:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1531 case GDK_Down:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1532 playlistwin_keypress_up_down_handler(playlistwin_list,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1533 keyval == GDK_Up
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1534 || keyval == GDK_KP_Up,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1535 event->state);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1536 refresh = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1537 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1538 case GDK_Page_Up:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1539 playlistwin_scroll(-playlistwin_list->pl_num_visible);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1540 refresh = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1541 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1542 case GDK_Page_Down:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1543 playlistwin_scroll(playlistwin_list->pl_num_visible);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1544 refresh = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1545 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1546 case GDK_Home:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1547 playlistwin_list->pl_first = 0;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1548 refresh = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1549 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1550 case GDK_End:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1551 playlistwin_list->pl_first =
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1552 playlist_get_length(playlist) - playlistwin_list->pl_num_visible;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1553 refresh = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1554 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1555 case GDK_Return:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1556 if (playlistwin_list->pl_prev_selected > -1
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1557 && playlistwin_item_visible(playlistwin_list->pl_prev_selected)) {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1558 playlist_set_position(playlist, playlistwin_list->pl_prev_selected);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1559 if (!bmp_playback_get_playing())
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1560 bmp_playback_initiate();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1561 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1562 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1563 case GDK_3:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1564 if (event->state & GDK_CONTROL_MASK)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1565 playlistwin_fileinfo();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1566 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1567 case GDK_Delete:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1568 if (event->state & GDK_CONTROL_MASK)
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1569 playlist_delete(playlist, TRUE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1570 else
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1571 playlist_delete(playlist, FALSE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1572 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1573 case GDK_Insert:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1574 if (event->state & GDK_MOD1_MASK)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1575 mainwin_show_add_url_window();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1576 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1577 playlistwin_show_filebrowser();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1578 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1579 case GDK_Left:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1580 case GDK_KP_Left:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1581 case GDK_KP_7:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1582 if (playlist_get_current_length(playlist) != -1)
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1583 bmp_playback_seek(CLAMP
2043
e211d52a3626 [svn] Seek controls (left and right) now seek 5 seconds like the main window
nazca
parents: 2028
diff changeset
1584 (bmp_playback_get_time() - 5000, 0,
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1585 playlist_get_current_length(playlist)) / 1000);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1586 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1587 case GDK_Right:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1588 case GDK_KP_Right:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1589 case GDK_KP_9:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1590 if (playlist_get_current_length(playlist) != -1)
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1591 bmp_playback_seek(CLAMP
2043
e211d52a3626 [svn] Seek controls (left and right) now seek 5 seconds like the main window
nazca
parents: 2028
diff changeset
1592 (bmp_playback_get_time() + 5000, 0,
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1593 playlist_get_current_length(playlist)) / 1000);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1594 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
1595 case GDK_KP_4:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1596 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
1597 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
1598 case GDK_KP_6:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1599 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
1600 break;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1601
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1602 case GDK_Escape:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1603 mainwin_minimize_cb();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1604 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1605 default:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1606 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1607 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1608
2026
f15664434382 [svn] rewrite scan thread with g_cond_wait():
yaz
parents: 1938
diff changeset
1609 if (refresh) {
f15664434382 [svn] rewrite scan thread with g_cond_wait():
yaz
parents: 1938
diff changeset
1610 g_cond_signal(cond_scan);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1611 playlistwin_update_list();
2026
f15664434382 [svn] rewrite scan thread with g_cond_wait():
yaz
parents: 1938
diff changeset
1612 }
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1613
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1614 return TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1615 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1616
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1617 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1618 playlistwin_draw_frame(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1619 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1620 gboolean focus =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1621 gtk_window_has_toplevel_focus(GTK_WINDOW(playlistwin)) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1622 !cfg.dim_titlebar;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1623
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1624 if (cfg.playlist_shaded) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1625 skin_draw_playlistwin_shaded(bmp_active_skin,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1626 playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1627 playlistwin_get_width(), focus);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1628 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1629 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1630 skin_draw_playlistwin_frame(bmp_active_skin,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1631 playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1632 playlistwin_get_width(),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1633 cfg.playlist_height, focus);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1634 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1635 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1636
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1637 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1638 draw_playlist_window(gboolean force)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1639 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1640 gboolean redraw;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1641 GList *wl;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1642 Widget *w;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1643
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1644 if (force)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1645 playlistwin_draw_frame();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1646
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1647 widget_list_lock(playlistwin_wlist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1648 widget_list_draw(playlistwin_wlist, &redraw, force);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1649
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1650 if (redraw || force) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1651 if (force) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1652 gdk_window_clear(playlistwin->window);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1653 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1654 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1655 for (wl = playlistwin_wlist; wl; wl = g_list_next(wl)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1656 w = WIDGET(wl->data);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1657 if (w->redraw && w->visible) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1658 gdk_window_clear_area(playlistwin->window, w->x, w->y,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1659 w->width, w->height);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1660 w->redraw = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1661 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1662 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1663 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1664
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1665 gdk_flush();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1666 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1667
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1668 widget_list_unlock(playlistwin_wlist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1669 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1670
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1671
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1672 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1673 playlistwin_hide_timer(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1674 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1675 textbox_set_text(playlistwin_time_min, " ");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1676 textbox_set_text(playlistwin_time_sec, " ");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1677 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1678
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1679 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1680 playlistwin_set_time(gint time, gint length, TimerMode mode)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1681 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1682 gchar *text, sign;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1683
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1684 if (mode == TIMER_REMAINING && length != -1) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1685 time = length - time;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1686 sign = '-';
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1687 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1688 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1689 sign = ' ';
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1690
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1691 time /= 1000;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1692
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1693 if (time < 0)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1694 time = 0;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1695 if (time > 99 * 60)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1696 time /= 60;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1697
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1698 text = g_strdup_printf("%c%-2.2d", sign, time / 60);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1699 textbox_set_text(playlistwin_time_min, text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1700 g_free(text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1701
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1702 text = g_strdup_printf("%-2.2d", time % 60);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1703 textbox_set_text(playlistwin_time_sec, text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1704 g_free(text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1705 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1706
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1707 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1708 playlistwin_drag_motion(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1709 GdkDragContext * context,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1710 gint x, gint y,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1711 GtkSelectionData * selection_data,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1712 guint info, guint time, gpointer user_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1713 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1714 playlistwin_list->pl_drag_motion = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1715 playlistwin_list->drag_motion_x = x;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1716 playlistwin_list->drag_motion_y = y;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1717 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1718 playlistwin_hint_flag = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1719 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1720
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1721 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1722 playlistwin_drag_end(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1723 GdkDragContext * context, gpointer user_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1724 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1725 playlistwin_list->pl_drag_motion = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1726 playlistwin_hint_flag = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1727 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1728 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1729
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1730 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1731 playlistwin_drag_data_received(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1732 GdkDragContext * context,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1733 gint x, gint y,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1734 GtkSelectionData *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1735 selection_data, guint info,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1736 guint time, gpointer user_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1737 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1738 gint pos;
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1739 Playlist *playlist = playlist_get_active();
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1740
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1741 g_return_if_fail(selection_data != NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1742
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1743 if (!selection_data->data) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1744 g_message("Received no DND data!");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1745 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1746 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1747
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1748 if (widget_contains(WIDGET(playlistwin_list), x, y)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1749 pos = (y - WIDGET(playlistwin_list)->y) /
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1750 playlistwin_list->pl_fheight + playlistwin_list->pl_first;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1751
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1752 pos = MIN(pos, playlist_get_length(playlist));
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1753 playlist_ins_url(playlist, (gchar *) selection_data->data, pos);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1754 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1755 else
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1756 playlist_add_url(playlist, (gchar *) selection_data->data);
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1757 }
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1758
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1759 static void
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1760 local_playlist_prev(void)
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1761 {
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1762 playlist_prev(playlist_get_active());
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1763 }
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1764
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1765 static void
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1766 local_playlist_next(void)
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1767 {
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1768 playlist_next(playlist_get_active());
1653
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 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1772 playlistwin_create_widgets(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1773 {
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
1774 gchar *font = NULL, *tmp = NULL;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1775 /* This function creates the custom widgets used by the playlist editor */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1776
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1777 /* text box for displaying song title in shaded mode */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1778 playlistwin_sinfo =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1779 create_textbox(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
1775
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
1780 4, 4, playlistwin_get_width() - 35, TRUE, SKIN_TEXT);
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
1781
7d32dff734da [svn] improvement of shaded playlist window
yaz
parents: 1762
diff changeset
1782 playlistwin_set_sinfo_font(cfg.playlist_font);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1783
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1784 if (!cfg.playlist_shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1785 widget_hide(WIDGET(playlistwin_sinfo));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1786
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1787 /* shade/unshade window push button */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1788 if (cfg.playlist_shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1789 playlistwin_shade =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1790 create_pbutton(&playlistwin_wlist, playlistwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1791 playlistwin_gc, playlistwin_get_width() - 21, 3,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1792 9, 9, 128, 45, 150, 42,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1793 playlistwin_shade_toggle, SKIN_PLEDIT);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1794 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1795 playlistwin_shade =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1796 create_pbutton(&playlistwin_wlist, playlistwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1797 playlistwin_gc, playlistwin_get_width() - 21, 3,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1798 9, 9, 157, 3, 62, 42, playlistwin_shade_toggle,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1799 SKIN_PLEDIT);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1800
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1801 playlistwin_shade->pb_allow_draw = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1802
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1803 /* close window push button */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1804 playlistwin_close =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1805 create_pbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1806 playlistwin_get_width() - 11, 3, 9, 9,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1807 cfg.playlist_shaded ? 138 : 167,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1808 cfg.playlist_shaded ? 45 : 3, 52, 42,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1809 playlistwin_hide, SKIN_PLEDIT);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1810 playlistwin_close->pb_allow_draw = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1811
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1812 /* playlist list box */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1813 playlistwin_list =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1814 create_playlist_list(&playlistwin_wlist, playlistwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1815 playlistwin_gc, 12, 20,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1816 playlistwin_get_width() - 31,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1817 cfg.playlist_height - 58);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1818 playlist_list_set_font(cfg.playlist_font);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1819
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1820 /* playlist list box slider */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1821 playlistwin_slider =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1822 create_playlistslider(&playlistwin_wlist, playlistwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1823 playlistwin_gc, playlistwin_get_width() - 15,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1824 20, cfg.playlist_height - 58, playlistwin_list);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1825 /* track time (minute) */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1826 playlistwin_time_min =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1827 create_textbox(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1828 playlistwin_get_width() - 82,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1829 cfg.playlist_height - 15, 15, FALSE, SKIN_TEXT);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1830
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1831 /* track time (second) */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1832 playlistwin_time_sec =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1833 create_textbox(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1834 playlistwin_get_width() - 64,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1835 cfg.playlist_height - 15, 10, FALSE, SKIN_TEXT);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1836
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1837 /* playlist information (current track length / total track length) */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1838 playlistwin_info =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1839 create_textbox(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1840 playlistwin_get_width() - 143,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1841 cfg.playlist_height - 28, 90, FALSE, SKIN_TEXT);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1842
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1843 /* mini play control buttons at right bottom corner */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1844
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1845 /* rewind button */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1846 playlistwin_srew =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1847 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1848 playlistwin_get_width() - 144,
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1849 cfg.playlist_height - 16, 8, 7, local_playlist_prev);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1850
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1851 /* play button */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1852 playlistwin_splay =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1853 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1854 playlistwin_get_width() - 138,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1855 cfg.playlist_height - 16, 10, 7, mainwin_play_pushed);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1856
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1857 /* pause button */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1858 playlistwin_spause =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1859 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1860 playlistwin_get_width() - 128,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1861 cfg.playlist_height - 16, 10, 7, bmp_playback_pause);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1862
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1863 /* stop button */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1864 playlistwin_sstop =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1865 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1866 playlistwin_get_width() - 118,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1867 cfg.playlist_height - 16, 9, 7, mainwin_stop_pushed);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1868
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1869 /* forward button */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1870 playlistwin_sfwd =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1871 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1872 playlistwin_get_width() - 109,
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1873 cfg.playlist_height - 16, 8, 7, local_playlist_next);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1874
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1875 /* eject button */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1876 playlistwin_seject =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1877 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1878 playlistwin_get_width() - 100,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1879 cfg.playlist_height - 16, 9, 7, mainwin_eject_pushed);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1880
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1881
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1882 playlistwin_sscroll_up =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1883 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1884 playlistwin_get_width() - 14,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1885 cfg.playlist_height - 35, 8, 5,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1886 playlistwin_scroll_up_pushed);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1887 playlistwin_sscroll_down =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1888 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1889 playlistwin_get_width() - 14,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1890 cfg.playlist_height - 30, 8, 5,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1891 playlistwin_scroll_down_pushed);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1892
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1893 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1894
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1895 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1896 selection_received(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1897 GtkSelectionData * selection_data, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1898 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1899 if (selection_data->type == GDK_SELECTION_TYPE_STRING &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1900 selection_data->length > 0)
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
1901 playlist_add_url(playlist_get_active(), (gchar *) selection_data->data);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1902 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1903
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1904 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1905 playlistwin_create_window(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1906 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1907 GdkPixbuf *icon;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1908
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1909 playlistwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1910 gtk_window_set_title(GTK_WINDOW(playlistwin), _("Audacious Playlist Editor"));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1911 gtk_window_set_wmclass(GTK_WINDOW(playlistwin), "playlist", "Audacious");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1912 gtk_window_set_role(GTK_WINDOW(playlistwin), "playlist");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1913 gtk_window_set_default_size(GTK_WINDOW(playlistwin),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1914 playlistwin_get_width(),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1915 playlistwin_get_height());
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1916 gtk_window_set_resizable(GTK_WINDOW(playlistwin), TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1917 playlistwin_set_geometry_hints(cfg.playlist_shaded);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1918 dock_window_list = dock_window_set_decorated(dock_window_list,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1919 GTK_WINDOW(playlistwin),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1920 cfg.show_wm_decorations);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1921
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1922 gtk_window_set_transient_for(GTK_WINDOW(playlistwin),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1923 GTK_WINDOW(mainwin));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1924 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(playlistwin), TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1925
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1926 icon = gdk_pixbuf_new_from_xpm_data((const gchar **) bmp_playlist_icon);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1927 gtk_window_set_icon(GTK_WINDOW(playlistwin), icon);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1928 g_object_unref(icon);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1929
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1930 gtk_widget_set_app_paintable(playlistwin, TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1931
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1932 if (cfg.playlist_x != -1 && cfg.save_window_position)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1933 gtk_window_move(GTK_WINDOW(playlistwin),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1934 cfg.playlist_x, cfg.playlist_y);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1935
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1936 gtk_widget_add_events(playlistwin, GDK_POINTER_MOTION_MASK |
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1937 GDK_FOCUS_CHANGE_MASK | GDK_BUTTON_MOTION_MASK |
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1938 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1939 GDK_SCROLL_MASK | GDK_VISIBILITY_NOTIFY_MASK);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1940 gtk_widget_realize(playlistwin);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1941
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1942 util_set_cursor(playlistwin);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1943
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1944 g_signal_connect(playlistwin, "delete_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1945 G_CALLBACK(playlistwin_delete), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1946 g_signal_connect(playlistwin, "button_press_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1947 G_CALLBACK(playlistwin_press), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1948 g_signal_connect(playlistwin, "button_release_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1949 G_CALLBACK(playlistwin_release), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1950 g_signal_connect(playlistwin, "scroll_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1951 G_CALLBACK(playlistwin_scrolled), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1952 g_signal_connect(playlistwin, "motion_notify_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1953 G_CALLBACK(playlistwin_motion), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1954 g_signal_connect(playlistwin, "enter_notify_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1955 G_CALLBACK(playlistwin_enter), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1956 g_signal_connect(playlistwin, "leave_notify_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1957 G_CALLBACK(playlistwin_leave), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1958 g_signal_connect_after(playlistwin, "focus_in_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1959 G_CALLBACK(playlistwin_focus_in), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1960 g_signal_connect_after(playlistwin, "focus_out_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1961 G_CALLBACK(playlistwin_focus_out), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1962 g_signal_connect(playlistwin, "configure_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1963 G_CALLBACK(playlistwin_configure), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1964 g_signal_connect(playlistwin, "style_set",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1965 G_CALLBACK(playlistwin_set_back_pixmap), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1966
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1967 bmp_drag_dest_set(playlistwin);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1968
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1969 /* DnD stuff */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1970 g_signal_connect(playlistwin, "drag-leave",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1971 G_CALLBACK(playlistwin_drag_end), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1972 g_signal_connect(playlistwin, "drag-data-delete",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1973 G_CALLBACK(playlistwin_drag_end), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1974 g_signal_connect(playlistwin, "drag-end",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1975 G_CALLBACK(playlistwin_drag_end), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1976 g_signal_connect(playlistwin, "drag-drop",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1977 G_CALLBACK(playlistwin_drag_end), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1978 g_signal_connect(playlistwin, "drag-data-received",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1979 G_CALLBACK(playlistwin_drag_data_received), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1980 g_signal_connect(playlistwin, "drag-motion",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1981 G_CALLBACK(playlistwin_drag_motion), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1982
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1983 g_signal_connect(playlistwin, "key_press_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1984 G_CALLBACK(playlistwin_keypress), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1985 g_signal_connect(playlistwin, "selection_received",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1986 G_CALLBACK(selection_received), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1987
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1988 playlistwin_set_mask();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1989 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1990
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1991 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1992 playlistwin_create_popup_menus(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1993 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1994 playlistwin_accel = gtk_accel_group_new();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1995
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1996 /* playlist window popup menu */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1997 playlistwin_popup_menu = create_menu(playlistwin_popup_menu_entries,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1998 G_N_ELEMENTS(playlistwin_popup_menu_entries),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1999 playlistwin_accel);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2000
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2001 pladd_menu = create_menu(pladd_menu_entries, G_N_ELEMENTS(pladd_menu_entries),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2002 playlistwin_accel);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2003 pldel_menu = create_menu(pldel_menu_entries, G_N_ELEMENTS(pldel_menu_entries),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2004 playlistwin_accel);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2005 plsel_menu = create_menu(plsel_menu_entries, G_N_ELEMENTS(plsel_menu_entries),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2006 playlistwin_accel);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2007 plsort_menu = create_menu(plsort_menu_entries,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2008 G_N_ELEMENTS(plsort_menu_entries),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2009 playlistwin_accel);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2010 pllist_menu = create_menu(pllist_menu_entries, G_N_ELEMENTS(pllist_menu_entries),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2011 playlistwin_accel);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2012
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2013 #if 0
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2014 make_submenu(playlistwin_popup_menu, "/Playlist",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2015 playlistwin_playlist_menu);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2016 make_submenu(playlistwin_popup_menu, "/Playback",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2017 playlistwin_playback_menu);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2018 make_submenu(playlistwin_popup_menu, "/Add",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2019 pladd_menu);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2020 #endif
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2021 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2022
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2023 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2024 playlistwin_create(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2025 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2026 playlistwin_create_window();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2027 playlistwin_create_popup_menus();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2028
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2029 /* create GC and back pixmap for custom widget to draw on */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2030 playlistwin_gc = gdk_gc_new(playlistwin->window);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2031 playlistwin_bg = gdk_pixmap_new(playlistwin->window,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2032 playlistwin_get_width(),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2033 playlistwin_get_height_unshaded(), -1);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2034 gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2035
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2036 playlistwin_create_widgets();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2037 playlistwin_update_info();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2038
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2039 gtk_window_add_accel_group(GTK_WINDOW(playlistwin), playlistwin_accel);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2040 gtk_window_add_accel_group(GTK_WINDOW(playlistwin), mainwin_accel);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2041 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2042
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2043
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2044 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2045 playlistwin_show(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2046 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2047 GtkWidget *item;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2048
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2049 item = gtk_item_factory_get_widget(mainwin_view_menu,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2050 "/Show Playlist Editor");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2051 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2052
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2053 tbutton_set_toggled(mainwin_pl, TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2054 cfg.playlist_visible = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2055
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2056 playlistwin_set_toprow(0);
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2057 playlist_check_pos_current(playlist_get_active());
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2058
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2059 gtk_widget_show(playlistwin);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2060 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2061
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2062 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2063 playlistwin_hide(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2064 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2065 GtkWidget *item;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2066
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2067 item = gtk_item_factory_get_widget(mainwin_view_menu,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2068 "/Show Playlist Editor");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2069 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2070
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2071 gtk_widget_hide(playlistwin);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2072 tbutton_set_toggled(mainwin_pl, FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2073 cfg.playlist_visible = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2074
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2075 gtk_window_present(GTK_WINDOW(mainwin));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2076 gtk_widget_grab_focus(mainwin);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2077 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2078
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2079
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2080 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2081 plsort_menu_callback(gpointer data,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2082 guint action,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2083 GtkWidget * widget)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2084 {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2085 Playlist *playlist = playlist_get_active();
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2086
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2087 switch (action) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2088 case PLAYLISTWIN_SORT_BYPLAYLIST:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2089 playlist_sort(playlist, PLAYLIST_SORT_PLAYLIST);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2090 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2091 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2092 case PLAYLISTWIN_SORT_BYTRACK:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2093 playlist_sort(playlist, PLAYLIST_SORT_TRACK);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2094 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2095 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2096 case PLAYLISTWIN_SORT_BYTITLE:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2097 playlist_sort(playlist, PLAYLIST_SORT_TITLE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2098 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2099 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2100 case PLAYLISTWIN_SORT_BYARTIST:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2101 playlist_sort(playlist, PLAYLIST_SORT_ARTIST);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2102 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2103 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2104 case PLAYLISTWIN_SORT_BYPATH:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2105 playlist_sort(playlist, PLAYLIST_SORT_PATH);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2106 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2107 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2108 case PLAYLISTWIN_SORT_BYDATE:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2109 playlist_sort(playlist, PLAYLIST_SORT_DATE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2110 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2111 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2112 case PLAYLISTWIN_SORT_BYFILENAME:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2113 playlist_sort(playlist, PLAYLIST_SORT_FILENAME);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2114 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2115 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2116 case PLAYLISTWIN_SORT_SEL_BYPLAYLIST:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2117 playlist_sort_selected(playlist, PLAYLIST_SORT_PLAYLIST);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2118 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2119 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2120 case PLAYLISTWIN_SORT_SEL_BYTRACK:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2121 playlist_sort_selected(playlist, PLAYLIST_SORT_TRACK);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2122 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2123 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2124 case PLAYLISTWIN_SORT_SEL_BYTITLE:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2125 playlist_sort_selected(playlist, PLAYLIST_SORT_TITLE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2126 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2127 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2128 case PLAYLISTWIN_SORT_SEL_BYARTIST:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2129 playlist_sort_selected(playlist, PLAYLIST_SORT_ARTIST);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2130 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2131 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2132 case PLAYLISTWIN_SORT_SEL_BYFILENAME:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2133 playlist_sort_selected(playlist, PLAYLIST_SORT_FILENAME);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2134 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2135 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2136 case PLAYLISTWIN_SORT_SEL_BYPATH:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2137 playlist_sort_selected(playlist, PLAYLIST_SORT_PATH);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2138 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2139 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2140 case PLAYLISTWIN_SORT_SEL_BYDATE:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2141 playlist_sort_selected(playlist, PLAYLIST_SORT_DATE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2142 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2143 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2144 case PLAYLISTWIN_SORT_REVERSE:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2145 playlist_reverse(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2146 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2147 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2148 case PLAYLISTWIN_SORT_RANDOMIZE:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2149 playlist_random(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2150 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2151 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2152 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2153 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2154
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2155 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2156 playlistwin_sub_menu_callback(gpointer data,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2157 guint action,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2158 GtkWidget * widget)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2159 {
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2160 Playlist *playlist = playlist_get_active();
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2161
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2162 switch (action) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2163 case PLIST_NEW:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2164 playlist_set_current_name(playlist, NULL);
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2165 playlist_clear(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2166 mainwin_clear_song_info();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2167 mainwin_set_info_text();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2168 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2169 case PLIST_SAVE:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2170 playlistwin_select_playlist_to_save(playlist_get_current_name(playlist));
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2171 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2172 case PLIST_DEFAULTSAVE:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2173 playlist_save(playlist, bmp_paths[BMP_PATH_PLAYLIST_FILE]);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2174 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2175 case PLIST_SAVE_AS:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2176 playlistwin_select_playlist_to_save(playlist_get_current_name(playlist));
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2177 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2178 case PLIST_LOAD:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2179 playlistwin_select_playlist_to_load(playlist_get_current_name(playlist));
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2180 break;
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
2181 case SEL_SEARCH:
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
2182 playlistwin_select_search();
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
2183 break;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2184 case SEL_INV:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2185 playlistwin_inverse_selection();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2186 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2187 case SEL_ZERO:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2188 playlistwin_select_none();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2189 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2190 case SEL_ALL:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2191 playlistwin_select_all();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2192 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2193 case SUB_ALL:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2194 playlist_clear(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2195 mainwin_clear_song_info();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2196 mainwin_set_info_text();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2197 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2198 case SUB_CROP:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2199 playlist_delete(playlist, TRUE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2200 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2201 case SUB_SELECTED:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2202 playlist_delete(playlist, FALSE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2203 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2204 case SUB_DUPLICATE_BYTITLE:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2205 playlist_remove_duplicates(playlist, PLAYLIST_DUPS_TITLE);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2206 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2207 case SUB_DUPLICATE_BYFILENAME:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2208 playlist_remove_duplicates(playlist, PLAYLIST_DUPS_FILENAME);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2209 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2210 case SUB_DUPLICATE_BYPATH:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2211 playlist_remove_duplicates(playlist, PLAYLIST_DUPS_PATH);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2212 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2213 case PLAYLISTWIN_REMOVE_DEAD_FILES:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2214 playlist_remove_dead_files(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2215 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2216 case PLAYLISTWIN_REFRESH:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2217 playlist_read_info_selection(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2218 playlistwin_update_list();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2219 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2220 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2221 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2222
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2223 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2224 playlistwin_popup_menu_callback(gpointer data,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2225 guint action,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2226 GtkWidget * widget)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2227 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2228 extern GtkWidget *filepopupbutton;
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2229 Playlist *playlist = playlist_get_active();
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2230
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2231 switch (action) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2232 case ADD_FILES:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2233 playlistwin_show_filebrowser();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2234 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2235 case CLOSE_PL_WINDOW:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2236 playlistwin_hide();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2237 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2238 case MISC_FILEINFO:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2239 playlistwin_fileinfo();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2240 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2241 case SEL_LOOKUP:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2242 playlist_read_info_selection(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2243 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2244 case MISC_QUEUE:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2245 playlist_queue(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2246 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2247 case PLIST_CQUEUE:
2095
855bba3f364e [svn] - update playlist UI
nenolod
parents: 2055
diff changeset
2248 playlist_clear_queue(playlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2249 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2250 case PLIST_JTT:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2251 mainwin_jump_to_time();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2252 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2253 case PLIST_JTF:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2254 mainwin_jump_to_file();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2255 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2256 case MISC_FILEPOPUP:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2257 cfg.show_filepopup_for_tuple = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2258 if(filepopupbutton != NULL){
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2259 gtk_signal_emit_by_name(GTK_OBJECT(filepopupbutton), "realize");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2260 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2261 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2262
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2263 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2264 }