? .bzr
? .bzrignore
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/rhythmbox/ChangeLog,v
retrieving revision 1.2254
diff -u -r1.2254 ChangeLog
--- ChangeLog	11 Aug 2006 10:04:17 -0000	1.2254
+++ ChangeLog	12 Aug 2006 19:21:12 -0000
@@ -1,3 +1,26 @@
+2006-08-12  Jan Arne Petersen  <jpetersen@jpetersen.org>
+
+	Migration from EggTrayIcon to GtkStatusIcon. EggTrayIcon is still used
+	for GTK+ < 2.10.0.
+
+	* configure.ac: Add HAVE_GTK_STATUS_ICON (GTK+ >= 2.10.0) check.
+
+	* widgets/Makefile.am: Usage of EggTrayIcon depends on
+	HAVE_GTK_STATUS_ICON.
+
+	* shell/rb-shell.c: (rb_shell_shutdown), (rb_shell_finalize),
+	(rb_shell_constructor), (set_icon_geometry),
+	(rb_shell_set_visibility), (rb_shell_hidden_notify):
+	* shell/rb-tray-icon.c: (rb_tray_icon_init),
+	(rb_tray_icon_finalize), (rb_tray_icon_new),
+	(rb_tray_icon_set_visible), (rb_tray_icon_set_tooltip),
+	(rb_tray_icon_is_embedded), (rb_tray_icon_get_geometry),
+	(rb_tray_icon_activate_cb), (rb_tray_icon_popup_menu_cb),
+	(rb_tray_icon_button_press_event_cb), (rb_tray_icon_notify):
+	* shell/rb-tray-icon.h: Move all tray icon related functions to
+	RBTrayIcon. Transform RBTrayIcon into a GObject and add
+	implementations for EggTrayIcon and GtkStatusIcon.
+
 2006-08-11  Jonathan Matthew  <jonathan@kaolin.wh9.net>
 
 	* lib/rb-debug.c: (rb_debug_real):
Index: configure.ac
===================================================================
RCS file: /cvs/gnome/rhythmbox/configure.ac,v
retrieving revision 1.255
diff -u -r1.255 configure.ac
--- configure.ac	11 Aug 2006 05:32:53 -0000	1.255
+++ configure.ac	12 Aug 2006 19:21:14 -0000
@@ -69,6 +69,16 @@
    AC_MSG_ERROR([totem playlist parsing library not found or too old])
 fi   
 
+dnl Check for GtkStatusIcon
+LIBNOTIFY_REQUIRED=0.2.2
+PKG_CHECK_MODULES(GTK_STATUS_ICON, gtk+-2.0 >= 2.10.0, 
+		  [HAVE_GTK_STATUS_ICON=yes], [HAVE_GTK_STATUS_ICON=no])
+if test x$HAVE_GTK_STATUS_ICON = xyes; then
+   AC_DEFINE(HAVE_GTK_STATUS_ICON, 1, [defined if GtkRecent is available])
+   LIBNOTIFY_REQUIRED=0.4.2
+fi
+AM_CONDITIONAL(HAVE_GTK_STATUS_ICON, test x$HAVE_GTK_STATUS_ICON = "xyes")
+
 AC_ARG_WITH(hal,
 	      AC_HELP_STRING([--without-hal],
 			     [Disable HAL support]))
@@ -397,7 +407,6 @@
 AM_CONDITIONAL(USE_HOWL, test "x$use_howl" = "xyes")
 AM_CONDITIONAL(USE_AVAHI, test "x$use_avahi" = "xyes")
 
