[gnote] Remove use of singleton IGnote for client side decorations



commit 310cf940a3fb7173d12dc28d6c45a49235dee2d9
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Mon Dec 2 23:31:25 2019 +0200

    Remove use of singleton IGnote for client side decorations

 src/mainwindow.cpp    | 4 ++--
 src/mainwindow.hpp    | 4 +++-
 src/recentchanges.cpp | 4 ++--
 3 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 4c9ea31f..b0efa7a2 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -105,10 +105,10 @@ MainWindow *MainWindow::present_default(const Note::Ptr & note)
   return win;
 }
 
-bool MainWindow::use_client_side_decorations()
+bool MainWindow::use_client_side_decorations(Preferences & prefs)
 {
   if(s_use_client_side_decorations < 0) {
-    Glib::ustring setting = 
IGnote::obj().preferences().get_schema_settings(Preferences::SCHEMA_GNOTE)->get_string(
+    Glib::ustring setting = prefs.get_schema_settings(Preferences::SCHEMA_GNOTE)->get_string(
       Preferences::USE_CLIENT_SIDE_DECORATIONS);
     if(setting == "enabled") {
       s_use_client_side_decorations = 1;
diff --git a/src/mainwindow.hpp b/src/mainwindow.hpp
index a438cb4c..7e052723 100644
--- a/src/mainwindow.hpp
+++ b/src/mainwindow.hpp
@@ -27,6 +27,8 @@
 
 namespace gnote {
 
+class Preferences;
+
 class MainWindow
   : public Gtk::ApplicationWindow
   , public EmbeddableWidgetHost
@@ -37,7 +39,7 @@ public:
   static MainWindow *present_active(const Note::Ptr & note);
   static MainWindow *present_in_new_window(const Note::Ptr & note, bool close_on_esacpe);
   static MainWindow *present_default(const Note::Ptr & note);
-  static bool use_client_side_decorations();
+  static bool use_client_side_decorations(Preferences & prefs);
 
   explicit MainWindow(const Glib::ustring & title);
 
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index bdac29e2..5b63b9e5 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -84,7 +84,7 @@ namespace gnote {
     make_search_box();
     m_content_vbox.set_orientation(Gtk::ORIENTATION_VERTICAL);
     int content_y_attach = 0;
-    if(use_client_side_decorations()) {
+    if(use_client_side_decorations(m_preferences)) {
       set_titlebar(*static_cast<Gtk::HeaderBar*>(m_header_bar));
     }
     else {
@@ -205,7 +205,7 @@ namespace gnote {
     right_box->attach(*m_window_actions_button, 1, 0, 1, 1);
     right_box->show();
 
-    if(use_client_side_decorations()) {
+    if(use_client_side_decorations(m_preferences)) {
       Gtk::HeaderBar *header_bar = manage(new Gtk::HeaderBar);
       header_bar->set_show_close_button(true);
       header_bar->pack_start(*left_box);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]