2020-12-07 16:21:34 -08:00
|
|
|
#include "about.h"
|
2021-02-27 15:25:25 -08:00
|
|
|
#include "project_config.h"
|
2020-12-07 16:21:34 -08:00
|
|
|
|
2021-03-02 07:10:23 -08:00
|
|
|
#include <glibmm/miscutils.h>
|
|
|
|
#include <glibmm/fileutils.h>
|
|
|
|
|
2021-02-12 12:46:41 -08:00
|
|
|
About::About()
|
|
|
|
{
|
2020-12-08 19:44:26 -08:00
|
|
|
std::vector<Glib::ustring> devs;
|
2021-03-02 09:24:51 -08:00
|
|
|
devs.push_back("Melroy van den Berg <info@libreweb.org>");
|
2021-04-04 13:20:16 -07:00
|
|
|
std::vector<Glib::ustring> docs;
|
|
|
|
docs.push_back("Melroy van den Berg <info@libreweb.org>");
|
|
|
|
|
2021-03-02 07:10:23 -08:00
|
|
|
logo.set(this->getLogoImage());
|
2020-12-07 16:21:34 -08:00
|
|
|
|
2021-03-02 08:47:17 -08:00
|
|
|
set_program_name("LibreWeb Browser");
|
2021-02-27 15:25:25 -08:00
|
|
|
set_version(PROJECT_VER);
|
2021-04-04 13:20:16 -07:00
|
|
|
set_comments("The fastest decentralized & distributed Browser on planet Earth.\n\nVisit GitLab project at: https://gitlab.melroy.org/libreweb/browser");
|
2020-12-09 09:52:21 -08:00
|
|
|
set_logo(logo.get_pixbuf());
|
2021-04-04 13:20:16 -07:00
|
|
|
set_website_label("Visit homepage");
|
2021-03-02 08:47:17 -08:00
|
|
|
set_website("https://libreweb.org/");
|
2020-12-07 16:21:34 -08:00
|
|
|
set_copyright("Copyright © 2020-2021 Melroy van den Berg");
|
|
|
|
set_authors(devs);
|
|
|
|
set_artists(devs);
|
2021-04-04 13:20:16 -07:00
|
|
|
set_documenters(docs);
|
|
|
|
set_license("");
|
2020-12-07 16:21:34 -08:00
|
|
|
set_license_type(Gtk::License::LICENSE_MIT_X11);
|
2021-02-12 14:30:39 -08:00
|
|
|
set_position(Gtk::WIN_POS_CENTER_ON_PARENT);
|
2020-12-07 16:21:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
About::~About()
|
|
|
|
{
|
|
|
|
}
|
2020-12-08 19:44:26 -08:00
|
|
|
|
|
|
|
void About::show_about()
|
|
|
|
{
|
|
|
|
run();
|
|
|
|
}
|
|
|
|
|
|
|
|
void About::hide_about(__attribute__((unused)) int response)
|
|
|
|
{
|
|
|
|
hide();
|
2021-03-02 07:10:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string About::getLogoImage()
|
|
|
|
{
|
|
|
|
// Try absolute path first
|
|
|
|
for (std::string data_dir : Glib::get_system_data_dirs())
|
|
|
|
{
|
2021-03-02 08:47:17 -08:00
|
|
|
std::vector<std::string> path_builder{data_dir, "libreweb-browser", "images", "browser_logo_small.png"};
|
2021-03-02 07:10:23 -08:00
|
|
|
std::string file_path = Glib::build_path(G_DIR_SEPARATOR_S, path_builder);
|
|
|
|
if (Glib::file_test(file_path, Glib::FileTest::FILE_TEST_IS_REGULAR))
|
|
|
|
{
|
|
|
|
return file_path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Try local path if the images are not installed (yet)
|
|
|
|
// When working directory is in the build/bin folder (relative path)
|
|
|
|
std::string file_path = Glib::build_filename("../../images", "browser_logo_small.png");
|
|
|
|
if (Glib::file_test(file_path, Glib::FileTest::FILE_TEST_IS_REGULAR))
|
|
|
|
{
|
|
|
|
return file_path;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return "";
|
|
|
|
}
|
2020-12-08 19:44:26 -08:00
|
|
|
}
|