r28786 - in /branches/upstream/libgtk2-trayicon-perl: ./ current/ current/examples/ current/t/

ryan52-guest at users.alioth.debian.org ryan52-guest at users.alioth.debian.org
Sun Dec 28 07:49:17 UTC 2008


Author: ryan52-guest
Date: Sun Dec 28 07:49:14 2008
New Revision: 28786

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=28786
Log:
[svn-inject] Installing original source of libgtk2-trayicon-perl

Added:
    branches/upstream/libgtk2-trayicon-perl/
    branches/upstream/libgtk2-trayicon-perl/current/
    branches/upstream/libgtk2-trayicon-perl/current/ChangeLog
    branches/upstream/libgtk2-trayicon-perl/current/MANIFEST
    branches/upstream/libgtk2-trayicon-perl/current/MANIFEST.SKIP
    branches/upstream/libgtk2-trayicon-perl/current/META.yml
    branches/upstream/libgtk2-trayicon-perl/current/Makefile.PL
    branches/upstream/libgtk2-trayicon-perl/current/README
    branches/upstream/libgtk2-trayicon-perl/current/TODO
    branches/upstream/libgtk2-trayicon-perl/current/TrayIcon.pm
    branches/upstream/libgtk2-trayicon-perl/current/TrayIcon.xs
    branches/upstream/libgtk2-trayicon-perl/current/config.h
    branches/upstream/libgtk2-trayicon-perl/current/eggtrayicon.c
    branches/upstream/libgtk2-trayicon-perl/current/eggtrayicon.h
    branches/upstream/libgtk2-trayicon-perl/current/examples/
    branches/upstream/libgtk2-trayicon-perl/current/examples/simple.pl
    branches/upstream/libgtk2-trayicon-perl/current/maps
    branches/upstream/libgtk2-trayicon-perl/current/perl-Gtk2-TrayIcon.spec.in
    branches/upstream/libgtk2-trayicon-perl/current/t/
    branches/upstream/libgtk2-trayicon-perl/current/t/load.t
    branches/upstream/libgtk2-trayicon-perl/current/trayicon.h

Added: branches/upstream/libgtk2-trayicon-perl/current/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgtk2-trayicon-perl/current/ChangeLog?rev=28786&op=file
==============================================================================
--- branches/upstream/libgtk2-trayicon-perl/current/ChangeLog (added)
+++ branches/upstream/libgtk2-trayicon-perl/current/ChangeLog Sun Dec 28 07:49:14 2008
@@ -1,0 +1,46 @@
+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.
+

Added: branches/upstream/libgtk2-trayicon-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgtk2-trayicon-perl/current/MANIFEST?rev=28786&op=file
==============================================================================
--- branches/upstream/libgtk2-trayicon-perl/current/MANIFEST (added)
+++ branches/upstream/libgtk2-trayicon-perl/current/MANIFEST Sun Dec 28 07:49:14 2008
@@ -1,0 +1,17 @@
+ChangeLog
+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

Added: branches/upstream/libgtk2-trayicon-perl/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgtk2-trayicon-perl/current/MANIFEST.SKIP?rev=28786&op=file
==============================================================================
--- branches/upstream/libgtk2-trayicon-perl/current/MANIFEST.SKIP (added)
+++ branches/upstream/libgtk2-trayicon-perl/current/MANIFEST.SKIP Sun Dec 28 07:49:14 2008
@@ -1,0 +1,14 @@
+CVS
+\.bak$
+\.bs$
+TrayIcon.c
+\.o$
+Makefile$
+Makefile\.old$
+~$
+\.sw.$
+\.cvsignore$
+blib
+build
+Gtk2-TrayIcon-.+\.tar\.gz
+

