Index: typing-break/Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-control-center/typing-break/Makefile.am,v
retrieving revision 1.5
diff -p -u -u -p -r1.5 Makefile.am
--- typing-break/Makefile.am	9 Jan 2006 12:22:34 -0000	1.5
+++ typing-break/Makefile.am	29 Apr 2006 11:08:55 -0000
@@ -1,8 +1,3 @@
-INCLUDES =						\
-	@GNOME_CFLAGS@					\
-	-DGNOMELOCALEDIR="\"$(datadir)/locale\""	\
-	-DIMAGEDIR=\"$(GNOMECC_PIXMAPS_DIR)\"
-
 bin_PROGRAMS = gnome-typing-monitor
 
 gnome_typing_monitor_SOURCES =			\
@@ -16,9 +11,15 @@ gnome_typing_monitor_SOURCES =			\
 	drw-utils.c				\
 	drw-utils.h				\
 	drw-selection.c				\
-	drw-selection.h				\
-	eggtrayicon.c				\
-	eggtrayicon.h
+	drw-selection.h
+
+gnome_typing_monitor_CPPFLAGS = \
+	-DGNOMELOCALEDIR="\"$(datadir)/locale\""	\
+	-DIMAGEDIR=\"$(GNOMECC_PIXMAPS_DIR)\"		\
+	$(AM_CPPFLAGS)
+gnome_typing_monitor_CFLAGS = \
+	@GNOME_CFLAGS@	\
+	$(AM_CFLAGS)
 
 gnome_typing_monitor_LDADD = @GNOME_LIBS@ @SCREENSAVER_LIBS@
 gnome_typing_monitor_LDFLAGS = -export-dynamic
Index: typing-break/drwright.c
===================================================================
RCS file: /cvs/gnome/gnome-control-center/typing-break/drwright.c,v
retrieving revision 1.14
diff -p -u -u -p -r1.14 drwright.c
--- typing-break/drwright.c	9 Jan 2006 12:22:34 -0000	1.14
+++ typing-break/drwright.c	29 Apr 2006 11:08:55 -0000
@@ -35,7 +35,6 @@
 #include "drw-break-window.h"
 #include "drw-monitor.h"
 #include "drw-utils.h"
-#include "eggtrayicon.h"
 
 #define BLINK_TIMEOUT        200
 #define BLINK_TIMEOUT_MIN    120
@@ -85,10 +84,7 @@ struct _DrWright {
 
 	gboolean        blink_on;
 
-	EggTrayIcon    *icon;
-	GtkWidget      *icon_image;
-	GtkWidget      *icon_event_box;
-	GtkTooltips    *tooltips;
+	GtkStatusIcon  *icon;
 
 	GdkPixbuf      *neutral_bar;
 	GdkPixbuf      *red_bar;
@@ -103,9 +99,6 @@ static void     activity_detected_cb    
 						DrWright       *drwright);
 static gboolean maybe_change_state             (DrWright       *drwright);
 static gboolean update_tooltip                 (DrWright       *drwright);
-static gboolean icon_button_press_cb           (GtkWidget      *widget,
-						GdkEventButton *event,
-						DrWright       *drwright);
 static void     break_window_done_cb           (GtkWidget      *window,
 						DrWright       *dr);
 static void     break_window_postpone_cb       (GtkWidget      *window,
@@ -123,7 +116,6 @@ static void     popup_about_cb          
 						GtkWidget      *widget);
 static gchar *  item_factory_trans_cb          (const gchar    *path,
 						gpointer        data);
-static void     init_tray_icon                 (DrWright       *dr);
 static GList *  create_secondary_break_windows (void);
 
 
@@ -159,7 +151,7 @@ update_icon (DrWright *dr)
 	gboolean   set_pixbuf;
 
 	if (!dr->enabled) {
-		gtk_image_set_from_pixbuf (GTK_IMAGE (dr->icon_image), dr->disabled_bar);
+		gtk_status_icon_set_from_pixbuf (dr->icon, dr->disabled_bar);
 		return;
 	}
 	
