This file is indexed.

/usr/share/gtk-doc/html/libpanel-applet/getting-started.example.html is in libpanel-applet-doc 3.20.1-1.

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
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Hello World Example: 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.concepts.applet-instances.html" title="Applet Instances">
<link rel="next" href="getting-started.context-menu.html" title="Using a Context Menu">
<meta name="generator" content="GTK-Doc V1.25 (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.concepts.applet-instances.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="getting-started.context-menu.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.example"></a>Hello World Example</h2></div></div></div>
<p>
      In this section we will write a simple example applet. This simple applet will have no functionality and
      only displays a label with "Hello World" on the panel. For this simple applet only following three parts
      are needed:
    </p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>
               <a class="link" href="libpanel-applet-Panel-Applet-Factory.html#PANEL-APPLET-OUT-PROCESS-FACTORY:CAPS" title="PANEL_APPLET_OUT_PROCESS_FACTORY()">
                   <code class="function">PANEL_APPLET_OUT_PROCESS_FACTORY()</code>
               </a>: this creates an <a class="link" href="getting-started.concepts.html#getting-started.concepts.applet-factory" title="Applet Factory">applet factory</a> named
               <code class="constant">HelloWorldFactory</code>, and each time our applet is added to a GNOME Panel, this applet
               factory will create an applet instance, and calls <code class="function">hello_world_factory_callback()</code>
               with a <a class="link" href="libpanel-applet-Panel-Applet.html#PanelApplet"><span class="type">PanelApplet</span></a> object already created.
           </p></li>
<li class="listitem">
<p>
               <code class="function">hello_world_factory_callback()</code>: this checks if the request to create an applet
               instance is for an <a class="link" href="getting-started.concepts.html#getting-started.concepts.applet-types" title="Applet Types">applet type</a> supported
               by our <a class="link" href="getting-started.concepts.html#getting-started.concepts.applet-factory" title="Applet Factory">applet factory</a>. Here we can see
               that we only support the <code class="constant">HelloWorldApplet</code> applet type. This function returns
               <code class="constant">TRUE</code> on success and <code class="constant">FALSE</code> on failures.

               </p>
<div class="note"><p>If you return <code class="constant">FALSE</code> here, GNOME Panel will show a dialog and
                   notify the user that the applet loading failed.</p></div>
<p>
           </p>
</li>
<li class="listitem">
<p>
               <code class="function">hello_world_applet_start()</code>: this is where we actually setup the
               <a class="link" href="libpanel-applet-Panel-Applet.html#PanelApplet"><span class="type">PanelApplet</span></a> widget for the work the applet should do.
               This can include adding widgets to the applet, connecting to signals, loading settings via GSettings,
               etc.

               </p>
<div class="note"><p>
                   The PanelApplet is a subclass of <a href="/usr/share/gtk-doc/html/gtk3/GtkBin.html#GtkBin-struct"><span class="type">GtkBin</span></a>
                   container, to add more than one widget to it you will need to use another GtkContainer
                   implementation such as <a href="/usr/share/gtk-doc/html/gtk3/GtkBox.html#GtkBox-struct"><span class="type">GtkBox</span></a> or
                   <a href="/usr/share/gtk-doc/html/gtk3/GtkGrid.html#GtkGrid-struct"><span class="type">GtkGrid</span></a>.
                 </p></div>
<p>
           </p>
</li>
</ul></div>
<p>
      An example is worth a million words, so here is the code for our <span class="emphasis"><em>Hello World</em></span> applet.
    </p>
<div class="example">
<a name="getting-started.example.simple"></a><p class="title"><b>Example 1. Hello World applet</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
20
21
22
23
24
25
26
27
28
29
30</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc">#include &lt;gtk/gtk.h&gt;</span>
<span class="gtkdoc ppc">#include &lt;panel-applet.h&gt;</span>

<span class="gtkdoc kwb">static void</span>
<span class="function">hello_world_applet_start</span> <span class="gtkdoc opt">(</span>PanelApplet <span class="gtkdoc opt">*</span>applet<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
    GtkWidget <span class="gtkdoc opt">*</span>label<span class="gtkdoc opt">;</span>

    label <span class="gtkdoc opt">=</span> <span class="function"><a href="/usr/share/gtk-doc/html/gtk3/GtkLabel.html#gtk-label-new">gtk_label_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Hello World&quot;</span><span class="gtkdoc opt">);</span>
    <span class="function"><a href="/usr/share/gtk-doc/html/gtk3/GtkContainer.html#gtk-container-add">gtk_container_add</a></span> <span class="gtkdoc opt">(</span><span class="function">GTK_CONTAINER</span> <span class="gtkdoc opt">(</span>applet<span class="gtkdoc opt">),</span> label<span class="gtkdoc opt">);</span>
    <span class="function"><a href="/usr/share/gtk-doc/html/gtk3/GtkWidget.html#gtk-widget-show-all">gtk_widget_show_all</a></span> <span class="gtkdoc opt">(</span><span class="function">GTK_WIDGET</span> <span class="gtkdoc opt">(</span>applet<span class="gtkdoc opt">));</span>
