[virt-tools-list] [PATCH 1/2] Report gtk_accel_map_change_entry() failures

Marc-André Lureau marcandre.lureau at redhat.com
Sat Jan 5 09:08:15 UTC 2019


Hi

On Mon, Aug 6, 2018 at 1:09 AM Paul Donohue <virt-tools at paulsd.com> wrote:
>
> Signed-off-by: Paul Donohue <virt-tools at PaulSD.com>

Sorry for the late review,
Reviewed-by: Marc-André Lureau <marcandre.lureau at redhat.com>

> ---
>  src/virt-viewer-app.c | 30 +++++++++++++++++++-----------
>  1 file changed, 19 insertions(+), 11 deletions(-)
>
> diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
> index 2a88882..3a31bbb 100644
> --- a/src/virt-viewer-app.c
> +++ b/src/virt-viewer-app.c
> @@ -1790,15 +1790,20 @@ virt_viewer_update_smartcard_accels(VirtViewerApp *self)
>          sw_smartcard = FALSE;
>      }
>      if (sw_smartcard) {
> +        gboolean r;
>          g_debug("enabling smartcard shortcuts");
> -        gtk_accel_map_change_entry("<virt-viewer>/file/smartcard-insert",
> -                                   priv->insert_smartcard_accel_key,
> -                                   priv->insert_smartcard_accel_mods,
> -                                   TRUE);
> -        gtk_accel_map_change_entry("<virt-viewer>/file/smartcard-remove",
> -                                   priv->remove_smartcard_accel_key,
> -                                   priv->remove_smartcard_accel_mods,
> -                                   TRUE);
> +        r = gtk_accel_map_change_entry("<virt-viewer>/file/smartcard-insert",
> +                                       priv->insert_smartcard_accel_key,
> +                                       priv->insert_smartcard_accel_mods,
> +                                       TRUE);
> +        if (!r)
> +            g_warning("Unable to set hotkey for 'smartcard-insert' due to a conflict in GTK");
> +        r = gtk_accel_map_change_entry("<virt-viewer>/file/smartcard-remove",
> +                                       priv->remove_smartcard_accel_key,
> +                                       priv->remove_smartcard_accel_mods,
> +                                       TRUE);
> +        if (!r)
> +            g_warning("Unable to set hotkey for 'smartcard-remove' due to a conflict in GTK");
>      } else {
>          g_debug("disabling smartcard shortcuts");
>          gtk_accel_map_change_entry("<virt-viewer>/file/smartcard-insert", 0, 0, TRUE);
> @@ -2109,12 +2114,13 @@ virt_viewer_app_set_hotkeys(VirtViewerApp *self, const gchar *hotkeys_str)
>              continue;
>          }
>
> +        gboolean status = TRUE;
>          if (g_str_equal(*hotkey, "toggle-fullscreen")) {
> -            gtk_accel_map_change_entry("<virt-viewer>/view/toggle-fullscreen", accel_key, accel_mods, TRUE);
> +            status = gtk_accel_map_change_entry("<virt-viewer>/view/toggle-fullscreen", accel_key, accel_mods, TRUE);
>          } else if (g_str_equal(*hotkey, "release-cursor")) {
> -            gtk_accel_map_change_entry("<virt-viewer>/view/release-cursor", accel_key, accel_mods, TRUE);
> +            status = gtk_accel_map_change_entry("<virt-viewer>/view/release-cursor", accel_key, accel_mods, TRUE);
>          } else if (g_str_equal(*hotkey, "secure-attention")) {
> -            gtk_accel_map_change_entry("<virt-viewer>/send/secure-attention", accel_key, accel_mods, TRUE);
> +            status = gtk_accel_map_change_entry("<virt-viewer>/send/secure-attention", accel_key, accel_mods, TRUE);
>          } else if (g_str_equal(*hotkey, "smartcard-insert")) {
>              virt_viewer_set_insert_smartcard_accel(self, accel_key, accel_mods);
>          } else if (g_str_equal(*hotkey, "smartcard-remove")) {
> @@ -2122,6 +2128,8 @@ virt_viewer_app_set_hotkeys(VirtViewerApp *self, const gchar *hotkeys_str)
>          } else {
>              g_warning("Unknown hotkey command %s", *hotkey);
>          }
> +        if (!status)
> +            g_warning("Unable to set hotkey for '%s' due to a conflict in GTK", *hotkey);
>      }
>      g_strfreev(hotkeys);
>
> --
> 2.17.1
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list




More information about the virt-tools-list mailing list