Working submenu!

master
Melroy van den Berg 2021-08-28 23:35:19 +02:00
parent b3f6ba3a99
commit 44f469723d
No known key found for this signature in database
GPG Key ID: 71D11FF23454B9D7
2 changed files with 16 additions and 9 deletions

View File

@ -34,6 +34,7 @@ MainWindow::MainWindow(const std::string &timeout)
m_vbox(Gtk::ORIENTATION_VERTICAL, 0),
m_vboxStatus(Gtk::ORIENTATION_VERTICAL),
m_vboxSettings(Gtk::ORIENTATION_VERTICAL),
m_vboxIconTheme(Gtk::ORIENTATION_VERTICAL),
m_searchMatchCase("Match _Case", true),
m_fontButton(DEFAULT_FONT_FAMILY + " " + std::to_string(DEFAULT_FONT_SIZE)),
m_copyIDButton("Copy your ID"),
@ -270,6 +271,7 @@ void MainWindow::initSettingsPopover()
m_gridSetings.attach(m_indentLabel, 0, 3);
m_gridSetings.attach(m_indentSpinButton, 1, 3);
// Icon theme (+ submenu)
m_iconThemeButton.set_label("Icon Theme");
m_iconThemeButton.property_menu_name() = "icon-theme";
m_aboutButton.set_label("About LibreWeb");
@ -279,6 +281,13 @@ void MainWindow::initSettingsPopover()
iconThemeButtonlabel->set_xalign(0.0);
aboutButtonLabel->set_xalign(0.0);
m_iconThemeBackButton.set_label("Main menu");
m_iconThemeBackButton.property_menu_name() = "main";
m_iconThemeBackButton.property_inverted() = true;
m_vboxIconTheme.add(m_iconThemeBackButton);
m_settingsPopover.add(m_vboxIconTheme);
m_settingsPopover.child_property_submenu(m_vboxIconTheme) = "icon-theme";
// Add all to vbox / pop-over
m_vboxSettings.set_margin_start(10);
m_vboxSettings.set_margin_end(10);
@ -695,7 +704,7 @@ bool MainWindow::delete_window(GdkEventAny *any_event __attribute__((unused)))
// Fullscreen will be availible with gtkmm-4.0
//m_settings->set_boolean("fullscreen", this->is_fullscreen());
// TODO: Also add font family & font size to the settings (and restore)
return false;
}
@ -1739,13 +1748,10 @@ std::string MainWindow::getIconImageFromTheme(const std::string &iconName, const
void MainWindow::updateCSS()
{
m_drawCSSProvider->load_from_data("textview { "
"font-family: \"" +
m_fontFamily + "\";"
"font-size: " +
std::to_string(m_fontSize) + "pt;"
"letter-spacing: " +
std::to_string(m_fontSpacing) + "px;"
"}");
"font-family: \"" + m_fontFamily + "\";"
"font-size: " + std::to_string(m_fontSize) + "pt;"
"letter-spacing: " + std::to_string(m_fontSpacing) + "px;"
"}");
}
void MainWindow::editor_changed_text()

View File

@ -119,7 +119,7 @@ protected:
Gtk::Box m_vboxSettings;
Gtk::Box m_hboxSetingsZoom;
Gtk::Box m_hboxSetingsBrightness;
Gtk::Box m_vboxTemp;
Gtk::Box m_vboxIconTheme;
Gtk::Scale m_scaleSettingsBrightness;
Gtk::Entry m_addressBar;
Gtk::ToggleButton m_searchMatchCase;
@ -132,6 +132,7 @@ protected:
Gtk::SpinButton m_indentSpinButton;
Gtk::ModelButton m_iconThemeButton;
Gtk::ModelButton m_aboutButton;
Gtk::ModelButton m_iconThemeBackButton;
Gtk::Grid m_gridSetings;
Gtk::Button m_backButton;
Gtk::Button m_forwardButton;