This file is indexed.

/usr/share/gtk-doc/html/mate-panel-applet/applet-porting.html is in libmate-panel-applet-doc 1.16.2-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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Porting Applets from the MATE 1.x interfaces: 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="multi-applets.html" title="Multiple Applets">
<link rel="next" href="mate-panel-applet.html" title="The Panel Applet Library">
<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><img src="up-insensitive.png" width="16" height="16" border="0"></td>
<td><a accesskey="p" href="multi-applets.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="mate-panel-applet.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-porting"></a>Porting Applets from the MATE 1.x interfaces</h1></div></div></div>
<p>In MATE 1.x the applet interface lived in a header called
<code class="filename">applet-widget.h</code>. The interface was based on GOAD,
the MATE 1.x object activation framework. A new interface was
designed for MATE 2.x using the power of matecomponent UI embedding and the
new object activation framework, matecomponent-activation. The interface is
intended to be easy to use, cruft free, but semantically similar to
the old API in order to make porting relatively painless.</p>
<div class="simplesect">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="applet-porting-activation"></a>Applet Activation</h2></div></div></div>
<p>The first thing to change when porting to the new API is
the header. Include <code class="filename">mate-panel-applet.h</code> instead of
<code class="filename">applet-widget.h</code>.</p>
<p>Next you need to change how the applet is activated.
Browsing through old applet's code, its obvious that this was done in
various ways in the past. The best advice is to hunt out the calls to
applet_widget_init, applet_widget_new and applet_widget_add.
applet_widget_new and applet_widget_add are now effectively merged
into one call mate_panel_applet_new, to which the top-level widget of the
applet should be passed. applet_widget_init is not neccessary anymore.
So the new code should look something like this</p>
<pre class="programlisting">
#include &lt;mate-panel-applet.h&gt;

static MateComponentObject *
blah_applet_new ()
{
        MatePanelApplet *applet;

	/*
	 * The old code setting up the applet widgetry
	 * goes here. So effectively delete calls to
	 * applet_widget_init and applet_widget_new
	 * and the replace applet_widget_add with a call
	 * to mate_panel_applet_new.
	 */

        applet = mate_panel_applet_new (label);

        return MATECOMPONENT_OBJECT (mate_panel_applet_get_control (applet));
}

static MateComponentObject *
blah_applet_factory (MateComponentGenericFactory *this,
		     const gchar          *iid,
		     gpointer              data)
{
        MateComponentObject *applet = NULL;

        if (!strcmp (iid, "OAFIID:BlahApplet"))
                applet = blah_applet_new ();

        return applet;
}


MATE_PANEL_APPLET_MATECOMPONENT_FACTORY ("OAFIID:BlahApplet_Factory",
                             "Blah",
                             "0",
                             blah_applet_factory,
                             NULL)
      </pre>
<p>You should use MATE_PANEL_APPLET_MATECOMPONENT_FACTORY or
MATE_PANEL_APPLET_MATECOMPONENT_SHLIB_FACTORY depending on whether you want the
applet to be out of process or in process.</p>
</div>
<div class="simplesect">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="applet-porting-activation-files"></a>Activation files</h2></div></div></div>
<p>The next thing to do may be to port from a
<code class="filename">.gnorba</code> file to a matecomponent-activation
<code class="filename">.server</code> file. You no longer need a .desktop file
for applets. A <code class="filename">.gnorba</code> looks something like this
:</p>
<pre class="programlisting">
[blah]
type=exe
repo_id=IDL:MATE/Applet:1.0
description=Blah
location_info=blah-de-blah
	</pre>
<p>Your <code class="filename">.server</code> file should look like
this :</p>
<pre class="programlisting">
&lt;oaf_info&gt;

&lt;oaf_server iid="OAFIID:BlahApplet"
            type="exe"
            location="blah-de-blah-2"&gt;

        &lt;oaf_attribute name="repo_ids" type="stringv"&gt;
                &lt;item value="IDL:MateComponent/GenericFactory:1.0""/&gt;
                &lt;item value="IDL:MateComponent/Unknown:1.0"/&gt;
        &lt;/oaf_attribute&gt;
        &lt;oaf_attribute name="name" type="string" value="Blah Factory"/&gt;
        &lt;oaf_attribute name="description" type="string" value="Blah De Blah"/&gt;