Added: branches/upstream/libgtk2-trayicon-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgtk2-trayicon-perl/current/META.yml?rev=28786&op=file
==============================================================================
--- branches/upstream/libgtk2-trayicon-perl/current/META.yml (added)
+++ branches/upstream/libgtk2-trayicon-perl/current/META.yml Sun Dec 28 07:49:14 2008
@@ -1,0 +1,11 @@
+# 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.04
+version_from: TrayIcon.pm
+installdirs:  site
+requires:
+    Gtk2:                          0.96
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17

Added: branches/upstream/libgtk2-trayicon-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgtk2-trayicon-perl/current/Makefile.PL?rev=28786&op=file
==============================================================================
--- branches/upstream/libgtk2-trayicon-perl/current/Makefile.PL (added)
+++ branches/upstream/libgtk2-trayicon-perl/current/Makefile.PL Sun Dec 28 07:49:14 2008
@@ -1,0 +1,91 @@
+
+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

Added: branches/upstream/libgtk2-trayicon-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgtk2-trayicon-perl/current/README?rev=28786&op=file
==============================================================================
--- branches/upstream/libgtk2-trayicon-perl/current/README (added)
+++ branches/upstream/libgtk2-trayicon-perl/current/README Sun Dec 28 07:49:14 2008
@@ -1,0 +1,16 @@
+README 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
+
+

Added: branches/upstream/libgtk2-trayicon-perl/current/TODO
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgtk2-trayicon-perl/current/TODO?rev=28786&op=file
==============================================================================
--- branches/upstream/libgtk2-trayicon-perl/current/TODO (added)
+++ branches/upstream/libgtk2-trayicon-perl/current/TODO Sun Dec 28 07:49:14 2008
@@ -1,0 +1,3 @@
+
+EggTrayIcon is not api stable - must keep up.
+

Added: branches/upstream/libgtk2-trayicon-perl/current/TrayIcon.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgtk2-trayicon-perl/current/TrayIcon.pm?rev=28786&op=file
==============================================================================
--- branches/upstream/libgtk2-trayicon-perl/current/TrayIcon.pm (added)
+++ branches/upstream/libgtk2-trayicon-perl/current/TrayIcon.pm Sun Dec 28 07:49:14 2008
@@ -1,0 +1,118 @@
+package Gtk2::TrayIcon;
+
+use 5.008;
+use strict;
+use warnings;
+
+use Gtk2;
+
+require DynaLoader;
+
+our @ISA = qw(DynaLoader);
+
+
+our $VERSION = '0.04';
+
+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<Gtk2::TrayIcon> 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<Gtk2::TrayIcon> 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<Gtk2::TrayIcon> is a subclass of C<Gtk2::Plug> 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<Gtk::Gdk::Screen>.
+
+=item $trayicon= Gtk2::TrayIcon->new($name)
+
+Like C<new_from_screen> 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<Glib>, L<Gtk2> and The System Tray Spec http://www.freedesktop.org/Standards/systemtray-spec.
+
+=head1 AUTHOR
+
+Christian Borup E<lt>gtk2-perl at borup dot comE<gt>
+
+=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

Added: branches/upstream/libgtk2-trayicon-perl/current/TrayIcon.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgtk2-trayicon-perl/current/TrayIcon.xs?rev=28786&op=file
==============================================================================
--- branches/upstream/libgtk2-trayicon-perl/current/TrayIcon.xs (added)
+++ branches/upstream/libgtk2-trayicon-perl/current/TrayIcon.xs Sun Dec 28 07:49:14 2008
@@ -1,0 +1,50 @@
+#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"
+

Added: branches/upstream/libgtk2-trayicon-perl/current/config.h
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgtk2-trayicon-perl/current/config.h?rev=28786&op=file
==============================================================================
--- branches/upstream/libgtk2-trayicon-perl/current/config.h (added)
+++ branches/upstream/libgtk2-trayicon-perl/current/config.h Sun Dec 28 07:49:14 2008
@@ -1,0 +1,1 @@
+

