[gnote/gnome-3-6] Fix status icon for Xfce 4
- From: Aurimas Äernius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote/gnome-3-6] Fix status icon for Xfce 4
- Date: Sun, 30 Dec 2012 18:33:40 +0000 (UTC)
commit 89955283907764d6913e7e74cdbf3d78cc33d1a4
Author: Aurimas Äernius <aurisc4 gmail com>
Date: Sun Dec 30 20:20:35 2012 +0200
Fix status icon for Xfce 4
Make status icon appear on Xfce 4.
Fixes bug 666775.
src/gnote.cpp | 30 ++++++++++++++++++++++--------
src/gnote.hpp | 1 +
2 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/src/gnote.cpp b/src/gnote.cpp
index 00e5f44..e81cb63 100644
--- a/src/gnote.cpp
+++ b/src/gnote.cpp
@@ -234,14 +234,30 @@ namespace gnote {
return note_path;
}
+ bool Gnote::show_tray_icon_timeout()
+ {
+ // Setting to false and back to true is required to make it work on some tray implementations
+ m_tray_icon->set_visible(false);
+ m_tray_icon->set_visible(true);
+ return false;
+ }
+
void Gnote::start_tray_icon()
{
// Create Search All Notes window as we need it present for application to run
NoteRecentChanges::get_instance(default_note_manager());
- // Create the tray icon and run the main loop
- m_tray_icon = Glib::RefPtr<TrayIcon>(new TrayIcon(default_note_manager()));
- m_tray = m_tray_icon->tray();
+ if(!m_tray_icon) {
+ // Create the tray icon and run the main loop
+ m_tray_icon = Glib::RefPtr<TrayIcon>(new TrayIcon(default_note_manager()));
+ m_tray = m_tray_icon->tray();
+ }
+
+ // Tome make status icon visible on some implementations, it should be made visible
+ // after some timeout.
+ Glib::RefPtr<Glib::TimeoutSource> timeout = Glib::TimeoutSource::create(100);
+ timeout->connect(sigc::mem_fun(*this, &Gnote::show_tray_icon_timeout));
+ timeout->attach();
}
@@ -268,14 +284,12 @@ namespace gnote {
bool use_status_icon = Preferences::obj()
.get_schema_settings(Preferences::SCHEMA_GNOTE)->get_boolean(key);
if(use_status_icon) {
- if(!m_tray_icon) {
- m_tray_icon = Glib::RefPtr<TrayIcon>(new TrayIcon(default_note_manager()));
- }
- m_tray_icon->set_visible(true);
+ start_tray_icon();
}
else {
- if(m_tray_icon)
+ if(m_tray_icon) {
m_tray_icon->set_visible(false);
+ }
ActionManager::obj()["ShowSearchAllNotesAction"]->activate();
}
}
diff --git a/src/gnote.hpp b/src/gnote.hpp
index d982525..8462faa 100644
--- a/src/gnote.hpp
+++ b/src/gnote.hpp
@@ -177,6 +177,7 @@ private:
void common_init();
void end_main(bool bus_aquired, bool name_acquired);
void on_sync_dialog_response(int response_id);
+ bool show_tray_icon_timeout();
NoteManager *m_manager;
IKeybinder *m_keybinder;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]