# HG changeset patch # User yaz # Date 1180373321 25200 # Node ID 77a012c3b521f803d3e9874075d58351c912e50e # Parent 49f3d1b43518b59f6f00d69503076124e1e4a47a [svn] - give default values to audacious_remote_* functions. if dbus call fails, default value will be returned. - now audacious_rc_song_filename() calls str_to_utf8() to ensure that the string to return is in utf-8. diff -r 49f3d1b43518 -r 77a012c3b521 ChangeLog --- a/ChangeLog Mon May 28 03:25:22 2007 -0700 +++ b/ChangeLog Mon May 28 10:28:41 2007 -0700 @@ -1,3 +1,11 @@ +2007-05-28 10:25:22 +0000 William Pitcock + revision [4652] + - code cleanups involving SRC patch and indentation + + trunk/src/audacious/output.c | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + + 2007-05-28 10:16:56 +0000 William Pitcock revision [4650] - remove xmms-like plugin loader diff -r 49f3d1b43518 -r 77a012c3b521 src/audacious/build_stamp.c --- a/src/audacious/build_stamp.c Mon May 28 03:25:22 2007 -0700 +++ b/src/audacious/build_stamp.c Mon May 28 10:28:41 2007 -0700 @@ -1,2 +1,2 @@ #include -const gchar *svn_stamp = "20070528-4650"; +const gchar *svn_stamp = "20070528-4652"; diff -r 49f3d1b43518 -r 77a012c3b521 src/audacious/dbus.c --- a/src/audacious/dbus.c Mon May 28 03:25:22 2007 -0700 +++ b/src/audacious/dbus.c Mon May 28 10:28:41 2007 -0700 @@ -38,6 +38,7 @@ #include "memorypool.h" #include "titlestring.h" #include "ui_jumptotrack.h" +#include "strings.h" static DBusGConnection *dbus_conn = NULL; static guint signals[LAST_SIG] = { 0 }; @@ -469,7 +470,15 @@ gboolean audacious_rc_song_filename(RemoteObject *obj, guint pos, gchar **filename, GError **error) { - *filename = playlist_get_filename(playlist_get_active(), pos); + gchar *tmp = NULL; + tmp = playlist_get_filename(playlist_get_active(), pos); + + if(tmp){ + *filename = str_to_utf8(tmp); + } + free(tmp); + tmp = NULL; + return TRUE; } diff -r 49f3d1b43518 -r 77a012c3b521 src/audtool/handlers.c --- a/src/audtool/handlers.c Mon May 28 03:25:22 2007 -0700 +++ b/src/audtool/handlers.c Mon May 28 10:28:41 2007 -0700 @@ -54,8 +54,15 @@ void get_current_song_filename(gint argc, gchar **argv) { gint playpos = audacious_remote_get_playlist_pos(dbus_proxy); + gchar *file = audacious_remote_get_playlist_file(dbus_proxy, playpos); - g_print("%s\n", audacious_remote_get_playlist_file(dbus_proxy, playpos)); + if (!file) + { + g_print("No song playing.\n"); + return; + } + + g_print("%s\n", file); } void get_current_song_output_length(gint argc, gchar **argv) diff -r 49f3d1b43518 -r 77a012c3b521 src/libaudclient/audctrl.c --- a/src/libaudclient/audctrl.c Mon May 28 03:25:22 2007 -0700 +++ b/src/libaudclient/audctrl.c Mon May 28 10:28:41 2007 -0700 @@ -53,8 +53,7 @@ * Return value: The protocol version used by Audacious. **/ gint audacious_remote_get_version(DBusGProxy *proxy) { -//XXX - return 0; + return 0x09a3; // XXX should do actual dbus call. } /** @@ -121,7 +120,7 @@ * Return value: TRUE if playing, FALSE otherwise. **/ gboolean audacious_remote_is_playing(DBusGProxy *proxy) { - gboolean is_playing; + gboolean is_playing = FALSE; org_atheme_audacious_playing(proxy, &is_playing, &error); g_clear_error(&error); return is_playing; @@ -136,7 +135,7 @@ * Return value: TRUE if playing, FALSE otherwise. **/ gboolean audacious_remote_is_paused(DBusGProxy *proxy) { - gboolean is_paused; + gboolean is_paused = FALSE; org_atheme_audacious_paused(proxy, &is_paused, &error); g_clear_error(&error); return is_paused; @@ -151,7 +150,7 @@ * Return value: The current playlist position. **/ gint audacious_remote_get_playlist_pos(DBusGProxy *proxy) { - guint pos; + guint pos = 0; org_atheme_audacious_position(proxy, &pos, &error); g_clear_error(&error); return pos; @@ -178,7 +177,7 @@ * Return value: The amount of entries in the playlist. **/ gint audacious_remote_get_playlist_length(DBusGProxy *proxy) { - gint len; + gint len = 0; org_atheme_audacious_length(proxy, &len, &error); g_clear_error(&error); return len; @@ -204,7 +203,7 @@ * Return value: The current output position. **/ gint audacious_remote_get_output_time(DBusGProxy *proxy) { - guint time; + guint time = 0; org_atheme_audacious_time(proxy, &time, &error); g_clear_error(&error); return time; @@ -244,7 +243,7 @@ * Return value: The current volume. **/ gint audacious_remote_get_main_volume(DBusGProxy *proxy) { - gint vl, vr; + gint vl = 0, vr = 0; audacious_remote_get_volume(proxy, &vl, &vr); @@ -260,7 +259,7 @@ * Return value: The current balance. **/ gint audacious_remote_get_balance(DBusGProxy *proxy) { - gint balance; + gint balance = 50; org_atheme_audacious_balance(proxy, &balance, &error); g_clear_error(&error); return balance; @@ -288,7 +287,7 @@ * Sets the volume in Audacious. **/ void audacious_remote_set_main_volume(DBusGProxy *proxy, gint v) { - gint b, vl, vr; + gint b = 50, vl = 0, vr = 0; b = audacious_remote_get_balance(proxy); @@ -311,7 +310,7 @@ * Sets the balance in Audacious. **/ void audacious_remote_set_balance(DBusGProxy *proxy, gint b) { - gint v, vl, vr; + gint v = 0, vl = 0, vr = 0; if (b < -100) b = -100; @@ -365,7 +364,7 @@ * Return value: A path to the file in the playlist at %pos position. **/ gchar *audacious_remote_get_playlist_file(DBusGProxy *proxy, guint pos) { - gchar *out; + gchar *out = NULL; org_atheme_audacious_song_filename(proxy, pos, &out, &error); g_clear_error(&error); return out; @@ -381,7 +380,7 @@ * Return value: The title for the entry in the playlist at %pos position. **/ gchar *audacious_remote_get_playlist_title(DBusGProxy *proxy, guint pos) { - gchar *out; + gchar *out = NULL; org_atheme_audacious_song_title(proxy, pos, &out, &error); g_clear_error(&error); return out; @@ -397,7 +396,7 @@ * Return value: The length of the entry in the playlist at %pos position. **/ gint audacious_remote_get_playlist_time(DBusGProxy *proxy, guint pos) { - gint out; + gint out = 0; org_atheme_audacious_song_frames(proxy, pos, &out, &error); g_clear_error(&error); return out; @@ -426,8 +425,6 @@ * Toggles the main window's visibility. **/ void audacious_remote_main_win_toggle(DBusGProxy *proxy, gboolean show) { - const char* path = dbus_g_proxy_get_path(proxy); - g_print("path: %s\n", path); org_atheme_audacious_show_main_win(proxy, show, &error); g_clear_error(&error); } @@ -465,7 +462,7 @@ * Return value: TRUE if visible, FALSE otherwise. **/ gboolean audacious_remote_is_main_win(DBusGProxy *proxy) { - gboolean visible; + gboolean visible = TRUE; org_atheme_audacious_main_win_visible(proxy, &visible, &error); g_clear_error(&error); return visible; @@ -480,7 +477,7 @@ * Return value: TRUE if visible, FALSE otherwise. **/ gboolean audacious_remote_is_pl_win(DBusGProxy *proxy) { - gboolean visible; + gboolean visible = TRUE; org_atheme_audacious_playlist_visible(proxy, &visible, &error); g_clear_error(&error); return visible; @@ -495,7 +492,7 @@ * Return value: TRUE if visible, FALSE otherwise. **/ gboolean audacious_remote_is_eq_win(DBusGProxy *proxy) { - gboolean visible; + gboolean visible = FALSE; org_atheme_audacious_equalizer_visible(proxy, &visible, &error); g_clear_error(&error); return visible; @@ -809,7 +806,7 @@ * Return value: TRUE if yes, otherwise FALSE. **/ gboolean audacious_remote_is_advance(DBusGProxy *proxy) { - gboolean is_advance; + gboolean is_advance = FALSE; org_atheme_audacious_auto_advance(proxy, &is_advance, &error); g_clear_error(&error); return is_advance;