Gtk2-TrayIcon-0.06/0000755000175000017500000000000010640473176013302 5ustar ebassiebassiGtk2-TrayIcon-0.06/MANIFEST0000644000175000017500000000033310633772202014424 0ustar ebassiebassiChangeLog config.h eggtrayicon.c eggtrayicon.h examples/simple.pl Makefile.PL MANIFEST This list of files MANIFEST.SKIP maps META.yml perl-Gtk2-TrayIcon.spec.in README t/load.t TODO trayicon.h TrayIcon.pm TrayIcon.xs Gtk2-TrayIcon-0.06/META.yml0000644000175000017500000000053010640473176014551 0ustar ebassiebassi# http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Gtk2-TrayIcon version: 0.06 version_from: TrayIcon.pm installdirs: site requires: Gtk2: 0.96 distribution_type: module generated_by: ExtUtils::MakeMaker version 6.30_01 Gtk2-TrayIcon-0.06/config.h0000644000175000017500000000000110633772202014701 0ustar ebassiebassi Gtk2-TrayIcon-0.06/Makefile.PL0000644000175000017500000000555710633772202015262 0ustar ebassiebassi use 5.008; use ExtUtils::MakeMaker; use Cwd; use File::Spec; use ExtUtils::Depends; use ExtUtils::PkgConfig; use Gtk2::CodeGen; # minimum required version of dependancies we need to build our %build_reqs = ( 'perl-ExtUtils-Depends' => '0.1', 'perl-ExtUtils-PkgConfig' => '0.1', 'perl-Glib' => '1.00', 'perl-Gtk2' => '1.00', ); # Writing a fake Makefile ensures that CPAN will pick up the correct # dependencies and install them. unless (eval "use ExtUtils::Depends;" . "use ExtUtils::PkgConfig;" . "use Glib::MakeHelper;" . "use Gtk2::CodeGen;" # just seeing if Glib is available isn't enough, make sure # it's recent enough, too . "use Glib '$build_reqs{'perl-Glib'}';" . "use Gtk2 '$build_reqs{'perl-Gtk2'}';" . "1") { warn "$@\n"; WriteMakefile( PREREQ_FATAL => 1, PREREQ_PM => { Glib:: => $build_reqs{'perl-Glib'}, Gtk2:: => $build_reqs{'perl-Gtk2'}, ExtUtils::Depends:: => $build_reqs{'perl-ExtUtils-Depends'}, ExtUtils::PkgConfig:: => $build_reqs{'perl-ExtUtils-PkgConfig'}, }, ); exit 1; # not reached } mkdir 'build', 0777; my %pkgcfg = ExtUtils::PkgConfig->find ('gtk+-2.0'); Gtk2::CodeGen->parse_maps ('trayicon'); Gtk2::CodeGen->write_boot; $trayicon = ExtUtils::Depends->new ('Gtk2::TrayIcon', 'Gtk2', 'Glib'); $trayicon->set_inc ($pkgcfg{cflags} . " -DEGG_COMPILATION"); $trayicon->set_libs ($pkgcfg{libs}); $trayicon->add_c("eggtrayicon.c"); $trayicon->add_xs ("TrayIcon.xs"); $trayicon->add_pm ('TrayIcon.pm' => '$(INST_LIBDIR)/TrayIcon.pm'); my $cwd = cwd(); $trayicon->add_typemaps (map {File::Spec->catfile($cwd,$_)} 'build/trayicon.typemap'); # $trayicon->install (qw(trayicon.h build/trayicon-autogen.h)); $trayicon->install (qw(build/trayicon-autogen.h)); $trayicon->save_config ('build/IFiles.pm'); WriteMakefile( NAME => 'Gtk2::TrayIcon', VERSION_FROM => 'TrayIcon.pm', # finds $VERSION ABSTRACT_FROM => 'TrayIcon.pm', # retrieve abstract from module XSPROTOARG => '-noprototypes', $trayicon->get_makefile_vars, PREREQ_PM => { Gtk2 => 0.96, }, ); package MY; use Cwd; sub postamble { return Glib::MakeHelper->postamble_clean () . Glib::MakeHelper->postamble_docs (@main::xs_files) . Glib::MakeHelper->postamble_rpms ( 'PERL_EXTUTILS_DEPENDS' => $build_reqs{'perl-ExtUtils-Depends'}, 'PERL_EXTUTILS_PKGCONFIG' => $build_reqs{'perl-ExtUtils-PkgConfig'}, 'PERL_GLIB' => $build_reqs{'perl-Glib'}, 'PERL_GTK' => $build_reqs{'perl-Gtk2'}, ); } package MAIN; # gcc -I. `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` -DEGG_COMPILATION -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED -g -O2 -Wall --shared eggtrayicon.c -o eggtrayicon.o Gtk2-TrayIcon-0.06/ChangeLog0000644000175000017500000000314310640470105015042 0ustar ebassiebassi2007/05/15 00:01 (+0200) borup * eggtrayicon.[ch]: merge changes from svn head 2006/05/14 21:04 (+0200) borup * eggtrayicon.[ch]: merge changes from svn head * eggtrayicon.[ch]: apply patch from: http://bugzilla.gnome.org/show_bug.cgi?id=150726 2005/03/03 21:54 (-0400) muppetman * eggtrayicon.c: apply patch from http://bugzilla.gnome.org/show_bug.cgi?id=123570 2004/10/24 11:55 (-0400) rwmcfa1 * MANIFEST.SKIP: updates * perl-Gtk2-TrayIcon.spec.in: new scheme that addresses x86_64 problems found by Carl Nygard 2004/02/26 17:41 (-0500) muppetman * Makefile.PL: remove no-op 2004/01/24 21:44 (-0500) rwmcfa1 * Makefile.PL: removed runtime_reqs stuff, replaced by the pkg-config trick. use Glib::MakeHelper. * perl-Gtk2-TrayIcon.spec.in: use pkg-config for Requires version 2003/12/29 16:32 (-0500) rwmcfa1 * perl-Gtk2-TrayIcon.spec.in: use the new DATE replacement in conjunction with VERSION to create the changlog on the fly, which is better. 2003-10-27 19:19 muppetman * TrayIcon.xs, eggtrayicon.c, eggtrayicon.h: long overdue, my old patch to allow this stuff to work with 2.0.x. 2003-10-21 23:25 rwmcfa1 2003-10-03 23:00 borup * ChangeLog, README, TrayIcon.pm: Added dull but needed stuff: ChangeLog and README 2003-09-29 03:08 rwmcfa1 * .cvsignore: initial import 2003-09-26 11:28 borup * Makefile.PL: Glib::PkgConfig changed name... 2003-09-26 08:08 borup * MANIFEST, MANIFEST.SKIP, META.yml, Makefile.PL, TODO, TrayIcon.pm, TrayIcon.xs, config.h, eggtrayicon.c, eggtrayicon.h, maps, trayicon.h, examples/simple.pl, t/load.t: Initial commit of Gtk2::TrayIcon. Gtk2-TrayIcon-0.06/t/0000755000175000017500000000000010640473176013545 5ustar ebassiebassiGtk2-TrayIcon-0.06/t/load.t0000644000175000017500000000035010633772202014641 0ustar ebassiebassi use Gtk2::TestHelper tests => 3; BEGIN { use_ok( "Gtk2::TrayIcon" ); } Gtk2->init; my $trayicon= Gtk2::TrayIcon->new("test"); isa_ok( $trayicon, "Gtk2::TrayIcon", '$trayicon' ); isa_ok( $trayicon, "Gtk2::Plug", '$trayicon' ); Gtk2-TrayIcon-0.06/TrayIcon.xs0000644000175000017500000000216010633772202015377 0ustar ebassiebassi#include "gtk2perl.h" #include "eggtrayicon.h" #include "trayicon-autogen.h" MODULE = Gtk2::TrayIcon PACKAGE = Gtk2::TrayIcon PREFIX = egg_tray_icon_ #ifdef GDK_TYPE_SCREEN ## EggTrayIcon *egg_tray_icon_new_for_screen (GdkScreen *screen, const gchar *name) EggTrayIcon * egg_tray_icon_new_for_screen (class, screen, name) GdkScreen *screen const gchar *name C_ARGS: screen, name #endif ## EggTrayIcon *egg_tray_icon_new (const gchar *name) EggTrayIcon * egg_tray_icon_new (class, name) const gchar *name C_ARGS: name ## guint egg_tray_icon_send_message (EggTrayIcon *icon, gint timeout, const char *message, gint len) guint egg_tray_icon_send_message (icon, timeout, message) EggTrayIcon *icon gint timeout const gchar *message C_ARGS: icon, timeout, message, -1 ## void egg_tray_icon_cancel_message (EggTrayIcon *icon, guint id) void egg_tray_icon_cancel_message (icon, id) EggTrayIcon *icon guint id ## GtkOrientation egg_tray_icon_get_orientation (EggTrayIcon *icon) GtkOrientation egg_tray_icon_get_orientation (icon) EggTrayIcon *icon BOOT: #include "register.xsh" #include "boot.xsh" Gtk2-TrayIcon-0.06/TODO0000644000175000017500000000006010633772202013760 0ustar ebassiebassi EggTrayIcon is not api stable - must keep up. Gtk2-TrayIcon-0.06/eggtrayicon.c0000644000175000017500000003377610640470105015766 0ustar ebassiebassi/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* eggtrayicon.c * Copyright (C) 2002 Anders Carlsson * * 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 #include #include #include "eggtrayicon.h" #include #if defined (GDK_WINDOWING_X11) #include #include #elif defined (GDK_WINDOWING_WIN32) #include #endif #ifndef EGG_COMPILATION #ifndef _ #define _(x) dgettext (GETTEXT_PACKAGE, x) #define N_(x) x #endif #else #define _(x) x #define N_(x) x #endif #define SYSTEM_TRAY_REQUEST_DOCK 0 #define SYSTEM_TRAY_BEGIN_MESSAGE 1 #define SYSTEM_TRAY_CANCEL_MESSAGE 2 #define SYSTEM_TRAY_ORIENTATION_HORZ 0 #define SYSTEM_TRAY_ORIENTATION_VERT 1 enum { PROP_0, PROP_ORIENTATION }; static GtkPlugClass *parent_class = NULL; static void egg_tray_icon_init (EggTrayIcon *icon); static void egg_tray_icon_class_init (EggTrayIconClass *klass); static void egg_tray_icon_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static void egg_tray_icon_realize (GtkWidget *widget); static void egg_tray_icon_unrealize (GtkWidget *widget); static void egg_tray_icon_add (GtkContainer *container, GtkWidget *widget); #ifdef GDK_WINDOWING_X11 static void egg_tray_icon_update_manager_window (EggTrayIcon *icon, gboolean dock_if_realized); static void egg_tray_icon_manager_window_destroyed (EggTrayIcon *icon); #endif GType egg_tray_icon_get_type (void) { static GType our_type = 0; if (our_type == 0) { static const GTypeInfo our_info = { sizeof (EggTrayIconClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) egg_tray_icon_class_init, NULL, /* class_finalize */ NULL, /* class_data */ sizeof (EggTrayIcon), 0, /* n_preallocs */ (GInstanceInitFunc) egg_tray_icon_init }; our_type = g_type_register_static (GTK_TYPE_PLUG, "EggTrayIcon", &our_info, 0); } return our_type; } static void egg_tray_icon_init (EggTrayIcon *icon) { icon->stamp = 1; icon->orientation = GTK_ORIENTATION_HORIZONTAL; gtk_widget_add_events (GTK_WIDGET (icon), GDK_PROPERTY_CHANGE_MASK); } static void egg_tray_icon_class_init (EggTrayIconClass *klass) { GObjectClass *gobject_class = (GObjectClass *)klass; GtkWidgetClass *widget_class = (GtkWidgetClass *)klass; 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)); #if defined (GDK_WINDOWING_X11) /* Nothing */ #elif defined (GDK_WINDOWING_WIN32) g_warning ("Port eggtrayicon to Win32"); #else g_warning ("Port eggtrayicon to this GTK+ backend"); #endif } static void egg_tray_icon_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { EggTrayIcon *icon = EGG_TRAY_ICON (object); switch (prop_id) { case PROP_ORIENTATION: g_value_set_enum (value, icon->orientation); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } #ifdef GDK_WINDOWING_X11 static void egg_tray_icon_get_orientation_property (EggTrayIcon *icon) { Display *xdisplay; Atom type; int format; union { gulong *prop; guchar *prop_ch; } prop = { NULL }; gulong nitems; gulong bytes_after; int error, result; g_assert (icon->manager_window != None); xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon))); gdk_error_trap_push (); type = None; result = XGetWindowProperty (xdisplay, icon->manager_window, icon->orientation_atom, 0, G_MAXLONG, FALSE, XA_CARDINAL, &type, &format, &nitems, &bytes_after, &(prop.prop_ch)); error = gdk_error_trap_pop (); if (error || result != Success) return; if (type == XA_CARDINAL) { GtkOrientation orientation; orientation = (prop.prop [0] == SYSTEM_TRAY_ORIENTATION_HORZ) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL; if (icon->orientation != orientation) { icon->orientation = orientation; g_object_notify (G_OBJECT (icon), "orientation"); } } if (prop.prop) XFree (prop.prop); } static GdkFilterReturn egg_tray_icon_manager_filter (GdkXEvent *xevent, GdkEvent *event, gpointer user_data) { EggTrayIcon *icon = user_data; XEvent *xev = (XEvent *)xevent; if (xev->xany.type == ClientMessage && xev->xclient.message_type == icon->manager_atom && xev->xclient.data.l[1] == icon->selection_atom) { egg_tray_icon_update_manager_window (icon, TRUE); } else if (xev->xany.window == icon->manager_window) { if (xev->xany.type == PropertyNotify && xev->xproperty.atom == icon->orientation_atom) { egg_tray_icon_get_orientation_property (icon); } if (xev->xany.type == DestroyNotify) { egg_tray_icon_manager_window_destroyed (icon); } } return GDK_FILTER_CONTINUE; } #endif static void egg_tray_icon_unrealize (GtkWidget *widget) { #ifdef GDK_WINDOWING_X11 EggTrayIcon *icon = EGG_TRAY_ICON (widget); GdkWindow *root_window; if (icon->manager_window != None) { GdkWindow *gdkwin; gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (widget), icon->manager_window); gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon); } root_window = gdk_screen_get_root_window (gtk_widget_get_screen (widget)); gdk_window_remove_filter (root_window, egg_tray_icon_manager_filter, icon); if (GTK_WIDGET_CLASS (parent_class)->unrealize) (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); #endif } #ifdef GDK_WINDOWING_X11 static void egg_tray_icon_send_manager_message (EggTrayIcon *icon, long message, Window window, long data1, long data2, long data3) { XClientMessageEvent ev; Display *display; ev.type = ClientMessage; ev.window = window; ev.message_type = icon->system_tray_opcode_atom; ev.format = 32; ev.data.l[0] = gdk_x11_get_server_time (GTK_WIDGET (icon)->window); ev.data.l[1] = message; ev.data.l[2] = data1; ev.data.l[3] = data2; ev.data.l[4] = data3; display = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon))); gdk_error_trap_push (); XSendEvent (display, icon->manager_window, False, NoEventMask, (XEvent *)&ev); XSync (display, False); gdk_error_trap_pop (); } static void egg_tray_icon_send_dock_request (EggTrayIcon *icon) { egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_REQUEST_DOCK, icon->manager_window, gtk_plug_get_id (GTK_PLUG (icon)), 0, 0); } static void egg_tray_icon_update_manager_window (EggTrayIcon *icon, gboolean dock_if_realized) { Display *xdisplay; if (icon->manager_window != None) return; xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon))); XGrabServer (xdisplay); icon->manager_window = XGetSelectionOwner (xdisplay, icon->selection_atom); if (icon->manager_window != None) XSelectInput (xdisplay, icon->manager_window, StructureNotifyMask|PropertyChangeMask); XUngrabServer (xdisplay); XFlush (xdisplay); if (icon->manager_window != None) { GdkWindow *gdkwin; gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)), icon->manager_window); gdk_window_add_filter (gdkwin, egg_tray_icon_manager_filter, icon); if (dock_if_realized && GTK_WIDGET_REALIZED (icon)) egg_tray_icon_send_dock_request (icon); egg_tray_icon_get_orientation_property (icon); } } static void egg_tray_icon_manager_window_destroyed (EggTrayIcon *icon) { GdkWindow *gdkwin; g_return_if_fail (icon->manager_window != None); gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)), icon->manager_window); gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon); icon->manager_window = None; egg_tray_icon_update_manager_window (icon, TRUE); } #endif static 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_realize (GtkWidget *widget) { #ifdef GDK_WINDOWING_X11 EggTrayIcon *icon = EGG_TRAY_ICON (widget); GdkScreen *screen; GdkDisplay *display; Display *xdisplay; char buffer[256]; GdkWindow *root_window; if (GTK_WIDGET_CLASS (parent_class)->realize) GTK_WIDGET_CLASS (parent_class)->realize (widget); 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, FALSE); egg_tray_icon_send_dock_request (icon); root_window = gdk_screen_get_root_window (screen); /* Add a root window filter so that we get changes on MANAGER */ gdk_window_add_filter (root_window, egg_tray_icon_manager_filter, icon); #endif } 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); #ifdef GDK_WINDOWING_X11 if (icon->manager_window == None) return 0; #endif if (len < 0) len = strlen (message); stamp = icon->stamp++; #ifdef GDK_WINDOWING_X11 /* Get ready to send the message */ egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_BEGIN_MESSAGE, icon->manager_window, 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 = icon->manager_window; ev.format = 8; ev.message_type = XInternAtom (xdisplay, "_NET_SYSTEM_TRAY_MESSAGE_DATA", False); if (len > 20) { memcpy (&ev.data, message, 20); len -= 20; message += 20; } else { memcpy (&ev.data, message, len); len = 0; } XSendEvent (xdisplay, icon->manager_window, False, StructureNotifyMask, (XEvent *)&ev); XSync (xdisplay, False); } gdk_error_trap_pop (); #endif return stamp; } void egg_tray_icon_cancel_message (EggTrayIcon *icon, guint id) { g_return_if_fail (EGG_IS_TRAY_ICON (icon)); g_return_if_fail (id > 0); #ifdef GDK_WINDOWING_X11 egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_CANCEL_MESSAGE, (Window)gtk_plug_get_id (GTK_PLUG (icon)), id, 0, 0); #endif } GtkOrientation egg_tray_icon_get_orientation (EggTrayIcon *icon) { g_return_val_if_fail (EGG_IS_TRAY_ICON (icon), GTK_ORIENTATION_HORIZONTAL); return icon->orientation; } Gtk2-TrayIcon-0.06/README0000644000175000017500000000047410633772202014161 0ustar ebassiebassiREADME for Gtk2::TrayIcon This module allows a Perl developer to embed an arbitrary widget in a System Tray like the Gnome notification area. It requires the Gtk2 modules to be installed, but includes the code for libeggtray which it wraps. Install as allways. perl Makefile.PL make make test make install Gtk2-TrayIcon-0.06/examples/0000755000175000017500000000000010640473175015117 5ustar ebassiebassiGtk2-TrayIcon-0.06/examples/simple.pl0000644000175000017500000000025410633772202016741 0ustar ebassiebassi use strict; use warnings; use Gtk2::TrayIcon; Gtk2->init; my $icon= Gtk2::TrayIcon->new("test"); $icon->add( Gtk2::Label->new("test") ); $icon->show_all; Gtk2->main; Gtk2-TrayIcon-0.06/trayicon.h0000644000175000017500000000000310633772202015266 0ustar ebassiebassi Gtk2-TrayIcon-0.06/MANIFEST.SKIP0000644000175000017500000000015710633772202015175 0ustar ebassiebassi~$ \.bak$ blib \.bs$ build CVS \.cvsignore$ Makefile$ Makefile\.old$ \.o$ \.spec$ \.sw.$ \.tar\.gz$ TrayIcon.c Gtk2-TrayIcon-0.06/maps0000644000175000017500000000007010633772202014154 0ustar ebassiebassiEGG_TYPE_TRAY_ICON EggTrayIcon GObject Gtk2::TrayIcon Gtk2-TrayIcon-0.06/TrayIcon.pm0000644000175000017500000000550510640470105015362 0ustar ebassiebassipackage Gtk2::TrayIcon; use 5.008; use strict; use warnings; use Gtk2; require DynaLoader; our @ISA = qw(DynaLoader); our $VERSION = '0.06'; sub dl_load_flags { 0x01 } bootstrap Gtk2::TrayIcon $VERSION; # Preloaded methods go here. 1; __END__ =head1 NAME Gtk2::TrayIcon - Perl interface to the EggTrayIcon library =head1 SYNOPSIS use Gtk2::TrayIcon; Gtk2->init; my $icon= Gtk2::TrayIcon->new("test"); my $label= Gtk2::Label->new("test"); $icon->add($label); $icon->show_all; Gtk2->main; =head1 ABSTRACT This module allows a Perl developer to embed an arbitrary widget in a System Tray like the Gnome notification area. =head1 DESCRIPTION EggTrayIcon is slated for inclusion in Gtk+ at some point, which is the reason the C namespace. As all egg libs, EggTrayIcon is not considered api stable and its not installed as a shared object. Enough about what it is not, C is first and foremost a simple way of giving a Gtk2 script access to the system tray. System Trays are found in both KDE and Gnome. But neither support the spec fully (see below). C is a subclass of C and should be used as such. =head1 METHODS 5 methods are available. =over 4 =item $trayicon= Gtk2::TrayIcon->new_from_screen($screen, $name) This creates a widget already connected to the notification area of C<$screen>. C<$screen> should be a C. =item $trayicon= Gtk2::TrayIcon->new($name) Like C but uses the default screen of the active display. =item $msgid= $trayicon->send_message($timeout, $message) Ask the tray to display C<$message> for C<$timeout> milliseconds. If C<$timeout> is 0, the message will not expire. Note that it is up to the tray to decide what to do with the message both Gnome and KDE just ignores it. =item $trayicon->cancel_message($msgid) Ask the tray to cancel the message. =back =head1 SEE ALSO L, L and The System Tray Spec http://www.freedesktop.org/Standards/systemtray-spec. =head1 AUTHOR Christian Borup Egtk2-perl at borup dot comE =head1 COPYRIGHT AND LICENSE Copyright 2003 by the gtk2-perl team. 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. =cut Gtk2-TrayIcon-0.06/eggtrayicon.h0000644000175000017500000000503610633772202015764 0ustar ebassiebassi/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* eggtrayicon.h * Copyright (C) 2002 Anders Carlsson * * 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 #ifdef GDK_WINDOWING_X11 #include #endif G_BEGIN_DECLS #define EGG_TYPE_TRAY_ICON (egg_tray_icon_get_type ()) #define EGG_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TRAY_ICON, EggTrayIcon)) #define EGG_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_TRAY_ICON, EggTrayIconClass)) #define EGG_IS_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TRAY_ICON)) #define EGG_IS_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_TRAY_ICON)) #define EGG_TRAY_ICON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_TRAY_ICON, EggTrayIconClass)) typedef struct _EggTrayIcon EggTrayIcon; typedef struct _EggTrayIconClass EggTrayIconClass; struct _EggTrayIcon { GtkPlug parent_instance; guint stamp; #ifdef GDK_WINDOWING_X11 Atom selection_atom; Atom manager_atom; Atom system_tray_opcode_atom; Atom orientation_atom; Window manager_window; #endif GtkOrientation orientation; }; struct _EggTrayIconClass { GtkPlugClass parent_class; }; GType egg_tray_icon_get_type (void); EggTrayIcon *egg_tray_icon_new_for_screen (GdkScreen *screen, const gchar *name); EggTrayIcon *egg_tray_icon_new (const gchar *name); guint egg_tray_icon_send_message (EggTrayIcon *icon, gint timeout, const char *message, gint len); void egg_tray_icon_cancel_message (EggTrayIcon *icon, guint id); GtkOrientation egg_tray_icon_get_orientation (EggTrayIcon *icon); G_END_DECLS #endif /* __EGG_TRAY_ICON_H__ */ Gtk2-TrayIcon-0.06/perl-Gtk2-TrayIcon.spec.in0000644000175000017500000000530010633772202020050 0ustar ebassiebassiSummary: Gtk2-TrayIcon Perl module Name: perl-Gtk2-TrayIcon Version: @VERSION@ Release: 1 Packager: gtk-perl-list@gnome.org License: LGPL Group: Development/Libraries URL: http://search.cpan.org/dist/Gtk2-TrayIcon/ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: perl >= 2:5.8.0 BuildRequires: gtk2-devel >= @GTK@ BuildRequires: perl-ExtUtils-Depends >= @PERL_EXTUTILS_DEPENDS@ BuildRequires: perl-ExtUtils-PkgConfig >= @PERL_EXTUTILS_PKGCONFIG@ BuildRequires: perl-Glib >= @PERL_GLIB@ BuildRequires: perl-Gtk2 >= @PERL_GTK@ Requires: perl-Glib >= @PERL_GLIB@ Requires: perl-Gtk2 >= @PERL_GTK@ Requires: %(perl -MConfig -le 'if (defined $Config{useithreads}) { print "perl(:WITH_ITHREADS)" } else { print "perl(:WITHOUT_ITHREADS)" }') Requires: %(perl -MConfig -le 'if (defined $Config{usethreads}) { print "perl(:WITH_THREADS)" } else { print "perl(:WITHOUT_THREADS)" }') Requires: %(perl -MConfig -le 'if (defined $Config{uselargefiles}) { print "perl(:WITH_LARGEFILES)" } else { print "perl(:WITHOUT_LARGEFILES)" }') Source0: @SOURCE@ %description This module allows a Perl developer to embed an arbitrary widget in a System Tray like the Gnome notification area. %prep %setup -q -n Gtk2-TrayIcon-%{version} %build CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL PREFIX=$RPM_BUILD_ROOT%{_prefix} make OPTIMIZE="$RPM_OPT_FLAGS" make test %install %makeinstall [ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress find $RPM_BUILD_ROOT \( -name perllocal.pod -o -name .packlist \) -exec rm -v {} \; find $RPM_BUILD_ROOT/usr -type f -print | \ sed "s@^$RPM_BUILD_ROOT@@g" | \ grep -v perllocal.pod | \ grep -v "\.packlist" > %{name}-%{version}-filelist if [ "$(cat %{name}-%{version}-filelist)X" = "X" ] ; then exit -1 fi %clean rm -rf $RPM_BUILD_ROOT %files -f %{name}-%{version}-filelist %defattr(-,root,root) %changelog * @DATE@ gtk-perl-list@gnome.org - @VERSION@ - Specfile autogenerated. # Copyright (C) 2003 by the gtk2-perl team (see the file AUTHORS for the full # list) # # 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.1 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.