<span class="gtkdoc opt">}</span>

<span class="gtkdoc kwb">static</span> gboolean
<span class="function">hello_world_factory_callback</span> <span class="gtkdoc opt">(</span>PanelApplet  <span class="gtkdoc opt">*</span>applet<span class="gtkdoc opt">,</span>
                              <span class="gtkdoc kwb">const</span> gchar  <span class="gtkdoc opt">*</span>iid<span class="gtkdoc opt">,</span>
                              gpointer      data<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
    <span class="keyword">if</span> <span class="gtkdoc opt">(</span><span class="function"><a href="/usr/share/gtk-doc/html/glib/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span> <span class="gtkdoc opt">(</span>iid<span class="gtkdoc opt">,</span> <span class="string">&quot;HelloWorldApplet&quot;</span><span class="gtkdoc opt">) !=</span> <span class="number">0</span><span class="gtkdoc opt">)</span>
         <span class="keyword">return</span> FALSE<span class="gtkdoc opt">;</span>

    <span class="function">hello_world_applet_start</span> <span class="gtkdoc opt">(</span>applet<span class="gtkdoc opt">);</span>

    <span class="keyword">return</span> TRUE<span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">}</span>

<span class="function"><a href="libpanel-applet-Panel-Applet-Factory.html#PANEL-APPLET-OUT-PROCESS-FACTORY:CAPS">PANEL_APPLET_OUT_PROCESS_FACTORY</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;HelloWorldFactory&quot;</span><span class="gtkdoc opt">,</span>
                                  PANEL_TYPE_APPLET<span class="gtkdoc opt">,</span>
                                  hello_world_factory_callback<span class="gtkdoc opt">,</span>
                                  NULL<span class="gtkdoc opt">)</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

</div>
<br class="example-break"><p>
      While the previous example is simple, it can be useful to directly subclass the
      <a class="link" href="libpanel-applet-Panel-Applet.html#PanelApplet"><span class="type">PanelApplet</span></a> type. This makes it easy to have a per-applet
      instance private structure, among other benefits. Most of the code below is related to the GObject system
      and needed to subclass the Panel Applet. The only noteworthy difference is that the
      <code class="constant">PANEL_APPLET_OUT_PROCESS_FACTORY</code> macro now takes our subclassed type (e.g. <code class="constant">HELLO_WORLD_TYPE_APPLET</code>)
      as its second parameter, instead of <code class="constant">PANEL_TYPE_APPLET</code>.
    </p>
<div class="example">
<a name="getting-started.example.subclass"></a><p class="title"><b>Example 2. Hello World applet, with a PanelApplet subclass</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
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</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc">#include &lt;gtk/gtk.h&gt;</span>
<span class="gtkdoc ppc">#include &lt;panel-applet.h&gt;</span>

<span class="gtkdoc ppc">#define HELLO_WORLD_TYPE_APPLET (hello_world_applet_get_type ())</span>

<span class="gtkdoc kwc">typedef</span> <span class="gtkdoc kwb">struct</span> _HelloWorldApplet        HelloWorldApplet<span class="gtkdoc opt">;</span>
<span class="gtkdoc kwc">typedef</span> <span class="gtkdoc kwb">struct</span> _HelloWorldAppletClass   HelloWorldAppletClass<span class="gtkdoc opt">;</span>
<span class="gtkdoc kwc">typedef</span> <span class="gtkdoc kwb">struct</span> _HelloWorldAppletPrivate HelloWorldAppletPrivate<span class="gtkdoc opt">;</span>

<span class="gtkdoc kwb">struct</span> _HelloWorldApplet <span class="gtkdoc opt">{</span>
    PanelApplet parent_object<span class="gtkdoc opt">;</span>

    <span class="comment">/*&lt; private &gt;*/</span>
    HelloWorldAppletPrivate <span class="gtkdoc opt">*</span>priv<span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">};</span>

<span class="gtkdoc kwb">struct</span> _HelloWorldAppletClass <span class="gtkdoc opt">{</span>
    PanelAppletClass parent_class<span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">};</span>

<span class="gtkdoc kwb">struct</span> _HelloWorldAppletPrivate
<span class="gtkdoc opt">{</span>
    GtkWidget <span class="gtkdoc opt">*</span>label<span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">};</span>

<span class="gtkdoc kwb">static</span> GType <span class="function">hello_world_applet_get_type</span> <span class="gtkdoc opt">(</span><span class="gtkdoc kwb">void</span><span class="gtkdoc opt">)</span> G_GNUC_CONST<span class="gtkdoc opt">;</span>

<span class="function"><a href="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#G-DEFINE-TYPE:CAPS">G_DEFINE_TYPE</a></span> <span class="gtkdoc opt">(</span>HelloWorldApplet<span class="gtkdoc opt">,</span> hello_world_applet<span class="gtkdoc opt">,</span> PANEL_TYPE_APPLET<span class="gtkdoc opt">);</span>

<span class="gtkdoc kwb">static void</span>
<span class="function">hello_world_applet_init</span> <span class="gtkdoc opt">(</span>HelloWorldApplet <span class="gtkdoc opt">*</span>applet<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
    applet<span class="gtkdoc opt">-&gt;</span>priv <span class="gtkdoc opt">=</span> <span class="function"><a href="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#G-TYPE-INSTANCE-GET-PRIVATE:CAPS">G_TYPE_INSTANCE_GET_PRIVATE</a></span> <span class="gtkdoc opt">(</span>applet<span class="gtkdoc opt">,</span> HELLO_WORLD_TYPE_APPLET<span class="gtkdoc opt">,</span>
                                                HelloWorldAppletPrivate<span class="gtkdoc opt">);</span>

    applet<span class="gtkdoc opt">-&gt;</span>priv<span class="gtkdoc opt">-&gt;</span>label <span class="gtkdoc opt">=</span> <span class="function"><a href="/usr/share/gtk-doc/html/gtk3/GtkLabel.html#gtk-label-new">gtk_label_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Hello World&quot;</span><span class="gtkdoc opt">);</span>
    <span class="function"><a href="/usr/share/gtk-doc/html/gtk3/GtkContainer.html#gtk-container-add">gtk_container_add</a></span> <span class="gtkdoc opt">(</span><span class="function">GTK_CONTAINER</span> <span class="gtkdoc opt">(</span>applet<span class="gtkdoc opt">),</span> applet<span class="gtkdoc opt">-&gt;</span>priv<span class="gtkdoc opt">-&gt;</span>label<span class="gtkdoc opt">);</span>
    <span class="function"><a href="/usr/share/gtk-doc/html/gtk3/GtkWidget.html#gtk-widget-show">gtk_widget_show</a></span> <span class="gtkdoc opt">(</span>applet<span class="gtkdoc opt">-&gt;</span>priv<span class="gtkdoc opt">-&gt;</span>label<span class="gtkdoc opt">);</span>
<span class="gtkdoc opt">}</span>

<span class="gtkdoc kwb">static void</span>
<span class="function">hello_world_applet_class_init</span> <span class="gtkdoc opt">(</span>HelloWorldAppletClass <span class="gtkdoc opt">*</span>klass<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
  <span class="function"><a href="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#g-type-class-add-private">g_type_class_add_private</a></span> <span class="gtkdoc opt">(</span><span class="gtkdoc kwc">class</span><span class="gtkdoc opt">,</span> <span class="keyword">sizeof</span> <span class="gtkdoc opt">(</span>HelloWorldAppletPrivate<span class="gtkdoc opt">));</span>
<span class="gtkdoc opt">}</span>

<span class="gtkdoc kwb">static</span>
<span class="function">hello_world_applet_start</span> <span class="gtkdoc opt">(</span>HelloWorldApplet <span class="gtkdoc opt">*</span>applet<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
    <span class="function"><a href="/usr/share/gtk-doc/html/gtk3/GtkWidget.html#gtk-widget-show">gtk_widget_show</a></span> <span class="gtkdoc opt">(</span><span class="function">GTK_WIDGET</span> <span class="gtkdoc opt">(</span>applet<span class="gtkdoc opt">));</span>
<span class="gtkdoc opt">}</span>

<span class="gtkdoc kwb">static</span> gboolean
<span class="function">hello_world_factory_callback</span> <span class="gtkdoc opt">(</span>HelloWorldApplet <span class="gtkdoc opt">*</span>applet<span class="gtkdoc opt">,</span>
                              <span class="gtkdoc kwb">const</span> gchar      <span class="gtkdoc opt">*</span>iid<span class="gtkdoc opt">,</span>
                              gpointer          data<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
    <span class="keyword">if</span> <span class="gtkdoc opt">(</span><span class="function"><a href="/usr/share/gtk-doc/html/glib/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span> <span class="gtkdoc opt">(</span>iid<span class="gtkdoc opt">,</span> <span class="string">&quot;HelloWorldApplet&quot;</span><span class="gtkdoc opt">) !=</span> <span class="number">0</span><span class="gtkdoc opt">)</span>
         <span class="keyword">return</span> FALSE<span class="gtkdoc opt">;</span>

    <span class="function">hello_world_applet_start</span> <span class="gtkdoc opt">(</span>applet<span class="gtkdoc opt">);</span>

    <span class="keyword">return</span> TRUE<span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">}</span>

<span class="function"><a href="libpanel-applet-Panel-Applet-Factory.html#PANEL-APPLET-OUT-PROCESS-FACTORY:CAPS">PANEL_APPLET_OUT_PROCESS_FACTORY</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;HelloWorldFactory&quot;</span><span class="gtkdoc opt">,</span>
                                  HELLO_WORLD_TYPE_APPLET<span class="gtkdoc opt">,</span>
                                  hello_world_factory_callback<span class="gtkdoc opt">,</span>
                                  NULL<span class="gtkdoc opt">)</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

</div>
<br class="example-break">
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25</div>
</body>
</html>