[gnote] Use only icons of certain size in tray
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Use only icons of certain size in tray
- Date: Wed, 15 Dec 2010 19:02:48 +0000 (UTC)
commit 4e180a7a1ec283b81e5ed7eee3a59919d9e7b4c2
Author: Aurimas Ä?ernius <aurisc4 gmail com>
Date: Wed Dec 15 21:01:19 2010 +0200
Use only icons of certain size in tray
Use icon of size 22, 24, 32 and 48 pixels depending of panel size.
Fixes bug 594932.
src/tray.cpp | 20 +++++++++++++++++---
src/tray.hpp | 2 ++
2 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/src/tray.cpp b/src/tray.cpp
index 65a1d3e..c6e8ff1 100644
--- a/src/tray.cpp
+++ b/src/tray.cpp
@@ -397,9 +397,6 @@ namespace gnote {
, m_keybinder(new GnotePrefsKeybinder(manager, *this))
, m_context_menu(NULL)
{
- int panel_size = 32;
- Glib::RefPtr<Gdk::Pixbuf> pixbuf = utils::get_icon("gnote", panel_size);
- set(pixbuf);
#if GTK_VERSION_GE(2,16)
gtk_status_icon_set_tooltip_text(gobj(),
tray_util_get_tooltip_text().c_str());
@@ -533,6 +530,23 @@ namespace gnote {
return open_upwards;
}
+ bool TrayIcon::on_size_changed(int size)
+ {
+ if(size < 24) {
+ size = 22;
+ }
+ else if(size < 32) {
+ size = 24;
+ }
+ else if(size < 48) {
+ size = 32;
+ }
+ else size = 48;
+ Glib::RefPtr<Gdk::Pixbuf> pixbuf = utils::get_icon("gnote", size);
+ set(pixbuf);
+ return Gtk::StatusIcon::on_size_changed(size);
+ }
+
//
// This is a helper to take the XKeybinding string from GConf, and
// convert it to a widget accelerator label, so note menu items can
diff --git a/src/tray.hpp b/src/tray.hpp
index 67227f5..f0c8b82 100644
--- a/src/tray.hpp
+++ b/src/tray.hpp
@@ -116,6 +116,8 @@ public:
void show_help_contents();
void show_about();
void quit();
+protected:
+ virtual bool on_size_changed(int size);
private:
Tray::Ptr m_tray;
PrefsKeybinder *m_keybinder;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]