Skip to content

Commit 66291b7

Browse files
authored
Merge pull request #22592 from ramezgerges/tmds_generator
2 parents 0af4a13 + 698f7e6 commit 66291b7

File tree

9 files changed

+587
-2477
lines changed

9 files changed

+587
-2477
lines changed

src/Uno.UI.Runtime.Skia.X11/DBus/Desktop.DBus.cs

Lines changed: 0 additions & 2465 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace Uno.WinUI.Runtime.Skia.X11.DBus
2+
{
3+
// From https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Request.html#signals
4+
enum Response : uint
5+
{
6+
Success = 0,
7+
UserCancelled = 1,
8+
Other = 2
9+
}
10+
}

src/Uno.UI.Runtime.Skia.X11/Helpers/Theming/LinuxSystemThemeHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public async Task Init()
5151
{
5252
try
5353
{
54-
var sessionsAddressBus = Address.Session;
54+
var sessionsAddressBus = DBusAddress.Session;
5555
if (sessionsAddressBus is null)
5656
{
5757
if (this.Log().IsEnabled(LogLevel.Error))
@@ -61,10 +61,10 @@ public async Task Init()
6161
return;
6262
}
6363

64-
var connection = new Connection(sessionsAddressBus);
64+
var connection = new DBusConnection(sessionsAddressBus);
6565
await connection.ConnectAsync();
6666

67-
var desktopService = new DesktopService(connection, Service);
67+
var desktopService = new DBusService(connection, Service);
6868
var settings = desktopService.CreateSettings(ObjectPath);
6969

7070
var version = await settings.GetVersionAsync();

src/Uno.UI.Runtime.Skia.X11/Storage/Pickers/LinuxFilePickerExtension.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
namespace Uno.WinUI.Runtime.Skia.X11;
2020

2121
// https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.FileChooser.html
22-
// https://github.com/tmds/Tmds.DBus/blob/main/docs/modelling.md#argument-types
2322

2423
/// <summary>
2524
/// This class implements v3 of the org.freedesktop.portal.FileChooser portal for files as defined by freedesktop.org.
@@ -45,7 +44,7 @@ public async Task<IReadOnlyList<StorageFile>> PickMultipleFilesAsync(Cancellatio
4544

4645
public async Task<IReadOnlyList<string>> PickFilesAsync(CancellationToken token, bool multiple, bool directory)
4746
{
48-
var sessionsAddressBus = Address.Session;
47+
var sessionsAddressBus = DBusAddress.Session;
4948
if (sessionsAddressBus is null)
5049
{
5150
if (this.Log().IsEnabled(LogLevel.Error))
@@ -60,7 +59,7 @@ public async Task<IReadOnlyList<string>> PickFilesAsync(CancellationToken token,
6059
return ImmutableList<string>.Empty;
6160
}
6261

63-
using var connection = new Connection(sessionsAddressBus);
62+
using var connection = new DBusConnection(sessionsAddressBus);
6463
var connectionTcs = new TaskCompletionSource();
6564
// ConnectAsync calls ConfigureAwait(false), so we need this TCS dance to make the continuation continue on the UI thread
6665
_ = connection.ConnectAsync().AsTask().ContinueWith(_ => connectionTcs.TrySetResult(), token);
@@ -77,7 +76,7 @@ public async Task<IReadOnlyList<string>> PickFilesAsync(CancellationToken token,
7776

7877
try
7978
{
80-
var desktopService = new DesktopService(connection, Service);
79+
var desktopService = new DBusService(connection, Service);
8180
var chooser = desktopService.CreateFileChooser(ObjectPath);
8281

8382
if (token.IsCancellationRequested)

src/Uno.UI.Runtime.Skia.X11/Storage/Pickers/LinuxFileSaverExtension.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
namespace Uno.WinUI.Runtime.Skia.X11;
1919

2020
// https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.FileChooser.html
21-
// https://github.com/tmds/Tmds.DBus/blob/main/docs/modelling.md#argument-types
2221

2322
/// <summary>
2423
/// This class implements v4 of the org.freedesktop.portal.FileChooser portal for files as defined by freedesktop.org
@@ -32,7 +31,7 @@ internal class LinuxFileSaverExtension(FileSavePicker picker) : IFileSavePickerE
3231

3332
public async Task<StorageFile?> PickSaveFileAsync(CancellationToken token)
3433
{
35-
var sessionsAddressBus = Address.Session;
34+
var sessionsAddressBus = DBusAddress.Session;
3635
if (sessionsAddressBus is null)
3736
{
3837
if (this.Log().IsEnabled(LogLevel.Error))
@@ -47,7 +46,7 @@ internal class LinuxFileSaverExtension(FileSavePicker picker) : IFileSavePickerE
4746
return null;
4847
}
4948

50-
using var connection = new Connection(sessionsAddressBus);
49+
using var connection = new DBusConnection(sessionsAddressBus);
5150
var connectionTcs = new TaskCompletionSource();
5251
// ConnectAsync calls ConfigureAwait(false), so we need this TCS dance to make the continuation continue on the UI thread
5352
_ = connection.ConnectAsync().AsTask().ContinueWith(_ => connectionTcs.TrySetResult(), token);
@@ -64,7 +63,7 @@ internal class LinuxFileSaverExtension(FileSavePicker picker) : IFileSavePickerE
6463

6564
try
6665
{
67-
var desktopService = new DesktopService(connection, Service);
66+
var desktopService = new DBusService(connection, Service);
6867
var chooser = desktopService.CreateFileChooser(ObjectPath);
6968

7069
if (token.IsCancellationRequested)

src/Uno.UI.Runtime.Skia.X11/Uno.UI.Runtime.Skia.X11.csproj

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@
2222
</ItemGroup>
2323

2424
<ItemGroup>
25-
<PackageReference Include="Tmds.DBus.Protocol" Version="0.21.2" />
25+
<PackageReference Include="Tmds.DBus.Protocol" Version="0.90.2" />
26+
<PackageReference Include="Tmds.DBus.Generator" Version="0.90.2" />
27+
</ItemGroup>
28+
29+
<ItemGroup>
30+
<AdditionalFiles Include="dbus-interfaces/org.freedesktop.portal.FileChooser.xml" Namespace="Uno.WinUI.Runtime.Skia.X11.DBus" GenerateDBusTypes="true" />
31+
<AdditionalFiles Include="dbus-interfaces/org.freedesktop.portal.Request.xml" Namespace="Uno.WinUI.Runtime.Skia.X11.DBus" GenerateDBusTypes="true" />
32+
<AdditionalFiles Include="dbus-interfaces/org.freedesktop.portal.Settings.xml" Namespace="Uno.WinUI.Runtime.Skia.X11.DBus" GenerateDBusTypes="true" />
2633
</ItemGroup>
2734

2835
<ItemGroup>

0 commit comments

Comments
 (0)