-LIBNOTIFY_REQUIRED=0.2.2
 AC_ARG_ENABLE(libnotify,
             AC_HELP_STRING([--disable-libnotify],
 			   [Disable libnotify support]),,
Index: shell/rb-shell.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-shell.c,v
retrieving revision 1.470
diff -u -r1.470 rb-shell.c
--- shell/rb-shell.c	10 Aug 2006 05:35:08 -0000	1.470
+++ shell/rb-shell.c	12 Aug 2006 19:21:22 -0000
@@ -231,7 +231,6 @@
 static gboolean rb_shell_show_popup_cb (RBSourceList *sourcelist,
 					RBSource *target,
 					RBShell *shell);
-static gboolean tray_destroy_cb (GtkObject *object, RBShell *shell);
 
 static gboolean save_yourself_cb (GnomeClient *client,
                                   gint phase,
@@ -865,7 +864,7 @@
 	/* Hide the main window and tray icon as soon as possible */
 	display = gtk_widget_get_display (shell->priv->window);
 	gtk_widget_hide (shell->priv->window);
-	gtk_widget_hide (GTK_WIDGET (shell->priv->tray_icon));
+	rb_tray_icon_set_visible (shell->priv->tray_icon, FALSE);
 	gdk_display_sync (display);
 }
 
@@ -886,7 +885,7 @@
 
 	g_list_free (shell->priv->supported_media_extensions);
 
-	gtk_widget_destroy (GTK_WIDGET (shell->priv->tray_icon));
+	g_object_unref (G_OBJECT (shell->priv->tray_icon));
 
 	if (shell->priv->save_playlist_id > 0) {
 		g_source_remove (shell->priv->save_playlist_id);
@@ -1318,7 +1317,8 @@
 	construct_widgets (shell);
 
 	rb_debug ("shell: setting up tray icon");
-	tray_destroy_cb (NULL, shell);
+	shell->priv->tray_icon = rb_tray_icon_new (shell->priv->ui_manager, shell);
+ 	rb_tray_icon_set_visible (shell->priv->tray_icon, TRUE);
 
 	rb_debug ("shell: adding gconf notification");
 	/* sync state */
@@ -1382,7 +1382,7 @@
 
 	rb_debug ("shell: syncing window state");
 	rb_shell_sync_paned (shell);
-	gtk_widget_show_all (GTK_WIDGET (shell->priv->tray_icon));
+	rb_tray_icon_set_visible (shell->priv->tray_icon, TRUE);
 
 	/* Stop here if this is the first time. */
 	if (!eel_gconf_get_boolean (CONF_FIRST_TIME)) {
@@ -1420,18 +1420,15 @@
 /* Based on a function found in wnck */
 static void
 set_icon_geometry  (GdkWindow *window,
-		    int        x,
-		    int        y,
-		    int        width,
-		    int        height)
+		    GdkRectangle *area)
 {
 	gulong data[4];
 	Display *dpy = gdk_x11_drawable_get_xdisplay (window);
 
-	data[0] = x;
-	data[1] = y;
-	data[2] = width;
-	data[3] = height;
+	data[0] = area->x;
+	data[1] = area->y;
+	data[2] = area->width;
+	data[3] = area->height;
 
 	XChangeProperty (dpy,
 			 GDK_WINDOW_XID (window),
@@ -1530,11 +1527,11 @@
 	shell->priv->idle_hide_mainwindow_id = 0;
 
 	/* don't minimise if we have no tray icon */
-	if (visible || (!force && !egg_tray_icon_have_manager (EGG_TRAY_ICON (shell->priv->tray_icon)))) {
+	if (visible || (!force && !rb_tray_icon_is_embedded (shell->priv->tray_icon))) {
 		rb_debug ("showing main window");
 		rb_shell_sync_window_state (shell, FALSE);
 
-		if (egg_tray_icon_have_manager (EGG_TRAY_ICON (shell->priv->tray_icon)))
+		if (rb_tray_icon_is_embedded (shell->priv->tray_icon))
 			gtk_window_set_skip_taskbar_hint (GTK_WINDOW (shell->priv->window), FALSE);
 		gtk_widget_show (GTK_WIDGET (shell->priv->window));
 		gtk_window_deiconify (GTK_WINDOW (shell->priv->window));
@@ -1548,16 +1545,14 @@
 
 		eel_gconf_set_boolean (CONF_STATE_WINDOW_VISIBLE, TRUE);
 	} else {
-		int x, y, width, height;
+		GdkRectangle area;
 
 		rb_debug ("hiding main window");
 		shell->priv->iconified = TRUE;
-		rb_tray_icon_get_geom (shell->priv->tray_icon,
-				       &x, &y, &width, &height);
+		rb_tray_icon_get_geometry (shell->priv->tray_icon, NULL, &area, NULL);
 		if (GTK_WIDGET_REALIZED (GTK_WIDGET (shell->priv->window)))
-			set_icon_geometry (GTK_WIDGET (shell->priv->window)->window,
-					   x, y, width, height);
-		if (egg_tray_icon_have_manager (EGG_TRAY_ICON (shell->priv->tray_icon)))
+			set_icon_geometry (GTK_WIDGET (shell->priv->window)->window, &area);
+		if (rb_tray_icon_is_embedded (shell->priv->tray_icon))
 			gtk_window_set_skip_taskbar_hint (GTK_WINDOW (shell->priv->window), TRUE);
 		gtk_window_iconify (GTK_WINDOW (shell->priv->window));
 
@@ -2815,45 +2810,6 @@
 	return rb_source_show_popup (target);
 }
 
-static void
-tray_embedded_cb (GtkPlug *plug,
-		  gpointer data)
-{
-	/* FIXME - this doens't work */
-#if 0
-	RBShell *shell = RB_SHELL (data);
-
-	rb_debug ("got embedded signal");
-
-	gdk_window_set_decorations (shell->priv->window->window,
-				    GDK_DECOR_ALL | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE);
-#endif
-}
-
-static gboolean
-tray_destroy_cb (GtkObject *object,
-		 RBShell *shell)
-{
-	if (shell->priv->tray_icon) {
-		rb_debug ("caught destroy event for tray icon %p", object);
-		gtk_object_sink (object);
-		shell->priv->tray_icon = NULL;
-		rb_debug ("finished sinking tray");
-	}
-
-	rb_debug ("creating new tray icon");
-	shell->priv->tray_icon = rb_tray_icon_new (shell->priv->ui_manager, shell);
-	g_signal_connect_object (G_OBJECT (shell->priv->tray_icon), "destroy",
-				 G_CALLBACK (tray_destroy_cb), shell, 0);
-	g_signal_connect_object (G_OBJECT (shell->priv->tray_icon), "embedded",
-				 G_CALLBACK (tray_embedded_cb), shell, 0);
-
- 	gtk_widget_show_all (GTK_WIDGET (shell->priv->tray_icon));
-
-	rb_debug ("done creating new tray icon %p", shell->priv->tray_icon);
- 	return TRUE;
-}
-
 void
 rb_shell_hidden_notify (RBShell *shell,
 			guint timeout,
@@ -2868,8 +2824,7 @@
 	}
 
 	rb_tray_icon_notify (shell->priv->tray_icon,
-			     timeout, primary,
-			     icon, secondary);
+			     timeout, primary, secondary);
 }
 
 static void
Index: shell/rb-tray-icon.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-tray-icon.c,v
retrieving revision 1.34
diff -u -r1.34 rb-tray-icon.c
--- shell/rb-tray-icon.c	17 Jul 2006 14:52:29 -0000	1.34
+++ shell/rb-tray-icon.c	12 Aug 2006 19:21:23 -0000
@@ -39,6 +39,15 @@
 #include "rb-shell.h"
 #include "rb-shell-player.h"
 
+#ifdef HAVE_GTK_STATUS_ICON
+#include <gtk/gtkstatusicon.h>
+#ifdef HAVE_NOTIFY
+#include <libnotify/notify.h>
+#endif
+#else
+#include "eggtrayicon.h"
+#endif
+
 static void rb_tray_icon_class_init (RBTrayIconClass *klass);
 static void rb_tray_icon_init (RBTrayIcon *shell_player);
 static GObject *rb_tray_icon_constructor (GType type, guint n_construct_properties,
@@ -55,35 +64,41 @@
 					  guint prop_id,
 					  GValue *value,
 					  GParamSpec *pspec);
+#ifdef HAVE_GTK_STATUS_ICON
+static void rb_tray_icon_activate_cb (GtkStatusIcon *status_icon, RBTrayIcon *icon);
+static void rb_tray_icon_popup_menu_cb (GtkStatusIcon *status_icon, guint button,
+					guint activate_time, RBTrayIcon *icon);
+#else
 static void rb_tray_icon_button_press_event_cb (GtkWidget *ebox, GdkEventButton *event,
-						RBTrayIcon *icon);
-static void rb_tray_icon_scroll_event_cb (GtkWidget *ebox, GdkEvent *event,
-						RBTrayIcon *icon);
+                                                RBTrayIcon *icon);
+#endif
 static void rb_tray_icon_show_window_changed_cb (GtkAction *action,
 						 RBTrayIcon *icon);
 static void rb_tray_icon_show_notifications_changed_cb (GtkAction *action,
 							RBTrayIcon *icon);
-static void rb_tray_icon_drop_cb (GtkWidget *widget,
-				  GdkDragContext *context,
-				  gint x,
-				  gint y,
-				  GtkSelectionData *data,
-				  guint info,
-				  guint time,
-				  RBTrayIcon *icon);
 
 struct RBTrayIconPrivate
 {
+#ifdef HAVE_GTK_STATUS_ICON
+	GtkStatusIcon *status_icon;
+#else
+	EggTrayIcon *tray_icon;
+
 	GtkTooltips *tooltips;
-	GtkUIManager *ui_manager;
-	GtkActionGroup *actiongroup;
 
 	GtkWidget *ebox;
+#endif
+
+	GtkUIManager *ui_manager;
+	GtkActionGroup *actiongroup;
 
 	RBShell *shell;
 	RBShellPlayer *shell_player;
 
 	gboolean show_notifications;
+#ifdef HAVE_NOTIFY
+	NotifyNotification *notification;
+#endif
 };
 
 #define RB_TRAY_ICON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RB_TYPE_TRAY_ICON, RBTrayIconPrivate))
@@ -112,9 +127,7 @@
 };
 static guint rb_tray_icon_n_toggle_entries = G_N_ELEMENTS (rb_tray_icon_toggle_entries);
 
-static const GtkTargetEntry target_uri [] = {{ "text/uri-list", 0, 0 }};
-
-G_DEFINE_TYPE (RBTrayIcon, rb_tray_icon, EGG_TYPE_TRAY_ICON)
+G_DEFINE_TYPE (RBTrayIcon, rb_tray_icon, G_TYPE_OBJECT)
 
 static void
 rb_tray_icon_class_init (RBTrayIconClass *klass)
@@ -155,36 +168,46 @@
 static void
 rb_tray_icon_init (RBTrayIcon *icon)
 {
+#ifndef HAVE_GTK_STATUS_ICON
 	GtkWidget *image;
+#endif
 
 	rb_debug ("setting up tray icon");
 
 	icon->priv = RB_TRAY_ICON_GET_PRIVATE (icon);
 
-	icon->priv->tooltips = gtk_tooltips_new ();
+#ifdef HAVE_GTK_STATUS_ICON
+	icon->priv->status_icon = gtk_status_icon_new_from_stock (RB_STOCK_TRAY_ICON);
 
-	gtk_tooltips_set_tip (icon->priv->tooltips, GTK_WIDGET (icon),
-			      _("Not playing"), NULL);
+	g_signal_connect_object (G_OBJECT (icon->priv->status_icon),
+				 "activate",
+				 G_CALLBACK (rb_tray_icon_activate_cb),
+				 icon, 0);
+	g_signal_connect_object (G_OBJECT (icon->priv->status_icon),
+				 "popup-menu",
+				 G_CALLBACK (rb_tray_icon_popup_menu_cb),
+				 icon, 0);
+#else
+	icon->priv->tray_icon = egg_tray_icon_new ("Rhythmbox tray icon");
+
+	icon->priv->tooltips = gtk_tooltips_new ();
 
 	icon->priv->ebox = gtk_event_box_new ();
+
 	g_signal_connect_object (G_OBJECT (icon->priv->ebox),
-				 "button_press_event",
+				 "button-press-event",
 				 G_CALLBACK (rb_tray_icon_button_press_event_cb),
 				 icon, 0);
-	g_signal_connect_object (G_OBJECT (icon->priv->ebox),
-				 "scroll_event",
-				 G_CALLBACK (rb_tray_icon_scroll_event_cb),
-				 icon, 0);
-	gtk_drag_dest_set (icon->priv->ebox, GTK_DEST_DEFAULT_ALL, target_uri, 1, GDK_ACTION_COPY);
-	g_signal_connect_object (G_OBJECT (icon->priv->ebox), "drag_data_received",
-				 G_CALLBACK (rb_tray_icon_drop_cb), icon, 0);
 
 	image = gtk_image_new_from_stock (RB_STOCK_TRAY_ICON,
 					  GTK_ICON_SIZE_SMALL_TOOLBAR);
 	gtk_container_add (GTK_CONTAINER (icon->priv->ebox), image);
 
-	gtk_container_add (GTK_CONTAINER (icon), icon->priv->ebox);
+	gtk_container_add (GTK_CONTAINER (icon->priv->tray_icon), icon->priv->ebox);
 	gtk_widget_show_all (GTK_WIDGET (icon->priv->ebox));
+#endif
+
+	rb_tray_icon_set_tooltip (icon, _("Not playing"));
 }
 
 static GObject *
@@ -239,7 +262,18 @@
 		g_object_unref (tray->priv->shell_player);
 	}
 
