From 6aa64f0bc1c05da350e93e7b0d5d22bae6d10eb0 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Tue, 12 Apr 2016 11:25:29 -0400 Subject: [PATCH] gui/audio: Block accelerators when a gtk entry is focused Otherwise pressing the spacebar while searching could toggle the play / pause status. Fixes #36: Button accelerators always triggered Signed-off-by: Anna Schumaker --- gui/audio.c | 9 +++++++++ share/ocarina/ocarina6.glade | 21 +++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/gui/audio.c b/gui/audio.c index ba1ff69a..86d39cc2 100644 --- a/gui/audio.c +++ b/gui/audio.c @@ -87,6 +87,15 @@ static int __audio_timeout(gpointer data) return G_SOURCE_CONTINUE; } +gboolean __audio_can_accel(GtkWidget *widget, guint signal_id) +{ + GtkWindow *window = GTK_WINDOW(gui_builder_widget("o_window")); + g_signal_stop_emission_by_name(widget, "can-activate-accel"); + return !GTK_IS_ENTRY(gtk_window_get_focus(window)) && + gtk_widget_is_visible(widget) && + gtk_widget_is_sensitive(widget); +} + struct audio_ops audio_ops = { diff --git a/share/ocarina/ocarina6.glade b/share/ocarina/ocarina6.glade index 0095cefc..830d2a92 100644 --- a/share/ocarina/ocarina6.glade +++ b/share/ocarina/ocarina6.glade @@ -241,10 +241,11 @@ True False + False True center center - False + @@ -272,10 +273,11 @@ True False + False True center center - False + @@ -303,10 +305,11 @@ False + False True center center - False + @@ -335,10 +338,11 @@ True False + False True center center - False + @@ -366,10 +370,11 @@ True False + False True center center - False + @@ -483,10 +488,10 @@ Favorite True False + False True Add track to Favorites playlist image6 - False True @@ -500,10 +505,10 @@ Hide True False + False True Hide track from Collection image7 - False False @@ -841,8 +846,8 @@ Manager Pause after True False - False False + False 0.5 True