Index: .cvsignore
===================================================================
RCS file: /cvs/gnome/eggcups/.cvsignore,v
retrieving revision 1.3
diff -p -u -B -r1.3 .cvsignore
--- .cvsignore	29 Sep 2004 03:25:53 -0000	1.3
+++ .cvsignore	18 Dec 2006 20:12:35 -0000
@@ -23,3 +23,11 @@ stamp-h1
 *.o
 gnome-default-printer.desktop
 gnome-default-printer
+compile
+config.guess
+config.sub
+depcomp
+install-sh
+ltmain.sh
+missing
+mkinstalldirs
Index: Makefile.am
===================================================================
RCS file: /cvs/gnome/eggcups/Makefile.am,v
retrieving revision 1.15
diff -p -u -B -r1.15 Makefile.am
--- Makefile.am	26 Aug 2005 19:19:48 -0000	1.15
+++ Makefile.am	18 Dec 2006 20:12:35 -0000
@@ -1,12 +1,13 @@
 INCLUDES =					\
-	@EGGCUPS_CFLAGS@			\
+	$(EGGCUPS_CFLAGS)			\
 	-D_BSD_SOURCE				\
 	-D_POSIX_SOURCE				\
 	-D_XOPEN_SOURCE=500			\
 	-DEGGCUPS_CUPS_CONFIG_DIR=\"$(sysconfdir)/cups\" \
-	-DSHARE_DIR=\"$(pkgdatadir)\"		\
-	-DGLADEDIR=\"$(datadir)/eggcups/glade\"	\
-	-DIMAGEDIR=\"$(datadir)/eggcups\"
+	-DSHARE_DIR="\"$(pkgdatadir)\""		\
+	-DGLADEDIR="\"$(pkgdatadir)/glade\""	\
+	-DIMAGEDIR="\"$(pkgdatadir)\""		\
+	-DGNOMELOCALEDIR="\"$(datadir)/locale\""
 
 bin_PROGRAMS = eggcups gnome-default-printer
 
@@ -26,8 +27,6 @@ eggcups_SOURCES = 				\
 	ec-job-list.h				\
 	ec-tray-icon.c				\
 	ec-tray-icon.h				\
-	eggtrayicon.c				\
-	eggtrayicon.h				\
 	ec-driver-prompt.c			\
 	ec-driver-prompt.h			\
 	ec-driver-prompt-dialog.c		\
@@ -44,15 +43,15 @@ BUILT_SOURCES=ec-marshal.c ec-marshal.h
 CLEAN_FILES = $(BUILT_SOURCES)
 
 ec-marshal.c: ec-marshal.list
-	@GLIB_GENMARSHAL@ --prefix=ec_marshal $(srcdir)/ec-marshal.list --header --body > ec-marshal.c
+	$(GLIB_GENMARSHAL) --prefix=ec_marshal $(srcdir)/ec-marshal.list --header --body > ec-marshal.c
 
 ec-marshal.h: ec-marshal.list
-	@GLIB_GENMARSHAL@ --prefix=ec_marshal $(srcdir)/ec-marshal.list --header > ec-marshal.h
+	$(GLIB_GENMARSHAL) --prefix=ec_marshal $(srcdir)/ec-marshal.list --header > ec-marshal.h
 
-eggcups_LDADD = @EGGCUPS_LIBS@ -L/usr/X11R6/lib -lXss -lcups
+eggcups_LDADD = $(EGGCUPS_LIBS) -L/usr/X11R6/lib -lXss -lcups
 eggcups_CFLAGS = -DDBUS_API_SUBJECT_TO_CHANGE
 
-gnome_default_printer_LDADD = @EGGCUPS_LIBS@
+gnome_default_printer_LDADD = $(EGGCUPS_LIBS)
 
 imagedir = $(datadir)/eggcups
 image_DATA = icon.png
@@ -63,7 +62,7 @@ glade_DATA = driverdialog.glade
 dbuspolicydir = $(sysconfdir)/dbus-1/system.d
 dbuspolicy_DATA = printdriverselector.conf
 
-schemadir = @GCONF_SCHEMA_FILE_DIR@
+schemadir = $(GCONF_SCHEMA_FILE_DIR)
 schema_DATA = eggcups.schemas
 
 if GCONF_SCHEMAS_INSTALL
Index: configure.ac
===================================================================
RCS file: /cvs/gnome/eggcups/configure.ac,v
retrieving revision 1.61
diff -p -u -B -r1.61 configure.ac
--- configure.ac	18 Dec 2006 19:19:02 -0000	1.61
+++ configure.ac	18 Dec 2006 20:12:35 -0000
@@ -50,7 +48,7 @@ dnl it too, or it will never make it int
 
 GLIB_REQUIRED=2.4.0
 PANGO_REQUIRED=1.0.99
