[totem] variable-rate: Fix bracket keys and backspace not working in search entry
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] variable-rate: Fix bracket keys and backspace not working in search entry
- Date: Wed, 23 Oct 2019 08:44:21 +0000 (UTC)
commit f0599bf4b1f21d635e6d60582b8e7f009c7473da
Author: Gabor Karsay <gabor karsay gmx at>
Date: Mon Oct 21 12:24:31 2019 +0200
variable-rate: Fix bracket keys and backspace not working in search entry
Let plugin handle key press events only in player mode and propagate them
in all other modes, e.g. to the search entry.
Closes: #212
.../variable-rate/totem-variable-rate-plugin.c | 28 +++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/variable-rate/totem-variable-rate-plugin.c
b/src/plugins/variable-rate/totem-variable-rate-plugin.c
index 792c0cb69..c59a31078 100644
--- a/src/plugins/variable-rate/totem-variable-rate-plugin.c
+++ b/src/plugins/variable-rate/totem-variable-rate-plugin.c
@@ -48,8 +48,10 @@
typedef struct {
TotemObject *totem;
guint handler_id_key_press;
+ guint handler_id_main_page;
GSimpleAction *action;
GMenuItem *submenu_item;
+ gboolean player_page;
} TotemVariableRatePluginPrivate;
#define NUM_RATES 6
@@ -161,12 +163,24 @@ change_rate (TotemVariableRatePlugin *pi,
g_action_change_state (G_ACTION (priv->action), state);
}
+static void
+on_totem_main_page_notify (GObject *object, GParamSpec *spec, TotemVariableRatePlugin *plugin)
+{
+ TotemVariableRatePlugin *pi = TOTEM_VARIABLE_RATE_PLUGIN (plugin);
+ char *main_page;
+
+ g_object_get (pi->priv->totem, "main-page", &main_page, NULL);
+ pi->priv->player_page = (g_strcmp0 (main_page, "player") == 0);
+ g_free (main_page);
+}
+
static gboolean
on_window_key_press_event (GtkWidget *window, GdkEventKey *event, TotemVariableRatePlugin *plugin)
{
TotemVariableRatePlugin *pi = TOTEM_VARIABLE_RATE_PLUGIN (plugin);
- if (event->state == 0 ||
+ if (!pi->priv->player_page ||
+ event->state == 0 ||
event->state & (GDK_CONTROL_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK | GDK_META_MASK)) {
return FALSE;
}
@@ -200,6 +214,12 @@ impl_activate (PeasActivatable *plugin)
priv->totem = g_object_get_data (G_OBJECT (plugin), "object");
+ /* Cache totem's main page */
+ priv->handler_id_main_page = g_signal_connect (G_OBJECT(priv->totem),
+ "notify::main-page",
+ G_CALLBACK (on_totem_main_page_notify),
+ pi);
+
/* Key press handler */
window = totem_object_get_main_window (priv->totem);
priv->handler_id_key_press = g_signal_connect (G_OBJECT(window),
@@ -245,6 +265,12 @@ impl_deactivate (PeasActivatable *plugin)
g_object_unref (window);
}
+ if (priv->handler_id_main_page != 0) {
+ g_signal_handler_disconnect (G_OBJECT(priv->totem),
+ priv->handler_id_main_page);
+ priv->handler_id_main_page = 0;
+ }
+
/* Remove the menu */
totem_object_empty_menu_section (priv->totem, "variable-rate-placeholder");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]