+#ifdef HAVE_GTK_STATUS_ICON
+	g_object_unref (tray->priv->status_icon);
+
+	if (tray->priv->notification != NULL) {
+		notify_notification_close (tray->priv->notification, NULL);
+		g_object_unref (tray->priv->notification);
+	}
+#else
+	gtk_widget_destroy (GTK_WIDGET (tray->priv->tray_icon));
+
 	gtk_object_destroy (GTK_OBJECT (tray->priv->tooltips));
+#endif
 
 	G_OBJECT_CLASS (rb_tray_icon_parent_class)->finalize (object);
 }
@@ -328,12 +362,108 @@
 		  RBShell *shell)
 {
 	return g_object_new (RB_TYPE_TRAY_ICON,
-			     "title", "Rhythmbox tray icon",
 			     "ui-manager", mgr,
 			     "shell", shell,
 			     NULL);
 }
 
+
+void
+rb_tray_icon_set_visible (RBTrayIcon *icon, gboolean visible)
+{
+#ifdef HAVE_GTK_STATUS_ICON
+	gtk_status_icon_set_visible (icon->priv->status_icon, visible);
+#else
+	if (visible) {
+		gtk_widget_show_all (GTK_WIDGET (icon->priv->tray_icon));
+	} else {
+		gtk_widget_hide (GTK_WIDGET (icon->priv->tray_icon));
+	}
+#endif
+}
+
+void
+rb_tray_icon_set_tooltip (RBTrayIcon *icon, const char *tooltip_text)
+{
+#ifdef HAVE_GTK_STATUS_ICON
+	gtk_status_icon_set_tooltip (icon->priv->status_icon, tooltip_text);
+#else
+	gtk_tooltips_set_tip (icon->priv->tooltips,
+			      GTK_WIDGET (icon->priv->tray_icon),
+			      tooltip_text, NULL);
+#endif
+}
+
+gboolean
+rb_tray_icon_is_embedded (RBTrayIcon *icon)
+{
+#ifdef HAVE_GTK_STATUS_ICON
+	return gtk_status_icon_is_embedded (icon->priv->status_icon);
+#else
+	return egg_tray_icon_have_manager (icon->priv->tray_icon);
+#endif
+}
+
+gboolean
+rb_tray_icon_get_geometry (RBTrayIcon *icon,
+			   GdkScreen **screen,
+			   GdkRectangle *area,
+			   GtkOrientation *orientation)
+{
+#ifdef HAVE_GTK_STATUS_ICON
+	return gtk_status_icon_get_geometry (icon->priv->status_icon,
+					     screen, area, orientation);
+#else
+	if (screen != NULL) {
+		*screen =  gtk_widget_get_screen (GTK_WIDGET (icon->priv->tray_icon));
+	}
+
+	if (area != NULL) {
+		GtkWidget *widget;
+		GtkRequisition requisition;
+
+		widget = GTK_WIDGET (icon->priv->ebox);
+
+		gtk_widget_size_request (widget, &requisition);
+
+		gdk_window_get_origin (widget->window, &(area->x), &(area->y));
+
+		area->width = widget->allocation.x;
+		area->height = widget->allocation.y;
+	}
+
+	if (orientation != NULL) {
+		*orientation = egg_tray_icon_get_orientation (icon->priv->tray_icon);
+	}
+
+	return TRUE;
+#endif
+}
+
+#ifdef HAVE_GTK_STATUS_ICON
+static void
+rb_tray_icon_activate_cb (GtkStatusIcon *status_icon, RBTrayIcon *icon)
+{
+	rb_debug ("tray activate");
+
+	rb_shell_toggle_visibility (icon->priv->shell);
+}
+
+static void
+rb_tray_icon_popup_menu_cb (GtkStatusIcon *status_icon, guint button,
+			    guint activate_time, RBTrayIcon *icon)
+{
+	GtkWidget *popup;
+
+	rb_debug ("tray popup menu");
+
+	popup = gtk_ui_manager_get_widget (GTK_UI_MANAGER (icon->priv->ui_manager),
+			"/RhythmboxTrayPopup");
+	gtk_menu_popup (GTK_MENU (popup), NULL, NULL,
+			gtk_status_icon_position_menu, icon->priv->status_icon, button,
+			activate_time);
+}
+#else
 static void
 tray_popup_position_menu (GtkMenu *menu,
 			  int *x,
@@ -381,92 +511,17 @@
 	case 1:
 		rb_shell_toggle_visibility (icon->priv->shell);
 		break;
-	case 2:
-		rb_shell_player_playpause (icon->priv->shell_player, FALSE, NULL);
-		break;
 	case 3:
 		popup = gtk_ui_manager_get_widget (GTK_UI_MANAGER (icon->priv->ui_manager),
 						   "/RhythmboxTrayPopup");
-		gtk_menu_set_screen (GTK_MENU (popup), gtk_widget_get_screen (GTK_WIDGET (icon)));
+		gtk_menu_set_screen (GTK_MENU (popup), gtk_widget_get_screen (GTK_WIDGET (icon->priv->tray_icon)));
 		gtk_menu_popup (GTK_MENU (popup), NULL, NULL,
 				tray_popup_position_menu, ebox, 2,
 				gtk_get_current_event_time ());
 		break;
 	}
 }
