Browse Source

Merge pull request #3840 from AvaloniaUI/dbus-menu-icon

icon-data support for dbusmenu
pull/3841/head
danwalmsley 6 years ago
committed by GitHub
parent
commit
7031cd3b4c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      src/Avalonia.FreeDesktop/DBusMenuExporter.cs

13
src/Avalonia.FreeDesktop/DBusMenuExporter.cs

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Reactive.Disposables;
using System.Threading.Tasks;
using Avalonia.Controls;
@ -184,7 +185,7 @@ namespace Avalonia.FreeDesktop
private static string[] AllProperties = new[]
{
"type", "label", "enabled", "visible", "shortcut", "toggle-type", "children-display", "toggle-state"
"type", "label", "enabled", "visible", "shortcut", "toggle-type", "children-display", "toggle-state", "icon-data"
};
object GetProperty((NativeMenuItemBase item, NativeMenu menu) i, string name)
@ -248,6 +249,16 @@ namespace Avalonia.FreeDesktop
return item.IsChecked ? 1 : 0;
}
if (name == "icon-data")
{
if (item.Icon != null)
{
var ms = new MemoryStream();
item.Icon.Save(ms);
return ms.ToArray();
}
}
if (name == "children-display")
return menu != null ? "submenu" : null;
}

Loading…
Cancel
Save