diff options
author | Bastien Nocera <hadess@hadess.net> | 2020-08-22 01:13:00 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2020-08-22 01:39:00 +0200 |
commit | 433e2a2c025853f904fd338a725919b026b43ea8 (patch) | |
tree | b290cc6c5cb26baf269a664dbcb5319ee439fd4e | |
parent | 2b7e0cc26b2c2d20cc1d0bb0dd298558cbbbf15e (diff) | |
download | totem-433e2a2c025853f904fd338a725919b026b43ea8.tar.gz |
rotation: Fix Ctrl+R/Ctrl+Shift+R not rotating the video
It's not enough to add an accel to the menu item for it to be called
when pressing those keys, so make sure the accel gets attached to the
window.
-rw-r--r-- | src/plugins/rotation/totem-rotation.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/rotation/totem-rotation.c b/src/plugins/rotation/totem-rotation.c index db342df23..183fcd475 100644 --- a/src/plugins/rotation/totem-rotation.c +++ b/src/plugins/rotation/totem-rotation.c @@ -226,6 +226,8 @@ impl_activate (PeasActivatable *plugin) GMenu *menu; GMenuItem *item; char *mrl; + const char * const rotate_cw[]= { "<Primary>r", NULL }; + const char * const rotate_ccw[]= { "<Primary><Shift>r", NULL }; priv->totem = g_object_get_data (G_OBJECT (plugin), "object"); priv->bvw = totem_object_get_video_widget (priv->totem); @@ -248,12 +250,18 @@ impl_activate (PeasActivatable *plugin) G_CALLBACK (cb_rotate_left), pi); g_action_map_add_action (G_ACTION_MAP (priv->totem), G_ACTION (priv->rotate_left_action)); + gtk_application_set_accels_for_action (GTK_APPLICATION (priv->totem), + "app.rotate-left", + rotate_ccw); priv->rotate_right_action = g_simple_action_new ("rotate-right", NULL); g_signal_connect (G_OBJECT (priv->rotate_right_action), "activate", G_CALLBACK (cb_rotate_right), pi); g_action_map_add_action (G_ACTION_MAP (priv->totem), G_ACTION (priv->rotate_right_action)); + gtk_application_set_accels_for_action (GTK_APPLICATION (priv->totem), + "app.rotate-right", + rotate_cw); item = g_menu_item_new (_("_Rotate ↷"), "app.rotate-right"); g_menu_item_set_attribute (item, "accel", "s", "<Primary>R"); @@ -273,6 +281,7 @@ impl_deactivate (PeasActivatable *plugin) { TotemRotationPlugin *pi = TOTEM_ROTATION_PLUGIN (plugin); TotemRotationPluginPrivate *priv = pi->priv; + const char * const accels[] = { NULL }; if (priv->cancellable != NULL) { g_cancellable_cancel (priv->cancellable); @@ -282,6 +291,13 @@ impl_deactivate (PeasActivatable *plugin) g_signal_handlers_disconnect_by_func (priv->totem, totem_rotation_file_opened, plugin); g_signal_handlers_disconnect_by_func (priv->totem, totem_rotation_file_closed, plugin); + gtk_application_set_accels_for_action (GTK_APPLICATION (priv->totem), + "app.rotate-right", + accels); + gtk_application_set_accels_for_action (GTK_APPLICATION (priv->totem), + "app.rotate-left", + accels); + totem_object_empty_menu_section (priv->totem, "rotation-placeholder"); g_action_map_remove_action (G_ACTION_MAP (priv->totem), "rotate-left"); g_action_map_remove_action (G_ACTION_MAP (priv->totem), "rotate-right"); |