[Libreoffice-commits] .: Branch 'feature/unitymenus-master' - vcl/inc vcl/Library_vclplug_gtk.mk vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Nov 14 03:42:26 PST 2012
vcl/Library_vclplug_gtk.mk | 5 +----
vcl/inc/unx/gtk/gtksalmenu.hxx | 15 +++++++++++++--
vcl/inc/unx/gtk/hudawareness.h | 1 -
vcl/unx/gtk/window/gtkframe.cxx | 30 ++++++++++++++----------------
vcl/unx/gtk/window/hudawareness.cxx | 35 ++++++++++++-----------------------
5 files changed, 40 insertions(+), 46 deletions(-)
New commits:
commit 785011d91cfc814f95a63554724138512bd39941
Author: Michael Meeks <michael.meeks at suse.com>
Date: Wed Nov 14 11:39:53 2012 +0000
misc dbus menu integration fixes
Re-declare GMenuModel / GActionGroup if we don't have a recent enough gio.
Fix a number of compile warnings.
use the standard gnumake macros / linking for ENABLE_GIO & ENABLE_DBUS
Initialize GDBusInterfaceVTable cleanly.
Take the Solar Mutex on hud_activated.
Change-Id: Ie0c1d6e75c4be857f0db1adad36418dd1693f63e
diff --git a/vcl/Library_vclplug_gtk.mk b/vcl/Library_vclplug_gtk.mk
index c43173a..41e6037 100644
--- a/vcl/Library_vclplug_gtk.mk
+++ b/vcl/Library_vclplug_gtk.mk
@@ -52,6 +52,7 @@ $(eval $(call gb_Library_use_libraries,vclplug_gtk,\
$(eval $(call gb_Library_use_externals,vclplug_gtk,\
dbus \
+ gio \
gtk \
gthread \
icule \
@@ -103,10 +104,6 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gtk,\
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
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index 313da51..05e1af9 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -29,8 +29,19 @@
#include <unx/salmenu.h>
#include <unx/gtk/gtkframe.hxx>
-#include <unx/gtk/glomenu.h>
-#include <unx/gtk/gloactiongroup.h>
+
+#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
+# define ENABLE_GMENU_INTEGRATION
+# include <unx/gtk/glomenu.h>
+# include <unx/gtk/gloactiongroup.h>
+#else
+# ifndef GLIB_AVAILABLE_IN_2_32
+ typedef void GMenuModel;
+# endif
+# ifndef GLIB_AVAILABLE_IN_2_28
+ typedef void GActionGroup;
+# endif
+#endif
class MenuItemList;
class GtkSalMenuItem;
diff --git a/vcl/inc/unx/gtk/hudawareness.h b/vcl/inc/unx/gtk/hudawareness.h
index 47c5f90..7d6b94f 100644
--- a/vcl/inc/unx/gtk/hudawareness.h
+++ b/vcl/inc/unx/gtk/hudawareness.h
@@ -29,7 +29,6 @@ G_BEGIN_DECLS
typedef void (* HudAwarenessCallback) (gboolean hud_active,
gpointer user_data);
-
guint hud_awareness_register (GDBusConnection *connection,
const gchar *object_path,
HudAwarenessCallback callback,
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 0f76ce2..c4fa0df 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
#include <unx/gtk/gtkframe.hxx>
#include <unx/gtk/gtkdata.hxx>
#include <unx/gtk/gtkinst.hxx>
@@ -33,13 +32,11 @@
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
#if !GTK_CHECK_VERSION(3,0,0)
-#include <unx/x11/xlimits.hxx>
+# 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>
+# include <unx/gtk/gtksalmenu.hxx>
+# include <unx/gtk/hudawareness.h>
#endif
#include <gtk/gtk.h>
@@ -61,7 +58,7 @@
#include <algorithm>
#if OSL_DEBUG_LEVEL > 1
-#include <cstdio>
+# include <cstdio>
#endif
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
@@ -511,7 +508,7 @@ gdk_x11_window_set_utf8_property (GdkWindow *window,
// AppMenu watch functions.
-#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
+#ifdef ENABLE_GMENU_INTEGRATION
static void ObjectDestroyedNotify( gpointer data )
{
if ( data ) {
@@ -523,6 +520,7 @@ static void hud_activated( gboolean hud_active, gpointer user_data )
{
if ( hud_activated )
{
+ SolarMutexGuard aGuard;
GtkSalFrame* pSalFrame = reinterpret_cast< GtkSalFrame* >( user_data );
GtkSalMenu* pSalMenu = reinterpret_cast< GtkSalMenu* >( pSalFrame->GetMenu() );
@@ -555,13 +553,13 @@ gboolean ensure_dbus_setup( gpointer data )
gchar* aDBusMenubarPath = g_strdup_printf( "/window/%lu/menus/menubar", windowId );
// Set window properties.
- g_object_set_data_full( G_OBJECT(gdkWindow), "g-lo-menubar", pMenuModel, ObjectDestroyedNotify);
- g_object_set_data_full( G_OBJECT(gdkWindow), "g-lo-action-group", pActionGroup, ObjectDestroyedNotify);
+ g_object_set_data_full( G_OBJECT( gdkWindow ), "g-lo-menubar", pMenuModel, ObjectDestroyedNotify );
+ g_object_set_data_full( G_OBJECT( gdkWindow ), "g-lo-action-group", pActionGroup, ObjectDestroyedNotify );
- gdk_x11_window_set_utf8_property ( gdkWindow, "_GTK_UNIQUE_BUS_NAME", g_dbus_connection_get_unique_name( pSessionBus ) );
- gdk_x11_window_set_utf8_property ( gdkWindow, "_GTK_APPLICATION_OBJECT_PATH", "" );
- gdk_x11_window_set_utf8_property ( gdkWindow, "_GTK_WINDOW_OBJECT_PATH", aDBusWindowPath );
- gdk_x11_window_set_utf8_property ( gdkWindow, "_GTK_MENUBAR_OBJECT_PATH", aDBusMenubarPath );
+ gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_UNIQUE_BUS_NAME", g_dbus_connection_get_unique_name( pSessionBus ) );
+ gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_APPLICATION_OBJECT_PATH", "" );
+ gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_WINDOW_OBJECT_PATH", aDBusWindowPath );
+ gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_MENUBAR_OBJECT_PATH", aDBusMenubarPath );
// Publish the menu model and the action group.
SAL_INFO("vcl.unity", "exporting menu model at " << pMenuModel << " for window " << windowId);
@@ -576,7 +574,7 @@ gboolean ensure_dbus_setup( gpointer data )
return FALSE;
}
-
+
void on_registrar_available( GDBusConnection * /*connection*/,
const gchar * /*name*/,
const gchar * /*name_owner*/,
@@ -619,7 +617,7 @@ void on_registrar_unavailable( GDBusConnection * /*connection*/,
void GtkSalFrame::EnsureAppMenuWatch()
{
-#if defined(ENABLE_DBUS) && defined(ENABLE_GIO)
+#ifdef ENABLE_GMENU_INTEGRATION
if ( !m_nWatcherId )
{
// Get a DBus session connection.
diff --git a/vcl/unx/gtk/window/hudawareness.cxx b/vcl/unx/gtk/window/hudawareness.cxx
index b36f553..ee5d715 100644
--- a/vcl/unx/gtk/window/hudawareness.cxx
+++ b/vcl/unx/gtk/window/hudawareness.cxx
@@ -19,6 +19,7 @@
* Author: Ryan Lortie <desrt at desrt.ca>
*/
+#include <string.h>
#include <unx/gtk/hudawareness.h>
typedef struct
@@ -30,10 +31,10 @@ typedef struct
} HudAwarenessHandle;
static void
-hud_awareness_method_call (GDBusConnection *connection,
- const gchar *sender,
- const gchar *object_path,
- const gchar *interface_name,
+hud_awareness_method_call (GDBusConnection * /* connection */,
+ const gchar * /* sender */,
+ const gchar * /* object_path */,
+ const gchar * /* interface_name */,
const gchar *method_name,
GVariant *parameters,
GDBusMethodInvocation *invocation,
@@ -53,19 +54,6 @@ hud_awareness_method_call (GDBusConnection *connection,
g_dbus_method_invocation_return_value (invocation, NULL);
}
-static void
-hud_awareness_handle_free (gpointer data)
-{
- HudAwarenessHandle *handle = (HudAwarenessHandle*) data;
-
- g_object_unref (handle->connection);
-
- if (handle->notify)
- (* handle->notify) (handle->user_data);
-
- g_slice_free (HudAwarenessHandle, handle);
-}
-
guint
hud_awareness_register (GDBusConnection *connection,
const gchar *object_path,
@@ -75,15 +63,16 @@ hud_awareness_register (GDBusConnection *connection,
GError **error)
{
static GDBusInterfaceInfo *iface;
- GDBusInterfaceVTable vtable = {
- hud_awareness_method_call
- };
+ GDBusInterfaceVTable vtable;
HudAwarenessHandle *handle;
guint object_id;
+ memset ((void *)&vtable, 0, sizeof (vtable));
+ vtable.method_call = hud_awareness_method_call;
+
if G_UNLIKELY (iface == NULL)
{
- GError *error = NULL;
+ GError *local_error = NULL;
GDBusNodeInfo *info;
info = g_dbus_node_info_new_for_xml ("<node>"
@@ -94,8 +83,8 @@ hud_awareness_register (GDBusConnection *connection,
"</method>"
"</interface>"
"</node>",
- &error);
- g_assert_no_error (error);
+ &local_error);
+ g_assert_no_error (local_error);
iface = g_dbus_node_info_lookup_interface (info, "com.canonical.hud.Awareness");
g_assert (iface != NULL);
}
More information about the Libreoffice-commits
mailing list