@@ -225,7 +217,7 @@ update_icon (DrWright *dr)
 			      255);
 	
 	if (set_pixbuf) {
-		gtk_image_set_from_pixbuf (GTK_IMAGE (dr->icon_image), tmp_pixbuf);
+		gtk_status_icon_set_from_pixbuf (dr->icon, tmp_pixbuf);
 	}
 	
 	if (dr->composite_bar) {
@@ -249,9 +241,9 @@ blink_timeout_cb (DrWright *dr)
 	}
 	
 	if (dr->blink_on || timeout == 0) {
-		gtk_image_set_from_pixbuf (GTK_IMAGE (dr->icon_image), dr->composite_bar);
+		gtk_status_icon_set_from_pixbuf (dr->icon, dr->composite_bar);
 	} else {
-		gtk_image_set_from_pixbuf (GTK_IMAGE (dr->icon_image), dr->neutral_bar);
+		gtk_status_icon_set_from_pixbuf (dr->icon, dr->neutral_bar);
 	}
 	
 	dr->blink_on = !dr->blink_on;
@@ -274,8 +266,6 @@ start_blinking (DrWright *dr)
 		dr->blink_on = TRUE;
 		blink_timeout_cb (dr);
 	}
-
-	/*gtk_widget_show (GTK_WIDGET (dr->icon));*/
 }
 
 static void
@@ -285,8 +275,6 @@ stop_blinking (DrWright *dr)
 		g_source_remove (dr->blink_timeout_id);
 		dr->blink_timeout_id = 0;
 	}
-
-	/*gtk_widget_hide (GTK_WIDGET (dr->icon));*/
 }
 
 static gboolean
@@ -331,7 +319,7 @@ maybe_change_state (DrWright *dr)
 			dr->break_window = NULL;
 		}
 
-		gtk_image_set_from_pixbuf (GTK_IMAGE (dr->icon_image), dr->neutral_bar);
+		gtk_status_icon_set_from_pixbuf (dr->icon, dr->neutral_bar);
 
 		g_timer_start (dr->timer);
 		g_timer_start (dr->idle_timer);
@@ -397,7 +385,7 @@ maybe_change_state (DrWright *dr)
 		}
 		
 		stop_blinking (dr);
-		gtk_image_set_from_pixbuf (GTK_IMAGE (dr->icon_image), dr->red_bar);
+		gtk_status_icon_set_from_pixbuf (dr->icon, dr->red_bar);
 
 		g_timer_start (dr->timer);
 
@@ -435,7 +423,7 @@ maybe_change_state (DrWright *dr)
 
 	case STATE_BREAK_DONE_SETUP:
 		stop_blinking (dr);
-		gtk_image_set_from_pixbuf (GTK_IMAGE (dr->icon_image), dr->green_bar);
+		gtk_status_icon_set_from_pixbuf (dr->icon, dr->green_bar);
 
 		dr->state = STATE_BREAK_DONE;
 		break;
@@ -466,9 +454,7 @@ update_tooltip (DrWright *dr)
 	gchar *str;
 
 	if (!dr->enabled) {
-		gtk_tooltips_set_tip (GTK_TOOLTIPS (dr->tooltips),
-				      dr->icon_event_box,
-				      _("Disabled"), _("Disabled"));
+		gtk_status_icon_set_tooltip (dr->icon, _("Disabled"));
 		return TRUE;
 	}
 	
@@ -492,10 +478,8 @@ update_tooltip (DrWright *dr)
 	} else {
 		str = g_strdup_printf (_("Less than one minute until the next break"));
 	}
-	
-	gtk_tooltips_set_tip (GTK_TOOLTIPS (dr->tooltips),
-			      dr->icon_event_box,
-			      str, str);
+
+	gtk_status_icon_set_tooltip (dr->icon, str);
 
 	g_free (str);
 
@@ -589,14 +573,6 @@ popup_preferences_cb (gpointer   callbac
 		g_error_free (error);
 	}
 }
