annotate audacious/ui_playlist.c @ 1775:7d32dff734da trunk

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