/usr/share/gtk-doc/html/libpanel-applet/getting-started.in-out-process.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 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Out-of-Process vs In-Process: 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.install.html" title="Applet Registration, Installation and Build System">
<link rel="prev" href="getting-started.install.html" title="Applet Registration, Installation and Build System">
<link rel="next" href="getting-started.install.build-system.html" title="Build system">
<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.install.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="getting-started.install.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="getting-started.install.build-system.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="sect1">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="getting-started.in-out-process"></a>Out-of-Process vs In-Process</h2></div></div></div>
<p>
Applets can either live in their own process ("out-of-process") or in the panel process ("in-process").
The decision to choose one or the other is done at build time, with the macro that you use to define the applet
factory:
<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>
is used for out-of-process applets while
<a class="link" href="libpanel-applet-Panel-Applet-Factory.html#PANEL-APPLET-IN-PROCESS-FACTORY:CAPS" title="PANEL_APPLET_IN_PROCESS_FACTORY()">
<code class="function">PANEL_APPLET_IN_PROCESS_FACTORY()</code>
</a> is used for in-process applets. Obviously, only one of those two macros can be used. If both
types should be supported, then each macro must be placed between preprocessor conditions and switched on
through a configure option. For example:
</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc">#ifdef MY_APPLET_OUT_PROCESS_ENABLED</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="gtkdoc ppc">#else</span>
<span class="function"><a href="libpanel-applet-Panel-Applet-Factory.html#PANEL-APPLET-IN-PROCESS-FACTORY:CAPS">PANEL_APPLET_IN_PROCESS_FACTORY</a></span> <span class="gtkdoc opt">(...)</span>
<span class="gtkdoc ppc">#endif</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p>
</p>
<p>
For most practical matters, from the applet perspective, the two options are the same.
In-process applets do offer a slightly better performance when the applet is loaded, but this should not have
much effect on the user experience. However, an in-process applet can potentially affect the whole behavior of
the panel, especially in case of crashes or memory corruptions: a crash in an in-process applet will crash the
whole panel. It is therefore recommended to use out-of-process applets.
</p>
<p>
The communication between the panel and the applet factory is done over D-Bus. When creating an applet,
the panel will send a message to the D-Bus service of the applet factory. If the D-Bus service is not
running yet, it must be started automatically. We use D-Bus activation for this, which requires install a
standard D-Bus service file. This is only needed for, because in-process applets do no need to have their
binary autostarted for obvious reasons.
</p>
<div class="note"><p>
Please refer to the
<a class="ulink" href="http://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-starting-services" target="_top">
D-Bus documentation</a> for more information about D-Bus service files.
</p></div>
<p>
Here is an example for a D-Bus Service file. It should be named <code class="constant">org.gnome.panel.applet.HelloWorldFactory.service.in</code>
</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="gtkdoc opt">[</span>D<span class="gtkdoc opt">-</span>BUS Service<span class="gtkdoc opt">]</span>
Name<span class="gtkdoc opt">=</span>org<span class="gtkdoc opt">.</span>gnome<span class="gtkdoc opt">.</span>panel<span class="gtkdoc opt">.</span>applet<span class="gtkdoc opt">.</span>HelloWorldFactory
Exec<span class="gtkdoc opt">=</span>@LOCATION@</pre></td>
</tr>
</tbody>
</table>
</div>
<p>
Additionally you should adjust the build system to replace <code class="constant">@LOCATION@</code> by the install location of the applet binary. The file itself must be installed into
<code class="constant">$(datadir)/dbus-1/services/</code>.
</p>
<p>
The next section contains an explanation how to setup the Makefile in order to install the service file
to the correct location on the system.
</p>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25</div>
</body>
</html>
|