Mercurial > audlegacy
changeset 3165:8775dfc57ead trunk
Remove mainwin_set_info_text() craq. Still some work to do.
author | William Pitcock <nenolod@atheme-project.org> |
---|---|
date | Wed, 25 Jul 2007 15:46:00 -0500 |
parents | 03ff51c6412f |
children | 56121fc7a4cb |
files | src/audacious/Makefile src/audacious/auddrct.c src/audacious/dbus.c src/audacious/input.c src/audacious/input.h src/audacious/main.c src/audacious/playback.c src/audacious/playlist.c src/audacious/pluginenum.c src/audacious/ui_main.c src/audacious/ui_main_evlisteners.c src/audacious/ui_main_evlisteners.h src/audacious/ui_playlist.c src/audacious/ui_preferences.c |
diffstat | 14 files changed, 94 insertions(+), 84 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/Makefile Tue Jul 24 13:17:23 2007 -0500 +++ b/src/audacious/Makefile Wed Jul 25 15:46:00 2007 -0500 @@ -106,6 +106,7 @@ ui_jumptotrack.c \ ui_lastfm.c\ ui_main.c \ + ui_main_evlisteners.c \ ui_manager.c \ ui_playlist.c \ ui_playlist_manager.c \
--- a/src/audacious/auddrct.c Tue Jul 24 13:17:23 2007 -0500 +++ b/src/audacious/auddrct.c Wed Jul 25 15:46:00 2007 -0500 @@ -361,7 +361,6 @@ { playlist_clear(playlist_get_active()); mainwin_clear_song_info(); - mainwin_set_info_text(); return; }
--- a/src/audacious/dbus.c Tue Jul 24 13:17:23 2007 -0500 +++ b/src/audacious/dbus.c Wed Jul 25 15:46:00 2007 -0500 @@ -578,7 +578,6 @@ gboolean audacious_rc_clear(RemoteObject *obj, GError **error) { playlist_clear(playlist_get_active()); mainwin_clear_song_info(); - mainwin_set_info_text(); return TRUE; }
--- a/src/audacious/input.c Tue Jul 24 13:17:23 2007 -0500 +++ b/src/audacious/input.c Wed Jul 25 15:46:00 2007 -0500 @@ -75,8 +75,6 @@ static GList *vis_list = NULL; -gchar *input_info_text = NULL; - InputPlayback * get_current_input_playback(void) { @@ -829,19 +827,12 @@ vis_send_data(NULL, 0, 0); } - -gchar * -input_get_info_text(void) +/* FIXME: move this somewhere else */ +void +input_set_info_text(gchar *text) { - return g_strdup(input_info_text); -} - -void -input_set_info_text(const gchar * text) -{ - g_free(input_info_text); - input_info_text = g_strdup(text); - mainwin_set_info_text(); + gchar *title = g_strdup(text); + event_queue("title change", title); } void
--- a/src/audacious/input.h Tue Jul 24 13:17:23 2007 -0500 +++ b/src/audacious/input.h Wed Jul 25 15:46:00 2007 -0500 @@ -67,7 +67,6 @@ guchar *input_get_vis(gint time); void input_update_vis_plugin(gint time); -gchar *input_get_info_text(void); void input_about(gint index); void input_configure(gint index); @@ -76,7 +75,7 @@ InputVisType input_get_vis_type(); void input_update_vis(gint time); -void input_set_info_text(const gchar * text); +void input_set_info_text(gchar * text); void input_set_status_buffering(gboolean status); GList *input_scan_dir(const gchar * dir); @@ -89,7 +88,6 @@ gchar *input_stringify_disabled_list(void); extern InputPluginData ip_data; -extern gchar *input_info_text; #endif
--- a/src/audacious/main.c Tue Jul 24 13:17:23 2007 -0500 +++ b/src/audacious/main.c Wed Jul 25 15:46:00 2007 -0500 @@ -1227,7 +1227,6 @@ if (options.headless != 1) { read_volume(VOLSET_STARTUP); - mainwin_set_info_text(); /* FIXME: delayed, because it deals directly with the plugin * interface to set menu items */ @@ -1296,7 +1295,6 @@ { GMainLoop *loop; - mainwin_set_info_text(); playlist_start_get_info_thread(); loop = g_main_loop_new(NULL, TRUE);
--- a/src/audacious/playback.c Tue Jul 24 13:17:23 2007 -0500 +++ b/src/audacious/playback.c Wed Jul 25 15:46:00 2007 -0500 @@ -121,7 +121,6 @@ } playlist_check_pos_current(playlist); - mainwin_set_info_text(); mainwin_update_song_info(); /* FIXME: use g_timeout_add_seconds when glib-2.14 is required */ @@ -192,12 +191,6 @@ free_vis_data(); ip_data.paused = FALSE; - if (input_info_text) { - g_free(input_info_text); - input_info_text = NULL; - mainwin_set_info_text(); - } - g_free(get_current_input_playback()->filename); g_free(get_current_input_playback()); set_current_input_playback(NULL); @@ -288,7 +281,6 @@ if (!entry->decoder || !input_is_enabled(entry->decoder->filename)) { set_current_input_playback(NULL); - mainwin_set_info_text(); return FALSE; }
--- a/src/audacious/playlist.c Tue Jul 24 13:17:23 2007 -0500 +++ b/src/audacious/playlist.c Wed Jul 25 15:46:00 2007 -0500 @@ -526,9 +526,6 @@ mainwin_clear_song_info(); } } - else if (set_info_text) { - mainwin_set_info_text(); - } playlist_manager_update(); } @@ -568,9 +565,6 @@ mainwin_clear_song_info(); } } - else if (set_info_text) { - mainwin_set_info_text(); - } playlist_manager_update(); } @@ -604,10 +598,6 @@ playlist_recalc_total_time(playlist); - if (set_info_text) { - mainwin_set_info_text(); - } - if (restart_playing) { if (playlist->position) { playback_initiate(); @@ -1045,6 +1035,7 @@ { Playlist *playlist = playlist_get_active(); PlaylistEventInfoChange *msg; + gchar *text; g_return_if_fail(playlist != NULL); @@ -1072,6 +1063,9 @@ event_queue("playlist info change", msg); + text = playlist_get_info_text(playlist); + event_queue("title change", text); + if ( playlist->position ) hook_call( "playlist set info" , playlist->position ); } @@ -1177,7 +1171,6 @@ if (restart_playing) playback_initiate(); else { - mainwin_set_info_text(); playlistwin_update_list(playlist); } } @@ -1239,7 +1232,6 @@ if (restart_playing) playback_initiate(); else { - mainwin_set_info_text(); playlistwin_update_list(playlist); } } @@ -1422,7 +1414,6 @@ if (restart_playing) playback_initiate(); else { - mainwin_set_info_text(); playlistwin_update_list(playlist); } } @@ -1480,7 +1471,6 @@ PLAYLIST_UNLOCK(playlist->mutex); hook_call("playlist end reached", playlist->position); mainwin_clear_song_info(); - mainwin_set_info_text(); return; } } @@ -1491,7 +1481,6 @@ playlist_check_pos_current(playlist); playback_initiate(); - mainwin_set_info_text(); playlistwin_update_list(playlist); } @@ -2490,7 +2479,6 @@ { GList *node; gboolean update_playlistwin = FALSE; - gboolean update_mainwin = FALSE; while (playlist_get_info_is_going()) { PlaylistEntry *entry; @@ -2518,8 +2506,6 @@ } else if ((entry->tuple != NULL || entry->title != NULL) && entry->length != -1) { update_playlistwin = TRUE; - if (entry == playlist->position) - update_mainwin = TRUE; break; } } @@ -2563,8 +2549,6 @@ } else if ((entry->tuple != NULL || entry->title != NULL) && entry->length != -1) { update_playlistwin = TRUE; - if (entry == playlist->position) - update_mainwin = TRUE; // no need for break here since this iteration is very short. } } @@ -2590,11 +2574,6 @@ update_playlistwin = FALSE; } - if (update_mainwin) { - mainwin_set_info_text(); - update_mainwin = FALSE; - } - if (playlist_get_info_scan_active) { continue; }
--- a/src/audacious/pluginenum.c Tue Jul 24 13:17:23 2007 -0500 +++ b/src/audacious/pluginenum.c Wed Jul 25 15:46:00 2007 -0500 @@ -162,8 +162,8 @@ else thinks we could use a CONST macro to solve the warnings? - descender */ p->set_info = (void (*)(gchar *, gint, gint, gint, gint)) playlist_set_info_old_abi; - p->set_info_text = (void (*)(gchar *)) input_set_info_text; - p->set_status_buffering = (void (*)(gboolean)) input_set_status_buffering; + p->set_info_text = input_set_info_text; + p->set_status_buffering = input_set_status_buffering; ip_data.input_list = g_list_append(ip_data.input_list, p); @@ -228,9 +228,11 @@ if (header->magic != PLUGIN_MAGIC) return plugin2_dispose(module, "plugin <%s> discarded, invalid module magic", filename); +#if 0 if (header->api_version != __AUDACIOUS_PLUGIN_API__) return plugin2_dispose(module, "plugin <%s> discarded, wanting API version %d, we implement API version %d", filename, header->api_version, __AUDACIOUS_PLUGIN_API__); +#endif if (header->init) header->init();
--- a/src/audacious/ui_main.c Tue Jul 24 13:17:23 2007 -0500 +++ b/src/audacious/ui_main.c Wed Jul 25 15:46:00 2007 -0500 @@ -91,6 +91,8 @@ #include "ui_skinned_monostereo.h" #include "ui_jumptotrack.h" +#include "ui_main_evlisteners.h" + static GTimeVal cb_time; /* click delay for tristate is defined by TRISTATE_THRESHOLD */ #define ITEM_SEPARATOR {"/-", NULL, NULL, 0, "<Separator>"} @@ -586,24 +588,6 @@ } -void -mainwin_set_info_text(void) -{ - gchar *text; - - if (mainwin_info_text_locked) - return; - - if ((text = input_get_info_text()) != NULL) { - ui_skinned_textbox_set_text(mainwin_info, text); - g_free(text); - } - else if ((text = playlist_get_info_text(playlist_get_active())) != NULL) { - ui_skinned_textbox_set_text(mainwin_info, text); - g_free(text); - } -} - static gchar *mainwin_tb_old_text = NULL; void @@ -634,8 +618,6 @@ g_free(mainwin_tb_old_text); mainwin_tb_old_text = NULL; } - else - mainwin_set_info_text(); /* XXX: best we can do */ } @@ -2138,9 +2120,6 @@ mainwin_mr_change(GtkWidget *widget, MenuRowItem i) { switch (i) { - case MENUROW_NONE: - mainwin_set_info_text(); - break; case MENUROW_OPTIONS: mainwin_lock_info_text(_("Options Menu")); break; @@ -2162,6 +2141,8 @@ case MENUROW_VISUALIZATION: mainwin_lock_info_text(_("Visualization Menu")); break; + case MENUROW_NONE: + break; } } @@ -2886,6 +2867,8 @@ g_signal_connect(mainwin, "key_press_event", G_CALLBACK(mainwin_keypress), NULL); + + ui_main_evlistener_init(); } void @@ -3025,7 +3008,6 @@ mainwin_title_text = NULL; G_UNLOCK(mainwin_title); - mainwin_set_info_text(); playlistwin_update_list(playlist_get_active()); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/ui_main_evlisteners.c Wed Jul 25 15:46:00 2007 -0500 @@ -0,0 +1,45 @@ +/* + * Audacious + * Copyright (c) 2006-2007 Audacious development team. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses>. + * + * The Audacious team does not consider modular code linking to + * Audacious or using our public API to be a derived work. + */ + +#include <glib.h> +#include "hook.h" +#include "playback.h" +#include "playlist.h" +#include "playlist_evmessages.h" +#include "playlist_evlisteners.h" + +#include "ui_main.h" +#include "ui_skinned_textbox.h" + +static void +ui_main_evlistener_title_change(gpointer hook_data, gpointer user_data) +{ + gchar *text = (gchar *) hook_data; + + ui_skinned_textbox_set_text(mainwin_info, text); + + g_free(text); +} + +void +ui_main_evlistener_init(void) +{ + hook_associate("title change", ui_main_evlistener_title_change, NULL); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/ui_main_evlisteners.h Wed Jul 25 15:46:00 2007 -0500 @@ -0,0 +1,28 @@ +/* + * Audacious + * Copyright (c) 2006-2007 Audacious development team. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses>. + * + * The Audacious team does not consider modular code linking to + * Audacious or using our public API to be a derived work. + */ + +#include <glib.h> + +#ifndef __AUDACIOUS_UI_MAIN_EVLISTENERS_H__ +#define __AUDACIOUS_UI_MAIN_EVLISTENERS_H__ + +void ui_main_evlistener_init(void); + +#endif
--- a/src/audacious/ui_playlist.c Tue Jul 24 13:17:23 2007 -0500 +++ b/src/audacious/ui_playlist.c Wed Jul 25 15:46:00 2007 -0500 @@ -893,7 +893,6 @@ playlist_clear(playlist); mainwin_clear_song_info(); - mainwin_set_info_text(); playlist_load(playlist, filename); playlist_set_current_name(playlist, filename); @@ -2018,7 +2017,6 @@ /* XXX -- should this really be coupled here? -nenolod */ mainwin_clear_song_info(); - mainwin_set_info_text(); } void
--- a/src/audacious/ui_preferences.c Tue Jul 24 13:17:23 2007 -0500 +++ b/src/audacious/ui_preferences.c Wed Jul 25 15:46:00 2007 -0500 @@ -890,7 +890,6 @@ cfg.mainwin_font = g_strdup(gtk_font_button_get_font_name(button)); ui_skinned_textbox_set_xfont(mainwin_info, cfg.mainwin_use_xfont, cfg.mainwin_font); - mainwin_set_info_text(); draw_main_window(TRUE); } @@ -911,7 +910,6 @@ ui_skinned_textbox_set_xfont(mainwin_info, cfg.mainwin_use_xfont, cfg.mainwin_font); playlistwin_set_sinfo_font(cfg.playlist_font); - mainwin_set_info_text(); draw_main_window(TRUE); if (cfg.playlist_shaded) { playlistwin_update_list(playlist_get_active());