aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
blob: 71e54d364520c101db9a5c9b688750f7cf8ba5cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "../include/Window.hpp"
#include <gtkmm/application.h>
#include <gtkmm/cssprovider.h>
#include <gtkmm/settings.h>

int main (int argc, char *argv[])
{
    auto app = Gtk::Application::create(argc, argv, "dec05eba.dchat");

    auto css = Gtk::CssProvider::create();
    try
    {
        if(!css->load_from_path("css/style.css"))
        {
            fprintf(stderr, "Failed to load css/style.css");
            return 1;
        }
    }
    catch(Gtk::CssProviderError &e)
    {
        fprintf(stderr, "Failed to load css/style.css, error: %s\n", e.what().c_str());
        return 1;
    }

    dchat::Window window;
    auto ctx = window.get_style_context();
    auto screen = Gdk::Screen::get_default();
    ctx->add_provider_for_screen(screen, css, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

    return app->run(window);
}