Skip to content

Commit

Permalink
Merge branch 'main' into mpris-offsets3
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc authored Apr 8, 2024
2 parents f9fe3ad + ad2cf7f commit e9640e0
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 6 deletions.
15 changes: 13 additions & 2 deletions installed-tests/fixtures/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ const GObject = imports.gi.GObject;
const Config = imports.config;
const Core = imports.service.core;

// Retain compatibility with GLib < 2.80, which lacks GioUnix
let GioUnix;
try {
GioUnix = imports.gi.GioUnix;
} catch (e) {
GioUnix = {
InputStream: Gio.UnixInputStream,
OutputStream: Gio.UnixOutputStream,
};
}


/**
* TCP Port Constants
Expand Down Expand Up @@ -127,7 +138,7 @@ var ChannelService = GObject.registerClass({

// Input stream
this._udp6_stream = new Gio.DataInputStream({
base_stream: new Gio.UnixInputStream({
base_stream: new GioUnix.InputStream({
fd: this._udp6.fd,
close_fd: false,
}),
Expand Down Expand Up @@ -159,7 +170,7 @@ var ChannelService = GObject.registerClass({

// Input stream
this._udp4_stream = new Gio.DataInputStream({
base_stream: new Gio.UnixInputStream({
base_stream: new GioUnix.InputStream({
fd: this._udp4.fd,
close_fd: false,
}),
Expand Down
1 change: 1 addition & 0 deletions src/gsconnect-preferences
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
imports.gi.versions.Gdk = '3.0';
imports.gi.versions.GdkPixbuf = '2.0';
imports.gi.versions.Gio = '2.0';
imports.gi.versions.GioUnix = '2.0';
imports.gi.versions.GLib = '2.0';
imports.gi.versions.GObject = '2.0';
imports.gi.versions.Gtk = '3.0';
Expand Down
14 changes: 12 additions & 2 deletions src/service/backends/lan.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ const GObject = imports.gi.GObject;
const Config = imports.config;
const Core = imports.service.core;

// Retain compatibility with GLib < 2.80, which lacks GioUnix
let GioUnix;
try {
GioUnix = imports.gi.GioUnix;
} catch (e) {
GioUnix = {
InputStream: Gio.UnixInputStream,
OutputStream: Gio.UnixOutputStream,
};
}

/**
* TCP Port Constants
Expand Down Expand Up @@ -264,7 +274,7 @@ var ChannelService = GObject.registerClass({

// Input stream
this._udp6_stream = new Gio.DataInputStream({
base_stream: new Gio.UnixInputStream({
base_stream: new GioUnix.InputStream({
fd: this._udp6.fd,
close_fd: false,
}),
Expand Down Expand Up @@ -296,7 +306,7 @@ var ChannelService = GObject.registerClass({

// Input stream
this._udp4_stream = new Gio.DataInputStream({
base_stream: new Gio.UnixInputStream({
base_stream: new GioUnix.InputStream({
fd: this._udp4.fd,
close_fd: false,
}),
Expand Down
1 change: 1 addition & 0 deletions src/service/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
imports.gi.versions.Gdk = '3.0';
imports.gi.versions.GdkPixbuf = '2.0';
imports.gi.versions.Gio = '2.0';
imports.gi.versions.GioUnix = '2.0';
imports.gi.versions.GIRepository = '2.0';
imports.gi.versions.GLib = '2.0';
imports.gi.versions.GObject = '2.0';
Expand Down
16 changes: 14 additions & 2 deletions src/service/nativeMessagingHost.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
'use strict';

imports.gi.versions.Gio = '2.0';
imports.gi.versions.GioUnix = '2.0';
imports.gi.versions.GLib = '2.0';
imports.gi.versions.GObject = '2.0';

Expand All @@ -15,6 +16,17 @@ const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const System = imports.system;

// Retain compatibility with GLib < 2.80, which lacks GioUnix
let GioUnix;
try {
GioUnix = imports.gi.GioUnix;
} catch (e) {
GioUnix = {
InputStream: Gio.UnixInputStream,
OutputStream: Gio.UnixOutputStream,
};
}


const NativeMessagingHost = GObject.registerClass({
GTypeName: 'GSConnectNativeMessagingHost',
Expand Down Expand Up @@ -44,12 +56,12 @@ const NativeMessagingHost = GObject.registerClass({

// IO Channels
this._stdin = new Gio.DataInputStream({
base_stream: new Gio.UnixInputStream({fd: 0}),
base_stream: new GioUnix.InputStream({fd: 0}),
byte_order: Gio.DataStreamByteOrder.HOST_ENDIAN,
});

this._stdout = new Gio.DataOutputStream({
base_stream: new Gio.UnixOutputStream({fd: 1}),
base_stream: new GioUnix.OutputStream({fd: 1}),
byte_order: Gio.DataStreamByteOrder.HOST_ENDIAN,
});

Expand Down

0 comments on commit e9640e0

Please sign in to comment.