aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/avatar_generator.vala
diff options
context:
space:
mode:
authorhrxi <hrrrxi@gmail.com>2019-09-01 18:18:25 +0200
committerfiaxh <fiaxh@users.noreply.github.com>2019-09-10 19:36:11 +0200
commitd5d305193ce527f1cc3022c406de35d9a85d4ccb (patch)
treed12efc741319a7d71c13f7bf6c2c7579d25fdabe /main/src/ui/avatar_generator.vala
parent9950742bf1903291c271619aea101b0e2f81d19c (diff)
downloaddino-d5d305193ce527f1cc3022c406de35d9a85d4ccb.tar.gz
dino-d5d305193ce527f1cc3022c406de35d9a85d4ccb.zip
Fix some warnings
Instances of `RegexError` are just asserted as `assert_not_reached` as they cannot really fail except for allocation failure if the given regex is valid.
Diffstat (limited to 'main/src/ui/avatar_generator.vala')
-rw-r--r--main/src/ui/avatar_generator.vala9
1 files changed, 5 insertions, 4 deletions
diff --git a/main/src/ui/avatar_generator.vala b/main/src/ui/avatar_generator.vala
index 012dabe4..2a6aa397 100644
--- a/main/src/ui/avatar_generator.vala
+++ b/main/src/ui/avatar_generator.vala
@@ -5,6 +5,7 @@ using Gtk;
using Dino.Entities;
using Xmpp;
+using Xmpp.Util;
namespace Dino.Ui {
@@ -259,10 +260,10 @@ public class AvatarGenerator {
}
private static void set_source_hex_color(Context ctx, string hex_color) {
- ctx.set_source_rgba((double) hex_color.substring(0, 2).to_long(null, 16) / 255,
- (double) hex_color.substring(2, 2).to_long(null, 16) / 255,
- (double) hex_color.substring(4, 2).to_long(null, 16) / 255,
- hex_color.length > 6 ? (double) hex_color.substring(6, 2).to_long(null, 16) / 255 : 1);
+ ctx.set_source_rgba((double) from_hex(hex_color.substring(0, 2)) / 255,
+ (double) from_hex(hex_color.substring(2, 2)) / 255,
+ (double) from_hex(hex_color.substring(4, 2)) / 255,
+ hex_color.length > 6 ? (double) from_hex(hex_color.substring(6, 2)) / 255 : 1);
}
}