|
|
80e98ef |
From 8636f3f41f8f6950a0e3c05f50eb4423c4035b2f Mon Sep 17 00:00:00 2001
|
|
|
80e98ef |
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
|
|
80e98ef |
Date: Thu, 27 Jan 2011 16:41:00 +0000
|
|
|
80e98ef |
Subject: [PATCH 1/2] Related: rhbz#672872 cancel gtk file-dialog on desktop::terminate
|
|
|
80e98ef |
|
|
|
80e98ef |
---
|
|
|
80e98ef |
fpicker/source/unx/gnome/SalGtkFilePicker.cxx | 7 +++++--
|
|
|
80e98ef |
fpicker/source/unx/gnome/SalGtkFolderPicker.cxx | 5 ++++-
|
|
|
80e98ef |
fpicker/source/unx/gnome/SalGtkPicker.cxx | 19 ++++++++++++++++---
|
|
|
80e98ef |
fpicker/source/unx/gnome/SalGtkPicker.hxx | 20 +++++++++++++++++---
|
|
|
80e98ef |
4 files changed, 42 insertions(+), 9 deletions(-)
|
|
|
80e98ef |
|
|
|
80e98ef |
diff --git a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx
|
|
|
80e98ef |
index d08125e..068ead5 100644
|
|
|
80e98ef |
--- a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx
|
|
|
80e98ef |
+++ b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx
|
|
|
9e87389 |
@@ -1030,7 +1030,10 @@
|
|
|
80e98ef |
uno::Reference< awt::XExtendedToolkit > xToolkit(
|
|
|
9e87389 |
m_xServiceMgr->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.awt.Toolkit") ), uno::UNO_QUERY);
|
|
|
80e98ef |
|
|
|
80e98ef |
- RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit);
|
|
|
80e98ef |
+ uno::Reference< frame::XDesktop > xDesktop(
|
|
|
80e98ef |
+ m_xServiceMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), uno::UNO_QUERY);
|
|
|
80e98ef |
+
|
|
|
80e98ef |
+ RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit, xDesktop);
|
|
|
80e98ef |
uno::Reference < awt::XTopWindowListener > xLifeCycle(pRunDialog);
|
|
|
80e98ef |
while( GTK_RESPONSE_NO == btn )
|
|
|
80e98ef |
{
|
|
|
9e87389 |
@@ -1063,7 +1066,7 @@
|
|
|
80e98ef |
OUStringToOString(aResProvider.getResString(FILE_PICKER_TITLE_SAVE ),
|
|
|
80e98ef |
RTL_TEXTENCODING_UTF8 ).getStr() );
|
|
|
80e98ef |
|
|
|
80e98ef |
- RunDialog* pAnotherDialog = new RunDialog(dlg, xToolkit);
|
|
|
80e98ef |
+ RunDialog* pAnotherDialog = new RunDialog(dlg, xToolkit, xDesktop);
|
|
|
80e98ef |
uno::Reference < awt::XTopWindowListener > xAnotherLifeCycle(pAnotherDialog);
|
|
|
80e98ef |
btn = pAnotherDialog->run();
|
|
|
80e98ef |
|
|
|
80e98ef |
diff --git a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx
|
|
|
80e98ef |
index c42021c..08bbf04 100644
|
|
|
80e98ef |
--- a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx
|
|
|
80e98ef |
+++ b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx
|
|
|
9e87389 |
@@ -184,7 +184,10 @@
|
|
|
80e98ef |
uno::Reference< awt::XExtendedToolkit > xToolkit(
|
|
|
9e87389 |
m_xServiceMgr->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.awt.Toolkit") ), uno::UNO_QUERY);
|
|
|
80e98ef |
|
|
|
80e98ef |
- RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit);
|
|
|
80e98ef |
+ uno::Reference< frame::XDesktop > xDesktop(
|
|
|
80e98ef |
+ m_xServiceMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), uno::UNO_QUERY);
|
|
|
80e98ef |
+
|
|
|
80e98ef |
+ RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit, xDesktop);
|
|
|
80e98ef |
uno::Reference < awt::XTopWindowListener > xLifeCycle(pRunDialog);
|
|
|
80e98ef |
gint nStatus = pRunDialog->run();
|
|
|
80e98ef |
switch( nStatus )
|
|
|
80e98ef |
diff --git a/fpicker/source/unx/gnome/SalGtkPicker.cxx b/fpicker/source/unx/gnome/SalGtkPicker.cxx
|
|
|
80e98ef |
index 6dbaa03..9bdad50 100644
|
|
|
80e98ef |
--- a/fpicker/source/unx/gnome/SalGtkPicker.cxx
|
|
|
80e98ef |
+++ b/fpicker/source/unx/gnome/SalGtkPicker.cxx
|
|
|
80e98ef |
@@ -130,9 +130,10 @@ extern "C"
|
|
|
80e98ef |
extern GdkDisplay* gdk_x11_lookup_xdisplay (void*xdisplay);
|
|
|
80e98ef |
}
|
|
|
80e98ef |
|
|
|
80e98ef |
-RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit >& rToolkit ) :
|
|
|
80e98ef |
- cppu::WeakComponentImplHelper1< awt::XTopWindowListener >( maLock ),
|
|
|
80e98ef |
- mpDialog(pDialog), mpCreatedParent(NULL), mxToolkit(rToolkit)
|
|
|
80e98ef |
+RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit >& rToolkit,
|
|
|
80e98ef |
+ uno::Reference< frame::XDesktop >& rDesktop ) :
|
|
|
80e98ef |
+ cppu::WeakComponentImplHelper2< awt::XTopWindowListener, frame::XTerminateListener >( maLock ),
|
|
|
80e98ef |
+ mpDialog(pDialog), mpCreatedParent(NULL), mxToolkit(rToolkit), mxDesktop(rDesktop)
|
|
|
80e98ef |
{
|
|
|
80e98ef |
awt::SystemDependentXWindow aWindowHandle;
|
|
|
80e98ef |
|
|
|
80e98ef |
@@ -186,6 +187,18 @@ void SAL_CALL RunDialog::windowOpened( const ::com::sun::star::lang::EventObject
|
|
|
80e98ef |
g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, (GSourceFunc)canceldialog, this, NULL);
|
|
|
80e98ef |
}
|
|
|
80e98ef |
|
|
|
80e98ef |
+void SAL_CALL RunDialog::queryTermination( const ::com::sun::star::lang::EventObject& )
|
|
|
80e98ef |
+ throw(::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException)
|
|
|
80e98ef |
+{
|
|
|
80e98ef |
+}
|
|
|
80e98ef |
+
|
|
|
80e98ef |
+void SAL_CALL RunDialog::notifyTermination( const ::com::sun::star::lang::EventObject& )
|
|
|
80e98ef |
+ throw(::com::sun::star::uno::RuntimeException)
|
|
|
80e98ef |
+{
|
|
|
80e98ef |
+ GdkThreadLock aLock;
|
|
|
80e98ef |
+ g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, (GSourceFunc)canceldialog, this, NULL);
|
|
|
80e98ef |
+}
|
|
|
80e98ef |
+
|
|
|
80e98ef |
void RunDialog::cancel()
|
|
|
80e98ef |
{
|
|
|
80e98ef |
GdkThreadLock aLock;
|
|
|
80e98ef |
diff --git a/fpicker/source/unx/gnome/SalGtkPicker.hxx b/fpicker/source/unx/gnome/SalGtkPicker.hxx
|
|
|
80e98ef |
index 889790d..52fe5a0 100644
|
|
|
80e98ef |
--- a/fpicker/source/unx/gnome/SalGtkPicker.hxx
|
|
|
80e98ef |
+++ b/fpicker/source/unx/gnome/SalGtkPicker.hxx
|
|
|
80e98ef |
@@ -34,7 +34,7 @@
|
|
|
80e98ef |
//_____________________________________________________________________________
|
|
|
80e98ef |
|
|
|
80e98ef |
#include <osl/mutex.hxx>
|
|
|
80e98ef |
-#include <cppuhelper/compbase1.hxx>
|
|
|
80e98ef |
+#include <cppuhelper/compbase2.hxx>
|
|
|
80e98ef |
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
|
|
|
80e98ef |
#include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
|
|
|
80e98ef |
#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
|
|
|
80e98ef |
@@ -43,6 +43,8 @@
|
|
|
80e98ef |
|
|
|
80e98ef |
#include <com/sun/star/awt/XTopWindowListener.hpp>
|
|
|
80e98ef |
#include <com/sun/star/awt/XExtendedToolkit.hpp>
|
|
|
80e98ef |
+#include <com/sun/star/frame/XDesktop.hpp>
|
|
|
80e98ef |
+#include <com/sun/star/frame/XTerminateListener.hpp>
|
|
|
80e98ef |
|
|
|
80e98ef |
#include <gtk/gtk.h>
|
|
|
80e98ef |
#include <gdk/gdkkeysyms.h>
|
|
|
80e98ef |
@@ -85,13 +87,16 @@ public:
|
|
|
80e98ef |
//to happen while we're opened waiting for user input, e.g.
|
|
|
80e98ef |
//https://bugzilla.redhat.com/show_bug.cgi?id=441108
|
|
|
80e98ef |
class RunDialog :
|
|
|
80e98ef |
- public cppu::WeakComponentImplHelper1< ::com::sun::star::awt::XTopWindowListener >
|
|
|
80e98ef |
+ public cppu::WeakComponentImplHelper2<
|
|
|
80e98ef |
+ ::com::sun::star::awt::XTopWindowListener,
|
|
|
80e98ef |
+ ::com::sun::star::frame::XTerminateListener >
|
|
|
80e98ef |
{
|
|
|
80e98ef |
private:
|
|
|
80e98ef |
osl::Mutex maLock;
|
|
|
80e98ef |
GtkWidget *mpDialog;
|
|
|
80e98ef |
GdkWindow *mpCreatedParent;
|
|
|
80e98ef |
::com::sun::star::uno::Reference< ::com::sun::star::awt::XExtendedToolkit> mxToolkit;
|
|
|
80e98ef |
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > mxDesktop;
|
|
|
80e98ef |
public:
|
|
|
80e98ef |
|
|
|
80e98ef |
// XTopWindowListener
|
|
|
80e98ef |
@@ -112,8 +117,17 @@ public:
|
|
|
80e98ef |
throw (::com::sun::star::uno::RuntimeException) {}
|
|
|
80e98ef |
virtual void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& )
|
|
|
80e98ef |
throw (::com::sun::star::uno::RuntimeException) {}
|
|
|
80e98ef |
+
|
|
|
80e98ef |
+ // XTerminateListener
|
|
|
80e98ef |
+ virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& aEvent )
|
|
|
80e98ef |
+ throw(::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException);
|
|
|
80e98ef |
+ virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& aEvent )
|
|
|
80e98ef |
+ throw(::com::sun::star::uno::RuntimeException);
|
|
|
80e98ef |
public:
|
|
|
80e98ef |
- RunDialog(GtkWidget *pDialog, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XExtendedToolkit > &rToolkit);
|
|
|
80e98ef |
+ RunDialog(GtkWidget *pDialog,
|
|
|
80e98ef |
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XExtendedToolkit > &rToolkit,
|
|
|
80e98ef |
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > &rDesktop
|
|
|
80e98ef |
+ );
|
|
|
80e98ef |
gint run();
|
|
|
80e98ef |
void cancel();
|
|
|
80e98ef |
~RunDialog();
|
|
|
80e98ef |
--
|
|
|
80e98ef |
1.7.3.5
|
|
|
80e98ef |
|