-
-static void
-about_response_cb (GtkWidget *dialog,
-		   gint       response,
-		   gpointer   user_data)
-{
-	gtk_widget_destroy (dialog);
-}
 	
 static void
 popup_about_cb (gpointer   callback_data,
@@ -604,128 +580,39 @@ popup_about_cb (gpointer   callback_data
 		GtkWidget *widget)
 {
 	static GtkWidget *about_window;
-	GtkWidget        *vbox;
-	GtkWidget        *label;
-	GdkPixbuf        *icon;
-	gchar            *markup;
+	const gchar      *authors[] = { "Richard Hult <richard@imendio.com>",
+				        "Anders Carlsson",
+					NULL };
 
 	if (about_window) {
 		gtk_window_present (GTK_WINDOW (about_window));
 		return;
 	}
 	
-	about_window = gtk_dialog_new ();
+	about_window = gtk_about_dialog_new ();
 
 	g_signal_connect (about_window,
 			  "destroy",
                           G_CALLBACK (gtk_widget_destroyed),
 			  &about_window);
-	
-	gtk_dialog_add_button (GTK_DIALOG (about_window),
-			       GTK_STOCK_OK, GTK_RESPONSE_OK);
-	gtk_dialog_set_default_response (GTK_DIALOG (about_window),
-					 GTK_RESPONSE_OK);
-	
-	gtk_window_set_title (GTK_WINDOW (about_window), _("About GNOME Typing Monitor"));
-	icon = NULL; /*gdk_pixbuf_new_from_file (IMAGEDIR "/bar.png", NULL);*/
-	if (icon != NULL) {
-		gtk_window_set_icon (GTK_WINDOW (about_window), icon);
-		g_object_unref (icon);
-	}
-	
-	gtk_window_set_resizable (GTK_WINDOW (about_window), FALSE);
-	gtk_window_set_position (GTK_WINDOW (about_window), 
-				 GTK_WIN_POS_CENTER_ON_PARENT);
-	gtk_window_set_type_hint (GTK_WINDOW (about_window), 
-				  GDK_WINDOW_TYPE_HINT_DIALOG);
-
-	vbox = gtk_vbox_new (FALSE, 0);
-	gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
-	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about_window)->vbox), vbox, FALSE, FALSE, 0);
-
-	label = gtk_label_new (NULL);
-	gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
-	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
-	markup = g_strdup_printf ("<span size=\"xx-large\" weight=\"bold\">Typing Monitor " VERSION "</span>\n\n"
-				  "%s\n\n"
-				  "<span size=\"small\">%s</span>\n"
-				  "<span size=\"small\">%s</span>\n",
-				  _("A computer break reminder."),
-				  _("Written by Richard Hult &lt;richard@imendio.com&gt;"),
-				  _("Eye candy added by Anders Carlsson"));
-	gtk_label_set_markup (GTK_LABEL (label), markup);
-	g_free (markup);
-	gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
-	
-	gtk_widget_show_all (about_window);
-
-	g_signal_connect (about_window,
-			  "response", G_CALLBACK (about_response_cb),
-			  NULL);
-}
-
-static void
-popup_menu_position_cb (GtkMenu  *menu,
-			gint     *x,
-			gint     *y,
-			gboolean *push_in,
-			gpointer  data)
-{
-	GtkWidget      *w = data;
-	GtkRequisition  requisition;
-	gint            wx, wy;
+	g_signal_connect (about_window, "response",
+			  G_CALLBACK (gtk_widget_destroy), NULL);
 
-	g_return_if_fail (w != NULL);
+	g_object_set (G_OBJECT (about_window),
+		      "name", _("Typing Monitor"),
+		      "version", VERSION,
+		      "comments", _("A computer break reminder"),
+		      "copyright", "Copyright \302\251 Richard Hult",
+		      "authors", authors,
+		      NULL);
 
-	gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
-
-	gdk_window_get_origin (w->window, &wx, &wy);
-
-	if (*x < wx)
-		*x = wx;
-	else if (*x > wx + w->allocation.width)
-		*x = wx + w->allocation.width;
-
-	if (*x + requisition.width > gdk_screen_width())
-		*x = gdk_screen_width() - requisition.width;
-
-	if (*y < wy)
-		*y = wy;
-	 else if (*y > wy + w->allocation.height)
-		*y = wy + w->allocation.height;
-
-	if (*y + requisition.height > gdk_screen_height())
-		*y = gdk_screen_height() - requisition.height;
-
-	*push_in = TRUE;
-}
-
-static gboolean
-icon_button_press_cb (GtkWidget      *widget,
-		      GdkEventButton *event,
-		      DrWright       *dr)
-{
-	GtkWidget *menu;
-
-	if (event->button == 3) {
-		menu = gtk_item_factory_get_widget (dr->popup_factory, "");
-
-		gtk_menu_popup (GTK_MENU (menu),
-				NULL,
-				NULL,
-				popup_menu_position_cb,
-				dr->icon,
-				event->button,
-				event->time);
-
-		return TRUE;
-	}
-	
-	return FALSE;
+	gtk_window_present (GTK_WINDOW (about_window));
 }
 
 static void
 popup_menu_cb (GtkWidget *widget,
+	       guint button,
+	       guint32 activate_time,
 	       DrWright  *dr)
 {
 	GtkWidget *menu;
@@ -735,10 +622,10 @@ popup_menu_cb (GtkWidget *widget,
 	gtk_menu_popup (GTK_MENU (menu),
 			NULL,
 			NULL,
-			popup_menu_position_cb,
+			gtk_status_icon_position_menu,
 			dr->icon,
-			0,
-			gtk_get_current_event_time());
+			button,
+			activate_time);
 }
 
 static void
