Mercurial > audlegacy
changeset 3928:366aa28f3ea2
Automated merge with ssh://hg.atheme.org//hg/audacious
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Mon, 12 Nov 2007 21:37:09 -0600 |
parents | 942a76b87306 (current diff) 05e6d9db003c (diff) |
children | fd6b3f983ff6 |
files | |
diffstat | 26 files changed, 451 insertions(+), 96 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/dbus-service.h Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/dbus-service.h Mon Nov 12 21:37:09 2007 -0600 @@ -184,9 +184,10 @@ gboolean audacious_rc_toggle_shuffle(RemoteObject *obj, GError **error); /* new */ -gboolean audacious_rc_show_prefs_box(RemoteObject *obj, GError **error); -gboolean audacious_rc_show_about_box(RemoteObject *obj, GError **error); -gboolean audacious_rc_show_jtf_box(RemoteObject *obj, GError **error); +gboolean audacious_rc_show_prefs_box(RemoteObject *obj, gboolean show, GError **error); +gboolean audacious_rc_show_about_box(RemoteObject *obj, gboolean show, GError **error); +gboolean audacious_rc_show_jtf_box(RemoteObject *obj, gboolean show, GError **error); +gboolean audacious_rc_show_filebrowser(RemoteObject *obj, gboolean show, GError **error); //new Nov 8 gboolean audacious_rc_play_pause(RemoteObject *obj, GError **error); gboolean audacious_rc_activate(RemoteObject *obj, GError **error); gboolean audacious_rc_queue_get_list_pos(RemoteObject *obj, gint qpos, gint *pos, GError **error); @@ -211,5 +212,6 @@ gboolean audacious_rc_set_eq(RemoteObject *obj, gdouble preamp, GArray *bands, GError **error); gboolean audacious_rc_set_eq_preamp(RemoteObject *obj, gdouble preamp, GError **error); gboolean audacious_rc_set_eq_band(RemoteObject *obj, gint band, gdouble value, GError **error); +gboolean audacious_rc_equalizer_activate(RemoteObject *obj, gboolean active, GError **error); #endif // !_DBUS_SERVICE_H
--- a/src/audacious/dbus.c Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/dbus.c Mon Nov 12 21:37:09 2007 -0600 @@ -46,6 +46,7 @@ #include "strings.h" #include "ui_credits.h" #include "skin.h" +#include "ui_fileopener.h" static DBusGConnection *dbus_conn = NULL; static guint signals[LAST_SIG] = { 0 }; @@ -801,20 +802,43 @@ } /* New on Oct 5 */ -gboolean audacious_rc_show_prefs_box(RemoteObject *obj, GError **error) { - if (has_x11_connection) - show_prefs_window(); +gboolean audacious_rc_show_prefs_box(RemoteObject *obj, gboolean show, GError **error) { + if (has_x11_connection) { + if (show) + show_prefs_window(); + else + hide_prefs_window(); + } return TRUE; } -gboolean audacious_rc_show_about_box(RemoteObject *obj, GError **error) { - if (has_x11_connection) - show_about_window(); +gboolean audacious_rc_show_about_box(RemoteObject *obj, gboolean show, GError **error) { + if (has_x11_connection) { + if (show) + show_about_window(); + else + hide_about_window(); + } return TRUE; } -gboolean audacious_rc_show_jtf_box(RemoteObject *obj, GError **error) { - if (has_x11_connection) - ui_jump_to_track(); +gboolean audacious_rc_show_jtf_box(RemoteObject *obj, gboolean show, GError **error) { + if (has_x11_connection) { + if (show) + ui_jump_to_track(); + else + ui_jump_to_track_hide(); + } + return TRUE; +} + +gboolean audacious_rc_show_filebrowser(RemoteObject *obj, gboolean show, GError **error) +{ + if (has_x11_connection) { + if (show) + run_filebrowser(FALSE); + else + hide_filebrowser(); + } return TRUE; } @@ -974,6 +998,7 @@ element = g_array_index(bands, gdouble, i); equalizerwin_set_band(i, (gfloat)element); } + equalizerwin_eq_changed(); return TRUE; } @@ -981,15 +1006,24 @@ gboolean audacious_rc_set_eq_preamp(RemoteObject *obj, gdouble preamp, GError **error) { equalizerwin_set_preamp((gfloat)preamp); + equalizerwin_eq_changed(); return TRUE; } gboolean audacious_rc_set_eq_band(RemoteObject *obj, gint band, gdouble value, GError **error) { equalizerwin_set_band(band, (gfloat)value); + equalizerwin_eq_changed(); return TRUE; } +gboolean audacious_rc_equalizer_activate(RemoteObject *obj, gboolean active, GError **error) +{ + equalizer_activate(active); + return TRUE; +} + + DBusGProxy *audacious_get_dbus_proxy(void) { DBusGConnection *connection = NULL;
--- a/src/audacious/objects.xml Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/objects.xml Mon Nov 12 21:37:09 2007 -0600 @@ -364,16 +364,25 @@ <!-- Show preferences window --> <method name="ShowPrefsBox"> <annotation name="org.freedesktop.DBus.GLib.NoReply" value=""/> + <arg type="b" name="show"/> </method> <!-- Show about window --> <method name="ShowAboutBox"> <annotation name="org.freedesktop.DBus.GLib.NoReply" value=""/> + <arg type="b" name="show"/> </method> <!-- Show jump to file window --> <method name="ShowJtfBox"> <annotation name="org.freedesktop.DBus.GLib.NoReply" value=""/> + <arg type="b" name="show"/> + </method> + + <!-- Show filebrowser --> + <method name="ShowFilebrowser"> + <annotation name="org.freedesktop.DBus.GLib.NoReply" value=""/> + <arg type="b" name="show"/> </method> <!-- Either play or pause --> @@ -495,5 +504,11 @@ <arg type="d" name="value"/> </method> + <!-- Activate/Deactivate Equalizer --> + <method name="EqualizerActivate"> + <annotation name="org.freedesktop.DBus.GLib.NoReply" value=""/> + <arg type="b" name="active"/> + </method> + </interface> </node>
--- a/src/audacious/playback.c Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/playback.c Mon Nov 12 21:37:09 2007 -0600 @@ -168,7 +168,7 @@ if (playback && playback->plugin->get_song_tuple) { Tuple *tuple = playback->plugin->get_song_tuple(playback->filename); if (tuple_get_value_type(tuple, FIELD_LENGTH, NULL) == TUPLE_INT) - return tuple_get_value_type(tuple, FIELD_LENGTH, NULL); + return tuple_get_int(tuple, FIELD_LENGTH, NULL); } return -1;
--- a/src/audacious/playlist.c Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/playlist.c Mon Nov 12 21:37:09 2007 -0600 @@ -451,6 +451,7 @@ playlist->entries = NULL; playlist->tail = NULL; playlist->attribute = PLAYLIST_PLAIN; + playlist->serial = 0; PLAYLIST_UNLOCK(playlist); } @@ -465,6 +466,7 @@ playlist_generate_shuffle_list(playlist); playlistwin_update_list(playlist); playlist_recalc_total_time(playlist); + PLAYLIST_INCR_SERIAL(playlist); playlist_manager_update(); } @@ -524,6 +526,7 @@ g_list_free_1(node); playlist_recalc_total_time_nolock(playlist); + PLAYLIST_INCR_SERIAL(playlist); } void @@ -549,6 +552,7 @@ PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); + PLAYLIST_INCR_SERIAL(playlist); playlistwin_update_list(playlist); if (restart_playing) { @@ -586,6 +590,7 @@ PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); + PLAYLIST_INCR_SERIAL(playlist); playlistwin_update_list(playlist); if (restart_playing) { @@ -626,6 +631,7 @@ PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); + PLAYLIST_INCR_SERIAL(playlist); if (restart_playing) { if (playlist->position) @@ -658,6 +664,7 @@ playlist_get_info_scan_active = TRUE; g_mutex_unlock(mutex_scan); g_cond_signal(cond_scan); + PLAYLIST_INCR_SERIAL(playlist); } static void @@ -750,6 +757,7 @@ g_mutex_unlock(mutex_scan); g_cond_signal(cond_scan); } + PLAYLIST_INCR_SERIAL(playlist); } gboolean @@ -985,7 +993,6 @@ { guint entries; entries = playlist_ins_url(playlist, url, -1); -// printf("playlist_add_url: entries = %d\n", entries); return entries; } @@ -1038,8 +1045,6 @@ g_return_val_if_fail(playlist != NULL, 0); g_return_val_if_fail(string != NULL, 0); -// playlistwin_update_list(playlist); // is this necessary? --yaz - while (*string) { GList *node; guint i = 0; @@ -1081,6 +1086,7 @@ } playlist_recalc_total_time(playlist); + PLAYLIST_INCR_SERIAL(playlist); //probably necessary because there is no underlying __playlist_ins --yaz playlist_generate_shuffle_list(playlist); playlistwin_update_list(playlist); @@ -1145,6 +1151,7 @@ } playlist_recalc_total_time(playlist); + PLAYLIST_INCR_SERIAL(playlist); //tentative --yaz mainwin_set_song_info(rate, freq, nch); @@ -1714,7 +1721,6 @@ pr = input_check_file(filename, FALSE); __playlist_ins_with_info(playlist, filename, pos, title, len, pr ? pr->ip : NULL); - g_free(pr); return; } @@ -1741,7 +1747,6 @@ pr = input_check_file(filename, FALSE); __playlist_ins_with_info(playlist, filename, pos, title, len, pr ? pr->ip : NULL); - g_free(pr); } @@ -1782,7 +1787,6 @@ pr = input_check_file(filename, FALSE); __playlist_ins_with_info_tuple(playlist, filename, pos, tuple, pr ? pr->ip : NULL); - g_free(pr); return; } @@ -1850,6 +1854,9 @@ playlistwin_update_list(playlist); playlist_manager_update(); + playlist_recalc_total_time(playlist); //tentative --yaz + PLAYLIST_INCR_SERIAL(playlist); + return new_len - old_len; } @@ -2793,6 +2800,7 @@ playlist_generate_shuffle_list(playlist); playlistwin_update_list(playlist); playlist_recalc_total_time(playlist); + PLAYLIST_INCR_SERIAL(playlist); playlist_manager_update(); } @@ -2912,6 +2920,7 @@ playlistwin_update_list(playlist); playlist_recalc_total_time(playlist); + PLAYLIST_INCR_SERIAL(playlist); playlist_manager_update(); } @@ -2931,7 +2940,6 @@ PLAYLIST_UNLOCK(playlist); } - static void playlist_recalc_total_time_nolock(Playlist *playlist) { @@ -3140,6 +3148,7 @@ PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); +// PLAYLIST_INCR_SERIAL(playlist); //unnecessary? --yaz return num_of_entries_found; } @@ -3253,6 +3262,7 @@ playlistwin_update_list(playlist); playlist_recalc_total_time(playlist); + PLAYLIST_INCR_SERIAL(playlist); //tentative --yaz return retval; } @@ -3275,6 +3285,7 @@ playlistwin_update_list(playlist); playlist_recalc_total_time(playlist); + PLAYLIST_INCR_SERIAL(playlist); //tentative --yaz } Playlist * @@ -3315,6 +3326,9 @@ playlist->title = NULL; playlist->filename = NULL; playlist_clear(playlist); + playlist->tail = NULL; + playlist->attribute = PLAYLIST_PLAIN; + playlist->serial = 0; return playlist; } @@ -3327,6 +3341,7 @@ g_mutex_free( playlist->mutex ); g_free( playlist ); + playlist = NULL; //XXX lead to crash? --yaz } Playlist *
--- a/src/audacious/playlist.h Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/playlist.h Mon Nov 12 21:37:09 2007 -0600 @@ -94,8 +94,9 @@ gboolean pl_selection_more; gboolean loading_playlist; GMutex *mutex; /* this is required for multiple playlist */ - GList *tail; /* marker for the last element in playlist->entries */ + GList *tail; /* marker for the last element in playlist->entries */ gint attribute; /* PlaylistAttribute */ + gulong serial; /* serial number */ }; typedef enum { @@ -223,8 +224,9 @@ gboolean is_playlist_name(const gchar * filename); -#define PLAYLIST_LOCK(pl) g_mutex_lock(pl->mutex) -#define PLAYLIST_UNLOCK(pl) g_mutex_unlock(pl->mutex) +#define PLAYLIST_LOCK(pl) g_mutex_lock((pl)->mutex) +#define PLAYLIST_UNLOCK(pl) g_mutex_unlock((pl)->mutex) +#define PLAYLIST_INCR_SERIAL(pl) (pl)->serial++ G_LOCK_EXTERN(playlists);
--- a/src/audacious/skin.c Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/skin.c Mon Nov 12 21:37:09 2007 -0600 @@ -1624,6 +1624,10 @@ if (pixmap) ui_skinned_playstatus_set_size(mainwin_playstatus, 11, pixmap->height); + pixmap = skin_get_pixmap(skin, SKIN_EQMAIN); + if (pixmap->height >= 313) + gtk_widget_show(equalizerwin_graph); + return error; } @@ -1744,6 +1748,10 @@ gdk_draw_drawable(drawable, gc, skin_get_pixmap(bmp_active_skin, SKIN_MAIN)->pixmap, 164 + xdest, 89, xdest, ydest, width, height); width = pixmap->width - xsrc; + } else if (pixmap_id == SKIN_EQMAIN) { + /* there are skins which EQMAIN doesn't include pixmap for equalizer graph */ + if (pixmap->height != 313) /* skins with EQMAIN which is 313 in height seems to display ok */ + gtk_widget_hide(equalizerwin_graph); } else return; }
--- a/src/audacious/ui_about.c Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/ui_about.c Mon Nov 12 21:37:09 2007 -0600 @@ -203,3 +203,10 @@ gtk_widget_show_all(about_window); gtk_window_present(GTK_WINDOW(about_window)); } + +void +hide_about_window(void) +{ + g_return_if_fail(about_window); + gtk_widget_hide(GTK_WIDGET(about_window)); +}
--- a/src/audacious/ui_credits.h Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/ui_credits.h Mon Nov 12 21:37:09 2007 -0600 @@ -3,6 +3,7 @@ #define ABOUT_H void show_about_window(void); +void hide_about_window(void); void show_credits_window(void); #endif
--- a/src/audacious/ui_equalizer.c Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/ui_equalizer.c Mon Nov 12 21:37:09 2007 -0600 @@ -74,6 +74,7 @@ GtkWidget *equalizerwin; +GtkWidget *equalizerwin_graph; static GtkWidget *equalizerwin_load_window = NULL; static GtkWidget *equalizerwin_load_auto_window = NULL; @@ -87,7 +88,6 @@ static GtkWidget *equalizerwin_on, *equalizerwin_auto; static GtkWidget *equalizerwin_close, *equalizerwin_presets, *equalizerwin_shade; -static GtkWidget *equalizerwin_graph; static GtkWidget *equalizerwin_preamp,*equalizerwin_bands[10]; static GtkWidget *equalizerwin_volume, *equalizerwin_balance; @@ -1515,3 +1515,13 @@ G_CALLBACK(equalizerwin_delete_auto_delete), NULL); } + +void +equalizer_activate(gboolean active) +{ + cfg.equalizer_active = active; + UI_SKINNED_BUTTON(equalizerwin_on)->inside = active; + gtk_widget_queue_draw(equalizerwin_on); + + equalizerwin_eq_changed(); +}
--- a/src/audacious/ui_equalizer.h Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/ui_equalizer.h Mon Nov 12 21:37:09 2007 -0600 @@ -58,6 +58,9 @@ gboolean equalizerwin_has_focus(void); extern GtkWidget *equalizerwin; +extern GtkWidget *equalizerwin_graph; extern gboolean equalizerwin_focus; +void equalizer_activate(gboolean active); + #endif
--- a/src/audacious/ui_fileopener.c Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/ui_fileopener.c Mon Nov 12 21:37:09 2007 -0600 @@ -108,8 +108,8 @@ return FALSE; } -void -util_run_filebrowser_gtk2style(gboolean play_button) +static void +util_run_filebrowser_gtk2style(gboolean play_button, gboolean show) { static GtkWidget *window = NULL; GtkWidget *vbox, *hbox, *bbox; @@ -119,9 +119,19 @@ gchar *window_title, *toggle_text; gpointer action_stock, storage; - if(window) { - gtk_window_present(GTK_WINDOW(window)); /* raise filebrowser */ - return; + if(!show) { + if(window){ + gtk_widget_hide(window); + return; + } + else + return; + } + else { + if(window) { + gtk_window_present(GTK_WINDOW(window)); /* raise filebrowser */ + return; + } } window_title = play_button ? _("Open Files") : _("Add Files"); @@ -339,17 +349,27 @@ gtk_entry_set_text(GTK_ENTRY(filesel->selection_entry), ""); } -void -util_run_filebrowser_classic(gboolean play_button) +static void +util_run_filebrowser_classic(gboolean play_button, gboolean show) { static GtkWidget *dialog; GtkWidget *button_add_selected, *button_add_all, *button_close, *button_add; char *title; - if (dialog != NULL) { - gtk_window_present(GTK_WINDOW(dialog)); - return; + if (!show) { + if(dialog) { + gtk_widget_hide(dialog); + return; + } + else + return; + } + else { + if (dialog) { + gtk_window_present(GTK_WINDOW(dialog)); + return; + } } if (play_button) @@ -450,7 +470,16 @@ run_filebrowser(gboolean play_button) { if (!cfg.use_xmms_style_fileselector) - util_run_filebrowser_gtk2style(play_button); + util_run_filebrowser_gtk2style(play_button, TRUE); else - util_run_filebrowser_classic(play_button); + util_run_filebrowser_classic(play_button, TRUE); } + +void +hide_filebrowser(void) +{ + if (!cfg.use_xmms_style_fileselector) + util_run_filebrowser_gtk2style(FALSE, FALSE); + else + util_run_filebrowser_classic(FALSE, FALSE); +}
--- a/src/audacious/ui_fileopener.h Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/ui_fileopener.h Mon Nov 12 21:37:09 2007 -0600 @@ -26,5 +26,6 @@ #define PLAY_BUTTON TRUE void run_filebrowser(gboolean clear_pl_on_ok); +void hide_filebrowser(void); #endif
--- a/src/audacious/ui_jumptotrack.c Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/ui_jumptotrack.c Mon Nov 12 21:37:09 2007 -0600 @@ -80,6 +80,7 @@ #include "ui_skinned_window.h" static GtkWidget *jump_to_track_win = NULL; +static gulong serial = 0; static void change_song(guint pos) @@ -91,6 +92,13 @@ playback_initiate(); } +void +ui_jump_to_track_hide(void) +{ + g_return_if_fail(jump_to_track_win); + gtk_widget_hide(jump_to_track_win); +} + static void ui_jump_to_track_jump(GtkTreeView * treeview) { @@ -109,11 +117,8 @@ change_song(pos - 1); - /* FIXME: should only hide window */ - if(cfg.close_jtf_dialog){ - gtk_widget_destroy(jump_to_track_win); - jump_to_track_win = NULL; - } + if(cfg.close_jtf_dialog) + ui_jump_to_track_hide(); } static void @@ -212,9 +217,7 @@ { switch (event->keyval) { case GDK_Escape: - /* FIXME: show only hide window */ - gtk_widget_destroy(jump_to_track_win); - jump_to_track_win = NULL; + ui_jump_to_track_hide(); return TRUE; case GDK_KP_Enter: ui_jump_to_track_queue_cb(NULL, data); @@ -247,12 +250,9 @@ return rv; } -/* FIXME: Clear the entry when the list gets updated */ void ui_jump_to_track_update(GtkWidget * widget, gpointer user_data) { - /* FIXME: Is not in sync with playlist due to delayed extinfo - * reading */ guint row; GList *playlist_glist; gchar *desc_buf = NULL; @@ -262,10 +262,18 @@ GtkTreeModel *store; + GtkTreeView *tree = GTK_TREE_VIEW(g_object_get_data(user_data, "treeview")); + GtkEntry *edit = g_object_get_data(user_data, "edit"); + if (!jump_to_track_win) return; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(user_data)); + /* clear edit widget */ + if(edit){ + gtk_entry_set_text(edit, "\0"); + } + + store = gtk_tree_view_get_model(tree); gtk_list_store_clear(GTK_LIST_STORE(store)); row = 1; @@ -296,8 +304,9 @@ } gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter); - selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(user_data)); + selection = gtk_tree_view_get_selection(tree); gtk_tree_selection_select_iter(selection, &iter); + serial = playlist->serial; // important. --yaz } static void @@ -443,11 +452,9 @@ gtk_list_store_clear(jtf_store); row = 1; - playlist = playlist_get_active(); PLAYLIST_LOCK(playlist); - for (playlist_glist = playlist->entries; playlist_glist; playlist_glist = g_list_next(playlist_glist)) { @@ -470,36 +477,50 @@ 0, row, 1, desc_buf, -1); row++; - if (desc_buf) { - g_free(desc_buf); - desc_buf = NULL; - } + g_free(desc_buf); + desc_buf = NULL; } - PLAYLIST_UNLOCK(playlist); /* attach liststore to treeview */ gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL(jtf_store)); g_object_unref(jtf_store); + serial = playlist->serial; return FALSE; } +static gboolean +watchdog(gpointer storage) +{ + GtkWidget *widget; + Playlist *playlist = playlist_get_active(); + + if(serial == playlist->serial) + return TRUE; + + widget = g_object_get_data(storage, "widget"); + ui_jump_to_track_update(widget, storage); + return TRUE; +} + void ui_jump_to_track(void) { GtkWidget *scrollwin; GtkWidget *vbox, *bbox, *sep; GtkWidget *toggle; - GtkWidget *jump, *queue, *cancel; + GtkWidget *jump, *queue, *close; GtkWidget *rescan, *edit; GtkWidget *search_label, *hbox; - GtkWidget *treeview; + GtkWidget *treeview = NULL; GtkListStore *jtf_store; GtkCellRenderer *renderer; GtkTreeViewColumn *column; + gpointer storage; + if (jump_to_track_win) { gtk_window_present(GTK_WINDOW(jump_to_track_win)); return; @@ -612,8 +633,16 @@ rescan = gtk_button_new_from_stock(GTK_STOCK_REFRESH); gtk_box_pack_start(GTK_BOX(bbox), rescan, FALSE, FALSE, 0); + + /* pack to container */ + storage = g_object_new(G_TYPE_OBJECT, NULL); + g_object_set_data(storage, "widget", rescan); + g_object_set_data(storage, "treeview", treeview); + g_object_set_data(storage, "edit", edit); + g_signal_connect(rescan, "clicked", - G_CALLBACK(ui_jump_to_track_update), treeview); + G_CALLBACK(ui_jump_to_track_update), storage); + GTK_WIDGET_SET_FLAGS(rescan, GTK_CAN_DEFAULT); gtk_widget_grab_default(rescan); @@ -627,14 +656,18 @@ GTK_WIDGET_SET_FLAGS(jump, GTK_CAN_DEFAULT); gtk_widget_grab_default(jump); - cancel = gtk_button_new_from_stock(GTK_STOCK_CLOSE); - gtk_box_pack_start(GTK_BOX(bbox), cancel, FALSE, FALSE, 0); - g_signal_connect_swapped(cancel, "clicked", - G_CALLBACK(gtk_widget_destroy), - jump_to_track_win); - GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); + close = gtk_button_new_from_stock(GTK_STOCK_CLOSE); + gtk_box_pack_start(GTK_BOX(bbox), close, FALSE, FALSE, 0); +/* g_signal_connect_swapped(close, "clicked", */ +/* G_CALLBACK(gtk_widget_destroy), */ +/* jump_to_track_win); */ + g_signal_connect_swapped(close, "clicked", + G_CALLBACK(gtk_widget_hide), + jump_to_track_win); // just hide --yaz + GTK_WIDGET_SET_FLAGS(close, GTK_CAN_DEFAULT); g_timeout_add(100, (GSourceFunc)ui_jump_to_track_fill, treeview); + g_timeout_add(500, (GSourceFunc)watchdog, storage); gtk_widget_show_all(jump_to_track_win); gtk_widget_grab_focus(edit);
--- a/src/audacious/ui_jumptotrack.h Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/ui_jumptotrack.h Mon Nov 12 21:37:09 2007 -0600 @@ -28,5 +28,6 @@ extern void ui_jump_to_track_update(GtkWidget * widget, gpointer user_data); extern void ui_jump_to_track(void); +extern void ui_jump_to_track_hide(void); #endif
--- a/src/audacious/ui_preferences.c Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/ui_preferences.c Mon Nov 12 21:37:09 2007 -0600 @@ -2182,6 +2182,13 @@ } } +void +hide_prefs_window(void) +{ + g_return_if_fail(prefswin); + gtk_widget_hide(GTK_WIDGET(prefswin)); +} + static void prefswin_page_queue_new(GtkWidget *container, gchar *name, gchar *imgurl) {
--- a/src/audacious/ui_preferences.h Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/ui_preferences.h Mon Nov 12 21:37:09 2007 -0600 @@ -22,6 +22,7 @@ void create_prefs_window(void); void show_prefs_window(void); +void hide_prefs_window(void); gint prefswin_page_new(GtkWidget *container, gchar *name, gchar *imgurl); void prefswin_page_destroy(GtkWidget *container);
--- a/src/audacious/ui_skinned_playstatus.c Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/ui_skinned_playstatus.c Mon Nov 12 21:37:09 2007 -0600 @@ -190,20 +190,20 @@ if (playstatus->status == STATUS_STOP && playstatus->buffering == TRUE) playstatus->buffering = FALSE; if (playstatus->status == STATUS_PLAY && playstatus->buffering == TRUE) - skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 39, 0, 0, 0, 3, 9); + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 39, 0, 0, 0, 3, playstatus->height); else if (playstatus->status == STATUS_PLAY) - skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 36, 0, 0, 0, 3, 9); + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 36, 0, 0, 0, 3, playstatus->height); else - skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 27, 0, 0, 0, 2, 9); + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 27, 0, 0, 0, 2, playstatus->height); switch (playstatus->status) { case STATUS_STOP: - skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 18, 0, 2, 0, 9, 9); + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 18, 0, 2, 0, 9, playstatus->height); break; case STATUS_PAUSE: - skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 9, 0, 2, 0, 9, 9); + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 9, 0, 2, 0, 9, playstatus->height); break; case STATUS_PLAY: - skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 1, 0, 3, 0, 8, 9); + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 1, 0, 3, 0, 8, playstatus->height); break; }
--- a/src/audacious/ui_skinned_window.c Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audacious/ui_skinned_window.c Mon Nov 12 21:37:09 2007 -0600 @@ -102,6 +102,8 @@ window->x = event->x; window->y = event->y; + gtk_window_set_keep_above(GTK_WINDOW(widget), cfg.always_on_top); + return FALSE; }
--- a/src/audtool/audtool.h Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audtool/audtool.h Mon Nov 12 21:37:09 2007 -0600 @@ -107,6 +107,7 @@ extern void equalizer_show(gint, gchar **); extern void show_preferences_window(gint, gchar **); extern void show_jtf_window(gint, gchar **); +extern void show_filebrowser(gint, gchar **); extern void shutdown_audacious_server(gint, gchar **); extern void show_about_window(gint, gchar **); @@ -129,5 +130,6 @@ extern void test_set_eq(gint argc, gchar **argv); extern void test_set_eq_preamp(gint argc, gchar **argv); extern void test_set_eq_band(gint argc, gchar **argv); +void test_equalizer_active(gint argc, gchar **argv); #endif
--- a/src/audtool/audtool_handlers_general.c Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audtool/audtool_handlers_general.c Mon Nov 12 21:37:09 2007 -0600 @@ -128,17 +128,113 @@ void show_preferences_window(gint argc, gchar **argv) { - audacious_remote_show_prefs_box(dbus_proxy); + gboolean show = TRUE; + + if (argc < 2) { +#if 0 + audtool_whine("invalid parameter for %s.", argv[0]); + audtool_whine("syntax: %s <on/off>", argv[0]); + exit(1); +#else + audacious_remote_toggle_prefs_box(dbus_proxy, show); + return; +#endif + } + + if (!g_ascii_strcasecmp(argv[1], "on")) + show = TRUE; + else if (!g_ascii_strcasecmp(argv[1], "off")) + show = FALSE; + else { + audtool_whine("invalid parameter for %s.", argv[0]); + audtool_whine("syntax: %s <on/off>", argv[0]); + exit (1); + } + + audacious_remote_toggle_prefs_box(dbus_proxy, show); } void show_about_window(gint argc, gchar **argv) { - audacious_remote_show_about_box(dbus_proxy); + gboolean show = TRUE; + + if (argc < 2) { +#if 0 + audtool_whine("invalid parameter for %s.", argv[0]); + audtool_whine("syntax: %s <on/off>", argv[0]); + exit(1); +#else + audacious_remote_toggle_about_box(dbus_proxy, show); + return; +#endif + } + + if (!g_ascii_strcasecmp(argv[1], "on")) + show = TRUE; + else if (!g_ascii_strcasecmp(argv[1], "off")) + show = FALSE; + else { + audtool_whine("invalid parameter for %s.", argv[0]); + audtool_whine("syntax: %s <on/off>", argv[0]); + exit (1); + } + + audacious_remote_toggle_about_box(dbus_proxy, show); } void show_jtf_window(gint argc, gchar **argv) { - audacious_remote_show_jtf_box(dbus_proxy); + gboolean show = TRUE; + + if (argc < 2) { +#if 0 + audtool_whine("invalid parameter for %s.", argv[0]); + audtool_whine("syntax: %s <on/off>", argv[0]); + exit(1); +#else + audacious_remote_toggle_jtf_box(dbus_proxy, show); + return; +#endif + } + if (!g_ascii_strcasecmp(argv[1], "on")) + show = TRUE; + else if (!g_ascii_strcasecmp(argv[1], "off")) + show = FALSE; + else { + audtool_whine("invalid parameter for %s.", argv[0]); + audtool_whine("syntax: %s <on/off>", argv[0]); + exit (1); + } + + audacious_remote_toggle_jtf_box(dbus_proxy, show); +} + +void show_filebrowser(gint argc, gchar **argv) +{ + gboolean show = TRUE; + + if (argc < 2) { +#if 0 + audtool_whine("invalid parameter for %s.", argv[0]); + audtool_whine("syntax: %s <on/off>", argv[0]); + exit(1); +#else + audacious_remote_toggle_filebrowser(dbus_proxy, show); + return; +#endif + } + + if (!g_ascii_strcasecmp(argv[1], "on")) + show = TRUE; + else if (!g_ascii_strcasecmp(argv[1], "off")) + show = FALSE; + else { + audtool_whine("invalid parameter for %s.", argv[0]); + audtool_whine("syntax: %s <on/off>", argv[0]); + exit (1); + } + + audacious_remote_toggle_filebrowser(dbus_proxy, show); } void shutdown_audacious_server(gint argc, gchar **argv)
--- a/src/audtool/audtool_handlers_playlist.c Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audtool/audtool_handlers_playlist.c Mon Nov 12 21:37:09 2007 -0600 @@ -295,6 +295,7 @@ void playlist_clear(gint argc, gchar **argv) { + audacious_remote_stop(dbus_proxy); audacious_remote_playlist_clear(dbus_proxy); }
--- a/src/audtool/audtool_handlers_test.c Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audtool/audtool_handlers_test.c Mon Nov 12 21:37:09 2007 -0600 @@ -229,3 +229,22 @@ audacious_remote_set_eq_band(dbus_proxy, band, preamp); } + +void test_equalizer_active(gint argc, gchar **argv) +{ + if (argc < 2) + { + audtool_whine("invalid parameters for %s.", argv[0]); + audtool_whine("syntax: %s <on/off>", argv[0]); + exit(1); + } + + if (!g_ascii_strcasecmp(argv[1], "on")) { + audacious_remote_eq_activate(dbus_proxy, TRUE); + return; + } + else if (!g_ascii_strcasecmp(argv[1], "off")) { + audacious_remote_eq_activate(dbus_proxy, FALSE); + return; + } +}
--- a/src/audtool/audtool_main.c Mon Nov 12 21:36:26 2007 -0600 +++ b/src/audtool/audtool_main.c Mon Nov 12 21:37:09 2007 -0600 @@ -100,9 +100,12 @@ {"mainwin-show", mainwin_show, "shows/hides the main window", 1}, {"playlist-show", playlist_show, "shows/hides the playlist window", 1}, {"equalizer-show", equalizer_show, "shows/hides the equalizer window", 1}, - {"preferences", show_preferences_window, "shows the preferences window", 0}, - {"about", show_about_window, "shows the about window", 0}, - {"jumptofile", show_jtf_window, "shows the jump to file window", 0}, + + {"preferences-show", show_preferences_window, "shows/hides the preferences window", 1}, + {"about-show", show_about_window, "shows/hides the about window", 1}, + {"jumptofile-show", show_jtf_window, "shows/hides the jump to file window", 1}, + {"filebrowser-show", show_filebrowser, "shows/hides the filebrowser", 1}, + {"shutdown", shutdown_audacious_server, "shuts down audacious", 0}, {"<sep>", NULL, "Help system", 0}, {"list-handlers", get_handlers_list, "shows handlers list", 0}, @@ -110,23 +113,24 @@ /* test suite */ {"<sep>", NULL, "Test suite", 0}, - {"activate", test_activate, "activate", 0}, - {"playlist-addurl-to-new-playlist", test_enqueue_to_temp, "adds a url to the newly created playlist", 1}, + {"activate", test_activate, "activate audacious", 0}, {"always-on-top", test_toggle_aot, "on/off always on top", 1}, + {"get-version", test_get_version, "get the version string of audacious", 0}, + {"get-info", test_get_info, "get info", 0}, {"get-skin", test_get_skin, "get skin", 0}, {"set-skin", test_set_skin, "set skin", 1}, - {"get-info", test_get_info, "get info", 0}, + {"playlist-addurl-to-new-playlist", test_enqueue_to_temp, "adds a url to the newly created playlist", 1}, {"playlist-insurl", test_ins_url_string, "inserts a url at specified position in the playlist", 2}, - {"get-version", test_get_version, "get version of audacious", 0}, /* test suite for equalizer */ - {"get-eq", test_get_eq, "get equalizer", 0}, - {"get-eq-preamp", test_get_eq_preamp, "get equalizer pre-amplitude", 0}, - {"get-eq-band", test_get_eq_band, "get equalizer bands", 1}, - {"set-eq", test_set_eq, "set equalizer", 11}, - {"set-eq-preamp", test_set_eq_preamp, "set equalizer pre-amplitude", 1}, - {"set-eq-band", test_set_eq_band, "set equalizer bands", 2}, - + {"equalizer-get", test_get_eq, "get the equalizer settings", 0}, + {"equalizer-get-preamp", test_get_eq_preamp, "get the equalizer pre-amplification", 0}, + {"equalizer-get-band", test_get_eq_band, "get the equalizer value in specified band", 1}, + {"equalizer-set", test_set_eq, "set the equalizer settings", 11}, + {"equalizer-set-preamp", test_set_eq_preamp, "set the equalizer pre-amplification", 1}, + {"equalizer-set-band", test_set_eq_band, "set the equalizer value in the specified band", 2}, + {"equalizer-activate", test_equalizer_active, "activate/deactivate the equalizer", 1}, + {NULL, NULL, NULL, 0} }; @@ -167,7 +171,7 @@ mowgli_error_context_push(e, "While processing the commandline"); if (argc < 2) - mowgli_error_context_display_with_error(e, ":\n * ", "not enough parameters, use audtool --help for more information."); + mowgli_error_context_display_with_error(e, ":\n * ", "not enough parameters, use \'audtool help\' for more information."); for (j = 1; j < argc; j++) { @@ -177,17 +181,18 @@ !g_ascii_strcasecmp(g_strconcat("--", handlers[i].name, NULL), argv[j])) && g_ascii_strcasecmp("<sep>", handlers[i].name)) { -// handlers[i].handler(handlers[i].args + 1, &argv[j]); - handlers[i].handler(handlers[i].args + 1 < argc - 1 ? handlers[i].args + 1 : argc - 1, - &argv[j]); // to enable argc check --yaz + int numargs = handlers[i].args + 1 < argc - 1 ? handlers[i].args + 1 : argc - 1; + handlers[i].handler(numargs, &argv[j]); j += handlers[i].args; k++; + if(j >= argc) + break; } } } if (k == 0) - mowgli_error_context_display_with_error(e, ":\n * ", g_strdup_printf("Unknown command `%s' encountered, use audtool --help for a command list.", argv[1])); + mowgli_error_context_display_with_error(e, ":\n * ", g_strdup_printf("Unknown command '%s' encountered, use \'audtool help\' for a command list.", argv[1])); return 0; }
--- a/src/libaudclient/audctrl.c Mon Nov 12 21:36:26 2007 -0600 +++ b/src/libaudclient/audctrl.c Mon Nov 12 21:37:09 2007 -0600 @@ -535,7 +535,18 @@ * Tells audacious to show the preferences pane. **/ void audacious_remote_show_prefs_box(DBusGProxy *proxy) { - org_atheme_audacious_show_prefs_box(proxy, &error); + audacious_remote_toggle_prefs_box(proxy, TRUE); +} + +/** + * audacious_remote_toggle_prefs_box: + * @proxy: DBus proxy for audacious + * @show: shows/hides + * + * Tells audacious to show/hide the preferences pane. + **/ +void audacious_remote_toggle_prefs_box(DBusGProxy *proxy, gboolean show) { + org_atheme_audacious_show_prefs_box(proxy, show, &error); g_clear_error(&error); } @@ -546,7 +557,18 @@ * Tells audacious to show the about box. **/ void audacious_remote_show_about_box(DBusGProxy *proxy) { - org_atheme_audacious_show_about_box(proxy, &error); + audacious_remote_toggle_about_box(proxy, TRUE); +} + +/** + * audacious_remote_toggle_about_box: + * @proxy: DBus proxy for audacious + * @show: shows/hides + * + * Tells audacious to show/hide the about box. + **/ +void audacious_remote_toggle_about_box(DBusGProxy *proxy, gboolean show) { + org_atheme_audacious_show_about_box(proxy, show, &error); g_clear_error(&error); } @@ -885,7 +907,30 @@ * Tells audacious to show the Jump-to-File pane. **/ void audacious_remote_show_jtf_box(DBusGProxy *proxy) { - org_atheme_audacious_show_jtf_box(proxy, &error); + audacious_remote_toggle_jtf_box(proxy, TRUE); +} + +/** + * audacious_remote_toggle_jtf_box: + * @proxy: DBus proxy for audacious + * @show: shows/hides jtf pane + * + * Tells audacious to show/hide the Jump-to-File pane. + **/ +void audacious_remote_toggle_jtf_box(DBusGProxy *proxy, gboolean show) { + org_atheme_audacious_show_jtf_box(proxy, show, &error); + g_clear_error(&error); +} + +/** + * audacious_remote_toggle_filebrowser: + * @proxy: DBus proxy for audacious + * @show: shows/hides filebrowser + * + * Tells audacious to show the filebrowser dialog. + **/ +void audacious_remote_toggle_filebrowser(DBusGProxy *proxy, gboolean show) { + org_atheme_audacious_show_filebrowser(proxy, show, &error); g_clear_error(&error); } @@ -1003,3 +1048,14 @@ return s; } +/** + * audacious_remote_eq_activate: + * @proxy: DBus proxy for audacious + * @active: Whether or not to activate the equalizer. + * + * Toggles the equalizer. + **/ +void audacious_remote_eq_activate(DBusGProxy *proxy, gboolean active) { + org_atheme_audacious_equalizer_activate (proxy, active, &error); + g_clear_error(&error); +}
--- a/src/libaudclient/audctrl.h Mon Nov 12 21:36:26 2007 -0600 +++ b/src/libaudclient/audctrl.h Mon Nov 12 21:37:09 2007 -0600 @@ -121,6 +121,11 @@ guint pos); /* Added in Audacious 1.4 */ void audacious_remote_show_about_box(DBusGProxy *proxy); + void audacious_remote_toggle_about_box(DBusGProxy *proxy, gboolean show); + void audacious_remote_toggle_jtf_box(DBusGProxy *proxy, gboolean show); + void audacious_remote_toggle_prefs_box(DBusGProxy *proxy, gboolean show); + void audacious_remote_toggle_filebrowser(DBusGProxy *proxy, gboolean show); + void audacious_remote_eq_activate(DBusGProxy *proxy, gboolean active); #ifdef __cplusplus };