changeset 4583:77f57ba8d7a4

Automated merge with ssh://hg.atheme.org//hg/audacious
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 22 May 2008 07:10:10 +0300
parents cf6711eeb12f (diff) 07a5687a90b0 (current diff)
children 78e21c07ba6a d9b2fe7a2d04
files
diffstat 10 files changed, 36 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/auddrct.c	Thu May 22 07:08:12 2008 +0300
+++ b/src/audacious/auddrct.c	Thu May 22 07:10:10 2008 +0300
@@ -94,6 +94,12 @@
 /* playback */
 
 void
+drct_initiate ( void )
+{
+    playback_initiate();
+}
+
+void
 drct_play ( void )
 {
     if (playback_get_paused())
--- a/src/audacious/auddrct.h	Thu May 22 07:08:12 2008 +0300
+++ b/src/audacious/auddrct.h	Thu May 22 07:10:10 2008 +0300
@@ -39,6 +39,7 @@
 void drct_activate(void);
 
 /* playback */
+void drct_initiate ( void );
 void drct_play ( void );
 void drct_pause ( void );
 void drct_stop ( void );
--- a/src/audacious/eventqueue.c	Thu May 22 07:08:12 2008 +0300
+++ b/src/audacious/eventqueue.c	Thu May 22 07:10:10 2008 +0300
@@ -27,6 +27,9 @@
     hook_call(hq->name, hq->user_data);
 
     g_free(hq->name);
+    if (hq->free_data && hq->user_data)
+        g_free(hq->user_data);
+
     g_slice_free(HookCallQueue, hq);
 
     return FALSE;
@@ -42,6 +45,7 @@
     hq = g_slice_new0(HookCallQueue);
     hq->name = g_strdup(name);
     hq->user_data = user_data;
+    hq->free_data = FALSE;
 
     g_idle_add_full(G_PRIORITY_HIGH_IDLE, eventqueue_handle, hq, NULL);
 }
@@ -56,6 +60,22 @@
     hq = g_slice_new0(HookCallQueue);
     hq->name = g_strdup(name);
     hq->user_data = user_data;
+    hq->free_data = FALSE;
 
     g_timeout_add(time, eventqueue_handle, hq);
 }
+
+void event_queue_with_data_free(const gchar *name, gpointer user_data)
+{
+    HookCallQueue *hq;
+
+    g_return_if_fail(name != NULL);
+    g_return_if_fail(user_data != NULL);
+
+    hq = g_slice_new0(HookCallQueue);
+    hq->name = g_strdup(name);
+    hq->user_data = user_data;
+    hq->free_data = TRUE;
+
+    g_idle_add_full(G_PRIORITY_HIGH_IDLE, eventqueue_handle, hq, NULL);
+}
\ No newline at end of file
--- a/src/audacious/eventqueue.h	Thu May 22 07:08:12 2008 +0300
+++ b/src/audacious/eventqueue.h	Thu May 22 07:10:10 2008 +0300
@@ -28,9 +28,11 @@
 typedef struct {
     gchar *name;
     gpointer *user_data;
+    gboolean free_data;
 } HookCallQueue;
 
 void event_queue(const gchar *name, gpointer user_data);
 void event_queue_timed(gint time, const gchar *name, gpointer user_data);
+void event_queue_with_data_free(const gchar *name, gpointer user_data);
 
 #endif /* AUDACIOUS_EVENTQUEUE_H */
--- a/src/audacious/input.c	Thu May 22 07:08:12 2008 +0300
+++ b/src/audacious/input.c	Thu May 22 07:10:10 2008 +0300
@@ -781,5 +781,5 @@
 input_set_info_text(gchar *text)
 {
     gchar *title = g_strdup(text);
-    event_queue("title change", title);
+    event_queue_with_data_free("title change", title);
 }
--- a/src/audacious/playlist.c	Thu May 22 07:08:12 2008 +0300
+++ b/src/audacious/playlist.c	Thu May 22 07:10:10 2008 +0300
@@ -1108,10 +1108,11 @@
     msg->samplerate = freq;
     msg->channels = nch;
 
