[gnote] Only reuse search window when --search
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Only reuse search window when --search
- Date: Fri, 23 Oct 2020 19:51:00 +0000 (UTC)
commit 23dc4e62a9873c375b634317fbd8892e23d022f8
Author: Aurimas Černius <aurisc4 gmail com>
Date: Fri Oct 23 22:50:03 2020 +0300
Only reuse search window when --search
Fixes https://gitlab.gnome.org/GNOME/gnote/-/issues/21
src/dbus/remotecontrol.cpp | 2 +-
src/gnote.cpp | 20 +++-----------------
2 files changed, 4 insertions(+), 18 deletions(-)
---
diff --git a/src/dbus/remotecontrol.cpp b/src/dbus/remotecontrol.cpp
index fd77b96c..91ac6916 100644
--- a/src/dbus/remotecontrol.cpp
+++ b/src/dbus/remotecontrol.cpp
@@ -144,7 +144,7 @@ namespace gnote {
void RemoteControl::DisplaySearchWithText(const Glib::ustring& search_text)
{
- MainWindow & recent_changes = m_gnote.get_main_window();
+ MainWindow & recent_changes = m_gnote.open_search_all();
recent_changes.set_search_text(search_text);
recent_changes.present();
recent_changes.show_search_bar();
diff --git a/src/gnote.cpp b/src/gnote.cpp
index 9d9317b0..876496bb 100644
--- a/src/gnote.cpp
+++ b/src/gnote.cpp
@@ -384,33 +384,19 @@ namespace gnote {
// present already open search window, if there is one
std::vector<Gtk::Window*> windows = Gtk::Window::list_toplevels();
- int main_windows = 0;
for(std::vector<Gtk::Window*>::iterator iter = windows.begin();
iter != windows.end(); ++iter) {
auto win = dynamic_cast<MainWindow*>(*iter);
if(win) {
- ++main_windows;
if(win->is_search()) {
return *win;
}
- else if(rc == NULL) {
- rc = win;
- }
}
}
- // if notes are opened in new window by default, then open new window for search
- // otherwise switch the only window to search
- // if there is more than one window open, open new for search, since we can't decide which one to switch
- bool new_window =
m_preferences.get_schema_settings(Preferences::SCHEMA_GNOTE)->get_boolean(Preferences::OPEN_NOTES_IN_NEW_WINDOW);
- if(main_windows > 1 || new_window) {
- MainWindow & main_window = new_main_window();
- main_window.present_search();
- return main_window;
- }
-
- rc->present_search();
- return *rc;
+ MainWindow & main_window = new_main_window();
+ main_window.present_search();
+ return main_window;
}
void Gnote::open_note_sync_window(const Glib::VariantBase&)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]