incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r1189586 - in /incubator/ooo/trunk/main: ./ desktop/source/app/ scp2/source/ooo/ sfx2/ sfx2/source/appl/
Date Thu, 27 Oct 2011 02:45:30 GMT
Author: pfg
Date: Thu Oct 27 02:45:30 2011
New Revision: 1189586

URL: http://svn.apache.org/viewvc?rev=1189586&view=rev
Log:
i118519 - gtk quickstarter: use GtkStatusIcon instead of libegg. Patch by Ariel Constenla-Haile

Modified:
    incubator/ooo/trunk/main/configure.in
    incubator/ooo/trunk/main/desktop/source/app/app.cxx
    incubator/ooo/trunk/main/desktop/source/app/cmdlineargs.cxx
    incubator/ooo/trunk/main/desktop/source/app/makefile.mk
    incubator/ooo/trunk/main/scp2/source/ooo/common_brand.scp
    incubator/ooo/trunk/main/scp2/source/ooo/file_library_ooo.scp
    incubator/ooo/trunk/main/sfx2/Library_sfx.mk
    incubator/ooo/trunk/main/sfx2/source/appl/shutdownicon.cxx
    incubator/ooo/trunk/main/sfx2/source/appl/shutdowniconunx.cxx

Modified: incubator/ooo/trunk/main/configure.in
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/configure.in?rev=1189586&r1=1189585&r2=1189586&view=diff
==============================================================================
--- incubator/ooo/trunk/main/configure.in (original)
+++ incubator/ooo/trunk/main/configure.in Thu Oct 27 02:45:30 2011
@@ -5797,8 +5797,10 @@ if test  "$test_gtk" = "yes"; then
       BUILD_TYPE="$BUILD_TYPE GTK"
 
       if test "x$enable_systray" = "xyes"; then
-         ENABLE_SYSTRAY_GTK="TRUE"
-         BUILD_TYPE="$BUILD_TYPE SYSTRAY_GTK"
+         PKG_CHECK_MODULES(GTK_2_16,gtk+-2.0 >= 2.16.0,
+                           [ENABLE_SYSTRAY_GTK="TRUE"
+                            BUILD_TYPE="$BUILD_TYPE SYSTRAY_GTK"],
+                           [ENABLE_SYSTRAY_GTK=""])
       fi
 
       AC_MSG_CHECKING([whether to enable DBUS support])

Modified: incubator/ooo/trunk/main/desktop/source/app/app.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/desktop/source/app/app.cxx?rev=1189586&r1=1189585&r2=1189586&view=diff
==============================================================================
--- incubator/ooo/trunk/main/desktop/source/app/app.cxx (original)
+++ incubator/ooo/trunk/main/desktop/source/app/app.cxx Thu Oct 27 02:45:30 2011
@@ -132,6 +132,8 @@
 #include <unotools/syslocaleoptions.hxx>
 #include <unotools/syslocale.hxx>
 #include <svl/folderrestriction.hxx>
+#include <svl/eitem.hxx>
+#include <svl/itemset.hxx>
 #include <unotools/tempfile.hxx>
 #include <rtl/logfile.hxx>
 #include <rtl/ustrbuf.hxx>
@@ -145,6 +147,7 @@
 #include <vcl/stdtext.hxx>
 #include <vcl/msgbox.hxx>
 #include <sfx2/sfx.hrc>
+#include <sfx2/app.hxx>
 #include <ucbhelper/contentbroker.hxx>
 #include <unotools/bootstrap.hxx>
 #include <cppuhelper/bootstrap.hxx>
@@ -2118,12 +2121,21 @@ sal_Bool Desktop::InitializeQuickstartMo
         RTL_LOGFILE_CONTEXT( aLog, "desktop (cd100003) createInstance com.sun.star.office.Quickstart"
);
 
         sal_Bool bQuickstart = GetCommandLineArgs()->IsQuickstart();
