[perl-Gnome2-PanelApplet] Wrap additional API
- From: Torsten Schönfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Gnome2-PanelApplet] Wrap additional API
- Date: Sun, 7 Mar 2010 01:13:48 +0000 (UTC)
commit d7fa435b0ebaf9eb81bf06281e84b5c6ef46756f
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date: Sun Mar 7 02:11:20 2010 +0100
Wrap additional API
Wrap and test panel_applet_get_locked_down (added in libpanel-applet
2.10), and panel_applet_request_focus and
panel_applet_set_background_widget (added in 2.14). To help test and
use these, also provide Gnome2::PanelApplet->CHECK_VERSION.
t/test-applet | 38 ++++++++++++++++++++++++++++++--------
xs/PanelApplet.xs | 33 +++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 8 deletions(-)
---
diff --git a/t/test-applet b/t/test-applet
index bc183b9..40694da 100755
--- a/t/test-applet
+++ b/t/test-applet
@@ -1,18 +1,17 @@
-#!/usr/bin/perl
+#!/opt/perl-5.10.1/bin/perl
# -*- coding: utf-8 -*-
+
+# Uncomment and modify this and the shebang above if you have the Perl modules
+# in a custom directory and the panel's environment isn't set up so that perl
+# can find them.
+use lib qw(/opt/perl-5.10.1-lib/lib/perl5);
+
use strict;
use warnings;
use utf8;
use Test::More qw(no_plan);
-# Uncomment and modify this if you have the Perl modules in a custom directory
-# and the panel's environment isn't set up so that perl can find them.
-# use lib qw(/opt/perl/share/perl
-# /opt/perl/lib
-# /opt/perl/lib/perl
-# /opt/perl/lib/perl/site_perl);
-
use Glib qw(:constants);
use Gnome2::PanelApplet;
@@ -36,6 +35,7 @@ sub fill {
<menuitem name="TestDos Item" verb="TestDos" _label="Test II ..."/>
<menuitem name="TestTres Item" verb="TestTres" _label="Test III ..."/>
<menuitem name="TestCuatro Item" verb="TestCuatro" _label="Test IV ..."/>
+ <menuitem name="TestCinco Item" verb="TestCinco" _label="Test V ..."/>
</popup>
EOX
@@ -44,6 +44,7 @@ EOX
TestDos => \&test_two,
TestTres => \&test_three,
TestCuatro => \&test_four,
+ TestCinco => \&test_five,
};
$applet->setup_menu($menu_xml, $cb_mapping, $applet);
@@ -190,3 +191,24 @@ sub test_four {
_show_results ($$output_ref);
}
+
+sub test_five {
+ my ($component, $applet, $verb) = @_;
+
+ my $output_ref = _setup_output (my $fh);
+
+ if (Gnome2::PanelApplet->CHECK_VERSION(2, 10, 0)) {
+ my $locked_down = $applet->get_locked_down ();
+ ok(defined $locked_down, "locked down: $locked_down");
+
+ $applet->request_focus(0);
+ ok(TRUE, 'requested focus');
+ }
+
+ if (Gnome2::PanelApplet->CHECK_VERSION(2, 14, 0)) {
+ $applet->set_background_widget(Gtk2::Button->new ('Huh'));
+ ok(TRUE, 'set background widget');
+ }
+
+ _show_results ($$output_ref);
+}
diff --git a/xs/PanelApplet.xs b/xs/PanelApplet.xs
index 3c4b750..6a9a7ed 100644
--- a/xs/PanelApplet.xs
+++ b/xs/PanelApplet.xs
@@ -401,6 +401,39 @@ panel_applet_setup_menu_from_file (applet, opt_datadir, file, opt_app_name, verb
real_verb_list,
(GDestroyNotify) destroy_verb_list);
+#if PANEL_APPLET_CHECK_VERSION(2, 10, 0)
+
+gboolean panel_applet_get_locked_down (PanelApplet *applet);
+
+void panel_applet_request_focus (PanelApplet *applet, guint32 timestamp);
+
+#endif
+
+#if PANEL_APPLET_CHECK_VERSION(2, 14, 0)
+
+void panel_applet_set_background_widget (PanelApplet *applet, GtkWidget *widget);
+
+#endif
+
+void
+GET_VERSION_INFO (class)
+ PPCODE:
+ EXTEND (SP, 3);
+ PUSHs (sv_2mortal (newSViv (PANEL_APPLET_MAJOR_VERSION)));
+ PUSHs (sv_2mortal (newSViv (PANEL_APPLET_MINOR_VERSION)));
+ PUSHs (sv_2mortal (newSViv (PANEL_APPLET_MICRO_VERSION)));
+ PERL_UNUSED_VAR (ax);
+
+bool
+CHECK_VERSION (class, major, minor, micro)
+ int major
+ int minor
+ int micro
+ CODE:
+ RETVAL = PANEL_APPLET_CHECK_VERSION (major, minor, micro);
+ OUTPUT:
+ RETVAL
+
# --------------------------------------------------------------------------- #
MODULE = Gnome2::PanelApplet PACKAGE = Gnome2::PanelApplet::Factory PREFIX = panel_applet_factory_
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]