[Libreoffice-commits] .: 8 commits - scripting/source sfx2/source shell/source ucb/source xmlhelp/source xmloff/source

Caolán McNamara caolan at kemper.freedesktop.org
Thu Nov 25 08:06:34 PST 2010


 scripting/source/stringresource/stringresource.cxx        |    2 
 sfx2/source/appl/makefile.mk                              |    4 +
 sfx2/source/appl/shutdowniconunx.cxx                      |   50 +++++++++++++-
 sfx2/source/doc/doctemplates.cxx                          |    4 -
 sfx2/source/doc/guisaveas.cxx                             |    2 
 shell/source/unix/sysshell/recently_used_file_handler.cxx |    4 -
 ucb/source/ucp/file/filtask.hxx                           |    2 
 xmlhelp/source/cxxhelp/provider/databases.hxx             |   12 +--
 xmloff/source/draw/animationexport.cxx                    |   20 ++---
 9 files changed, 76 insertions(+), 24 deletions(-)

New commits:
commit 785ef1daae1e0f508edf5bff7e1dd09574daf6bd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Nov 25 13:38:40 2010 +0000

    Resolves: rhbz#610103 exit quickstarter if physically deleted

diff --git a/sfx2/source/appl/makefile.mk b/sfx2/source/appl/makefile.mk
index 72ac94a..a583102 100644
--- a/sfx2/source/appl/makefile.mk
+++ b/sfx2/source/appl/makefile.mk
@@ -53,6 +53,10 @@ CFLAGS+=-DENABLE_QUICKSTART_APPLET
         CDEFS+=-DDLL_NAME=libsfx$(DLLPOSTFIX)$(DLLPOST)
 .IF "$(ENABLE_SYSTRAY_GTK)"=="TRUE"
         PKGCONFIG_MODULES=gtk+-2.0
+.IF "$(ENABLE_GIO)"!=""
+        PKGCONFIG_MODULES+=gio-2.0
+        CDEFS+=-DENABLE_GIO
+.ENDIF
         .INCLUDE: pkg_config.mk
         CFLAGS+=$(PKGCONFIG_CFLAGS)
         CFLAGS+=-DENABLE_QUICKSTART_APPLET
diff --git a/sfx2/source/appl/shutdowniconunx.cxx b/sfx2/source/appl/shutdowniconunx.cxx
index e31c32f..db0f232 100644
--- a/sfx2/source/appl/shutdowniconunx.cxx
+++ b/sfx2/source/appl/shutdowniconunx.cxx
@@ -19,6 +19,10 @@
 #include "shutdownicon.hxx"
 #endif
 
+#ifdef ENABLE_GIO
+#include <gio/gio.h>
+#endif
+
 // Cut/paste from vcl/inc/svids.hrc
 #define SV_ICON_SMALL_START                 25000
 
@@ -39,6 +43,9 @@ static EggTrayIcon *pTrayIcon;
 static GtkWidget *pExitMenuItem = NULL;
 static GtkWidget *pOpenMenuItem = NULL;
 static GtkWidget *pDisableMenuItem = NULL;
+#ifdef ENABLE_GIO
+GFileMonitor* pMonitor = NULL;
+#endif
 
 static void open_url_cb( GtkWidget *, gpointer data )
 {
@@ -358,6 +365,22 @@ extern "C" {
     }
 }
 
+#ifdef ENABLE_GIO
+/*
+ * See rhbz#610103. If the quickstarter is running, then LibreOffice is
+ * upgraded, then the old quickstarter is still running, but is now unreliable
+ * as the old install has been deleted. A fairly intractable problem but we
+ * can avoid much of the pain if we turn off the quickstarter if we detect
+ * that it has been physically deleted.
+*/
+static void notify_file_changed(GFileMonitor * /*gfilemonitor*/, GFile * /*arg1*/,
+    GFile * /*arg2*/, GFileMonitorEvent event_type, gpointer /*user_data*/)
+{
+    if (event_type == G_FILE_MONITOR_EVENT_DELETED)
+        exit_quickstarter_cb(GTK_WIDGET(pTrayIcon));
+}
+#endif
+
 void SAL_DLLPUBLIC_EXPORT plugin_init_sys_tray()
 {
     ::SolarMutexGuard aGuard;
@@ -403,6 +426,20 @@ void SAL_DLLPUBLIC_EXPORT plugin_init_sys_tray()
 
     g_signal_connect(GTK_WIDGET(pTrayIcon), "destroy",
             G_CALLBACK(exit_quickstarter_cb), NULL);
+
+#ifdef ENABLE_GIO
+    GFile* pFile = NULL;
+    rtl::OUString sLibraryFileUrl;
+    if (osl::Module::getUrlFromAddress(plugin_init_sys_tray, sLibraryFileUrl))
+        pFile = g_file_new_for_uri(rtl::OUStringToOString(sLibraryFileUrl, RTL_TEXTENCODING_UTF8).getStr());
+
+    if (pFile)
+    {
+        if ((pMonitor = g_file_monitor_file(pFile, G_FILE_MONITOR_NONE, NULL, NULL)))
+            g_signal_connect(pMonitor, "changed", (GCallback)notify_file_changed, NULL);
+        g_object_unref(pFile);
+    }
+#endif
 }
 
 void SAL_DLLPUBLIC_EXPORT plugin_shutdown_sys_tray()
