Kaydet (Commit) e78d99fd authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Andras Timar

gtk3: gtk_window_set_transient_for on overwrite warning dlg

Change-Id: I91d21e3d1663880de14792ded0a1e079d1a40f09
(cherry picked from commit 30a5b304)
üst 2a8053b9
...@@ -918,6 +918,9 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException, std ...@@ -918,6 +918,9 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException, std
frame::Desktop::create(m_xContext), frame::Desktop::create(m_xContext),
UNO_QUERY_THROW ); 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); RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit, xDesktop);
uno::Reference < awt::XTopWindowListener > xLifeCycle(pRunDialog); uno::Reference < awt::XTopWindowListener > xLifeCycle(pRunDialog);
while( GTK_RESPONSE_NO == btn ) while( GTK_RESPONSE_NO == btn )
...@@ -1005,7 +1008,8 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException, std ...@@ -1005,7 +1008,8 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException, std
gtk_window_set_title( GTK_WINDOW( dlg ), gtk_window_set_title( GTK_WINDOW( dlg ),
OUStringToOString(getResString(FILE_PICKER_TITLE_SAVE ), OUStringToOString(getResString(FILE_PICKER_TITLE_SAVE ),
RTL_TEXTENCODING_UTF8 ).getStr() ); RTL_TEXTENCODING_UTF8 ).getStr() );
if (pParent)
gtk_window_set_transient_for(GTK_WINDOW(dlg), pParent);
RunDialog* pAnotherDialog = new RunDialog(dlg, xToolkit, xDesktop); RunDialog* pAnotherDialog = new RunDialog(dlg, xToolkit, xDesktop);
uno::Reference < awt::XTopWindowListener > xAnotherLifeCycle(pAnotherDialog); uno::Reference < awt::XTopWindowListener > xAnotherLifeCycle(pAnotherDialog);
btn = pAnotherDialog->run(); btn = pAnotherDialog->run();
......
...@@ -145,6 +145,9 @@ sal_Int16 SAL_CALL SalGtkFolderPicker::execute() throw( uno::RuntimeException, s ...@@ -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); 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); RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit, xDesktop);
uno::Reference < awt::XTopWindowListener > xLifeCycle(pRunDialog); uno::Reference < awt::XTopWindowListener > xLifeCycle(pRunDialog);
gint nStatus = pRunDialog->run(); gint nStatus = pRunDialog->run();
......
...@@ -104,10 +104,7 @@ extern "C" ...@@ -104,10 +104,7 @@ extern "C"
} }
} }
RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit >& rToolkit, GtkWindow* RunDialog::GetTransientFor()
uno::Reference< frame::XDesktop >& rDesktop ) :
cppu::WeakComponentImplHelper2< awt::XTopWindowListener, frame::XTerminateListener >( maLock ),
mpDialog(pDialog), mxToolkit(rToolkit), mxDesktop(rDesktop)
{ {
GtkWindow *pParent = NULL; GtkWindow *pParent = NULL;
...@@ -118,8 +115,15 @@ RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit ...@@ -118,8 +115,15 @@ RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit
if( pFrame ) if( pFrame )
pParent = GTK_WINDOW( pFrame->getWindow() ); 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() RunDialog::~RunDialog()
...@@ -133,7 +137,6 @@ void SAL_CALL RunDialog::windowOpened( const ::com::sun::star::lang::EventObject ...@@ -133,7 +137,6 @@ void SAL_CALL RunDialog::windowOpened( const ::com::sun::star::lang::EventObject
throw (::com::sun::star::uno::RuntimeException, std::exception) throw (::com::sun::star::uno::RuntimeException, std::exception)
{ {
SolarMutexGuard g; SolarMutexGuard g;
g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, reinterpret_cast<GSourceFunc>(canceldialog), this, NULL); g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, reinterpret_cast<GSourceFunc>(canceldialog), this, NULL);
} }
......
...@@ -115,6 +115,7 @@ public: ...@@ -115,6 +115,7 @@ public:
virtual ~RunDialog(); virtual ~RunDialog();
gint run(); gint run();
void cancel(); void cancel();
static GtkWindow* GetTransientFor();
}; };
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment