Browse Source

share: add support for clipboard sharing

bboozzoo/self-announce
Maciek Borzecki 7 years ago
parent
commit
abca399606
3 changed files with 12 additions and 1 deletions
  1. +2
    -1
      meson.build
  2. +3
    -0
      src/mconnect/main.vala
  3. +7
    -0
      src/mconnect/share.vala

+ 2
- 1
meson.build View File

@ -9,6 +9,7 @@ json_glib_dep = dependency('json-glib-1.0')
gee_dep = dependency('gee-0.8')
libnotify_dep = dependency('libnotify')
gdk_dep = dependency('gdk-3.0')
gtk_dep = dependency('gtk+-3.0')
atspi_dep = dependency('atspi-2')
gnutls_dep = dependency('gnutls')
posix_dep = meson.get_compiler('vala').find_library('posix')
@ -58,7 +59,7 @@ mconnect_prog = executable('mconnect', mconnect_src,
json_glib_dep, gee_dep,
libnotify_dep, gdk_dep,
atspi_dep, gnutls_dep,
posix_dep],
posix_dep, gtk_dep],
install: true)
mconnectctl_src = 'src/mconnectctl/main.vala'


+ 3
- 0
src/mconnect/main.vala View File

@ -24,5 +24,8 @@ public static int main(string[] args)
// needed for mousepad protocol handler
Gdk.init(ref args);
// needed for clipboard sharing
Gtk.init(ref args);
return app.run(args);
}

+ 7
- 0
src/mconnect/share.vala View File

@ -106,5 +106,12 @@ class ShareHandler : Object, PacketHandlerInterface {
}
private void handle_text(Device dev, Packet pkt) {
var text = pkt.body.get_string_member("text");
debug("shared text '%s'", text);
var display = Gdk.Display.get_default();
if (display != null) {
var cb = Gtk.Clipboard.get_default(display);
cb.set_text(text, -1);
}
}
}

Loading…
Cancel
Save