annotate Plugins/General/song_change/song_change.c @ 1390:dfa069085cbb trunk

[svn] - use default 'plugins' icon for now.
author nenolod
date Mon, 10 Jul 2006 14:04:49 -0700
parents 3e44e4df1e35
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
1 /*
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
2 * Audacious: A cross-platform multimedia player.
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
3 * Copyright (c) 2005 Audacious Team
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
4 */
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
5 #include "config.h"
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
6
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
7 #include <glib.h>
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
8 #include <glib/gi18n.h>
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
9 #include <gtk/gtk.h>
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
10 #include <sys/types.h>
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
11 #include <sys/wait.h>
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
12
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
13 #include <signal.h>
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
14 #include <unistd.h>
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
15 #include <stdio.h>
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
16
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
17 #include <string.h>
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
18
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
19 #include "audacious/plugin.h"
1221
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
20 #include "audacious/prefswin.h"
308
511354316db4 [svn] Convert to configdb usage.
chainsaw
parents: 247
diff changeset
21 #include "libaudacious/configdb.h"
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
22 #include "libaudacious/beepctrl.h"
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
23 #include "libaudacious/formatter.h"
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
24
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
25 static void init(void);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
26 static void cleanup(void);
1221
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
27 static GtkWidget *configure(void);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
28 static int timeout_func(gpointer);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
29
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
30 static int timeout_tag = 0;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
31 static int previous_song = -1;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
32 static char *cmd_line = NULL;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
33 static char *cmd_line_after = NULL;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
34 static char *cmd_line_end = NULL;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
35 static gboolean possible_pl_end;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
36
1385
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
37 static GtkWidget *configure_vbox = NULL;
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
38 static GtkWidget *cmd_entry, *cmd_after_entry, *cmd_end_entry;
1385
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
39 static GtkWidget *cmd_warn_label, *cmd_warn_img;
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
40
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
41 GeneralPlugin sc_gp =
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
42 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
43 NULL, /* handle */
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
44 NULL, /* filename */
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
45 -1, /* xmms_session */
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
46 NULL, /* Description */
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
47 init,
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
48 NULL,
1221
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
49 NULL,
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
50 cleanup,
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
51 };
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
52
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
53 GeneralPlugin *get_gplugin_info(void)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
54 {
751
6636d328fa38 [svn] more progress
nenolod
parents: 308
diff changeset
55 sc_gp.description = g_strdup_printf(_("Song Change %s"), PACKAGE_VERSION);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
56 return &sc_gp;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
57 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
58
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
59 static void read_config(void)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
60 {
308
511354316db4 [svn] Convert to configdb usage.
chainsaw
parents: 247
diff changeset
61 ConfigDb *db;
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
62
308
511354316db4 [svn] Convert to configdb usage.
chainsaw
parents: 247
diff changeset
63 cmd_line = g_strdup("");
511354316db4 [svn] Convert to configdb usage.
chainsaw
parents: 247
diff changeset
64 cmd_line_after = g_strdup("");
511354316db4 [svn] Convert to configdb usage.
chainsaw
parents: 247
diff changeset
65 cmd_line_end = g_strdup("");
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
66
308
511354316db4 [svn] Convert to configdb usage.
chainsaw
parents: 247
diff changeset
67 db = bmp_cfg_db_open();
511354316db4 [svn] Convert to configdb usage.
chainsaw
parents: 247
diff changeset
68 bmp_cfg_db_get_string(db, "song_change", "cmd_line", &cmd_line);
511354316db4 [svn] Convert to configdb usage.
chainsaw
parents: 247
diff changeset
69 bmp_cfg_db_get_string(db, "song_change", "cmd_line_after", &cmd_line_after);
511354316db4 [svn] Convert to configdb usage.
chainsaw
parents: 247
diff changeset
70 bmp_cfg_db_get_string(db, "song_change", "cmd_line_end", &cmd_line_end);
511354316db4 [svn] Convert to configdb usage.
chainsaw
parents: 247
diff changeset
71 bmp_cfg_db_close(db);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
72 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
73
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
74 static void cleanup(void)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
75 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
76 if (timeout_tag)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
77 gtk_timeout_remove(timeout_tag);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
78 timeout_tag = 0;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
79
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
80 g_free(cmd_line);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
81 g_free(cmd_line_after);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
82 g_free(cmd_line_end);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
83 cmd_line = NULL;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
84 cmd_line_after = NULL;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
85 cmd_line_end = NULL;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
86 signal(SIGCHLD, SIG_DFL);
1221
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
87
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
88 prefswin_page_destroy(configure_vbox);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
89 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
90
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
91 static void save_and_close(GtkWidget *w, gpointer data)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
92 {
308
511354316db4 [svn] Convert to configdb usage.
chainsaw
parents: 247
diff changeset
93 ConfigDb *db;
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
94 char *cmd, *cmd_after, *cmd_end;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
95
247
95f7737919b1 [svn] Avoid discarding pointer type qualifiers by not using the result of gtk_entry_get_text directly.
chainsaw
parents: 119
diff changeset
96 cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(cmd_entry)));
95f7737919b1 [svn] Avoid discarding pointer type qualifiers by not using the result of gtk_entry_get_text directly.
chainsaw
parents: 119
diff changeset
97 cmd_after = g_strdup(gtk_entry_get_text(GTK_ENTRY(cmd_after_entry)));
95f7737919b1 [svn] Avoid discarding pointer type qualifiers by not using the result of gtk_entry_get_text directly.
chainsaw
parents: 119
diff changeset
98 cmd_end = g_strdup(gtk_entry_get_text(GTK_ENTRY(cmd_end_entry)));
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
99
308
511354316db4 [svn] Convert to configdb usage.
chainsaw
parents: 247
diff changeset
100 db = bmp_cfg_db_open();
511354316db4 [svn] Convert to configdb usage.
chainsaw
parents: 247
diff changeset
101 bmp_cfg_db_set_string(db, "song_change", "cmd_line", cmd);
511354316db4 [svn] Convert to configdb usage.
chainsaw
parents: 247
diff changeset
102 bmp_cfg_db_set_string(db, "song_change", "cmd_line_after", cmd_after);
511354316db4 [svn] Convert to configdb usage.
chainsaw
parents: 247
diff changeset
103 bmp_cfg_db_set_string(db, "song_change", "cmd_line_end", cmd_end);
511354316db4 [svn] Convert to configdb usage.
chainsaw
parents: 247
diff changeset
104 bmp_cfg_db_close(db);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
105
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
106 if (timeout_tag)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
107 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
108 g_free(cmd_line);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
109 cmd_line = g_strdup(cmd);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
110 g_free(cmd_line_after);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
111 cmd_line_after = g_strdup(cmd_after);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
112 g_free(cmd_line_end);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
113 cmd_line_end = g_strdup(cmd_end);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
114 }
931
26b580493ce2 [svn] Moved the free, based on Joker's report of string corruptions.
nemo
parents: 859
diff changeset
115
26b580493ce2 [svn] Moved the free, based on Joker's report of string corruptions.
nemo
parents: 859
diff changeset
116 g_free(cmd);
26b580493ce2 [svn] Moved the free, based on Joker's report of string corruptions.
nemo
parents: 859
diff changeset
117 g_free(cmd_after);
26b580493ce2 [svn] Moved the free, based on Joker's report of string corruptions.
nemo
parents: 859
diff changeset
118 g_free(cmd_end);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
119 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
120
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
121 static int check_command(char *command)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
122 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
123 const char *dangerous = "fns";
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
124 char *c;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
125 int qu = 0;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
126
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
127 for (c = command; *c != '\0'; c++)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
128 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
129 if (*c == '"' && (c == command || *(c - 1) != '\\'))
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
130 qu = !qu;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
131 else if (*c == '%' && !qu && strchr(dangerous, *(c + 1)))
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
132 return -1;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
133 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
134 return 0;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
135 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
136
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
137 static void configure_ok_cb(GtkWidget *w, gpointer data)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
138 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
139 char *cmd, *cmd_after, *cmd_end;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
140
247
95f7737919b1 [svn] Avoid discarding pointer type qualifiers by not using the result of gtk_entry_get_text directly.
chainsaw
parents: 119
diff changeset
141 cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(cmd_entry)));
95f7737919b1 [svn] Avoid discarding pointer type qualifiers by not using the result of gtk_entry_get_text directly.
chainsaw
parents: 119
diff changeset
142 cmd_after = g_strdup(gtk_entry_get_text(GTK_ENTRY(cmd_after_entry)));
95f7737919b1 [svn] Avoid discarding pointer type qualifiers by not using the result of gtk_entry_get_text directly.
chainsaw
parents: 119
diff changeset
143 cmd_end = g_strdup(gtk_entry_get_text(GTK_ENTRY(cmd_end_entry)));
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
144
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
145 if (check_command(cmd) < 0 || check_command(cmd_after) < 0
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
146 || check_command(cmd_end) < 0)
1385
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
147 {
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
148 gtk_widget_show(cmd_warn_img);
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
149 gtk_widget_show(cmd_warn_label);
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
150 }
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
151 else
1385
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
152 {
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
153 gtk_widget_hide(cmd_warn_img);
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
154 gtk_widget_hide(cmd_warn_label);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
155 save_and_close(NULL, NULL);
1385
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
156 }
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
157
247
95f7737919b1 [svn] Avoid discarding pointer type qualifiers by not using the result of gtk_entry_get_text directly.
chainsaw
parents: 119
diff changeset
158 g_free(cmd);
95f7737919b1 [svn] Avoid discarding pointer type qualifiers by not using the result of gtk_entry_get_text directly.
chainsaw
parents: 119
diff changeset
159 g_free(cmd_after);
95f7737919b1 [svn] Avoid discarding pointer type qualifiers by not using the result of gtk_entry_get_text directly.
chainsaw
parents: 119
diff changeset
160 g_free(cmd_end);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
161 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
162
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
163
1221
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
164 static GtkWidget *configure(void)
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
165 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
166 GtkWidget *sep1, *sep2, *sep3;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
167 GtkWidget *cmd_hbox, *cmd_label;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
168 GtkWidget *cmd_after_hbox, *cmd_after_label;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
169 GtkWidget *cmd_end_hbox, *cmd_end_label;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
170 GtkWidget *cmd_desc, *cmd_after_desc, *cmd_end_desc, *f_desc;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
171 GtkWidget *song_frame, *song_vbox;
1385
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
172 GtkWidget *bbox_hbox;
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
173 char *temp;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
174
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
175 read_config();
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
176
1385
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
177 configure_vbox = gtk_vbox_new(FALSE, 12);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
178
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
179 song_frame = gtk_frame_new(_("Commands"));
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
180 gtk_box_pack_start(GTK_BOX(configure_vbox), song_frame, FALSE, FALSE, 0);
1385
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
181 song_vbox = gtk_vbox_new(FALSE, 12);
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
182 gtk_container_set_border_width(GTK_CONTAINER(song_vbox), 6);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
183 gtk_container_add(GTK_CONTAINER(song_frame), song_vbox);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
184
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
185 cmd_desc = gtk_label_new(_(
1378
27d9eb18c7cf [svn] - some improvements to song_change, still sucky
nenolod
parents: 1328
diff changeset
186 "Command to run when Audacious starts a new song."));
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
187 gtk_label_set_justify(GTK_LABEL(cmd_desc), GTK_JUSTIFY_LEFT);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
188 gtk_misc_set_alignment(GTK_MISC(cmd_desc), 0, 0.5);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
189 gtk_box_pack_start(GTK_BOX(song_vbox), cmd_desc, FALSE, FALSE, 0);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
190 gtk_label_set_line_wrap(GTK_LABEL(cmd_desc), TRUE);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
191
1385
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
192 cmd_hbox = gtk_hbox_new(FALSE, 6);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
193 gtk_box_pack_start(GTK_BOX(song_vbox), cmd_hbox, FALSE, FALSE, 0);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
194
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
195 cmd_label = gtk_label_new(_("Command:"));
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
196 gtk_box_pack_start(GTK_BOX(cmd_hbox), cmd_label, FALSE, FALSE, 0);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
197
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
198 cmd_entry = gtk_entry_new();
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
199 if (cmd_line)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
200 gtk_entry_set_text(GTK_ENTRY(cmd_entry), cmd_line);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
201 gtk_widget_set_usize(cmd_entry, 200, -1);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
202 gtk_box_pack_start(GTK_BOX(cmd_hbox), cmd_entry, TRUE, TRUE, 0);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
203
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
204 sep1 = gtk_hseparator_new();
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
205 gtk_box_pack_start(GTK_BOX(song_vbox), sep1, TRUE, TRUE, 0);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
206
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
207
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
208 cmd_after_desc = gtk_label_new(_(
1378
27d9eb18c7cf [svn] - some improvements to song_change, still sucky
nenolod
parents: 1328
diff changeset
209 "Command to run toward the end of a song."));
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
210 gtk_label_set_justify(GTK_LABEL(cmd_after_desc), GTK_JUSTIFY_LEFT);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
211 gtk_misc_set_alignment(GTK_MISC(cmd_after_desc), 0, 0.5);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
212 gtk_box_pack_start(GTK_BOX(song_vbox), cmd_after_desc, FALSE, FALSE, 0);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
213
1385
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
214 cmd_after_hbox = gtk_hbox_new(FALSE, 6);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
215 gtk_box_pack_start(GTK_BOX(song_vbox), cmd_after_hbox, FALSE, FALSE, 0);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
216
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
217 cmd_after_label = gtk_label_new(_("Command:"));
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
218 gtk_box_pack_start(GTK_BOX(cmd_after_hbox), cmd_after_label, FALSE, FALSE, 0);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
219
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
220 cmd_after_entry = gtk_entry_new();
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
221 if (cmd_line_after)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
222 gtk_entry_set_text(GTK_ENTRY(cmd_after_entry), cmd_line_after);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
223 gtk_widget_set_usize(cmd_after_entry, 200, -1);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
224 gtk_box_pack_start(GTK_BOX(cmd_after_hbox), cmd_after_entry, TRUE, TRUE, 0);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
225 sep2 = gtk_hseparator_new();
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
226 gtk_box_pack_start(GTK_BOX(song_vbox), sep2, TRUE, TRUE, 0);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
227
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
228 cmd_end_desc = gtk_label_new(_(
1378
27d9eb18c7cf [svn] - some improvements to song_change, still sucky
nenolod
parents: 1328
diff changeset
229 "Command to run when Audacious reaches the end "
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
230 "of the playlist."));
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
231 gtk_label_set_justify(GTK_LABEL(cmd_end_desc), GTK_JUSTIFY_LEFT);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
232 gtk_misc_set_alignment(GTK_MISC(cmd_end_desc), 0, 0.5);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
233 gtk_box_pack_start(GTK_BOX(song_vbox), cmd_end_desc, FALSE, FALSE, 0);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
234
1385
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
235 cmd_end_hbox = gtk_hbox_new(FALSE, 6);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
236 gtk_box_pack_start(GTK_BOX(song_vbox), cmd_end_hbox, FALSE, FALSE, 0);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
237
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
238 cmd_end_label = gtk_label_new(_("Command:"));
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
239 gtk_box_pack_start(GTK_BOX(cmd_end_hbox), cmd_end_label, FALSE, FALSE, 0);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
240
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
241 cmd_end_entry = gtk_entry_new();
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
242 if (cmd_line_end)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
243 gtk_entry_set_text(GTK_ENTRY(cmd_end_entry), cmd_line_end);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
244 gtk_widget_set_usize(cmd_end_entry, 200, -1);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
245 gtk_box_pack_start(GTK_BOX(cmd_end_hbox), cmd_end_entry, TRUE, TRUE, 0);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
246 sep3 = gtk_hseparator_new();
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
247 gtk_box_pack_start(GTK_BOX(song_vbox), sep3, TRUE, TRUE, 0);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
248
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
249 temp = g_strdup_printf(
1385
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
250 _("You can use the following format strings which\n"
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
251 "will be substituted before calling the command\n"
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
252 "(not all are useful for the end-of-playlist command).\n\n"
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
253 "%%F: Frequency (in hertz)\n"
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
254 "%%c: Number of channels\n"
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
255 "%%f: filename (full path)\n"
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
256 "%%l: length (in milliseconds)\n"
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
257 "%%n or %%s: Song name\n"
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
258 "%%r: Rate (in bits per second)\n"
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
259 "%%t: Playlist position (%%02d)\n"
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
260 "%%p: Currently playing (1 or 0)"));
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
261 f_desc = gtk_label_new(temp);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
262 g_free(temp);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
263
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
264 gtk_label_set_justify(GTK_LABEL(f_desc), GTK_JUSTIFY_LEFT);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
265 gtk_misc_set_alignment(GTK_MISC(f_desc), 0, 0.5);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
266 gtk_box_pack_start(GTK_BOX(song_vbox), f_desc, FALSE, FALSE, 0);
1385
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
267
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
268 bbox_hbox = gtk_hbox_new(FALSE, 6);
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
269 gtk_box_pack_start(GTK_BOX(configure_vbox), bbox_hbox, FALSE, FALSE, 0);
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
270
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
271 cmd_warn_img = gtk_image_new_from_stock("gtk-dialog-warning", GTK_ICON_SIZE_MENU);
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
272 gtk_box_pack_start(GTK_BOX(bbox_hbox), cmd_warn_img, FALSE, FALSE, 0);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
273
1385
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
274 temp = g_strdup_printf(
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
275 _("<span size='small'>Parameters passed to the shell should be encapsulated in quotes. Doing otherwise is a security risk.</span>"));
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
276 cmd_warn_label = gtk_label_new(temp);
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
277 gtk_label_set_markup(GTK_LABEL(cmd_warn_label), temp);
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
278 gtk_box_pack_start(GTK_BOX(bbox_hbox), cmd_warn_label, FALSE, FALSE, 0);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
279
1385
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
280 g_signal_connect(GTK_OBJECT(cmd_entry), "changed", GTK_SIGNAL_FUNC(configure_ok_cb), NULL);
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
281 g_signal_connect(GTK_OBJECT(cmd_after_entry), "changed", GTK_SIGNAL_FUNC(configure_ok_cb), NULL);
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
282 g_signal_connect(GTK_OBJECT(cmd_end_entry), "changed", GTK_SIGNAL_FUNC(configure_ok_cb), NULL);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
283
1221
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
284 gtk_widget_show_all(configure_vbox);
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
285
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
286 return configure_vbox;
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
287 }
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
288
1221
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
289 static void init(void)
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
290 {
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
291 read_config();
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
292
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
293 previous_song = -1;
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
294 timeout_tag = gtk_timeout_add(100, timeout_func, NULL);
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
295
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
296 configure_vbox = configure();
1390
dfa069085cbb [svn] - use default 'plugins' icon for now.
nenolod
parents: 1385
diff changeset
297 prefswin_page_new(configure_vbox, "Song Change", DATA_DIR "/images/plugins.png");
1385
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
298
3e44e4df1e35 [svn] - vast improvements to the songchange plugin
nenolod
parents: 1378
diff changeset
299 configure_ok_cb(NULL, NULL);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
300 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
301
1221
f72025664bed [svn] - song_change II (`Do Something') begins.
nenolod
parents: 931
diff changeset
302
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
303 static void bury_child(int signal)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
304 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
305 waitpid(-1, NULL, WNOHANG);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
306 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
307
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
308 static void execute_command(char *cmd)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
309 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
310 char *argv[4] = {"/bin/sh", "-c", NULL, NULL};
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
311 int i;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
312 argv[2] = cmd;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
313 signal(SIGCHLD, bury_child);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
314 if (fork() == 0)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
315 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
316 /* We don't want this process to hog the audio device etc */
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
317 for (i = 3; i < 255; i++)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
318 close(i);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
319 execv("/bin/sh", argv);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
320 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
321 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
322
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
323 /*
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
324 * escape_shell_chars()
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
325 *
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
326 * Escapes characters that are special to the shell inside double quotes.
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
327 */
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
328
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
329 static char* escape_shell_chars(const char *string)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
330 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
331 const char *special = "$`\"\\"; /* Characters to escape */
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
332 const char *in = string;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
333 char *out;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
334 char *escaped;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
335 int num = 0;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
336
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
337 while (*in != '\0')
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
338 if (strchr(special, *in++))
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
339 num++;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
340
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
341 escaped = g_malloc(strlen(string) + num + 1);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
342
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
343 in = string;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
344 out = escaped;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
345
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
346 while (*in != '\0')
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
347 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
348 if (strchr(special, *in))
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
349 *out++ = '\\';
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
350 *out++ = *in++;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
351 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
352 *out = '\0';
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
353
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
354 return escaped;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
355 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
356
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
357
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
358
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
359 /* Format codes:
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
360 *
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
361 * F - frequency (in hertz)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
362 * c - number of channels
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
363 * f - filename (full path)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
364 * l - length (in milliseconds)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
365 * n - name
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
366 * r - rate (in bits per second)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
367 * s - name (since everyone's used to it)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
368 * t - playlist position (%02d)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
369 * p - currently playing (1 or 0)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
370 */
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
371 /* do_command(): do @cmd after replacing the format codes
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
372 @cmd: command to run
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
373 @current_file: file name of current song
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
374 @pos: playlist_pos */
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
375 void do_command(char *cmd, const char *current_file, int pos)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
376 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
377 int length, rate, freq, nch;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
378 char *str, *shstring = NULL, *temp, numbuf[16];
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
379 gboolean playing;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
380 Formatter *formatter;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
381
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
382 if (cmd && strlen(cmd) > 0)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
383 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
384 formatter = xmms_formatter_new();
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
385 str = xmms_remote_get_playlist_title(sc_gp.xmms_session, pos);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
386 if (str)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
387 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
388 temp = escape_shell_chars(str);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
389 xmms_formatter_associate(formatter, 's', temp);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
390 xmms_formatter_associate(formatter, 'n', temp);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
391 g_free(str);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
392 g_free(temp);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
393 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
394 else
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
395 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
396 xmms_formatter_associate(formatter, 's', "");
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
397 xmms_formatter_associate(formatter, 'n', "");
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
398 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
399
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
400 if (current_file)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
401 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
402 temp = escape_shell_chars(current_file);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
403 xmms_formatter_associate(formatter, 'f', temp);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
404 g_free(temp);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
405 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
406 else
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
407 xmms_formatter_associate(formatter, 'f', "");
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
408 sprintf(numbuf, "%02d", pos + 1);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
409 xmms_formatter_associate(formatter, 't', numbuf);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
410 length = xmms_remote_get_playlist_time(sc_gp.xmms_session, pos);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
411 if (length != -1)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
412 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
413 sprintf(numbuf, "%d", length);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
414 xmms_formatter_associate(formatter, 'l', numbuf);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
415 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
416 else
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
417 xmms_formatter_associate(formatter, 'l', "0");
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
418 xmms_remote_get_info(sc_gp.xmms_session, &rate, &freq, &nch);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
419 sprintf(numbuf, "%d", rate);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
420 xmms_formatter_associate(formatter, 'r', numbuf);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
421 sprintf(numbuf, "%d", freq);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
422 xmms_formatter_associate(formatter, 'F', numbuf);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
423 sprintf(numbuf, "%d", nch);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
424 xmms_formatter_associate(formatter, 'c', numbuf);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
425 playing = xmms_remote_is_playing(sc_gp.xmms_session);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
426 sprintf(numbuf, "%d", playing);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
427 xmms_formatter_associate(formatter, 'p', numbuf);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
428 shstring = xmms_formatter_format(formatter, cmd);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
429 xmms_formatter_destroy(formatter);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
430
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
431 if (shstring)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
432 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
433 execute_command(shstring);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
434 /* FIXME: This can possibly be freed too early */
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
435 g_free(shstring);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
436 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
437 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
438 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
439
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
440
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
441 static int timeout_func(gpointer data)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
442 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
443 int pos;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
444 gboolean playing;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
445 static char *previous_file = NULL;
859
df6712e1959d [svn] - Also determine a change by track name, patch by nixphoeni.
nenolod
parents: 751
diff changeset
446 static char *previous_track = NULL;
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
447 static gboolean cmd_after_already_run = FALSE;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
448 char *current_file;
859
df6712e1959d [svn] - Also determine a change by track name, patch by nixphoeni.
nenolod
parents: 751
diff changeset
449 char *current_track;
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
450
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
451 GDK_THREADS_ENTER();
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
452
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
453 playing = xmms_remote_is_playing(sc_gp.xmms_session);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
454 pos = xmms_remote_get_playlist_pos(sc_gp.xmms_session);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
455 current_file = xmms_remote_get_playlist_file(sc_gp.xmms_session, pos);
859
df6712e1959d [svn] - Also determine a change by track name, patch by nixphoeni.
nenolod
parents: 751
diff changeset
456 current_track = xmms_remote_get_playlist_title(sc_gp.xmms_session, pos);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
457
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
458 if ((pos != previous_song ||
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
459 (!previous_file && current_file) ||
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
460 (previous_file && !current_file) ||
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
461 (previous_file && current_file &&
859
df6712e1959d [svn] - Also determine a change by track name, patch by nixphoeni.
nenolod
parents: 751
diff changeset
462 strcmp(previous_file, current_file)) ||
df6712e1959d [svn] - Also determine a change by track name, patch by nixphoeni.
nenolod
parents: 751
diff changeset
463 (!previous_track && current_track) ||
df6712e1959d [svn] - Also determine a change by track name, patch by nixphoeni.
nenolod
parents: 751
diff changeset
464 (previous_track && !current_track) ||
df6712e1959d [svn] - Also determine a change by track name, patch by nixphoeni.
nenolod
parents: 751
diff changeset
465 (previous_track && current_track &&
df6712e1959d [svn] - Also determine a change by track name, patch by nixphoeni.
nenolod
parents: 751
diff changeset
466 strcmp(previous_track, current_track))) &&
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
467 xmms_remote_get_output_time(sc_gp.xmms_session) > 0)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
468 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
469 do_command(cmd_line, current_file, pos);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
470 g_free(previous_file);
859
df6712e1959d [svn] - Also determine a change by track name, patch by nixphoeni.
nenolod
parents: 751
diff changeset
471 g_free(previous_track);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
472 previous_file = g_strdup(current_file);
859
df6712e1959d [svn] - Also determine a change by track name, patch by nixphoeni.
nenolod
parents: 751
diff changeset
473 previous_track = g_strdup(current_track);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
474 previous_song = pos;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
475 cmd_after_already_run = FALSE;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
476 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
477 if (!cmd_after_already_run &&
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
478 ((xmms_remote_get_playlist_time(sc_gp.xmms_session,pos) -
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
479 xmms_remote_get_output_time(sc_gp.xmms_session)) < 100))
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
480 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
481 do_command(cmd_line_after, current_file, pos);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
482 cmd_after_already_run = TRUE;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
483 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
484
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
485 if (playing)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
486 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
487 int playlist_length = xmms_remote_get_playlist_length(sc_gp.xmms_session);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
488 if (pos + 1 == playlist_length)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
489 possible_pl_end = TRUE;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
490 else
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
491 possible_pl_end = FALSE;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
492 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
493 else if (possible_pl_end)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
494 {
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
495 if (pos == 0)
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
496 do_command(cmd_line_end, current_file, pos);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
497 possible_pl_end = FALSE;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
498 g_free(previous_file);
859
df6712e1959d [svn] - Also determine a change by track name, patch by nixphoeni.
nenolod
parents: 751
diff changeset
499 g_free(previous_track);
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
500 previous_file = NULL;
859
df6712e1959d [svn] - Also determine a change by track name, patch by nixphoeni.
nenolod
parents: 751
diff changeset
501 previous_track = NULL;
117
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
502 }
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
503
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
504 g_free(current_file);
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
505 current_file = NULL;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
506
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
507 GDK_THREADS_LEAVE();
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
508
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
509 return TRUE;
e9d61d327c30 [svn] Add song_change plugin, ready to go.
nenolod
parents:
diff changeset
510 }