annotate audacious/ui_playlist.c @ 2228:894f7aa46f83 trunk

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