[gnote] Use main window placement methods
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Use main window placement methods
- Date: Sun, 20 Dec 2020 10:58:50 +0000 (UTC)
commit 25dff02b11afbc767207ea87c4438824c713d4b8
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sat Dec 19 18:12:07 2020 +0200
Use main window placement methods
src/recentchanges.cpp | 10 +++-------
src/searchnoteswidget.cpp | 18 ++++++------------
2 files changed, 9 insertions(+), 19 deletions(-)
---
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index 6d9a55ae..180017f7 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -61,10 +61,9 @@ namespace gnote {
, m_window_menu_default(NULL)
, m_keybinder(get_accel_group())
{
- Glib::RefPtr<Gio::Settings> settings = g.preferences().get_schema_settings(Preferences::SCHEMA_GNOTE);
set_default_size(450,400);
set_resizable(true);
- if(settings->get_boolean(Preferences::MAIN_WINDOW_MAXIMIZED)) {
+ if(g.preferences().main_window_maximized()) {
maximize();
}
@@ -386,9 +385,7 @@ namespace gnote {
Glib::RefPtr<Gdk::Window> win = get_window();
// background window (for tray to work) might not have GDK window
if(win) {
- m_preferences.get_schema_settings(Preferences::SCHEMA_GNOTE)->set_boolean(
- Preferences::MAIN_WINDOW_MAXIMIZED,
- win->get_state() & Gdk::WINDOW_STATE_MAXIMIZED);
+ m_preferences.main_window_maximized(win->get_state() & Gdk::WINDOW_STATE_MAXIMIZED);
}
std::vector<Gtk::Widget*> current = m_embed_box.get_children();
for(std::vector<Gtk::Widget*>::iterator iter = current.begin();
@@ -530,8 +527,7 @@ namespace gnote {
wid.show();
widget.foreground();
- bool maximized = m_preferences.get_schema_settings(Preferences::SCHEMA_GNOTE)->get_boolean(
- Preferences::MAIN_WINDOW_MAXIMIZED);
+ bool maximized = m_preferences.main_window_maximized();
if(get_realized()) {
//if window is showing, use actual state
maximized = get_window()->get_state() & Gdk::WINDOW_STATE_MAXIMIZED;
diff --git a/src/searchnoteswidget.cpp b/src/searchnoteswidget.cpp
index 47125058..69db48d4 100644
--- a/src/searchnoteswidget.cpp
+++ b/src/searchnoteswidget.cpp
@@ -270,9 +270,7 @@ void SearchNotesWidget::save_position()
return;
}
- Glib::RefPtr<Gio::Settings> settings = m_gnote.preferences()
- .get_schema_settings(Preferences::SCHEMA_GNOTE);
- settings->set_int(Preferences::SEARCH_WINDOW_SPLITTER_POS, get_position());
+ m_gnote.preferences().search_window_splitter_pos(get_position());
Gtk::Window *window = dynamic_cast<Gtk::Window*>(current_host);
if(!window || (window->get_window()->get_state() & Gdk::WINDOW_STATE_MAXIMIZED) != 0) {
@@ -281,8 +279,8 @@ void SearchNotesWidget::save_position()
window->get_size(width, height);
- settings->set_int(Preferences::SEARCH_WINDOW_WIDTH, width);
- settings->set_int(Preferences::SEARCH_WINDOW_HEIGHT, height);
+ m_gnote.preferences().search_window_width(width);
+ m_gnote.preferences().search_window_height(height);
}
void SearchNotesWidget::notebook_pixbuf_cell_data_func(Gtk::CellRenderer * renderer,
@@ -1396,17 +1394,13 @@ void SearchNotesWidget::background()
void SearchNotesWidget::hint_size(int & width, int & height)
{
- Glib::RefPtr<Gio::Settings> settings = m_gnote.preferences()
- .get_schema_settings(Preferences::SCHEMA_GNOTE);
- width = settings->get_int(Preferences::SEARCH_WINDOW_WIDTH);
- height = settings->get_int(Preferences::SEARCH_WINDOW_HEIGHT);
+ width = m_gnote.preferences().search_window_width();
+ height = m_gnote.preferences().search_window_height();
}
void SearchNotesWidget::size_internals()
{
- Glib::RefPtr<Gio::Settings> settings = m_gnote.preferences()
- .get_schema_settings(Preferences::SCHEMA_GNOTE);
- int pos = settings->get_int(Preferences::SEARCH_WINDOW_SPLITTER_POS);
+ int pos = m_gnote.preferences().search_window_splitter_pos();
if(pos) {
set_position(pos);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]