@@ -411,6 +448,17 @@ void SAL_DLLPUBLIC_EXPORT plugin_shutdown_sys_tray()
     if( !pTrayIcon )
         return;
 
+#ifdef ENABLE_GIO
+    if (pMonitor)
+    {
+        g_signal_handlers_disconnect_by_func(pMonitor,
+            (void*)notify_file_changed, pMonitor);
+        g_file_monitor_cancel(pMonitor);
+        g_object_unref(pMonitor);
+        pMonitor = NULL;
+    }
+#endif
+
     /* we have to set pTrayIcon to NULL now, because gtk_widget_destroy
      * causes calling exit_quickstarter_cb (which then calls this func.)
      * again -> crash.
@@ -419,7 +467,7 @@ void SAL_DLLPUBLIC_EXPORT plugin_shutdown_sys_tray()
      */
     GtkWidget* const pIcon = GTK_WIDGET( pTrayIcon );
     pTrayIcon = NULL;
-	gtk_widget_destroy( pIcon );
+    gtk_widget_destroy( pIcon );
 
     pExitMenuItem = NULL;
     pOpenMenuItem = NULL;
commit d8ee330ae492b1a19c4211081edd574ec1603418
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Nov 25 11:57:37 2010 +0000

    cppcheck: methods can be const

diff --git a/shell/source/unix/sysshell/recently_used_file_handler.cxx b/shell/source/unix/sysshell/recently_used_file_handler.cxx
index 76d7d1e..c144dbb 100644
--- a/shell/source/unix/sysshell/recently_used_file_handler.cxx
+++ b/shell/source/unix/sysshell/recently_used_file_handler.cxx
@@ -396,8 +396,8 @@ namespace /* private */ {
             uri_(uri) 
         {}
             
-        bool operator() (const recently_used_item* item)
-        { return (item->uri_ == uri_); }        
+        bool operator() (const recently_used_item* item) const
+            { return (item->uri_ == uri_); }
     private:
         string_t uri_;
     };
commit 9bdacf916d64657a318bd08e3c1157bf414b4743
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Nov 25 11:54:13 2010 +0000

    cppcheck: methods can be const

diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx
index 590042d..a91de97 100644
--- a/xmloff/source/draw/animationexport.cxx
+++ b/xmloff/source/draw/animationexport.cxx
@@ -526,11 +526,11 @@ public:
 
     Reference< XInterface > getParagraphTarget( const ParagraphTarget* pTarget ) const;
 
-    void convertPath( OUStringBuffer& sTmp, const Any& rPath );
-    void convertValue( XMLTokenEnum eAttributeName, OUStringBuffer& sTmp, const Any& rValue );
-    void convertTiming( OUStringBuffer& sTmp, const Any& rTiming );
-    void convertSource( OUStringBuffer& sTmp, const Any& rSource );
-    void convertTarget( OUStringBuffer& sTmp, const Any& rTarget );
+    void convertPath( OUStringBuffer& sTmp, const Any& rPath ) const;
+    void convertValue( XMLTokenEnum eAttributeName, OUStringBuffer& sTmp, const Any& rValue ) const;
+    void convertTiming( OUStringBuffer& sTmp, const Any& rTiming ) const;
+    void convertSource( OUStringBuffer& sTmp, const Any& rSource ) const;
+    void convertTarget( OUStringBuffer& sTmp, const Any& rTarget ) const;
 
     void prepareValue( const Any& rValue );
 
@@ -1437,7 +1437,7 @@ Reference< XInterface > AnimationsExporterImpl::getParagraphTarget( const Paragr
     return xRef;
 }
 
