update connections (#239)

This commit is contained in:
ouwou 2023-10-17 22:55:50 -04:00
parent ffb8d38621
commit 5e244e5cb8
10 changed files with 37 additions and 18 deletions

BIN
res/res/crunchyroll.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

BIN
res/res/ebay.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
res/res/instagram.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
res/res/paypal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
res/res/playstation.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
res/res/riotgames.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
res/res/tiktok.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -1,6 +1,34 @@
#include "userinfopane.hpp"
#include <unordered_set>
static std::string GetConnectionURL(const ConnectionData &conn) {
if (conn.Type == "github") {
return "https://github.com/" + conn.Name;
} else if (conn.Type == "steam") {
return "https://steamcommunity.com/profiles/" + conn.ID;
} else if (conn.Type == "twitch") {
return "https://twitch.tv/" + conn.Name;
} else if (conn.Type == "twitter") {
return "https://twitter.com/i/user/" + conn.ID;
} else if (conn.Type == "spotify") {
return "https://open.spotify.com/user/" + conn.ID;
} else if (conn.Type == "reddit") {
return "https://reddit.com/u/" + conn.Name;
} else if (conn.Type == "youtube") {
return "https://www.youtube.com/channel/" + conn.ID;
} else if (conn.Type == "facebook") {
return "https://www.facebook.com/" + conn.ID;
} else if (conn.Type == "ebay") {
return "https://www.ebay.com/usr/" + conn.Name;
} else if (conn.Type == "instagram") {
return "https://www.instagram.com/" + conn.Name;
} else if (conn.Type == "tiktok") {
return "https://www.tiktok.com/@" + conn.Name;
}
return "";
}
ConnectionItem::ConnectionItem(const ConnectionData &conn)
: m_box(Gtk::ORIENTATION_HORIZONTAL)
, m_name(conn.Name) {
@ -8,23 +36,7 @@ ConnectionItem::ConnectionItem(const ConnectionData &conn)
try {
pixbuf = Gdk::Pixbuf::create_from_file(Abaddon::GetResPath("/" + conn.Type + ".png"), 32, 32);
} catch (const Glib::Exception &e) {}
std::string url;
if (conn.Type == "github")
url = "https://github.com/" + conn.Name;
else if (conn.Type == "steam")
url = "https://steamcommunity.com/profiles/" + conn.ID;
else if (conn.Type == "twitch")
url = "https://twitch.tv/" + conn.Name;
else if (conn.Type == "twitter")
url = "https://twitter.com/i/user/" + conn.ID;
else if (conn.Type == "spotify")
url = "https://open.spotify.com/user/" + conn.ID;
else if (conn.Type == "reddit")
url = "https://reddit.com/u/" + conn.Name;
else if (conn.Type == "youtube")
url = "https://www.youtube.com/channel/" + conn.ID;
else if (conn.Type == "facebook")
url = "https://www.facebook.com/" + conn.ID;
std::string url = GetConnectionURL(conn);
if (pixbuf) {
m_image = Gtk::manage(new Gtk::Image(pixbuf));
m_image->get_style_context()->add_class("profile-connection-image");
@ -83,17 +95,24 @@ void ConnectionsContainer::SetConnections(const std::vector<ConnectionData> &con
static const std::unordered_set<std::string> supported_services = {
"battlenet",
"ebay",
"epicgames",
"facebook",
"github",
"instagram",
"leagueoflegends",
"paypal",
"playstation",
"reddit",
"riotgames",
"skype",
"spotify",
"steam",
"tiktok",
"twitch",
"twitter",
"xbox",
"youtube",
"facebook"
};
int i = 0;