-    event_queue("playlist info change", msg);
+    playback_set_sample_params(rate, freq, nch);
+    event_queue_with_data_free("playlist info change", msg);
 
     text = playlist_get_info_text(playlist);
-    event_queue("title change", text);
+    event_queue_with_data_free("title change", text);
 
     if ( playlist->position )
         hook_call( "playlist set info" , playlist->position );
--- a/src/audacious/plugin.h	Thu May 22 07:08:12 2008 +0300
+++ b/src/audacious/plugin.h	Thu May 22 07:10:10 2008 +0300
@@ -547,6 +547,7 @@
     void (*drct_activate)(void);
 
     /* DRCT API: playback */
+    void (*drct_initiate) ( void );
     void (*drct_play) ( void );
     void (*drct_pause) ( void );
     void (*drct_stop) ( void );
@@ -904,6 +905,7 @@
 #define audacious_drct_set_skin			_audvt->drct_set_skin
 #define audacious_drct_activate			_audvt->drct_activate
 
+#define audacious_drct_initiate                 _audvt->drct_initiate
 #define audacious_drct_play			_audvt->drct_play
 #define audacious_drct_pause			_audvt->drct_pause
 #define audacious_drct_stop			_audvt->drct_stop
--- a/src/audacious/pluginenum.c	Thu May 22 07:08:12 2008 +0300
+++ b/src/audacious/pluginenum.c	Thu May 22 07:10:10 2008 +0300
@@ -309,6 +309,7 @@
     .drct_set_skin = NULL, /* remove someday. --mf0102 */
     .drct_activate = drct_activate,
 
+    .drct_initiate = drct_initiate,
     .drct_play = drct_play,
     .drct_pause = drct_pause,
     .drct_stop = drct_stop,
--- a/src/audacious/ui_main.c	Thu May 22 07:08:12 2008 +0300
+++ b/src/audacious/ui_main.c	Thu May 22 07:10:10 2008 +0300
@@ -620,8 +620,6 @@
     gchar *title;
     Playlist *playlist = playlist_get_active();
 
-    playback_set_sample_params(bitrate, frequency, n_channels);
-
     GDK_THREADS_ENTER();
     if (bitrate != -1) {
         bitrate /= 1000;
--- a/src/audacious/ui_main_evlisteners.c	Thu May 22 07:08:12 2008 +0300
+++ b/src/audacious/ui_main_evlisteners.c	Thu May 22 07:10:10 2008 +0300
@@ -63,7 +63,6 @@
 
     ui_skinned_textbox_set_text(mainwin_info, text);
     playlistwin_update_list(playlist_get_active());
-    g_free(text);
 }
 
 static void
@@ -95,12 +94,6 @@
 }
 
 static void
-ui_main_evlistener_playback_initiate(gpointer hook_data, gpointer user_data)
-{
-    playback_initiate();
-}
-
-static void
 ui_main_evlistener_playback_begin(gpointer hook_data, gpointer user_data)
 {
     PlaylistEntry *entry = (PlaylistEntry*)hook_data;
@@ -193,8 +186,6 @@
     PlaylistEventInfoChange *msg = (PlaylistEventInfoChange *) hook_data;
 
     mainwin_set_song_info(msg->bitrate, msg->samplerate, msg->channels);
-
-    g_free(msg);
 }
 
 static void
@@ -293,7 +284,6 @@
     hook_associate("title change", ui_main_evlistener_title_change, NULL);
     hook_associate("hide seekbar", ui_main_evlistener_hide_seekbar, NULL);
     hook_associate("volume set", ui_main_evlistener_volume_change, NULL);
-    hook_associate("playback initiate", ui_main_evlistener_playback_initiate, NULL);
     hook_associate("playback begin", ui_main_evlistener_playback_begin, NULL);
     hook_associate("playback stop", ui_main_evlistener_playback_stop, NULL);
     hook_associate("playback pause", ui_main_evlistener_playback_pause, NULL);