Added: branches/upstream/libgtk2-trayicon-perl/current/eggtrayicon.c
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgtk2-trayicon-perl/current/eggtrayicon.c?rev=28786&op=file
==============================================================================
--- branches/upstream/libgtk2-trayicon-perl/current/eggtrayicon.c (added)
+++ branches/upstream/libgtk2-trayicon-perl/current/eggtrayicon.c Sun Dec 28 07:49:14 2008
@@ -1,0 +1,528 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* eggtrayicon.c
+ * Copyright (C) 2002 Anders Carlsson <andersca at 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 <string.h>
+#include <libintl.h>
+
+#include "eggtrayicon.h"
+
+#include <gdk/gdkx.h>
+#include <X11/Xatom.h>
+
+#ifndef EGG_COMPILATION
+#ifndef _
+#define _(x) dgettext (GETTEXT_PACKAGE, x)
+#define N_(x) x
+#endif
+#else
+#define _(x) x
+#define N_(x) x
+#endif
+
+#define SYSTEM_TRAY_REQUEST_DOCK    0
+#define SYSTEM_TRAY_BEGIN_MESSAGE   1
+#define SYSTEM_TRAY_CANCEL_MESSAGE  2
+
+#define SYSTEM_TRAY_ORIENTATION_HORZ 0
+#define SYSTEM_TRAY_ORIENTATION_VERT 1
+
+enum {
+  PROP_0,
+  PROP_ORIENTATION
+};
+         
+static GtkPlugClass *parent_class = NULL;
+
+static void egg_tray_icon_init (EggTrayIcon *icon);
+static void egg_tray_icon_class_init (EggTrayIconClass *klass);
+
+static void egg_tray_icon_get_property (GObject    *object,
+					guint       prop_id,
+					GValue     *value,
+					GParamSpec *pspec);
+
+static void egg_tray_icon_realize   (GtkWidget *widget);
+static void egg_tray_icon_unrealize (GtkWidget *widget);
+
+static void egg_tray_icon_update_manager_window (EggTrayIcon *icon);
+
+GType
+egg_tray_icon_get_type (void)
+{
+  static GType our_type = 0;
+
+  if (our_type == 0)
+    {
+      static const GTypeInfo our_info =
+      {
+	sizeof (EggTrayIconClass),
+	(GBaseInitFunc) NULL,
+	(GBaseFinalizeFunc) NULL,
+	(GClassInitFunc) egg_tray_icon_class_init,
+	NULL, /* class_finalize */
+	NULL, /* class_data */
+	sizeof (EggTrayIcon),
+	0,    /* n_preallocs */
+	(GInstanceInitFunc) egg_tray_icon_init
+      };
+
+      our_type = g_type_register_static (GTK_TYPE_PLUG, "EggTrayIcon", &our_info, 0);
+    }
+
+  return our_type;
+}
+
+static void
+egg_tray_icon_init (EggTrayIcon *icon)
+{
+  icon->stamp = 1;
+  icon->orientation = GTK_ORIENTATION_HORIZONTAL;
+  
+  gtk_widget_add_events (GTK_WIDGET (icon), GDK_PROPERTY_CHANGE_MASK);
+}
+
+static void
+egg_tray_icon_class_init (EggTrayIconClass *klass)
+{
+  GObjectClass *gobject_class = (GObjectClass *)klass;
+  GtkWidgetClass *widget_class = (GtkWidgetClass *)klass;
+
+  parent_class = g_type_class_peek_parent (klass);
+
+  gobject_class->get_property = egg_tray_icon_get_property;
+
+  widget_class->realize   = egg_tray_icon_realize;
+  widget_class->unrealize = egg_tray_icon_unrealize;
+
+  g_object_class_install_property (gobject_class,
+				   PROP_ORIENTATION,
+				   g_param_spec_enum ("orientation",
+						      _("Orientation"),
+						      _("The orientation of the tray."),
+						      GTK_TYPE_ORIENTATION,
+						      GTK_ORIENTATION_HORIZONTAL,
+						      G_PARAM_READABLE));
+}
+
+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);
+
+#ifdef GDK_TYPE_DISPLAY
+  xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
+#else
+  xdisplay = GDK_WINDOW_XDISPLAY (GTK_WIDGET (icon)->window);
+#endif
+
+  gdk_error_trap_push ();
+  type = None;
+  result = XGetWindowProperty (xdisplay,
+			       icon->manager_window,
+			       icon->orientation_atom,
+			       0, G_MAXLONG, FALSE,
+			       XA_CARDINAL,
+			       &type, &format, &nitems,
+			       &bytes_after, &(prop.prop_ch));
+  error = gdk_error_trap_pop ();
+
+  if (error || result != Success)
+    return;
+
+  if (type == XA_CARDINAL)
+    {
+      GtkOrientation orientation;
+
+      orientation = (prop.prop [0] == SYSTEM_TRAY_ORIENTATION_HORZ) ?
+					GTK_ORIENTATION_HORIZONTAL :
+					GTK_ORIENTATION_VERTICAL;
+
+      if (icon->orientation != orientation)
+	{
+	  icon->orientation = orientation;
+
+	  g_object_notify (G_OBJECT (icon), "orientation");
+	}
+    }
+
+  if (prop.prop)
+    XFree (prop.prop);
+}
+
+static GdkFilterReturn
+egg_tray_icon_manager_filter (GdkXEvent *xevent, GdkEvent *event, gpointer user_data)
+{
+  EggTrayIcon *icon = user_data;
+  XEvent *xev = (XEvent *)xevent;
+
+  if (xev->xany.type == ClientMessage &&
+      xev->xclient.message_type == icon->manager_atom &&
+      xev->xclient.data.l[1] == icon->selection_atom)
+    {
+      egg_tray_icon_update_manager_window (icon);
+    }
+  else if (xev->xany.window == icon->manager_window)
+    {
+      if (xev->xany.type == PropertyNotify &&
+	  xev->xproperty.atom == icon->orientation_atom)
+	{
+	  egg_tray_icon_get_orientation_property (icon);
+	}
+      if (xev->xany.type == DestroyNotify)
+	{
+	  egg_tray_icon_update_manager_window (icon);
+	}
+    }
+  
+  return GDK_FILTER_CONTINUE;
+}
+
+static void
+egg_tray_icon_unrealize (GtkWidget *widget)
+{
+  EggTrayIcon *icon = EGG_TRAY_ICON (widget);
+  GdkWindow *root_window;
+
+  if (icon->manager_window != None)
+    {
+      GdkWindow *gdkwin;
+
+#ifdef GDK_TYPE_DISPLAY
+      gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (widget),
+                                              icon->manager_window);
+#else
+      gdkwin = gdk_window_lookup (icon->manager_window);
+#endif
+
+      gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon);
+    }
+
+#ifdef GDK_TYPE_SCREEN
+  root_window = gdk_screen_get_root_window (gtk_widget_get_screen (widget));
+#else
+  root_window = gdk_get_default_root_window ();
+#endif
+
+  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;
+
+#ifdef GDK_TYPE_DISPLAY
+  display = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
+#else
+  display = GDK_WINDOW_XDISPLAY (GTK_WIDGET (icon)->window);
+#endif
+  
+  gdk_error_trap_push ();
+  XSendEvent (display,
+	      icon->manager_window, False, NoEventMask, (XEvent *)&ev);
+  XSync (display, False);
+  gdk_error_trap_pop ();
+}
+
+static void
+egg_tray_icon_send_dock_request (EggTrayIcon *icon)
+{
+  egg_tray_icon_send_manager_message (icon,
+				      SYSTEM_TRAY_REQUEST_DOCK,
+				      icon->manager_window,
+				      gtk_plug_get_id (GTK_PLUG (icon)),
+				      0, 0);
+}
+
+static void
+egg_tray_icon_update_manager_window (EggTrayIcon *icon)
+{
+  Display *xdisplay;
+  
+#ifdef GDK_TYPE_DISPLAY
+  xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
+#else
+  xdisplay = GDK_WINDOW_XDISPLAY (GTK_WIDGET (icon)->window);
+#endif
+  
+  if (icon->manager_window != None)
+    {
+      GdkWindow *gdkwin;
+
+#ifdef GDK_TYPE_DISPLAY
+      gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)),
+					      icon->manager_window);
+#else
+      gdkwin = gdk_window_lookup (icon->manager_window);
+#endif
+      
+      gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon);
+    }
+  
+  XGrabServer (xdisplay);
+  
+  icon->manager_window = XGetSelectionOwner (xdisplay,
+					     icon->selection_atom);
+
+  if (icon->manager_window != None)
+    XSelectInput (xdisplay,
+		  icon->manager_window, StructureNotifyMask|PropertyChangeMask);
+
+  XUngrabServer (xdisplay);
+  XFlush (xdisplay);
+  
+  if (icon->manager_window != None)
+    {
+      GdkWindow *gdkwin;
+
+#ifdef GDK_TYPE_DISPLAY
+      gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)),
+					      icon->manager_window);
+#else
+      gdkwin = gdk_window_lookup (icon->manager_window);
+#endif
+      
+      gdk_window_add_filter (gdkwin, egg_tray_icon_manager_filter, icon);
+
+      /* Send a request that we'd like to dock */
+      egg_tray_icon_send_dock_request (icon);
+
+      egg_tray_icon_get_orientation_property (icon);
+    }
+}
+
+static void
+egg_tray_icon_realize (GtkWidget *widget)
+{
+  EggTrayIcon *icon = EGG_TRAY_ICON (widget);
+#if defined(GDK_TYPE_DISPLAY) && defined(GDK_TYPE_SCREEN)
+  GdkScreen *screen;
+  GdkDisplay *display;
+#endif
+  Display *xdisplay;
+  char buffer[256];
+  GdkWindow *root_window;
+
+  if (GTK_WIDGET_CLASS (parent_class)->realize)
+    GTK_WIDGET_CLASS (parent_class)->realize (widget);
+
+#if defined(GDK_TYPE_DISPLAY) && defined(GDK_TYPE_SCREEN)
+  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));
+#else
+  xdisplay = GDK_WINDOW_XDISPLAY (widget->window);
+
+  /* Now see if there's a manager window around */
+  g_snprintf (buffer, sizeof (buffer),
+	      "_NET_SYSTEM_TRAY_S%d",
+	      0);
+#endif
+
+  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);
+
+#ifdef GDK_TYPE_SCREEN
+  root_window = gdk_screen_get_root_window (screen);
+#else
+  root_window = gdk_get_default_root_window ();
+#endif
+  
+  /* Add a root window filter so that we get changes on MANAGER */
+  gdk_window_add_filter (root_window,
+			 egg_tray_icon_manager_filter, icon);
+}
+
+#ifdef GDK_TYPE_SCREEN
+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);
+}
+#endif
+
+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;
+
+#ifdef GDK_TYPE_DISPLAY
+      xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
+#else
+      xdisplay = GDK_WINDOW_XDISPLAY (GTK_WIDGET (icon)->window);
+#endif
+      
+      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;
+}

