[gnote] Refactor to use enable_close_note_on_escape
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Refactor to use enable_close_note_on_escape
- Date: Sat, 19 Dec 2020 14:06:21 +0000 (UTC)
commit 07ec3c90fd0e0c4e3350757af51ec1d67ab42a35
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sat Dec 19 13:30:54 2020 +0200
Refactor to use enable_close_note_on_escape
src/mainwindow.cpp | 4 ++--
src/notebooks/notebooknewnotemenuitem.cpp | 6 ++----
src/recentchanges.cpp | 9 ++-------
src/recentchanges.hpp | 3 +--
4 files changed, 7 insertions(+), 15 deletions(-)
---
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index e415bca4..b25bbad1 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2013,2015-2017,2019 Aurimas Cernius
+ * Copyright (C) 2013,2015-2017,2019-2020 Aurimas Cernius
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -98,7 +98,7 @@ MainWindow *MainWindow::present_default(IGnote & g, const Note::Ptr & note)
}
if(!win) {
win = &g.new_main_window();
- win->close_on_escape(settings->get_boolean(Preferences::ENABLE_CLOSE_NOTE_ON_ESCAPE));
+ win->close_on_escape(g.preferences().enable_close_note_on_escape());
}
win->present_note(note);
win->present();
diff --git a/src/notebooks/notebooknewnotemenuitem.cpp b/src/notebooks/notebooknewnotemenuitem.cpp
index 126d5fea..1e5345d6 100644
--- a/src/notebooks/notebooknewnotemenuitem.cpp
+++ b/src/notebooks/notebooknewnotemenuitem.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2010,2012-2013,2017,2019 Aurimas Cernius
+ * Copyright (C) 2010,2012-2013,2017,2019-2020 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -56,9 +56,7 @@ namespace gnote {
// Look for the template note and create a new note
Note::Ptr note = m_notebook->create_notebook_note ();
- MainWindow::present_in_new_window(m_gnote, note,
- m_gnote.preferences().get_schema_settings(Preferences::SCHEMA_GNOTE)->get_boolean(
- Preferences::ENABLE_CLOSE_NOTE_ON_ESCAPE));
+ MainWindow::present_in_new_window(m_gnote, note, m_gnote.preferences().enable_close_note_on_escape());
}
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index 6668f610..e849b7c4 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -63,7 +63,6 @@ namespace gnote {
{
Glib::RefPtr<Gio::Settings> settings = g.preferences().get_schema_settings(Preferences::SCHEMA_GNOTE);
m_open_notes_in_new_window = settings->get_boolean(Preferences::OPEN_NOTES_IN_NEW_WINDOW);
- m_close_note_on_escape = settings->get_boolean(Preferences::ENABLE_CLOSE_NOTE_ON_ESCAPE);
set_default_size(450,400);
set_resizable(true);
if(settings->get_boolean(Preferences::MAIN_WINDOW_MAXIMIZED)) {
@@ -374,7 +373,7 @@ namespace gnote {
void NoteRecentChanges::on_open_note_new_window(const Note::Ptr & note)
{
- present_in_new_window(m_gnote, note, m_close_note_on_escape);
+ present_in_new_window(m_gnote, note, m_preferences.enable_close_note_on_escape());
}
void NoteRecentChanges::on_delete_note()
@@ -436,7 +435,7 @@ namespace gnote {
else if(close_on_escape()) {
close_window();
}
- else if(m_close_note_on_escape) {
+ else if(m_preferences.enable_close_note_on_escape()) {
EmbeddableWidget *current_item = currently_embedded();
if(current_item) {
background_embedded(*current_item);
@@ -836,10 +835,6 @@ namespace gnote {
m_open_notes_in_new_window = m_preferences.get_schema_settings(
Preferences::SCHEMA_GNOTE)->get_boolean(Preferences::OPEN_NOTES_IN_NEW_WINDOW);
}
- else if(key == Preferences::ENABLE_CLOSE_NOTE_ON_ESCAPE) {
- m_close_note_on_escape = m_preferences.get_schema_settings(
- Preferences::SCHEMA_GNOTE)->get_boolean(Preferences::ENABLE_CLOSE_NOTE_ON_ESCAPE);
- }
}
bool NoteRecentChanges::on_notes_widget_key_press(GdkEventKey *evt)
diff --git a/src/recentchanges.hpp b/src/recentchanges.hpp
index 6fe3ee55..51115be7 100644
--- a/src/recentchanges.hpp
+++ b/src/recentchanges.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2010-2017,2019 Aurimas Cernius
+ * Copyright (C) 2010-2017,2019-2020 Aurimas Cernius
* Copyright (C) 2010 Debarshi Ray
* Copyright (C) 2009 Hubert Figuiere
*
@@ -119,7 +119,6 @@ private:
Gtk::PopoverMenu *m_window_menu_default;
utils::GlobalKeybinder m_keybinder;
bool m_open_notes_in_new_window;
- bool m_close_note_on_escape;
std::map<Glib::ustring, MainWindowAction::Ptr> m_actions;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]