[gnote] Allow to hide the Find bar with ESC. (Tomboy bug #540822) (tb-backport)
- From: Hubert Figuière <hub src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnote] Allow to hide the Find bar with ESC. (Tomboy bug #540822) (tb-backport)
- Date: Sun, 19 Jul 2009 03:30:20 +0000 (UTC)
commit f86acd3900a222e93fc807be27acee092338b0ce
Author: Hubert Figuiere <hub figuiere net>
Date: Fri Jul 17 00:13:33 2009 -0400
Allow to hide the Find bar with ESC. (Tomboy bug #540822) (tb-backport)
src/notewindow.cpp | 33 ++++++++-------------------------
src/notewindow.hpp | 2 --
2 files changed, 8 insertions(+), 27 deletions(-)
---
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index 9448c6b..f8bd1da 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -171,13 +171,8 @@ namespace gnote {
GDK_N, Gdk::CONTROL_MASK,
Gtk::ACCEL_VISIBLE);
- // Have Esc key close the note window
- if (Preferences::obj().get<bool>(Preferences::ENABLE_CLOSE_NOTE_ON_ESCAPE))
- m_keypress_cid = signal_key_press_event().connect(sigc::mem_fun(*this, &NoteWindow::on_key_pressed));
+ signal_key_press_event().connect(sigc::mem_fun(*this, &NoteWindow::on_key_pressed));
- // Watch the escape setting in GConf
- m_gconf_notify = Preferences::obj().add_notify(Preferences::ENABLE_CLOSE_NOTE_ON_ESCAPE,
- &NoteWindow::on_escape_setting_changed, this);
// Increase Indent
m_global_keys->add_accelerator (sigc::mem_fun(*this, &NoteWindow::change_depth_right_handler),
@@ -222,29 +217,17 @@ namespace gnote {
move(x, y);
}
- void NoteWindow::on_escape_setting_changed(GConfClient *, guint /*cnxid*/,
- GConfEntry* entry, gpointer data)
- {
- NoteWindow * self = static_cast<NoteWindow*>(data);
-
- GConfValue * value = gconf_entry_get_value(entry);
- if(!value) {
- return;
- }
-
- if(gconf_value_get_bool(value)) {
- self->m_keypress_cid = self->signal_key_press_event().connect(
- sigc::mem_fun(*self, &NoteWindow::on_key_pressed));
- }
- else {
- self->m_keypress_cid.disconnect();
- }
- }
bool NoteWindow::on_key_pressed(GdkEventKey *ev)
{
if(ev->keyval == GDK_Escape) {
- close_window_handler();
+ if (m_find_bar && m_find_bar->is_visible()) {
+ m_find_bar->hide();
+ }
+ else if (Preferences::obj().get<bool>(
+ Preferences::ENABLE_CLOSE_NOTE_ON_ESCAPE)) {
+ close_window_handler();
+ }
return true;
}
return false;
diff --git a/src/notewindow.hpp b/src/notewindow.hpp
index 71e0fac..0c8c89f 100644
--- a/src/notewindow.hpp
+++ b/src/notewindow.hpp
@@ -129,7 +129,6 @@ protected:
virtual bool on_delete_event(GdkEventAny *ev);
virtual void on_hide();
private:
- static void on_escape_setting_changed(GConfClient *, guint cnxid, GConfEntry* entry, gpointer data);
bool on_key_pressed(GdkEventKey*);
void close_window_handler();
void close_all_windows_handler();
@@ -166,7 +165,6 @@ private:
utils::GlobalKeybinder *m_global_keys;
utils::InterruptableTimeout *m_mark_set_timeout;
- sigc::connection m_keypress_cid;
guint m_gconf_notify;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]