Browse Source

Merge pull request #10826 from affederaffe/bump-tmds.dbus.sourcegenerator

Bump Tmds.DBus.SourceGenerator
pull/10833/head
Nikita Tsukanov 3 years ago
committed by GitHub
parent
commit
6dfc2cadf4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/Avalonia.FreeDesktop/Avalonia.FreeDesktop.csproj
  2. 21
      src/Avalonia.FreeDesktop/DBusMenuExporter.cs
  3. 13
      src/Avalonia.FreeDesktop/DBusTrayIconImpl.cs

10
src/Avalonia.FreeDesktop/Avalonia.FreeDesktop.csproj

@ -5,20 +5,20 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<Import Project="..\..\build\TrimmingEnable.props" /> <Import Project="../../build/TrimmingEnable.props" />
<ItemGroup> <ItemGroup>
<Compile Include="..\Shared\IsExternalInit.cs" Link="IsExternalInit.cs" /> <Compile Include="../Shared/IsExternalInit.cs" Link="IsExternalInit.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Tmds.DBus.Protocol" Version="0.14.0" /> <PackageReference Include="Tmds.DBus.Protocol" Version="0.14.0" />
<PackageReference Include="Tmds.DBus.SourceGenerator" Version="0.0.4" /> <PackageReference Include="Tmds.DBus.SourceGenerator" Version="0.0.5" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Avalonia.Controls\Avalonia.Controls.csproj" /> <ProjectReference Include="../Avalonia.Controls/Avalonia.Controls.csproj" />
<ProjectReference Include="..\Avalonia.Dialogs\Avalonia.Dialogs.csproj" /> <ProjectReference Include="../Avalonia.Dialogs/Avalonia.Dialogs.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="InternalsVisibleTo"> <ItemGroup Label="InternalsVisibleTo">

21
src/Avalonia.FreeDesktop/DBusMenuExporter.cs

@ -38,7 +38,7 @@ namespace Avalonia.FreeDesktop
private bool _resetQueued; private bool _resetQueued;
private int _nextId = 1; private int _nextId = 1;
public DBusMenuExporterImpl(Connection connection, IntPtr xid) public DBusMenuExporterImpl(Connection connection, IntPtr xid) : this()
{ {
Connection = connection; Connection = connection;
_xid = (uint)xid.ToInt32(); _xid = (uint)xid.ToInt32();
@ -47,7 +47,7 @@ namespace Avalonia.FreeDesktop
_ = InitializeAsync(); _ = InitializeAsync();
} }
public DBusMenuExporterImpl(Connection connection, string path) public DBusMenuExporterImpl(Connection connection, string path) : this()
{ {
Connection = connection; Connection = connection;
_appMenu = false; _appMenu = false;
@ -56,6 +56,13 @@ namespace Avalonia.FreeDesktop
_ = InitializeAsync(); _ = InitializeAsync();
} }
private DBusMenuExporterImpl()
{
BackingProperties.Status = string.Empty;
BackingProperties.TextDirection = string.Empty;
BackingProperties.IconThemePath = Array.Empty<string>();
}
protected override Connection Connection { get; } protected override Connection Connection { get; }
public override string Path { get; } public override string Path { get; }
@ -202,15 +209,9 @@ namespace Avalonia.FreeDesktop
return id; return id;
} }
private void OnMenuItemsChanged(object? sender, NotifyCollectionChangedEventArgs e) private void OnMenuItemsChanged(object? sender, NotifyCollectionChangedEventArgs e) => QueueReset();
{
QueueReset();
}
private void OnItemPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) private void OnItemPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) => QueueReset();
{
QueueReset();
}
private static readonly string[] s_allProperties = { private static readonly string[] s_allProperties = {
"type", "label", "enabled", "visible", "shortcut", "toggle-type", "children-display", "toggle-state", "icon-data" "type", "label", "enabled", "visible", "shortcut", "toggle-type", "children-display", "toggle-state", "icon-data"

13
src/Avalonia.FreeDesktop/DBusTrayIconImpl.cs

@ -220,6 +220,16 @@ namespace Avalonia.FreeDesktop
{ {
Connection = connection; Connection = connection;
BackingProperties.Menu = dbusMenuPath; BackingProperties.Menu = dbusMenuPath;
BackingProperties.Category = string.Empty;
BackingProperties.Status = string.Empty;
BackingProperties.Id = string.Empty;
BackingProperties.Title = string.Empty;
BackingProperties.IconPixmap = Array.Empty<(int, int, byte[])>();
BackingProperties.AttentionIconName = string.Empty;
BackingProperties.AttentionIconPixmap = Array.Empty<(int, int, byte[])>();
BackingProperties.AttentionMovieName = string.Empty;
BackingProperties.OverlayIconName = string.Empty;
BackingProperties.OverlayIconPixmap = Array.Empty<(int, int, byte[])>();
BackingProperties.ToolTip = (string.Empty, Array.Empty<(int, int, byte[])>(), string.Empty, string.Empty); BackingProperties.ToolTip = (string.Empty, Array.Empty<(int, int, byte[])>(), string.Empty, string.Empty);
InvalidateAll(); InvalidateAll();
} }
@ -234,7 +244,7 @@ namespace Avalonia.FreeDesktop
protected override ValueTask OnActivateAsync(int x, int y) protected override ValueTask OnActivateAsync(int x, int y)
{ {
Dispatcher.UIThread.Post(() => ActivationDelegate?.Invoke()); ActivationDelegate?.Invoke();
return new ValueTask(); return new ValueTask();
} }
@ -267,7 +277,6 @@ namespace Avalonia.FreeDesktop
BackingProperties.Category = "ApplicationStatus"; BackingProperties.Category = "ApplicationStatus";
BackingProperties.Status = text; BackingProperties.Status = text;
BackingProperties.Title = text; BackingProperties.Title = text;
BackingProperties.ToolTip = (string.Empty, Array.Empty<(int, int, byte[])>(), text, string.Empty);
InvalidateAll(); InvalidateAll();
} }
} }

Loading…
Cancel
Save