+        if ( !bQuickstart )
+        {
+            SfxItemSet aOptSet( SFX_APP()->GetPool(), SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER
);
+            SFX_APP()->GetOptions(aOptSet);
+            const SfxPoolItem* pItem;
+            if ( SFX_ITEM_SET == aOptSet.GetItemState( SID_ATTR_QUICKLAUNCHER, sal_False,
&pItem ) )
+                bQuickstart = ((const SfxBoolItem*)pItem)->GetValue();
+        }
+
         Sequence< Any > aSeq( 1 );
         aSeq[0] <<= bQuickstart;
 
         // Try to instanciate quickstart service. This service is not mandatory, so
         // do nothing if service is not available
-        
+
         // #i105753# the following if was invented for performance
         // unfortunately this broke the QUARTZ behavior which is to always run
         // in quickstart mode since Mac applications do not usually quit

Modified: incubator/ooo/trunk/main/desktop/source/app/cmdlineargs.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/desktop/source/app/cmdlineargs.cxx?rev=1189586&r1=1189585&r2=1189586&view=diff
==============================================================================
--- incubator/ooo/trunk/main/desktop/source/app/cmdlineargs.cxx (original)
+++ incubator/ooo/trunk/main/desktop/source/app/cmdlineargs.cxx Thu Oct 27 02:45:30 2011
@@ -422,7 +422,7 @@ sal_Bool CommandLineArgs::InterpretComma
     }
     else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-quickstart" )) == sal_True
)
     {
-#if defined(WNT) || defined(OS2) || defined(QUARTZ)
+#if defined(ENABLE_QUICKSTART_APPLET)
         SetBoolParam_Impl( CMD_BOOLPARAM_QUICKSTART, sal_True );
 #endif
         SetBoolParam_Impl( CMD_BOOLPARAM_NOQUICKSTART, sal_False );

Modified: incubator/ooo/trunk/main/desktop/source/app/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/desktop/source/app/makefile.mk?rev=1189586&r1=1189585&r2=1189586&view=diff
==============================================================================
--- incubator/ooo/trunk/main/desktop/source/app/makefile.mk (original)
+++ incubator/ooo/trunk/main/desktop/source/app/makefile.mk Thu Oct 27 02:45:30 2011
@@ -41,6 +41,10 @@ ENABLE_EXCEPTIONS=TRUE
 CFLAGS+=-DGNOME_VFS_ENABLED
 .ENDIF
 
+.IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2" || "$(GUIBASE)"=="aqua" || "$(ENABLE_SYSTRAY_GTK)"=="TRUE"
+CFLAGS+=-DENABLE_QUICKSTART_APPLET
+.ENDIF
+
 # .IF "$(OS)" == "WNT"
 # .IF "$(COM)" == "GCC"
 # DEPLOYMENTMISCLIB = -ldeploymentmisc$(DLLPOSTFIX)

Modified: incubator/ooo/trunk/main/scp2/source/ooo/common_brand.scp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/scp2/source/ooo/common_brand.scp?rev=1189586&r1=1189585&r2=1189586&view=diff
==============================================================================
--- incubator/ooo/trunk/main/scp2/source/ooo/common_brand.scp (original)
+++ incubator/ooo/trunk/main/scp2/source/ooo/common_brand.scp Thu Oct 27 02:45:30 2011
@@ -98,7 +98,7 @@ Module gid_Module_Root_Brand
              gid_Brand_File_Share_Xdg_JavaFilter,
              gid_Brand_File_Share_Xdg_Math,
              gid_Brand_File_Share_Xdg_Printeradmin,
-//             gid_Brand_File_Share_Xdg_QStart,
+             gid_Brand_File_Share_Xdg_QStart,
              gid_Brand_File_Share_Xdg_StartCenter,
              gid_Brand_File_Share_Xdg_Writer,
              gid_Brand_File_Txt_Package);
@@ -738,16 +738,16 @@ File gid_Brand_File_Share_Xdg_Printeradm
 End
 #endif
 
