| 12345678910111213141516171819202122232425262728293031323334353637 |
- #include "MainWindow.hpp"
- #include <gtkmm/application.h>
- #include <gtk/gtk.h>
- #include <iostream>
- #include <cstdlib>
- #include <sys/stat.h>
- #include <string>
- int main(int argc, char *argv[]) {
- // --- Environment Hijack for Fontconfig ---
- const char* user = std::getenv("USER");
- std::string safe_cache_dir = std::string("/tmp/gnome-vault-cache-") + (user ? user : "default");
- mkdir(safe_cache_dir.c_str(), 0777);
- setenv("XDG_CACHE_HOME", safe_cache_dir.c_str(), 1);
- // Set Program Name for WmClass / Task Bar
- g_set_prgname("gnomesettingsvault");
- g_set_application_name("GnomeSettingsVault");
- if (!gtk_init_check(&argc, &argv)) {
- std::cerr << "Bloody hell: GTK failed to initialize." << std::endl;
- return 1;
- }
- try {
- // Application ID also helps define the WmClass
- auto app = Gtk::Application::create(argc, argv, "org.gnome.settingsvault");
- MainWindow window;
- return app->run(window);
- } catch (const Glib::Error& ex) {
- std::cerr << "GTK Error: " << ex.what() << std::endl;
- return 1;
- } catch (const std::exception& ex) {
- std::cerr << "Standard Exception: " << ex.what() << std::endl;
- return 1;
- }
- }
|