[gnote] Fix opening special notes
- From: Aurimas Äernius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Fix opening special notes
- Date: Sat, 20 Oct 2012 18:23:21 +0000 (UTC)
commit c5820f343955ba284505f08eff360a0e9159a836
Author: Aurimas Äernius <aurisc4 gmail com>
Date: Sat Oct 20 18:08:30 2012 +0300
Fix opening special notes
Change get_window()->show() to use Gnote::open_note.
.../noteoftheday/noteofthedaypreferences.cpp | 7 ++++---
src/gnote.cpp | 10 +++++++++-
src/gnote.hpp | 1 +
src/notebooks/notebooknewnotemenuitem.cpp | 4 ++--
src/preferencesdialog.cpp | 2 +-
src/prefskeybinder.cpp | 8 +++-----
6 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/src/addins/noteoftheday/noteofthedaypreferences.cpp b/src/addins/noteoftheday/noteofthedaypreferences.cpp
index aea89a5..916c430 100644
--- a/src/addins/noteoftheday/noteofthedaypreferences.cpp
+++ b/src/addins/noteoftheday/noteofthedaypreferences.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2011 Aurimas Cernius
+ * Copyright (C) 2011-2012 Aurimas Cernius
* Copyright (C) 2009 Debarshi Ray
*
* This program is free software: you can redistribute it and/or modify
@@ -74,8 +74,9 @@ void NoteOfTheDayPreferences::open_template_button_clicked() const
}
}
- if (0 != template_note)
- template_note->get_window()->show();
+ if(0 != template_note) {
+ gnote::Gnote::obj().open_note(template_note);
+ }
}
}
diff --git a/src/gnote.cpp b/src/gnote.cpp
index 2c19ad8..36e2685 100644
--- a/src/gnote.cpp
+++ b/src/gnote.cpp
@@ -208,7 +208,7 @@ namespace gnote {
void Gnote::start_note_created(const Note::Ptr & start_note)
{
DBG_OUT("we will show the start note");
- start_note->get_window()->show();
+ open_note(start_note);
}
std::string Gnote::get_note_path(const std::string & override_path)
@@ -506,6 +506,14 @@ namespace gnote {
}
+ void Gnote::open_note(const Note::Ptr & note)
+ {
+ NoteRecentChanges::Ptr main_window = get_window_for_note();
+ main_window->present_note(note);
+ main_window->present();
+ }
+
+
void Gnote::make_app_menu()
{
set_app_menu(ActionManager::obj().get_app_menu());
diff --git a/src/gnote.hpp b/src/gnote.hpp
index b932392..5d17bde 100644
--- a/src/gnote.hpp
+++ b/src/gnote.hpp
@@ -165,6 +165,7 @@ public:
{
return m_sync_dlg;
}
+ void open_note(const Note::Ptr & note);
protected:
virtual int on_command_line(const Glib::RefPtr<Gio::ApplicationCommandLine> & command_line);
virtual void on_startup();
diff --git a/src/notebooks/notebooknewnotemenuitem.cpp b/src/notebooks/notebooknewnotemenuitem.cpp
index 26bed64..cdd40c2 100644
--- a/src/notebooks/notebooknewnotemenuitem.cpp
+++ b/src/notebooks/notebooknewnotemenuitem.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2010 Aurimas Cernius
+ * Copyright (C) 2010,2012 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -53,7 +53,7 @@ namespace gnote {
// Look for the template note and create a new note
Note::Ptr note = m_notebook->create_notebook_note ();
- note->get_window()->show ();
+ Gnote::obj().open_note(note);
}
diff --git a/src/preferencesdialog.cpp b/src/preferencesdialog.cpp
index 2adcff9..f9761f4 100644
--- a/src/preferencesdialog.cpp
+++ b/src/preferencesdialog.cpp
@@ -1007,7 +1007,7 @@ namespace gnote {
Note::Ptr template_note = manager.get_or_create_template_note ();
// Open the template note
- template_note->get_window()->show ();
+ Gnote::obj().open_note(template_note);
}
diff --git a/src/prefskeybinder.cpp b/src/prefskeybinder.cpp
index 7c2cd01..731b5b3 100644
--- a/src/prefskeybinder.cpp
+++ b/src/prefskeybinder.cpp
@@ -204,9 +204,7 @@ namespace gnote {
{
Note::Ptr note = m_manager.find_by_uri (m_manager.start_note_uri());
if (note) {
- NoteRecentChanges::Ptr window = Gnote::obj().get_window_for_note();
- window->present_note(note);
- window->present();
+ Gnote::obj().open_note(note);
}
}
@@ -214,8 +212,8 @@ namespace gnote {
void GnotePrefsKeybinder::key_create_new_note()
{
try {
- Note::Ptr new_note = m_manager.create ();
- new_note->get_window()->show ();
+ Note::Ptr new_note = m_manager.create();
+ Gnote::obj().open_note(new_note);
}
catch (...) {
// Fail silently.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]