annotate src/skins/ui_playlist.c @ 2975:4d778b7a19c6

now sndfile can display Japanese file name.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 12 Feb 2009 01:50:09 +0900
parents 3134a0987162
children 323138ecc070
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1 /* Audacious - Cross-platform multimedia player
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
2 * Copyright (C) 2005-2006 Audacious development team.
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
3 *
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
4 * BMP - Cross-platform multimedia player
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2003-2004 BMP development team.
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
6 *
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
7 * Based on XMMS:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
8 * Copyright (C) 1998-2003 XMMS development team.
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
9 *
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
12 * the Free Software Foundation; under version 3 of the License.
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
13 *
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
17 * GNU General Public License for more details.
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
18 *
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
20 * along with this program. If not, see <http://www.gnu.org/licenses>.
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
21 *
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
22 * The Audacious team does not consider modular code linking to
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
23 * Audacious or using our public API to be a derived work.
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
24 */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
25
2967
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
26 #define AUD_DEBUG 1
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
27 #define CONDSCAN 1
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
28
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
29 #include "ui_playlist.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
30
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
31 #include <glib.h>
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
32 #include <glib/gi18n.h>
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
33 #include <gdk/gdk.h>
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
34 #include <gdk/gdkkeysyms.h>
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
35 #include <gtk/gtk.h>
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
36 #include <string.h>
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
37
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
38 #include "platform/smartinclude.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
39
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
40 #include <unistd.h>
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
41 #include <errno.h>
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
42
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
43 #include "actions-playlist.h"
2629
2ce9e17525dc make dnd working in playlistwin
Tomasz Mon <desowin@gmail.com>
parents: 2621
diff changeset
44 #include "dnd.h"
2816
a7a260032a5e use InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents: 2794
diff changeset
45 #include "plugin.h"
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
46 #include "ui_dock.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
47 #include "ui_equalizer.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
48 #include "ui_main.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
49 #include "ui_manager.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
50 #include "ui_playlist_evlisteners.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
51 #include "ui_playlist_manager.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
52 #include "util.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
53
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
54 #include "ui_skinned_window.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
55 #include "ui_skinned_button.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
56 #include "ui_skinned_textbox.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
57 #include "ui_skinned_playlist_slider.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
58 #include "ui_skinned_playlist.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
59
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
60 #include "icons-stock.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
61 #include "images/audacious_playlist.xpm"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
62
2971
3134a0987162 - changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2967
diff changeset
63 #include <audlegacy/main.h>
2967
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
64
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
65 GtkWidget *playlistwin;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
66
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
67 static GMutex *resize_mutex = NULL;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
68
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
69 static GtkWidget *playlistwin_list = NULL;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
70 static GtkWidget *playlistwin_shade, *playlistwin_close;
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
71 static GtkWidget *playlistwin_shaded_shade, *playlistwin_shaded_close;
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
72
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
73 static gboolean playlistwin_hint_flag = FALSE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
74
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
75 static GtkWidget *playlistwin_slider;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
76 static GtkWidget *playlistwin_time_min, *playlistwin_time_sec;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
77 static GtkWidget *playlistwin_info, *playlistwin_sinfo;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
78 static GtkWidget *playlistwin_srew, *playlistwin_splay;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
79 static GtkWidget *playlistwin_spause, *playlistwin_sstop;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
80 static GtkWidget *playlistwin_sfwd, *playlistwin_seject;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
81 static GtkWidget *playlistwin_sscroll_up, *playlistwin_sscroll_down;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
82
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
83 static void playlistwin_select_search_cbt_cb(GtkWidget *called_cbt,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
84 gpointer other_cbt);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
85 static gboolean playlistwin_select_search_kp_cb(GtkWidget *entry,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
86 GdkEventKey *event,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
87 gpointer searchdlg_win);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
88
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
89 static gboolean playlistwin_resizing = FALSE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
90 static gint playlistwin_resize_x, playlistwin_resize_y;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
91
2967
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
92 /* #if CONDSCAN */
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
93 /* extern GCond *cond_scan; */
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
94 /* #endif */
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
95
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
96 gboolean
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
97 playlistwin_is_shaded(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
98 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
99 return config.playlist_shaded;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
100 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
101
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
102 gint
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
103 playlistwin_get_width(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
104 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
105 config.playlist_width /= PLAYLISTWIN_WIDTH_SNAP;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
106 config.playlist_width *= PLAYLISTWIN_WIDTH_SNAP;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
107 return config.playlist_width;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
108 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
109
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
110 gint
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
111 playlistwin_get_height_unshaded(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
112 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
113 config.playlist_height /= PLAYLISTWIN_HEIGHT_SNAP;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
114 config.playlist_height *= PLAYLISTWIN_HEIGHT_SNAP;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
115 return config.playlist_height;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
116 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
117
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
118 gint
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
119 playlistwin_get_height_shaded(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
120 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
121 return PLAYLISTWIN_SHADED_HEIGHT;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
122 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
123
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
124 gint
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
125 playlistwin_get_height(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
126 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
127 if (playlistwin_is_shaded())
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
128 return playlistwin_get_height_shaded();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
129 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
130 return playlistwin_get_height_unshaded();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
131 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
132
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
133 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
134 playlistwin_update_info(Playlist *playlist)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
135 {
2634
43a07a0607da make playlistwin_update_info and playlistwin_update_sinfo working
Tomasz Mon <desowin@gmail.com>
parents: 2629
diff changeset
136 g_return_if_fail(playlist != NULL);
43a07a0607da make playlistwin_update_info and playlistwin_update_sinfo working
Tomasz Mon <desowin@gmail.com>
parents: 2629
diff changeset
137
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
138 gchar *text, *sel_text, *tot_text;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
139 gulong selection, total;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
140 gboolean selection_more, total_more;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
141
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
142 aud_playlist_get_total_time(playlist, &total, &selection, &total_more, &selection_more);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
143
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
144 if (selection > 0 || (selection == 0 && !selection_more)) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
145 if (selection > 3600)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
146 sel_text =
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
147 g_strdup_printf("%lu:%-2.2lu:%-2.2lu%s", selection / 3600,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
148 (selection / 60) % 60, selection % 60,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
149 (selection_more ? "+" : ""));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
150 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
151 sel_text =
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
152 g_strdup_printf("%lu:%-2.2lu%s", selection / 60,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
153 selection % 60, (selection_more ? "+" : ""));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
154 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
155 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
156 sel_text = g_strdup("?");
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
157 if (total > 0 || (total == 0 && !total_more)) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
158 if (total > 3600)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
159 tot_text =
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
160 g_strdup_printf("%lu:%-2.2lu:%-2.2lu%s", total / 3600,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
161 (total / 60) % 60, total % 60,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
162 total_more ? "+" : "");
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
163 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
164 tot_text =
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
165 g_strdup_printf("%lu:%-2.2lu%s", total / 60, total % 60,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
166 total_more ? "+" : "");
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
167 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
168 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
169 tot_text = g_strdup("?");
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
170 text = g_strconcat(sel_text, "/", tot_text, NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
171 ui_skinned_textbox_set_text(playlistwin_info, text ? text : "");
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
172 g_free(text);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
173 g_free(tot_text);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
174 g_free(sel_text);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
175 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
176
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
177 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
178 playlistwin_update_sinfo(Playlist *playlist)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
179 {
2634
43a07a0607da make playlistwin_update_info and playlistwin_update_sinfo working
Tomasz Mon <desowin@gmail.com>
parents: 2629
diff changeset
180 g_return_if_fail(playlist != NULL);
43a07a0607da make playlistwin_update_info and playlistwin_update_sinfo working
Tomasz Mon <desowin@gmail.com>
parents: 2629
diff changeset
181
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
182 gchar *posstr, *timestr, *title, *info;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
183 gint pos, time;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
184
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
185 pos = aud_playlist_get_position(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
186 title = aud_playlist_get_songtitle(playlist, pos);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
187
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
188 if (!title) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
189 ui_skinned_textbox_set_text(playlistwin_sinfo, "");
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
190 return;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
191 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
192
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
193 aud_convert_title_text(title);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
194
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
195 time = aud_playlist_get_songtime(playlist, pos);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
196
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
197 if (config.show_numbers_in_pl)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
198 posstr = g_strdup_printf("%d. ", pos + 1);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
199 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
200 posstr = g_strdup("");
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
201
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
202 if (time != -1) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
203 timestr = g_strdup_printf(" (%d:%-2.2d)", time / 60000,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
204 (time / 1000) % 60);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
205 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
206 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
207 timestr = g_strdup("");
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
208
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
209 info = g_strdup_printf("%s%s%s", posstr, title, timestr);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
210
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
211 g_free(posstr);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
212 g_free(title);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
213 g_free(timestr);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
214
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
215 ui_skinned_textbox_set_text(playlistwin_sinfo, info ? info : "");
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
216 g_free(info);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
217 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
218
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
219 gboolean
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
220 playlistwin_item_visible(gint index)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
221 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
222 g_return_val_if_fail(UI_SKINNED_IS_PLAYLIST(playlistwin_list), FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
223
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
224 if (index >= UI_SKINNED_PLAYLIST(playlistwin_list)->first &&
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
225 index < (UI_SKINNED_PLAYLIST(playlistwin_list)->first + UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible) ) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
226 return TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
227 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
228 return FALSE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
229 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
230
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
231 gint
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
232 playlistwin_list_get_visible_count(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
233 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
234 g_return_val_if_fail(UI_SKINNED_IS_PLAYLIST(playlistwin_list), -1);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
235
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
236 return UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
237 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
238
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
239 gint
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
240 playlistwin_list_get_first(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
241 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
242 g_return_val_if_fail(UI_SKINNED_IS_PLAYLIST(playlistwin_list), -1);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
243
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
244 return UI_SKINNED_PLAYLIST(playlistwin_list)->first;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
245 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
246
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
247 gint
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
248 playlistwin_get_toprow(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
249 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
250 g_return_val_if_fail(UI_SKINNED_IS_PLAYLIST(playlistwin_list), -1);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
251
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
252 return (UI_SKINNED_PLAYLIST(playlistwin_list)->first);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
253 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
254
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
255 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
256 playlistwin_set_toprow(gint toprow)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
257 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
258 if (UI_SKINNED_IS_PLAYLIST(playlistwin_list))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
259 UI_SKINNED_PLAYLIST(playlistwin_list)->first = toprow;
2967
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
260 #if CONDSCAN
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
261 GCond *cond_scan = aud_get_cond_scan();
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
262 AUDDBG("cond_scan = %p\n", cond_scan);
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
263 if(cond_scan)
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
264 g_cond_signal(cond_scan);
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
265 #endif
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
266 playlistwin_update_list(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
267 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
268
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
269 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
270 playlistwin_update_list(Playlist *playlist)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
271 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
272 /* this can happen early on. just bail gracefully. */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
273 g_return_if_fail(playlistwin_list);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
274
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
275 playlistwin_update_info(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
276 playlistwin_update_sinfo(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
277 gtk_widget_queue_draw(playlistwin_list);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
278 gtk_widget_queue_draw(playlistwin_slider);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
279 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
280
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
281 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
282 playlistwin_set_geometry_hints(gboolean shaded)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
283 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
284 GdkGeometry geometry;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
285 GdkWindowHints mask;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
286
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
287 geometry.min_width = PLAYLISTWIN_MIN_WIDTH;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
288 geometry.max_width = G_MAXUINT16;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
289
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
290 geometry.width_inc = PLAYLISTWIN_WIDTH_SNAP;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
291 geometry.height_inc = PLAYLISTWIN_HEIGHT_SNAP;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
292
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
293 if (shaded) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
294 geometry.min_height = PLAYLISTWIN_SHADED_HEIGHT;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
295 geometry.max_height = PLAYLISTWIN_SHADED_HEIGHT;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
296 geometry.base_height = PLAYLISTWIN_SHADED_HEIGHT;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
297 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
298 else {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
299 geometry.min_height = PLAYLISTWIN_MIN_HEIGHT;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
300 geometry.max_height = G_MAXUINT16;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
301 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
302
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
303 mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_RESIZE_INC;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
304
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
305 gtk_window_set_geometry_hints(GTK_WINDOW(playlistwin),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
306 playlistwin, &geometry, mask);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
307 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
308
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
309 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
310 playlistwin_set_sinfo_font(gchar *font)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
311 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
312 gchar *tmp = NULL, *tmp2 = NULL;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
313
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
314 g_return_if_fail(font);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
315 AUDDBG("Attempt to set font \"%s\"\n", font);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
316
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
317 tmp = g_strdup(font);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
318 g_return_if_fail(tmp);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
319
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
320 *strrchr(tmp, ' ') = '\0';
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
321 tmp2 = g_strdup_printf("%s 8", tmp);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
322 g_return_if_fail(tmp2);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
323
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
324 ui_skinned_textbox_set_xfont(playlistwin_sinfo, !config.mainwin_use_bitmapfont, tmp2);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
325
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
326 g_free(tmp);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
327 g_free(tmp2);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
328 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
329
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
330 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
331 playlistwin_set_sinfo_scroll(gboolean scroll)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
332 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
333 if(playlistwin_is_shaded())
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
334 ui_skinned_textbox_set_scroll(playlistwin_sinfo, config.autoscroll);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
335 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
336 ui_skinned_textbox_set_scroll(playlistwin_sinfo, FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
337 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
338
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
339 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
340 playlistwin_set_shade(gboolean shaded)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
341 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
342 config.playlist_shaded = shaded;
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
343 ui_skinned_window_set_shade(playlistwin, shaded);
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
344
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
345 if (shaded) {
2642
c2603047a1a3 add few more config items
Tomasz Mon <desowin@gmail.com>
parents: 2640
diff changeset
346 playlistwin_set_sinfo_font(config.playlist_font);
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
347 playlistwin_set_sinfo_scroll(config.autoscroll);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
348 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
349 else {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
350 playlistwin_set_sinfo_scroll(FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
351 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
352
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
353 dock_shade(get_dock_window_list(), GTK_WINDOW(playlistwin),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
354 playlistwin_get_height());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
355
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
356 playlistwin_set_geometry_hints(config.playlist_shaded);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
357
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
358 gtk_window_resize(GTK_WINDOW(playlistwin),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
359 playlistwin_get_width(),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
360 playlistwin_get_height());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
361 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
362
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
363 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
364 playlistwin_set_shade_menu(gboolean shaded)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
365 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
366 GtkAction *action = gtk_action_group_get_action(
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
367 toggleaction_group_others , "roll up playlist editor" );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
368 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , shaded );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
369
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
370 playlistwin_set_shade(shaded);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
371 playlistwin_update_list(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
372 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
373
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
374 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
375 playlistwin_shade_toggle(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
376 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
377 playlistwin_set_shade_menu(!config.playlist_shaded);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
378 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
379
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
380 static gboolean
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
381 playlistwin_release(GtkWidget * widget,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
382 GdkEventButton * event,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
383 gpointer callback_data)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
384 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
385 playlistwin_resizing = FALSE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
386 return FALSE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
387 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
388
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
389 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
390 playlistwin_scroll(gint num)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
391 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
392 if (UI_SKINNED_IS_PLAYLIST(playlistwin_list))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
393 UI_SKINNED_PLAYLIST(playlistwin_list)->first += num;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
394 playlistwin_update_list(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
395 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
396
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
397 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
398 playlistwin_scroll_up_pushed(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
399 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
400 playlistwin_scroll(-3);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
401 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
402
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
403 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
404 playlistwin_scroll_down_pushed(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
405 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
406 playlistwin_scroll(3);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
407 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
408
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
409 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
410 playlistwin_select_all(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
411 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
412 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
413
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
414 aud_playlist_select_all(playlist, TRUE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
415 if (UI_SKINNED_IS_PLAYLIST(playlistwin_list)) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
416 UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected = 0;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
417 UI_SKINNED_PLAYLIST(playlistwin_list)->prev_min = 0;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
418 UI_SKINNED_PLAYLIST(playlistwin_list)->prev_max = aud_playlist_get_length(playlist) - 1;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
419 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
420 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
421 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
422
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
423 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
424 playlistwin_select_none(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
425 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
426 aud_playlist_select_all(aud_playlist_get_active(), FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
427 if (UI_SKINNED_IS_PLAYLIST(playlistwin_list)) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
428 UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected = -1;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
429 UI_SKINNED_PLAYLIST(playlistwin_list)->prev_min = -1;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
430 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
431 playlistwin_update_list(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
432 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
433
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
434 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
435 playlistwin_select_search(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
436 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
437 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
438 GtkWidget *searchdlg_win, *searchdlg_table;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
439 GtkWidget *searchdlg_hbox, *searchdlg_logo, *searchdlg_helptext;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
440 GtkWidget *searchdlg_entry_title, *searchdlg_label_title;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
441 GtkWidget *searchdlg_entry_album, *searchdlg_label_album;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
442 GtkWidget *searchdlg_entry_file_name, *searchdlg_label_file_name;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
443 GtkWidget *searchdlg_entry_performer, *searchdlg_label_performer;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
444 GtkWidget *searchdlg_checkbt_clearprevsel;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
445 GtkWidget *searchdlg_checkbt_newplaylist;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
446 GtkWidget *searchdlg_checkbt_autoenqueue;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
447 gint result;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
448
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
449 /* create dialog */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
450 searchdlg_win = gtk_dialog_new_with_buttons(
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
451 _("Search entries in active playlist") , GTK_WINDOW(mainwin) ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
452 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
453 GTK_STOCK_CANCEL , GTK_RESPONSE_REJECT , GTK_STOCK_OK , GTK_RESPONSE_ACCEPT , NULL );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
454 gtk_window_set_position(GTK_WINDOW(searchdlg_win), GTK_WIN_POS_CENTER);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
455
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
456 /* help text and logo */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
457 searchdlg_hbox = gtk_hbox_new( FALSE , 4 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
458 searchdlg_logo = gtk_image_new_from_stock( GTK_STOCK_FIND , GTK_ICON_SIZE_DIALOG );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
459 searchdlg_helptext = gtk_label_new( _("Select entries in playlist by filling one or more "
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
460 "fields. Fields use regular expressions syntax, case-insensitive. If you don't know how "
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
461 "regular expressions work, simply insert a literal portion of what you're searching for.") );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
462 gtk_label_set_line_wrap( GTK_LABEL(searchdlg_helptext) , TRUE );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
463 gtk_box_pack_start( GTK_BOX(searchdlg_hbox) , searchdlg_logo , FALSE , FALSE , 0 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
464 gtk_box_pack_start( GTK_BOX(searchdlg_hbox) , searchdlg_helptext , FALSE , FALSE , 0 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
465
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
466 /* title */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
467 searchdlg_label_title = gtk_label_new( _("Title: ") );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
468 searchdlg_entry_title = gtk_entry_new();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
469 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_title) , 0 , 0.5 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
470 g_signal_connect( G_OBJECT(searchdlg_entry_title) , "key-press-event" ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
471 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
472
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
473 /* album */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
474 searchdlg_label_album= gtk_label_new( _("Album: ") );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
475 searchdlg_entry_album= gtk_entry_new();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
476 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_album) , 0 , 0.5 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
477 g_signal_connect( G_OBJECT(searchdlg_entry_album) , "key-press-event" ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
478 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
479
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
480 /* artist */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
481 searchdlg_label_performer = gtk_label_new( _("Artist: ") );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
482 searchdlg_entry_performer = gtk_entry_new();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
483 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_performer) , 0 , 0.5 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
484 g_signal_connect( G_OBJECT(searchdlg_entry_performer) , "key-press-event" ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
485 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
486
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
487 /* file name */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
488 searchdlg_label_file_name = gtk_label_new( _("Filename: ") );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
489 searchdlg_entry_file_name = gtk_entry_new();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
490 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_file_name) , 0 , 0.5 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
491 g_signal_connect( G_OBJECT(searchdlg_entry_file_name) , "key-press-event" ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
492 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
493
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
494 /* some options that control behaviour */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
495 searchdlg_checkbt_clearprevsel = gtk_check_button_new_with_label(
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
496 _("Clear previous selection before searching") );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
497 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_clearprevsel) , TRUE );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
498 searchdlg_checkbt_autoenqueue = gtk_check_button_new_with_label(
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
499 _("Automatically toggle queue for matching entries") );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
500 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_autoenqueue) , FALSE );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
501 searchdlg_checkbt_newplaylist = gtk_check_button_new_with_label(
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
502 _("Create a new playlist with matching entries") );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
503 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_newplaylist) , FALSE );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
504 g_signal_connect( G_OBJECT(searchdlg_checkbt_autoenqueue) , "clicked" ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
505 G_CALLBACK(playlistwin_select_search_cbt_cb) , searchdlg_checkbt_newplaylist );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
506 g_signal_connect( G_OBJECT(searchdlg_checkbt_newplaylist) , "clicked" ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
507 G_CALLBACK(playlistwin_select_search_cbt_cb) , searchdlg_checkbt_autoenqueue );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
508
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
509 /* place fields in searchdlg_table */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
510 searchdlg_table = gtk_table_new( 8 , 2 , FALSE );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
511 gtk_table_set_row_spacing( GTK_TABLE(searchdlg_table) , 0 , 8 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
512 gtk_table_set_row_spacing( GTK_TABLE(searchdlg_table) , 4 , 8 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
513 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_hbox ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
514 0 , 2 , 0 , 1 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
515 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_title ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
516 0 , 1 , 1 , 2 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
517 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_title ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
518 1 , 2 , 1 , 2 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
519 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_album,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
520 0 , 1 , 2 , 3 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
521 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_album,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
522 1 , 2 , 2 , 3 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
523 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_performer ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
524 0 , 1 , 3 , 4 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
525 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_performer ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
526 1 , 2 , 3 , 4 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
527 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_file_name ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
528 0 , 1 , 4 , 5 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
529 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_file_name ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
530 1 , 2 , 4 , 5 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
531 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_clearprevsel ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
532 0 , 2 , 5 , 6 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
533 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_autoenqueue ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
534 0 , 2 , 6 , 7 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
535 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_newplaylist ,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
536 0 , 2 , 7 , 8 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
537
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
538 gtk_container_set_border_width( GTK_CONTAINER(searchdlg_table) , 5 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
539 gtk_container_add( GTK_CONTAINER(GTK_DIALOG(searchdlg_win)->vbox) , searchdlg_table );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
540 gtk_widget_show_all( searchdlg_win );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
541 result = gtk_dialog_run( GTK_DIALOG(searchdlg_win) );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
542 switch(result)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
543 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
544 case GTK_RESPONSE_ACCEPT:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
545 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
546 gint matched_entries_num = 0;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
547 /* create a TitleInput tuple with user search data */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
548 Tuple *tuple = aud_tuple_new();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
549 gchar *searchdata = NULL;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
550
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
551 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_title) );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
552 AUDDBG("title=\"%s\"\n", searchdata);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
553 aud_tuple_associate_string(tuple, FIELD_TITLE, NULL, searchdata);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
554
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
555 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_album) );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
556 AUDDBG("album=\"%s\"\n", searchdata);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
557 aud_tuple_associate_string(tuple, FIELD_ALBUM, NULL, searchdata);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
558
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
559 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_performer) );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
560 AUDDBG("performer=\"%s\"\n", searchdata);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
561 aud_tuple_associate_string(tuple, FIELD_ARTIST, NULL, searchdata);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
562
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
563 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_file_name) );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
564 AUDDBG("filename=\"%s\"\n", searchdata);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
565 aud_tuple_associate_string(tuple, FIELD_FILE_NAME, NULL, searchdata);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
566
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
567 /* check if previous selection should be cleared before searching */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
568 if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_clearprevsel)) == TRUE )
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
569 playlistwin_select_none();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
570 /* now send this tuple to the real search function */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
571 matched_entries_num = aud_playlist_select_search( playlist , tuple , 0 );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
572 /* we do not need the tuple and its data anymore */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
573 mowgli_object_unref(tuple);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
574 playlistwin_update_list(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
575 /* check if a new playlist should be created after searching */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
576 if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_newplaylist)) == TRUE )
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
577 aud_playlist_new_from_selected();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
578 /* check if matched entries should be queued */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
579 else if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_autoenqueue)) == TRUE )
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
580 aud_playlist_queue(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
581 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
582 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
583 default:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
584 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
585 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
586 /* done here :) */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
587 gtk_widget_destroy( searchdlg_win );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
588 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
589
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
590 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
591 playlistwin_inverse_selection(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
592 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
593 aud_playlist_select_invert_all(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
594 if (UI_SKINNED_IS_PLAYLIST(playlistwin_list)) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
595 UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected = -1;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
596 UI_SKINNED_PLAYLIST(playlistwin_list)->prev_min = -1;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
597 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
598 playlistwin_update_list(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
599 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
600
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
601 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
602 playlistwin_resize(gint width, gint height)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
603 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
604 gint tx, ty;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
605 gint dx, dy;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
606
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
607 g_return_if_fail(width > 0 && height > 0);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
608
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
609 tx = (width - PLAYLISTWIN_MIN_WIDTH) / PLAYLISTWIN_WIDTH_SNAP;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
610 tx = (tx * PLAYLISTWIN_WIDTH_SNAP) + PLAYLISTWIN_MIN_WIDTH;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
611 if (tx < PLAYLISTWIN_MIN_WIDTH)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
612 tx = PLAYLISTWIN_MIN_WIDTH;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
613
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
614 if (!config.playlist_shaded)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
615 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
616 ty = (height - PLAYLISTWIN_MIN_HEIGHT) / PLAYLISTWIN_HEIGHT_SNAP;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
617 ty = (ty * PLAYLISTWIN_HEIGHT_SNAP) + PLAYLISTWIN_MIN_HEIGHT;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
618 if (ty < PLAYLISTWIN_MIN_HEIGHT)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
619 ty = PLAYLISTWIN_MIN_HEIGHT;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
620 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
621 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
622 ty = config.playlist_height;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
623
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
624 if (tx == config.playlist_width && ty == config.playlist_height)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
625 return;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
626
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
627 /* difference between previous size and new size */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
628 dx = tx - config.playlist_width;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
629 dy = ty - config.playlist_height;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
630
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
631 config.playlist_width = width = tx;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
632 config.playlist_height = height = ty;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
633
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
634 g_mutex_lock(resize_mutex);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
635 ui_skinned_playlist_resize_relative(playlistwin_list, dx, dy);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
636
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
637 ui_skinned_playlist_slider_move_relative(playlistwin_slider, dx);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
638 ui_skinned_playlist_slider_resize_relative(playlistwin_slider, dy);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
639
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
640 playlistwin_update_sinfo(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
641
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
642 ui_skinned_button_move_relative(playlistwin_shade, dx, 0);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
643 ui_skinned_button_move_relative(playlistwin_close, dx, 0);
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
644 ui_skinned_button_move_relative(playlistwin_shaded_shade, dx, 0);
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
645 ui_skinned_button_move_relative(playlistwin_shaded_close, dx, 0);
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
646 ui_skinned_textbox_move_relative(playlistwin_time_min, dx, dy);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
647 ui_skinned_textbox_move_relative(playlistwin_time_sec, dx, dy);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
648 ui_skinned_textbox_move_relative(playlistwin_info, dx, dy);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
649 ui_skinned_button_move_relative(playlistwin_srew, dx, dy);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
650 ui_skinned_button_move_relative(playlistwin_splay, dx, dy);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
651 ui_skinned_button_move_relative(playlistwin_spause, dx, dy);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
652 ui_skinned_button_move_relative(playlistwin_sstop, dx, dy);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
653 ui_skinned_button_move_relative(playlistwin_sfwd, dx, dy);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
654 ui_skinned_button_move_relative(playlistwin_seject, dx, dy);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
655 ui_skinned_button_move_relative(playlistwin_sscroll_up, dx, dy);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
656 ui_skinned_button_move_relative(playlistwin_sscroll_down, dx, dy);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
657
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
658 gtk_widget_set_size_request(playlistwin_sinfo, playlistwin_get_width() - 35,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
659 aud_active_skin->properties.textbox_bitmap_font_height);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
660 g_mutex_unlock(resize_mutex);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
661 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
662
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
663 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
664 playlistwin_motion(GtkWidget * widget,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
665 GdkEventMotion * event,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
666 gpointer callback_data)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
667 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
668 /*
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
669 * GDK2's resize is broken and doesn't really play nice, so we have
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
670 * to do all of this stuff by hand.
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
671 */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
672 if (playlistwin_resizing == TRUE)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
673 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
674 if (event->x + playlistwin_resize_x != playlistwin_get_width() ||
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
675 event->y + playlistwin_resize_y != playlistwin_get_height())
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
676 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
677 playlistwin_resize(event->x + playlistwin_resize_x,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
678 event->y + playlistwin_resize_y);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
679 gdk_window_resize(playlistwin->window,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
680 config.playlist_width, playlistwin_get_height());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
681 gdk_flush();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
682 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
683 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
684 else if (dock_is_moving(GTK_WINDOW(playlistwin)))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
685 dock_move_motion(GTK_WINDOW(playlistwin), event);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
686 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
687
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
688 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
689 playlistwin_show_filebrowser(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
690 {
2640
dd255ad225f3 use more hooks
Tomasz Mon <desowin@gmail.com>
parents: 2639
diff changeset
691 action_playlist_add_files();
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
692 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
693
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
694 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
695 playlistwin_fileinfo(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
696 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
697 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
698
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
699 /* Show the first selected file, or the current file if nothing is
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
700 * selected */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
701 GList *list = aud_playlist_get_selected(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
702 if (list) {
2639
6a881c49db96 make use of ui_fileinfo
Tomasz Mon <desowin@gmail.com>
parents: 2634
diff changeset
703 aud_playlist_fileinfo(playlist, GPOINTER_TO_INT(list->data));
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
704 g_list_free(list);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
705 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
706 else
2639
6a881c49db96 make use of ui_fileinfo
Tomasz Mon <desowin@gmail.com>
parents: 2634
diff changeset
707 aud_playlist_fileinfo_current(playlist);
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
708 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
709
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
710 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
711 show_playlist_save_error(GtkWindow *parent,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
712 const gchar *filename)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
713 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
714 GtkWidget *dialog;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
715
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
716 g_return_if_fail(GTK_IS_WINDOW(parent));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
717 g_return_if_fail(filename);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
718
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
719 dialog = gtk_message_dialog_new(GTK_WINDOW(parent),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
720 GTK_DIALOG_DESTROY_WITH_PARENT,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
721 GTK_MESSAGE_ERROR,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
722 GTK_BUTTONS_OK,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
723 _("Error writing playlist \"%s\": %s"),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
724 filename, strerror(errno));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
725
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
726 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); /* centering */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
727 gtk_dialog_run(GTK_DIALOG(dialog));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
728 gtk_widget_destroy(dialog);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
729 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
730
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
731 static gboolean
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
732 show_playlist_overwrite_prompt(GtkWindow * parent,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
733 const gchar * filename)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
734 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
735 GtkWidget *dialog;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
736 gint result;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
737
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
738 g_return_val_if_fail(GTK_IS_WINDOW(parent), FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
739 g_return_val_if_fail(filename != NULL, FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
740
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
741 dialog = gtk_message_dialog_new(GTK_WINDOW(parent),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
742 GTK_DIALOG_DESTROY_WITH_PARENT,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
743 GTK_MESSAGE_QUESTION,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
744 GTK_BUTTONS_YES_NO,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
745 _("%s already exist. Continue?"),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
746 filename);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
747
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
748 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); /* centering */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
749 result = gtk_dialog_run(GTK_DIALOG(dialog));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
750 gtk_widget_destroy(dialog);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
751
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
752 return (result == GTK_RESPONSE_YES);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
753 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
754
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
755 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
756 show_playlist_save_format_error(GtkWindow * parent,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
757 const gchar * filename)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
758 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
759 const gchar *markup =
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
760 N_("<b><big>Unable to save playlist.</big></b>\n\n"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
761 "Unknown file type for '%s'.\n");
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
762
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
763 GtkWidget *dialog;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
764
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
765 g_return_if_fail(GTK_IS_WINDOW(parent));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
766 g_return_if_fail(filename != NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
767
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
768 dialog =
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
769 gtk_message_dialog_new_with_markup(GTK_WINDOW(parent),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
770 GTK_DIALOG_DESTROY_WITH_PARENT,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
771 GTK_MESSAGE_ERROR,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
772 GTK_BUTTONS_OK,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
773 _(markup),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
774 filename);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
775
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
776 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); /* centering */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
777 gtk_dialog_run(GTK_DIALOG(dialog));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
778 gtk_widget_destroy(dialog);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
779 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
780
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
781 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
782 playlistwin_save_playlist(const gchar * filename)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
783 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
784 PlaylistContainer *plc;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
785 gchar *ext = strrchr(filename, '.') + 1;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
786
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
787 plc = aud_playlist_container_find(ext);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
788 if (plc == NULL) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
789 show_playlist_save_format_error(GTK_WINDOW(playlistwin), filename);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
790 return;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
791 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
792
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
793 aud_str_replace_in(&aud_cfg->playlist_path, g_path_get_dirname(filename));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
794
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
795 if (g_file_test(filename, G_FILE_TEST_IS_REGULAR))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
796 if (!show_playlist_overwrite_prompt(GTK_WINDOW(playlistwin), filename))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
797 return;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
798
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
799 if (!aud_playlist_save(aud_playlist_get_active(), filename))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
800 show_playlist_save_error(GTK_WINDOW(playlistwin), filename);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
801 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
802
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
803 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
804 playlistwin_load_playlist(const gchar * filename)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
805 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
806 const gchar *title;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
807 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
808
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
809 g_return_if_fail(filename != NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
810
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
811 aud_str_replace_in(&aud_cfg->playlist_path, g_path_get_dirname(filename));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
812
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
813 aud_playlist_clear(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
814 mainwin_clear_song_info();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
815
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
816 aud_playlist_load(playlist, filename);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
817 title = aud_playlist_get_current_name(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
818 if(!title || !title[0])
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
819 aud_playlist_set_current_name(playlist, filename);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
820 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
821
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
822 static gchar *
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
823 playlist_file_selection_load(const gchar * title,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
824 const gchar * default_filename)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
825 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
826 GtkWidget *dialog;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
827 gchar *filename;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
828
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
829 g_return_val_if_fail(title != NULL, NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
830
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
831 dialog = make_filebrowser(title, FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
832 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), aud_cfg->playlist_path);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
833 if (default_filename)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
834 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), default_filename);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
835 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); /* centering */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
836
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
837 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
838 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
839 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
840 filename = NULL;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
841
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
842 gtk_widget_destroy(dialog);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
843 return filename;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
844 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
845
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
846 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
847 on_static_toggle(GtkToggleButton *button, gpointer data)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
848 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
849 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
850
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
851 playlist->attribute =
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
852 gtk_toggle_button_get_active(button) ?
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
853 playlist->attribute | PLAYLIST_STATIC :
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
854 playlist->attribute & ~PLAYLIST_STATIC;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
855 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
856
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
857 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
858 on_relative_toggle(GtkToggleButton *button, gpointer data)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
859 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
860 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
861
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
862 playlist->attribute =
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
863 gtk_toggle_button_get_active(button) ?
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
864 playlist->attribute | PLAYLIST_USE_RELATIVE :
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
865 playlist->attribute & ~PLAYLIST_USE_RELATIVE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
866 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
867
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
868 static gchar *
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
869 playlist_file_selection_save(const gchar * title,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
870 const gchar * default_filename)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
871 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
872 GtkWidget *dialog;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
873 gchar *filename;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
874 GtkWidget *hbox;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
875 GtkWidget *toggle, *toggle2;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
876
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
877 g_return_val_if_fail(title != NULL, NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
878
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
879 dialog = make_filebrowser(title, TRUE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
880 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), aud_cfg->playlist_path);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
881 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), default_filename);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
882
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
883 hbox = gtk_hbox_new(FALSE, 5);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
884
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
885 /* static playlist */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
886 toggle = gtk_check_button_new_with_label(_("Save as Static Playlist"));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
887 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
888 (aud_playlist_get_active()->attribute & PLAYLIST_STATIC) ? TRUE : FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
889 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(on_static_toggle), dialog);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
890 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
891
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
892 /* use relative path */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
893 toggle2 = gtk_check_button_new_with_label(_("Use Relative Path"));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
894 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle2),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
895 (aud_playlist_get_active()->attribute & PLAYLIST_USE_RELATIVE) ? TRUE : FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
896 g_signal_connect(G_OBJECT(toggle2), "toggled", G_CALLBACK(on_relative_toggle), dialog);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
897 gtk_box_pack_start(GTK_BOX(hbox), toggle2, FALSE, FALSE, 0);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
898
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
899 gtk_widget_show_all(hbox);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
900 gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(dialog), hbox);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
901
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
902 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
903 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
904 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
905 filename = NULL;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
906
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
907 gtk_widget_destroy(dialog);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
908 return filename;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
909 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
910
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
911 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
912 playlistwin_select_playlist_to_load(const gchar * default_filename)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
913 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
914 gchar *filename =
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
915 playlist_file_selection_load(_("Load Playlist"), default_filename);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
916
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
917 if (filename) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
918 playlistwin_load_playlist(filename);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
919 g_free(filename);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
920 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
921 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
922
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
923 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
924 playlistwin_select_playlist_to_save(const gchar * default_filename)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
925 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
926 gchar *dot = NULL, *basename = NULL;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
927 gchar *filename =
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
928 playlist_file_selection_save(_("Save Playlist"), default_filename);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
929
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
930 if (filename) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
931 /* Default extension */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
932 basename = g_path_get_basename(filename);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
933 dot = strrchr(basename, '.');
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
934 if( dot == NULL || dot == basename) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
935 gchar *oldname = filename;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
936 #ifdef HAVE_XSPF_PLAYLIST
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
937 filename = g_strconcat(oldname, ".xspf", NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
938 #else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
939 filename = g_strconcat(oldname, ".m3u", NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
940 #endif
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
941 g_free(oldname);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
942 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
943 g_free(basename);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
944
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
945 playlistwin_save_playlist(filename);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
946 g_free(filename);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
947 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
948 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
949
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
950 #define REGION_L(x1,x2,y1,y2) \
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
951 (event->x >= (x1) && event->x < (x2) && \
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
952 event->y >= config.playlist_height - (y1) && \
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
953 event->y < config.playlist_height - (y2))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
954
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
955 #define REGION_R(x1,x2,y1,y2) \
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
956 (event->x >= playlistwin_get_width() - (x1) && \
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
957 event->x < playlistwin_get_width() - (x2) && \
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
958 event->y >= config.playlist_height - (y1) && \
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
959 event->y < config.playlist_height - (y2))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
960
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
961 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
962 playlistwin_scrolled(GtkWidget * widget,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
963 GdkEventScroll * event,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
964 gpointer callback_data)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
965 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
966 if (event->direction == GDK_SCROLL_DOWN)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
967 playlistwin_scroll(config.scroll_pl_by);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
968
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
969 if (event->direction == GDK_SCROLL_UP)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
970 playlistwin_scroll(-config.scroll_pl_by);
2967
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
971 #if CONDSCAN
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
972 GCond *cond_scan = aud_get_cond_scan();
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
973 AUDDBG("cond_scan = %p\n", cond_scan);
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
974 if(cond_scan)
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
975 g_cond_signal(cond_scan);
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
976 #endif
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
977 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
978
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
979 static gboolean
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
980 playlistwin_press(GtkWidget * widget,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
981 GdkEventButton * event,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
982 gpointer callback_data)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
983 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
984 gint xpos, ypos;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
985 GtkRequisition req;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
986
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
987 gtk_window_get_position(GTK_WINDOW(playlistwin), &xpos, &ypos);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
988
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
989 if (event->button == 1 && !config.show_wm_decorations &&
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
990 ((!config.playlist_shaded &&
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
991 event->x > playlistwin_get_width() - 20 &&
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
992 event->y > config.playlist_height - 20) ||
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
993 (config.playlist_shaded &&
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
994 event->x >= playlistwin_get_width() - 31 &&
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
995 event->x < playlistwin_get_width() - 22))) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
996
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
997 if (event->type != GDK_2BUTTON_PRESS &&
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
998 event->type != GDK_3BUTTON_PRESS) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
999 playlistwin_resizing = TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1000 playlistwin_resize_x = config.playlist_width - event->x;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1001 playlistwin_resize_y = config.playlist_height - event->y;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1002 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1003 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1004 else if (event->button == 1 && REGION_L(12, 37, 29, 11)) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1005 /* ADD button menu */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1006 gtk_widget_size_request(playlistwin_pladd_menu, &req);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1007 ui_manager_popup_menu_show(GTK_MENU(playlistwin_pladd_menu),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1008 xpos + 12,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1009 (ypos + playlistwin_get_height()) - 8 - req.height,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1010 event->button,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1011 event->time);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1012 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1013 else if (event->button == 1 && REGION_L(41, 66, 29, 11)) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1014 /* SUB button menu */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1015 gtk_widget_size_request(playlistwin_pldel_menu, &req);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1016 ui_manager_popup_menu_show(GTK_MENU(playlistwin_pldel_menu),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1017 xpos + 40,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1018 (ypos + playlistwin_get_height()) - 8 - req.height,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1019 event->button,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1020 event->time);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1021 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1022 else if (event->button == 1 && REGION_L(70, 95, 29, 11)) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1023 /* SEL button menu */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1024 gtk_widget_size_request(playlistwin_plsel_menu, &req);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1025 ui_manager_popup_menu_show(GTK_MENU(playlistwin_plsel_menu),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1026 xpos + 68,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1027 (ypos + playlistwin_get_height()) - 8 - req.height,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1028 event->button,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1029 event->time);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1030 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1031 else if (event->button == 1 && REGION_L(99, 124, 29, 11)) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1032 /* MISC button menu */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1033 gtk_widget_size_request(playlistwin_plsort_menu, &req);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1034 ui_manager_popup_menu_show(GTK_MENU(playlistwin_plsort_menu),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1035 xpos + 100,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1036 (ypos + playlistwin_get_height()) - 8 - req.height,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1037 event->button,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1038 event->time);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1039 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1040 else if (event->button == 1 && REGION_R(46, 23, 29, 11)) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1041 /* LIST button menu */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1042 gtk_widget_size_request(playlistwin_pllist_menu, &req);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1043 ui_manager_popup_menu_show(GTK_MENU(playlistwin_pllist_menu),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1044 xpos + playlistwin_get_width() - req.width - 12,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1045 (ypos + playlistwin_get_height()) - 8 - req.height,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1046 event->button,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1047 event->time);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1048 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1049 else if (event->button == 1 && event->type == GDK_BUTTON_PRESS &&
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1050 (config.easy_move || event->y < 14))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1051 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1052 return FALSE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1053 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1054 else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1055 && event->y < 14) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1056 /* double click on title bar */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1057 playlistwin_shade_toggle();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1058 if (dock_is_moving(GTK_WINDOW(playlistwin)))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1059 dock_move_release(GTK_WINDOW(playlistwin));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1060 return TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1061 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1062 else if (event->button == 3) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1063 /*
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1064 * Pop up the main menu a few pixels down to avoid
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1065 * anything to be selected initially.
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1066 */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1067 ui_manager_popup_menu_show(GTK_MENU(mainwin_general_menu), event->x_root,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1068 event->y_root + 2, 3, event->time);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1069 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1070
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1071 return TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1072 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1073
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1074 static gboolean
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1075 playlistwin_delete(GtkWidget * w, gpointer data)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1076 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1077 playlistwin_hide();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1078 return TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1079 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1080
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1081 static gboolean
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1082 playlistwin_keypress_up_down_handler(UiSkinnedPlaylist * pl,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1083 gboolean up, guint state)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1084 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1085 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1086 if ((!(pl->prev_selected || pl->first) && up) ||
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1087 ((pl->prev_selected >= aud_playlist_get_length(playlist) - 1) && !up))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1088 return FALSE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1089
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1090 if ((state & GDK_MOD1_MASK) && (state & GDK_SHIFT_MASK))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1091 return FALSE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1092 if (!(state & GDK_MOD1_MASK))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1093 aud_playlist_select_all(playlist, FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1094
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1095 if (pl->prev_selected == -1 ||
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1096 (!playlistwin_item_visible(pl->prev_selected) &&
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1097 !(state & GDK_SHIFT_MASK && pl->prev_min != -1))) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1098 pl->prev_selected = pl->first;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1099 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1100 else if (state & GDK_SHIFT_MASK) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1101 if (pl->prev_min == -1) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1102 pl->prev_max = pl->prev_selected;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1103 pl->prev_min = pl->prev_selected;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1104 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1105 pl->prev_max += (up ? -1 : 1);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1106 pl->prev_max =
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1107 CLAMP(pl->prev_max, 0, aud_playlist_get_length(playlist) - 1);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1108
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1109 pl->first = MIN(pl->first, pl->prev_max);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1110 pl->first = MAX(pl->first, pl->prev_max -
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1111 pl->num_visible + 1);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1112 aud_playlist_select_range(playlist, pl->prev_min, pl->prev_max, TRUE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1113 return TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1114 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1115 else if (state & GDK_MOD1_MASK) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1116 if (up)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1117 ui_skinned_playlist_move_up(pl);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1118 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1119 ui_skinned_playlist_move_down(pl);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1120 if (pl->prev_min < pl->first)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1121 pl->first = pl->prev_min;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1122 else if (pl->prev_max >= (pl->first + pl->num_visible))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1123 pl->first = pl->prev_max - pl->num_visible + 1;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1124 return TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1125 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1126 else if (up)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1127 pl->prev_selected--;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1128 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1129 pl->prev_selected++;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1130
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1131 pl->prev_selected =
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1132 CLAMP(pl->prev_selected, 0, aud_playlist_get_length(playlist) - 1);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1133
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1134 if (pl->prev_selected < pl->first)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1135 pl->first--;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1136 else if (pl->prev_selected >= (pl->first + pl->num_visible))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1137 pl->first++;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1138
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1139 aud_playlist_select_range(playlist, pl->prev_selected, pl->prev_selected, TRUE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1140 pl->prev_min = -1;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1141
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1142 return TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1143 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1144
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1145 /* FIXME: Handle the keys through menu */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1146
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1147 static gboolean
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1148 playlistwin_keypress(GtkWidget * w, GdkEventKey * event, gpointer data)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1149 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1150 g_return_val_if_fail(UI_SKINNED_IS_PLAYLIST(playlistwin_list), FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1151 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1152
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1153 guint keyval;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1154 gboolean refresh = FALSE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1155 guint cur_pos;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1156
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1157 if (config.playlist_shaded)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1158 return FALSE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1159
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1160 switch (keyval = event->keyval) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1161 case GDK_KP_Up:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1162 case GDK_KP_Down:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1163 case GDK_Up:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1164 case GDK_Down:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1165 refresh = playlistwin_keypress_up_down_handler(UI_SKINNED_PLAYLIST(playlistwin_list),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1166 keyval == GDK_Up
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1167 || keyval == GDK_KP_Up,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1168 event->state);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1169 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1170 case GDK_Page_Up:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1171 playlistwin_scroll(-UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1172 refresh = TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1173 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1174 case GDK_Page_Down:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1175 playlistwin_scroll(UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1176 refresh = TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1177 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1178 case GDK_Home:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1179 UI_SKINNED_PLAYLIST(playlistwin_list)->first = 0;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1180 refresh = TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1181 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1182 case GDK_End:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1183 UI_SKINNED_PLAYLIST(playlistwin_list)->first =
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1184 aud_playlist_get_length(playlist) - UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1185 refresh = TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1186 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1187 case GDK_Return:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1188 if (UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected > -1
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1189 && playlistwin_item_visible(UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected)) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1190 aud_playlist_set_position(playlist, UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1191 if (!audacious_drct_get_playing())
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1192 audacious_drct_initiate();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1193 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1194 refresh = TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1195 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1196 case GDK_3:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1197 if (event->state & GDK_CONTROL_MASK)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1198 playlistwin_fileinfo();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1199 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1200 case GDK_Delete:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1201 if (event->state & GDK_CONTROL_MASK)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1202 aud_playlist_delete(playlist, TRUE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1203 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1204 aud_playlist_delete(playlist, FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1205 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1206 case GDK_Insert:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1207 if (event->state & GDK_MOD1_MASK)
2793
mf0102 <0102@gmx.at>
parents: 2719
diff changeset
1208 action_playlist_add_url();
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1209 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1210 playlistwin_show_filebrowser();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1211 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1212 case GDK_Left:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1213 case GDK_KP_Left:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1214 case GDK_KP_7:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1215 if (aud_playlist_get_current_length(playlist) != -1)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1216 audacious_drct_seek(CLAMP
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1217 (audacious_drct_get_time() - 5000, 0,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1218 aud_playlist_get_current_length(playlist)));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1219 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1220 case GDK_Right:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1221 case GDK_KP_Right:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1222 case GDK_KP_9:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1223 if (aud_playlist_get_current_length(playlist) != -1)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1224 audacious_drct_seek(CLAMP
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1225 (audacious_drct_get_time() + 5000, 0,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1226 aud_playlist_get_current_length(playlist)));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1227 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1228 case GDK_KP_4:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1229 aud_playlist_prev(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1230 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1231 case GDK_KP_6:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1232 aud_playlist_next(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1233 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1234
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1235 case GDK_Escape:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1236 mainwin_minimize_cb();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1237 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1238 case GDK_Tab:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1239 if (event->state & GDK_CONTROL_MASK) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1240 if (config.player_visible)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1241 gtk_window_present(GTK_WINDOW(mainwin));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1242 else if (config.equalizer_visible)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1243 gtk_window_present(GTK_WINDOW(equalizerwin));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1244 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1245 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1246 case GDK_space:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1247 cur_pos=aud_playlist_get_position(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1248 UI_SKINNED_PLAYLIST(playlistwin_list)->first =
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1249 cur_pos - (UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible >> 1);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1250 refresh = TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1251 break;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1252 default:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1253 return FALSE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1254 }
2967
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
1255 #if CONDSCAN
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1256 if (refresh) {
2967
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
1257 GCond *cond_scan = aud_get_cond_scan();
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
1258 AUDDBG("cond_scan = %p\n", cond_scan);
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
1259 if(cond_scan)
165ccb8de035 audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2844
diff changeset
1260 g_cond_signal(cond_scan);
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1261 playlistwin_update_list(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1262 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1263 #endif
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1264 return TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1265 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1266
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1267 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1268 playlistwin_hide_timer(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1269 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1270 ui_skinned_textbox_set_text(playlistwin_time_min, " ");
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1271 ui_skinned_textbox_set_text(playlistwin_time_sec, " ");
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1272 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1273
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1274 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1275 playlistwin_set_time(gint time, gint length, TimerMode mode)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1276 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1277 gchar *text, sign;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1278
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1279 if (mode == TIMER_REMAINING && length != -1) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1280 time = length - time;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1281 sign = '-';
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1282 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1283 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1284 sign = ' ';
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1285
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1286 time /= 1000;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1287
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1288 if (time < 0)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1289 time = 0;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1290 if (time > 99 * 60)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1291 time /= 60;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1292
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1293 text = g_strdup_printf("%c%-2.2d", sign, time / 60);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1294 ui_skinned_textbox_set_text(playlistwin_time_min, text);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1295 g_free(text);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1296
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1297 text = g_strdup_printf("%-2.2d", time % 60);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1298 ui_skinned_textbox_set_text(playlistwin_time_sec, text);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1299 g_free(text);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1300 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1301
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1302 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1303 playlistwin_drag_motion(GtkWidget * widget,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1304 GdkDragContext * context,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1305 gint x, gint y,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1306 GtkSelectionData * selection_data,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1307 guint info, guint time, gpointer user_data)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1308 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1309 if (UI_SKINNED_IS_PLAYLIST(playlistwin_list)) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1310 UI_SKINNED_PLAYLIST(playlistwin_list)->drag_motion = TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1311 UI_SKINNED_PLAYLIST(playlistwin_list)->drag_motion_x = x;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1312 UI_SKINNED_PLAYLIST(playlistwin_list)->drag_motion_y = y;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1313 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1314 playlistwin_update_list(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1315 playlistwin_hint_flag = TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1316 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1317
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1318 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1319 playlistwin_drag_end(GtkWidget * widget,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1320 GdkDragContext * context, gpointer user_data)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1321 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1322 if (UI_SKINNED_IS_PLAYLIST(playlistwin_list))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1323 UI_SKINNED_PLAYLIST(playlistwin_list)->drag_motion = FALSE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1324 playlistwin_hint_flag = FALSE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1325 playlistwin_update_list(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1326 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1327
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1328 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1329 playlistwin_drag_data_received(GtkWidget * widget,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1330 GdkDragContext * context,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1331 gint x, gint y,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1332 GtkSelectionData *
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1333 selection_data, guint info,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1334 guint time, gpointer user_data)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1335 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1336 gint pos;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1337 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1338
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1339 g_return_if_fail(selection_data);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1340
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1341 if (!selection_data->data) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1342 g_message("Received no DND data!");
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1343 return;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1344 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1345 if (UI_SKINNED_IS_PLAYLIST(playlistwin_list) &&
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1346 (x < playlistwin_get_width() - 20 || y < config.playlist_height - 38)) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1347 pos = y / UI_SKINNED_PLAYLIST(playlistwin_list)->fheight + UI_SKINNED_PLAYLIST(playlistwin_list)->first;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1348
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1349 pos = MIN(pos, aud_playlist_get_length(playlist));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1350 aud_playlist_ins_url(playlist, (gchar *) selection_data->data, pos);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1351 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1352 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1353 aud_playlist_add_url(playlist, (gchar *) selection_data->data);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1354 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1355
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1356 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1357 local_playlist_prev(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1358 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1359 aud_playlist_prev(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1360 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1361
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1362 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1363 local_playlist_next(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1364 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1365 aud_playlist_next(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1366 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1367
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1368 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1369 playlistwin_create_widgets(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1370 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1371 /* This function creates the custom widgets used by the playlist editor */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1372
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1373 /* text box for displaying song title in shaded mode */
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1374 playlistwin_sinfo = ui_skinned_textbox_new(SKINNED_WINDOW(playlistwin)->shaded,
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1375 4, 4, playlistwin_get_width() - 35, TRUE, SKIN_TEXT);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1376
2642
c2603047a1a3 add few more config items
Tomasz Mon <desowin@gmail.com>
parents: 2640
diff changeset
1377 playlistwin_set_sinfo_font(config.playlist_font);
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1378
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1379
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1380 playlistwin_shaded_shade = ui_skinned_button_new();
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1381 ui_skinned_push_button_setup(playlistwin_shaded_shade, SKINNED_WINDOW(playlistwin)->shaded,
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1382 playlistwin_get_width() - 21, 3,
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1383 9, 9, 128, 45, 150, 42, SKIN_PLEDIT);
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1384 g_signal_connect(playlistwin_shaded_shade, "clicked", playlistwin_shade_toggle, NULL );
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1385
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1386 playlistwin_shaded_close = ui_skinned_button_new();
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1387 ui_skinned_push_button_setup(playlistwin_shaded_close, SKINNED_WINDOW(playlistwin)->shaded,
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1388 playlistwin_get_width() - 11, 3, 9, 9, 138, 45, 52, 42, SKIN_PLEDIT);
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1389 g_signal_connect(playlistwin_shaded_close, "clicked", playlistwin_hide, NULL );
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1390
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1391 playlistwin_shade = ui_skinned_button_new();
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1392 ui_skinned_push_button_setup(playlistwin_shade, SKINNED_WINDOW(playlistwin)->normal,
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1393 playlistwin_get_width() - 21, 3,
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1394 9, 9, 157, 3, 62, 42, SKIN_PLEDIT);
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1395 g_signal_connect(playlistwin_shade, "clicked", playlistwin_shade_toggle, NULL );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1396
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1397 playlistwin_close = ui_skinned_button_new();
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1398 ui_skinned_push_button_setup(playlistwin_close, SKINNED_WINDOW(playlistwin)->normal,
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1399 playlistwin_get_width() - 11, 3, 9, 9, 167, 3, 52, 42, SKIN_PLEDIT);
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1400 g_signal_connect(playlistwin_close, "clicked", playlistwin_hide, NULL );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1401
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1402 /* playlist list box */
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1403 playlistwin_list = ui_skinned_playlist_new(SKINNED_WINDOW(playlistwin)->normal, 12, 20,
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1404 playlistwin_get_width() - 31,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1405 config.playlist_height - 58);
2642
c2603047a1a3 add few more config items
Tomasz Mon <desowin@gmail.com>
parents: 2640
diff changeset
1406 ui_skinned_playlist_set_font(config.playlist_font);
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1407
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1408 /* playlist list box slider */
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1409 playlistwin_slider = ui_skinned_playlist_slider_new(SKINNED_WINDOW(playlistwin)->normal, playlistwin_get_width() - 15,
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1410 20, config.playlist_height - 58);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1411
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1412 /* track time (minute) */
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1413 playlistwin_time_min = ui_skinned_textbox_new(SKINNED_WINDOW(playlistwin)->normal,
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1414 playlistwin_get_width() - 82,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1415 config.playlist_height - 15, 15, FALSE, SKIN_TEXT);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1416 g_signal_connect(playlistwin_time_min, "button-press-event", G_CALLBACK(change_timer_mode_cb), NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1417
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1418 /* track time (second) */
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1419 playlistwin_time_sec = ui_skinned_textbox_new(SKINNED_WINDOW(playlistwin)->normal,
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1420 playlistwin_get_width() - 64,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1421 config.playlist_height - 15, 10, FALSE, SKIN_TEXT);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1422 g_signal_connect(playlistwin_time_sec, "button-press-event", G_CALLBACK(change_timer_mode_cb), NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1423
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1424 /* playlist information (current track length / total track length) */
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1425 playlistwin_info = ui_skinned_textbox_new(SKINNED_WINDOW(playlistwin)->normal,
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1426 playlistwin_get_width() - 143,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1427 config.playlist_height - 28, 90, FALSE, SKIN_TEXT);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1428
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1429 /* mini play control buttons at right bottom corner */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1430
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1431 /* rewind button */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1432 playlistwin_srew = ui_skinned_button_new();
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1433 ui_skinned_small_button_setup(playlistwin_srew, SKINNED_WINDOW(playlistwin)->normal,
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1434 playlistwin_get_width() - 144,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1435 config.playlist_height - 16, 8, 7);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1436 g_signal_connect(playlistwin_srew, "clicked", local_playlist_prev, NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1437
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1438 /* play button */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1439 playlistwin_splay = ui_skinned_button_new();
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1440 ui_skinned_small_button_setup(playlistwin_splay, SKINNED_WINDOW(playlistwin)->normal,
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1441 playlistwin_get_width() - 138,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1442 config.playlist_height - 16, 10, 7);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1443 g_signal_connect(playlistwin_splay, "clicked", mainwin_play_pushed, NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1444
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1445 /* pause button */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1446 playlistwin_spause = ui_skinned_button_new();
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1447 ui_skinned_small_button_setup(playlistwin_spause, SKINNED_WINDOW(playlistwin)->normal,
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1448 playlistwin_get_width() - 128,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1449 config.playlist_height - 16, 10, 7);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1450 g_signal_connect(playlistwin_spause, "clicked", audacious_drct_pause, NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1451
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1452 /* stop button */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1453 playlistwin_sstop = ui_skinned_button_new();
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1454 ui_skinned_small_button_setup(playlistwin_sstop, SKINNED_WINDOW(playlistwin)->normal,
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1455 playlistwin_get_width() - 118,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1456 config.playlist_height - 16, 9, 7);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1457 g_signal_connect(playlistwin_sstop, "clicked", mainwin_stop_pushed, NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1458
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1459 /* forward button */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1460 playlistwin_sfwd = ui_skinned_button_new();
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1461 ui_skinned_small_button_setup(playlistwin_sfwd, SKINNED_WINDOW(playlistwin)->normal,
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1462 playlistwin_get_width() - 109,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1463 config.playlist_height - 16, 8, 7);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1464 g_signal_connect(playlistwin_sfwd, "clicked", local_playlist_next, NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1465
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1466 /* eject button */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1467 playlistwin_seject = ui_skinned_button_new();
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1468 ui_skinned_small_button_setup(playlistwin_seject, SKINNED_WINDOW(playlistwin)->normal,
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1469 playlistwin_get_width() - 100,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1470 config.playlist_height - 16, 9, 7);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1471 g_signal_connect(playlistwin_seject, "clicked", mainwin_eject_pushed, NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1472
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1473 playlistwin_sscroll_up = ui_skinned_button_new();
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1474 ui_skinned_small_button_setup(playlistwin_sscroll_up, SKINNED_WINDOW(playlistwin)->normal,
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1475 playlistwin_get_width() - 14,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1476 config.playlist_height - 35, 8, 5);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1477 g_signal_connect(playlistwin_sscroll_up, "clicked", playlistwin_scroll_up_pushed, NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1478
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1479 playlistwin_sscroll_down = ui_skinned_button_new();
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2698
diff changeset
1480 ui_skinned_small_button_setup(playlistwin_sscroll_down, SKINNED_WINDOW(playlistwin)->normal,
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1481 playlistwin_get_width() - 14,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1482 config.playlist_height - 30, 8, 5);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1483 g_signal_connect(playlistwin_sscroll_down, "clicked", playlistwin_scroll_down_pushed, NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1484
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1485 ui_playlist_evlistener_init();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1486 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1487
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1488 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1489 selection_received(GtkWidget * widget,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1490 GtkSelectionData * selection_data, gpointer data)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1491 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1492 if (selection_data->type == GDK_SELECTION_TYPE_STRING &&
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1493 selection_data->length > 0)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1494 aud_playlist_add_url(aud_playlist_get_active(), (gchar *) selection_data->data);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1495 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1496
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1497 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1498 playlistwin_create_window(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1499 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1500 GdkPixbuf *icon;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1501
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1502 playlistwin = ui_skinned_window_new("playlist");
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1503 gtk_window_set_title(GTK_WINDOW(playlistwin), _("Audacious Playlist Editor"));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1504 gtk_window_set_role(GTK_WINDOW(playlistwin), "playlist");
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1505 gtk_window_set_default_size(GTK_WINDOW(playlistwin),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1506 playlistwin_get_width(),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1507 playlistwin_get_height());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1508 gtk_window_set_resizable(GTK_WINDOW(playlistwin), TRUE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1509 playlistwin_set_geometry_hints(config.playlist_shaded);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1510
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1511 gtk_window_set_transient_for(GTK_WINDOW(playlistwin),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1512 GTK_WINDOW(mainwin));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1513 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(playlistwin), TRUE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1514
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1515 icon = gdk_pixbuf_new_from_xpm_data((const gchar **) audacious_playlist_icon);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1516 gtk_window_set_icon(GTK_WINDOW(playlistwin), icon);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1517 g_object_unref(icon);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1518
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1519 if (config.playlist_x != -1 && config.save_window_position)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1520 gtk_window_move(GTK_WINDOW(playlistwin),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1521 config.playlist_x, config.playlist_y);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1522
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1523 gtk_widget_add_events(playlistwin, GDK_POINTER_MOTION_MASK |
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1524 GDK_FOCUS_CHANGE_MASK | GDK_BUTTON_MOTION_MASK |
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1525 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1526 GDK_SCROLL_MASK | GDK_VISIBILITY_NOTIFY_MASK);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1527 gtk_widget_realize(playlistwin);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1528
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1529 g_signal_connect(playlistwin, "delete_event",
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1530 G_CALLBACK(playlistwin_delete), NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1531 g_signal_connect(playlistwin, "button_press_event",
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1532 G_CALLBACK(playlistwin_press), NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1533 g_signal_connect(playlistwin, "button_release_event",
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1534 G_CALLBACK(playlistwin_release), NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1535 g_signal_connect(playlistwin, "scroll_event",
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1536 G_CALLBACK(playlistwin_scrolled), NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1537 g_signal_connect(playlistwin, "motion_notify_event",
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1538 G_CALLBACK(playlistwin_motion), NULL);
2629
2ce9e17525dc make dnd working in playlistwin
Tomasz Mon <desowin@gmail.com>
parents: 2621
diff changeset
1539
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1540 aud_drag_dest_set(playlistwin);
2629
2ce9e17525dc make dnd working in playlistwin
Tomasz Mon <desowin@gmail.com>
parents: 2621
diff changeset
1541
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1542 /* DnD stuff */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1543 g_signal_connect(playlistwin, "drag-leave",
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1544 G_CALLBACK(playlistwin_drag_end), NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1545 g_signal_connect(playlistwin, "drag-data-delete",
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1546 G_CALLBACK(playlistwin_drag_end), NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1547 g_signal_connect(playlistwin, "drag-end",
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1548 G_CALLBACK(playlistwin_drag_end), NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1549 g_signal_connect(playlistwin, "drag-drop",
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1550 G_CALLBACK(playlistwin_drag_end), NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1551 g_signal_connect(playlistwin, "drag-data-received",
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1552 G_CALLBACK(playlistwin_drag_data_received), NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1553 g_signal_connect(playlistwin, "drag-motion",
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1554 G_CALLBACK(playlistwin_drag_motion), NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1555
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1556 g_signal_connect(playlistwin, "key_press_event",
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1557 G_CALLBACK(playlistwin_keypress), NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1558 g_signal_connect(playlistwin, "selection_received",
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1559 G_CALLBACK(selection_received), NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1560 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1561
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1562 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1563 playlistwin_create(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1564 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1565 resize_mutex = g_mutex_new();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1566 playlistwin_create_window();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1567
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1568 playlistwin_create_widgets();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1569 playlistwin_update_info(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1570
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1571 gtk_window_add_accel_group(GTK_WINDOW(playlistwin), ui_manager_get_accel_group());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1572 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1573
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1574
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1575 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1576 playlistwin_show(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1577 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1578 gtk_window_move(GTK_WINDOW(playlistwin), config.playlist_x, config.playlist_y);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1579 GtkAction *action = gtk_action_group_get_action(
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1580 toggleaction_group_others , "show playlist editor" );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1581 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , TRUE );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1582
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1583 config.playlist_visible = TRUE;
2668
a1431a900f28 introduce ui_skinned_button_set_inside
Tomasz Mon <desowin@gmail.com>
parents: 2658
diff changeset
1584 ui_skinned_button_set_inside(mainwin_pl, TRUE);
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1585
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1586 playlistwin_set_toprow(0);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1587 aud_playlist_check_pos_current(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1588
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1589 gtk_widget_show_all(playlistwin);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1590 if (!config.playlist_shaded)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1591 gtk_widget_hide(playlistwin_sinfo);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1592 gtk_window_present(GTK_WINDOW(playlistwin));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1593 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1594
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1595 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1596 playlistwin_hide(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1597 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1598 GtkAction *action = gtk_action_group_get_action(
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1599 toggleaction_group_others , "show playlist editor" );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1600 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , FALSE );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1601
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1602 gtk_widget_hide(playlistwin);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1603 config.playlist_visible = FALSE;
2668
a1431a900f28 introduce ui_skinned_button_set_inside
Tomasz Mon <desowin@gmail.com>
parents: 2658
diff changeset
1604 ui_skinned_button_set_inside(mainwin_pl, FALSE);
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1605
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1606 if ( config.player_visible )
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1607 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1608 gtk_window_present(GTK_WINDOW(mainwin));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1609 gtk_widget_grab_focus(mainwin);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1610 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1611 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1612
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1613 void action_playlist_track_info(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1614 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1615 playlistwin_fileinfo();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1616 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1617
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1618 void action_queue_toggle(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1619 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1620 aud_playlist_queue(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1621 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1622
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1623 void action_playlist_sort_by_playlist_entry(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1624 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1625 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1626
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1627 aud_playlist_sort(playlist, PLAYLIST_SORT_PLAYLIST);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1628 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1629 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1630
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1631 void action_playlist_sort_by_track_number(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1632 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1633 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1634
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1635 aud_playlist_sort(playlist, PLAYLIST_SORT_TRACK);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1636 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1637 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1638
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1639 void action_playlist_sort_by_title(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1640 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1641 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1642
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1643 aud_playlist_sort(playlist, PLAYLIST_SORT_TITLE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1644 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1645 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1646
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1647 void action_playlist_sort_by_artist(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1648 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1649 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1650
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1651 aud_playlist_sort(playlist, PLAYLIST_SORT_ARTIST);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1652 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1653 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1654
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1655 void action_playlist_sort_by_full_path(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1656 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1657 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1658
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1659 aud_playlist_sort(playlist, PLAYLIST_SORT_PATH);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1660 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1661 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1662
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1663 void action_playlist_sort_by_date(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1664 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1665 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1666
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1667 aud_playlist_sort(playlist, PLAYLIST_SORT_DATE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1668 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1669 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1670
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1671 void action_playlist_sort_by_filename(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1672 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1673 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1674
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1675 aud_playlist_sort(playlist, PLAYLIST_SORT_FILENAME);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1676 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1677 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1678
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1679 void action_playlist_sort_selected_by_playlist_entry(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1680 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1681 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1682
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1683 aud_playlist_sort_selected(playlist, PLAYLIST_SORT_PLAYLIST);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1684 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1685 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1686
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1687 void action_playlist_sort_selected_by_track_number(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1688 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1689 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1690
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1691 aud_playlist_sort_selected(playlist, PLAYLIST_SORT_TRACK);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1692 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1693 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1694
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1695 void action_playlist_sort_selected_by_title(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1696 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1697 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1698
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1699 aud_playlist_sort_selected(playlist, PLAYLIST_SORT_TITLE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1700 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1701 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1702
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1703 void action_playlist_sort_selected_by_artist(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1704 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1705 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1706
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1707 aud_playlist_sort_selected(playlist, PLAYLIST_SORT_ARTIST);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1708 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1709 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1710
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1711 void action_playlist_sort_selected_by_full_path(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1712 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1713 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1714
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1715 aud_playlist_sort_selected(playlist, PLAYLIST_SORT_PATH);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1716 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1717 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1718
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1719 void action_playlist_sort_selected_by_date(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1720 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1721 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1722
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1723 aud_playlist_sort_selected(playlist, PLAYLIST_SORT_DATE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1724 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1725 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1726
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1727 void action_playlist_sort_selected_by_filename(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1728 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1729 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1730
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1731 aud_playlist_sort_selected(playlist, PLAYLIST_SORT_FILENAME);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1732 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1733 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1734
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1735 void action_playlist_randomize_list(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1736 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1737 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1738
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1739 aud_playlist_random(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1740 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1741 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1742
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1743 void action_playlist_reverse_list(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1744 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1745 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1746
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1747 aud_playlist_reverse(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1748 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1749 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1750
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1751 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1752 action_playlist_clear_queue(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1753 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1754 aud_playlist_clear_queue(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1755 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1756
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1757 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1758 action_playlist_remove_unavailable(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1759 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1760 aud_playlist_remove_dead_files(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1761 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1762
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1763 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1764 action_playlist_remove_dupes_by_title(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1765 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1766 aud_playlist_remove_duplicates(aud_playlist_get_active(), PLAYLIST_DUPS_TITLE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1767 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1768
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1769 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1770 action_playlist_remove_dupes_by_filename(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1771 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1772 aud_playlist_remove_duplicates(aud_playlist_get_active(), PLAYLIST_DUPS_FILENAME);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1773 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1774
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1775 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1776 action_playlist_remove_dupes_by_full_path(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1777 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1778 aud_playlist_remove_duplicates(aud_playlist_get_active(), PLAYLIST_DUPS_PATH);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1779 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1780
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1781 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1782 action_playlist_remove_all(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1783 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1784 aud_playlist_clear(aud_playlist_get_active());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1785
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1786 /* XXX -- should this really be coupled here? -nenolod */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1787 mainwin_clear_song_info();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1788 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1789
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1790 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1791 action_playlist_remove_selected(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1792 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1793 aud_playlist_delete(aud_playlist_get_active(), FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1794 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1795
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1796 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1797 action_playlist_remove_unselected(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1798 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1799 aud_playlist_delete(aud_playlist_get_active(), TRUE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1800 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1801
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1802 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1803 action_playlist_add_files(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1804 {
2816
a7a260032a5e use InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents: 2794
diff changeset
1805 skins_interface.ops->filebrowser_show(FALSE); /* FALSE = NO_PLAY_BUTTON */
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1806 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1807
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1808 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1809 action_playlist_add_url(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1810 {
2816
a7a260032a5e use InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents: 2794
diff changeset
1811 skins_interface.ops->urlopener_show();
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1812 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1813
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1814 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1815 action_playlist_new( void )
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1816 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1817 Playlist *new_pl = aud_playlist_new();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1818 aud_playlist_add_playlist(new_pl);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1819 aud_playlist_select_playlist(new_pl);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1820 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1821
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1822 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1823 action_playlist_prev( void )
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1824 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1825 aud_playlist_select_prev();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1826 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1827
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1828 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1829 action_playlist_next( void )
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1830 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1831 aud_playlist_select_next();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1832 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1833
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1834 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1835 action_playlist_delete( void )
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1836 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1837 aud_playlist_remove_playlist( aud_playlist_get_active() );
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1838 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1839
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1840 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1841 action_playlist_save_list(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1842 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1843 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1844
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1845 playlistwin_select_playlist_to_save(aud_playlist_get_current_name(playlist));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1846 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1847
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1848 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1849 action_playlist_save_default_list(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1850 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1851 #if 0
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1852 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1853
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1854 aud_playlist_save(playlist, aud_paths[BMP_PATH_PLAYLIST_FILE]);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1855 #endif
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1856 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1857
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1858 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1859 action_playlist_load_list(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1860 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1861 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1862
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1863 playlistwin_select_playlist_to_load(aud_playlist_get_current_name(playlist));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1864 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1865
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1866 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1867 action_playlist_refresh_list(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1868 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1869 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1870
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1871 aud_playlist_read_info_selection(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1872 playlistwin_update_list(playlist);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1873 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1874
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1875 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1876 action_open_list_manager(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1877 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1878 playlist_manager_ui_show();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1879 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1880
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1881 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1882 action_playlist_search_and_select(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1883 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1884 playlistwin_select_search();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1885 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1886
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1887 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1888 action_playlist_invert_selection(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1889 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1890 playlistwin_inverse_selection();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1891 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1892
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1893 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1894 action_playlist_select_none(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1895 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1896 playlistwin_select_none();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1897 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1898
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1899 void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1900 action_playlist_select_all(void)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1901 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1902 playlistwin_select_all();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1903 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1904
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1905
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1906 static void
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1907 playlistwin_select_search_cbt_cb(GtkWidget *called_cbt, gpointer other_cbt)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1908 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1909 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(called_cbt)) == TRUE)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1910 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(other_cbt), FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1911 return;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1912 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1913
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1914 static gboolean
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1915 playlistwin_select_search_kp_cb(GtkWidget *entry, GdkEventKey *event,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1916 gpointer searchdlg_win)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1917 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1918 switch (event->keyval)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1919 {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1920 case GDK_Return:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1921 if (gtk_im_context_filter_keypress (GTK_ENTRY (entry)->im_context, event)) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1922 GTK_ENTRY (entry)->need_im_reset = TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1923 return TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1924 } else {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1925 gtk_dialog_response(GTK_DIALOG(searchdlg_win), GTK_RESPONSE_ACCEPT);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1926 return TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1927 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1928 default:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1929 return FALSE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1930 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1931 }