diff options
author | Michael Meeks <michael.meeks@suse.com> | 2012-11-14 11:39:53 +0000 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2012-11-14 13:53:02 +0100 |
commit | dc3ada4db5f6311aaf3154aed0bba17d96c2af9a (patch) | |
tree | 882e4f70f70eaa4abd3d75c06217b239418dd636 /vcl/unx | |
parent | e5e55d450d674bdfde6c86992274d8e22f949eb6 (diff) |
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
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk/window/gtkframe.cxx | 30 | ||||
-rw-r--r-- | vcl/unx/gtk/window/hudawareness.cxx | 35 |
2 files changed, 26 insertions, 39 deletions
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 0f76ce22f7a2..c4fa0df9e389 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 b36f553bc656..ee5d715e872b 100644 --- a/vcl/unx/gtk/window/hudawareness.cxx +++ b/vcl/unx/gtk/window/hudawareness.cxx @@ -19,6 +19,7 @@ * Author: Ryan Lortie <desrt@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); } |