-
-static void
-rb_tray_icon_scroll_event_cb (GtkWidget *ebox, GdkEvent *event,
-				    RBTrayIcon *icon)
-{
-	gdouble adjust;
-
-	switch (event->scroll.direction) {
-	case GDK_SCROLL_UP:
-		adjust = 0.1;
-		break;
-	case GDK_SCROLL_DOWN:
-		adjust = -0.1;
-		break;
-	default:
-		return;
-	}
-
-	rb_shell_player_set_volume_relative (icon->priv->shell_player, adjust, NULL);
-}
-
-static void
-rb_tray_icon_drop_cb (GtkWidget *widget,
-		      GdkDragContext *context,
-		      gint x,
-		      gint y,
-		      GtkSelectionData *data,
-		      guint info,
-		      guint time,
-		      RBTrayIcon *icon)
-{
-	GList *list, *uri_list, *i;
-	GtkTargetList *tlist;
-	gboolean ret;
-
-	tlist = gtk_target_list_new (target_uri, 1);
-	ret = (gtk_drag_dest_find_target (widget, context, tlist) != GDK_NONE);
-	gtk_target_list_unref (tlist);
-
-	if (ret == FALSE)
-		return;
-
-	list = gnome_vfs_uri_list_parse ((char *) data->data);
-
-	if (list == NULL) {
-		gtk_drag_finish (context, FALSE, FALSE, time);
-		return;
-	}
-
-	uri_list = NULL;
-
-	for (i = list; i != NULL; i = g_list_next (i))
-		uri_list = g_list_prepend (uri_list, gnome_vfs_uri_to_string ((const GnomeVFSURI *) i->data, 0));
-
-	gnome_vfs_uri_list_free (list);
-
-	if (uri_list == NULL) {
-		gtk_drag_finish (context, FALSE, FALSE, time);
-		return;
-	}
-
-	for (i = uri_list; i != NULL; i = i->next) {
-		char *uri = i->data;
-		if (uri != NULL)
-			rb_shell_load_uri (icon->priv->shell, uri, FALSE, NULL);
-
-		g_free (uri);
-	}
-
-	g_list_free (uri_list);
-
-	gtk_drag_finish (context, TRUE, FALSE, time);
-}
+#endif
 
 static void
 rb_tray_icon_show_window_changed_cb (GtkAction *action,
@@ -488,37 +543,12 @@
 }
 
 void
