2024-02-18 05:03:26 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2024 elementary, Inc. (https://elementary.io)
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class Gala.Daemon.Application : Gtk.Application {
|
|
|
|
public Application () {
|
|
|
|
Object (application_id: "org.pantheon.gala.daemon");
|
2019-09-24 20:33:52 +03:00
|
|
|
}
|
|
|
|
|
2024-02-18 05:03:26 +03:00
|
|
|
public override void startup () {
|
|
|
|
base.startup ();
|
2019-09-24 20:33:52 +03:00
|
|
|
|
2024-02-18 05:03:26 +03:00
|
|
|
var granite_settings = Granite.Settings.get_default ();
|
|
|
|
var gtk_settings = Gtk.Settings.get_default ();
|
2019-09-24 20:33:52 +03:00
|
|
|
|
2024-02-18 05:03:26 +03:00
|
|
|
gtk_settings.gtk_application_prefer_dark_theme = granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK;
|
2020-08-05 23:02:45 +03:00
|
|
|
|
2024-02-18 05:03:26 +03:00
|
|
|
granite_settings.notify["prefers-color-scheme"].connect (() => {
|
2020-08-05 23:02:45 +03:00
|
|
|
gtk_settings.gtk_application_prefer_dark_theme = granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK;
|
2024-02-18 05:03:26 +03:00
|
|
|
});
|
2024-02-20 02:15:24 +03:00
|
|
|
|
|
|
|
var app_provider = new Gtk.CssProvider ();
|
2024-07-05 21:14:35 +03:00
|
|
|
app_provider.load_from_resource ("/io/elementary/desktop/gala-daemon/gala-daemon.css");
|
|
|
|
Gtk.StyleContext.add_provider_for_display (Gdk.Display.get_default (), app_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
|
2019-09-24 20:33:52 +03:00
|
|
|
}
|
|
|
|
|
2024-02-18 05:03:26 +03:00
|
|
|
public override void activate () {
|
|
|
|
hold ();
|
|
|
|
}
|
2021-08-12 16:32:39 +03:00
|
|
|
|
2024-02-18 05:03:26 +03:00
|
|
|
public override bool dbus_register (DBusConnection connection, string object_path) throws Error {
|
|
|
|
base.dbus_register (connection, object_path);
|
2019-09-24 20:33:52 +03:00
|
|
|
|
2024-07-05 21:14:35 +03:00
|
|
|
// We are using gtk in the DBus () constructor so we need to init it early
|
|
|
|
Gtk.init ();
|
|
|
|
|
2024-02-20 02:15:24 +03:00
|
|
|
connection.register_object (object_path, new DBus ());
|
2019-09-24 20:33:52 +03:00
|
|
|
|
2024-02-18 05:03:26 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2019-09-24 20:33:52 +03:00
|
|
|
|
2024-02-18 05:03:26 +03:00
|
|
|
public static int main (string[] args) {
|
|
|
|
GLib.Intl.setlocale (LocaleCategory.ALL, "");
|
|
|
|
GLib.Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
|
|
|
|
GLib.Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
|
|
|
|
GLib.Intl.textdomain (Config.GETTEXT_PACKAGE);
|
2019-09-24 20:33:52 +03:00
|
|
|
|
2024-02-18 05:03:26 +03:00
|
|
|
var app = new Gala.Daemon.Application ();
|
|
|
|
return app.run ();
|
2018-09-11 01:16:52 +03:00
|
|
|
}
|