From b350cee2bcd5b04df5da5f545191ac59a2b6944a Mon Sep 17 00:00:00 2001 From: Marcel Fries Date: Mon, 16 Mar 2020 14:40:56 +0100 Subject: [PATCH] Use custom gtk theme when compiling and running on widows --- EstusShots.Gtk/EstusShots.Gtk.csproj | 5 +++++ EstusShots.Gtk/Program.cs | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/EstusShots.Gtk/EstusShots.Gtk.csproj b/EstusShots.Gtk/EstusShots.Gtk.csproj index 0025cd3..950e693 100644 --- a/EstusShots.Gtk/EstusShots.Gtk.csproj +++ b/EstusShots.Gtk/EstusShots.Gtk.csproj @@ -14,6 +14,10 @@ %(Filename)%(Extension) + + + PreserveNewest + @@ -27,6 +31,7 @@ + diff --git a/EstusShots.Gtk/Program.cs b/EstusShots.Gtk/Program.cs index 600cc43..1aa7944 100644 --- a/EstusShots.Gtk/Program.cs +++ b/EstusShots.Gtk/Program.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.InteropServices; using Gtk; namespace EstusShots.Gtk @@ -10,6 +11,17 @@ namespace EstusShots.Gtk { Application.Init(); + // Load a custom theme only when running on windows + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + var provider = new CssProvider(); + provider.LoadFromPath("Theme/gtk-3.20/gtk.css"); + StyleContext.AddProviderForScreen(Gdk.Screen.Default, provider, 800); + + // TODO ???? + //IconTheme.Default.PrependSearchPath("Theme/icons/48x48"); + } + var app = new Application("EstusShots.Gtk", GLib.ApplicationFlags.None); app.Register(GLib.Cancellable.Current);