Added: branches/upstream/libgtk2-trayicon-perl/current/eggtrayicon.h
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgtk2-trayicon-perl/current/eggtrayicon.h?rev=28786&op=file
==============================================================================
--- branches/upstream/libgtk2-trayicon-perl/current/eggtrayicon.h (added)
+++ branches/upstream/libgtk2-trayicon-perl/current/eggtrayicon.h Sun Dec 28 07:49:14 2008
@@ -1,0 +1,78 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* eggtrayicon.h
+ * Copyright (C) 2002 Anders Carlsson <andersca at 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);
+
+#ifdef GDK_TYPE_SCREEN
+EggTrayIcon *egg_tray_icon_new_for_screen (GdkScreen   *screen,
+					   const gchar *name);
+#endif
+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__ */

Added: branches/upstream/libgtk2-trayicon-perl/current/examples/simple.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgtk2-trayicon-perl/current/examples/simple.pl?rev=28786&op=file
==============================================================================
--- branches/upstream/libgtk2-trayicon-perl/current/examples/simple.pl (added)
+++ branches/upstream/libgtk2-trayicon-perl/current/examples/simple.pl Sun Dec 28 07:49:14 2008
@@ -1,0 +1,14 @@
+
+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;
+

Added: branches/upstream/libgtk2-trayicon-perl/current/maps
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgtk2-trayicon-perl/current/maps?rev=28786&op=file
==============================================================================
--- branches/upstream/libgtk2-trayicon-perl/current/maps (added)
+++ branches/upstream/libgtk2-trayicon-perl/current/maps Sun Dec 28 07:49:14 2008
@@ -1,0 +1,2 @@
+EGG_TYPE_TRAY_ICON	EggTrayIcon	GObject		Gtk2::TrayIcon
+