-rb_tray_icon_get_geom (RBTrayIcon *icon, int *x, int *y, int *width, int *height)
-{
-	GtkWidget *widget;
-	GtkRequisition requisition;
-
-	widget = GTK_WIDGET (icon->priv->ebox);
-
-	gtk_widget_size_request (widget, &requisition);
-
-	gdk_window_get_origin (widget->window, x, y);
-
-	*width = widget->allocation.x;
-	*height = widget->allocation.y;
-}
-
-void
-rb_tray_icon_set_tooltip (RBTrayIcon *icon, const char *tooltip)
-{
-	gtk_tooltips_set_tip (icon->priv->tooltips,
-			      GTK_WIDGET (icon),
-			      tooltip, NULL);
-}
-
-void
 rb_tray_icon_notify (RBTrayIcon *icon,
 		     guint timeout,
 		     const char *primary,
-		     GtkWidget *msgicon,
 		     const char *secondary)
 {
-	if (!egg_tray_icon_have_manager (EGG_TRAY_ICON (icon))) {
+	if (!rb_tray_icon_is_embedded (icon)) {
 		rb_debug ("not showing notification: %s", primary);
 		return;
 	}
@@ -527,12 +557,28 @@
 		return;
 	}
 
+#ifdef HAVE_NOTIFY
 	rb_debug ("doing notify: %s", primary);
-	egg_tray_icon_notify (EGG_TRAY_ICON (icon), timeout, primary, msgicon, secondary);
-}
 
