Be more verbose when loading CSS and config
This commit is contained in:
@@ -311,6 +311,8 @@ namespace SwayNotificationCenter {
|
|||||||
public static void reload_config (ModifyNode modify_cb = () => {}) {
|
public static void reload_config (ModifyNode modify_cb = () => {}) {
|
||||||
// Re-check if config file path still exists
|
// Re-check if config file path still exists
|
||||||
string path = Functions.get_config_path (_path);
|
string path = Functions.get_config_path (_path);
|
||||||
|
path = File.new_for_path (path).get_path () ?? path;
|
||||||
|
message ("Loading Config: \"%s\"", path);
|
||||||
|
|
||||||
ConfigModel m = null;
|
ConfigModel m = null;
|
||||||
try {
|
try {
|
||||||
@@ -331,7 +333,7 @@ namespace SwayNotificationCenter {
|
|||||||
}
|
}
|
||||||
m = model;
|
m = model;
|
||||||
} catch (Error e) {
|
} catch (Error e) {
|
||||||
stderr.printf (e.message + "\n");
|
critical (e.message);
|
||||||
}
|
}
|
||||||
_instance = m ?? new ConfigModel ();
|
_instance = m ?? new ConfigModel ();
|
||||||
_path = path;
|
_path = path;
|
||||||
|
@@ -72,32 +72,36 @@ namespace SwayNotificationCenter {
|
|||||||
public static bool load_css (string ? style_path) {
|
public static bool load_css (string ? style_path) {
|
||||||
int css_priority = ConfigModel.instance.cssPriority.get_priority ();
|
int css_priority = ConfigModel.instance.cssPriority.get_priority ();
|
||||||
|
|
||||||
try {
|
|
||||||
// Load packaged CSS as backup
|
// Load packaged CSS as backup
|
||||||
string system_css = get_style_path (null, true);
|
string system_css = get_style_path (null, true);
|
||||||
|
system_css = File.new_for_path (system_css).get_path () ?? system_css;
|
||||||
|
message ("Loading CSS: \"%s\"", system_css);
|
||||||
|
try {
|
||||||
system_css_provider.load_from_path (system_css);
|
system_css_provider.load_from_path (system_css);
|
||||||
Gtk.StyleContext.add_provider_for_screen (
|
Gtk.StyleContext.add_provider_for_screen (
|
||||||
Gdk.Screen.get_default (),
|
Gdk.Screen.get_default (),
|
||||||
system_css_provider,
|
system_css_provider,
|
||||||
css_priority);
|
css_priority);
|
||||||
} catch (Error e) {
|
} catch (Error e) {
|
||||||
print ("Load packaged CSS Error: %s\n", e.message);
|
critical ("Load packaged CSS Error (\"%s\"):\n\t%s\n", system_css, e.message);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
// Load user CSS
|
// Load user CSS
|
||||||
string user_css = get_style_path (style_path);
|
string user_css = get_style_path (style_path);
|
||||||
|
user_css = File.new_for_path (user_css).get_path () ?? user_css;
|
||||||
|
message ("Loading CSS: \"%s\"", user_css);
|
||||||
|
try {
|
||||||
user_css_provider.load_from_path (user_css);
|
user_css_provider.load_from_path (user_css);
|
||||||
Gtk.StyleContext.add_provider_for_screen (
|
Gtk.StyleContext.add_provider_for_screen (
|
||||||
Gdk.Screen.get_default (),
|
Gdk.Screen.get_default (),
|
||||||
user_css_provider,
|
user_css_provider,
|
||||||
css_priority);
|
css_priority);
|
||||||
return true;
|
|
||||||
} catch (Error e) {
|
} catch (Error e) {
|
||||||
print ("Load user CSS Error: %s\n", e.message);
|
critical ("Load user CSS Error (\"%s\"):\n\t%s\n", user_css, e.message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string get_style_path (owned string ? custom_path,
|
public static string get_style_path (owned string ? custom_path,
|
||||||
|
Reference in New Issue
Block a user