annotate audacious/ui_playlist.c @ 1538:fe671cb74bf9 trunk

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