-void
-rb_tray_icon_cancel_notify (RBTrayIcon *icon)
-{
-	egg_tray_icon_cancel_message (EGG_TRAY_ICON (icon), 1);
+#ifdef HAVE_GTK_STATUS_ICON
+	if (!notify_is_initted () && !notify_init ("rhythmbox")) {
+		rb_debug ("cannot initialize notification");
+		return;
+	}
+
+	if (icon->priv->notification != NULL) {
+		notify_notification_close (icon->priv->notification, NULL);
+		g_object_unref (icon->priv->notification);
+	}
+
+	/* FIXME: Workaround libnotify#85 (http://trac.galago-project.org/ticket/85) */
+	icon->priv->notification = notify_notification_new (primary, secondary, NULL, NULL);
+	g_object_set (G_OBJECT (icon->priv->notification), "status-icon", icon->priv->status_icon, NULL);
+	notify_notification_set_urgency (icon->priv->notification, NOTIFY_URGENCY_LOW);
+	notify_notification_set_timeout (icon->priv->notification, timeout);
+	notify_notification_show (icon->priv->notification, NULL);
+#else
+	egg_tray_icon_notify (icon->priv->tray_icon, timeout, primary, NULL, secondary);
+#endif
+#endif
 }
Index: shell/rb-tray-icon.h
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-tray-icon.h,v
retrieving revision 1.10
diff -u -r1.10 rb-tray-icon.h
--- shell/rb-tray-icon.h	12 May 2006 16:04:49 -0000	1.10
+++ shell/rb-tray-icon.h	12 Aug 2006 19:21:23 -0000
@@ -21,7 +21,6 @@
 
 #include <gtk/gtkactiongroup.h>
 #include <gtk/gtkuimanager.h>
