Removed all string templates
This commit is contained in:
@@ -51,8 +51,9 @@ private void print_help (string[] args) {
|
||||
}
|
||||
|
||||
private void on_subscribe (uint count, bool dnd, bool cc_open) {
|
||||
stdout.write (
|
||||
@"{ \"count\": $(count), \"dnd\": $(dnd), \"visible\": $(cc_open) }\n".data);
|
||||
stdout.printf (
|
||||
"{ \"count\": %u, \"dnd\": %s, \"visible\": %s }\n"
|
||||
.printf (count, dnd.to_string (), cc_open.to_string ()));
|
||||
}
|
||||
|
||||
private void print_subscribe () {
|
||||
@@ -70,12 +71,12 @@ private void on_subscribe_waybar (uint count, bool dnd, bool cc_open) {
|
||||
|
||||
string tooltip = "";
|
||||
if (count > 0) {
|
||||
tooltip = @"$(count) Notification" + (count > 1 ? "s" : "");
|
||||
tooltip = "%u Notification%s".printf (count, count > 1 ? "s" : "");
|
||||
}
|
||||
|
||||
string _class = @"\"$(state)\"";
|
||||
string _class = "\"%s\"".printf (state);
|
||||
if (cc_open) {
|
||||
_class = @"[$(_class), \"cc-open\"]";
|
||||
_class = "[%s, \"cc-open\"]".printf (_class);
|
||||
}
|
||||
|
||||
print (
|
||||
|
@@ -48,8 +48,8 @@ namespace SwayNotificationCenter {
|
||||
|
||||
public string to_string () {
|
||||
string[] fields = {};
|
||||
if (sound != null) fields += @"sound: $sound";
|
||||
if (icon != null) fields += @"icon: $icon";
|
||||
if (sound != null) fields += "sound: %s".printf (sound);
|
||||
if (icon != null) fields += "icon: %s".printf (icon);
|
||||
return string.joinv (", ", fields);
|
||||
}
|
||||
}
|
||||
@@ -106,11 +106,11 @@ namespace SwayNotificationCenter {
|
||||
|
||||
public string to_string () {
|
||||
string[] fields = {};
|
||||
if (app_name != null) fields += @"app-name: $app_name";
|
||||
if (summary != null) fields += @"summary: $summary";
|
||||
if (body != null) fields += @"body: $body";
|
||||
if (urgency != null) fields += @"urgency: $urgency";
|
||||
if (category != null) fields += @"category: $category";
|
||||
if (app_name != null) fields += "app-name: %s".printf (app_name);
|
||||
if (summary != null) fields += "summary: %s".printf (summary);
|
||||
if (body != null) fields += "body: %s".printf (body);
|
||||
if (urgency != null) fields += "urgency: %s".printf (urgency);
|
||||
if (category != null) fields += "category: %s".printf (category);
|
||||
return string.joinv (", ", fields);
|
||||
}
|
||||
|
||||
@@ -175,15 +175,15 @@ namespace SwayNotificationCenter {
|
||||
try {
|
||||
string[] spawn_env = Environ.get ();
|
||||
// Export env variables
|
||||
spawn_env += @"SWAYNC_APP_NAME=" + param.app_name;
|
||||
spawn_env += @"SWAYNC_SUMMARY=" + param.summary;
|
||||
spawn_env += @"SWAYNC_BODY=" + param.body;
|
||||
spawn_env += @"SWAYNC_URGENCY=" + param.urgency.to_string ();
|
||||
spawn_env += @"SWAYNC_CATEGORY=" + param.category;
|
||||
spawn_env += @"SWAYNC_ID=" + param.applied_id.to_string ();
|
||||
spawn_env += @"SWAYNC_REPLACES_ID=" + param.replaces_id.to_string ();
|
||||
spawn_env += @"SWAYNC_TIME=" + param.time.to_string ();
|
||||
spawn_env += @"SWAYNC_DESKTOP_ENTRY=" + param.desktop_entry ?? "";
|
||||
spawn_env += "SWAYNC_APP_NAME=%s".printf (param.app_name);
|
||||
spawn_env += "SWAYNC_SUMMARY=%s".printf (param.summary);
|
||||
spawn_env += "SWAYNC_BODY=%s".printf (param.body);
|
||||
spawn_env += "SWAYNC_URGENCY=%s".printf (param.urgency.to_string ());
|
||||
spawn_env += "SWAYNC_CATEGORY=%s".printf (param.category);
|
||||
spawn_env += "SWAYNC_ID=%s".printf (param.applied_id.to_string ());
|
||||
spawn_env += "SWAYNC_REPLACES_ID=%s".printf (param.replaces_id.to_string ());
|
||||
spawn_env += "SWAYNC_TIME=%s".printf (param.time.to_string ());
|
||||
spawn_env += "SWAYNC_DESKTOP_ENTRY=%s".printf (param.desktop_entry ?? "");
|
||||
|
||||
Pid child_pid;
|
||||
Process.spawn_async (
|
||||
|
@@ -129,13 +129,13 @@ namespace SwayNotificationCenter {
|
||||
*/
|
||||
[DBus (name = "Notify")]
|
||||
public new uint32 notify (string app_name,
|
||||
uint32 replaces_id,
|
||||
string app_icon,
|
||||
string summary,
|
||||
string body,
|
||||
string[] actions,
|
||||
HashTable<string, Variant> hints,
|
||||
int expire_timeout) throws DBusError, IOError {
|
||||
uint32 replaces_id,
|
||||
string app_icon,
|
||||
string summary,
|
||||
string body,
|
||||
string[] actions,
|
||||
HashTable<string, Variant> hints,
|
||||
int expire_timeout) throws DBusError, IOError {
|
||||
uint32 id = replaces_id;
|
||||
if (replaces_id == 0 || replaces_id > noti_id) id = ++noti_id;
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace SwayNotificationCenter {
|
||||
_hints.insert ("urgency",
|
||||
UrgencyLevels.CRITICAL.to_byte ());
|
||||
|
||||
string _summary = @"Failed to run script: $key";
|
||||
string _summary = "Failed to run script: %s".printf (key);
|
||||
string _body = "<b>Output:</b> " + error_msg;
|
||||
this.notify ("SwayNotificationCenter",
|
||||
0,
|
||||
@@ -274,9 +274,9 @@ namespace SwayNotificationCenter {
|
||||
*/
|
||||
[DBus (name = "GetServerInformation")]
|
||||
public void get_server_information (out string name,
|
||||
out string vendor,
|
||||
out string version,
|
||||
out string spec_version)
|
||||
out string vendor,
|
||||
out string version,
|
||||
out string spec_version)
|
||||
throws DBusError, IOError {
|
||||
name = "SwayNotificationCenter";
|
||||
vendor = "ErikReider";
|
||||
|
@@ -59,7 +59,7 @@ namespace SwayNotificationCenter {
|
||||
|
||||
public string to_string () {
|
||||
if (identifier == null || name == null) return "None";
|
||||
return @"Name: $name, Id: $identifier";
|
||||
return "Name: %s, Id: %s".printf (name, identifier);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ namespace SwayNotificationCenter {
|
||||
if (!key.contains ("image") && !key.contains ("icon")) {
|
||||
data = v.print (true);
|
||||
}
|
||||
_hints += @"\n\t$key: " + data;
|
||||
_hints += "\n\t%s: %s".printf (key, data);
|
||||
}
|
||||
params.set ("hints", string.joinv ("", _hints));
|
||||
params.set ("expire_timeout", expire_timeout.to_string ());
|
||||
@@ -273,7 +273,7 @@ namespace SwayNotificationCenter {
|
||||
string[] result = {};
|
||||
foreach (var k in params.get_keys ()) {
|
||||
string ? v = params[k];
|
||||
result += @"$k:\t\t" + v;
|
||||
result += "%s:\t\t %s".printf (k, v);
|
||||
}
|
||||
return "\n" + string.joinv ("\n", result);
|
||||
}
|
||||
|
Reference in New Issue
Block a user