Re: [PATCH 1/2] Report gtk_accel_map_change_entry() failures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

On Mon, Aug 6, 2018 at 1:09 AM Paul Donohue <virt-tools@xxxxxxxxxx> wrote:
>
> Signed-off-by: Paul Donohue <virt-tools@xxxxxxxxxx>

Sorry for the late review,
Reviewed-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>

> ---
>  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@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/virt-tools-list

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux