diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-11-10 02:16:49 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-11-10 02:16:49 +0000 |
commit | a777361f0e24dbf226d309babdd93a968b9f8148 (patch) | |
tree | 572ed2d1c3078d2ca8f95fd1dda6e3c8669f8fb0 /src | |
parent | 476168eeba6a0574f96afa1655d9b344b803da14 (diff) |
implemented trayicon notification with eggtrayicon.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1288 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r-- | src/eggtrayicon.c | 6 | ||||
-rw-r--r-- | src/eggtrayicon.h | 5 | ||||
-rw-r--r-- | src/trayicon.c | 23 |
3 files changed, 18 insertions, 16 deletions
diff --git a/src/eggtrayicon.c b/src/eggtrayicon.c index b1c93e3d..d913736d 100644 --- a/src/eggtrayicon.c +++ b/src/eggtrayicon.c @@ -20,12 +20,12 @@ /* Added WINDOWING ifdef 2005-07-09 by Yoichi Imai <yoichi@silver-forest.com> */ #include <config.h> -#include <string.h> -#include <libintl.h> #include "eggtrayicon.h" -#ifdef GDK_WINDOWING_X11 +#if !GTK_CHECK_VERSION(2, 10, 0) && defined(GDK_WINDOWING_X11) +#include <string.h> +#include <libintl.h> #include <gdk/gdkx.h> #include <X11/Xatom.h> diff --git a/src/eggtrayicon.h b/src/eggtrayicon.h index 7bbfe8bf..c0abfc0a 100644 --- a/src/eggtrayicon.h +++ b/src/eggtrayicon.h @@ -21,10 +21,11 @@ #ifndef __EGG_TRAY_ICON_H__ #define __EGG_TRAY_ICON_H__ -#include <gtk/gtkplug.h> +#include <gdkconfig.h> #include <gtk/gtkversion.h> -#ifdef GDK_WINDOWING_X11 +#if !GTK_CHECK_VERSION(2, 10, 0) && defined(GDK_WINDOWING_X11) +#include <gtk/gtkplug.h> #include <gdk/gdkx.h> G_BEGIN_DECLS diff --git a/src/trayicon.c b/src/trayicon.c index 677c4f29..51d9f47c 100644 --- a/src/trayicon.c +++ b/src/trayicon.c @@ -213,12 +213,10 @@ void trayicon_set_notify(gboolean enabled) GdkPixbuf *pixbuf; if (enabled && !on_notify) { - stock_pixbuf_gdk(NULL, TRAYICON_NEW_IMAGE, &pixbuf); - gtk_status_icon_set_from_pixbuf(trayicon.status_icon, pixbuf); + trayicon_set_stock_icon(TRAYICON_NEW_IMAGE); on_notify = TRUE; } else if (!enabled && on_notify) { - stock_pixbuf_gdk(NULL, TRAYICON_IMAGE, &pixbuf); - gtk_status_icon_set_from_pixbuf(trayicon.status_icon, pixbuf); + trayicon_set_stock_icon(TRAYICON_IMAGE); on_notify = FALSE; } @@ -234,13 +232,9 @@ void trayicon_set_notify(gboolean enabled) void trayicon_set_stock_icon(StockPixmap icon) { GdkPixbuf *pixbuf; - GdkPixbuf *scaled_pixbuf; stock_pixbuf_gdk(NULL, icon, &pixbuf); - scaled_pixbuf = gdk_pixbuf_scale_simple(pixbuf, 24, 24, - GDK_INTERP_HYPER); - gtk_status_icon_set_from_pixbuf(trayicon.status_icon, scaled_pixbuf); - g_object_unref(scaled_pixbuf); + gtk_status_icon_set_from_pixbuf(trayicon.status_icon, pixbuf); } static void trayicon_activated(GtkStatusIcon *status_icon, gpointer data) @@ -257,7 +251,7 @@ static void trayicon_popup_menu_cb(GtkStatusIcon *status_icon, guint button, button, activate_time); } -#else +#else /* GTK_CHECK_VERSION(2, 10, 0) */ void trayicon_show(TrayIcon *tray_icon) { @@ -294,6 +288,13 @@ void trayicon_set_tooltip(const gchar *text) void trayicon_set_notify(gboolean enabled) { + if (enabled && !on_notify) { + trayicon_set_stock_icon(TRAYICON_NEW_IMAGE); + on_notify = TRUE; + } else if (!enabled && on_notify) { + trayicon_set_stock_icon(TRAYICON_IMAGE); + on_notify = FALSE; + } } void trayicon_set_stock_icon(StockPixmap icon) @@ -337,7 +338,7 @@ static void trayicon_destroy_cb(GtkWidget *widget, gpointer data) g_idle_add(trayicon_restore, data); } -#endif +#endif /* GTK_CHECK_VERSION(2, 10, 0) */ static void trayicon_present(GtkWidget *widget, gpointer data) { |