@@ -790,80 +677,6 @@ item_factory_trans_cb (const gchar *path
 	return _((gchar*) path);
 }
 
-static void
-icon_event_box_destroy_cb (GtkWidget *widget,
-			   DrWright  *dr)
-{
-	gtk_widget_destroy (GTK_WIDGET (dr->icon));
-	init_tray_icon (dr);
-}
-
-static gboolean
-icon_event_box_expose_event_cb (GtkWidget      *widget,
-				GdkEventExpose *event,
-				DrWright       *dr)
-{
-	if (GTK_WIDGET_HAS_FOCUS (widget)) {
-		gint focus_width, focus_pad;
-		gint x, y, width, height;
-		
-		gtk_widget_style_get (widget,
-				      "focus-line-width", &focus_width,
-				      "focus-padding", &focus_pad,
-				      NULL);
-		x = widget->allocation.x + focus_pad;
-		y = widget->allocation.y + focus_pad;
-		width = widget->allocation.width - 2 * focus_pad;
-		height = widget->allocation.height - 2 * focus_pad;
-
-		gtk_paint_focus (widget->style, widget->window,
-				 GTK_WIDGET_STATE (widget),
-				 &event->area, widget, "button",
-				 x, y, width, height);
-	}
-
-	return FALSE;
-}
-
-static void
-init_tray_icon (DrWright *dr)
-{
-	dr->icon = egg_tray_icon_new (_("Break reminder"));
-
-	dr->icon_event_box = gtk_event_box_new ();
-	dr->icon_image = gtk_image_new_from_pixbuf (dr->neutral_bar);
-	gtk_container_add (GTK_CONTAINER (dr->icon_event_box), dr->icon_image);
-		
-	gtk_widget_add_events (GTK_WIDGET (dr->icon), GDK_BUTTON_PRESS_MASK | GDK_FOCUS_CHANGE_MASK);
-	gtk_container_add (GTK_CONTAINER (dr->icon), dr->icon_event_box);
-	gtk_widget_show_all (GTK_WIDGET (dr->icon));
-
-	GTK_WIDGET_SET_FLAGS (dr->icon_event_box, GTK_CAN_FOCUS);
-	
-	update_tooltip (dr);
-	update_icon (dr);
-
-	g_signal_connect (dr->icon,
-			  "button_press_event",
-			  G_CALLBACK (icon_button_press_cb),
-			  dr);
-
-	g_signal_connect (dr->icon,
-			  "destroy",
-			  G_CALLBACK (icon_event_box_destroy_cb),
-			  dr);
-
-	g_signal_connect (dr->icon,
-			  "popup_menu",
-			  G_CALLBACK (popup_menu_cb),
-			  dr);
-	
-	g_signal_connect_after (dr->icon_event_box,
-				"expose_event",
-				G_CALLBACK (icon_event_box_expose_event_cb),
-				dr);
-}
-
 static GList *
 create_secondary_break_windows (void)
 {
@@ -981,9 +794,13 @@ drwright_new (void)
 	dr->green_bar = gdk_pixbuf_new_from_file (IMAGEDIR "/bar-green.png", NULL);
 	dr->disabled_bar = gdk_pixbuf_new_from_file (IMAGEDIR "/bar-disabled.png", NULL);
 
-	dr->tooltips = gtk_tooltips_new ();
+	/* no need for new_from_pixbuf, since update_icon will set a pixbuf */
+	dr->icon = gtk_status_icon_new ();
+	g_signal_connect (dr->icon, "popup-menu",
+			  G_CALLBACK (popup_menu_cb), dr);
 
-	init_tray_icon (dr);
+	update_tooltip (dr);
+	update_icon (dr);
 	
 	g_timeout_add (10*1000,
 		       (GSourceFunc) update_tooltip,
@@ -994,4 +811,3 @@ drwright_new (void)
 
 	return dr;
 }
-       
Index: typing-break/eggtrayicon.c
===================================================================
RCS file: typing-break/eggtrayicon.c
diff -N typing-break/eggtrayicon.c
--- typing-break/eggtrayicon.c	8 Oct 2005 16:11:35 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,513 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* eggtrayicon.c
- * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <string.h>
-#include <libintl.h>
-
-#include "eggtrayicon.h"
-
-#include <gdkconfig.h>
-#if defined (GDK_WINDOWING_X11)
-#include <gdk/gdkx.h>
-#include <X11/Xatom.h>
-#elif defined (GDK_WINDOWING_WIN32)
-#include <gdk/gdkwin32.h>
-#endif
-
-#ifndef EGG_COMPILATION
-#ifndef _
-#define _(x) dgettext (GETTEXT_PACKAGE, x)
-#define N_(x) x
-#endif
-#else
-#define _(x) x
-#define N_(x) x
-#endif
-
-#define SYSTEM_TRAY_REQUEST_DOCK    0
-#define SYSTEM_TRAY_BEGIN_MESSAGE   1
-#define SYSTEM_TRAY_CANCEL_MESSAGE  2
-
-#define SYSTEM_TRAY_ORIENTATION_HORZ 0
-#define SYSTEM_TRAY_ORIENTATION_VERT 1
-
-enum {
-  PROP_0,
-  PROP_ORIENTATION
-};
-         
-static GtkPlugClass *parent_class = NULL;
-
-static void egg_tray_icon_init (EggTrayIcon *icon);
-static void egg_tray_icon_class_init (EggTrayIconClass *klass);
-
-static void egg_tray_icon_get_property (GObject    *object,
-					guint       prop_id,
-					GValue     *value,
-					GParamSpec *pspec);
-
-static void egg_tray_icon_realize   (GtkWidget *widget);
-static void egg_tray_icon_unrealize (GtkWidget *widget);
-
-#ifdef GDK_WINDOWING_X11
-static void egg_tray_icon_update_manager_window    (EggTrayIcon *icon,
-						    gboolean     dock_if_realized);
-static void egg_tray_icon_manager_window_destroyed (EggTrayIcon *icon);
-#endif
-
-GType
-egg_tray_icon_get_type (void)
-{
-  static GType our_type = 0;
-
-  if (our_type == 0)
-    {
-      static const GTypeInfo our_info =
-      {
-	sizeof (EggTrayIconClass),
-	(GBaseInitFunc) NULL,
-	(GBaseFinalizeFunc) NULL,
-	(GClassInitFunc) egg_tray_icon_class_init,
-	NULL, /* class_finalize */
-	NULL, /* class_data */
-	sizeof (EggTrayIcon),
-	0,    /* n_preallocs */
-	(GInstanceInitFunc) egg_tray_icon_init
-      };
-
-      our_type = g_type_register_static (GTK_TYPE_PLUG, "EggTrayIcon", &our_info, 0);
-    }
-
-  return our_type;
-}
-
-static void
-egg_tray_icon_init (EggTrayIcon *icon)
-{
-  icon->stamp = 1;
-  icon->orientation = GTK_ORIENTATION_HORIZONTAL;
-  
-  gtk_widget_add_events (GTK_WIDGET (icon), GDK_PROPERTY_CHANGE_MASK);
-}
-
-static void
-egg_tray_icon_class_init (EggTrayIconClass *klass)
-{
-  GObjectClass *gobject_class = (GObjectClass *)klass;
-  GtkWidgetClass *widget_class = (GtkWidgetClass *)klass;
-
-  parent_class = g_type_class_peek_parent (klass);
-
-  gobject_class->get_property = egg_tray_icon_get_property;
-
-  widget_class->realize   = egg_tray_icon_realize;
-  widget_class->unrealize = egg_tray_icon_unrealize;
-
-  g_object_class_install_property (gobject_class,
-				   PROP_ORIENTATION,
-				   g_param_spec_enum ("orientation",
-						      _("Orientation"),
-						      _("The orientation of the tray."),
-						      GTK_TYPE_ORIENTATION,
-						      GTK_ORIENTATION_HORIZONTAL,
-						      G_PARAM_READABLE));
-
-#if defined (GDK_WINDOWING_X11)
-  /* Nothing */
-#elif defined (GDK_WINDOWING_WIN32)
-  g_warning ("Port eggtrayicon to Win32");
-#else
-  g_warning ("Port eggtrayicon to this GTK+ backend");
-#endif
-}
-
-static void
-egg_tray_icon_get_property (GObject    *object,
-			    guint       prop_id,
-			    GValue     *value,
-			    GParamSpec *pspec)
-{
-  EggTrayIcon *icon = EGG_TRAY_ICON (object);
-
-  switch (prop_id)
-    {
-    case PROP_ORIENTATION:
-      g_value_set_enum (value, icon->orientation);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-    }
-}
-
-#ifdef GDK_WINDOWING_X11
-
-static void
-egg_tray_icon_get_orientation_property (EggTrayIcon *icon)
-{
-  Display *xdisplay;
-  Atom type;
-  int format;
-  union {
-	gulong *prop;
-	guchar *prop_ch;
-  } prop = { NULL };
-  gulong nitems;
-  gulong bytes_after;
-  int error, result;
-
-  g_assert (icon->manager_window != None);
-  
-  xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-
-  gdk_error_trap_push ();
-  type = None;
-  result = XGetWindowProperty (xdisplay,
-			       icon->manager_window,
-			       icon->orientation_atom,
-			       0, G_MAXLONG, FALSE,
-			       XA_CARDINAL,
-			       &type, &format, &nitems,
-			       &bytes_after, &(prop.prop_ch));
-  error = gdk_error_trap_pop ();
-
-  if (error || result != Success)
-    return;
-
-  if (type == XA_CARDINAL)
-    {
-      GtkOrientation orientation;
-
-      orientation = (prop.prop [0] == SYSTEM_TRAY_ORIENTATION_HORZ) ?
-					GTK_ORIENTATION_HORIZONTAL :
-					GTK_ORIENTATION_VERTICAL;
-
-      if (icon->orientation != orientation)
-	{
-	  icon->orientation = orientation;
-
-	  g_object_notify (G_OBJECT (icon), "orientation");
-	}
-    }
-
-  if (prop.prop)
-    XFree (prop.prop);
-}
-
-static GdkFilterReturn
-egg_tray_icon_manager_filter (GdkXEvent *xevent, GdkEvent *event, gpointer user_data)
-{
-  EggTrayIcon *icon = user_data;
-  XEvent *xev = (XEvent *)xevent;
-
-  if (xev->xany.type == ClientMessage &&
-      xev->xclient.message_type == icon->manager_atom &&
-      xev->xclient.data.l[1] == icon->selection_atom)
-    {
-      egg_tray_icon_update_manager_window (icon, TRUE);
-    }
-  else if (xev->xany.window == icon->manager_window)
-    {
-      if (xev->xany.type == PropertyNotify &&
-	  xev->xproperty.atom == icon->orientation_atom)
-	{
-	  egg_tray_icon_get_orientation_property (icon);
-	}
-      if (xev->xany.type == DestroyNotify)
-	{
-	  egg_tray_icon_manager_window_destroyed (icon);
-	}
-    }
-  return GDK_FILTER_CONTINUE;
-}
-
-#endif  
-
-static void
-egg_tray_icon_unrealize (GtkWidget *widget)
-{
-#ifdef GDK_WINDOWING_X11
-  EggTrayIcon *icon = EGG_TRAY_ICON (widget);
-  GdkWindow *root_window;
-
-  if (icon->manager_window != None)
-    {
-      GdkWindow *gdkwin;
-
-      gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (widget),
-                                              icon->manager_window);
-
-      gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon);
-    }
-
-  root_window = gdk_screen_get_root_window (gtk_widget_get_screen (widget));
-
-  gdk_window_remove_filter (root_window, egg_tray_icon_manager_filter, icon);
-
-  if (GTK_WIDGET_CLASS (parent_class)->unrealize)
-    (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-#endif
-}
-
-#ifdef GDK_WINDOWING_X11
-
-static void
-egg_tray_icon_send_manager_message (EggTrayIcon *icon,
-				    long         message,
-				    Window       window,
-				    long         data1,
-				    long         data2,
-				    long         data3)
-{
-  XClientMessageEvent ev;
-  Display *display;
-  
-  ev.type = ClientMessage;
-  ev.window = window;
-  ev.message_type = icon->system_tray_opcode_atom;
-  ev.format = 32;
-  ev.data.l[0] = gdk_x11_get_server_time (GTK_WIDGET (icon)->window);
-  ev.data.l[1] = message;
-  ev.data.l[2] = data1;
-  ev.data.l[3] = data2;
-  ev.data.l[4] = data3;
-
-  display = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-  
-  gdk_error_trap_push ();
-  XSendEvent (display,
-	      icon->manager_window, False, NoEventMask, (XEvent *)&ev);
-  XSync (display, False);
-  gdk_error_trap_pop ();
-}
-
-static void
-egg_tray_icon_send_dock_request (EggTrayIcon *icon)
-{
-  egg_tray_icon_send_manager_message (icon,
-				      SYSTEM_TRAY_REQUEST_DOCK,
-				      icon->manager_window,
-				      gtk_plug_get_id (GTK_PLUG (icon)),
-				      0, 0);
-}
-
-static void
-egg_tray_icon_update_manager_window (EggTrayIcon *icon,
-				     gboolean     dock_if_realized)
-{
-  Display *xdisplay;
-  
-  if (icon->manager_window != None)
-    return;
-
-  xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-  
-  XGrabServer (xdisplay);
-  
-  icon->manager_window = XGetSelectionOwner (xdisplay,
-					     icon->selection_atom);
-
-  if (icon->manager_window != None)
-    XSelectInput (xdisplay,
-		  icon->manager_window, StructureNotifyMask|PropertyChangeMask);
-
-  XUngrabServer (xdisplay);
-  XFlush (xdisplay);
-  
-  if (icon->manager_window != None)
-    {
-      GdkWindow *gdkwin;
-
-      gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)),
-					      icon->manager_window);
-      
-      gdk_window_add_filter (gdkwin, egg_tray_icon_manager_filter, icon);
-
-      if (dock_if_realized && GTK_WIDGET_REALIZED (icon))
-	egg_tray_icon_send_dock_request (icon);
-
-      egg_tray_icon_get_orientation_property (icon);
-    }
-}
-
-static void
-egg_tray_icon_manager_window_destroyed (EggTrayIcon *icon)
-{
-  GdkWindow *gdkwin;
-  
-  g_return_if_fail (icon->manager_window != None);
-
-  gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)),
-					  icon->manager_window);
-      
-  gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon);
-
-  icon->manager_window = None;
-
-  egg_tray_icon_update_manager_window (icon, TRUE);
-}
-
-#endif
-
-static void
-egg_tray_icon_realize (GtkWidget *widget)
-{
-#ifdef GDK_WINDOWING_X11
-  EggTrayIcon *icon = EGG_TRAY_ICON (widget);
-  GdkScreen *screen;
-  GdkDisplay *display;
-  Display *xdisplay;
-  char buffer[256];
-  GdkWindow *root_window;
-
-  if (GTK_WIDGET_CLASS (parent_class)->realize)
-    GTK_WIDGET_CLASS (parent_class)->realize (widget);
-
-  screen = gtk_widget_get_screen (widget);
-  display = gdk_screen_get_display (screen);
-  xdisplay = gdk_x11_display_get_xdisplay (display);
-
-  /* Now see if there's a manager window around */
-  g_snprintf (buffer, sizeof (buffer),
-	      "_NET_SYSTEM_TRAY_S%d",
-	      gdk_screen_get_number (screen));
-
-  icon->selection_atom = XInternAtom (xdisplay, buffer, False);
-  
-  icon->manager_atom = XInternAtom (xdisplay, "MANAGER", False);
-  
-  icon->system_tray_opcode_atom = XInternAtom (xdisplay,
-						   "_NET_SYSTEM_TRAY_OPCODE",
-						   False);
-
-  icon->orientation_atom = XInternAtom (xdisplay,
-					"_NET_SYSTEM_TRAY_ORIENTATION",
-					False);
-
-  egg_tray_icon_update_manager_window (icon, FALSE);
-  egg_tray_icon_send_dock_request (icon);
-
-  root_window = gdk_screen_get_root_window (screen);
-  
-  /* Add a root window filter so that we get changes on MANAGER */
-  gdk_window_add_filter (root_window,
-			 egg_tray_icon_manager_filter, icon);
-#endif
-}
-
-EggTrayIcon *
-egg_tray_icon_new_for_screen (GdkScreen *screen, const char *name)
-{
-  g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
-  return g_object_new (EGG_TYPE_TRAY_ICON, "screen", screen, "title", name, NULL);
-}
-
-EggTrayIcon*
-egg_tray_icon_new (const gchar *name)
-{
-  return g_object_new (EGG_TYPE_TRAY_ICON, "title", name, NULL);
-}
-
-guint
-egg_tray_icon_send_message (EggTrayIcon *icon,
-			    gint         timeout,
-			    const gchar *message,
-			    gint         len)
-{
-  guint stamp;
-  
-  g_return_val_if_fail (EGG_IS_TRAY_ICON (icon), 0);
-  g_return_val_if_fail (timeout >= 0, 0);
-  g_return_val_if_fail (message != NULL, 0);
-		     
-#ifdef GDK_WINDOWING_X11
-  if (icon->manager_window == None)
-    return 0;
-#endif
-
-  if (len < 0)
-    len = strlen (message);
-
-  stamp = icon->stamp++;
-  
-#ifdef GDK_WINDOWING_X11
-  /* Get ready to send the message */
-  egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_BEGIN_MESSAGE,
-				      (Window)gtk_plug_get_id (GTK_PLUG (icon)),
-				      timeout, len, stamp);
-
-  /* Now to send the actual message */
-  gdk_error_trap_push ();
-  while (len > 0)
-    {
-      XClientMessageEvent ev;
-      Display *xdisplay;
-
-      xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-      
-      ev.type = ClientMessage;
-      ev.window = (Window)gtk_plug_get_id (GTK_PLUG (icon));
-      ev.format = 8;
-      ev.message_type = XInternAtom (xdisplay,
-				     "_NET_SYSTEM_TRAY_MESSAGE_DATA", False);
-      if (len > 20)
-	{
-	  memcpy (&ev.data, message, 20);
-	  len -= 20;
-	  message += 20;
-	}
-      else
-	{
-	  memcpy (&ev.data, message, len);
-	  len = 0;
-	}
-
-      XSendEvent (xdisplay,
-		  icon->manager_window, False, StructureNotifyMask, (XEvent *)&ev);
-      XSync (xdisplay, False);
-    }
-  gdk_error_trap_pop ();
-#endif
-
-  return stamp;
-}
-
-void
-egg_tray_icon_cancel_message (EggTrayIcon *icon,
-			      guint        id)
-{
-  g_return_if_fail (EGG_IS_TRAY_ICON (icon));
-  g_return_if_fail (id > 0);
-#ifdef GDK_WINDOWING_X11  
-  egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_CANCEL_MESSAGE,
-				      (Window)gtk_plug_get_id (GTK_PLUG (icon)),
-				      id, 0, 0);
-#endif
-}
-
-GtkOrientation
-egg_tray_icon_get_orientation (EggTrayIcon *icon)
-{
-  g_return_val_if_fail (EGG_IS_TRAY_ICON (icon), GTK_ORIENTATION_HORIZONTAL);
-
-  return icon->orientation;
-}
Index: typing-break/eggtrayicon.h
===================================================================
RCS file: typing-break/eggtrayicon.h
diff -N typing-break/eggtrayicon.h
--- typing-break/eggtrayicon.h	8 Oct 2005 16:11:35 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,80 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* eggtrayicon.h
- * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __EGG_TRAY_ICON_H__
-#define __EGG_TRAY_ICON_H__
-
-#include <gtk/gtkplug.h>
-#ifdef GDK_WINDOWING_X11
-#include <gdk/gdkx.h>
-#endif
-
-G_BEGIN_DECLS
-
-#define EGG_TYPE_TRAY_ICON		(egg_tray_icon_get_type ())
-#define EGG_TRAY_ICON(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TRAY_ICON, EggTrayIcon))
-#define EGG_TRAY_ICON_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_TRAY_ICON, EggTrayIconClass))
-#define EGG_IS_TRAY_ICON(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TRAY_ICON))
-#define EGG_IS_TRAY_ICON_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_TRAY_ICON))
-#define EGG_TRAY_ICON_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_TRAY_ICON, EggTrayIconClass))
-	
-typedef struct _EggTrayIcon	  EggTrayIcon;
-typedef struct _EggTrayIconClass  EggTrayIconClass;
-
-struct _EggTrayIcon
-{
-  GtkPlug parent_instance;
-
-  guint stamp;
-  
-#ifdef GDK_WINDOWING_X11
-  Atom selection_atom;
-  Atom manager_atom;
-  Atom system_tray_opcode_atom;
-  Atom orientation_atom;
-  Window manager_window;
-#endif
-  GtkOrientation orientation;
-};
-
-struct _EggTrayIconClass
-{
-  GtkPlugClass parent_class;
-};
-
-GType        egg_tray_icon_get_type       (void);
-
-EggTrayIcon *egg_tray_icon_new_for_screen (GdkScreen   *screen,
-					   const gchar *name);
-
-EggTrayIcon *egg_tray_icon_new            (const gchar *name);
-
-guint        egg_tray_icon_send_message   (EggTrayIcon *icon,
-					   gint         timeout,
-					   const char  *message,
-					   gint         len);
-void         egg_tray_icon_cancel_message (EggTrayIcon *icon,
-					   guint        id);
-
-GtkOrientation egg_tray_icon_get_orientation (EggTrayIcon *icon);
-					    
-G_END_DECLS
-
-#endif /* __EGG_TRAY_ICON_H__ */
