[Libreoffice-commits] .: Branch 'feature/unitymenus-master' - vcl/Library_vcl.mk vcl/Library_vclplug_gtk.mk vcl/unx

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Nov 14 00:46:16 PST 2012


 vcl/Library_vcl.mk              |    5 +++++
 vcl/Library_vclplug_gtk.mk      |   19 +++++++++++++++----
 vcl/unx/gtk/app/gtkinst.cxx     |   16 ++++++++++++++++
 vcl/unx/gtk/window/gtkframe.cxx |   25 ++++++++++++++++++++-----
 4 files changed, 56 insertions(+), 9 deletions(-)

New commits:
commit d0d155a45f4ad21f3f240337ea92a688735434af
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Wed Nov 14 09:40:46 2012 +0100

    only enable unity integration with enabled dbus and gio
    
    Change-Id: I418e3c57e7c201529020864b1f4677ec4c24e2c8

diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index fa69d46..0e6283f 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -97,8 +97,13 @@ $(eval $(call gb_Library_use_externals,vcl,\
 	icule \
 	icuuc \
 	lcms2 \
+))
+
+ifneq ($(ENABLE_GIO),)
+$(eval $(call gb_Library_use_externals,vcl,\
 	gio \
 ))
+endif
 
 $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/app/brand \
diff --git a/vcl/Library_vclplug_gtk.mk b/vcl/Library_vclplug_gtk.mk
index a70ce09..a95ea19 100644
--- a/vcl/Library_vclplug_gtk.mk
+++ b/vcl/Library_vclplug_gtk.mk
@@ -89,16 +89,27 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gtk,\
     vcl/unx/gtk/gdi/salnativewidgets-gtk \
     vcl/unx/gtk/window/gtkframe \
     vcl/unx/gtk/window/gtkobject \
-    vcl/unx/gtk/window/gloactiongroup \
-    vcl/unx/gtk/window/gtksalmenu \
-    vcl/unx/gtk/window/glomenu \
-    vcl/unx/gtk/window/hudawareness \
     vcl/unx/gtk/fpicker/resourceprovider \
     vcl/unx/gtk/fpicker/SalGtkPicker \
     vcl/unx/gtk/fpicker/SalGtkFilePicker \
     vcl/unx/gtk/fpicker/SalGtkFolderPicker \
 ))
 
