/usr/share/gtk-doc/html/libpanel-applet/getting-started.integration.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 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Proper Integration with the Panel: 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.install.build-system.html" title="Build system">
<link rel="next" href="getting-started.introspection.html" title="Writing an applet in languages other than C">
<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.install.build-system.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="getting-started.introspection.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.integration"></a>Proper Integration with the Panel</h2></div></div></div>
<p>
Since the applets appear as part of the panel to users, it is important that they behave in a consistent way. A few steps can be completed to achieve proper integration.
</p>
<div class="sect2">
<div class="titlepage"><div><div><h3 class="title">
<a name="getting-started.integration.background"></a>Panel Background</h3></div></div></div>
<p>
The panel can have different types of background, depending on how the user configures the panel. By default, applets do not respect the background that is configured and can therefore look out of place.
</p>
<p>
The <a class="link" href="libpanel-applet-Panel-Applet.html#panel-applet-set-background-widget" title="panel_applet_set_background_widget ()"><code class="function">panel_applet_set_background_widget()</code></a> function can be used to automatically have the right background drawn for a specific widget. Just using this function on the <a class="link" href="libpanel-applet-Panel-Applet.html#PanelApplet"><span class="type">PanelApplet</span></a> object itself, or its child is usually enough to have proper background integration.
</p>
<p>
In some rare cases, though,
<a class="link" href="libpanel-applet-Panel-Applet.html#panel-applet-set-background-widget" title="panel_applet_set_background_widget ()">
<code class="function">panel_applet_set_background_widget()</code>
</a> will not be enough. The solution is then to connect to the
<a class="link" href="libpanel-applet-Panel-Applet.html#PanelApplet-change-background" title="The “change-background” signal"><code class="function">"change-background"</code></a> signal of the
<a class="link" href="libpanel-applet-Panel-Applet.html#PanelApplet"><span class="type">PanelApplet</span></a> object: it will be emitted when the background has
changed, and it will provide the <span class="type">cairo_pattern_t</span> pattern to use as a basis to draw the background.
</p>
</div>
<div class="sect2">
<div class="titlepage"><div><div><h3 class="title">
<a name="getting-started.integration.lockdown"></a>Panel Lockdown</h3></div></div></div>
<p>
The panel has proper support for lockdown, and when it is locked down, it is expected that all applets behave
consistently in a lockdown mode too. This generally means that the preferences of the applet should not be
accessible, but it could also imply a restriction on the behavior of the applet.
</p>
<p>
The <a class="link" href="libpanel-applet-Panel-Applet.html#panel-applet-get-locked-down" title="panel_applet_get_locked_down ()"><code class="function">panel_applet_get_locked_down()</code></a>
function can be used to query the state of the panel lockdown. It is also possible to react to changes by
monitoring the <a class="link" href="libpanel-applet-Panel-Applet.html#PanelApplet--locked-down" title="The “locked-down” property"><code class="function">"locked-down"</code></a>
property of the <a class="link" href="libpanel-applet-Panel-Applet.html#PanelApplet"><span class="type">PanelApplet</span></a> object. You can achieve this
by connecting to the <code class="function">"notify::locked-down"</code> event.
</p>
<p>
In most cases, the <span class="type">GBinding</span> API is enough to respect the panel lockdown:
<code class="function">g_object_bind_property()</code> can be used to automatically update the visiblity of a menu
item in the context menu of the applet. In the following example, the <code class="function">"HelloWorldPrefs"</code>
action (which is an action from the context menu) will only be displayed if the panel is not locked down.
</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</pre></td>
<td class="listing_code"><pre class="programlisting">action <span class="gtkdoc opt">=</span> <span class="function"><a href="/usr/share/gtk-doc/html/gtk3/GtkActionGroup.html#gtk-action-group-get-action">gtk_action_group_get_action</a></span> <span class="gtkdoc opt">(</span>action_group<span class="gtkdoc opt">,</span> <span class="string">"HelloWorldPrefs"</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="/usr/share/gtk-doc/html/gobject/GBinding.html#g-object-bind-property">g_object_bind_property</a></span> <span class="gtkdoc opt">(</span>applet<span class="gtkdoc opt">,</span> <span class="string">"locked-down"</span><span class="gtkdoc opt">,</span>
action<span class="gtkdoc opt">,</span> <span class="string">"visible"</span><span class="gtkdoc opt">,</span>
G_BINDING_DEFAULT<span class="gtkdoc opt">|</span>G_BINDING_INVERT_BOOLEAN<span class="gtkdoc opt">|</span>G_BINDING_SYNC_CREATE<span class="gtkdoc opt">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p>
</p>
<p>
Of course it is also possible to use <code class="function">g_object_bind_property()</code> to change the visibility of
widgets that appear outside of the context menu, like a button in a window.
</p>
<p>
</p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25</div>
</body>
</html>
|