[gnote] Prevent activation of links that have just been middle-click pasted to a note.
- From: Hubert Figuière <hub src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnote] Prevent activation of links that have just been middle-click pasted to a note.
- Date: Sun, 19 Jul 2009 03:30:15 +0000 (UTC)
commit 9d00377dd06dfef40fabc65304e666c286d8bee9
Author: Hubert Figuiere <hub figuiere net>
Date: Thu Jul 16 23:57:20 2009 -0400
Prevent activation of links that have just been middle-click pasted to a note.
(Tomboy bug #414029) (tb-backport)
src/notetag.cpp | 12 ++++++++++++
src/notetag.hpp | 1 +
2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/notetag.cpp b/src/notetag.cpp
index 5fba580..4d49366 100644
--- a/src/notetag.cpp
+++ b/src/notetag.cpp
@@ -37,6 +37,7 @@ namespace gnote {
: Gtk::TextTag(tag_name)
, m_element_name(tag_name)
, m_widget(NULL)
+ , m_allow_middle_activate(false)
, m_flags(flags | CAN_SERIALIZE | CAN_SPLIT)
{
if (tag_name.empty()) {
@@ -51,6 +52,7 @@ namespace gnote {
NoteTag::NoteTag()
: Gtk::TextTag()
, m_widget(NULL)
+ , m_allow_middle_activate(false)
, m_flags(0)
{
}
@@ -174,6 +176,7 @@ namespace gnote {
// Do not insert selected text when activating links with
// middle mouse button
if (button_ev->button == 2) {
+ m_allow_middle_activate = true;
return true;
}
@@ -195,6 +198,15 @@ namespace gnote {
return false;
}
+ // Don't activate if the link has just been pasted with the
+ // middle mouse button (no preceding ButtonPress event)
+ if (button_ev->button == 2 && !m_allow_middle_activate) {
+ return false;
+ }
+ else {
+ m_allow_middle_activate = false;
+ }
+
get_extents (iter, start, end);
bool success = on_activate (*(editor.operator->()), start, end);
diff --git a/src/notetag.hpp b/src/notetag.hpp
index 61dc93b..ded644d 100644
--- a/src/notetag.hpp
+++ b/src/notetag.hpp
@@ -156,6 +156,7 @@ private:
std::string m_element_name;
Glib::RefPtr<Gtk::TextMark> m_widget_location;
Gtk::Widget * m_widget;
+ bool m_allow_middle_activate;
int m_flags;
TagActivatedHandler m_signal_activate;
ContrastPaletteColor m_palette_foreground;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]