-GTK_REQUIRED=2.4.0
+GTK_REQUIRED=2.10.0
 GCONF_REQUIRED=2.0.0
 LIBGLADE_REQUIRED=2.0.0
 LIBGNOMEUI_REQUIRED=2.7.2
Index: ec-driver-prompt.c
===================================================================
RCS file: /cvs/gnome/eggcups/ec-driver-prompt.c,v
retrieving revision 1.17
diff -p -u -B -r1.17 ec-driver-prompt.c
--- ec-driver-prompt.c	13 Dec 2006 04:42:57 -0000	1.17
+++ ec-driver-prompt.c	18 Dec 2006 20:12:36 -0000
@@ -42,9 +42,9 @@ static void on_driver_dialog_destroy				
 
 static ECDriverPromptDialog *ec_driver_prompt_create_dialog	(ECDriverPrompt *self);
 
- 
+ #if 0
 static void ec_driver_prompt_config_user_printers		(ECDriverPrompt *self);
-
+#endif
 static gboolean find_user_driver				(const gchar *make, 
 								 const gchar *model, 
 								 gchar **return_make, 
@@ -334,6 +334,7 @@ ec_driver_prompt_dbus_unregister_handler
 	/* do nothing */
 }
 
+#if 0
 /*
  * 'construct_printer_name()' -  creates a name by taking the product name
  *                               and appending it with the usb port number 
@@ -476,6 +477,7 @@ ec_driver_prompt_config_user_printers (E
                 libhal_ctx_free (ctx);
 	}
 }
+#endif
 
 static gboolean
 ec_driver_prompt_dbus_init (ECDriverPrompt *self)
Index: ec-tray-icon.c
===================================================================
RCS file: /cvs/gnome/eggcups/ec-tray-icon.c,v
retrieving revision 1.31
diff -p -u -B -r1.31 ec-tray-icon.c
--- ec-tray-icon.c	13 Dec 2006 04:42:57 -0000	1.31
+++ ec-tray-icon.c	18 Dec 2006 20:12:36 -0000
@@ -5,6 +5,7 @@
  * Copyright (C) 2002, 2003, 2004 Tim Waugh <twaugh@redhat.com>
  * Copyright (C) 2004 Red Hat, Inc.
  * Rewritten by Colin Walters <walters@redhat.com>
+ * Copyright (C) 2006 Christian Persch
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -22,6 +23,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include "config.h"
+
 #define EC_OBJECT_PATH "/com/redhat/PrinterManager"
 #define EC_CONF_SESSION_CUPSD "/apps/eggcups/session_cupsd"
 
@@ -34,7 +37,6 @@
 #include "ec-driver-prompt.h"
 #include <dbus/dbus.h>
 #include <dbus/dbus-glib-lowlevel.h>
-#include "eggtrayicon.h"
 #include <errno.h>
 #include <signal.h>
 #include <stdlib.h>
@@ -63,28 +65,20 @@
 #define BLINK_DURATION_SECONDS 2
 #define BLINK_CHANGE_SECONDS 0.5
 
-G_DEFINE_TYPE(ECTrayIcon, ec_tray_icon, EGG_TYPE_TRAY_ICON)
-
-struct ECTrayIconBlinkContext
-{
-	ECTrayIcon *icon;
-	gboolean blanked;
-	guint count;
-};
+G_DEFINE_TYPE(ECTrayIcon, ec_tray_icon, GTK_TYPE_STATUS_ICON)
 
 static void ec_tray_icon_dispose (GObject *object);
 static void ec_tray_icon_finalize (GObject *object);
+static void ec_tray_icon_activate (GtkStatusIcon *status_icon);
+static void ec_tray_icon_popup_menu (GtkStatusIcon *status_icon, guint button, guint32 timestamp);
 
 static gboolean idle_check_system_dbus (ECTrayIcon *icon);
 static gboolean idle_check_session_dbus (ECTrayIcon *icon);
 static char * item_factory_trans_cb (const gchar *path, gpointer data);
 static void popup_about_cb (gpointer callback_data, guint action, GtkWidget *widget);
 static void menu_hide_cb (ECTrayIcon *icon, guint action, GtkWidget *widget);
-static gboolean icon_button_press_cb (GtkWidget *widget, GdkEventButton *event, ECTrayIcon *icon);
-static void icon_destroy_cb (GtkWidget *widget, gpointer user_data);
 static gboolean sync_state (ECTrayIcon *icon);
-static gboolean idle_blink (struct ECTrayIconBlinkContext *ctxt);
-static void idle_blink_ctxt_destroy (gpointer data);
+static gboolean idle_decrease_blink_counter (gpointer data);
 static gboolean job_visible_func (GtkTreeModel *model, GtkTreeIter *iter, ECTrayIcon *icon);
 static void row_inserted_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, ECTrayIcon *icon);
 static void row_deleted_cb (GtkTreeModel *model, GtkTreePath *path, ECTrayIcon *icon);
@@ -111,20 +105,12 @@ ec_vtable = { &ec_dbus_unregister_handle
 	      NULL };
 
 struct ECTrayIconPrivate {
-	gboolean disposed;
-	
 	/* D-BUS */
 	DBusConnection *system_dbus;
 	DBusConnection *session_dbus;
 
 	char *username;
 
