mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
added file existence check
This commit is contained in:
parent
da3d9533d1
commit
7671ccfbc6
@ -10,6 +10,7 @@
|
|||||||
#include "gdkmm/cursor.h"
|
#include "gdkmm/cursor.h"
|
||||||
#include "gdkmm/event.h"
|
#include "gdkmm/event.h"
|
||||||
#include "gdkmm/types.h"
|
#include "gdkmm/types.h"
|
||||||
|
#include "glibmm/fileutils.h"
|
||||||
#include "sigc++/functors/mem_fun.h"
|
#include "sigc++/functors/mem_fun.h"
|
||||||
#include "sigc++/functors/ptr_fun.h"
|
#include "sigc++/functors/ptr_fun.h"
|
||||||
|
|
||||||
@ -106,8 +107,12 @@ void User::init_default_user_avatar(int width, int height) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void User::init_user_avatar(const std::string& path, int width, int height) {
|
void User::init_user_avatar(const std::string& path, int width, int height) {
|
||||||
|
if (Glib::file_test(path, Glib::FILE_TEST_EXISTS)) {
|
||||||
Glib::RefPtr<Gdk::Pixbuf> pixbuf_ = Gdk::Pixbuf::create_from_file(path, width, height);
|
Glib::RefPtr<Gdk::Pixbuf> pixbuf_ = Gdk::Pixbuf::create_from_file(path, width, height);
|
||||||
AIconLabel::image_.set(pixbuf_);
|
AIconLabel::image_.set(pixbuf_);
|
||||||
|
} else {
|
||||||
|
AIconLabel::box_.remove(AIconLabel::image_);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto User::update() -> void {
|
auto User::update() -> void {
|
||||||
|
Loading…
Reference in New Issue
Block a user