Re: [spice-gtk][PATCH] spicy: Fix error msg dialog created without parent

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

 



I'm not entirely sure why this message exists, but I suspect it is so
that the dialog can be centered on its parent, etc. The gtk+ commit that
introduced this message states:

    We want make it mandatory for dialogs to have transient parents,
    eventually. This is a first step in that direction.

Creating a fake parent window might avoid that message for now, but it
will almost certainly not satisfy the spirit of that warning. So I'm not
a fan of adding this sort of hack. I suspect that the gtk+ developers
would simply tell us that we should be using a GtkWindow instead of a
GtkDialog if we don't have a parent for it. Maybe there are other
solutions though.

(for one thing, we certainly don't need the
GTK_DIALOG_DESTROY_WITH_PARENT flag if there is no parent. But I don't
think removing that flag will avoid this warning)



On Wed, 2015-05-20 at 11:46 +0200, Lukas Venhoda wrote:
> Spicy creates it's first window only after connection has been
> established (window = display). This makes it currenlty impossible to
> supply parent window to connection dialog.
> 
> Supplying a fake parent will sqeulch the error message.
> Possible fix for fdo#90452
> ---
>  gtk/spicy.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/gtk/spicy.c b/gtk/spicy.c
> index 9cd6ee5..d1ff1c1 100644
> --- a/gtk/spicy.c
> +++ b/gtk/spicy.c
> @@ -223,13 +223,15 @@ static void recent_item_activated_dialog_cb(GtkRecentChooser *chooser, gpointer
> 
>  static int connect_dialog(SpiceSession *session)
>  {
> -    GtkWidget *dialog, *area, *label;
> +    GtkWidget *dialog, *area, *label, *fake_parent;
>      GtkTable *table;
>      int i, retval;
> 
> +    fake_parent = gtk_window_new(GTK_WINDOW_TOPLEVEL);
> +
>      /* Create the widgets */
>      dialog = gtk_dialog_new_with_buttons(_("Connect to SPICE"),
> -                                         NULL,
> +                                         fake_parent,
>                                           GTK_DIALOG_DESTROY_WITH_PARENT,
>                                           GTK_STOCK_CANCEL,
>                                           GTK_RESPONSE_REJECT,
> @@ -291,6 +293,7 @@ static int connect_dialog(SpiceSession *session)
>      } else
>          retval = -1;
>      gtk_widget_destroy(dialog);
> +    gtk_widget_destroy(fake_parent);
>      return retval;
>  }
> 
> --
> 2.4.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel


_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]