This file is indexed.

/usr/share/doc/kildclient/html/apes06.xhtml is in kildclient-doc 3.2.0-2.

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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><title>E.6. Using GTK+ From Plugins</title><link rel="stylesheet" type="text/css" href="docbook.css"/><link rel="stylesheet" type="text/css" href="kildclient.css"/><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"/><link rel="prev" href="apes05.xhtml" title="E.5. Conditional Loading of Plugins"/><link rel="next" href="apes07.xhtml" title="E.7. Plugin Conventions"/></head><body><header><div class="navheader"><table style="width: 100%; "><tr><th style="text-align: center; " colspan="3">E.6. Using GTK+ From Plugins</th></tr><tr><td style="width: 20%; text-align: left; "><a accesskey="p" href="apes05.xhtml">Prev</a> </td><th style="width: 60%; text-align: center; ">Appendix E. Writing Plugins</th><td style="width: 20%; text-align: right; "> <a accesskey="n" href="apes07.xhtml">Next</a></td></tr></table><hr/></div></header><section class="sect1" id="idm5378"><div class="titlepage"><div><div><h2 class="title" style="clear: both">E.6. Using GTK+ From Plugins</h2></div></div></div><p>With the use of the gtk3-perl bindings, it is possible to use
the full power of the GTK+ library in KildClient plugins. This allows
you to create dialogs, windows, message boxes, and anything else your
plugin needs.</p><p>Using gtk3-perl in a KildClient plugin is straightforward, there
is just a couple of points to be observed. Import the Perl modules as
usual, generally with a line like this: "<code class="literal">use Gtk3
-init;</code>". Create windows and display them as usual. The
biggest difference is that you must not call
<code class="literal">Gtk3-&gt;main</code>. Since KildClient is a GTK+ application,
it already runs a main loop, and starting another one would lock
KildClient and make it unresponsive. Also, you must never call
<code class="literal">Gtk3-&gt;main_quit</code>, because that would cause
KildClient to quit. Even tough the world would be saved, the user
certainly wouldn't want that.</p><p>All features of GTK+ are supported, as are all of gtk3-modules
(this includes modules for the base libraries Glib and GDK, and also
for other libraries such as the Gnome ones). Notably, Gtk3::Builder is
supported, which allows you to create complex user interfaces visually
and load them from the .ui file in the plugin.</p><p>Note that having the gtk3-perl bindings is not necessary to run
KildClient. If they are not present, however, it will not be possible
to run plugins that use it, naturally. The plugins will not be loaded
because an error will be generated when the modules are loaded (in the
"<code class="literal">use Gtk3 -init;</code>" line).</p><p>The example below shows a very simple (and not very useful)
plugin using gtk3-perl. It should show how simple it is to use the
gtk3-perl bindings in KildClient plugin.</p><div class="example" id="idm5390"><div class="example-title">Example E.4. A plugin that uses gtk3-perl</div><div class="example-contents"><pre class="programlisting">
package gtksample;
#: Version: 1.0.0
#: Description: A Plugin Using gtk3-perl
#: Author: Eduardo M Kalinowski

use Gtk3 -init;

# Is the window being displayed?
our $window_displayed = 0;

# Widgets
our $window;
our $entry;
our $button;

sub help {
  $::world-&gt;echonl("This plugins demonstrates the use of gtk3-perl under KildClient.",
                   "It does nothing really useful.",
                   "",
                   "Enter /gtksample::run to try it.");
}


sub run {
  return if $window_displayed;

  $window = Gtk3::Window-&gt;new();
  $window-&gt;set_title("gtk3-perl test");
  $window-&gt;signal_connect(delete_event =&gt; sub {
                            $window_displayed = 0;
                            return 0;
                          });

  my $vbox = Gtk3::Box-&gt;new('vertical', 8);

  $entry = Gtk3::Entry-&gt;new();
  $entry-&gt;set_text("Type something here");
  $vbox-&gt;pack_start($entry, 0, 1, 0);

  $button = Gtk3::Button-&gt;new("And click me");
  $button-&gt;signal_connect(clicked =&gt; \&amp;on_button_clicked);
  $vbox-&gt;pack_start($button, 0, 1, 0);

  $window-&gt;add($vbox);

  $window-&gt;show_all();
  $window_displayed = 1;
}


sub on_button_clicked {
  $button-&gt;set_label($entry-&gt;get_text());
}


sub UNLOAD {
  $window-&gt;destroy if $window_displayed;
}
</pre></div></div><br class="example-break"/><p>Notice how it defines a <code class="literal">UNLOAD</code> function that
destroys the window if it is being displayed. Plugins that open
windows almost always need such a function to delete the windows that
are still open when the World is closed. If these windows are not
closed, the program will most likely crash if the user tries to use
them after the Worlds has been closed, so make sure they get
deleted.</p><p>For more information on gtk3-perl, see <a class="link" href="https://metacpan.org/release/Gtk3/" target="_top">https://metacpan.org/release/Gtk3/</a>.</p></section><footer><div class="navfooter"><hr/><table style="width: 100%; "><tr><td style="width: 40%; text-align: left; "><a accesskey="p" href="apes05.xhtml">Prev</a> </td><td style="width: 20%; text-align: center; "><a accesskey="u" href="ape.xhtml">Up</a></td><td style="width: 40%; text-align: right; "> <a accesskey="n" href="apes07.xhtml">Next</a></td></tr><tr><td style="width: 40%; text-align: left; vertical-align: top; ">E.5. Conditional Loading of Plugins </td><td style="width: 20%; text-align: center; "><a accesskey="h" href="index.xhtml">Home</a></td><td style="width: 40%; text-align: right; vertical-align: top; "> E.7. Plugin Conventions</td></tr></table></div></footer></body></html>