~ubuntu-branches/ubuntu/oneiric/gnome-panel/oneiric

« back to all changes in this revision

Viewing changes to doc/reference/panel-applet/html/getting-started.integration.html

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-05-30 11:04:49 UTC
  • mfrom: (1.3.4 upstream)
  • mto: This revision was merged to the branch mainline in revision 204.
  • Revision ID: james.westby@ubuntu.com-20110530110449-ut1tc5t61rpvf9e3
Tags: upstream-3.0.2
Import upstream version 3.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
2
<html>
 
3
<head>
 
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 
5
<title>Proper Integration with the Panel</title>
 
6
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
 
7
<link rel="home" href="index.html" title="Panel Applet Library Reference Manual">
 
8
<link rel="up" href="getting-started.html" title="Part II. Getting Started with the Panel Applet library">
 
9
<link rel="prev" href="getting-started.install.html" title="Making the Applet Visible to the Panel">
 
10
<link rel="next" href="getting-started.in-out-process.html" title="Out-of-Process vs In-Process">
 
11
<meta name="generator" content="GTK-Doc V1.17.1 (XML mode)">
 
12
<link rel="stylesheet" href="style.css" type="text/css">
 
13
</head>
 
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 
15
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
 
16
<td><a accesskey="p" href="getting-started.install.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
 
17
<td><a accesskey="u" href="getting-started.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
 
18
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
 
19
<th width="100%" align="center">Panel Applet Library Reference Manual</th>
 
20
<td><a accesskey="n" href="getting-started.in-out-process.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
 
21
</tr></table>
 
22
<div class="chapter">
 
23
<div class="titlepage"><div><div><h2 class="title">
 
24
<a name="getting-started.integration"></a>Proper Integration with the Panel</h2></div></div></div>
 
25
<p>
 
26
     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.
 
27
    </p>
 
28
<div class="sect2">
 
29
<div class="titlepage"><div><div><h3 class="title">
 
30
<a name="getting-started.integration.background"></a>Panel Background</h3></div></div></div>
 
31
<p>
 
32
     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.
 
33
     </p>
 
34
<p>
 
35
      The <a class="link" href="panel-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="panel-applet-Panel-Applet.html#PanelApplet"><span class="type">PanelApplet</span></a> object itself, or its child is usually enough to have proper background integration.
 
36
     </p>
 
37
<p>
 
38
      In some rare cases, though, <a class="link" href="panel-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="panel-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="panel-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.
 
39
     </p>
 
40
</div>
 
41
<div class="sect2">
 
42
<div class="titlepage"><div><div><h3 class="title">
 
43
<a name="getting-started.integration.lockdown"></a>Panel Lockdown</h3></div></div></div>
 
44
<p>
 
45
      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.
 
46
     </p>
 
47
<p>
 
48
      The <a class="link" href="panel-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="panel-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="panel-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.
 
49
     </p>
 
50
<p>
 
51
       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.
 
52
 
 
53
      </p>
 
54
<div class="informalexample">
 
55
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
 
56
    <tbody>
 
57
      <tr>
 
58
        <td class="listing_lines" align="right"><pre>1
 
59
2
 
60
3
 
61
4</pre></td>
 
62
        <td class="listing_code"><pre class="programlisting">action = gtk_action_group_get_action (action_group, <span class="number">&quot;HelloWorldPrefs&quot;</span>);
 
63
g_object_bind_property (applet, <span class="number">&quot;locked-down&quot;</span>,
 
64
                        action, <span class="number">&quot;visible&quot;</span>,
 
65
                        G_BINDING_DEFAULT|G_BINDING_INVERT_BOOLEAN|G_BINDING_SYNC_CREATE);</pre></td>
 
66
      </tr>
 
67
    </tbody>
 
68
  </table>
 
69
</div>
 
70
 
 
71
<p>
 
72
 
 
73
      </p>
 
74
<p>
 
75
       It is obviously 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.
 
76
      </p>
 
77
<p>
 
78
 
 
79
     </p>
 
80
</div>
 
81
</div>
 
82
<div class="footer">
 
83
<hr>
 
84
          Generated by GTK-Doc V1.17.1</div>
 
85
</body>
 
86
</html>
 
 
b'\\ No newline at end of file'