-	/* Widgets. */
-	GtkWidget *ebox;
-	GtkWidget *icon_image;
-	GdkPixbuf *jobs_pixbuf;
-	GdkPixbuf *blank_pixbuf;
-
 #ifdef WITH_SESSION_CUPSD
 	ECCupsManager *cups_manager;
 #endif
@@ -135,36 +121,48 @@ struct ECTrayIconPrivate {
 	ECJobList *list_window;
 
 	GtkItemFactory *popup_factory;
-	GtkTooltips *tips;
 
 	guint idle_check_system_dbus_id;
 	guint idle_check_session_dbus_id;
 	guint idle_hide_id;
-	guint idle_blink_id;
+	guint stop_blinking_timeout_id;
+	guint blink_count;
 
 	ECDriverPrompt *driverprompt;
-};
 
-static GObjectClass *parent_class = NULL;
+	guint sensitive : 1;
+};
 
 static void
 ec_tray_icon_class_init (ECTrayIconClass *klass)
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-	parent_class = g_type_class_peek_parent (klass);
+	GtkStatusIconClass *status_icon_class = GTK_STATUS_ICON_CLASS (klass);
 
 	object_class->dispose = ec_tray_icon_dispose;
 	object_class->finalize = ec_tray_icon_finalize;
+
+	status_icon_class->activate = ec_tray_icon_activate;
+	status_icon_class->popup_menu = ec_tray_icon_popup_menu;
+
+	g_type_class_add_private (object_class, sizeof (ECTrayIconPrivate));
 }
 
 void
 ec_tray_icon_init (ECTrayIcon *icon)
 {
+	ECTrayIconPrivate *priv;
 	char *fname;
 	
-	icon->priv = g_new0 (struct ECTrayIconPrivate, 1);
+	priv = icon->priv = G_TYPE_INSTANCE_GET_PRIVATE (icon, EC_TYPE_TRAY_ICON, ECTrayIconPrivate);
+
+	priv->sensitive = FALSE;
+	priv->blink_count = 0;
 
+	fname = g_build_filename (IMAGEDIR, "icon.png", NULL);
+	gtk_status_icon_set_from_file (GTK_STATUS_ICON (icon), fname);
+	g_free (fname);
+	
 	icon->priv->popup_factory = gtk_item_factory_new (GTK_TYPE_MENU,
 						  "<main>",
 						  NULL);
@@ -178,33 +176,6 @@ ec_tray_icon_init (ECTrayIcon *icon)
 				       popup_items,
 				       icon);
 
-	icon->priv->ebox = gtk_event_box_new ();
-	g_signal_connect_object (G_OBJECT (icon->priv->ebox),
-				 "button_press_event",
-				 G_CALLBACK (icon_button_press_cb),
-				 icon, 0);
-
-	fname = g_build_filename (IMAGEDIR, "icon.png", NULL);
-	icon->priv->jobs_pixbuf = gdk_pixbuf_new_from_file (fname, NULL);
-	g_free (fname);
-	
-	icon->priv->icon_image = gtk_image_new_from_pixbuf (icon->priv->jobs_pixbuf);
-	gtk_container_add (GTK_CONTAINER (icon->priv->ebox), icon->priv->icon_image);
-
-	icon->priv->blank_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
-						   gdk_pixbuf_get_width (icon->priv->jobs_pixbuf),
-						   gdk_pixbuf_get_height (icon->priv->jobs_pixbuf));
-	gdk_pixbuf_fill (icon->priv->blank_pixbuf, 0);
-
-	gtk_container_add (GTK_CONTAINER (icon), icon->priv->ebox);
-
-	icon->priv->tips = gtk_tooltips_new ();
-
-	g_signal_connect_object (G_OBJECT (icon),
-				 "destroy",
-				 G_CALLBACK (icon_destroy_cb),
-				 icon, 0);
-
 	icon->priv->username = g_strdup (g_get_user_name ());
 
 	icon->priv->model = ec_job_model_new ();
