/usr/share/gtk-doc/html/mate-panel-applet/applet-writing.html is in libmate-panel-applet-doc 1.20.1-3ubuntu1.
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 Applets: Panel Applet Library Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="Panel Applet Library Reference Manual">
<link rel="up" href="index.html" title="Panel Applet Library Reference Manual">
<link rel="prev" href="index.html" title="Panel Applet Library Reference Manual">
<link rel="next" href="server-files.html" title="MateComponent Activation .server Files For 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><img src="up-insensitive.png" width="16" height="16" border="0"></td>
<td><a accesskey="p" href="index.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="server-files.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><h1 class="title">
<a name="applet-writing"></a>Writing Applets</h1></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="sect1"><a href="applet-writing.html#hello-world">Hello World Applet</a></span></dt>
<dt><span class="sect1"><a href="server-files.html">MateComponent Activation .server Files For Applets</a></span></dt>
<dt><span class="sect1"><a href="applet-popups.html">Defining a Popup Context Menu</a></span></dt>
<dt><span class="sect1"><a href="panel-signals.html">Detecting Changes in the Panel.</a></span></dt>
<dt><span class="sect1"><a href="session-saving.html">Session/Preference Saving.</a></span></dt>
<dt><span class="sect1"><a href="multi-applets.html">Multiple Applets</a></span></dt>
</dl></div>
<p>Writing applets is very simple. You take some boiler plate
code like below, change a couple of things and write the code that
implements your widgetry. The hardest part is writing your widgetry -
and its completely up to yourself how hard that should be.
</p>
<div class="sect1">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="hello-world"></a>Hello World Applet</h2></div></div></div>
<p>As usual, following the pointless tradition of starting with
an example of how get 'Hello World' on the screen in some form, here's
just about the simplest applet you could write.
</p>
<pre class="programlisting">
#include <string.h>
#include <mate-panel-applet.h>
#include <gtk/gtklabel.h>
static gboolean
hello_applet_fill (MatePanelApplet *applet,
const gchar *iid,
gpointer data)
{
GtkWidget *label;
if (strcmp (iid, "OAFIID:My_HelloApplet") != 0)
return FALSE;
label = gtk_label_new ("Hello World");
gtk_container_add (GTK_CONTAINER (applet), label);
gtk_widget_show_all (GTK_WIDGET (applet));
return TRUE;
}
MATE_PANEL_APPLET_MATECOMPONENT_FACTORY ("OAFIID:My_HelloApplet_Factory",
PANEL_TYPE_APPLET,
"TheHelloWorldApplet",
"0",
hello_applet_fill,
NULL);
</pre>
<p>The code here is very similar to writing a normal MateComponent
control. You define a factory using MATE_PANEL_APPLET_MATECOMPONENT_FACTORY(),
passing it a factory function like hello_applet_fill().
</p>
<p>libmate-panel-applet automatically creates a #MatePanelApplet object
for you, passing this to your factory method. Here, you should fill
the applet with your widgets just like a #GtkBin. For example, if you
were writing a cdplayer applet you would create a #GtkHBox, pack the
hbox with the cdplayer buttons and in turn add the hbox to the applet.
</p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.27</div>
</body>
</html>
|