private void Init() { // general gtk initialization Gtk.Application.Init(); MainThreadId = Thread.CurrentThread.ManagedThreadId; // load styles var provider = new Gtk.CssProvider(); provider.LoadFromData(Resources.LoadResourceString(Resources.ID_STYLES_SCREEN_CSS)); Gtk.StyleContext.AddProviderForScreen(Gdk.Screen.Default, provider, 600); // install handler for glib exceptions GLib.ExceptionManager.UnhandledException += (exargs) => PrintUnhandledException((Exception)exargs.ExceptionObject); // initialize this.Log = new BooruLog(); this.EventCenter = new BooruEventCenter(); this.TaskRunner = new TaskRunner(); this.Settings = new BooruSettings(); this.Network = new Network(); this.Database = new Database(); this.PluginLoader = new PluginLoader(); this.PluginLoader.LoadPlugins(); // create gui this.MainWindow = MainWindow.Create(); }
public static void ApplyTheme() { // Based on this Link http://awesome.naquadah.org/wiki/Better_Font_Rendering // Get the Global Settings var setts = Gtk.Settings.Default; // This enables clear text on Win32, makes the text look a lot less crappy setts.XftRgba = "rgb"; // This enlarges the size of the controls based on the dpi setts.XftDpi = 96; // By Default Anti-aliasing is enabled, if you want to disable it for any reason set this value to 0 //setts.XftAntialias = 0 // Enable text hinting setts.XftHinting = 1; //setts.XftHintstyle = "hintslight" setts.XftHintstyle = "hintfull"; // Load the Theme Gtk.CssProvider css_provider = new Gtk.CssProvider(); //css_provider.LoadFromPath("themes/DeLorean-Dark-3.14/gtk-3.0/gtk.css"); css_provider.LoadFromPath("themes/AlienEngine/gtk.css"); Gtk.StyleContext.AddProviderForScreen(Gdk.Screen.Default, css_provider, 800); }
private static void InitializeCssStyles() { var styleProvider = new Gtk.CssProvider(); using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Microsoft.Psi.Samples.LinuxWebcamWithAudioSample.Styles.css"); using StreamReader reader = new StreamReader(stream); styleProvider.LoadFromData(reader.ReadToEnd()); Gtk.StyleContext.AddProviderForScreen(Gdk.Display.Default.DefaultScreen, styleProvider, Gtk.StyleProviderPriority.Application); }
public static Gtk.CssProvider GetNamed(string name, string variant) { IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup(name); IntPtr native_variant = GLib.Marshaller.StringToPtrGStrdup(variant); IntPtr raw_ret = gtk_css_provider_get_named(native_name, native_variant); Gtk.CssProvider ret = GLib.Object.GetObject(raw_ret) as Gtk.CssProvider; GLib.Marshaller.Free(native_name); GLib.Marshaller.Free(native_variant); return(ret); }
protected virtual void InitializeGtk() { Log.Debug("Initializing GTK"); if (!GLib.Thread.Supported) { GLib.Thread.Init(); } #if GNOME // Using GConf from multiple threads causes crashes if multithreading is not initialized explictly in dbus // This is a workaround for bgo#692374 dbus_g_thread_init(); #endif Gtk.Application.Init(); // This could go into GtkBaseClient, but it's probably something we // should really only support at each client level if (File.Exists(user_css) && !ApplicationContext.CommandLine.Contains("no-gtkcss")) { custom_provider = new Gtk.CssProvider(); custom_provider.LoadFromPath(user_css); Gtk.StyleContext.AddProviderForScreen(Gdk.Screen.Default, (Gtk.IStyleProvider)custom_provider, 600 /* GTK_STYLE_PROVIDER_PRIORITY_APPLICATION*/); } if (ApplicationContext.CommandLine.Contains("debug-gtkcss")) { Log.Information("Note: gtk.css file will be checked for reload every 5 seconds!"); GLib.Timeout.Add(5000, delegate { if (custom_provider != null) { custom_provider.LoadFromPath(user_css); Gtk.StyleContext.ResetWidgets(Gdk.Screen.Default); Log.Information("gtk.css has been reloaded"); } return(true); }); } }
static _Extensions() { HorizontalZeroPadding = new Gtk.CssProvider(); HorizontalZeroPadding.LoadFromData(".horizontal { padding-top: 0px; padding-bottom: 5px; padding-left: 0px; padding-right: 0px }"); }