-void AnimationsExporterImpl::convertPath( OUStringBuffer& sTmp, const Any& rPath )
+void AnimationsExporterImpl::convertPath( OUStringBuffer& sTmp, const Any& rPath ) const
 {
     OUString aStr;
     rPath >>= aStr;
@@ -1445,7 +1445,7 @@ void AnimationsExporterImpl::convertPath( OUStringBuffer& sTmp, const Any& rPath
     sTmp = aStr;
 }
 
-void AnimationsExporterImpl::convertValue( XMLTokenEnum eAttributeName, OUStringBuffer& sTmp, const Any& rValue )
+void AnimationsExporterImpl::convertValue( XMLTokenEnum eAttributeName, OUStringBuffer& sTmp, const Any& rValue ) const
 {
     if( !rValue.hasValue() )
         return;
@@ -1581,7 +1581,7 @@ void AnimationsExporterImpl::convertValue( XMLTokenEnum eAttributeName, OUString
 */
 }
 
-void AnimationsExporterImpl::convertTiming( OUStringBuffer& sTmp, const Any& rValue )
+void AnimationsExporterImpl::convertTiming( OUStringBuffer& sTmp, const Any& rValue ) const
 {
     if( !rValue.hasValue() )
         return;
@@ -1648,12 +1648,12 @@ void AnimationsExporterImpl::convertTiming( OUStringBuffer& sTmp, const Any& rVa
     }	
 }
 
-void AnimationsExporterImpl::convertSource( OUStringBuffer& sTmp, const Any& rSource )
+void AnimationsExporterImpl::convertSource( OUStringBuffer& sTmp, const Any& rSource ) const
 {
     convertTarget( sTmp, rSource );
 }
 
-void AnimationsExporterImpl::convertTarget( OUStringBuffer& sTmp, const Any& rTarget )
+void AnimationsExporterImpl::convertTarget( OUStringBuffer& sTmp, const Any& rTarget ) const
 {
     if( !rTarget.hasValue() )
         return;
commit 5ef31eb1dcb4c01adea9c41930fb5fbdcfce4c2a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Nov 25 11:40:42 2010 +0000

    cppcheck: methods can be const

diff --git a/ucb/source/ucp/file/filtask.hxx b/ucb/source/ucp/file/filtask.hxx
index a348761..0b499c9 100644
--- a/ucb/source/ucp/file/filtask.hxx
+++ b/ucb/source/ucp/file/filtask.hxx
@@ -93,7 +93,7 @@ namespace fileaccess
                 m_bHandled = true;
             }
 
-            bool isHandled()
+            bool isHandled() const
             {
                 return true;
             }
commit 0cca9165eaf1cd4b559ad2928a46f16fac307a9f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Nov 25 11:26:49 2010 +0000

    cppcheck: methods can be const

diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index ea9f3c9..ffcfe78 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -375,8 +375,8 @@ public:
     void                setHierarchyURL( const OUString& rURL ) { maHierarchyURL = rURL; }
     void                setTargetURL( const OUString& rURL ) { maTargetURL = rURL; }
 
-    sal_Bool            getInUse() { return mbInUse; }
-    sal_Bool            getInHierarchy() { return mbInHierarchy; }
+    sal_Bool            getInUse() const { return mbInUse; }
+    sal_Bool            getInHierarchy() const { return mbInHierarchy; }
     const OUString&     getHierarchyURL() const { return maHierarchyURL; }
     const OUString&     getTargetURL() const { return maTargetURL; }
     const OUString&     getTitle() const { return maTitle; }
commit feb744e8719e911324cc10f07fb0c37acc28fe70
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Nov 25 11:23:03 2010 +0000

    cppcheck: methods can be const

diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx
index 4aa17a7..f923348 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -1518,7 +1518,7 @@ public:
     Reference< io::XInputStream > getInputStreamForSection( sal_Int32 nSize );
 
     void seek( sal_Int32 nPos );
-    sal_Int32 getPosition( void )
+    sal_Int32 getPosition( void ) const
         { return m_nCurPos; }
 
     sal_Int16 readInt16( void );
commit 71fcbeceadd95d9861aede0f101f35146e0232db
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Nov 25 11:16:15 2010 +0000

    remove empty method

diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 5b0dc7c..a2a7e07 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -272,7 +272,7 @@ public:
 
     ::comphelper::SequenceAsHashMap& GetMediaDescr() { return m_aMediaDescrHM; }
 
-    sal_Bool IsRecommendReadOnly() { return m_bRecommendReadOnly; }
+    sal_Bool IsRecommendReadOnly() const { return m_bRecommendReadOnly; }
 
     const ::comphelper::SequenceAsHashMap& GetDocProps();
 
commit 8cf86b504fea3c5fed5af481dd576b049787603f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Nov 25 11:07:46 2010 +0000

    cppcheck: methods can be const

diff --git a/xmlhelp/source/cxxhelp/provider/databases.hxx b/xmlhelp/source/cxxhelp/provider/databases.hxx
index 134adbd..0018ad5 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.hxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.hxx
@@ -99,12 +99,12 @@ namespace chelp {
         
         ~StaticModuleInformation() { }
 
-        rtl::OUString get_title()     { return m_aTitle; }
-        rtl::OUString get_id()        { return m_aStartId; }
-        rtl::OUString get_program()   { return m_aProgramSwitch; }
-        rtl::OUString get_heading()   { return m_aHeading; }
-        rtl::OUString get_fulltext()  { return m_aFulltext; }
-        int get_order() { return m_nOrder; }
+        rtl::OUString get_title() const { return m_aTitle; }
+        rtl::OUString get_id() const { return m_aStartId; }
+        rtl::OUString get_program() const { return m_aProgramSwitch; }
+        rtl::OUString get_heading() const { return m_aHeading; }
+        rtl::OUString get_fulltext() const { return m_aFulltext; }
+        int get_order() const { return m_nOrder; }
     };  // end class StaticModuleInformation
     
     


More information about the Libreoffice-commits mailing list