/usr/share/gtk-doc/html/ethos/ch03.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 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding Ethos to my Application</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-developer.html" title="Part II. Ethos Developer Overview">
<link rel="prev" href="ethos-developer.html" title="Part II. Ethos Developer Overview">
<link rel="next" href="ethos-base.html" title="Part III. Ethos API Reference">
<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-developer.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ethos-developer.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="ethos-base.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="idp2417824"></a>Adding Ethos to my Application</h2></div></div></div>
<p>
As a developer, you might be wondering what Ethos does for you. Ethos provides the
scaffolding around supporting plugins within your application. This includes the details
like cracking open shared libraries to extract the plugins, hosting various virtual machines
for higher-level language support, and reusable widgets to manage plugins in your GTK+
application during runtime. However, if you are writing an application that does not have a
user interface, ethos can also be used without a UI and therefore only require libglib2.0
and libgobject2.0.
</p>
<p>
It only takes a couple of lines of code to setup Ethos during runtime. Lets look at an
example in Vala for the succinctness of code.
</p>
<p>
</p>
<div class="informalexample"><pre class="programlisting">using GLib;
using Gtk;
using Ethos;
static void main (string[] args) {
Gtk.init (ref args);
var manager = new Ethos.Manager ();
manager.set_app_name ("Foo");
manager.set_plugin_dirs (new string[] { "./plugins" });
manager.initialized += _ => { stdout.printf ("Ethos initialized\n"); };
manager.initialize ();
Gtk.main ();
}
</pre></div>
<p>
</p>
<p>
This prepares the basic EthosManager instance that can locate and load plugins. When
"manager.initialize()" is called, the EthosManager will lookup all the plugins within the
plugin directories. By default, EthosManager will enable all plugins. This behaviour can
be changed by inheriting from EthosManager and overridding the "load_plugin" slot in the
classes vtable.
</p>
<p>
Many applications will have a GTK+ user interface and want to present a way to control
plugins during runtime to the user. There is a reusable GTK+ widget that is bundled with
Ethos called EthosUIManagerWidget. It is ideal for embedding within a preferences dialog.
Lets take a quick look at what that might look like.
</p>
<p>
</p>
<div class="informalexample"><pre class="programlisting">using GLib;
using Gtk;
using Ethos;
using Ethos.UI;
...
void setup_plugins_page () {
var widget = new Ethos.UI.ManagerWidget ();
widget.set_manager (this.manager);
this.plugins_page.add (widget);
widget.show ();
}
...
</pre></div>
<p>
</p>
<p>
This will create the EthosUIManagerWidget and prepare it to observe the EthosManager for
runtime changes.
</p>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.18</div>
</body>
</html>
|