-//#if defined UNX && ! defined MACOSX
-//#ifdef ENABLE_GTK
-//File gid_Brand_File_Share_Xdg_QStart
-//    TXT_FILE_BODY;
-//    Dir = gid_Brand_Dir_Share_Xdg;
-//    Styles = (PACKED,SCPZIP_REPLACE);
-//    Name = "qstart.desktop";
-//End
-//#endif
-//#endif
+#if defined UNX && ! defined MACOSX
+#ifdef ENABLE_GTK
+File gid_Brand_File_Share_Xdg_QStart
+    TXT_FILE_BODY;
+    Dir = gid_Brand_Dir_Share_Xdg;
+    Styles = (PACKED,SCPZIP_REPLACE);
+    Name = "qstart.desktop";
+End
+#endif
+#endif
 
 #if defined UNX && ! defined MACOSX
 File gid_Brand_File_Share_Xdg_Writer

Modified: incubator/ooo/trunk/main/scp2/source/ooo/file_library_ooo.scp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/scp2/source/ooo/file_library_ooo.scp?rev=1189586&r1=1189585&r2=1189586&view=diff
==============================================================================
--- incubator/ooo/trunk/main/scp2/source/ooo/file_library_ooo.scp (original)
+++ incubator/ooo/trunk/main/scp2/source/ooo/file_library_ooo.scp Thu Oct 27 02:45:30 2011
@@ -208,25 +208,18 @@ End
 
 #endif
 
-//#ifdef UNX
-//#ifdef ENABLE_GTK
-//#ifdef ENABLE_SYSTRAY_GTK
-//File gid_File_Lib_Egg_Tray
-// TXT_FILE_BODY;
-// Styles = (PACKED);
-// Dir = SCP2_OOO_BIN_DIR;
-// Name = STRING(CONCAT3(libeggtray,DLLPOSTFIX,UNXSUFFIX));
-//End
-//
-//File gid_File_Lib_QStart_Gtk
-//    Name = LIBNAME(qstart_gtk);
-//    TXT_FILE_BODY;
-//    Styles = (PACKED);
-//    Dir = SCP2_OOO_BIN_DIR;
-//End
-//#endif
-//#endif
-//#endif
+#ifdef UNX
+#ifdef ENABLE_GTK
+#ifdef ENABLE_SYSTRAY_GTK
+File gid_File_Lib_QStart_Gtk
+    Name = LIBNAME(qstart_gtk);
+    TXT_FILE_BODY;
+    Styles = (PACKED);
+    Dir = SCP2_OOO_BIN_DIR;
+End
+#endif
+#endif
+#endif
 
 STD_LIB_FILE( gid_File_Lib_Dba, dba)
 

Modified: incubator/ooo/trunk/main/sfx2/Library_sfx.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sfx2/Library_sfx.mk?rev=1189586&r1=1189585&r2=1189586&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sfx2/Library_sfx.mk (original)
+++ incubator/ooo/trunk/main/sfx2/Library_sfx.mk Thu Oct 27 02:45:30 2011
@@ -273,6 +273,14 @@ $(eval $(call gb_Library_set_defs,sfx,\
 ))
 endif
 
