This file is indexed.

/usr/share/gtk-doc/html/ethos/ch01.html is in libethos-doc 0.2.2-2ubuntu1.

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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>My first plugin in C</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="Ethos Reference Manual">
<link rel="up" href="ethos-user.html" title="Part I. Ethos User Overview">
<link rel="prev" href="ethos-user.html" title="Part I. Ethos User Overview">
<link rel="next" href="ch02.html" title="My first plugin in Python">
<meta name="generator" content="GTK-Doc V1.18 (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="2"><tr valign="middle">
<td><a accesskey="p" href="ethos-user.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ethos-user.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Ethos Reference Manual</th>
<td><a accesskey="n" href="ch02.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="chapter">
<div class="titlepage"><div><div><h2 class="title">
<a name="idp601320"></a>My first plugin in C</h2></div></div></div>
<p>
      	Plugins consisit of two parts, a plugin description file and the plugin code.  The plugin
      	description file is an *.ini like file that contains information about the plugin.
      </p>
<p>
        The description file can be named fairly liberally except for the extension.  The extension
        must follow the naming convention "appname-plugin".  Therefore, if the application is named
        Foo, then a valid filename would be "myplugin.foo-plugin".
      </p>
<p>
      	The content of the plugin description file contains some basic information about the plugin
      	and how to load it.  Lets take a look at an example quickly.
      </p>
<p>
	      </p>
<div class="informalexample"><pre class="programlisting"># example.foo-plugin

[Foo Plugin]
Name=Example
Description=My First Plugin
Authors=Plugin Author
IAge=1
Module=example
Icon=ethos-plugin
Copyright=Public Domain
Website=http://example.com</pre></div>
<p>
      </p>
<p>
        Most of the file, as you can see, is self explanatory.  Basic information like Name,
        Description, Authors, Copyright and Website is used in the plugin overview pages.
      </p>
<p>
      	The critical bit in the file is the Module line.  It specifies which shared library to load
      	the plugin from during runtime.  If the module name is "example", then ethos will look for
	"libexample.so" on Linux.  The naming for the file is platform specific, so check GModule
	for the naming for your platform.
      </p>
<p>
      	Now lets breifly take a look at the code to implement this plugin.
      </p>
<p>
        </p>
<div class="informalexample"><pre class="programlisting">#include &lt;ethos/ethos.h&gt;
#include &lt;ethos/ethos-ui.h&gt;

#define EXAMPLE_TYPE_PLUGIN		(example_plugin_get_type ())
#define EXAMPLE_PLUGIN(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_TYPE_PLUGIN, ExamplePlugin))
#define EXAMPLE_PLUGIN_CONST(obj)	(G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_TYPE_PLUGIN, ExamplePlugin const))
#define EXAMPLE_PLUGIN_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), EXAMPLE_TYPE_PLUGIN, ExamplePluginClass))
#define EXAMPLE_IS_PLUGIN(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXAMPLE_TYPE_PLUGIN))
#define EXAMPLE_IS_PLUGIN_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), EXAMPLE_TYPE_PLUGIN))
#define EXAMPLE_PLUGIN_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj), EXAMPLE_TYPE_PLUGIN, ExamplePluginClass))

typedef struct {
	EthosPlugin parent;
	ExamplePluginPrivate *priv;
} ExamplePlugin;

typedef struct {
	EthosPluginClass parent_class;
} ExamplePluginClass;

typedef struct {
	gpointer dummy;
} ExamplePluginPrivate;

GType        example_plugin_get_type (void) G_GNUC_CONST;
EthosPlugin* example_plugin_new      (void);

static void
destroy (GtkWidget *widget)
{
	gtk_widget_destroy (gtk_widget_get_toplevel (widget));
}

G_DEFINE_TYPE (ExamplePlugin, example_plugin, ETHOS_TYPE_PLUGIN)

static void
example_plugin_finalize (GObject *object)
{
	G_OBJECT_CLASS (example_plugin_parent_class)-&gt;finalize (object);
}

static void activated (EthosPlugin *plugin)
{
	g_debug ("plugin activated");
}

static void deactivated (EthosPlugin *plugin)
{
	g_debug ("plugin deactivated");
}

static void
example_plugin_class_init (ExamplePluginClass *klass)
{
	GObjectClass *object_class = G_OBJECT_CLASS (klass);
	EthosPluginClass *plugin_class = ETHOS_PLUGIN_CLASS (klass);

	object_class-&gt;finalize = example_plugin_finalize;
	plugin_class-&gt;activated = activated;
	plugin_class-&gt;deactivated = deactivated;

	g_type_class_add_private (object_class, sizeof(ExamplePluginPrivate));
}

static void
example_plugin_init (ExamplePlugin *self)
{
	self-&gt;priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EXAMPLE_TYPE_PLUGIN, ExamplePluginPrivate);
}

EthosPlugin*
example_plugin_new ()
{
	return g_object_new (EXAMPLE_TYPE_PLUGIN, NULL);
}

G_MODULE_EXPORT EthosPlugin*
ethos_plugin_register (void)
{
	return example_plugin_new ();
}</pre></div>
<p>
      </p>
<p>
      	Most of the file is your standard GObject boilerplate code.  You will notice that the
        ExamplePlugin class inherits from EthosPlugin.  Your plugin should do the same.  At the very
        bottom of the sample, is a method named "ethos_plugin_register".  This method is looked up
        during runtime to create an instance of the plugin.
      </p>
<p>
      	When the EthosManager attempts to load a plugin, "ethos_plugin_register" is found within the
      	shared library and executed, expecting the result to be an instance of EthosPlugin.
      </p>
<p>
      	There are "activated" and "deactivated" signals that can be connected to for setup and
      	destruction of resources for the plugin.  You can either connect to the signals with
      	g_signal_connect() or override the slot in the classes vtable.
      </p>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>