Added: branches/upstream/libgtk2-trayicon-perl/current/perl-Gtk2-TrayIcon.spec.in
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgtk2-trayicon-perl/current/perl-Gtk2-TrayIcon.spec.in?rev=28786&op=file
==============================================================================
--- branches/upstream/libgtk2-trayicon-perl/current/perl-Gtk2-TrayIcon.spec.in (added)
+++ branches/upstream/libgtk2-trayicon-perl/current/perl-Gtk2-TrayIcon.spec.in Sun Dec 28 07:49:14 2008
@@ -1,0 +1,76 @@
+Summary: Gtk2-TrayIcon Perl module
+Name: perl-Gtk2-TrayIcon
+Version: @VERSION@
+Release: 1
+Packager: gtk-perl-list at 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
+rm -rf $RPM_BUILD_ROOT
+eval `perl '-V:installarchlib'`
+mkdir -p $RPM_BUILD_ROOT$installarchlib
+%makeinstall
+rm -f `find $RPM_BUILD_ROOT -type f -name perllocal.pod -o -name .packlist`
+
+[ -x %{_libdir}/rpm/brp-compress ] && %{_libdir}/rpm/brp-compress
+
+find $RPM_BUILD_ROOT%{_prefix} -type f -print | \
+	sed "s@^$RPM_BUILD_ROOT@@g" > %{name}-%{version}-%{release}-filelist
+if [ "$(cat %{name}-%{version}-%{release}-filelist)X" = "X" ] ; then
+    echo "ERROR: EMPTY FILE LIST"
+    exit 1
+fi
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files -f %{name}-%{version}-%{release}-filelist
+%defattr(-,root,root,-)
+
+%changelog
+* @DATE@ gtk-perl-list at 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.

Added: branches/upstream/libgtk2-trayicon-perl/current/t/load.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgtk2-trayicon-perl/current/t/load.t?rev=28786&op=file
==============================================================================
--- branches/upstream/libgtk2-trayicon-perl/current/t/load.t (added)
+++ branches/upstream/libgtk2-trayicon-perl/current/t/load.t Sun Dec 28 07:49:14 2008
@@ -1,0 +1,13 @@
+
+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' );
+

Added: branches/upstream/libgtk2-trayicon-perl/current/trayicon.h
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgtk2-trayicon-perl/current/trayicon.h?rev=28786&op=file
==============================================================================
--- branches/upstream/libgtk2-trayicon-perl/current/trayicon.h (added)
+++ branches/upstream/libgtk2-trayicon-perl/current/trayicon.h Sun Dec 28 07:49:14 2008
@@ -1,0 +1,3 @@
+
+
+




More information about the Pkg-perl-cvs-commits mailing list