/usr/share/gtk-doc/html/panel-applet-4.0/getting-started.introspection.html is in libpanel-applet-4-doc 1:3.8.0-1ubuntu11.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Writing an applet in languages other than C</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="Panel Applet Library Reference Manual">
<link rel="up" href="getting-started.html" title="Part II. Getting Started with the Panel Applet library">
<link rel="prev" href="getting-started.in-out-process.html" title="Out-of-Process vs In-Process">
<link rel="next" href="port-gnome2.html" title="Part III. Porting Applets from GNOME 2.x">
<meta name="generator" content="GTK-Doc V1.19 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="getting-started.in-out-process.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="getting-started.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Panel Applet Library Reference Manual</th>
<td><a accesskey="n" href="port-gnome2.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="chapter">
<div class="titlepage"><div><div><h2 class="title">
<a name="getting-started.introspection"></a>Writing an applet in languages other than C</h2></div></div></div>
<p>
The Panel Applet library comes with support for <a class="ulink" href="http://live.gnome.org/GObjectIntrospection" target="_top">GObject Introspection</a>. This makes it possible to write applets in the languages that have <a class="ulink" href="http://live.gnome.org/GObjectIntrospection/Users" target="_top">bindings based on GObject Introspection</a>.
</p>
<p>
Here is a simple example of a python applet:
</p>
<div class="example">
<a name="id-1.3.10.3.1"></a><p class="title"><b>Example 4. Hello World applet, in Python</b></p>
<div class="example-contents">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19</pre></td>
<td class="listing_code"><pre class="programlisting">from gi<span class="gtkdoc opt">.</span>repository import Gtk
from gi<span class="gtkdoc opt">.</span>repository import PanelApplet
def <span class="function">applet_fill</span><span class="gtkdoc opt">(</span>applet<span class="gtkdoc opt">):</span>
label <span class="gtkdoc opt">=</span> Gtk<span class="gtkdoc opt">.</span><span class="function">Label</span><span class="gtkdoc opt">(</span><span class="string">"Hello World"</span><span class="gtkdoc opt">)</span>
applet<span class="gtkdoc opt">.</span><span class="function">add</span><span class="gtkdoc opt">(</span>label<span class="gtkdoc opt">)</span>
applet<span class="gtkdoc opt">.</span><span class="function">show_all</span><span class="gtkdoc opt">()</span>
def <span class="function">applet_factory</span><span class="gtkdoc opt">(</span>applet<span class="gtkdoc opt">,</span> iid<span class="gtkdoc opt">,</span> data<span class="gtkdoc opt">):</span>
<span class="keyword">if</span> iid <span class="gtkdoc opt">!=</span> <span class="string">"HelloWorldApplet"</span><span class="gtkdoc opt">:</span>
<span class="keyword">return</span> False
<span class="function">applet_fill</span><span class="gtkdoc opt">(</span>applet<span class="gtkdoc opt">)</span>
<span class="keyword">return</span> True
PanelApplet<span class="gtkdoc opt">.</span>Applet<span class="gtkdoc opt">.</span><span class="function">factory_main</span><span class="gtkdoc opt">(</span><span class="string">"HelloWorldFactory"</span><span class="gtkdoc opt">,</span>
PanelApplet<span class="gtkdoc opt">.</span>Applet<span class="gtkdoc opt">.</span>__gtype__<span class="gtkdoc opt">,</span>
applet_factory<span class="gtkdoc opt">,</span> None<span class="gtkdoc opt">)</span></pre></td>
</tr>
</tbody>
</table>
</div>
</div>
<p><br class="example-break">
</p>
<p>
The only limitation of writing an applet in a language other than C is that the applet will not be able to run in the panel process: it will have to stay out-of-process. However, since it is recommended to leave applets out-of-process, this limitation is mitigated.
</p>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.19</div>
</body>
</html>
|