| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package ZConf::BGSet::GUI::GTK; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
20084
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
34
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
31
|
|
|
5
|
1
|
|
|
1
|
|
416
|
use ZConf::BGSet; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Gtk2; |
|
7
|
|
|
|
|
|
|
use Gtk2::Ex::Simple::List; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
ZConf::BGSet::GUI::GTK - GTK GUI for ZConf::BGSet |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Version 0.0.1 |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.0.1'; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Quick summary of what the module does. |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Perhaps a little code snippet. |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use Gtk2 -init; |
|
29
|
|
|
|
|
|
|
use ZConf::BGSet::GUI::GTK; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $zbgGTK = ZConf::BGSet::GUI::GTK->new(); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $window = Gtk2::Window->new ('toplevel'); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $zbgGUI=ZConf::BGSet::GUI::GTK->new({autoinit=>'1'}); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $item=$zbgGUI->notebook(); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
$window->add($item); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
$window->signal_connect('delete-event'=>sub{exit 0}); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$window->show_all; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Gtk2->main; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 METHODES |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 new |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
This initiates the module. |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head3 hash values |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head4 autoinit |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
If this is set to true, it will automatically call |
|
58
|
|
|
|
|
|
|
init the set and config. If this is set to false or |
|
59
|
|
|
|
|
|
|
not defined, besure to check '$zbg->{init}' to see |
|
60
|
|
|
|
|
|
|
if the config/module has been initiated or not. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head4 set |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This is the set to load initially. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head4 zconf |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
If this key is defined, this hash will be passed to ZConf->new(). |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub new { |
|
73
|
|
|
|
|
|
|
my %args; |
|
74
|
|
|
|
|
|
|
if(defined($_[1])){ |
|
75
|
|
|
|
|
|
|
%args= %{$_[1]}; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# |
|
79
|
|
|
|
|
|
|
my $self={error=>undef, errorString=>undef}; |
|
80
|
|
|
|
|
|
|
bless $self; |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
$self->{zbg}=ZConf::BGSet->new(\%args); |
|
83
|
|
|
|
|
|
|
if ($self->{zbg}->{error}) { |
|
84
|
|
|
|
|
|
|
warn('ZConf-BGSet-GUI-GTK new: Initializing "ZConf::BGSet" failed. '. |
|
85
|
|
|
|
|
|
|
'error="'.$self->{zbg}->{error}.'" errorString="'. |
|
86
|
|
|
|
|
|
|
$self->{zbg}->{errorString}.'"'); |
|
87
|
|
|
|
|
|
|
$self->{error}=1; |
|
88
|
|
|
|
|
|
|
$self->{errorString}='Initializing "ZConf::BGSet" failed. '. |
|
89
|
|
|
|
|
|
|
'error="'.$self->{zbg}->{error}.'" errorString="'. |
|
90
|
|
|
|
|
|
|
$self->{zbg}->{errorString}.'"'; |
|
91
|
|
|
|
|
|
|
return $self; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
return $self; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 addFSPath |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Utility function for '$self->{pathsBewFSPathButton}'. |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub addFSPath{ |
|
104
|
|
|
|
|
|
|
my $widget=$_[0]; |
|
105
|
|
|
|
|
|
|
my $self=$_[1]; |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
my $file_chooser = Gtk2::FileChooserDialog->new ('test', |
|
108
|
|
|
|
|
|
|
undef, |
|
109
|
|
|
|
|
|
|
'select-folder', |
|
110
|
|
|
|
|
|
|
'gtk-cancel' => 'cancel', |
|
111
|
|
|
|
|
|
|
'gtk-ok' => 'ok' |
|
112
|
|
|
|
|
|
|
); |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
#gets what directory to use |
|
115
|
|
|
|
|
|
|
my $dir=undef; |
|
116
|
|
|
|
|
|
|
if ('ok' eq $file_chooser->run){ |
|
117
|
|
|
|
|
|
|
$dir=$file_chooser->get_filename; |
|
118
|
|
|
|
|
|
|
}else { |
|
119
|
|
|
|
|
|
|
#if it was canceled destroy it and return |
|
120
|
|
|
|
|
|
|
$file_chooser->destroy; |
|
121
|
|
|
|
|
|
|
return; |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
#destroys the chooser |
|
125
|
|
|
|
|
|
|
$file_chooser->destroy; |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
#get the selected index |
|
128
|
|
|
|
|
|
|
my @selectedIndexA=$self->{pathsSList}->get_selected_indices; |
|
129
|
|
|
|
|
|
|
my $selectedIndex=$selectedIndexA[0]; |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
#gets the path |
|
132
|
|
|
|
|
|
|
my $pathName=$self->{pathsSList}->{data}[$selectedIndex][0]; |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
#gets the path as an array |
|
135
|
|
|
|
|
|
|
my @path=$self->{zbg}->getPath($pathName); |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
#adds the path to the the path |
|
138
|
|
|
|
|
|
|
push(@path, $dir); |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
# |
|
141
|
|
|
|
|
|
|
$self->{zbg}->setPath($pathName, \@path); |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
@{$self->{pathsPathSList}->{data}}= @path; |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head2 askNewPath |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
This is the utility function called by '$self->{pathsNewPathButton}'. |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=cut |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub askNewPath{ |
|
154
|
|
|
|
|
|
|
my $widget=$_[0]; |
|
155
|
|
|
|
|
|
|
my $self=$_[1]; |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
my $text='Name of new path?'; |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
my $window = Gtk2::Dialog->new($text, |
|
160
|
|
|
|
|
|
|
undef, |
|
161
|
|
|
|
|
|
|
[qw/modal destroy-with-parent/], |
|
162
|
|
|
|
|
|
|
'gtk-cancel' => 'cancel', |
|
163
|
|
|
|
|
|
|
'gtk-save' => 'accept', |
|
164
|
|
|
|
|
|
|
); |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
$window->set_position('center-always'); |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
$window->set_response_sensitive ('accept', 0); |
|
169
|
|
|
|
|
|
|
$window->set_response_sensitive ('reject', 0); |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
my $vbox = $window->vbox; |
|
172
|
|
|
|
|
|
|
$vbox->set_border_width(5); |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
my $label = Gtk2::Label->new_with_mnemonic($text); |
|
175
|
|
|
|
|
|
|
$vbox->pack_start($label, 0, 0, 1); |
|
176
|
|
|
|
|
|
|
$label->show; |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
my $entry = Gtk2::Entry->new(); |
|
179
|
|
|
|
|
|
|
$vbox->pack_end($entry, 0, 0, 1); |
|
180
|
|
|
|
|
|
|
$entry->show; |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
$entry->signal_connect (changed => sub { |
|
183
|
|
|
|
|
|
|
my $text = $entry->get_text; |
|
184
|
|
|
|
|
|
|
$window->set_response_sensitive ('accept', $text !~ m/^\s*$/); |
|
185
|
|
|
|
|
|
|
$window->set_response_sensitive ('reject', 1); |
|
186
|
|
|
|
|
|
|
} |
|
187
|
|
|
|
|
|
|
); |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
my $value; |
|
190
|
|
|
|
|
|
|
my $pressed; |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
$window->signal_connect(response => sub { |
|
193
|
|
|
|
|
|
|
$value=$entry->get_text; |
|
194
|
|
|
|
|
|
|
$pressed=$_[1]; |
|
195
|
|
|
|
|
|
|
} |
|
196
|
|
|
|
|
|
|
); |
|
197
|
|
|
|
|
|
|
#runs the dailog and gets the response |
|
198
|
|
|
|
|
|
|
#'cancel' means the user decided not to create a new set |
|
199
|
|
|
|
|
|
|
#'accept' means the user wants to create a new set with the entered name |
|
200
|
|
|
|
|
|
|
my $response=$window->run; |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
$window->destroy; |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
#set the pressed to reject if |
|
205
|
|
|
|
|
|
|
if (($value eq '' )&&($pressed eq 'accept')) { |
|
206
|
|
|
|
|
|
|
$pressed='reject'; |
|
207
|
|
|
|
|
|
|
return; |
|
208
|
|
|
|
|
|
|
} |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
#add a new path |
|
211
|
|
|
|
|
|
|
my @newpath; |
|
212
|
|
|
|
|
|
|
$self->{zbg}->createPath($value, @newpath); |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
#rebuild the path list |
|
215
|
|
|
|
|
|
|
my @paths=$self->{zbg}->listPaths(); |
|
216
|
|
|
|
|
|
|
@{$self->{pathsSList}->{data}}=@paths; |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
} |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=head2 chooseFile |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
Utility function for '$self->{setbgFileButton}'. |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=cut |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub chooseFile{ |
|
227
|
|
|
|
|
|
|
my $widget=$_[0]; |
|
228
|
|
|
|
|
|
|
my $self=$_[1]; |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
my $file_chooser = Gtk2::FileChooserDialog->new ('test', |
|
231
|
|
|
|
|
|
|
undef, |
|
232
|
|
|
|
|
|
|
'open', |
|
233
|
|
|
|
|
|
|
'gtk-cancel' => 'cancel', |
|
234
|
|
|
|
|
|
|
'gtk-ok' => 'ok' |
|
235
|
|
|
|
|
|
|
); |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
#creates a filter and adds image types to it |
|
238
|
|
|
|
|
|
|
my $filter=Gtk2::FileFilter->new; |
|
239
|
|
|
|
|
|
|
$filter->add_pattern('*.jpg'); |
|
240
|
|
|
|
|
|
|
$filter->add_pattern('*.jpeg'); |
|
241
|
|
|
|
|
|
|
$filter->add_pattern('*.gif'); |
|
242
|
|
|
|
|
|
|
$filter->add_pattern('*.png'); |
|
243
|
|
|
|
|
|
|
$filter->add_pattern('*.xmp'); |
|
244
|
|
|
|
|
|
|
$filter->add_pattern('*.bmp'); |
|
245
|
|
|
|
|
|
|
$filter->add_pattern('*.tif'); |
|
246
|
|
|
|
|
|
|
$filter->add_pattern('*.tiff'); |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
#adds the filter to to the chooser |
|
249
|
|
|
|
|
|
|
$file_chooser->add_filter($filter); |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
#gets what directory to use |
|
252
|
|
|
|
|
|
|
my $file=undef; |
|
253
|
|
|
|
|
|
|
if ('ok' eq $file_chooser->run){ |
|
254
|
|
|
|
|
|
|
$file=$file_chooser->get_filename; |
|
255
|
|
|
|
|
|
|
}else { |
|
256
|
|
|
|
|
|
|
#if it was canceled destroy it and return |
|
257
|
|
|
|
|
|
|
$file_chooser->destroy; |
|
258
|
|
|
|
|
|
|
return; |
|
259
|
|
|
|
|
|
|
} |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
#destroys the chooser |
|
262
|
|
|
|
|
|
|
$file_chooser->destroy; |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
$self->{setbgFileEntry}->set_text($file); |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
} |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=head2 history |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
This returns a scrolled window containing the last |
|
271
|
|
|
|
|
|
|
several backgrounds. |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=cut |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
sub history{ |
|
276
|
|
|
|
|
|
|
my $self=$_[0]; |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
$self->{historySWindow}=Gtk2::ScrolledWindow->new; |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
$self->{historySList} = Gtk2::Ex::Simple::List->new ( |
|
281
|
|
|
|
|
|
|
'Hostname'=>'text', |
|
282
|
|
|
|
|
|
|
'Display'=>'text', |
|
283
|
|
|
|
|
|
|
'Fill Type'=>'text', |
|
284
|
|
|
|
|
|
|
'Image'=>'text' |
|
285
|
|
|
|
|
|
|
); |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
#add the slist to the scrolled window |
|
288
|
|
|
|
|
|
|
$self->{historySWindow}->add($self->{historySList}); |
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
#sets them all as as uneditable |
|
291
|
|
|
|
|
|
|
$self->{historySList}->set_column_editable ('Hostname', 0); |
|
292
|
|
|
|
|
|
|
$self->{historySList}->set_column_editable ('Display', 0); |
|
293
|
|
|
|
|
|
|
$self->{historySList}->set_column_editable ('Fill Type', 0); |
|
294
|
|
|
|
|
|
|
$self->{historySList}->set_column_editable ('Image', 0); |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
#fetches the last |
|
297
|
|
|
|
|
|
|
my $lastRaw=$self->{zbg}->getLastRaw; |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
#splits up each line |
|
300
|
|
|
|
|
|
|
my @lines=split(/\n/, $lastRaw); |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
my @list; |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
my $int=0;#used for intering through @lines |
|
305
|
|
|
|
|
|
|
while (defined($lines[$int])) { |
|
306
|
|
|
|
|
|
|
my @line=split(/:/, $lines[$int],4); |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
push(@{$self->{historySList}->{data}}, [$line[0], $line[1], $line[2], $line[3]]); |
|
309
|
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
$int++; |
|
311
|
|
|
|
|
|
|
} |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
#shows the window |
|
314
|
|
|
|
|
|
|
$self->{historySWindow}->show; |
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
#show the list |
|
317
|
|
|
|
|
|
|
$self->{historySList}->show; |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
return $self->{historySWindow}; |
|
320
|
|
|
|
|
|
|
} |
|
321
|
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
=head2 notebook |
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
This returns a notebook widget populated with everything. |
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
=cut |
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
sub notebook{ |
|
329
|
|
|
|
|
|
|
my $self=$_[0]; |
|
330
|
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
$self->{notebook}=Gtk2::Notebook->new; |
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
#sets up the history page |
|
334
|
|
|
|
|
|
|
$self->{notebookSetbgLabel}=Gtk2::Label->new('Set BG'); |
|
335
|
|
|
|
|
|
|
$self->{notebook}->append_page($self->setbg(), $self->{notebookSetbgLabel}); |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
#sets up the history page |
|
338
|
|
|
|
|
|
|
$self->{notebookHistoryLabel}=Gtk2::Label->new('History'); |
|
339
|
|
|
|
|
|
|
$self->{notebook}->append_page($self->history(), $self->{notebookHistoryLabel}); |
|
340
|
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
#sets up the paths page |
|
342
|
|
|
|
|
|
|
$self->{notebookPathsLabel}=Gtk2::Label->new('Paths'); |
|
343
|
|
|
|
|
|
|
$self->{notebook}->append_page($self->paths(), $self->{notebookPathsLabel}); |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
#sets up the setters page |
|
346
|
|
|
|
|
|
|
$self->{notebookSettersLabel}=Gtk2::Label->new('Setters'); |
|
347
|
|
|
|
|
|
|
$self->{notebook}->append_page($self->setters(), $self->{notebookSettersLabel}); |
|
348
|
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
#shows it... if this is not done set_current_page will not work |
|
350
|
|
|
|
|
|
|
$self->{notebook}->show_all; |
|
351
|
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
#set it to the set page |
|
353
|
|
|
|
|
|
|
$self->{notebook}->set_current_page('0'); |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
return $self->{notebook}; |
|
356
|
|
|
|
|
|
|
} |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
=head2 removeFSPath |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
This is the utility function used by '$self->{pathsRemoveFSPathButton}'. |
|
361
|
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
=cut |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
sub removeFSPath{ |
|
365
|
|
|
|
|
|
|
my $widget=$_[0]; |
|
366
|
|
|
|
|
|
|
my $self=$_[1]; |
|
367
|
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
#get the selected index |
|
369
|
|
|
|
|
|
|
my @selectedIndexA=$self->{pathsSList}->get_selected_indices; |
|
370
|
|
|
|
|
|
|
my $selectedIndex=$selectedIndexA[0]; |
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
#gets the path |
|
373
|
|
|
|
|
|
|
my $pathName=$self->{pathsSList}->{data}[$selectedIndex][0]; |
|
374
|
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
#get the selected index |
|
376
|
|
|
|
|
|
|
@selectedIndexA=$self->{pathsPathSList}->get_selected_indices; |
|
377
|
|
|
|
|
|
|
$selectedIndex=$selectedIndexA[0]; |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
#gets the path |
|
380
|
|
|
|
|
|
|
my $FSpathName=$self->{pathsPathSList}->{data}[$selectedIndex][0]; |
|
381
|
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
#gets the path as an array |
|
383
|
|
|
|
|
|
|
my @path=$self->{zbg}->getPath($pathName); |
|
384
|
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
my @newPath; |
|
386
|
|
|
|
|
|
|
my $int=0; |
|
387
|
|
|
|
|
|
|
while (defined($path[$int])) { |
|
388
|
|
|
|
|
|
|
if ($path[$int] ne $FSpathName) { |
|
389
|
|
|
|
|
|
|
push (@newPath, $path[$int]); |
|
390
|
|
|
|
|
|
|
} |
|
391
|
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
$int++; |
|
393
|
|
|
|
|
|
|
} |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
$self->{zbg}->setPath($pathName, \@newPath); |
|
396
|
|
|
|
|
|
|
#don't update pathsPathSList if there was an error |
|
397
|
|
|
|
|
|
|
if ($self->{zbg}->{error}){ |
|
398
|
|
|
|
|
|
|
return; |
|
399
|
|
|
|
|
|
|
} |
|
400
|
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
@{$self->{pathsPathSList}->{data}}=@newPath; |
|
402
|
|
|
|
|
|
|
} |
|
403
|
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
=head2 removePath |
|
405
|
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
This is a utility function called by '$self->{pathsRemovePathButton}'. |
|
407
|
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
=cut |
|
409
|
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
sub removePath{ |
|
411
|
|
|
|
|
|
|
my $widget=$_[0]; |
|
412
|
|
|
|
|
|
|
my $self=$_[1]; |
|
413
|
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
#get the selected index |
|
415
|
|
|
|
|
|
|
my @selectedIndexA=$self->{pathsSList}->get_selected_indices; |
|
416
|
|
|
|
|
|
|
my $selectedIndex=$selectedIndexA[0]; |
|
417
|
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
#gets the path |
|
419
|
|
|
|
|
|
|
my $path=$self->{pathsSList}->{data}[$selectedIndex][0]; |
|
420
|
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
#removes the path |
|
422
|
|
|
|
|
|
|
$self->{zbg}->delPath($path); |
|
423
|
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
#gets the paths and dumps them into the lists |
|
426
|
|
|
|
|
|
|
my @paths=$self->{zbg}->listPaths(); |
|
427
|
|
|
|
|
|
|
@{$self->{pathsSList}->{data}}=@paths; |
|
428
|
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
} |
|
430
|
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
=head2 pathChanged |
|
433
|
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
This is a utility function called by '$self->{pathsSList}' |
|
435
|
|
|
|
|
|
|
upon a row being clicked on. |
|
436
|
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
=cut |
|
438
|
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
sub pathChanged{ |
|
440
|
|
|
|
|
|
|
my $widget=$_[0]; |
|
441
|
|
|
|
|
|
|
my $self=$_[1]; |
|
442
|
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
#get the selected index |
|
444
|
|
|
|
|
|
|
my @selectedIndexA=$self->{pathsSList}->get_selected_indices; |
|
445
|
|
|
|
|
|
|
my $selectedIndex=$selectedIndexA[0]; |
|
446
|
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
#get the list of paths |
|
448
|
|
|
|
|
|
|
my @paths=$self->{zbg}->listPaths(); |
|
449
|
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
#gets the path |
|
451
|
|
|
|
|
|
|
my $pathName=$self->{pathsSList}->{data}[$selectedIndex][0]; |
|
452
|
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
my $path=$self->{zbg}->{zconf}->{conf}{zbgset}{'paths/'.$pathName}; |
|
454
|
|
|
|
|
|
|
my @pathA=split(/\n/, $path); |
|
455
|
|
|
|
|
|
|
@{$self->{pathsPathSList}->{data}}=@pathA; |
|
456
|
|
|
|
|
|
|
} |
|
457
|
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
=head2 paths |
|
459
|
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
This returns a VBox for manipulating the paths. |
|
461
|
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
=cut |
|
463
|
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
sub paths{ |
|
465
|
|
|
|
|
|
|
my $self=$_[0]; |
|
466
|
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
# |
|
468
|
|
|
|
|
|
|
my @paths=$self->{zbg}->listPaths(); |
|
469
|
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
#gets the name of the path |
|
471
|
|
|
|
|
|
|
my $pathName=$self->{zbg}->{zconf}->{conf}->{zbgset}{path}; |
|
472
|
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
# |
|
474
|
|
|
|
|
|
|
$self->{pathsIndex}=undef; |
|
475
|
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
# |
|
477
|
|
|
|
|
|
|
my $int=0; |
|
478
|
|
|
|
|
|
|
while ($paths[$int]) { |
|
479
|
|
|
|
|
|
|
if ($pathName eq $paths[$int]) { |
|
480
|
|
|
|
|
|
|
$self->{pathsIndex}=$int; |
|
481
|
|
|
|
|
|
|
} |
|
482
|
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
$int++; |
|
484
|
|
|
|
|
|
|
} |
|
485
|
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
#creates the VBox |
|
487
|
|
|
|
|
|
|
$self->{pathsVBox}=Gtk2::VBox->new; |
|
488
|
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
#creates the VBox |
|
490
|
|
|
|
|
|
|
$self->{pathsHBox}=Gtk2::HBox->new; |
|
491
|
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
#adds the VBox to the HBox |
|
493
|
|
|
|
|
|
|
$self->{pathsVBox}->pack_start($self->{pathsHBox}, 1, 1, 0); |
|
494
|
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
#creates the SWindow |
|
496
|
|
|
|
|
|
|
$self->{pathsSWindow}=Gtk2::ScrolledWindow->new; |
|
497
|
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
#adds the paths to the SWindow |
|
499
|
|
|
|
|
|
|
$self->{pathsHBox}->pack_start($self->{pathsSWindow}, 1, 1, 0); |
|
500
|
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
#creates the SList of paths |
|
502
|
|
|
|
|
|
|
$self->{pathsSList} = Gtk2::Ex::Simple::List->new ( |
|
503
|
|
|
|
|
|
|
'Paths'=>'text', |
|
504
|
|
|
|
|
|
|
); |
|
505
|
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
# |
|
507
|
|
|
|
|
|
|
$self->{pathsSList}->signal_connect("cursor-changed"=>\&pathChanged, $self); |
|
508
|
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
#this adds pathsSList to pathsSWindow |
|
510
|
|
|
|
|
|
|
$self->{pathsSWindow}->add($self->{pathsSList}); |
|
511
|
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
#adds the paths to the SList |
|
513
|
|
|
|
|
|
|
push(@{$self->{pathsSList}->{data}}, @paths); |
|
514
|
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
#if the pathsIndex is defined, select it |
|
516
|
|
|
|
|
|
|
if (defined($self->{pathsIndex})) { |
|
517
|
|
|
|
|
|
|
$self->{pathsSList}->select($self->{pathsIndex}); |
|
518
|
|
|
|
|
|
|
} |
|
519
|
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
#creates the SList of the paths in the path in question |
|
521
|
|
|
|
|
|
|
$self->{pathsPathSList} = Gtk2::Ex::Simple::List->new ( |
|
522
|
|
|
|
|
|
|
'File System Paths'=>'text', |
|
523
|
|
|
|
|
|
|
); |
|
524
|
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
#creates the SWindow for the Path |
|
526
|
|
|
|
|
|
|
$self->{pathsPathSWindow}=Gtk2::ScrolledWindow->new; |
|
527
|
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
#this adds pathsPathSList to pathsPathSWindow |
|
529
|
|
|
|
|
|
|
$self->{pathsPathSWindow}->add($self->{pathsPathSList}); |
|
530
|
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
#this adds pathsPathSWindow to pathsHBox |
|
532
|
|
|
|
|
|
|
$self->{pathsHBox}->pack_start($self->{pathsPathSWindow}, 1, 1, 0); |
|
533
|
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
#gets the path |
|
535
|
|
|
|
|
|
|
my $path=$self->{zbg}->{zconf}->{conf}{zbgset}{'paths/'.$pathName}; |
|
536
|
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
#split up the path and add it to the SList for the path |
|
538
|
|
|
|
|
|
|
my @pathA=split(/\n/, $path); |
|
539
|
|
|
|
|
|
|
push(@{$self->{pathsPathSList}->{data}}, @pathA); |
|
540
|
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
#create and add the button bar |
|
542
|
|
|
|
|
|
|
$self->{pathsButtonBar}=Gtk2::HBox->new; |
|
543
|
|
|
|
|
|
|
$self->{pathsVBox}->pack_start($self->{pathsButtonBar}, 0, 0, 0); |
|
544
|
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
#creates the new path button |
|
546
|
|
|
|
|
|
|
$self->{pathsNewPathButton}=Gtk2::Button->new(); |
|
547
|
|
|
|
|
|
|
$self->{pathsNewPathButtonLabel}=Gtk2::Label->new('New Path'); |
|
548
|
|
|
|
|
|
|
$self->{pathsNewPathButton}->add($self->{pathsNewPathButtonLabel}); |
|
549
|
|
|
|
|
|
|
$self->{pathsNewPathButton}->signal_connect("clicked"=>\&askNewPath,$self); |
|
550
|
|
|
|
|
|
|
$self->{pathsButtonBar}->pack_start($self->{pathsNewPathButton}, 1, 0, 0); |
|
551
|
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
#creates the remove path button |
|
553
|
|
|
|
|
|
|
$self->{pathsRemovePathButton}=Gtk2::Button->new(); |
|
554
|
|
|
|
|
|
|
$self->{pathsRemovePathButtonLabel}=Gtk2::Label->new('Remove Path'); |
|
555
|
|
|
|
|
|
|
$self->{pathsRemovePathButton}->add($self->{pathsRemovePathButtonLabel}); |
|
556
|
|
|
|
|
|
|
$self->{pathsRemovePathButton}->signal_connect("clicked"=>\&removePath,$self); |
|
557
|
|
|
|
|
|
|
$self->{pathsButtonBar}->pack_start($self->{pathsRemovePathButton}, 1, 0, 0); |
|
558
|
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
#creates the new path button |
|
560
|
|
|
|
|
|
|
$self->{pathsNewFSPathButton}=Gtk2::Button->new(); |
|
561
|
|
|
|
|
|
|
$self->{pathsNewFSPathButtonLabel}=Gtk2::Label->new('New FS Path'); |
|
562
|
|
|
|
|
|
|
$self->{pathsNewFSPathButton}->add($self->{pathsNewFSPathButtonLabel}); |
|
563
|
|
|
|
|
|
|
$self->{pathsNewFSPathButton}->signal_connect("clicked"=>\&addFSPath,$self); |
|
564
|
|
|
|
|
|
|
$self->{pathsButtonBar}->pack_start($self->{pathsNewFSPathButton}, 1, 0, 0); |
|
565
|
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
#creates the remove FS path button |
|
567
|
|
|
|
|
|
|
$self->{pathsRemoveFSPathButton}=Gtk2::Button->new(); |
|
568
|
|
|
|
|
|
|
$self->{pathsRemoveFSPathButtonLabel}=Gtk2::Label->new('Remove FS Path'); |
|
569
|
|
|
|
|
|
|
$self->{pathsRemoveFSPathButton}->add($self->{pathsRemoveFSPathButtonLabel}); |
|
570
|
|
|
|
|
|
|
$self->{pathsRemoveFSPathButton}->signal_connect("clicked"=>\&removeFSPath,$self); |
|
571
|
|
|
|
|
|
|
$self->{pathsButtonBar}->pack_start($self->{pathsRemoveFSPathButton}, 1, 0, 0); |
|
572
|
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
return $self->{pathsVBox}; |
|
574
|
|
|
|
|
|
|
} |
|
575
|
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
=head2 setbg |
|
577
|
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
This returns a VBox containing widgets for setting the background. |
|
579
|
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
=cut |
|
581
|
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
sub setbg{ |
|
583
|
|
|
|
|
|
|
my $self=$_[0]; |
|
584
|
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
#creates the VBox |
|
586
|
|
|
|
|
|
|
$self->{setbgVBox}=Gtk2::VBox->new; |
|
587
|
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
#sets up the file HBox |
|
589
|
|
|
|
|
|
|
$self->{setbgFileHBox}=Gtk2::HBox->new(0,0); |
|
590
|
|
|
|
|
|
|
$self->{setbgVBox}->pack_start($self->{setbgFileHBox}, 0, 0, 0); |
|
591
|
|
|
|
|
|
|
$self->{setbgFileLabel}=Gtk2::Label->new('File'); |
|
592
|
|
|
|
|
|
|
$self->{setbgFileHBox}->pack_start($self->{setbgFileLabel}, 0, 0, 0); |
|
593
|
|
|
|
|
|
|
$self->{setbgFileEntry}=Gtk2::Entry->new(); |
|
594
|
|
|
|
|
|
|
$self->{setbgFileHBox}->pack_start($self->{setbgFileEntry}, 1, 1, 0); |
|
595
|
|
|
|
|
|
|
$self->{setbgFileButton}=Gtk2::Button->new(); |
|
596
|
|
|
|
|
|
|
$self->{setbgFileButton}->signal_connect("clicked"=>\&chooseFile,$self); |
|
597
|
|
|
|
|
|
|
$self->{setbgFileButtonLabel}=Gtk2::Label->new('Select'); |
|
598
|
|
|
|
|
|
|
$self->{setbgFileButton}->add($self->{setbgFileButtonLabel}); |
|
599
|
|
|
|
|
|
|
$self->{setbgFileHBox}->pack_start($self->{setbgFileButton}, 0, 1, 0); |
|
600
|
|
|
|
|
|
|
$self->{setbgFT}=Gtk2::ComboBox->new_text(); |
|
601
|
|
|
|
|
|
|
$self->{setbgFT}->append_text('auto'); |
|
602
|
|
|
|
|
|
|
$self->{setbgFT}->append_text('center'); |
|
603
|
|
|
|
|
|
|
$self->{setbgFT}->append_text('fill'); |
|
604
|
|
|
|
|
|
|
$self->{setbgFT}->append_text('full'); |
|
605
|
|
|
|
|
|
|
$self->{setbgFT}->append_text('tile'); |
|
606
|
|
|
|
|
|
|
$self->{setbgFT}->set_active(0); |
|
607
|
|
|
|
|
|
|
$self->{setbgFileHBox}->pack_start($self->{setbgFT}, 0, 1, 0); |
|
608
|
|
|
|
|
|
|
$self->{setbgSet}=Gtk2::Button->new(); |
|
609
|
|
|
|
|
|
|
$self->{setbgSet}->signal_connect("clicked"=>\&setFile,$self); |
|
610
|
|
|
|
|
|
|
$self->{setbgSetLabel}=Gtk2::Label->new('Set'); |
|
611
|
|
|
|
|
|
|
$self->{setbgSet}->add($self->{setbgSetLabel}); |
|
612
|
|
|
|
|
|
|
$self->{setbgFileHBox}->pack_start($self->{setbgSet}, 0, 1, 0); |
|
613
|
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
#sets up the rand HBox |
|
615
|
|
|
|
|
|
|
$self->{setbgRandHBox}=Gtk2::HBox->new(0,0); |
|
616
|
|
|
|
|
|
|
$self->{setbgVBox}->pack_start($self->{setbgRandHBox}, 0, 0, 0); |
|
617
|
|
|
|
|
|
|
$self->{setbgRandLabel}=Gtk2::Label->new('Random Path'); |
|
618
|
|
|
|
|
|
|
$self->{setbgRandHBox}->pack_start($self->{setbgRandLabel}, 0, 0, 0); |
|
619
|
|
|
|
|
|
|
$self->{setbgPath}=Gtk2::ComboBox->new_text(); |
|
620
|
|
|
|
|
|
|
$self->{setbgRandHBox}->pack_start($self->{setbgPath}, 0, 1, 0); |
|
621
|
|
|
|
|
|
|
$self->{setbgRandButton}=Gtk2::Button->new(); |
|
622
|
|
|
|
|
|
|
$self->{setbgRandButton}->signal_connect("clicked"=>\&setRand,$self); |
|
623
|
|
|
|
|
|
|
$self->{setbgRandButtonLabel}=Gtk2::Label->new('Set Random'); |
|
624
|
|
|
|
|
|
|
$self->{setbgRandButton}->add($self->{setbgRandButtonLabel}); |
|
625
|
|
|
|
|
|
|
$self->{setbgRandHBox}->pack_start($self->{setbgRandButton}, 0, 1, 0); |
|
626
|
|
|
|
|
|
|
#builds the path list and set it to the default |
|
627
|
|
|
|
|
|
|
my @paths=$self->{zbg}->listPaths; |
|
628
|
|
|
|
|
|
|
my $path=$self->{zbg}->getDefaultPath; |
|
629
|
|
|
|
|
|
|
my $int=0; |
|
630
|
|
|
|
|
|
|
while (defined($paths[$int])) { |
|
631
|
|
|
|
|
|
|
$self->{setbgPath}->append_text($paths[$int]); |
|
632
|
|
|
|
|
|
|
if ($paths[$int] eq $path) { |
|
633
|
|
|
|
|
|
|
$self->{setbgPath}->set_active($int); |
|
634
|
|
|
|
|
|
|
} |
|
635
|
|
|
|
|
|
|
$int++; |
|
636
|
|
|
|
|
|
|
} |
|
637
|
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
#creates a setlast line |
|
639
|
|
|
|
|
|
|
$self->{setbgLastHBox}=Gtk2::HBox->new(0,0); |
|
640
|
|
|
|
|
|
|
$self->{setbgVBox}->pack_start($self->{setbgLastHBox}, 0, 0, 0); |
|
641
|
|
|
|
|
|
|
$self->{setbgLastButton}=Gtk2::Button->new(); |
|
642
|
|
|
|
|
|
|
$self->{setbgLastButtonLabel}=Gtk2::Label->new('Set Last'); |
|
643
|
|
|
|
|
|
|
$self->{setbgLastButton}->add($self->{setbgLastButtonLabel}); |
|
644
|
|
|
|
|
|
|
$self->{setbgLastHBox}->pack_start($self->{setbgLastButton}, 0, 1, 0); |
|
645
|
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
return $self->{setbgVBox}; |
|
648
|
|
|
|
|
|
|
} |
|
649
|
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
=head2 setFile |
|
651
|
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
Utility function for '$self->{setbgSet}'. |
|
653
|
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
=cut |
|
655
|
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
sub setFile{ |
|
657
|
|
|
|
|
|
|
my $widget=$_[0]; |
|
658
|
|
|
|
|
|
|
my $self=$_[1]; |
|
659
|
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
my $file=$self->{setbgFileEntry}->get_text; |
|
661
|
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
my $ft=$self->{setbgFT}->get_active_text; |
|
663
|
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
$self->{zbg}->setBG({image=>$file, filltype=>$ft}); |
|
665
|
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
} |
|
667
|
|
|
|
|
|
|
|
|
668
|
|
|
|
|
|
|
=head2 setRand |
|
669
|
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
This is the utility function used by '$self->{setbgRandButton}'. |
|
671
|
|
|
|
|
|
|
|
|
672
|
|
|
|
|
|
|
=cut |
|
673
|
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
sub setRand{ |
|
675
|
|
|
|
|
|
|
my $widget=$_[0]; |
|
676
|
|
|
|
|
|
|
my $self=$_[1]; |
|
677
|
|
|
|
|
|
|
|
|
678
|
|
|
|
|
|
|
my $pathIndex=$self->{setbgPath}->get_active; |
|
679
|
|
|
|
|
|
|
my @paths=$self->{zbg}->listPaths; |
|
680
|
|
|
|
|
|
|
my $path=$paths[$pathIndex]; |
|
681
|
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
#sets it to a random file |
|
683
|
|
|
|
|
|
|
$self->{zbg}->setRand($path); |
|
684
|
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
#fetches the last |
|
686
|
|
|
|
|
|
|
my $lastRaw=$self->{zbg}->getLastRaw; |
|
687
|
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
#splits up each line |
|
689
|
|
|
|
|
|
|
my @lines=split(/\n/, $lastRaw); |
|
690
|
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
my @list; |
|
692
|
|
|
|
|
|
|
|
|
693
|
|
|
|
|
|
|
my @newHistory; |
|
694
|
|
|
|
|
|
|
my $int=0;#used for intering through @lines |
|
695
|
|
|
|
|
|
|
while (defined($lines[$int])) { |
|
696
|
|
|
|
|
|
|
my @line=split(/:/, $lines[$int],4); |
|
697
|
|
|
|
|
|
|
|
|
698
|
|
|
|
|
|
|
push(@newHistory, [$line[0], $line[1], $line[2], $line[3]]); |
|
699
|
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
$int++; |
|
701
|
|
|
|
|
|
|
} |
|
702
|
|
|
|
|
|
|
@{$self->{historySList}->{data}}=@newHistory; |
|
703
|
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
} |
|
705
|
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
=head2 setters |
|
707
|
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
This returns a VBox that allow the setters to be edited. |
|
709
|
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
=cut |
|
711
|
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
sub setters{ |
|
713
|
|
|
|
|
|
|
my $self=$_[0]; |
|
714
|
|
|
|
|
|
|
|
|
715
|
|
|
|
|
|
|
#creates the VBox |
|
716
|
|
|
|
|
|
|
$self->{settersVBox}=Gtk2::VBox->new; |
|
717
|
|
|
|
|
|
|
|
|
718
|
|
|
|
|
|
|
#sets up the HBoxes |
|
719
|
|
|
|
|
|
|
$self->{settersHBoxFill}=Gtk2::HBox->new(0,0); |
|
720
|
|
|
|
|
|
|
$self->{settersHBoxFull}=Gtk2::HBox->new(0,0); |
|
721
|
|
|
|
|
|
|
$self->{settersHBoxTile}=Gtk2::HBox->new(0,0); |
|
722
|
|
|
|
|
|
|
$self->{settersHBoxCenter}=Gtk2::HBox->new(0,0); |
|
723
|
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
#creates the labels |
|
725
|
|
|
|
|
|
|
$self->{settersLabelCenter}=Gtk2::Label->new('Center'); |
|
726
|
|
|
|
|
|
|
$self->{settersLabelFill}=Gtk2::Label->new('Fill'); |
|
727
|
|
|
|
|
|
|
$self->{settersLabelFull}=Gtk2::Label->new('Full'); |
|
728
|
|
|
|
|
|
|
$self->{settersLabelTile}=Gtk2::Label->new('Tile'); |
|
729
|
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
#adds the labels |
|
731
|
|
|
|
|
|
|
$self->{settersHBoxCenter}->pack_start($self->{settersLabelCenter}, 0, 0, 0); |
|
732
|
|
|
|
|
|
|
$self->{settersHBoxFill}->pack_start($self->{settersLabelFill}, 0, 0, 0); |
|
733
|
|
|
|
|
|
|
$self->{settersHBoxFull}->pack_start($self->{settersLabelFull}, 0, 0, 0); |
|
734
|
|
|
|
|
|
|
$self->{settersHBoxTile}->pack_start($self->{settersLabelTile}, 0, 0, 0); |
|
735
|
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
#adds them all to the HBox |
|
737
|
|
|
|
|
|
|
$self->{settersVBox}->add($self->{settersHBoxCenter}); |
|
738
|
|
|
|
|
|
|
$self->{settersVBox}->add($self->{settersHBoxFull}); |
|
739
|
|
|
|
|
|
|
$self->{settersVBox}->add($self->{settersHBoxFill}); |
|
740
|
|
|
|
|
|
|
$self->{settersVBox}->add($self->{settersHBoxTile}); |
|
741
|
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
#adds the various text boxes |
|
743
|
|
|
|
|
|
|
$self->{settersEntryCenter}=Gtk2::Entry->new; |
|
744
|
|
|
|
|
|
|
$self->{settersEntryFull}=Gtk2::Entry->new; |
|
745
|
|
|
|
|
|
|
$self->{settersEntryFill}=Gtk2::Entry->new; |
|
746
|
|
|
|
|
|
|
$self->{settersEntryTile}=Gtk2::Entry->new; |
|
747
|
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
#sets the various texts |
|
749
|
|
|
|
|
|
|
$self->{settersEntryCenter}->set_text($self->{zbg}->getSetter('center')); |
|
750
|
|
|
|
|
|
|
$self->{settersEntryFill}->set_text($self->{zbg}->getSetter('fill')); |
|
751
|
|
|
|
|
|
|
$self->{settersEntryFull}->set_text($self->{zbg}->getSetter('full')); |
|
752
|
|
|
|
|
|
|
$self->{settersEntryTile}->set_text($self->{zbg}->getSetter('tile')); |
|
753
|
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
#adds the text entries to the HBoxes |
|
755
|
|
|
|
|
|
|
$self->{settersHBoxCenter}->pack_start($self->{settersEntryCenter}, 1, 1, 0); |
|
756
|
|
|
|
|
|
|
$self->{settersHBoxFill}->pack_start($self->{settersEntryFill}, 1, 1, 0); |
|
757
|
|
|
|
|
|
|
$self->{settersHBoxFull}->pack_start($self->{settersEntryFull}, 1, 1, 0); |
|
758
|
|
|
|
|
|
|
$self->{settersHBoxTile}->pack_start($self->{settersEntryTile}, 1, 1, 0); |
|
759
|
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
#sets up the info part |
|
761
|
|
|
|
|
|
|
$self->{settersInfo}=Gtk2::Label->new('"%%%THEFILE%%%" is replaced with the name of the file.'); |
|
762
|
|
|
|
|
|
|
$self->{settersVBox}->add($self->{settersInfo}); |
|
763
|
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
return $self->{settersVBox}; |
|
765
|
|
|
|
|
|
|
} |
|
766
|
|
|
|
|
|
|
|
|
767
|
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
=head1 ERROR CODES |
|
769
|
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
This can be found by checking $zbg->{error}. Only errors currently upon new. |
|
771
|
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
=head2 1 |
|
773
|
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
Failed to initailize 'ZConf::BGSet'. |
|
775
|
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
=head1 AUTHOR |
|
777
|
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
Zane C. Bowers, C<< >> |
|
779
|
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
=head1 BUGS |
|
781
|
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
|
783
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
|
784
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
785
|
|
|
|
|
|
|
|
|
786
|
|
|
|
|
|
|
|
|
787
|
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
|
|
789
|
|
|
|
|
|
|
=head1 SUPPORT |
|
790
|
|
|
|
|
|
|
|
|
791
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
792
|
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
perldoc ZConf::BGSet::GUI::GTK |
|
794
|
|
|
|
|
|
|
|
|
795
|
|
|
|
|
|
|
|
|
796
|
|
|
|
|
|
|
You can also look for information at: |
|
797
|
|
|
|
|
|
|
|
|
798
|
|
|
|
|
|
|
=over 4 |
|
799
|
|
|
|
|
|
|
|
|
800
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
801
|
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
L |
|
803
|
|
|
|
|
|
|
|
|
804
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
805
|
|
|
|
|
|
|
|
|
806
|
|
|
|
|
|
|
L |
|
807
|
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
809
|
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
L |
|
811
|
|
|
|
|
|
|
|
|
812
|
|
|
|
|
|
|
=item * Search CPAN |
|
813
|
|
|
|
|
|
|
|
|
814
|
|
|
|
|
|
|
L |
|
815
|
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
=back |
|
817
|
|
|
|
|
|
|
|
|
818
|
|
|
|
|
|
|
|
|
819
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
820
|
|
|
|
|
|
|
|
|
821
|
|
|
|
|
|
|
|
|
822
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
823
|
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
Copyright 2009 Zane C. Bowers, all rights reserved. |
|
825
|
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
827
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
828
|
|
|
|
|
|
|
|
|
829
|
|
|
|
|
|
|
|
|
830
|
|
|
|
|
|
|
=cut |
|
831
|
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
1; # End of ZConf::BGSet::GUI::GTK |