@@ -242,20 +213,14 @@ static void
 ec_tray_icon_dispose (GObject *object)
 {
 	ECTrayIcon *icon = EC_TRAY_ICON (object);
+	ECTrayIconPrivate *priv = icon->priv;
 
-	if (icon->priv->disposed)
-		return;
-	icon->priv->disposed = TRUE;
-
-	rb_debug ("disposing");
 	if (icon->priv->system_dbus) {
-		dbus_connection_close (icon->priv->system_dbus);
 		dbus_connection_unref (icon->priv->system_dbus);
 		icon->priv->system_dbus = NULL;
 	}
 
 	if (icon->priv->session_dbus) {
-		dbus_connection_close (icon->priv->session_dbus);
 		dbus_connection_unref (icon->priv->session_dbus);
 		icon->priv->session_dbus = NULL;
 	}
@@ -270,24 +235,31 @@ ec_tray_icon_dispose (GObject *object)
 		icon->priv->idle_check_session_dbus_id = 0;
 	}
 
-	if (icon->priv->idle_blink_id > 0) {
-		g_source_remove (icon->priv->idle_blink_id);
-		icon->priv->idle_blink_id = 0;
+	if (priv->stop_blinking_timeout_id != 0) {
+		g_source_remove (priv->stop_blinking_timeout_id);
+		priv->stop_blinking_timeout_id = 0;
 	}
 
+	gtk_status_icon_set_blinking (GTK_STATUS_ICON (icon), FALSE);
+
 #ifdef WITH_SESSION_CUPSD
-	if (icon->priv->cups_manager)
+	if (icon->priv->cups_manager) {
 		g_object_unref (icon->priv->cups_manager);
+		priv->cups_manager = NULL;
+	}
 #endif
 
-	if (icon->priv->list_window)
+	if (icon->priv->list_window) {
 		g_object_unref (icon->priv->list_window);
+		priv->list_window = NULL;
+	}
 
-	g_object_unref (G_OBJECT (icon->priv->jobs_pixbuf));
-	g_object_unref (G_OBJECT (icon->priv->blank_pixbuf));
-	gtk_object_destroy (GTK_OBJECT (icon->priv->tips));
+	if (priv->model) {
+		g_object_unref (priv->model);
+		priv->model = NULL;
+	}
 
-	g_object_unref (G_OBJECT (icon->priv->model));
+	G_OBJECT_CLASS (ec_tray_icon_parent_class)->dispose (object);
 }
 
 static void
@@ -301,15 +273,13 @@ ec_tray_icon_finalize (GObject *object)
 
 	g_free (icon->priv->username);
 
-	g_free (icon->priv);
-
 	G_OBJECT_CLASS (ec_tray_icon_parent_class)->finalize (object);
 }
        
 ECTrayIcon *
 ec_tray_icon_new (void)
 {
-        return EC_TRAY_ICON (g_object_new (EC_TYPE_TRAY_ICON, "title", "EggCups", NULL));
+        return EC_TRAY_ICON (g_object_new (EC_TYPE_TRAY_ICON, NULL));
 }
 
 static void
@@ -338,8 +308,7 @@ popup_about_cb (gpointer callback_data,
 void
 ec_tray_icon_show_about_window (void)
 {
-#if GTK_CHECK_VERSION(2,6,0)
-	static const gchar *authors[] = {
+	const gchar *authors[] = {
 		"Tim Waugh <twaugh@redhat.com>",
 		"Colin Walters <walters@redhat.com>",
 		"Matthias Clasen <mclasen@redhat.com>",
@@ -361,65 +330,6 @@ ec_tray_icon_show_about_window (void)
 	                       "authors", authors,
 	                       NULL);
 	g_free (copyright);
-#else
-	static GtkWidget *about_window;
-	GtkWidget *vbox;
-	GtkWidget *label;
-	gchar *markup;
-
-	if (about_window) {
-		gtk_window_present (GTK_WINDOW (about_window));
-		return;
-	}
-	
-	about_window = gtk_dialog_new ();
-
-	g_object_add_weak_pointer (G_OBJECT (about_window),
-				   (gpointer *) &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);
-	g_signal_connect (about_window, "response",
-			  G_CALLBACK (gtk_widget_hide), NULL);
-
-	gtk_window_set_title (GTK_WINDOW (about_window), _("About Print Notifier"));
-	
-	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\">%s " VERSION "</span>\n\n"
-				  "%s\n\n"
-				  "<span size=\"small\">%s</span>\n"
-				  "<span size=\"small\">%s</span>\n"
-				  "<span size=\"small\">%s</span>\n"
-				  "<span size=\"small\">%s</span>\n",
-				  _("Print Notifier"),
-				  _("A program for print job notification."),
-				  ("Copyright \xc2\xa9 2002 Tim Waugh &lt;twaugh@redhat.com&gt;"),
-				  ("Copyright \xc2\xa9 2004 Colin Walters &lt;walters@redhat.com&gt;"),
-				  ("Copyright \xc2\xa9 2004 Matthias Clasen &lt;mclasen@redhat.com&gt;"),
-				  _("Based on code by CodeFactory."));
-	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);
-	gtk_dialog_run (GTK_DIALOG (about_window));
-	gtk_widget_hide (about_window);
-#endif
 }
 
 static DBusHandlerResult 
