[gtk+/wip/attente/mir-content-hub: 4/6] mir: watch for pasteboard changes



commit e67dbd8dd0ac5a1ac63c8d2f32cdb256ebbcd74c
Author: William Hua <william hua canonical com>
Date:   Sat Oct 15 22:19:59 2016 +0200

    mir: watch for pasteboard changes

 gdk/mir/gdkmirdisplay.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/gdk/mir/gdkmirdisplay.c b/gdk/mir/gdkmirdisplay.c
index 4f73542..d0bd3e8 100644
--- a/gdk/mir/gdkmirdisplay.c
+++ b/gdk/mir/gdkmirdisplay.c
@@ -62,6 +62,7 @@ typedef struct GdkMirDisplay
 
   ContentHubService *content_service;
   ContentHubHandler *content_handler;
+  GVariant *paste_data;
 } GdkMirDisplay;
 
 typedef struct GdkMirDisplayClass
@@ -107,6 +108,13 @@ static void get_pixel_formats (MirConnection *, MirPixelFormat *sw, MirPixelForm
 
 G_DEFINE_TYPE (GdkMirDisplay, gdk_mir_display, GDK_TYPE_DISPLAY)
 
+static void
+pasteboard_changed_cb (GdkMirDisplay *display,
+                       gpointer       user_data)
+{
+  g_clear_pointer (&display->paste_data, g_variant_unref);
+}
+
 GdkDisplay *
 _gdk_mir_display_open (const gchar *display_name)
 {
@@ -154,6 +162,12 @@ _gdk_mir_display_open (const gchar *display_name)
     NULL,
     NULL);
 
+  g_signal_connect_swapped (
+    display->content_service,
+    "pasteboard-changed",
+    G_CALLBACK (pasteboard_changed_cb),
+    display);
+
   display->content_handler = content_hub_handler_skeleton_new ();
 
   session = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
@@ -214,6 +228,7 @@ gdk_mir_display_dispose (GObject *object)
 {
   GdkMirDisplay *display = GDK_MIR_DISPLAY (object);
 
+  g_clear_pointer (&display->paste_data, g_variant_unref);
   g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (display->content_handler));
   g_clear_object (&display->content_handler);
   g_clear_object (&display->content_service);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]