Index: configure.ac
===================================================================
RCS file: /cvs/gnome/gossip/configure.ac,v
retrieving revision 1.66
diff -u -p -r1.66 configure.ac
--- configure.ac	17 Sep 2006 08:36:16 -0000	1.66
+++ configure.ac	20 Sep 2006 17:47:31 -0000
@@ -142,7 +142,7 @@ AC_ARG_ENABLE(libnotify,
               enable_libnotify=auto)
 
 if test "x$enable_libnotify" != "xno"; then
-   libnotify_pkgconfig_tmp="libnotify >= 0.3.2"
+   libnotify_pkgconfig_tmp="libnotify >= 0.4.1"
    PKG_CHECK_MODULES(LIBNOTIFY, $libnotify_pkgconfig_tmp, have_libnotify=yes, have_libnotify=no)
    if test x$have_libnotify = xyes; then
       AC_DEFINE(HAVE_LIBNOTIFY, 1, [libnotify support])
Index: src/Makefile.am
===================================================================
RCS file: /cvs/gnome/gossip/src/Makefile.am,v
retrieving revision 1.81
diff -u -p -r1.81 Makefile.am
--- src/Makefile.am	17 Sep 2006 10:10:53 -0000	1.81
+++ src/Makefile.am	20 Sep 2006 17:47:32 -0000
@@ -28,17 +28,12 @@ if HAVE_LIBNOTIFY
 libnotify_sources = gossip-notify.c gossip-notify.h
 endif
 
-if HAVE_GNOME
-eggtray_sources = eggtrayicon.c eggtrayicon.h
-endif
-
 bin_PROGRAMS = gossip
 
 gossip_SOURCES = 				                        	\
 	$(dbus_sources)			     	                        	\
 	$(galago_sources)		     	                        	\
 	$(libnotify_sources)		     	                        	\
-	$(eggtray_sources)		     	                        	\
 	gossip-about-dialog.c              gossip-about-dialog.h		\
 	gossip-accounts-dialog.c           gossip-accounts-dialog.h		\
 	gossip-account-chooser.c	   gossip-account-chooser.h		\
@@ -127,6 +122,5 @@ EXTRA_DIST =						\
 	$(dbus_sources)					\
 	$(dbus_binding_sources)				\
 	$(galago_sources)				\
-	$(libnotify_sources)				\
-	$(eggtray_sources)
+	$(libnotify_sources)
 
Index: src/gossip-app.c
===================================================================
RCS file: /cvs/gnome/gossip/src/gossip-app.c,v
retrieving revision 1.284
diff -u -p -r1.284 gossip-app.c
--- src/gossip-app.c	17 Sep 2006 10:10:53 -0000	1.284
+++ src/gossip-app.c	20 Sep 2006 17:47:34 -0000
@@ -30,11 +30,6 @@
 #include <glade/glade.h>
 #include <glib/gi18n.h>
 
-#ifdef HAVE_GNOME
-#include <libgnomeui/libgnomeui.h>
-#include "eggtrayicon.h"
-#endif
-
 #include <libgossip/gossip-contact.h>
 #include <libgossip/gossip-debug.h>
 #include <libgossip/gossip-ft.h>
@@ -148,12 +143,10 @@ struct _GossipAppPriv {
 	GtkWidget             *edit_context;   
 	GtkWidget             *edit_context_separator;   
 
-	/* Tray */
-	GtkWidget             *tray_icon;
-	GtkWidget             *tray_event_box;
-	GtkWidget             *tray_image;
-	GList                 *tray_flash_icons;
-	guint                  tray_flash_timeout_id;
+	/* Status Icon */
+	GtkStatusIcon         *status_icon;
+	GList                 *status_icon_flash_icons;
+	guint                  status_icon_flash_timeout_id;
 
 	GtkWidget             *popup_menu;
 	GtkWidget             *popup_menu_status_item;
@@ -283,16 +276,18 @@ static void            app_show_hide_lis
 							       GossipApp                *app);
 static void            app_popup_new_message_cb               (GtkWidget                *widget,
 							       gpointer                  user_data);