+ifeq ($(ENABLE_SYSTRAY_GTK),TRUE)
+$(eval $(call gb_Library_set_defs,sfx,\
+	$$(DEFS) \
+	-DENABLE_QUICKSTART_APPLET \
+	-DENABLE_SYSTRAY_GTK \
+))
+endif
+
 ifeq ($(OS),OS2)
 $(eval $(call gb_Library_add_exception_objects,sfx,\
     sfx2/source/appl/shutdowniconOs2.ob \

Modified: incubator/ooo/trunk/main/sfx2/source/appl/shutdownicon.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sfx2/source/appl/shutdownicon.cxx?rev=1189586&r1=1189585&r2=1189586&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sfx2/source/appl/shutdownicon.cxx (original)
+++ incubator/ooo/trunk/main/sfx2/source/appl/shutdownicon.cxx Thu Oct 27 02:45:30 2011
@@ -62,6 +62,7 @@
 #include <osl/security.hxx>
 #include <osl/file.hxx>
 #include <rtl/bootstrap.hxx>
+#include <rtl/ustrbuf.hxx>
 #include <tools/link.hxx>
 #ifdef UNX // need symlink
 #include <unistd.h>
@@ -826,8 +827,15 @@ rtl::OUString ShutdownIcon::getShortcutN
 	aShortcut += OUString( RTL_CONSTASCII_USTRINGPARAM( "\\" ) );
 	aShortcut += aShortcutName;
 #else // UNX
-	OUString aShortcut = getDotAutostart();
-	aShortcut += OUString( RTL_CONSTASCII_USTRINGPARAM( "/qstart.desktop" ) );
+    OUStringBuffer aStrBuff( getDotAutostart() );
+    aStrBuff.appendAscii( RTL_CONSTASCII_STRINGPARAM( "/" ) );
+    if ( sal_Int32 len = aShortcutName.getLength() )
+        aStrBuff.append( aShortcutName.getStr(), len );
+    else
+        aStrBuff.appendAscii( RTL_CONSTASCII_STRINGPARAM( "qstart" ) );
+    aStrBuff.appendAscii( RTL_CONSTASCII_STRINGPARAM( ".desktop" ) );
+
+    OUString aShortcut( aStrBuff.makeStringAndClear() );
 #endif // UNX
 	return aShortcut;
 #endif // ENABLE_QUICKSTART_APPLET

Modified: incubator/ooo/trunk/main/sfx2/source/appl/shutdowniconunx.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sfx2/source/appl/shutdowniconunx.cxx?rev=1189586&r1=1189585&r2=1189586&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sfx2/source/appl/shutdowniconunx.cxx (original)
+++ incubator/ooo/trunk/main/sfx2/source/appl/shutdowniconunx.cxx Thu Oct 27 02:45:30 2011
@@ -2,12 +2,10 @@
 #ifdef ENABLE_QUICKSTART_APPLET
 
 #include <unotools/moduleoptions.hxx>
-
 #include <unotools/dynamicmenuoptions.hxx>
 
 #include <gtk/gtk.h>
 #include <glib.h>
-#include <eggtray/eggtrayicon.h>
 #include <vos/mutex.hxx>
 #include <vcl/bitmapex.hxx>
 #include <vcl/bmpacc.hxx>
@@ -21,6 +19,7 @@
 #endif
 
 // Cut/paste from vcl/inc/svids.hrc
+#define SV_ICON_LARGE_START                 24000
 #define SV_ICON_SMALL_START                 25000
 
 #define SV_ICON_ID_OFFICE                       1
@@ -36,9 +35,10 @@ using namespace ::rtl;
 using namespace ::osl;
 
 static ResMgr *pVCLResMgr;
-static EggTrayIcon *pTrayIcon;
+static GtkStatusIcon *pTrayIcon;
 static GtkWidget *pExitMenuItem = NULL;
 static GtkWidget *pOpenMenuItem = NULL;
+static GtkWidget *pDisableMenuItem = NULL;
 
 static void open_url_cb( GtkWidget *, gpointer data )
 {
@@ -66,7 +66,6 @@ static void systray_disable_cb()
 
 static void exit_quickstarter_cb( GtkWidget * )
 {
-	egg_tray_icon_cancel_message (pTrayIcon, 1 );
 	ShutdownIcon::getInstance()->terminateDesktop();
 	plugin_shutdown_sys_tray();
 }
@@ -78,7 +77,7 @@ static void menu_deactivate_cb( GtkWidge
 
 static GdkPixbuf * ResIdToPixbuf( sal_uInt16 nResId )
 {
-	ResId aResId( SV_ICON_SMALL_START + nResId, *pVCLResMgr );
+	ResId aResId( nResId, *pVCLResMgr );
 	BitmapEx aIcon( aResId );
 	Bitmap pInSalBitmap = aIcon.GetBitmap();
 	AlphaMask pInSalAlpha = aIcon.GetAlpha();
@@ -152,9 +151,9 @@ static void add_item( GtkMenuShell *pMen
 									RTL_TEXTENCODING_UTF8);
 	}
 
-	GdkPixbuf *pPixbuf= ResIdToPixbuf( nResId );
-	GtkWidget *pImage = gtk_image_new_from_pixbuf( pPixbuf );
-	g_object_unref( G_OBJECT( pPixbuf ) );
+    GdkPixbuf *pPixbuf= ResIdToPixbuf( SV_ICON_SMALL_START + nResId );
+    GtkWidget *pImage = gtk_image_new_from_pixbuf( pPixbuf );
+    g_object_unref( G_OBJECT( pPixbuf ) );
 
 	GtkWidget *pMenuItem = gtk_image_menu_item_new_with_label( aLabel );
 	gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM( pMenuItem ), pImage );
@@ -262,10 +261,11 @@ static void populate_menu( GtkWidget *pM
 		 pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ),
 		 G_CALLBACK( open_file_cb ));
 
+
 	pMenuItem = gtk_separator_menu_item_new();
 	gtk_menu_shell_append( pMenuShell, pMenuItem );
 
-	(void) add_image_menu_item
+	pDisableMenuItem = add_image_menu_item
         ( pMenuShell, GTK_STOCK_CLOSE,
 		  pShutdownIcon->GetResString( STR_QUICKSTART_PRELAUNCH_UNX ),
 		  G_CALLBACK( systray_disable_cb ) );
@@ -289,31 +289,9 @@ static void refresh_menu( GtkWidget *pMe
 	bool bModal = ShutdownIcon::bModalMode;
 	gtk_widget_set_sensitive( pExitMenuItem, !bModal);
 	gtk_widget_set_sensitive( pOpenMenuItem, !bModal);
+    gtk_widget_set_sensitive( pDisableMenuItem, !bModal);
 }
 
-extern "C" {
-static void
-layout_menu( GtkMenu *menu,
-			 gint *x, gint *y, gboolean *push_in,
-			 gpointer )
-{
-	GtkRequisition req;
-	GtkWidget *ebox = GTK_BIN( pTrayIcon )->child;
-
-	gtk_widget_size_request( GTK_WIDGET( menu ), &req );
-	gdk_window_get_origin( ebox->window, x, y );
-
-	(*x) += ebox->allocation.x;
-	(*y) += ebox->allocation.y;
-
-	if (*y >= gdk_screen_get_height (gtk_widget_get_screen (ebox)) / 2)
-		(*y) -= req.height;
-	else
-		(*y) += ebox->allocation.height;
-
-	*push_in = sal_True;
-}
-}
 
 static gboolean display_menu_cb( GtkWidget *,
 								 GdkEventButton *event, GtkWidget *pMenu )
@@ -321,36 +299,15 @@ static gboolean display_menu_cb( GtkWidg
 	if (event->button == 2)
 		return sal_False;
 
-#ifdef TEMPLATE_DIALOG_MORE_POLISHED
-	if (event->button == 1 &&
-		event->type == GDK_2BUTTON_PRESS)
-	{
-		open_template_cb( NULL );
-		return sal_True;
-	}
-	if (event->button == 3)
-	{
-		... as below ...
-#endif
-
 	refresh_menu( pMenu );
 
 	gtk_menu_popup( GTK_MENU( pMenu ), NULL, NULL,
-					layout_menu, NULL, 0, event->time );
+                    gtk_status_icon_position_menu,
+                    pTrayIcon, 0, event->time );
 
 	return sal_True;
 }
 
-extern "C" {
-	static gboolean
-	show_at_idle( gpointer )
-	{
-		::vos::OGuard aGuard( Application::GetSolarMutex() );
-		gtk_widget_show_all( GTK_WIDGET( pTrayIcon ) );
-		return sal_False;
-	}
-}
-
 void SAL_DLLPUBLIC_EXPORT plugin_init_sys_tray()
 {
 	::vos::OGuard aGuard( Application::GetSolarMutex() );
@@ -358,41 +315,42 @@ void SAL_DLLPUBLIC_EXPORT plugin_init_sy
 	if( !g_type_from_name( "GdkDisplay" ) )
 		return;
 
+    ShutdownIcon *pShutdownIcon = ShutdownIcon::getInstance();
+    if ( !pShutdownIcon )
+        return;
+
+    pTrayIcon = gtk_status_icon_new();
+    pVCLResMgr = CREATEVERSIONRESMGR( vcl );
+
+    if ( !pTrayIcon || !pVCLResMgr )
+        return;
+
+    // disable shutdown
+    pShutdownIcon->SetVeto( true );
+    pShutdownIcon->addTerminateListener();
+
 	OString aLabel;
-	ShutdownIcon *pShutdownIcon = ShutdownIcon::getInstance();
 
 	aLabel = rtl::OUStringToOString (
 			pShutdownIcon->GetResString( STR_QUICKSTART_TIP ),
 			RTL_TEXTENCODING_UTF8 );
 
-	pTrayIcon = egg_tray_icon_new( aLabel );
-
-	GtkWidget *pParent = gtk_event_box_new();
-	GtkTooltips *pTooltips = gtk_tooltips_new();
-	gtk_tooltips_set_tip( GTK_TOOLTIPS( pTooltips ), pParent, aLabel, NULL );
+	GdkPixbuf *pPixbuf = ResIdToPixbuf( SV_ICON_LARGE_START + SV_ICON_ID_OFFICE );
+    g_object_set( G_OBJECT( pTrayIcon ),
+                  "pixbuf", pPixbuf,
+                  "title", aLabel.getStr(),
+                  NULL );
+	g_object_unref( pPixbuf );
 
-	GtkWidget *pIconImage = gtk_image_new();
-	gtk_container_add( GTK_CONTAINER( pParent ), pIconImage );
+    gtk_status_icon_set_tooltip_text( pTrayIcon, aLabel.getStr() );
 
-	pVCLResMgr = CREATEVERSIONRESMGR( vcl );
+	GtkWidget *pMenu = gtk_menu_new();
 
-	GdkPixbuf *pPixbuf = ResIdToPixbuf( SV_ICON_ID_OFFICE );
-	gtk_image_set_from_pixbuf( GTK_IMAGE( pIconImage ), pPixbuf );
-	g_object_unref( pPixbuf );
+    g_signal_connect( pTrayIcon, "button-press-event",
+                      G_CALLBACK( display_menu_cb ), pMenu );
 
-	GtkWidget *pMenu = gtk_menu_new();
-	g_signal_connect (pMenu, "deactivate",
-					  G_CALLBACK (menu_deactivate_cb), NULL);
-	g_signal_connect( pParent, "button_press_event",
-					  G_CALLBACK( display_menu_cb ), pMenu );
-	gtk_container_add( GTK_CONTAINER( pTrayIcon ), pParent );
-
-	// Show at idle to avoid artefacts at startup
-	g_idle_add (show_at_idle, (gpointer) pTrayIcon);
-
-	// disable shutdown
-	pShutdownIcon->SetVeto( true );
-	pShutdownIcon->addTerminateListener();
+    g_signal_connect( pMenu, "deactivate",
+                      G_CALLBACK (menu_deactivate_cb), NULL);
 }
 
 void SAL_DLLPUBLIC_EXPORT plugin_shutdown_sys_tray()
@@ -400,10 +358,11 @@ void SAL_DLLPUBLIC_EXPORT plugin_shutdow
 	::vos::OGuard aGuard( Application::GetSolarMutex() );
 	if( !pTrayIcon )
 		return;
-	gtk_widget_destroy( GTK_WIDGET( pTrayIcon ) );
+	g_object_unref( pTrayIcon );
 	pTrayIcon = NULL;
 	pExitMenuItem = NULL;
 	pOpenMenuItem = NULL;
+    pDisableMenuItem = NULL;
 }
 
 #endif // ENABLE_QUICKSTART_APPLET



Mime
View raw message