ocarina: Bugfix the ban button
- Use g_signal_connect() when creating toggle buttons - Only set the banned state on a track if it has changed Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
ed33881a25
commit
376fe67115
|
@ -11,7 +11,6 @@ static GtkWidget *title;
|
|||
static GtkWidget *artist;
|
||||
static GtkWidget *album;
|
||||
static GtkWidget *ban;
|
||||
static bool ignore_ban = false;
|
||||
|
||||
static void set_label(GtkWidget *label, string text, string size)
|
||||
{
|
||||
|
@ -66,14 +65,11 @@ static GtkWidget *make_tag_labels()
|
|||
|
||||
static void on_ban(GtkWidget *w, gpointer d)
|
||||
{
|
||||
bool banned;
|
||||
bool banned = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ban));
|
||||
|
||||
if (ignore_ban) {
|
||||
ignore_ban = false;
|
||||
if (current->get_banned() == banned)
|
||||
return;
|
||||
}
|
||||
|
||||
banned = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ban));
|
||||
current->set_banned(banned);
|
||||
if (banned)
|
||||
libsaria::deck::next();
|
||||
|
@ -111,8 +107,6 @@ namespace ocarina
|
|||
current = cur;
|
||||
refresh_widgets();
|
||||
update_automatic_pause();
|
||||
|
||||
ignore_ban = true;
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ban), current->get_banned());
|
||||
|
||||
println("Current track changed");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
static GtkWidget *get_toggle_button(void (* func)(GtkWidget *, gpointer), bool show)
|
||||
{
|
||||
GtkWidget *button = gtk_toggle_button_new();
|
||||
GTK_CONNECT(button, "toggled", func, NULL);
|
||||
g_signal_connect(button, "toggled", G_CALLBACK(func), NULL);
|
||||
if (show == true)
|
||||
gtk_widget_show(button);
|
||||
return button;
|
||||
|
|
Loading…
Reference in New Issue