@@ -926,17 +836,21 @@ idle_check_session_dbus (ECTrayIcon *ico
 static void
 row_inserted_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, ECTrayIcon *icon)
 {
+	ECTrayIconPrivate *priv = icon->priv;
+
 	sync_state (icon);
-	if (icon->priv->idle_blink_id == 0) {
-		struct ECTrayIconBlinkContext *ctxt = g_new0 (struct ECTrayIconBlinkContext, 1);
-		ctxt->icon = g_object_ref (icon);
-		ctxt->count = BLINK_DURATION_SECONDS / BLINK_CHANGE_SECONDS;
-		icon->priv->idle_blink_id = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,
-								BLINK_CHANGE_SECONDS * 1000,
-								(GSourceFunc) idle_blink,
-								ctxt,
-								idle_blink_ctxt_destroy);
-							
+
+	/* Reset blink count */
+	priv->blink_count = BLINK_DURATION_SECONDS;
+
+	if (priv->stop_blinking_timeout_id == 0) {
+		priv->stop_blinking_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,
+								     1000,
+								     (GSourceFunc) idle_decrease_blink_counter,
+								     icon,
+								     NULL);
+
+		gtk_status_icon_set_blinking (GTK_STATUS_ICON (icon), TRUE);
 	}
 }
 
@@ -969,7 +883,7 @@ hide_window (ECTrayIcon *icon)
 
 	rb_debug ("hiding window");
 
-	gtk_widget_hide (GTK_WIDGET (icon));
+	gtk_status_icon_set_visible (GTK_STATUS_ICON (icon), FALSE);
 
 	icon->priv->idle_hide_id = 0;
 
@@ -978,53 +892,51 @@ hide_window (ECTrayIcon *icon)
 	return FALSE;
 }
 
-static void
-idle_blink_ctxt_destroy (gpointer data)
-{
-	struct ECTrayIconBlinkContext *ctxt = data;
-	ctxt->icon->priv->idle_blink_id = 0;
-	g_object_unref (ctxt->icon);
-	g_free (ctxt);
-}
-
 static gboolean