-static gboolean        app_tray_destroy_cb                    (GtkWidget                *widget,
-							       gpointer                  user_data);
-static gboolean        app_tray_button_press_cb               (GtkWidget                *widget,
-							       GdkEventButton           *event,
+static void            app_status_icon_activate_cb            (GtkStatusIcon            *status_icon,
 							       GossipApp                *app);
-static void            app_tray_create_menu                   (void);
-static void            app_tray_create                        (void);
-static void            app_tray_update_tooltip                (void);
-static void            app_status_flash_start                 (void);
-static void            app_status_flash_stop                  (void);
+static void            app_status_icon_popup_menu_cb          (GtkStatusIcon            *status_icon, 
+							       guint                     button,
+							       guint                     activate_time,
+							       GossipApp                *app);
+static void            app_status_icon_create_menu            (void);
+static void            app_status_icon_create                 (void);
+static void            app_status_icon_update_tooltip         (void);
+static void            app_status_icon_flash_start            (void);
+static void            app_status_icon_flash_maybe_stop       (void);
+static gboolean        app_status_icon_flash_timeout_func     (gpointer                  data);
 static void            app_notify_show_offline_cb             (GossipConf               *conf,
 							       const gchar              *key,
 							       gpointer                  check_menu_item);
@@ -329,9 +324,8 @@ static gboolean        configure_event_t
 static gboolean        app_window_configure_event_cb          (GtkWidget                *widget,
 							       GdkEventConfigure        *event,
 							       GossipApp                *app);
-static gboolean        app_tray_flash_timeout_func            (gpointer                  data);
-static void            app_tray_flash_start                   (void);
-static void            app_tray_flash_maybe_stop              (void);
+static void            app_status_flash_start                 (void);
+static void            app_status_flash_stop                  (void);
 static void            app_chatroom_auto_connect_update_cb    (GossipChatroomManager    *manager,
 							       GossipChatroomProvider   *provider,
 							       GossipChatroom           *chatroom,
@@ -399,8 +393,8 @@ app_finalize (GObject *object)
 		g_source_remove (priv->size_timeout_id);
 	}
 
-	if (priv->tray_flash_timeout_id) {
-		g_source_remove (priv->tray_flash_timeout_id);
+	if (priv->status_icon_flash_timeout_id) {
+		g_source_remove (priv->status_icon_flash_timeout_id);
 	}
 
 	g_list_free (priv->widgets_connected);
@@ -424,15 +418,6 @@ app_finalize (GObject *object)
 	
 	g_object_unref (priv->tooltips);
 
-	if (priv->tray_icon) {
-		/* Disconnect so it doesn't get recreated when we destroy it. */
-		g_signal_handlers_disconnect_by_func (priv->tray_icon,
-						      app_tray_destroy_cb,
-						      priv->tray_event_box);
-		
-		gtk_widget_destroy (GTK_WIDGET (priv->tray_icon));
-	}
-
 	gossip_conf_shutdown ();
 
 #ifdef HAVE_LIBNOTIFY
@@ -698,8 +683,8 @@ app_setup (GossipSession        *session
 
 	/* Set up notification area / tray. */
 	gossip_debug (DEBUG_DOMAIN_SETUP, "Configuring notification area widgets");
-	app_tray_create_menu ();
-	app_tray_create ();
+	app_status_icon_create_menu ();
+	app_status_icon_create ();
 
 	/* Load user-defined accelerators. */
 	gossip_debug (DEBUG_DOMAIN_SETUP, "Configuring accels");
@@ -755,10 +740,10 @@ app_setup (GossipSession        *session
 
 	g_object_set (priv->contact_list, "show-avatars", show_avatars, NULL);
 
-	/* Set window to be hidden. If doesn't have tray, show window and mask
-	 * "actions_hide_list".
+	/* Set window to be hidden. If doesn't have status icon, show window
+	 * and mask "actions_hide_list".
 	 */
-	if (!gossip_have_tray ()) {
+	if (!gtk_status_icon_is_embedded (priv->status_icon)) {
 		hidden = FALSE;
 	} else {
 		gossip_conf_get_bool (conf,
@@ -943,7 +928,11 @@ app_main_window_delete_event_cb (GtkWidg
 				 GdkEvent  *event,
 				 GossipApp *app)
 {
-	if (gossip_have_tray ()) { 
+	GossipAppPriv *priv;
+
+	priv = GET_PRIV (app);
+
+	if (gtk_status_icon_is_embedded (priv->status_icon)) { 
 		gossip_hint_show (GOSSIP_PREFS_HINTS_CLOSE_MAIN_WINDOW,
 				  _("Gossip is still running, it is just hidden."),
 				  _("Click on the notification area icon to show Gossip."),
@@ -1661,7 +1650,7 @@ gossip_app_toggle_visibility (void)
 
 	visible = gossip_window_get_is_visible (GTK_WINDOW (priv->window));
 
-	if (visible && gossip_have_tray ()) {
+	if (visible && gtk_status_icon_is_embedded (priv->status_icon)) {
 		gint x, y, w, h;
 
 		gtk_window_get_size (GTK_WINDOW (priv->window), &w, &h);
@@ -1736,92 +1725,58 @@ app_popup_new_message_cb (GtkWidget *wid
 	gossip_new_message_dialog_show (NULL);
 }
 
-static gboolean
-app_tray_destroy_cb (GtkWidget *widget,
-		     gpointer   user_data)
+static void
+app_status_icon_activate_cb (GtkStatusIcon  *status_icon, 
+			     GossipApp      *app)
 {
 	GossipAppPriv *priv;
 
 	priv = GET_PRIV (app);
-	
-	gtk_widget_destroy (GTK_WIDGET (priv->tray_icon));
-	priv->tray_icon = NULL;
-	priv->tray_event_box = NULL;
-	priv->tray_image = NULL;
 
-	if (priv->tray_flash_timeout_id) {
-		g_source_remove (priv->tray_flash_timeout_id);
-		priv->tray_flash_timeout_id = 0;
-	}
-	
-	app_tray_create ();
-	
-	/* Show the window in case the notification area was removed */
-	if (!gossip_have_tray ()) {
-		gtk_widget_show (priv->window);
+	if (!priv->status_icon_flash_icons) {
+		gossip_app_toggle_visibility ();
+	} else {
+		gossip_event_manager_activate (priv->event_manager,
+					       priv->status_icon_flash_icons->data);
 	}
-
-	return TRUE;
 }
 
-static gboolean
-app_tray_button_press_cb (GtkWidget      *widget, 
-			  GdkEventButton *button_event, 
-			  GossipApp      *app)
+static void
+app_status_icon_popup_menu_cb (GtkStatusIcon  *status_icon, 
+			       guint          button,
+			       guint          activate_time,
+			       GossipApp      *app)
 {
 	GossipAppPriv *priv;
 	GtkWidget     *submenu;
+	gboolean       show;
 
 	priv = GET_PRIV (app);
 
-	if (button_event->type == GDK_2BUTTON_PRESS ||
-	    button_event->type == GDK_3BUTTON_PRESS) {
-		return FALSE;
-	}
-	
-	if (button_event->button != 1 && 
-	    button_event->button != 3) {
-		return FALSE;
-	}
-
-	if (button_event->button == 1) {
-		GossipEvent *event;
+	show = gossip_window_get_is_visible (GTK_WINDOW (priv->window));
 
-		if (!priv->tray_flash_icons) {
-			gossip_app_toggle_visibility ();
-			return TRUE;
-		}
-		
-		event = priv->tray_flash_icons->data;
-		gossip_event_manager_activate (priv->event_manager, event);
-	} else if (button_event->button == 3) {
-		gboolean show;
+	g_signal_handlers_block_by_func (priv->popup_menu_show_list_item, 
+					 app_show_hide_list_cb, app);
+	gtk_check_menu_item_set_active 
+		(GTK_CHECK_MENU_ITEM (priv->popup_menu_show_list_item), show);
+	g_signal_handlers_unblock_by_func (priv->popup_menu_show_list_item, 
+					   app_show_hide_list_cb, app);
 
-		show = gossip_window_get_is_visible (GTK_WINDOW (priv->window));
-		
-		g_signal_handlers_block_by_func (priv->popup_menu_show_list_item, 
-						 app_show_hide_list_cb, app);
-		gtk_check_menu_item_set_active 
-			(GTK_CHECK_MENU_ITEM (priv->popup_menu_show_list_item), show);
-		g_signal_handlers_unblock_by_func (priv->popup_menu_show_list_item, 
-						   app_show_hide_list_cb, app);
-
-		submenu = gossip_presence_chooser_create_menu (
-			GOSSIP_PRESENCE_CHOOSER (priv->presence_chooser));
-		gtk_menu_item_set_submenu (GTK_MENU_ITEM (priv->popup_menu_status_item),
-					   submenu);
-		
-		gtk_menu_popup (GTK_MENU (priv->popup_menu), 
-				NULL, NULL, NULL, NULL, 
-				button_event->button, 
-				button_event->time);
-	}
+	submenu = gossip_presence_chooser_create_menu (
+		GOSSIP_PRESENCE_CHOOSER (priv->presence_chooser));
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (priv->popup_menu_status_item),
+				   submenu);
 
-	return TRUE;
+	gtk_menu_popup (GTK_MENU (priv->popup_menu), 
+			NULL, NULL,
+			gtk_status_icon_position_menu,
+			priv->status_icon, 
+			button, 
+			activate_time);
 }
 
 static void
-app_tray_create_menu (void)
+app_status_icon_create_menu (void)
 {
 	GossipAppPriv *priv;
 	GladeXML      *glade;
@@ -1857,71 +1812,43 @@ app_tray_create_menu (void)
 }
 
 static void
-app_tray_create (void)
+app_status_icon_create (void)
 {
-#ifdef HAVE_GNOME
 	GossipAppPriv *priv;
 	GdkPixbuf     *pixbuf;
-	gchar         *name;
 
 	priv = GET_PRIV (app);
 
-	name = g_strdup_printf ("%s, Instant Messaging Client", PACKAGE_NAME);
-	priv->tray_icon = GTK_WIDGET (egg_tray_icon_new (name));
-	g_free (name);
-
-	priv->tray_event_box = gtk_event_box_new ();
-	priv->tray_image = gtk_image_new ();
-	
 	pixbuf = app_get_current_status_pixbuf ();
-	gtk_image_set_from_pixbuf (GTK_IMAGE (priv->tray_image), pixbuf);
+	priv->status_icon = gtk_status_icon_new_from_pixbuf (pixbuf);
 	g_object_unref (pixbuf);
 	
-	gtk_container_add (GTK_CONTAINER (priv->tray_event_box),
-			   priv->tray_image);
-
-	gtk_widget_show (priv->tray_event_box);
-	gtk_widget_show (priv->tray_image);
-
-	gtk_container_add (GTK_CONTAINER (priv->tray_icon),
-			   priv->tray_event_box);
-	gtk_widget_show (GTK_WIDGET (priv->tray_icon));
-
-	gtk_widget_add_events (GTK_WIDGET (priv->tray_icon),
-			       GDK_BUTTON_PRESS_MASK);
-	
-	g_signal_connect (priv->tray_icon,
-			  "button_press_event",
-			  G_CALLBACK (app_tray_button_press_cb),
+	g_signal_connect (priv->status_icon,
+			  "activate",
+			  G_CALLBACK (app_status_icon_activate_cb),
 			  app);
 
-	/* Handles when the area is removed from the panel. */
-	g_signal_connect (priv->tray_icon,
-			  "destroy",
-			  G_CALLBACK (app_tray_destroy_cb),
-			  priv->tray_event_box);
+	g_signal_connect (priv->status_icon,
+			  "popup_menu",
+			  G_CALLBACK (app_status_icon_popup_menu_cb),
+			  app);
 
 #ifdef HAVE_LIBNOTIFY
-	gossip_notify_set_attach_widget (GTK_WIDGET (priv->tray_icon));
+	gossip_notify_set_attach_status_icon (priv->status_icon);
 #endif
 
-	app_tray_update_tooltip ();
-#else
-	if (0) {
-		app_tray_button_press_cb (NULL, NULL, NULL);
-	}
-#endif
+	app_status_icon_update_tooltip ();
 }
 
 static void
-app_tray_update_tooltip (void)
+app_status_icon_update_tooltip (void)
 {
 	GossipAppPriv *priv;
 	GossipEvent   *event;
 
 	priv = GET_PRIV (app);
 
-	if (!priv->tray_flash_icons) {
+	if (!priv->status_icon_flash_icons) {
 		const gchar *status;
 
 		if (gossip_app_is_connected ()) {
@@ -1940,22 +1867,14 @@ app_tray_update_tooltip (void)
 			status = _("Offline");
 		}
 
-		if (priv->tray_event_box) {
-			gtk_tooltips_set_tip (GTK_TOOLTIPS (priv->tooltips),
-					      priv->tray_event_box, status, status);
-		}
-		
+		gtk_status_icon_set_tooltip (priv->status_icon, status);
 		return;
 	}
 
-	event = priv->tray_flash_icons->data;
+	event = priv->status_icon_flash_icons->data;
 
-	if (priv->tray_event_box) {
-		gtk_tooltips_set_tip (GTK_TOOLTIPS (priv->tooltips),
-				      priv->tray_event_box,
-				      gossip_event_get_message (event),
-				      gossip_event_get_message (event));
-	}	
+	gtk_status_icon_set_tooltip (priv->status_icon,
+				     gossip_event_get_message (event));
 }
 
 static void
@@ -1969,7 +1888,7 @@ app_status_flash_start (void)
 					     app_get_current_state (),
 					     app_get_previous_state ());
 	
-	app_tray_flash_start ();
+	app_status_icon_flash_start ();
 }
 
 static void
@@ -1982,7 +1901,7 @@ app_status_flash_stop (void)
 	gossip_presence_chooser_flash_stop (GOSSIP_PRESENCE_CHOOSER (priv->presence_chooser),
 					    app_get_current_state ());
 	
-	app_tray_flash_maybe_stop ();
+	app_status_icon_flash_maybe_stop ();
 }
 
 static void
@@ -2575,17 +2494,15 @@ app_presence_updated (void)
 	
 	priv = GET_PRIV (app);
 
-	if (priv->tray_image) {
-		pixbuf = app_get_current_status_pixbuf ();
-		gtk_image_set_from_pixbuf (GTK_IMAGE (priv->tray_image), pixbuf);
-		g_object_unref (pixbuf);
-	}
+	pixbuf = app_get_current_status_pixbuf ();
+	gtk_status_icon_set_from_pixbuf (priv->status_icon, pixbuf);
+	g_object_unref (pixbuf);
 	
 	if (!gossip_session_is_connected (priv->session, NULL)) {
 		gossip_presence_chooser_set_status (
 			GOSSIP_PRESENCE_CHOOSER (priv->presence_chooser),
 			_("Offline"));
-		app_tray_update_tooltip ();
+		app_status_icon_update_tooltip ();
 		return;
 	}
 
@@ -2604,7 +2521,7 @@ app_presence_updated (void)
 		
 	gossip_session_set_presence (priv->session, presence);
 
-	app_tray_update_tooltip ();
+	app_status_icon_update_tooltip ();
 }
 
 /* clears status data from autoaway mode */ 
@@ -2740,7 +2657,7 @@ gossip_app_get_window (void)
 }
 
 static gboolean
-app_tray_flash_timeout_func (gpointer data)
+app_status_icon_flash_timeout_func (gpointer data)
 {
 	GossipAppPriv   *priv;
 	GdkPixbuf       *pixbuf = NULL;
@@ -2749,10 +2666,6 @@ app_tray_flash_timeout_func (gpointer da
 
 	priv = GET_PRIV (app);
 
-	if (!priv->tray_image) {
-		return TRUE;
-	}
-	
 	is_flashing = gossip_presence_chooser_is_flashing
 		(GOSSIP_PRESENCE_CHOOSER (priv->presence_chooser));
 
@@ -2760,11 +2673,11 @@ app_tray_flash_timeout_func (gpointer da
 		if (is_flashing) {
 			pixbuf = gossip_pixbuf_for_presence (priv->presence);
 		}
-		else if (priv->tray_flash_icons != NULL) {
+		else if (priv->status_icon_flash_icons != NULL) {
 			GossipEvent *event;
 			const gchar *stock_id = NULL;
 
-			event = priv->tray_flash_icons->data;
+			event = priv->status_icon_flash_icons->data;
 			switch (gossip_event_get_type (event)) {
 			case GOSSIP_EVENT_NEW_MESSAGE:
 			case GOSSIP_EVENT_SERVER_MESSAGE: 
@@ -2793,7 +2706,7 @@ app_tray_flash_timeout_func (gpointer da
 		pixbuf = app_get_current_status_pixbuf ();
 	}
 
-	gtk_image_set_from_pixbuf (GTK_IMAGE (priv->tray_image), pixbuf);
+	gtk_status_icon_set_from_pixbuf (priv->status_icon, pixbuf);
 	g_object_unref (pixbuf);
 	
 	on = !on;
@@ -2802,41 +2715,40 @@ app_tray_flash_timeout_func (gpointer da
 }
 
 static void
-app_tray_flash_start (void)
+app_status_icon_flash_start (void)
 {
 	GossipAppPriv *priv;
 
 	priv = GET_PRIV (app);
 
-	if (!priv->tray_flash_timeout_id) {
-		priv->tray_flash_timeout_id = g_timeout_add (FLASH_TIMEOUT,
-							     app_tray_flash_timeout_func,
-							     NULL);
+	if (!priv->status_icon_flash_timeout_id) {
+		priv->status_icon_flash_timeout_id =
+			g_timeout_add (FLASH_TIMEOUT,
+				       app_status_icon_flash_timeout_func,
+				       NULL);
 	}
 }
 
 /* Stop if there are no flashing messages or status change. */
 static void
-app_tray_flash_maybe_stop (void)
+app_status_icon_flash_maybe_stop (void)
 {
 	GossipAppPriv *priv;
 	GdkPixbuf     *pixbuf;
 
 	priv = GET_PRIV (app);
 
-	if (priv->tray_flash_icons != NULL || priv->leave_time > 0) {
+	if (priv->status_icon_flash_icons != NULL || priv->leave_time > 0) {
 		return;
 	}
 
-	if (priv->tray_image) {
-		pixbuf = app_get_current_status_pixbuf ();
-		gtk_image_set_from_pixbuf (GTK_IMAGE (priv->tray_image), pixbuf);
-		g_object_unref (pixbuf);
-	}
+	pixbuf = app_get_current_status_pixbuf ();
+	gtk_status_icon_set_from_pixbuf (priv->status_icon, pixbuf);
+	g_object_unref (pixbuf);
 	
-	if (priv->tray_flash_timeout_id) {
-		g_source_remove (priv->tray_flash_timeout_id);
-		priv->tray_flash_timeout_id = 0;
+	if (priv->status_icon_flash_timeout_id) {
+		g_source_remove (priv->status_icon_flash_timeout_id);
+		priv->status_icon_flash_timeout_id = 0;
 	}
 }
 
@@ -2885,18 +2797,19 @@ app_event_added_cb (GossipEventManager *
 	
 	gossip_request_user_attention ();
 	
-	l = g_list_find_custom (priv->tray_flash_icons, 
+	l = g_list_find_custom (priv->status_icon_flash_icons, 
 				event, gossip_event_compare);
 	if (l) {
 		/* Already in list */
 		return;
 	}
 	
-	priv->tray_flash_icons = g_list_append (priv->tray_flash_icons, 
-						g_object_ref (event));
+	priv->status_icon_flash_icons =
+		g_list_append (priv->status_icon_flash_icons,
+			       g_object_ref (event));
 
-	app_tray_flash_start ();
-	app_tray_update_tooltip ();
+	app_status_icon_flash_start ();
+	app_status_icon_update_tooltip ();
 }
 
 static void
@@ -2909,7 +2822,7 @@ app_event_removed_cb (GossipEventManager
 
 	priv = GET_PRIV (app);
 
-	l = g_list_find_custom (priv->tray_flash_icons, event,
+	l = g_list_find_custom (priv->status_icon_flash_icons, event,
 				gossip_event_compare);
 
 	if (!l) {
@@ -2917,10 +2830,10 @@ app_event_removed_cb (GossipEventManager
 		return;
 	}
 
-	priv->tray_flash_icons = g_list_delete_link (priv->tray_flash_icons, l);
+	priv->status_icon_flash_icons = g_list_delete_link (priv->status_icon_flash_icons, l);
 
-	app_tray_flash_maybe_stop ();
-	app_tray_update_tooltip ();
+	app_status_icon_flash_maybe_stop ();
+	app_status_icon_update_tooltip ();
 
 	g_object_unref (event);
 }
Index: src/gossip-notify.c
===================================================================
RCS file: /cvs/gnome/gossip/src/gossip-notify.c,v
retrieving revision 1.37
diff -u -p -r1.37 gossip-notify.c
--- src/gossip-notify.c	16 Sep 2006 10:35:57 -0000	1.37
+++ src/gossip-notify.c	20 Sep 2006 17:47:35 -0000
@@ -91,12 +91,13 @@ enum {
 	NOTIFY_SHOW_ROSTER
 };
 
-static gboolean    inited = FALSE;
-static GHashTable *account_states = NULL;
-static GHashTable *contact_states = NULL;
-static GHashTable *message_notifications = NULL;
-static GHashTable *event_notifications = NULL;
-static GtkWidget  *attach_widget = NULL;
+static gboolean       inited = FALSE;
+static GHashTable    *account_states = NULL;
+static GHashTable    *contact_states = NULL;
+static GHashTable    *message_notifications = NULL;
+static GHashTable    *event_notifications = NULL;
+static GtkWidget     *attach_widget = NULL;
+static GtkStatusIcon *attach_status_icon = NULL;
 
 static const gchar *
 notify_get_status_from_presence (GossipPresence *presence)
@@ -212,8 +213,8 @@ notify_contact_online (GossipContact *co
 			  G_CALLBACK (notify_closed_cb),
 			  NULL);
 
-	if (attach_widget) {
-		notify_notification_attach_to_widget (notify, attach_widget);
+	if (attach_status_icon) {
+		notify_notification_attach_to_status_icon (notify, attach_status_icon);
 	}
 
 	notify_notification_add_action (notify, "default", _("Default"),
@@ -278,7 +279,7 @@ notify_subscription_request_show (Gossip
 	notify = notify_notification_new (_("Subscription request"),
 					  message,
 					  NULL,
-					  attach_widget);
+					  NULL);
 	g_free (message);
 
 	notify_notification_set_urgency (notify, NOTIFY_URGENCY_NORMAL);
@@ -429,8 +430,8 @@ notify_new_message (GossipEventManager *
 			  G_CALLBACK (notify_closed_cb),
 			  NULL);
 
-	if (attach_widget) {
-		notify_notification_attach_to_widget (notify, attach_widget);
+	if (attach_status_icon) {
+		notify_notification_attach_to_status_icon (notify, attach_status_icon);
 	}
 	
 	notify_notification_add_action (notify, "default", _("Default"),
@@ -686,6 +687,21 @@ gossip_notify_set_attach_widget (GtkWidg
 	}
 }
 
+void
+gossip_notify_set_attach_status_icon (GtkStatusIcon *new_attach)
+{
+	if (attach_status_icon) {
+		g_object_remove_weak_pointer (G_OBJECT (attach_status_icon),
+					      (gpointer) &attach_status_icon);
+	}
+	
+	attach_status_icon = new_attach;
+	if (attach_status_icon) {
+		g_object_add_weak_pointer (G_OBJECT (attach_status_icon),
+					   (gpointer) &attach_status_icon);
+	}
+}
+
 static void
 notify_hint_closed_cb (NotifyNotification *notification,
 		       gpointer            user_data)
@@ -728,13 +744,17 @@ gossip_notify_hint_show (const gchar    
 		return FALSE;
 	}
 
-	notify = notify_notification_new (summary, message, NULL, attach_widget);
+	notify = notify_notification_new (summary, message, NULL, NULL);
 	g_object_set_data_full (G_OBJECT (notify), "conf_path", g_strdup (conf_path), g_free);
 	g_object_set_data (G_OBJECT (notify), "func", func);
 	g_signal_connect (notify,
 			  "closed",
 			  G_CALLBACK (notify_hint_closed_cb),
 			  user_data);
+
+	if (attach_status_icon) {
+		notify_notification_attach_to_status_icon (notify, attach_status_icon);
+	}
 
 	if (!notify_notification_show (notify, &error)) {
 		g_warning ("Failed to send notification: %s",
Index: src/gossip-notify.h
===================================================================
RCS file: /cvs/gnome/gossip/src/gossip-notify.h,v
retrieving revision 1.6
diff -u -p -r1.6 gossip-notify.h
--- src/gossip-notify.h	18 Aug 2006 21:49:12 -0000	1.6
+++ src/gossip-notify.h	20 Sep 2006 17:47:35 -0000
@@ -24,15 +24,15 @@
 #include <libgossip/gossip-session.h>
 #include <libgossip/gossip-event-manager.h>
 
-void     gossip_notify_init              (GossipSession      *session,
-					  GossipEventManager *event_manager);
-void     gossip_notify_finalize          (void);
-
-void     gossip_notify_set_attach_widget (GtkWidget          *new_attach_widget);
-gboolean gossip_notify_hint_show         (const gchar        *conf_path, 
-					  const gchar        *summary,
-					  const gchar        *message,
-					  GFunc               func,
-					  gpointer            user_data);
+void gossip_notify_init                   (GossipSession      *session,
+				           GossipEventManager *event_manager);
+void gossip_notify_finalize               (void);
+void gossip_notify_set_attach_widget      (GtkWidget          *new_attach_widget);
+void gossip_notify_set_attach_status_icon (GtkStatusIcon      *new_attach);
+gboolean gossip_notify_hint_show          (const gchar        *conf_path, 
+					   const gchar        *summary,
+					   const gchar        *message,
+					   GFunc               func,
+					   gpointer            user_data);
 
 #endif /* __GOSSIP_NOTIFY_H__ */
Index: src/gossip-ui-utils.c
===================================================================
RCS file: /cvs/gnome/gossip/src/gossip-ui-utils.c,v
retrieving revision 1.41
diff -u -p -r1.41 gossip-ui-utils.c
--- src/gossip-ui-utils.c	16 Sep 2006 08:22:25 -0000	1.41
+++ src/gossip-ui-utils.c	20 Sep 2006 17:47:37 -0000
@@ -1545,29 +1545,6 @@ gossip_window_set_default_icon_name (con
 #endif
 }
 
-gboolean
-gossip_have_tray (void)
-{
-#ifdef HAVE_GNOME
-	Screen *xscreen = DefaultScreenOfDisplay (gdk_display);
-	Atom    selection_atom;
-	char   *selection_atom_name;
-	
-	selection_atom_name = g_strdup_printf ("_NET_SYSTEM_TRAY_S%d",
-					       XScreenNumberOfScreen (xscreen));
-	selection_atom = XInternAtom (DisplayOfScreen (xscreen), selection_atom_name, False);
-	g_free (selection_atom_name);
-	
-	if (XGetSelectionOwner (DisplayOfScreen (xscreen), selection_atom)) {
-		return TRUE;
-	} else {
-		return FALSE;
-	}
-#else
-	return FALSE;
-#endif
-}
-
 void
 gossip_request_user_attention (void)
 {
Index: src/gossip-ui-utils.h
===================================================================
RCS file: /cvs/gnome/gossip/src/gossip-ui-utils.h,v
retrieving revision 1.19
diff -u -p -r1.19 gossip-ui-utils.h
--- src/gossip-ui-utils.h	18 Aug 2006 21:49:10 -0000	1.19
+++ src/gossip-ui-utils.h	20 Sep 2006 17:47:37 -0000
@@ -124,7 +124,6 @@ void       gossip_help_show             
 GtkWidget *gossip_link_button_new                   (const gchar         *url,
 						     const gchar         *title);
 
-gboolean   gossip_have_tray                         (void);
 void       gossip_request_user_attention            (void);
 
 #endif /*  __GOSSIP_UI_UTILS_H__ */
