some refactorage and add avatars to member list

This commit is contained in:
ouwou
2020-09-12 19:35:24 -04:00
parent e68f8ef8f4
commit 2822add5fe
7 changed files with 100 additions and 35 deletions

View File

@@ -27,3 +27,18 @@ Glib::RefPtr<Gdk::Pixbuf> ImageManager::GetFromURLIfCached(std::string url) {
return Glib::RefPtr<Gdk::Pixbuf>(nullptr);
}
Glib::RefPtr<Gdk::Pixbuf> ImageManager::GetPlaceholder(int size) {
std::string name = "/placeholder" + std::to_string(size);
if (m_pixs.find(name) != m_pixs.end())
return m_pixs.at(name);
try {
auto buf = Gdk::Pixbuf::create_from_file("res/decamarks.png", size, size);
m_pixs[name] = buf;
return buf;
} catch (std::exception &e) {
fprintf(stderr, "error loading placeholder\n");
return Glib::RefPtr<Gdk::Pixbuf>(nullptr);
}
}