[gnome-builder] flatpak: setup modal/transient-for during ctor



commit 42f9fe46caa977d36b7c158b5b68ed005d216a3d
Author: Christian Hergert <chergert redhat com>
Date:   Fri Mar 22 16:56:00 2019 -0700

    flatpak: setup modal/transient-for during ctor
    
    This is necessary for the modality to be applied correctly on
    Wayland. This requires that we delay build pipeline setup, which
    has been done on a previous commit.
    
    Fixes #858

 src/plugins/flatpak/gbp-flatpak-install-dialog.c   | 6 +++++-
 src/plugins/flatpak/gbp-flatpak-install-dialog.h   | 2 +-
 src/plugins/flatpak/gbp-flatpak-runtime-provider.c | 5 +++--
 3 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/flatpak/gbp-flatpak-install-dialog.c 
b/src/plugins/flatpak/gbp-flatpak-install-dialog.c
index 57aad9b08..0c891e369 100644
--- a/src/plugins/flatpak/gbp-flatpak-install-dialog.c
+++ b/src/plugins/flatpak/gbp-flatpak-install-dialog.c
@@ -43,10 +43,14 @@ struct _GbpFlatpakInstallDialog
 G_DEFINE_TYPE (GbpFlatpakInstallDialog, gbp_flatpak_install_dialog, GTK_TYPE_DIALOG)
 
 GbpFlatpakInstallDialog *
-gbp_flatpak_install_dialog_new (void)
+gbp_flatpak_install_dialog_new (GtkWindow *transient_for)
 {
+  g_return_val_if_fail (GTK_IS_WINDOW (transient_for), NULL);
+
   return g_object_new (GBP_TYPE_FLATPAK_INSTALL_DIALOG,
                        "use-header-bar", TRUE,
+                       "transient-for", transient_for,
+                       "modal", TRUE,
                        NULL);
 }
 
diff --git a/src/plugins/flatpak/gbp-flatpak-install-dialog.h 
b/src/plugins/flatpak/gbp-flatpak-install-dialog.h
index 04092be46..3d6363a73 100644
--- a/src/plugins/flatpak/gbp-flatpak-install-dialog.h
+++ b/src/plugins/flatpak/gbp-flatpak-install-dialog.h
@@ -28,7 +28,7 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (GbpFlatpakInstallDialog, gbp_flatpak_install_dialog, GBP, FLATPAK_INSTALL_DIALOG, 
GtkDialog)
 
-GbpFlatpakInstallDialog  *gbp_flatpak_install_dialog_new              (void);
+GbpFlatpakInstallDialog  *gbp_flatpak_install_dialog_new              (GtkWindow                
*transient_for);
 void                      gbp_flatpak_install_dialog_add_runtime      (GbpFlatpakInstallDialog  *self,
                                                                        const gchar              *runtime_id);
 void                      gbp_flatpak_install_dialog_add_runtime_full (GbpFlatpakInstallDialog  *self,
diff --git a/src/plugins/flatpak/gbp-flatpak-runtime-provider.c 
b/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
index dcc650cbe..e101f3e43 100644
--- a/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
+++ b/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
@@ -694,6 +694,7 @@ gbp_flatpak_runtime_provider_bootstrap_async (IdeRuntimeProvider  *provider,
   GbpFlatpakInstallDialog *dialog;
   BootstrapState *state;
   IdeWorkbench *workbench;
+  IdeWorkspace *workspace;
   const gchar *runtime_id;
   const gchar *build_arch;
   IdeContext *context;
@@ -726,10 +727,10 @@ gbp_flatpak_runtime_provider_bootstrap_async (IdeRuntimeProvider  *provider,
     }
 
   /* Create dialog to potentially query user if we are allowed to install */
-  dialog = gbp_flatpak_install_dialog_new ();
   workbench = _ide_workbench_from_context (context);
+  workspace = ide_workbench_get_current_workspace (workbench);
+  dialog = gbp_flatpak_install_dialog_new (GTK_WINDOW (workspace));
   gtk_window_group_add_window (GTK_WINDOW_GROUP (workbench), GTK_WINDOW (dialog));
-  gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
 
   /* Create state for async op */
   state = g_slice_new0 (BootstrapState);


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