[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara caolanm at redhat.com
Fri Jun 26 08:32:07 PDT 2015


 vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx   |    6 +++++-
 vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx |    3 +++
 vcl/unx/gtk/fpicker/SalGtkPicker.cxx       |   17 ++++++++++-------
 vcl/unx/gtk/fpicker/SalGtkPicker.hxx       |    1 +
 4 files changed, 19 insertions(+), 8 deletions(-)

New commits:
commit 30a5b304f2c1c3d89a2e3b76ac44f2c6376ee65f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jun 26 16:30:02 2015 +0100

    gtk3: gtk_window_set_transient_for on overwrite warning dlg
    
    Change-Id: I91d21e3d1663880de14792ded0a1e079d1a40f09

diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index 9936f8c..2731162 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -918,6 +918,9 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException, std
         frame::Desktop::create(m_xContext),
         UNO_QUERY_THROW );
 
+    GtkWindow *pParent = RunDialog::GetTransientFor();
+    if (pParent)
+        gtk_window_set_transient_for(GTK_WINDOW(m_pDialog), pParent);
     RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit, xDesktop);
     uno::Reference < awt::XTopWindowListener > xLifeCycle(pRunDialog);
     while( GTK_RESPONSE_NO == btn )
@@ -1005,7 +1008,8 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException, std
                             gtk_window_set_title( GTK_WINDOW( dlg ),
                                 OUStringToOString(getResString(FILE_PICKER_TITLE_SAVE ),
                                 RTL_TEXTENCODING_UTF8 ).getStr() );
-
+                            if (pParent)
+                                gtk_window_set_transient_for(GTK_WINDOW(dlg), pParent);
                             RunDialog* pAnotherDialog = new RunDialog(dlg, xToolkit, xDesktop);
                             uno::Reference < awt::XTopWindowListener > xAnotherLifeCycle(pAnotherDialog);
                             btn = pAnotherDialog->run();
diff --git a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
index 3a2fc6c..23efb79 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
@@ -145,6 +145,9 @@ sal_Int16 SAL_CALL SalGtkFolderPicker::execute() throw( uno::RuntimeException, s
 
     uno::Reference< frame::XDesktop > xDesktop( frame::Desktop::create(m_xContext), uno::UNO_QUERY);
 
+    GtkWindow *pParent = RunDialog::GetTransientFor();
+    if (pParent)
+        gtk_window_set_transient_for(GTK_WINDOW(m_pDialog), pParent);
     RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit, xDesktop);
     uno::Reference < awt::XTopWindowListener > xLifeCycle(pRunDialog);
     gint nStatus = pRunDialog->run();
diff --git a/vcl/unx/gtk/fpicker/SalGtkPicker.cxx b/vcl/unx/gtk/fpicker/SalGtkPicker.cxx
index 6ada45b..c53a80b 100644
--- a/vcl/unx/gtk/fpicker/SalGtkPicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkPicker.cxx
@@ -103,10 +103,7 @@ extern "C"
     }
 }
 
-RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit >& rToolkit,
-    uno::Reference< frame::XDesktop >& rDesktop ) :
-    cppu::WeakComponentImplHelper2< awt::XTopWindowListener, frame::XTerminateListener >( maLock ),
-    mpDialog(pDialog), mxToolkit(rToolkit), mxDesktop(rDesktop)
+GtkWindow* RunDialog::GetTransientFor()
 {
     GtkWindow *pParent = NULL;
 
@@ -117,8 +114,15 @@ RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit
         if( pFrame )
             pParent = GTK_WINDOW( pFrame->getWindow() );
     }
-    if (pParent)
-        gtk_window_set_transient_for( GTK_WINDOW( mpDialog ), pParent );
+
+    return pParent;
+}
+
+RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit >& rToolkit,
+    uno::Reference< frame::XDesktop >& rDesktop ) :
+    cppu::WeakComponentImplHelper2< awt::XTopWindowListener, frame::XTerminateListener >( maLock ),
+    mpDialog(pDialog), mxToolkit(rToolkit), mxDesktop(rDesktop)
+{
 }
 
 RunDialog::~RunDialog()
@@ -132,7 +136,6 @@ void SAL_CALL RunDialog::windowOpened( const ::com::sun::star::lang::EventObject
     throw (::com::sun::star::uno::RuntimeException, std::exception)
 {
     SolarMutexGuard g;
-
     g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, reinterpret_cast<GSourceFunc>(canceldialog), this, NULL);
 }
 
diff --git a/vcl/unx/gtk/fpicker/SalGtkPicker.hxx b/vcl/unx/gtk/fpicker/SalGtkPicker.hxx
index 78d810c..dd98b3a 100644
--- a/vcl/unx/gtk/fpicker/SalGtkPicker.hxx
+++ b/vcl/unx/gtk/fpicker/SalGtkPicker.hxx
@@ -115,6 +115,7 @@ public:
     virtual ~RunDialog();
     gint run();
     void cancel();
+    static GtkWindow* GetTransientFor();
 };
 
 #endif


More information about the Libreoffice-commits mailing list