&lt;/oaf_server&gt;

&lt;oaf_server iid="OAFIID:BlahApplet"
            type="factory"
            location="OAFIID:BlahApplet_Factory"&gt;

        &lt;oaf_attribute name="repo_ids" type="stringv"&gt;
                &lt;item value="IDL:MATE/MatePanelAppletShell:1.0"/&gt;
                &lt;item value="IDL:MateComponent/Control:1.0"/&gt;
                &lt;item value="IDL:MateComponent/Unknown:1.0"/&gt;
        &lt;/oaf_attribute&gt;
        &lt;oaf_attribute name="name" type="string" value="Blah Applet"/&gt;
        &lt;oaf_attribute name="description" type="string" value="Blah De Blah"/&gt;
        &lt;oaf_attribute name="panel:icon" type="string" value="blah-de-blah.png"/&gt;

&lt;/oaf_server&gt;

&lt;/oaf_info&gt;
	</pre>
<p>A lot of this should be copied and pasted. The most
important bit is "panel:icon" which specfies the icon
that should be displayed in the "Add to Panel" dialog.</p>
</div>
<div class="simplesect">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="applet-porting-menus"></a>Context Menu</h2></div></div></div>
<p>Most applets also place extra menu items into it context
menu. It might be a good idea to port this next. In MATE 1.x this was
done using the applet_widget_register_stock_callback API call. In
MATE 2.x 3 things must be done</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>An xml desription of the popup menu must be
written.</p></li>
<li class="listitem"><p>A description of the verbs must be prepared.
This is basically a list of callbacks to be call when a certain menu
item is clicked in the popup.</p></li>
<li class="listitem"><p>The menu is registered using a call to
mate_panel_applet_setup_menu.</p></li>
</ul></div>
<p>The xml description should look something like this
:</p>
<pre class="programlisting">
static const char fish_menu_xml [] =
        "&lt;popup name=\"button3\"&gt;\n"
        "   &lt;menuitem name=\"Properties Item\" verb=\"BlahProperties\" _label=\"Properties ...\"\n"
        "             pixtype=\"stock\" pixname=\"gtk-properties\"/&gt;\n"
        "   &lt;menuitem name=\"Help Item\" verb=\"BlahHelp\" _label=\"Help\"\n"
        "             pixtype=\"stock\" pixname=\"gtk-help\"/&gt;\n"
        "   &lt;menuitem name=\"About Item\" verb=\"BlahAbout\" _label=\"About ...\"\n"
        "             pixtype=\"stock\" pixname=\"mate-stock-about\"/&gt;\n"
        "&lt;/popup&gt;\n";
	</pre>
<p>This could also be in a seperate
<code class="filename">.xml</code> file and loaded with
mate_panel_applet_setup_menu_from_file. The description of the verbs should
look something like :</p>
<pre class="programlisting">
static const MateComponentUIVerb fish_menu_verbs [] = {
        MATECOMPONENT_UI_VERB ("BlahProperties", display_properties_dialog),
        MATECOMPONENT_UI_VERB ("BlahHelp",       display_help_dialog),
        MATECOMPONENT_UI_VERB ("BlahAbout",      display_about_dialog),

        MATECOMPONENT_UI_VERB_END
};
	</pre>
<p>This is just a list of callbacks invoked when the menu
items are clicked. There are other macros you may use other than
MATECOMPONENT_UI_VERB - see
<code class="filename">matecomponent-ui-component.h</code>.</p>
<p>To actually register the menu you just do something like
:</p>
<pre class="programlisting">
	mate_panel_applet_setup_menu (MATE_PANEL_APPLET (blah-&gt;applet),
                                 blah_menu_xml,
                                 blah_menu_verbs,
                                 blah);
	</pre>
<p>The last argument is the user_data argument passed back
to the callbacks.</p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25</div>
</body>
</html>