@@ -18,11 +18,16 @@ public class Gala.Drawing.StyleManager : Object {
1818 }
1919
2020 [DBus (name ="io.elementary.pantheon. AccountsService ")]
21- private interface AccountsService : DBusProxy {
21+ private interface PantheonAccountsService : DBusProxy {
2222 public abstract int prefers_color_scheme { get ; set ; }
2323 public abstract int prefers_accent_color { get ; set ; }
2424 }
2525
26+ [DBus (name ="io.elementary. SettingsDaemon .AccountsService ")]
27+ private interface SettingsDaemonAccountsService : DBusProxy {
28+ public abstract int accent_color { get ; set ; }
29+ }
30+
2631 private const string FDO_ACCOUNTS_NAME = " org.freedesktop.Accounts" ;
2732 private const string FDO_ACCOUNTS_PATH = " /org/freedesktop/Accounts" ;
2833
@@ -37,10 +42,18 @@ public class Gala.Drawing.StyleManager : Object {
3742 public ColorScheme prefers_color_scheme { get ; private set ; default = LIGHT ; }
3843 public Gdk . RGBA theme_accent_color { get ; private set ; default = DEFAULT_ACCENT_COLOR ; }
3944
40- private AccountsService ? accounts_service_proxy;
45+ private PantheonAccountsService ? pantheon_proxy;
46+ private SettingsDaemonAccountsService ? settings_daemon_proxy;
4147
4248 construct {
43- Bus . watch_name (SYSTEM , FDO_ACCOUNTS_NAME , NONE , () = > connect_to_accounts_service. begin (), () = > accounts_service_proxy = null );
49+ Bus . watch_name (
50+ SYSTEM , FDO_ACCOUNTS_NAME , NONE ,
51+ () = > connect_to_accounts_service. begin (),
52+ () = > {
53+ pantheon_proxy = null ;
54+ settings_daemon_proxy = null ;
55+ }
56+ );
4457 }
4558
4659 private async void connect_to_accounts_service () {
@@ -49,24 +62,27 @@ public class Gala.Drawing.StyleManager : Object {
4962
5063 var path = yield accounts. find_user_by_name (Environment . get_user_name ());
5164
52- accounts_service_proxy = yield Bus . get_proxy< AccountsService > (SYSTEM , FDO_ACCOUNTS_NAME , path, GET_INVALIDATED_PROPERTIES );
65+ pantheon_proxy = yield Bus . get_proxy< PantheonAccountsService > (SYSTEM , FDO_ACCOUNTS_NAME , path, GET_INVALIDATED_PROPERTIES );
66+ settings_daemon_proxy = yield Bus . get_proxy< SettingsDaemonAccountsService > (SYSTEM , FDO_ACCOUNTS_NAME , path, GET_INVALIDATED_PROPERTIES );
5367 } catch {
5468 warning (" Could not connect to AccountsService. Default accent color will be used" );
5569 return ;
5670 }
5771
58- update_color_scheme (accounts_service_proxy . prefers_color_scheme);
59- update_color (accounts_service_proxy . prefers_accent_color );
72+ update_color_scheme (pantheon_proxy . prefers_color_scheme);
73+ update_color (settings_daemon_proxy . accent_color );
6074
61- accounts_service_proxy . g_properties_changed. connect ((changed, invalid) = > {
62- var value = changed. lookup_value (" PrefersAccentColor " , new VariantType (" i" ));
75+ pantheon_proxy . g_properties_changed. connect ((changed, invalid) = > {
76+ var value = changed. lookup_value (" PrefersColorScheme " , new VariantType (" i" ));
6377 if (value != null ) {
64- update_color (value . get_int32 ());
78+ update_color_scheme (value . get_int32 ());
6579 }
80+ });
6681
67- value = changed. lookup_value (" PrefersColorScheme" , new VariantType (" i" ));
82+ settings_daemon_proxy. g_properties_changed. connect ((changed, invalid) = > {
83+ var value = changed. lookup_value (" AccentColor" , new VariantType (" i" ));
6884 if (value != null ) {
69- update_color_scheme (value . get_int32 ());
85+ update_color (value . get_int32 ());
7086 }
7187 });
7288 }
0 commit comments