[gnote] Use actual visibility of status icon
- From: Aurimas Äernius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Use actual visibility of status icon
- Date: Mon, 27 Jun 2011 20:41:11 +0000 (UTC)
commit ad3c3f4f9dc36c3b8bf15c96656bacde13aa3a6c
Author: Aurimas Äernius <aurisc4 gmail com>
Date: Mon Jun 27 23:30:40 2011 +0300
Use actual visibility of status icon
When checking for status icon visibility, use actual state
instead of the value, recorded during startup.
Fixes bug 650001.
src/gnote.cpp | 11 ++++-------
src/gnote.hpp | 6 +++---
src/recentchanges.cpp | 4 ++--
3 files changed, 9 insertions(+), 12 deletions(-)
---
diff --git a/src/gnote.cpp b/src/gnote.cpp
index 0bb128b..3b951fa 100644
--- a/src/gnote.cpp
+++ b/src/gnote.cpp
@@ -64,8 +64,6 @@
namespace gnote {
- bool Gnote::s_tray_icon_showing = false;
-
Gnote::Gnote()
: m_manager(NULL)
, m_keybinder(NULL)
@@ -123,7 +121,6 @@ namespace gnote {
if(m_is_panel_applet) {
DBG_OUT("starting applet");
- s_tray_icon_showing = true;
am["CloseWindowAction"]->set_visible(true);
am["QuitGNoteAction"]->set_visible(false);
@@ -179,10 +176,10 @@ namespace gnote {
// Give the TrayIcon 2 seconds to appear. If it
// doesn't by then, open the SearchAllNotes window.
- s_tray_icon_showing = m_tray_icon->is_embedded()
+ bool is_tray_icon_showing = m_tray_icon->is_embedded()
&& m_tray_icon->get_visible();
- if (!s_tray_icon_showing) {
+ if (!is_tray_icon_showing) {
Glib::RefPtr<Glib::TimeoutSource> timeout
= Glib::TimeoutSource::create(2000);
timeout->connect(sigc::mem_fun(*this, &Gnote::check_tray_icon_showing));
@@ -195,9 +192,9 @@ namespace gnote {
bool Gnote::check_tray_icon_showing()
{
- s_tray_icon_showing = m_tray_icon->is_embedded()
+ bool is_tray_icon_showing = m_tray_icon->is_embedded()
&& m_tray_icon->get_visible();
- if(!s_tray_icon_showing) {
+ if(!is_tray_icon_showing) {
ActionManager & am(ActionManager::obj());
am["ShowSearchAllNotesAction"]->activate();
}
diff --git a/src/gnote.hpp b/src/gnote.hpp
index 9227cbf..d111bec 100644
--- a/src/gnote.hpp
+++ b/src/gnote.hpp
@@ -76,9 +76,10 @@ public:
static std::string data_dir();
static std::string old_note_dir();
- static bool tray_icon_showing()
+ bool tray_icon_showing()
{
- return s_tray_icon_showing;
+ return m_is_panel_applet
+ || (m_tray_icon && m_tray_icon->is_embedded() && m_tray_icon->get_visible());
}
bool is_panel_applet()
{
@@ -97,7 +98,6 @@ private:
NoteManager *m_manager;
IKeybinder *m_keybinder;
Glib::RefPtr<Gtk::IconTheme> m_icon_theme;
- static bool s_tray_icon_showing;
Glib::RefPtr<TrayIcon> m_tray_icon;
Tray::Ptr m_tray;
bool m_is_panel_applet;
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index 66e6ff9..be910ca 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -241,7 +241,7 @@ namespace gnote {
// end notebook addin
am ["CloseWindowAction"]->signal_activate()
.connect(sigc::mem_fun(*this, &NoteRecentChanges::on_close_window));
- if (Gnote::tray_icon_showing() == false)
+ if (Gnote::obj().tray_icon_showing() == false)
am ["CloseWindowAction"]->set_visible(false);
// Allow Escape to close the window as well as <Control>W
@@ -1089,7 +1089,7 @@ namespace gnote {
hide ();
delete s_instance;
s_instance = NULL;
- if (Gnote::tray_icon_showing() == false) {
+ if (Gnote::obj().tray_icon_showing() == false) {
ActionManager::obj()["QuitGNoteAction"]->activate();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]