[gnote] Fix --highlight-search with non-uri --open-note
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Fix --highlight-search with non-uri --open-note
- Date: Thu, 23 Dec 2010 22:25:58 +0000 (UTC)
commit 932fbce21d6072490112943ab140bebdec53e4ed
Author: Aurimas Ä?ernius <aurisc4 gmail com>
Date: Fri Dec 24 00:20:12 2010 +0200
Fix --highlight-search with non-uri --open-note
Make highlight-search work when argument for --open-note is a file.
Fixes Bug 608713.
src/gnote.cpp | 32 ++++++++++++++++++++------------
src/gnote.hpp | 3 +++
2 files changed, 23 insertions(+), 12 deletions(-)
---
diff --git a/src/gnote.cpp b/src/gnote.cpp
index 713c3c3..f250538 100644
--- a/src/gnote.cpp
+++ b/src/gnote.cpp
@@ -544,13 +544,7 @@ namespace gnote {
m_open_note_uri = remote->FindNote (m_open_note_name);
}
if (!m_open_note_uri.empty()) {
- if (m_highlight_search) {
- remote->DisplayNoteWithSearch (m_open_note_uri,
- m_highlight_search);
- }
- else {
- remote->DisplayNote (m_open_note_uri);
- }
+ display_note(remote, m_open_note_uri);
}
if (!m_open_external_note_path.empty()) {
@@ -558,9 +552,7 @@ namespace gnote {
if (!note_id.empty()) {
// Attempt to load the note, assuming it might already
// be part of our notes list.
- if (remote->DisplayNote (
- str(boost::format("note://gnote/%1%") % note_id)) == false) {
-
+ if (!display_note(remote, str(boost::format("note://gnote/%1%") % note_id))) {
sharp::StreamReader sr;
sr.init(m_open_external_note_path);
if (sr.file()) {
@@ -577,7 +569,7 @@ namespace gnote {
noteXml = "";
}
- if (!noteXml.empty()) {
+ if (!noteXml.empty()) {
noteTitle = NoteArchiver::obj().get_title_from_note_xml (noteXml);
if (!noteTitle.empty()) {
// Check for conflicting titles
@@ -594,7 +586,7 @@ namespace gnote {
if (!note_uri.empty()) {
// Load in the XML contents of the note file
if (remote->SetNoteCompleteXml (note_uri, noteXml)) {
- remote->DisplayNote (note_uri);
+ display_note(remote, note_uri);
}
}
}
@@ -640,6 +632,22 @@ namespace gnote {
}
+ bool GnoteCommandLine::display_note(RemoteControlClient * remote,
+ std::string uri)
+ {
+#ifdef ENABLE_DBUS
+ if (m_highlight_search) {
+ return remote->DisplayNoteWithSearch(uri, m_highlight_search);
+ }
+ else {
+ return remote->DisplayNote (uri);
+ }
+#else
+ return false;
+#endif
+ }
+
+
bool GnoteCommandLine::needs_execute() const
{
DBG_OUT("needs execute?");
diff --git a/src/gnote.hpp b/src/gnote.hpp
index ba14e72..7590d12 100644
--- a/src/gnote.hpp
+++ b/src/gnote.hpp
@@ -103,6 +103,7 @@ private:
RemoteControl *m_remote_control;
};
+class RemoteControlClient;
class GnoteCommandLine
{
@@ -128,6 +129,8 @@ public:
GError **error);
private:
void print_version();
+ bool display_note(RemoteControlClient * remote,
+ std::string uri);
GOptionContext *m_context;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]