+ifneq ($(ENABLE_DBUS),)
+ifneq ($(ENABLE_GIO),)
+$(eval $(call gb_Library_add_exception_objects,vclplug_gtk,\
+    vcl/unx/gtk/window/gloactiongroup \
+    vcl/unx/gtk/window/gtksalmenu \
+    vcl/unx/gtk/window/glomenu \
+    vcl/unx/gtk/window/hudawareness \
+))
+$(eval $(call gb_Library_add_defs,vclplug_gtk,\
+    -DENABLE_GIO=$(ENABLE_GIO) \
+    -DENABLE_DBUS=#(ENABLE_DBUS) \
+))
+endif
+endif
+
 ifeq ($(ENABLE_GTK_PRINT),TRUE)
 $(eval $(call gb_Library_add_exception_objects,vclplug_gtk,\
     vcl/unx/gtk/gdi/gtkprintwrapper \
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index 642d785..38786f7 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -510,6 +510,7 @@ SalBitmap* GtkInstance::CreateSalBitmap()
 #endif
 }
 
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
 SalMenu* GtkInstance::CreateMenu( sal_Bool bMenuBar, Menu* pVCLMenu )
 {
     GtkSalMenu* pSalMenu = new GtkSalMenu( bMenuBar );
@@ -517,27 +518,42 @@ SalMenu* GtkInstance::CreateMenu( sal_Bool bMenuBar, Menu* pVCLMenu )
 
     return static_cast<SalMenu*>( pSalMenu );
 }
+#else
+SalMenu* GtkInstance::CreateMenu( sal_Bool, Menu* ) { return NULL; }
+#endif
 
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
 void GtkInstance::DestroyMenu( SalMenu* pMenu )
 {
     (void)pMenu;
     delete pMenu;
 //    OSL_ENSURE( pMenu == 0, "DestroyMenu called with non-native menus" );
 }
+#else
+void GtkInstance::DestroyMenu( SalMenu* ) {}
+#endif
 
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
 SalMenuItem* GtkInstance::CreateMenuItem( const SalItemParams* pItemData )
 {
     GtkSalMenuItem* pMenuItem = new GtkSalMenuItem( pItemData );
 
     return static_cast<SalMenuItem*>( pMenuItem );
 }
+#else
+SalMenuItem* GtkInstance::CreateMenuItem( const SalItemParams* ) { return NULL; }
+#endif
 
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
 void GtkInstance::DestroyMenuItem( SalMenuItem* pItem )
 {
     (void)pItem;
     delete pItem;
 //    OSL_ENSURE( pItem == 0, "DestroyMenu called with non-native menus" );
 }
+#else
+void GtkInstance::DestroyMenuItem( SalMenuItem* ) {}
+#endif
 
 SalTimer* GtkInstance::CreateSalTimer()
 {
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 80e4d19..0f76ce2 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -22,10 +22,6 @@
 #include <unx/gtk/gtkdata.hxx>
 #include <unx/gtk/gtkinst.hxx>
 #include <unx/gtk/gtkgdi.hxx>
-#include <unx/gtk/glomenu.h>
-#include <unx/gtk/gloactiongroup.h>
-#include <unx/gtk/gtksalmenu.hxx>
-#include <unx/gtk/hudawareness.h>
 #include <vcl/keycodes.hxx>
 #include <unx/wmadaptor.hxx>
 #include <unx/sm.hxx>
@@ -39,6 +35,12 @@
 #if !GTK_CHECK_VERSION(3,0,0)
 #include <unx/x11/xlimits.hxx>
 #endif
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
+#include <unx/gtk/glomenu.h>
+#include <unx/gtk/gloactiongroup.h>
+#include <unx/gtk/gtksalmenu.hxx>
+#include <unx/gtk/hudawareness.h>
+#endif
 
 #include <gtk/gtk.h>
 #include <tools/prex.h>
@@ -99,7 +101,10 @@ using namespace com::sun::star;
 
 int GtkSalFrame::m_nFloats = 0;
 
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
 static GDBusConnection* pSessionBus = NULL;
+#endif
+
 static sal_uInt16 GetKeyModCode( guint state )
 {
     sal_uInt16 nCode = 0;
@@ -479,7 +484,7 @@ GtkSalFrame::GtkSalFrame( SystemParentData* pSysData )
     Init( pSysData );
 }
 
-#if !GTK_CHECK_VERSION(3,0,0)
+#if !GTK_CHECK_VERSION(3,0,0) && defined(ENABLE_DBUS) && defined(ENABLE_GIO)
 static void
 gdk_x11_window_set_utf8_property  (GdkWindow *window,
                                    const gchar *name,
@@ -506,6 +511,7 @@ gdk_x11_window_set_utf8_property  (GdkWindow *window,
 
 // AppMenu watch functions.
 
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
 static void ObjectDestroyedNotify( gpointer data )
 {
     if ( data ) {
@@ -609,9 +615,11 @@ void on_registrar_unavailable( GDBusConnection * /*connection*/,
         pGtkSalMenu->Display( sal_False );
     }
 }
+#endif
 
 void GtkSalFrame::EnsureAppMenuWatch()
 {
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
     if ( !m_nWatcherId )
     {
         // Get a DBus session connection.
@@ -634,6 +642,7 @@ void GtkSalFrame::EnsureAppMenuWatch()
     }
 
     //ensure_dbus_setup( this );
+#endif
 }
 
 GtkSalFrame::~GtkSalFrame()
@@ -679,12 +688,15 @@ GtkSalFrame::~GtkSalFrame()
         gtk_widget_destroy( GTK_WIDGET( m_pFixedContainer ) );
     {
         SolarMutexGuard aGuard;
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
         if(m_nWatcherId)
             g_bus_unwatch_name(m_nWatcherId);
+#endif
         if( m_pWindow )
         {
             g_object_set_data( G_OBJECT( m_pWindow ), "SalFrame", NULL );
 
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
             if ( pSessionBus )
             {
                 if ( m_nHudAwarenessId )
@@ -694,6 +706,7 @@ GtkSalFrame::~GtkSalFrame()
                 if ( m_nActionGroupExportId )
                     g_dbus_connection_unexport_action_group( pSessionBus, m_nActionGroupExportId );
             }
+#endif
             gtk_widget_destroy( m_pWindow );
         }
     }
@@ -1124,8 +1137,10 @@ void GtkSalFrame::Init( SalFrame* pParent, sal_uLong nStyle )
 #if !GTK_CHECK_VERSION(3,0,0)
     if( eWinType == GTK_WINDOW_TOPLEVEL )
     {
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
         // Enable DBus native menu if available.
         ensure_dbus_setup( this );
+#endif
 
         guint32 nUserTime = 0;
         if( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_TOOLWINDOW)) == 0 )


More information about the Libreoffice-commits mailing list