-#include "eggtrayicon.h"
 #include "rhythmdb.h"
 #include "rb-shell.h"
 
@@ -41,31 +40,36 @@
 
 typedef struct
 {
-	EggTrayIcon parent;
+	GObject parent;
 
 	RBTrayIconPrivate *priv;
 } RBTrayIcon;
 
 typedef struct
 {
-	EggTrayIconClass parent_class;
+	GObjectClass parent_class;
 } RBTrayIconClass;
 
-GType			rb_tray_icon_get_type	(void);
+GType			rb_tray_icon_get_type	  (void);
 
-RBTrayIcon *		rb_tray_icon_new	(GtkUIManager *mgr, RBShell *shell);
+RBTrayIcon *		rb_tray_icon_new	  (GtkUIManager *mgr, RBShell *shell);
 
-void                    rb_tray_icon_get_geom   (RBTrayIcon *icon, int *x, int *y, int *width, int *height);
+void                    rb_tray_icon_set_visible  (RBTrayIcon *icon, gboolean visible);
 
-void                    rb_tray_icon_notify     (RBTrayIcon *icon,
-						 guint timeout,
-						 const char *primary,
-						 GtkWidget *msgicon,
-						 const char *secondary);
+void                    rb_tray_icon_set_tooltip  (RBTrayIcon *icon, 
+						   const char *tooltip_text);
 
