aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-03-20 23:45:25 +0800
committerChristian Persch <chpe@src.gnome.org>2006-03-20 23:45:25 +0800
commitc502325d46776394ad1208a7ec44f8a91dad30f8 (patch)
treea4b1ceba38f2aba4fbad5999866a648162e86d53 /lib
parent6ea171cfee81802366862fee5e15c65d3c393c57 (diff)
downloadgsoc2013-epiphany-c502325d46776394ad1208a7ec44f8a91dad30f8.tar
gsoc2013-epiphany-c502325d46776394ad1208a7ec44f8a91dad30f8.tar.gz
gsoc2013-epiphany-c502325d46776394ad1208a7ec44f8a91dad30f8.tar.bz2
gsoc2013-epiphany-c502325d46776394ad1208a7ec44f8a91dad30f8.tar.lz
gsoc2013-epiphany-c502325d46776394ad1208a7ec44f8a91dad30f8.tar.xz
gsoc2013-epiphany-c502325d46776394ad1208a7ec44f8a91dad30f8.tar.zst
gsoc2013-epiphany-c502325d46776394ad1208a7ec44f8a91dad30f8.zip
Use GtkStatusIcon.
2006-03-20 Christian Persch <chpe@cvs.gnome.org> * embed/downloader-view.c: (status_icon_popup_menu_cb), (show_status_icon), (downloader_view_init), (downloader_view_finalize), (update_status_icon), (download_changed_cb), (downloader_view_add_download), (downloader_view_remove_download), (download_dialog_delete_event_cb): Use GtkStatusIcon. * lib/egg/Makefile.am: * lib/egg/eggstatusicon.c: * lib/egg/eggstatusicon.h: * lib/egg/eggtrayicon.c: * lib/egg/eggtrayicon.h: * lib/egg/eggtraymanager.c: * lib/egg/eggtraymanager.h: Remove egg status icons files.
Diffstat (limited to 'lib')
-rw-r--r--lib/egg/Makefile.am10
-rw-r--r--lib/egg/eggstatusicon.c782
-rw-r--r--lib/egg/eggstatusicon.h102
-rw-r--r--lib/egg/eggtrayicon.c495
-rw-r--r--lib/egg/eggtrayicon.h80
-rw-r--r--lib/egg/eggtraymanager.c726
-rw-r--r--lib/egg/eggtraymanager.h93
7 files changed, 2 insertions, 2286 deletions
diff --git a/lib/egg/Makefile.am b/lib/egg/Makefile.am
index cf04e9bda..bb50e0915 100644
--- a/lib/egg/Makefile.am
+++ b/lib/egg/Makefile.am
@@ -2,19 +2,13 @@ EGGSOURCES = \
eggtreemultidnd.c \
egg-editable-toolbar.c \
egg-toolbars-model.c \
- egg-toolbar-editor.c \
- eggstatusicon.c \
- eggtrayicon.c \
- eggtraymanager.c
+ egg-toolbar-editor.c
EGGHEADERS = \
eggtreemultidnd.h \
egg-editable-toolbar.h \
egg-toolbars-model.h \
- egg-toolbar-editor.h \
- eggstatusicon.h \
- eggtrayicon.h \
- eggtraymanager.h
+ egg-toolbar-editor.h
noinst_HEADERS = \
$(EGGHEADERS) \
diff --git a/lib/egg/eggstatusicon.c b/lib/egg/eggstatusicon.c
deleted file mode 100644
index b336a6676..000000000
--- a/lib/egg/eggstatusicon.c
+++ /dev/null
@@ -1,782 +0,0 @@
-/* eggstatusicon.c:
- *
- * Copyright (C) 2003 Sun Microsystems, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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.
- *
- * Authors:
- * Mark McLoughlin <mark@skynet.ie>
- */
-
-#include <config.h>
-#include <string.h>
-#include <libintl.h>
-
-#include "eggstatusicon.h"
-
-#include <gtk/gtk.h>
-#include "eggmarshalers.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 P_(x) x
-
-enum{
- PROP_0,
- PROP_PIXBUF,
- PROP_FILE,
- PROP_STOCK,
- PROP_PIXBUF_ANIMATION,
- PROP_STORAGE_TYPE,
- PROP_SIZE,
- PROP_BLINKING
-};
-
-enum {
- ACTIVATE_SIGNAL,
- POPUP_MENU_SIGNAL,
- SIZE_CHANGED_SIGNAL,
- LAST_SIGNAL
-};
-
-struct _EggStatusIconPrivate
-{
- GtkWidget *tray_icon;
- GtkWidget *image;
- gint size;
-
- GtkTooltips *tooltips;
-
- GtkImageType image_type;
-
- union
- {
- GdkPixbuf *pixbuf;
- const gchar *stock_id;
- GdkPixbufAnimation *animimation;
- } image_data;
-
- GdkPixbuf *blank_icon;
- guint blinking_timeout;
-
- guint blinking : 1;
- guint blink_off : 1;
-};
-
-static void egg_status_icon_class_init (EggStatusIconClass *klass);
-static void egg_status_icon_init (EggStatusIcon *status_icon);
-
-static void egg_status_icon_finalize (GObject *object);
-static void egg_status_icon_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void egg_status_icon_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-static void egg_status_icon_size_allocate (EggStatusIcon *status_icon,
- GtkAllocation *allocation);
-static gboolean egg_status_icon_button_press (EggStatusIcon *status_icon,
- GdkEventButton *event);
-static void egg_status_icon_disable_blinking (EggStatusIcon *status_icon);
-static void egg_status_icon_reset_image_data (EggStatusIcon *status_icon);
-static gboolean emit_popup_menu_signal (EggStatusIcon *status_icon);
-
-static GObjectClass *parent_class = NULL;
-static guint status_icon_signals [LAST_SIGNAL] = { 0 };
-
-GType
-egg_status_icon_get_type (void)
-{
- static GType status_icon_type = 0;
-
- if (!status_icon_type)
- {
- static const GTypeInfo status_icon_info =
- {
- sizeof (EggStatusIconClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) egg_status_icon_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EggStatusIcon),
- 0, /* n_preallocs */
- (GInstanceInitFunc) egg_status_icon_init,
- };
-
- status_icon_type = g_type_register_static (G_TYPE_OBJECT,
- "EggStatusIcon",
- &status_icon_info, 0);
- }
-
- return status_icon_type;
-}
-
-static void
-egg_status_icon_class_init (EggStatusIconClass *klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->finalize = egg_status_icon_finalize;
- gobject_class->set_property = egg_status_icon_set_property;
- gobject_class->get_property = egg_status_icon_get_property;
-
- g_object_class_install_property (gobject_class,
- PROP_PIXBUF,
- g_param_spec_object ("pixbuf",
- P_("Pixbuf"),
- P_("A GdkPixbuf to display"),
- GDK_TYPE_PIXBUF,
- G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
- g_object_class_install_property (gobject_class,
- PROP_FILE,
- g_param_spec_string ("file",
- P_("Filename"),
- P_("Filename to load and display"),
- NULL,
- G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
- g_object_class_install_property (gobject_class,
- PROP_STOCK,
- g_param_spec_string ("stock",
- P_("Stock ID"),
- P_("Stock ID for a stock image to display"),
- NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
- g_object_class_install_property (gobject_class,
- PROP_PIXBUF_ANIMATION,
- g_param_spec_object ("pixbuf-animation",
- P_("Animation"),
- P_("GdkPixbufAnimation to display"),
- GDK_TYPE_PIXBUF_ANIMATION,
- G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
- g_object_class_install_property (gobject_class,
- PROP_STORAGE_TYPE,
- g_param_spec_enum ("image-type",
- P_("Image type"),
- P_("The representation being used for image data"),
- GTK_TYPE_IMAGE_TYPE,
- GTK_IMAGE_EMPTY,
- G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
- g_object_class_install_property (gobject_class,
- PROP_SIZE,
- g_param_spec_int ("size",
- P_("Size"),
- P_("The size of the icon"),
- G_MININT,
- G_MAXINT,
- 0,
- G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
- g_object_class_install_property (gobject_class,
- PROP_BLINKING,
- g_param_spec_boolean ("blinking",
- P_("Blinking"),
- P_("Whether or not the status icon is blinking"),
- FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
- status_icon_signals [ACTIVATE_SIGNAL] =
- g_signal_new ("activate",
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (EggStatusIconClass, activate),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
- status_icon_signals [POPUP_MENU_SIGNAL] =
- g_signal_new ("popup-menu",
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggStatusIconClass, popup_menu),
- g_signal_accumulator_true_handled,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_BOOLEAN,
- 0);
-
- status_icon_signals [SIZE_CHANGED_SIGNAL] =
- g_signal_new ("size-changed",
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EggStatusIconClass, size_changed),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE,
- 1,
- G_TYPE_INT);
-}
-
-static void
-egg_status_icon_init (EggStatusIcon *status_icon)
-{
- status_icon->priv = g_new0 (EggStatusIconPrivate, 1);
-
- status_icon->priv->image_type = GTK_IMAGE_EMPTY;
- status_icon->priv->size = G_MAXINT;
-
- status_icon->tray_icon = GTK_WIDGET (egg_tray_icon_new (NULL));
- g_object_ref (status_icon->tray_icon);
- gtk_object_sink (GTK_OBJECT (status_icon->tray_icon));
-
- gtk_widget_add_events (GTK_WIDGET (status_icon->tray_icon),
- GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
-
- g_signal_connect_swapped (status_icon->tray_icon, "button-press-event",
- G_CALLBACK (egg_status_icon_button_press), status_icon);
- g_signal_connect_swapped (status_icon->tray_icon, "popup-menu",
- G_CALLBACK (emit_popup_menu_signal), status_icon);
- status_icon->priv->image = gtk_image_new ();
- gtk_container_add (GTK_CONTAINER (status_icon->tray_icon),
- status_icon->priv->image);
-
- g_signal_connect_swapped (status_icon->priv->image, "size-allocate",
- G_CALLBACK (egg_status_icon_size_allocate), status_icon);
-
- gtk_widget_show (status_icon->priv->image);
- gtk_widget_show (status_icon->tray_icon);
-
- status_icon->priv->tooltips = gtk_tooltips_new ();
- g_object_ref (status_icon->priv->tooltips);
- gtk_object_sink (GTK_OBJECT (status_icon->priv->tooltips));
-}
-
-static void
-egg_status_icon_finalize (GObject *object)
-{
- EggStatusIcon *status_icon = EGG_STATUS_ICON (object);
-
- egg_status_icon_disable_blinking (status_icon);
-
- egg_status_icon_reset_image_data (status_icon);
-
- if (status_icon->priv->blank_icon)
- g_object_unref (status_icon->priv->blank_icon);
- status_icon->priv->blank_icon = NULL;
-
- if (status_icon->priv->tooltips)
- g_object_unref (status_icon->priv->tooltips);
- status_icon->priv->tooltips = NULL;
-
- gtk_widget_destroy (status_icon->tray_icon);
- g_object_unref (status_icon->tray_icon);
-
- g_free (status_icon->priv);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-egg_status_icon_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EggStatusIcon *status_icon = EGG_STATUS_ICON (object);
-
- switch (prop_id)
- {
- case PROP_PIXBUF:
- egg_status_icon_set_from_pixbuf (status_icon, g_value_get_object (value));
- break;
- case PROP_FILE:
- egg_status_icon_set_from_file (status_icon, g_value_get_string (value));
- break;
- case PROP_STOCK:
- egg_status_icon_set_from_stock (status_icon, g_value_get_string (value));
- break;
- case PROP_PIXBUF_ANIMATION:
- egg_status_icon_set_from_animation (status_icon, g_value_get_object (value));
- break;
- case PROP_BLINKING:
- egg_status_icon_set_is_blinking (status_icon, g_value_get_boolean (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-egg_status_icon_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EggStatusIcon *status_icon = EGG_STATUS_ICON (object);
-
- switch (prop_id)
- {
- case PROP_PIXBUF:
- g_value_set_object (value, egg_status_icon_get_pixbuf (status_icon));
- break;
- case PROP_STOCK:
- g_value_set_string (value, egg_status_icon_get_stock (status_icon));
- break;
- case PROP_PIXBUF_ANIMATION:
- g_value_set_object (value, egg_status_icon_get_animation (status_icon));
- break;
- case PROP_STORAGE_TYPE:
- g_value_set_enum (value, egg_status_icon_get_image_type (status_icon));
- break;
- case PROP_SIZE:
- g_value_set_int (value, status_icon->priv->size);
- break;
- case PROP_BLINKING:
- g_value_set_boolean (value, status_icon->priv->blinking);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-EggStatusIcon *
-egg_status_icon_new (void)
-{
- return g_object_new (EGG_TYPE_STATUS_ICON, NULL);
-}
-
-EggStatusIcon *
-egg_status_icon_new_from_pixbuf (GdkPixbuf *pixbuf)
-{
- return g_object_new (EGG_TYPE_STATUS_ICON,
- "pixbuf", pixbuf,
- NULL);
-}
-
-EggStatusIcon *
-egg_status_icon_new_from_file (const gchar *filename)
-{
- return g_object_new (EGG_TYPE_STATUS_ICON,
- "file", filename,
- NULL);
-}
-
-EggStatusIcon *
-egg_status_icon_new_from_stock (const gchar *stock_id)
-{
- return g_object_new (EGG_TYPE_STATUS_ICON,
- "stock", stock_id,
- NULL);
-}
-
-EggStatusIcon *
-egg_status_icon_new_from_animation (GdkPixbufAnimation *animation)
-{
- return g_object_new (EGG_TYPE_STATUS_ICON,
- "pixbuf_animation", animation,
- NULL);
-}
-
-static void
-emit_activate_signal (EggStatusIcon *status_icon)
-{
- g_signal_emit (status_icon, status_icon_signals [ACTIVATE_SIGNAL], 0);
-}
-
-static gboolean
-emit_popup_menu_signal (EggStatusIcon *status_icon)
-{
- gboolean retval = FALSE;
-
- g_signal_emit (status_icon, status_icon_signals [POPUP_MENU_SIGNAL], 0,
- &retval);
-
- return retval;
-}
-
-static gboolean
-emit_size_changed_signal (EggStatusIcon *status_icon,
- gint size)
-{
- gboolean handled = FALSE;
-
- g_signal_emit (status_icon,
- status_icon_signals [SIZE_CHANGED_SIGNAL], 0,
- size,
- &handled);
-
- return handled;
-}
-
-static GdkPixbuf *
-egg_status_icon_blank_icon (EggStatusIcon *status_icon)
-{
- if (status_icon->priv->blank_icon)
- {
- gint width, height;
-
- width = gdk_pixbuf_get_width (status_icon->priv->blank_icon);
- height = gdk_pixbuf_get_width (status_icon->priv->blank_icon);
-
- if (width == status_icon->priv->size &&
- height == status_icon->priv->size)
- {
- return status_icon->priv->blank_icon;
- }
- else
- {
- g_object_unref (status_icon->priv->blank_icon);
- status_icon->priv->blank_icon = NULL;
- }
- }
-
- status_icon->priv->blank_icon = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
- status_icon->priv->size,
- status_icon->priv->size);
- if (status_icon->priv->blank_icon)
- gdk_pixbuf_fill (status_icon->priv->blank_icon, 0);
-
- return status_icon->priv->blank_icon;
-}
-
-static void
-egg_status_icon_update_image (EggStatusIcon *status_icon)
-{
- if (status_icon->priv->blink_off)
- {
- gtk_image_set_from_pixbuf (GTK_IMAGE (status_icon->priv->image),
- egg_status_icon_blank_icon (status_icon));
- return;
- }
-
- switch (status_icon->priv->image_type)
- {
- case GTK_IMAGE_PIXBUF:
- {
- GdkPixbuf *pixbuf;
-
- pixbuf = status_icon->priv->image_data.pixbuf;
-
- if (pixbuf)
- {
- GdkPixbuf *scaled;
- gint size;
- gint width;
- gint height;
-
- size = status_icon->priv->size;
-
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
-
- if (width > size || height > size)
- {
- scaled = gdk_pixbuf_scale_simple (pixbuf,
- MIN (size, width),
- MIN (size, height),
- GDK_INTERP_BILINEAR);
- }
- else
- {
- scaled = g_object_ref (pixbuf);
- }
-
- gtk_image_set_from_pixbuf (GTK_IMAGE (status_icon->priv->image), scaled);
-
- g_object_unref (scaled);
- }
- else
- {
- gtk_image_set_from_pixbuf (GTK_IMAGE (status_icon->priv->image), NULL);
- }
- }
- break;
- case GTK_IMAGE_STOCK:
- case GTK_IMAGE_ANIMATION:
- case GTK_IMAGE_EMPTY:
- gtk_image_set_from_pixbuf (GTK_IMAGE (status_icon->priv->image), NULL);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-}
-
-static void
-egg_status_icon_size_allocate (EggStatusIcon *status_icon,
- GtkAllocation *allocation)
-{
- GtkOrientation orientation;
- gint size;
-
- orientation = egg_tray_icon_get_orientation (EGG_TRAY_ICON (status_icon->tray_icon));
-
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
- size = allocation->height;
- else
- size = allocation->width;
-
- if (status_icon->priv->size != size)
- {
- status_icon->priv->size = size;
-
- g_object_notify (G_OBJECT (status_icon), "size");
-
- if (!emit_size_changed_signal (status_icon, size))
- {
- egg_status_icon_update_image (status_icon);
- }
- }
-}
-
-static gboolean
-egg_status_icon_button_press (EggStatusIcon *status_icon,
- GdkEventButton *event)
-{
- gboolean handled = FALSE;
- if (event->button == 1 && event->type == GDK_2BUTTON_PRESS)
- {
- emit_activate_signal (status_icon);
- handled = TRUE;
- }
- else if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
- {
- handled = emit_popup_menu_signal (status_icon);
- }
-
- return handled;
-}
-
-static void
-egg_status_icon_reset_image_data (EggStatusIcon *status_icon)
-{
- switch (status_icon->priv->image_type)
- {
- case GTK_IMAGE_PIXBUF:
- status_icon->priv->image_type = GTK_IMAGE_EMPTY;
-
- if (status_icon->priv->image_data.pixbuf)
- g_object_unref (status_icon->priv->image_data.pixbuf);
- status_icon->priv->image_data.pixbuf = NULL;
-
- g_object_notify (G_OBJECT (status_icon), "image-type");
- g_object_notify (G_OBJECT (status_icon), "pixbuf");
- break;
- case GTK_IMAGE_STOCK:
- case GTK_IMAGE_ANIMATION:
- case GTK_IMAGE_EMPTY:
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-}
-
-void
-egg_status_icon_set_from_pixbuf (EggStatusIcon *status_icon,
- GdkPixbuf *pixbuf)
-{
- g_return_if_fail (EGG_IS_STATUS_ICON (status_icon));
- g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
-
- if (pixbuf)
- g_object_ref (pixbuf);
-
- g_object_freeze_notify (G_OBJECT (status_icon));
-
- egg_status_icon_reset_image_data (status_icon);
-
- status_icon->priv->image_type = GTK_IMAGE_PIXBUF;
- status_icon->priv->image_data.pixbuf = pixbuf;
-
- g_object_notify (G_OBJECT (status_icon), "image-type");
- g_object_notify (G_OBJECT (status_icon), "pixbuf");
-
- g_object_thaw_notify (G_OBJECT (status_icon));
-
- egg_status_icon_update_image (status_icon);
-}
-
-void
-egg_status_icon_set_from_file (EggStatusIcon *status_icon,
- const gchar *filename)
-{
- g_return_if_fail (EGG_IS_STATUS_ICON (status_icon));
-}
-
-void
-egg_status_icon_set_from_stock (EggStatusIcon *status_icon,
- const gchar *stock_id)
-{
- g_return_if_fail (EGG_IS_STATUS_ICON (status_icon));
-}
-
-void
-egg_status_icon_set_from_animation (EggStatusIcon *status_icon,
- GdkPixbufAnimation *animation)
-{
- g_return_if_fail (EGG_IS_STATUS_ICON (status_icon));
- g_return_if_fail (animation == NULL || GDK_IS_PIXBUF_ANIMATION (animation));
-}
-
-GtkImageType
-egg_status_icon_get_image_type (EggStatusIcon *status_icon)
-{
- g_return_val_if_fail (EGG_IS_STATUS_ICON (status_icon), GTK_IMAGE_EMPTY);
-
- return status_icon->priv->image_type;
-}
-
-GdkPixbuf *
-egg_status_icon_get_pixbuf (EggStatusIcon *status_icon)
-{
- g_return_val_if_fail (EGG_IS_STATUS_ICON (status_icon), NULL);
- g_return_val_if_fail (status_icon->priv->image_type == GTK_IMAGE_PIXBUF ||
- status_icon->priv->image_type == GTK_IMAGE_EMPTY, NULL);
-
- if (status_icon->priv->image_type == GTK_IMAGE_EMPTY)
- status_icon->priv->image_data.pixbuf = NULL;
-
- return status_icon->priv->image_data.pixbuf;
-}
-
-G_CONST_RETURN gchar *
-egg_status_icon_get_stock (EggStatusIcon *status_icon)
-{
- g_return_val_if_fail (EGG_IS_STATUS_ICON (status_icon), NULL);
-
- return NULL;
-}
-
-GdkPixbufAnimation *
-egg_status_icon_get_animation (EggStatusIcon *status_icon)
-{
- g_return_val_if_fail (EGG_IS_STATUS_ICON (status_icon), NULL);
-
- return NULL;
-}
-
-gint
-egg_status_icon_get_size (EggStatusIcon *status_icon)
-{
- g_return_val_if_fail (EGG_IS_STATUS_ICON (status_icon), -1);
-
- return status_icon->priv->size;
-}
-
-void
-egg_status_icon_set_tooltip (EggStatusIcon *status_icon,
- const gchar *tooltip_text,
- const gchar *tooltip_private)
-{
- g_return_if_fail (EGG_IS_STATUS_ICON (status_icon));
-
- gtk_tooltips_set_tip (status_icon->priv->tooltips,
- status_icon->tray_icon,
- tooltip_text,
- tooltip_private);
-}
-
-void
-egg_status_icon_set_balloon_text (EggStatusIcon *status_icon,
- const gchar *text)
-{
- g_return_if_fail (EGG_IS_STATUS_ICON (status_icon));
-}
-
-G_CONST_RETURN gchar *
-egg_status_icon_get_balloon_text (EggStatusIcon *status_icon)
-{
- g_return_val_if_fail (EGG_IS_STATUS_ICON (status_icon), NULL);
-
- return NULL;
-}
-
-static gboolean
-egg_status_icon_blinker (EggStatusIcon *status_icon)
-{
- status_icon->priv->blink_off = !status_icon->priv->blink_off;
-
- egg_status_icon_update_image (status_icon);
-
- return TRUE;
-}
-
-static void
-egg_status_icon_enable_blinking (EggStatusIcon *status_icon)
-{
- if (!status_icon->priv->blinking_timeout)
- {
- egg_status_icon_blinker (status_icon);
-
- status_icon->priv->blinking_timeout =
- g_timeout_add (500, (GSourceFunc) egg_status_icon_blinker, status_icon);
- }
-}
-
-static void
-egg_status_icon_disable_blinking (EggStatusIcon *status_icon)
-{
- if (status_icon->priv->blinking_timeout)
- {
- g_source_remove (status_icon->priv->blinking_timeout);
- status_icon->priv->blinking_timeout = 0;
- status_icon->priv->blink_off = FALSE;
-
- egg_status_icon_update_image (status_icon);
- }
-}
-
-void
-egg_status_icon_set_is_blinking (EggStatusIcon *status_icon,
- gboolean is_blinking)
-{
- g_return_if_fail (EGG_IS_STATUS_ICON (status_icon));
-
- is_blinking = is_blinking != FALSE;
-
- if (status_icon->priv->blinking != is_blinking)
- {
- status_icon->priv->blinking = is_blinking;
-
- if (is_blinking)
- egg_status_icon_enable_blinking (status_icon);
- else
- egg_status_icon_disable_blinking (status_icon);
-
- g_object_notify (G_OBJECT (status_icon), "blinking");
- }
-}
-
-gboolean
-egg_status_icon_get_is_blinking (EggStatusIcon *status_icon)
-{
- g_return_val_if_fail (EGG_IS_STATUS_ICON (status_icon), FALSE);
-
- return status_icon->priv->blinking;
-}
diff --git a/lib/egg/eggstatusicon.h b/lib/egg/eggstatusicon.h
deleted file mode 100644
index 58bb59319..000000000
--- a/lib/egg/eggstatusicon.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* eggstatusicon.h:
- *
- * Copyright (C) 2003 Sun Microsystems, Inc.
- *
- * 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.
- *
- * Authors:
- * Mark McLoughlin <mark@skynet.ie>
- */
-
-#ifndef __EGG_STATUS_ICON_H__
-#define __EGG_STATUS_ICON_H__
-
-#include "eggtrayicon.h"
-#include <gtk/gtkimage.h>
-
-G_BEGIN_DECLS
-
-#define EGG_TYPE_STATUS_ICON (egg_status_icon_get_type ())
-#define EGG_STATUS_ICON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EGG_TYPE_STATUS_ICON, EggStatusIcon))
-#define EGG_STATUS_ICON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EGG_TYPE_STATUS_ICON, EggStatusIconClass))
-#define EGG_IS_STATUS_ICON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EGG_TYPE_STATUS_ICON))
-#define EGG_IS_STATUS_ICON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EGG_TYPE_STATUS_ICON))
-#define EGG_STATUS_ICON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EGG_TYPE_STATUS_ICON, EggStatusIconClass))
-
-typedef struct _EggStatusIcon EggStatusIcon;
-typedef struct _EggStatusIconClass EggStatusIconClass;
-typedef struct _EggStatusIconPrivate EggStatusIconPrivate;
-
-struct _EggStatusIcon
-{
- GObject parent_instance;
-
- /*< public >*/
- GtkWidget *tray_icon;
- /*< private >*/
- EggStatusIconPrivate *priv;
-};
-
-struct _EggStatusIconClass
-{
- GObjectClass parent_class;
-
- void (* activate) (EggStatusIcon *status_icon);
- gboolean (* popup_menu) (EggStatusIcon *status_icon);
- gboolean (* size_changed) (EggStatusIcon *status_icon,
- gint size);
-};
-
-GType egg_status_icon_get_type (void);
-
-EggStatusIcon *egg_status_icon_new (void);
-EggStatusIcon *egg_status_icon_new_from_pixbuf (GdkPixbuf *pixbuf);
-EggStatusIcon *egg_status_icon_new_from_file (const gchar *filename);
-EggStatusIcon *egg_status_icon_new_from_stock (const gchar *stock_id);
-EggStatusIcon *egg_status_icon_new_from_animation (GdkPixbufAnimation *animation);
-
-void egg_status_icon_set_from_pixbuf (EggStatusIcon *status_icon,
- GdkPixbuf *pixbuf);
-void egg_status_icon_set_from_file (EggStatusIcon *status_icon,
- const gchar *filename);
-void egg_status_icon_set_from_stock (EggStatusIcon *status_icon,
- const gchar *stock_id);
-void egg_status_icon_set_from_animation (EggStatusIcon *status_icon,
- GdkPixbufAnimation *animation);
-
-GtkImageType egg_status_icon_get_image_type (EggStatusIcon *status_icon);
-
-GdkPixbuf *egg_status_icon_get_pixbuf (EggStatusIcon *status_icon);
-G_CONST_RETURN gchar *egg_status_icon_get_stock (EggStatusIcon *status_icon);
-GdkPixbufAnimation *egg_status_icon_get_animation (EggStatusIcon *status_icon);
-
-gint egg_status_icon_get_size (EggStatusIcon *status_icon);
-
-void egg_status_icon_set_tooltip (EggStatusIcon *status_icon,
- const gchar *tooltip_text,
- const gchar *tooltip_private);
-
-void egg_status_icon_set_balloon_text (EggStatusIcon *status_icon,
- const gchar *text);
-G_CONST_RETURN gchar *egg_status_icon_get_balloon_text (EggStatusIcon *status_icon);
-
-void egg_status_icon_set_is_blinking (EggStatusIcon *status_icon,
- gboolean enable_blinking);
-gboolean egg_status_icon_get_is_blinking (EggStatusIcon *status_icon);
-
-G_END_DECLS
-
-#endif /* __EGG_STATUS_ICON_H__ */
diff --git a/lib/egg/eggtrayicon.c b/lib/egg/eggtrayicon.c
deleted file mode 100644
index 2ffa784b7..000000000
--- a/lib/egg/eggtrayicon.c
+++ /dev/null
@@ -1,495 +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 P_(x) x
-
-#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_update_manager_window (EggTrayIcon *icon,
- gboolean dock_if_realized);
-static void egg_tray_icon_manager_window_destroyed (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;
-
- 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",
- P_("Orientation"),
- P_("The orientation of the tray."),
- GTK_TYPE_ORIENTATION,
- GTK_ORIENTATION_HORIZONTAL,
- G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-}
-
-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, 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;
-}
-
-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,
- 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);
-}
-
-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);
-
- 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);
-}
-
-EggTrayIcon *
-egg_tray_icon_new_for_xscreen (Screen *xscreen, const char *name)
-{
- GdkDisplay *display;
- GdkScreen *screen;
-
- display = gdk_x11_lookup_xdisplay (DisplayOfScreen (xscreen));
- screen = gdk_display_get_screen (display, XScreenNumberOfScreen (xscreen));
-
- return egg_tray_icon_new_for_screen (screen, name);
-}
-
-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;
-}
diff --git a/lib/egg/eggtrayicon.h b/lib/egg/eggtrayicon.h
deleted file mode 100644
index 9ce3173e2..000000000
--- a/lib/egg/eggtrayicon.h
+++ /dev/null
@@ -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>
-#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_xscreen(Screen *xscreen,
- const char *name);
-
-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__ */
diff --git a/lib/egg/eggtraymanager.c b/lib/egg/eggtraymanager.c
deleted file mode 100644
index 0b9dabf52..000000000
--- a/lib/egg/eggtraymanager.c
+++ /dev/null
@@ -1,726 +0,0 @@
-/* eggtraymanager.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 "eggtraymanager.h"
-
-#include <gdk/gdkx.h>
-#include <gtk/gtkinvisible.h>
-#include <gtk/gtksocket.h>
-#include <gtk/gtkwindow.h>
-#include <X11/Xatom.h>
-
-#include "eggmarshalers.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 P_(x) x
-
-/* Signals */
-enum
-{
- TRAY_ICON_ADDED,
- TRAY_ICON_REMOVED,
- MESSAGE_SENT,
- MESSAGE_CANCELLED,
- LOST_SELECTION,
- LAST_SIGNAL
-};
-
-enum {
- PROP_0,
- PROP_ORIENTATION
-};
-
-typedef struct
-{
- long id, len;
- long remaining_len;
-
- long timeout;
- Window window;
- char *str;
-} PendingMessage;
-
-static GObjectClass *parent_class = NULL;
-static guint manager_signals[LAST_SIGNAL] = { 0 };
-
-#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
-
-static gboolean egg_tray_manager_check_running_xscreen (Screen *xscreen);
-
-static void egg_tray_manager_init (EggTrayManager *manager);
-static void egg_tray_manager_class_init (EggTrayManagerClass *klass);
-
-static void egg_tray_manager_finalize (GObject *object);
-static void egg_tray_manager_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void egg_tray_manager_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-static void egg_tray_manager_unmanage (EggTrayManager *manager);
-
-GType
-egg_tray_manager_get_type (void)
-{
- static GType our_type = 0;
-
- if (our_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (EggTrayManagerClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) egg_tray_manager_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EggTrayManager),
- 0, /* n_preallocs */
- (GInstanceInitFunc) egg_tray_manager_init
- };
-
- our_type = g_type_register_static (G_TYPE_OBJECT, "EggTrayManager", &our_info, 0);
- }
-
- return our_type;
-
-}
-
-static void
-egg_tray_manager_init (EggTrayManager *manager)
-{
- manager->socket_table = g_hash_table_new (NULL, NULL);
-}
-
-static void
-egg_tray_manager_class_init (EggTrayManagerClass *klass)
-{
- GObjectClass *gobject_class;
-
- parent_class = g_type_class_peek_parent (klass);
- gobject_class = (GObjectClass *)klass;
-
- gobject_class->finalize = egg_tray_manager_finalize;
- gobject_class->set_property = egg_tray_manager_set_property;
- gobject_class->get_property = egg_tray_manager_get_property;
-
- g_object_class_install_property (gobject_class,
- PROP_ORIENTATION,
- g_param_spec_enum ("orientation",
- P_("Orientation"),
- P_("The orientation of the tray."),
- GTK_TYPE_ORIENTATION,
- GTK_ORIENTATION_HORIZONTAL,
- G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_CONSTRUCT));
-
- manager_signals[TRAY_ICON_ADDED] =
- g_signal_new ("tray_icon_added",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggTrayManagerClass, tray_icon_added),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- GTK_TYPE_SOCKET);
-
- manager_signals[TRAY_ICON_REMOVED] =
- g_signal_new ("tray_icon_removed",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggTrayManagerClass, tray_icon_removed),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- GTK_TYPE_SOCKET);
- manager_signals[MESSAGE_SENT] =
- g_signal_new ("message_sent",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggTrayManagerClass, message_sent),
- NULL, NULL,
- _egg_marshal_VOID__OBJECT_STRING_LONG_LONG,
- G_TYPE_NONE, 4,
- GTK_TYPE_SOCKET,
- G_TYPE_STRING,
- G_TYPE_LONG,
- G_TYPE_LONG);
- manager_signals[MESSAGE_CANCELLED] =
- g_signal_new ("message_cancelled",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggTrayManagerClass, message_cancelled),
- NULL, NULL,
- _egg_marshal_VOID__OBJECT_LONG,
- G_TYPE_NONE, 2,
- GTK_TYPE_SOCKET,
- G_TYPE_LONG);
- manager_signals[LOST_SELECTION] =
- g_signal_new ("lost_selection",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggTrayManagerClass, lost_selection),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
-}
-
-static void
-egg_tray_manager_finalize (GObject *object)
-{
- EggTrayManager *manager;
-
- manager = EGG_TRAY_MANAGER (object);
-
- egg_tray_manager_unmanage (manager);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-egg_tray_manager_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EggTrayManager *manager = EGG_TRAY_MANAGER (object);
-
- switch (prop_id)
- {
- case PROP_ORIENTATION:
- egg_tray_manager_set_orientation (manager, g_value_get_enum (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-egg_tray_manager_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EggTrayManager *manager = EGG_TRAY_MANAGER (object);
-
- switch (prop_id)
- {
- case PROP_ORIENTATION:
- g_value_set_enum (value, manager->orientation);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-EggTrayManager *
-egg_tray_manager_new (void)
-{
- EggTrayManager *manager;
-
- manager = g_object_new (EGG_TYPE_TRAY_MANAGER, NULL);
-
- return manager;
-}
-
-static gboolean
-egg_tray_manager_plug_removed (GtkSocket *socket,
- EggTrayManager *manager)
-{
- Window *window;
-
- window = g_object_get_data (G_OBJECT (socket), "egg-tray-child-window");
-
- g_hash_table_remove (manager->socket_table, GINT_TO_POINTER (*window));
- g_object_set_data (G_OBJECT (socket), "egg-tray-child-window",
- NULL);
-
- g_signal_emit (manager, manager_signals[TRAY_ICON_REMOVED], 0, socket);
-
- /* This destroys the socket. */
- return FALSE;
-}
-
-static void
-egg_tray_manager_handle_dock_request (EggTrayManager *manager,
- XClientMessageEvent *xevent)
-{
- GtkWidget *socket;
- Window *window;
-
- socket = gtk_socket_new ();
-
- /* We need to set the child window here
- * so that the client can call _get functions
- * in the signal handler
- */
- window = g_new (Window, 1);
- *window = xevent->data.l[2];
-
- g_object_set_data_full (G_OBJECT (socket),
- "egg-tray-child-window",
- window, g_free);
- g_signal_emit (manager, manager_signals[TRAY_ICON_ADDED], 0,
- socket);
-
- /* Add the socket only if it's been attached */
- if (GTK_IS_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (socket))))
- {
- g_signal_connect (socket, "plug_removed",
- G_CALLBACK (egg_tray_manager_plug_removed), manager);
-
- gtk_socket_add_id (GTK_SOCKET (socket), xevent->data.l[2]);
-
- g_hash_table_insert (manager->socket_table, GINT_TO_POINTER (xevent->data.l[2]), socket);
- }
- else
- gtk_widget_destroy (socket);
-}
-
-static void
-pending_message_free (PendingMessage *message)
-{
- g_free (message->str);
- g_free (message);
-}
-
-static void
-egg_tray_manager_handle_message_data (EggTrayManager *manager,
- XClientMessageEvent *xevent)
-{
- GList *p;
- int len;
-
- /* Try to see if we can find the
- * pending message in the list
- */
- for (p = manager->messages; p; p = p->next)
- {
- PendingMessage *msg = p->data;
-
- if (xevent->window == msg->window)
- {
- /* Append the message */
- len = MIN (msg->remaining_len, 20);
-
- memcpy ((msg->str + msg->len - msg->remaining_len),
- &xevent->data, len);
- msg->remaining_len -= len;
-
- if (msg->remaining_len == 0)
- {
- GtkSocket *socket;
-
- socket = g_hash_table_lookup (manager->socket_table, GINT_TO_POINTER (msg->window));
-
- if (socket)
- {
- g_signal_emit (manager, manager_signals[MESSAGE_SENT], 0,
- socket, msg->str, msg->id, msg->timeout);
- }
- manager->messages = g_list_remove_link (manager->messages,
- p);
-
- pending_message_free (msg);
- }
-
- return;
- }
- }
-}
-
-static void
-egg_tray_manager_handle_begin_message (EggTrayManager *manager,
- XClientMessageEvent *xevent)
-{
- GList *p;
- PendingMessage *msg;
-
- /* Check if the same message is
- * already in the queue and remove it if so
- */
- for (p = manager->messages; p; p = p->next)
- {
- PendingMessage *msg = p->data;
-
- if (xevent->window == msg->window &&
- xevent->data.l[4] == msg->id)
- {
- /* Hmm, we found it, now remove it */
- pending_message_free (msg);
- manager->messages = g_list_remove_link (manager->messages, p);
- break;
- }
- }
-
- /* Now add the new message to the queue */
- msg = g_new0 (PendingMessage, 1);
- msg->window = xevent->window;
- msg->timeout = xevent->data.l[2];
- msg->len = xevent->data.l[3];
- msg->id = xevent->data.l[4];
- msg->remaining_len = msg->len;
- msg->str = g_malloc (msg->len + 1);
- msg->str[msg->len] = '\0';
- manager->messages = g_list_prepend (manager->messages, msg);
-}
-
-static void
-egg_tray_manager_handle_cancel_message (EggTrayManager *manager,
- XClientMessageEvent *xevent)
-{
- GtkSocket *socket;
-
- socket = g_hash_table_lookup (manager->socket_table, GINT_TO_POINTER (xevent->window));
-
- if (socket)
- {
- g_signal_emit (manager, manager_signals[MESSAGE_CANCELLED], 0,
- socket, xevent->data.l[2]);
- }
-}
-
-static GdkFilterReturn
-egg_tray_manager_handle_event (EggTrayManager *manager,
- XClientMessageEvent *xevent)
-{
- switch (xevent->data.l[1])
- {
- case SYSTEM_TRAY_REQUEST_DOCK:
- egg_tray_manager_handle_dock_request (manager, xevent);
- return GDK_FILTER_REMOVE;
-
- case SYSTEM_TRAY_BEGIN_MESSAGE:
- egg_tray_manager_handle_begin_message (manager, xevent);
- return GDK_FILTER_REMOVE;
-
- case SYSTEM_TRAY_CANCEL_MESSAGE:
- egg_tray_manager_handle_cancel_message (manager, xevent);
- return GDK_FILTER_REMOVE;
- default:
- break;
- }
-
- return GDK_FILTER_CONTINUE;
-}
-
-static GdkFilterReturn
-egg_tray_manager_window_filter (GdkXEvent *xev, GdkEvent *event, gpointer data)
-{
- XEvent *xevent = (GdkXEvent *)xev;
- EggTrayManager *manager = data;
-
- if (xevent->type == ClientMessage)
- {
- if (xevent->xclient.message_type == manager->opcode_atom)
- {
- return egg_tray_manager_handle_event (manager, (XClientMessageEvent *)xevent);
- }
- else if (xevent->xclient.message_type == manager->message_data_atom)
- {
- egg_tray_manager_handle_message_data (manager, (XClientMessageEvent *)xevent);
- return GDK_FILTER_REMOVE;
- }
- }
- else if (xevent->type == SelectionClear)
- {
- g_signal_emit (manager, manager_signals[LOST_SELECTION], 0);
- egg_tray_manager_unmanage (manager);
- }
-
- return GDK_FILTER_CONTINUE;
-}
-
-static void
-egg_tray_manager_unmanage (EggTrayManager *manager)
-{
- Display *display;
- guint32 timestamp;
- GtkWidget *invisible;
-
- if (manager->invisible == NULL)
- return;
-
- invisible = manager->invisible;
- g_assert (GTK_IS_INVISIBLE (invisible));
- g_assert (GTK_WIDGET_REALIZED (invisible));
- g_assert (GDK_IS_WINDOW (invisible->window));
-
- display = GDK_WINDOW_XDISPLAY (invisible->window);
-
- if (XGetSelectionOwner (display, manager->selection_atom) ==
- GDK_WINDOW_XWINDOW (invisible->window))
- {
- timestamp = gdk_x11_get_server_time (invisible->window);
- XSetSelectionOwner (display, manager->selection_atom, None, timestamp);
- }
-
- gdk_window_remove_filter (invisible->window, egg_tray_manager_window_filter, manager);
-
- manager->invisible = NULL; /* prior to destroy for reentrancy paranoia */
- gtk_widget_destroy (invisible);
- g_object_unref (G_OBJECT (invisible));
-}
-
-static void
-egg_tray_manager_set_orientation_property (EggTrayManager *manager)
-{
- gulong data[1];
-
- if (!manager->invisible || !manager->invisible->window)
- return;
-
- g_assert (manager->orientation_atom != None);
-
- data[0] = manager->orientation == GTK_ORIENTATION_HORIZONTAL ?
- SYSTEM_TRAY_ORIENTATION_HORZ :
- SYSTEM_TRAY_ORIENTATION_VERT;
-
- XChangeProperty (GDK_WINDOW_XDISPLAY (manager->invisible->window),
- GDK_WINDOW_XWINDOW (manager->invisible->window),
- manager->orientation_atom,
- XA_CARDINAL, 32,
- PropModeReplace,
- (guchar *) &data, 1);
-}
-
-static gboolean
-egg_tray_manager_manage_xscreen (EggTrayManager *manager, Screen *xscreen)
-{
- GtkWidget *invisible;
- char *selection_atom_name;
- guint32 timestamp;
- GdkScreen *screen;
-
- g_return_val_if_fail (EGG_IS_TRAY_MANAGER (manager), FALSE);
- g_return_val_if_fail (manager->screen == NULL, FALSE);
-
- /* If there's already a manager running on the screen
- * we can't create another one.
- */
-#if 0
- if (egg_tray_manager_check_running_xscreen (xscreen))
- return FALSE;
-#endif
- screen = gdk_display_get_screen (gdk_x11_lookup_xdisplay (DisplayOfScreen (xscreen)),
- XScreenNumberOfScreen (xscreen));
-
- invisible = gtk_invisible_new_for_screen (screen);
- gtk_widget_realize (invisible);
-
- gtk_widget_add_events (invisible, GDK_PROPERTY_CHANGE_MASK | GDK_STRUCTURE_MASK);
-
- selection_atom_name = g_strdup_printf ("_NET_SYSTEM_TRAY_S%d",
- XScreenNumberOfScreen (xscreen));
- manager->selection_atom = XInternAtom (DisplayOfScreen (xscreen), selection_atom_name, False);
-
- g_free (selection_atom_name);
-
- manager->orientation_atom = XInternAtom (DisplayOfScreen (xscreen),
- "_NET_SYSTEM_TRAY_ORIENTATION",
- FALSE);
- egg_tray_manager_set_orientation_property (manager);
-
- timestamp = gdk_x11_get_server_time (invisible->window);
- XSetSelectionOwner (DisplayOfScreen (xscreen), manager->selection_atom,
- GDK_WINDOW_XWINDOW (invisible->window), timestamp);
-
- /* Check if we were could set the selection owner successfully */
- if (XGetSelectionOwner (DisplayOfScreen (xscreen), manager->selection_atom) ==
- GDK_WINDOW_XWINDOW (invisible->window))
- {
- XClientMessageEvent xev;
-
- xev.type = ClientMessage;
- xev.window = RootWindowOfScreen (xscreen);
- xev.message_type = XInternAtom (DisplayOfScreen (xscreen), "MANAGER", False);
-
- xev.format = 32;
- xev.data.l[0] = timestamp;
- xev.data.l[1] = manager->selection_atom;
- xev.data.l[2] = GDK_WINDOW_XWINDOW (invisible->window);
- xev.data.l[3] = 0; /* manager specific data */
- xev.data.l[4] = 0; /* manager specific data */
-
- XSendEvent (DisplayOfScreen (xscreen),
- RootWindowOfScreen (xscreen),
- False, StructureNotifyMask, (XEvent *)&xev);
-
- manager->invisible = invisible;
- g_object_ref (G_OBJECT (manager->invisible));
-
- manager->opcode_atom = XInternAtom (DisplayOfScreen (xscreen),
- "_NET_SYSTEM_TRAY_OPCODE",
- False);
-
- manager->message_data_atom = XInternAtom (DisplayOfScreen (xscreen),
- "_NET_SYSTEM_TRAY_MESSAGE_DATA",
- False);
-
- /* Add a window filter */
- gdk_window_add_filter (invisible->window, egg_tray_manager_window_filter, manager);
- return TRUE;
- }
- else
- {
- gtk_widget_destroy (invisible);
-
- return FALSE;
- }
-}
-
-gboolean
-egg_tray_manager_manage_screen (EggTrayManager *manager,
- GdkScreen *screen)
-{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
- g_return_val_if_fail (manager->screen == NULL, FALSE);
-
- return egg_tray_manager_manage_xscreen (manager,
- GDK_SCREEN_XSCREEN (screen));
-}
-
-static gboolean
-egg_tray_manager_check_running_xscreen (Screen *xscreen)
-{
- 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;
-}
-
-gboolean
-egg_tray_manager_check_running (GdkScreen *screen)
-{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
-
- return egg_tray_manager_check_running_xscreen (GDK_SCREEN_XSCREEN (screen));
-}
-
-char *
-egg_tray_manager_get_child_title (EggTrayManager *manager,
- EggTrayManagerChild *child)
-{
- Window *child_window;
- Atom utf8_string, atom, type;
- int result;
- char *retval;
- int format;
- gulong nitems;
- gulong bytes_after;
- guchar *val;
-
- g_return_val_if_fail (EGG_IS_TRAY_MANAGER (manager), NULL);
- g_return_val_if_fail (GTK_IS_SOCKET (child), NULL);
-
- child_window = g_object_get_data (G_OBJECT (child),
- "egg-tray-child-window");
-
- utf8_string = XInternAtom (GDK_DISPLAY (), "UTF8_STRING", False);
- atom = XInternAtom (GDK_DISPLAY (), "_NET_WM_NAME", False);
-
- gdk_error_trap_push ();
-
- result = XGetWindowProperty (GDK_DISPLAY (),
- *child_window,
- atom,
- 0, G_MAXLONG,
- False, utf8_string,
- &type, &format, &nitems,
- &bytes_after, (guchar **)&val);
-
- if (gdk_error_trap_pop () || result != Success)
- return NULL;
-
- if (type != utf8_string ||
- format != 8 ||
- nitems == 0)
- {
- if (val)
- XFree (val);
- return NULL;
- }
-
- if (!g_utf8_validate ((const gchar *)val, nitems, NULL))
- {
- XFree (val);
- return NULL;
- }
-
- retval = g_strndup ((const gchar *)val, nitems);
-
- XFree (val);
-
- return retval;
-
-}
-
-void
-egg_tray_manager_set_orientation (EggTrayManager *manager,
- GtkOrientation orientation)
-{
- g_return_if_fail (EGG_IS_TRAY_MANAGER (manager));
-
- if (manager->orientation != orientation)
- {
- manager->orientation = orientation;
-
- egg_tray_manager_set_orientation_property (manager);
-
- g_object_notify (G_OBJECT (manager), "orientation");
- }
-}
-
-GtkOrientation
-egg_tray_manager_get_orientation (EggTrayManager *manager)
-{
- g_return_val_if_fail (EGG_IS_TRAY_MANAGER (manager), GTK_ORIENTATION_HORIZONTAL);
-
- return manager->orientation;
-}
diff --git a/lib/egg/eggtraymanager.h b/lib/egg/eggtraymanager.h
deleted file mode 100644
index 672e9753c..000000000
--- a/lib/egg/eggtraymanager.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* eggtraymanager.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_MANAGER_H__
-#define __EGG_TRAY_MANAGER_H__
-
-#include <gtk/gtkwidget.h>
-#include <gdk/gdkx.h>
-
-G_BEGIN_DECLS
-
-#define EGG_TYPE_TRAY_MANAGER (egg_tray_manager_get_type ())
-#define EGG_TRAY_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TRAY_MANAGER, EggTrayManager))
-#define EGG_TRAY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_TRAY_MANAGER, EggTrayManagerClass))
-#define EGG_IS_TRAY_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TRAY_MANAGER))
-#define EGG_IS_TRAY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_TRAY_MANAGER))
-#define EGG_TRAY_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_TRAY_MANAGER, EggTrayManagerClass))
-
-typedef struct _EggTrayManager EggTrayManager;
-typedef struct _EggTrayManagerClass EggTrayManagerClass;
-typedef struct _EggTrayManagerChild EggTrayManagerChild;
-
-struct _EggTrayManager
-{
- GObject parent_instance;
-
- Atom opcode_atom;
- Atom selection_atom;
- Atom message_data_atom;
- Atom orientation_atom;
-
- GtkWidget *invisible;
- GdkScreen *screen;
- GtkOrientation orientation;
-
- GList *messages;
- GHashTable *socket_table;
-};
-
-struct _EggTrayManagerClass
-{
- GObjectClass parent_class;
-
- void (* tray_icon_added) (EggTrayManager *manager,
- EggTrayManagerChild *child);
- void (* tray_icon_removed) (EggTrayManager *manager,
- EggTrayManagerChild *child);
-
- void (* message_sent) (EggTrayManager *manager,
- EggTrayManagerChild *child,
- const gchar *message,
- glong id,
- glong timeout);
-
- void (* message_cancelled) (EggTrayManager *manager,
- EggTrayManagerChild *child,
- glong id);
-
- void (* lost_selection) (EggTrayManager *manager);
-};
-
-GType egg_tray_manager_get_type (void);
-
-gboolean egg_tray_manager_check_running (GdkScreen *screen);
-EggTrayManager *egg_tray_manager_new (void);
-gboolean egg_tray_manager_manage_screen (EggTrayManager *manager,
- GdkScreen *screen);
-char *egg_tray_manager_get_child_title (EggTrayManager *manager,
- EggTrayManagerChild *child);
-void egg_tray_manager_set_orientation (EggTrayManager *manager,
- GtkOrientation orientation);
-GtkOrientation egg_tray_manager_get_orientation (EggTrayManager *manager);
-
-G_END_DECLS
-
-#endif /* __EGG_TRAY_MANAGER_H__ */