-idle_blink (struct ECTrayIconBlinkContext *ctxt)
+idle_decrease_blink_counter (gpointer data)
 {
+	ECTrayIcon *icon = EC_TRAY_ICON (data);
+	ECTrayIconPrivate *priv = icon->priv;
+	gboolean retval = TRUE;
+
 	GDK_THREADS_ENTER ();
-	
-	if (ctxt->count == 0) {
-		gtk_image_set_from_pixbuf (GTK_IMAGE (ctxt->icon->priv->icon_image),
-					   ctxt->icon->priv->jobs_pixbuf);
 
-		GDK_THREADS_LEAVE ();
-		return FALSE;
-	}
+	priv->blink_count--;
+	if (priv->blink_count == 0) {
+		gtk_status_icon_set_blinking (GTK_STATUS_ICON (icon), FALSE);
 
-	ctxt->count--;
-	if (gtk_image_get_pixbuf (GTK_IMAGE (ctxt->icon->priv->icon_image)) == ctxt->icon->priv->blank_pixbuf)
-		gtk_image_set_from_pixbuf (GTK_IMAGE (ctxt->icon->priv->icon_image),
-					   ctxt->icon->priv->jobs_pixbuf);
-	else
-		gtk_image_set_from_pixbuf (GTK_IMAGE (ctxt->icon->priv->icon_image),
-					   ctxt->icon->priv->blank_pixbuf);
+
+		priv->stop_blinking_timeout_id = 0;
+		retval = FALSE;
+	}
 
 	GDK_THREADS_LEAVE ();
-	return TRUE;
+
+	return retval;
 }
 
 static gboolean
 sync_state (ECTrayIcon *icon)
 {
-	guint count = gtk_tree_model_iter_n_children (icon->priv->filtered_model, NULL);
+	GtkStatusIcon *status_icon = GTK_STATUS_ICON (icon);
+	ECTrayIconPrivate *priv = icon->priv;
+	guint count;
 	char *text;
 
+	count = gtk_tree_model_iter_n_children (icon->priv->filtered_model, NULL);
+
 	rb_debug ("%u jobs outstanding", count);
 
-	gtk_widget_set_sensitive (GTK_WIDGET (icon->priv->icon_image), count > 0);
+	priv->sensitive = count > 0;
+
 	if (count > 0) {
-		text = g_strdup_printf (_("%d documents queued"), count);		
-		gtk_widget_show_all (GTK_WIDGET (icon));
-		gtk_widget_show_all (GTK_WIDGET (icon->priv->ebox));
+		text = g_strdup_printf (ngettext ("%d document queued",
+						  "%d documents queued",
+						  count),
+					count);
+
+		gtk_status_icon_set_visible (GTK_STATUS_ICON (icon), TRUE);
+
 		if (icon->priv->idle_hide_id > 0) {
 			g_source_remove (icon->priv->idle_hide_id);
 			icon->priv->idle_hide_id = 0;
@@ -1033,7 +945,7 @@ sync_state (ECTrayIcon *icon)
 		text = g_strdup_printf (_("No documents queued for printing"));
 	} 
 
-	gtk_tooltips_set_tip (icon->priv->tips, GTK_WIDGET (icon), text, NULL);
+	gtk_status_icon_set_tooltip (status_icon, text);
 	g_free (text);
 	
 	if (DISPLAY_TIMEOUT_SECONDS > 0
@@ -1045,72 +957,44 @@ sync_state (ECTrayIcon *icon)
 }
 
 static void
-popup_menu_position_cb (GtkMenu  *menu,
-			gint *x,
-			gint *y,
-			gboolean *push_in,
-			gpointer data)
+ec_tray_icon_activate (GtkStatusIcon *status_icon)
 {
-	GtkWidget *w = GTK_WIDGET (data);
-	GtkRequisition  requisition;
-	gint wx, wy;
-
-	g_return_if_fail (w != 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;
+	ECTrayIcon *icon = EC_TRAY_ICON (status_icon);
+	ECTrayIconPrivate *priv = icon->priv;
 
-	*push_in = TRUE;
-}
+	if (!priv->sensitive)
+		return;
 
-static gboolean
-icon_button_press_cb (GtkWidget *widget,
-		      GdkEventButton *event,
-		      ECTrayIcon *icon)
-{
-	if (event->button == 1) {
-		if (icon->priv->list_window == NULL)
-			icon->priv->list_window = ec_job_list_new (icon->priv->model);
-		gtk_window_present (GTK_WINDOW (icon->priv->list_window));
-	}
-
-	if (event->button == 3) {
-		GtkWidget *menu;
-
-		menu = gtk_item_factory_get_widget (icon->priv->popup_factory, "");
-		gtk_menu_popup (GTK_MENU (menu),
-				NULL,
-				NULL,
-				popup_menu_position_cb,
-				icon,
-				event->button,
-				event->time);
+	if (priv->list_window == NULL) {
+		priv->list_window = ec_job_list_new (priv->model);
 	}
 
-	return FALSE;
+	gtk_window_present (GTK_WINDOW (priv->list_window));
 }
 
 static void
-icon_destroy_cb (GtkWidget *widget, gpointer user_data)
-{
-	gtk_main_quit ();
+ec_tray_icon_popup_menu (GtkStatusIcon *status_icon,
+			 guint button,
+			 guint32 timestamp)
+{
+	ECTrayIcon *icon = EC_TRAY_ICON (status_icon);
+	ECTrayIconPrivate *priv = icon->priv;
+	GtkWidget *menu;
+
+	if (!priv->sensitive)
+		return;
+
+	menu = gtk_item_factory_get_widget (priv->popup_factory, "");
+	gtk_menu_popup (GTK_MENU (menu),
+			NULL,
+			NULL,
+			gtk_status_icon_position_menu,
+			status_icon,
+			button,
+			timestamp);
+	if (button == 0) {
+		gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
+	}
 }
 
 static char *
Index: ec-tray-icon.h
===================================================================
RCS file: /cvs/gnome/eggcups/ec-tray-icon.h,v
retrieving revision 1.1.1.1
diff -p -u -B -r1.1.1.1 ec-tray-icon.h
--- ec-tray-icon.h	15 Jul 2004 17:46:55 -0000	1.1.1.1
+++ ec-tray-icon.h	18 Dec 2006 20:12:36 -0000
@@ -24,8 +24,7 @@
 #ifndef __EC_TRAY_ICON__
 #define __EC_TRAY_ICON__
 
-#include "eggtrayicon.h"
-#include "config.h"
+#include <gtk/gtkstatusicon.h>
 
 G_BEGIN_DECLS
 
@@ -40,14 +39,14 @@ typedef struct ECTrayIconPrivate ECTrayI
 
 typedef struct
 {
-	EggTrayIcon parent;
+	GtkStatusIcon parent;
 
 	ECTrayIconPrivate *priv;
 } ECTrayIcon;
 
 typedef struct
 {
-	EggTrayIconClass parent;
+	GtkStatusIconClass parent;
 } ECTrayIconClass;
 
 GType       ec_tray_icon_get_type (void);
Index: eggtrayicon.c
===================================================================
RCS file: eggtrayicon.c
diff -N eggtrayicon.c
--- eggtrayicon.c	13 Dec 2006 04:42:57 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,515 +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 <gdk/gdkx.h>
-#include <X11/Xatom.h>
-
-#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);
-
-static void egg_tray_icon_add (GtkContainer *container,
-			       GtkWidget    *widget);
-
-static void egg_tray_icon_update_manager_window (EggTrayIcon *icon);
-
-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;
-  GtkContainerClass *container_class = (GtkContainerClass *)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;
-
-  container_class->add = egg_tray_icon_add;
-
-  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));
-}
-
-static gboolean
-transparent_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
-{
-  gdk_window_clear_area (widget->window, event->area.x, event->area.y,
-			 event->area.width, event->area.height);
-  return FALSE;
-}
-
-static void
-make_transparent_again (GtkWidget *widget, GtkStyle *previous_style,
-			gpointer user_data)
-{
-  gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
-}
-
-static void
-make_transparent (GtkWidget *widget, gpointer user_data)
-{
-  if (GTK_WIDGET_NO_WINDOW (widget) || GTK_WIDGET_APP_PAINTABLE (widget))
-    return;
-
-  gtk_widget_set_app_paintable (widget, TRUE);
-  gtk_widget_set_double_buffered (widget, FALSE);
-  gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
-  g_signal_connect (widget, "expose_event",
-		    G_CALLBACK (transparent_expose_event), NULL);
-  g_signal_connect_after (widget, "style_set",
-			  G_CALLBACK (make_transparent_again), NULL);
-}	
-
-
-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;
-    }
-}
-
-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);
-    }
-  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_update_manager_window (icon);
-	}
-    }
-  
-  return GDK_FILTER_CONTINUE;
-}
-
-static void
-egg_tray_icon_unrealize (GtkWidget *widget)
-{
-  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);
-}
-
-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)
-{
-  Display *xdisplay;
-  
-  xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-  
-  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_remove_filter (gdkwin, egg_tray_icon_manager_filter, 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);
-
-      /* Send a request that we'd like to dock */
-      egg_tray_icon_send_dock_request (icon);
-
-      egg_tray_icon_get_orientation_property (icon);
-    }
-}
-
-static void
-egg_tray_icon_realize (GtkWidget *widget)
-{
-  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);
-
-  make_transparent (widget, NULL);
-  
-  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);
-
-  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);
-}
-
-static void
-egg_tray_icon_add (GtkContainer *container, GtkWidget *widget)
-{
-  g_signal_connect (widget, "realize",
-		    G_CALLBACK (make_transparent), NULL);
-  GTK_CONTAINER_CLASS (parent_class)->add (container, widget);
-}
-
-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);
-		     
-  if (icon->manager_window == None)
-    return 0;
-
-  if (len < 0)
-    len = strlen (message);
-
-  stamp = icon->stamp++;
-  
-  /* 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 ();
-
-  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);
-  
-  egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_CANCEL_MESSAGE,
-				      (Window)gtk_plug_get_id (GTK_PLUG (icon)),
-				      id, 0, 0);
-}
-
-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: eggtrayicon.h
===================================================================
RCS file: eggtrayicon.h
diff -N eggtrayicon.h
--- eggtrayicon.h	15 Jul 2004 17:46:55 -0000	1.1.1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,77 +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>
-#include <gdk/gdkx.h>
-
-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;
-  
-  Atom selection_atom;
-  Atom manager_atom;
-  Atom system_tray_opcode_atom;
-  Atom orientation_atom;
-  Window manager_window;
-
-  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__ */
Index: gnome-default-printer.c
===================================================================
RCS file: /cvs/gnome/eggcups/gnome-default-printer.c,v
retrieving revision 1.3
diff -p -u -B -r1.3 gnome-default-printer.c
--- gnome-default-printer.c	30 Sep 2004 19:46:50 -0000	1.3
+++ gnome-default-printer.c	18 Dec 2006 20:12:37 -0000
@@ -222,7 +222,7 @@ main (int argc, char **argv) 
 	GtkCellRenderer *rend;
 	GtkWidget *view;
 
