/usr/share/gtk-doc/html/libpanel-applet/getting-started.introspection.html is in libpanel-applet-doc 1:3.26.0-1ubuntu5.
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 93 94 95 96 | <!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: Panel Applet Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="Panel Applet 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.integration.html" title="Proper Integration with the Panel">
<link rel="next" href="port-gnome2.html" title="Part III. Porting older Applets">
<meta name="generator" content="GTK-Doc V1.27 (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="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="getting-started.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="getting-started.integration.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="port-gnome2.html"><img src="right.png" width="16" height="16" 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.9.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.27</div>
</body>
</html>
|