1GConf(3) User Contributed Perl Documentation GConf(3)
2
3
4
6 Gnome2::GConf - Perl wrappers for the GConf configuration engine.
7
9 use Gnome2::GConf;
10
11 my $client = Gnome2::GConf::Client->get_default;
12 my $app_key = "/apps/myapp/mykey";
13
14 $client->add_dir($app_key, 'preload-none');
15
16 # add a notify for the key
17 my $notify_id = $client->notify_add($app_key, sub {
18 my ($client, $cnxn_id, $entry) = @_;
19 return unless $entry->{value};
20
21 if ($entry->{value}->{type} eq 'string') {
22 printf "key '%s' changed to '%s'\n",
23 $entry->{key},
24 $entry->{value}->{value};
25 }
26 });
27
28 my $string = $client->get_string($app_key);
29 $string = 'some string' unless $string;
30
31 $client->set($app_key, { type => 'string', data => $string });
32
33 # set a schema for the key
34 $client->set_schema ($app_key,
35 {
36 type => 'string',
37 locale => 'C',
38 short_desc => 'Some key.',
39 long_desc => 'This key does something.',
40 owner => 'some_program'
41 });
42
43 # remove the notification callback
44 $client->notify_remove($notify_id);
45
47 Perl bindings to the 2.2 series of the GConf configuration engine
48 libraries, for use with gtk2-perl.
49
51 This module allows you to use the GConf configuration system in order
52 to store/retrieve the configuration of an application. The GConf
53 system is a powerful configuration manager based on a user daemon that
54 handles a set of key and value pairs, and notifies any changes of the
55 value to every program that monitors those keys. GConf is used by
56 GNOME 2.x.
57
58 To discuss gtk2-perl, ask questions and flame/praise the authors, join
59 gtk-perl-list@gnome.org at lists.gnome.org.
60
61 Find out more about Gnome at http://www.gnome.org.
62
64 Some opaque data types in GConf are not registered inside the Glib type
65 system. Thus, they have been implemented in a more perlish way, when
66 possible, for the sake of coherency and following the principle of
67 least surprise for the perl developer. These changes try to preserve
68 semantics, to add syntactic sugar and to remove the need for accessor
69 methods.
70
71 GConfEntry
72 See Gnome2::GConf::Entry
73
74 GConfValue
75 See Gnome2::GConf::Value
76
77 GConfChangeSet
78 See Gnome2::GConf::ChangeSet
79
80 GConfSchema
81 See Gnome2::GConf::Schema
82
84 Reflecting the changes operated for the data types, some methods that
85 use those type have had the call signature modified.
86
87 GConfNotifyFunc
88 In C, the function passed to "Gnome2::GConf::notify_add" must have
89 the following signature:
90
91 void (GConfNotifyFunc *) (GConfClient * client,
92 guint cnxn_id,
93 GConfEntry * entry);
94
95 Where "GConfEntry" is a container for the key/value pair. Since in
96 perl there's no "GConfEntry" (see above), the "entry" parameter is
97 an hashref.
98
99 GConfClient::get
100 GConfClient::set
101 In C, these accessor methods return/use a "GConfValue". In perl,
102 they return/use an hashref. See Gnome2::GConf::Value
103
104 GConfClient::get_list
105 GConfClient::set_list
106 These accessor methods use a string for setting the type of the
107 lists (lists may have values of only one type), and an arrayref
108 containing the values.
109
110 GConfClient::get_pair
111 GConfClient::set_pair
112 These accessor methods use two hashref (representing "GConfValue"s)
113 for the "car" and the "cdr" parameters.
114
115 GConfClient::get_schema
116 GConfClient::set_schema
117 Similarly to the get/set pair above, these two methods return/use
118 an hashref. See Gnome2::GConf::Schema.
119
120 GConfClient::commit_change_set
121 In C, this method return a boolean value (TRUE on success, FALSE on
122 failure). On user request (using the boolean parameter
123 "remove_committed"), it also returns the "GConfChangeSet", pruned
124 of the successfully committed keys. In perl, this method returns a
125 boolean value both in scalar context or if the user sets to FALSE
126 the "remove_committed" parameter; in array context or if the user
127 requests the uncommitted keys, returns both the return value and
128 the pruned "GConfChangeSet".
129
131 perl(1), Glib(3pm).
132
134 Emmanuele Bassi <ebassi@gmail.com>
135
136 gtk2-perl created by the gtk2-perl team: http://gtk2-perl.sf.net
137
139 Copyright 2003-2006 by Emmanuele Bassi
140
141 This library is free software; you can redistribute it and/or modify it
142 under the terms of the GNU Library General Public License as published
143 by the Free Software Foundation; either version 2 of the License, or
144 (at your option) any later version.
145
146 This library is distributed in the hope that it will be useful, but
147 WITHOUT ANY WARRANTY; without even the implied warranty of
148 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
149 Library General Public License for more details.
150
151 You should have received a copy of the GNU Library General Public
152 License along with this library; if not, write to the Free Software
153 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307
154 USA.
155
156
157
158perl v5.30.1 2020-01-30 GConf(3)