-void                    rb_tray_icon_cancel_notify (RBTrayIcon *icon);
+gboolean                rb_tray_icon_is_embedded  (RBTrayIcon *icon);
 
-void			rb_tray_icon_set_tooltip(RBTrayIcon *icon, const char *tooltip);
+gboolean                rb_tray_icon_get_geometry (RBTrayIcon *icon,
+						   GdkScreen **screen,
+						   GdkRectangle *area,
+						   GtkOrientation *orientation);
+
+void                    rb_tray_icon_notify      (RBTrayIcon *icon,
+						  guint timeout,
+						  const char *primary,
+						  const char *secondary);
 
 G_END_DECLS
 
Index: widgets/Makefile.am
===================================================================
RCS file: /cvs/gnome/rhythmbox/widgets/Makefile.am,v
retrieving revision 1.34
diff -u -r1.34 Makefile.am
--- widgets/Makefile.am	10 Jul 2006 04:19:59 -0000	1.34
+++ widgets/Makefile.am	12 Aug 2006 19:21:23 -0000
@@ -20,8 +20,6 @@
 	bacon-volume.h					\
 	rb-druid.c					\
 	rb-druid.h					\
-	eggtrayicon.c					\
-	eggtrayicon.h					\
 	rb-dialog.c					\
 	rb-dialog.h					\
 	rb-cell-renderer-pixbuf.c			\
@@ -40,6 +38,14 @@
 	rb-query-creator.h				\
 	rb-query-creator-private.h			\
 	rb-query-creator-properties.c
+
+if HAVE_GTK_STATUS_ICON
+librbwidgets_la_SOURCES +=
+else
+librbwidgets_la_SOURCES +=				\
+	eggtrayicon.c					\
+	eggtrayicon.h
+endif
 
 INCLUDES =						\
 	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"        \
