void MainWindow::run(Glib::RefPtr<Gtk::Application> app) { Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create(); try{ builder->add_from_resource("/nethogs_gui/window.glade"); } catch(Gtk::BuilderError const& e){ std::cout << e.what() << std::endl; return; } try{ builder->add_from_resource("/nethogs_gui/headerbar.ui"); } catch(Gtk::BuilderError const& e){ std::cout << e.what() << std::endl; return; } //get widgets m_window = loadWiget<Gtk::ApplicationWindow>(builder, "main_window"); m_p_status_label_1 = loadWiget<Gtk::Label>(builder, "status_label_1"); m_p_status_label_2 = loadWiget<Gtk::Label>(builder, "status_label_2"); m_p_status_label_3 = loadWiget<Gtk::Label>(builder, "status_label_3"); m_p_status_label_4 = loadWiget<Gtk::Label>(builder, "status_label_4"); std::shared_ptr<Gtk::TreeView> tree_view = loadWiget<Gtk::TreeView>(builder, "treeview"); std::shared_ptr<Gtk::HeaderBar> pheaderbar = loadWiget<Gtk::HeaderBar>(builder, "headerbar"); //set title bar m_window->set_titlebar(*pheaderbar); //Create the Tree model m_list_store = m_tree_data.createListStore(); assert(m_list_store); tree_view->set_model(m_list_store); m_tree_data.setTreeColumns(tree_view.get()); //Connect signals m_window->signal_realize().connect(std::bind(&MainWindow::onLoaded, this)); m_window->signal_delete_event().connect(sigc::mem_fun(this,&MainWindow::onClosed)); m_window->signal_show().connect(sigc::mem_fun(this,&MainWindow::onShow)); //add actions app->add_action("about", sigc::mem_fun(this,&MainWindow::onAction_About)); app->add_action("quit", sigc::mem_fun(this,&MainWindow::onAction_Quit)); app->run(*m_window); }