-	bindtextdomain (GETTEXT_PACKAGE, EGGCUPS_LOCALEDIR);
+	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
Index: main.c
===================================================================
RCS file: /cvs/gnome/eggcups/main.c,v
retrieving revision 1.11
diff -p -u -B -r1.11 main.c
--- main.c	13 Dec 2006 04:42:57 -0000	1.11
+++ main.c	18 Dec 2006 20:12:37 -0000
@@ -37,26 +37,13 @@
 #include <dbus/dbus.h>
 #include <dbus/dbus-glib-lowlevel.h>
 
-gboolean debug = 0;
-gboolean show = 0;
+static gboolean debug = FALSE;
+static gboolean show = FALSE;
 static ECTrayIcon *icon;
 
-static gboolean tray_destroy_cb (GtkWidget *win, GdkEventAny *event, gpointer unused);
-
-static void
-destroy_icon (void)
-{
-	if (icon) {
-		rb_debug ("destroying icon!");
-		gtk_widget_destroy (GTK_WIDGET (icon));
-		icon = NULL;
-	}
-}
-
 static gboolean
 session_die (GnomeClient *client, gpointer client_data)
 {
-	destroy_icon ();
 	gtk_main_quit ();
 
 	return TRUE;
@@ -88,7 +75,6 @@ handle_die_signal (GIOChannel *src,
 	rb_debug ("got die input");
 	g_io_channel_read_chars (src, buf, 1, &read, NULL);
 
-	destroy_icon ();
 	gtk_main_quit ();
 
 	return TRUE;
@@ -97,6 +83,7 @@ handle_die_signal (GIOChannel *src,
 int
 main (int argc, char *argv[])
 {
+	GnomeProgram *program;
 	GnomeClient *client;
 	GPtrArray *restart_argv;
 	char *dotdir;
@@ -105,23 +92,28 @@ main (int argc, char *argv[])
 	DBusConnection *dbus = NULL;
 	dbus_uint32_t acquisition_result;
 	DBusError error;
+	GOptionContext *context;
 
-	const struct poptOption popt_options[] =
+	const GOptionEntry entries[] =
 	{
-		{ "debug", 'd', POPT_ARG_NONE, &debug, 0, N_("Enable debugging information"), NULL },
-		{ "show", 's', POPT_ARG_NONE, &show, 0, N_("Show icon by default"), NULL },
-		POPT_TABLEEND
+		{ "debug", 'd', 0, G_OPTION_ARG_NONE, N_("Enable debugging information"), NULL },
+		{ "show", 's', 0, G_OPTION_ARG_NONE, &show, N_("Show icon by default"), NULL },
+		{ NULL }
 	};
 
-	bindtextdomain (GETTEXT_PACKAGE, EGGCUPS_LOCALEDIR);  
+	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
-	gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE, 
-			    argc, argv, 
-			    GNOME_PARAM_POPT_TABLE, popt_options,
-			    GNOME_PARAM_HUMAN_READABLE_NAME, _("Print Notifier"),
-			    NULL);
+	context = g_option_context_new (" - Print Notifier");
+	g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+
+	program = gnome_program_init (PACKAGE, VERSION,
+				      LIBGNOMEUI_MODULE,
+				      argc, argv,
+				      GNOME_PARAM_GOPTION_CONTEXT, context,
+				      GNOME_PARAM_HUMAN_READABLE_NAME, _("Print Notifier"),
+				      NULL);
 
 	rb_debug_init (debug);
 
@@ -174,7 +166,7 @@ main (int argc, char *argv[])
 	if (!g_file_test (dotdir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
 		if (mkdir (dotdir, 0750) < 0) {
 			g_critical ("Couldn't create .eggcups directory");
-			exit (1);
+			goto lose;
 		}
 	}
 	g_free (dotdir);
@@ -197,7 +189,7 @@ main (int argc, char *argv[])
 	g_ptr_array_free (restart_argv, TRUE);
 	gnome_client_set_restart_style (client, GNOME_RESTART_IMMEDIATELY);
 
-	tray_destroy_cb (NULL, NULL, NULL);
+	icon = ec_tray_icon_new ();
 
 	die_io_channel = g_io_channel_unix_new (die_fds[0]);
 	g_io_add_watch (die_io_channel, G_IO_IN | G_IO_ERR,
@@ -205,31 +197,13 @@ main (int argc, char *argv[])
 
 	gtk_main ();
 
+	g_object_unref (icon);
+	g_object_unref (program);
+
 	exit (0);
  lose:
 	gnome_client_set_restart_style (client, GNOME_RESTART_NEVER);
-	exit (1);
-}
-
-static gboolean
-tray_destroy_cb (GtkWidget *win, GdkEventAny *event, gpointer unused)
-{
-	icon = NULL;
-
-	if (icon) {
-		rb_debug ("caught delete_event for tray icon");
-		gtk_widget_destroy (GTK_WIDGET (icon));
-	}
+ 	g_object_unref (program);
 
-	rb_debug ("creating new tray icon");
-	icon = ec_tray_icon_new ();
-	gtk_object_sink (GTK_OBJECT (icon));
- 	g_signal_connect_object (G_OBJECT (icon), "destroy-event",
-				 G_CALLBACK (tray_destroy_cb), NULL, 0);
-	if (show) {
-		gtk_widget_show_all (GTK_WIDGET (icon));
-	}
- 
- 	return TRUE;
+	exit (1);
 }
-
Index: po/.cvsignore
===================================================================
RCS file: /cvs/gnome/eggcups/po/.cvsignore,v
retrieving revision 1.1
diff -p -u -B -r1.1 .cvsignore
--- po/.cvsignore	15 Jul 2004 20:52:20 -0000	1.1
+++ po/.cvsignore	18 Dec 2006 20:12:37 -0000
@@ -13,3 +13,4 @@ notexist
 po2tbl.sed
 po2tbl.sed.in
 stamp-cat-id
+stamp-it

