From 352fadd9d80fc8b220dc604d1241e831b458629c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Nov 25 2010 13:23:21 +0000 Subject: Resolves: rhbz#610103 exit quickstarter when libs deleted --- diff --git a/exit.quickstarter.when.deleted.patch b/exit.quickstarter.when.deleted.patch new file mode 100644 index 0000000..411ac5d --- /dev/null +++ b/exit.quickstarter.when.deleted.patch @@ -0,0 +1,111 @@ +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..1b78f9b 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 ++#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; diff --git a/libreoffice.spec b/libreoffice.spec index 6fa64fe..3dd4a0a 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -28,7 +28,7 @@ Summary: Free Software Productivity Suite Name: libreoffice Version: 3.2.99.3 -Release: 1%{?dist} +Release: 2%{?dist} License: LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and (CDDL or GPLv2) and Public Domain Group: Applications/Productivity URL: http://www.documentfoundation.org/develop @@ -95,6 +95,7 @@ Patch11: openoffice.org-3.3.0.ooo113273.desktop.resolvelinks.patch Patch12: turn-script-providers-into-extensions.patch Patch13: qstart.dont-forceenabled-on-post-reg-restart.patch Patch14: libreoffice-installfix.patch +Patch15: exit.quickstarter.when.deleted.patch %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %define instdir %{_libdir} @@ -706,6 +707,7 @@ cp -p %{SOURCE20} external/unowinreg/unowinreg.dll %patch12 -p1 -b .turn-script-providers-into-extensions.patch %patch13 -p1 -b .qstart.dont-forceenabled-on-post-reg-restart.patch %patch14 -p1 -b .libreoffice-installfix.patch +%patch15 -p1 -b .exit.quickstarter.when.deleted.patch touch scripting/source/pyprov/delzip touch scripting/util/provider/beanshell/delzip touch scripting/util/provider/javascript/delzip @@ -1990,6 +1992,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || : %changelog +* Thu Nov 25 2010 Caolán McNamara 3.2.99.3-2 +- Resolves: rhbz#610103 exit quickstarter when libs deleted + * Thu Nov 18 2010 Caolán McNamara