monotone

monotone Commit Details

Date:2008-03-31 18:50:06 (11 years 4 months ago)
Author:Tony Cooper
Branch:net.venge.monotone.contrib.mtn-browse
Commit:85d1a1c887bc8ff9a8e9677d9bed0af44a122cfc
Parents: d60051f12f67d333bb52ef8cdbd12696446e2c92
Message:- Added the find text functionality in the main browser window.

- Window types are now stored in variables as against string literals.
- Trailing new lines are removed from displayed files.
Changes:
AFindText.pm (full)
MAdvancedFind.pm (5 diffs)
MAnnotate.pm (4 diffs)
MChangeLog.pm (4 diffs)
MHistory.pm (6 diffs)
Mmtn-browse (11 diffs)
Mmtn-browse.glade (26 diffs)

File differences

AdvancedFind.pm
4444
4545
4646
47
48
49
50
51
52
4753
4854
4955
......
96102
97103
98104
99
100
105
101106
102107
103108
......
123128
124129
125130
131
126132
127133
128134
......
249255
250256
251257
252
258
253259
254
260
255261
256262
257263
......
267273
268274
269275
270
271
276
272277
273278
274279
use strict;
# ***** GLOBAL DATA DECLARATIONS *****
# The type of window that is going to be managed by this module.
my $window_type = "advanced_find_window";
# ***** FUNCTIONAL PROTOTYPES FOR THIS FILE *****
# Public routines.
foreach my $window (@windows)
{
if ($window->{type} eq "advanced_find_window"
&& ! $window->{window}->mapped())
if ($window->{type} eq $window_type && ! $window->{window}->mapped())
{
$advanced_find = $window;
last;
{
local $advanced_find->{in_cb} = 1;
$advanced_find->{selected} = 0;
# Reset the window contents, then show it.
$tv_column);
$instance = {};
$instance->{type} = "advanced_find_window";
$instance->{type} = $window_type;
$instance->{glade} =
Gtk2::GladeXML->new("../mtn-browse.glade", "advanced_find_window");
Gtk2::GladeXML->new("../mtn-browse.glade", $window_type);
# Flag to stop recursive calling of callbacks.
# Get the widgets that we are interested in.
$instance->{window} =
$instance->{glade}->get_widget("advanced_find_window");
$instance->{window} = $instance->{glade}->get_widget($window_type);
$instance->{window}->set_icon($app_icon);
$instance->{appbar} = $instance->{glade}->get_widget("appbar");
$instance->{simple_query_radiobutton} =
Annotate.pm
4242
4343
4444
45
4645
4746
4847
......
207206
208207
209208
210
209
210
211211
212
213
212214
213215
214
215
216
216217
217218
218219
......
225226
226227
227228
228
229
229230
230
231
231232
232233
233234
......
239240
240241
241242
242
243
243
244244
245245
246246
require 5.008;
use lib "/home/aecoope/perl";
use strict;
# ***** FUNCTIONAL PROTOTYPES FOR THIS FILE *****
my($font,
$height,
$instance,
$width);
$width,
$window_type);
$window_type = "annotation_window";
foreach my $window (@windows)
{
if ($window->{type} eq "annotation_window"
&& ! $window->{window}->mapped())
if ($window->{type} eq $window_type && ! $window->{window}->mapped())
{
$instance = $window;
last;
if (! defined($instance))
{
$instance = {};
$instance->{type} = "annotation_window";
$instance->{type} = $window_type;
$instance->{glade} =
Gtk2::GladeXML->new("../mtn-browse.glade", "annotation_window");
Gtk2::GladeXML->new("../mtn-browse.glade", $window_type);
# Flag to stop recursive calling of callbacks.
# Get the widgets that we are interested in.
$instance->{window} =
$instance->{glade}->get_widget("annotation_window");
$instance->{window} = $instance->{glade}->get_widget($window_type);
$instance->{window}->set_icon($app_icon);
$instance->{appbar} = $instance->{glade}->get_widget("appbar");
$instance->{annotation_textview} =
ChangeLog.pm
4242
4343
4444
45
4645
4746
4847
......
123122
124123
125124
126
125
126
127127
128
129
128130
129131
130
131
132
132133
133134
134135
......
141142
142143
143144
144
145
145146
146
147
147148
148149
149150
......
155156
156157
157158
158
159
159
160160
161161
162162
require 5.008;
use lib "/home/aecoope/perl";
use strict;
# ***** FUNCTIONAL PROTOTYPES FOR THIS FILE *****
my($font,
$height,
$instance,
$width);
$width,
$window_type);
$window_type = "changelog_window";
foreach my $window (@windows)
{
if ($window->{type} eq "change_log_window"
&& ! $window->{window}->mapped())
if ($window->{type} eq $window_type && ! $window->{window}->mapped())
{
$instance = $window;
last;
if (! defined($instance))
{
$instance = {};
$instance->{type} = "change_log_window";
$instance->{type} = $window_type;
$instance->{glade} =
Gtk2::GladeXML->new("../mtn-browse.glade", "changelog_window");
Gtk2::GladeXML->new("../mtn-browse.glade", $window_type);
# Flag to stop recursive calling of callbacks.
# Get the widgets that we are interested in.
$instance->{window} =
$instance->{glade}->get_widget("changelog_window");
$instance->{window} = $instance->{glade}->get_widget($window_type);
$instance->{window}->set_icon($app_icon);
$instance->{changelog_textview} =
$instance->{glade}->get_widget("changelog_textview");
FindText.pm
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
##############################################################################
#
# File Name - FindText.pm
#
# Description - The find text module for the mtn-browse application. This
# module contains all the routines for implementing find text
# window.
#
# Author - A.E.Cooper.
#
# Legal Stuff - Copyright (c) 2007 Anthony Edward Cooper
# <aecooper@coosoft.plus.com>.
#
# This program is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation;
# either version 3 of the License, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public
# License along with this software; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307 USA.
#
##############################################################################
#
##############################################################################
#
# Global Data For This Module
#
##############################################################################
# ***** DIRECTIVES *****
require 5.008;
use strict;
# ***** GLOBAL DATA DECLARATIONS *****
# The type of window that is going to be managed by this module.
my $window_type = "find_text_window";
# ***** FUNCTIONAL PROTOTYPES FOR THIS FILE *****
# Public routines.
sub disable_find_text($$);
sub find_text($$);
sub reset_find_text($);
# Private routines.
sub find_combo_changed_cb($$);
sub get_find_text_window($$);
#
##############################################################################
#
# Routine - find_text
#
# Description - Display the find text window associated with the specified
# text view widget, creating one if necessary, and allow the
# user to search through the related text buffer.
#
# Data - $parent : The parent window widget for the find text
# window.
# $text_view : The text view widget that is to be searched.
#
##############################################################################
sub find_text($$)
{
my($parent, $text_view) = @_;
my $instance;
foreach my $window (@windows)
{
if ($window->{type} eq $window_type
&& $window->{window}->mapped()
&& $window->{text_view} == $text_view)
{
$instance = $window;
last;
}
}
# A suitable mapped find text window cannot be found so reuse an unsued one
# or create a new one.
if (! defined($instance))
{
$instance = get_find_text_window($parent, $text_view);
}
}
#
##############################################################################
#
# Routine - reset_find_text
#
# Description - Resets the search context for the find text window
# associated with the specified text view widget.
#
# Data - $text_view : The text view widget to which the find text
# window is associated.
#
##############################################################################
sub reset_find_text($)
{
my $text_view = $_[0];
my $instance;
foreach my $window (@windows)
{
if ($window->{type} eq $window_type
&& $window->{window}->mapped()
&& $window->{text_view} == $text_view)
{
$instance = $window;
last;
}
}
# Simply reset the search context for the found find text window.
$instance->{match_offset_start} = $instance->{match_offset_end} = -1
if (defined($instance));
}
#
##############################################################################
#
# Routine - disable_find_text
#
# Description - Disables or enables the find text window associated with
# the specified text view widget.
#
# Data - $text_view : The text view widget to which the find text
# window is associated.
# $disable : True if the window is to be disabled,
# otherwise false if it is to be enabled.
#
##############################################################################
sub disable_find_text($$)
{
my($text_view, $disable) = @_;
my $instance;
foreach my $window (@windows)
{
if ($window->{type} eq $window_type
&& $window->{window}->mapped()
&& $window->{text_view} == $text_view)
{
$instance = $window;
last;
}
}
# Simply disable/enable the found find text window.
$instance->{window}->set_sensitive($disable ? FALSE : TRUE)
if (defined($instance));
}
#
##############################################################################
#
# Routine - get_find_text_window
#
# Description - Creates or prepares an existing find text window for use.
#
# Data - $parent : The parent window widget for the find text
# window.
# $text_view : The text view widget that is to be searched.
#
##############################################################################
sub get_find_text_window($$)
{
my($parent, $text_view) = @_;
my($instance,
$new);
foreach my $window (@windows)
{
if ($window->{type} eq $window_type && ! $window->{window}->mapped())
{
$instance = $window;
last;
}
}
# Create a new find text window if an unused one wasn't found, otherwise
# reuse an existing unused one.
if (! defined($instance))
{
$new = 1;
$instance = {};
$instance->{type} = $window_type;
$instance->{glade} =
Gtk2::GladeXML->new("../mtn-browse.glade", $window_type);
# Flag to stop recursive calling of callbacks.
$instance->{in_cb} = 0;
# Connect Glade registered signal handlers.
glade_signal_autoconnect($instance->{glade}, $instance);
# Get the widgets that we are interested in.
$instance->{window} = $instance->{glade}->get_widget($window_type);
$instance->{window}->set_icon($app_icon);
$instance->{find_combo} =
$instance->{glade}->get_widget("find_comboboxentry");
$instance->{case_sensitive_tick} =
$instance->{glade}->get_widget("case_sensitive_checkbutton");
$instance->{search_backwards_tick} =
$instance->{glade}->get_widget("search_backwards_checkbutton");
$instance->{find_button} =
$instance->{glade}->get_widget("find_button");
# Setup the find text window deletion handlers.
$instance->{window}->signal_connect
("delete_event",
sub {
my($widget, $event, $instance) = @_;
return TRUE if ($instance->{in_cb});
local $instance->{in_cb} = 1;
$instance->{window}->hide();
return TRUE;
},
$instance);
$instance->{glade}->get_widget("close_button")->signal_connect
("clicked",
sub {
my($widget, $instance) = @_;
return TRUE if ($instance->{in_cb});
local $instance->{in_cb} = 1;
$instance->{window}->hide();
},
$instance);
# Setup the comboboxentry changed signal handler.
$instance->{find_combo}->child()->
signal_connect("changed", \&find_combo_changed_cb, $instance);
# Setup the combobox.
$instance->{find_combo}->
set_model(Gtk2::ListStore->new("Glib::String"));
$instance->{find_combo}->set_text_column(0);
$instance->{search_history} = [];
}
else
{
$new = 0;
$instance->{in_cb} = 0;
$instance->{window}->set_sensitive(TRUE);
}
# Reset the search context.
$instance->{match_offset_start} = $instance->{match_offset_end} = -1;
$instance->{old_y} = 0;
$instance->{old_search_term} = "";
# Make sure the find button is only enabled when there is something entered
# into the comboboxentry widget.
$instance->{find_button}->set_sensitive
((length($instance->{find_combo}->child()->get_text()) > 0) ?
TRUE : FALSE);
# Store the associated text view and text buffer.
$instance->{text_view} = $text_view;
$instance->{text_buffer} = $instance->{text_view}->get_buffer();
# Reparent window and display it.
$instance->{window}->set_transient_for($parent);
$instance->{window}->show_all();
# If necessary, setup the list of windows that can be made busy for this
# application window.
if ($new)
{
$instance->{busy_windows} = [];
push(@{$instance->{busy_windows}}, $instance->{window}->window());
push(@windows, $instance);
}
return $instance;
}
#
##############################################################################
#
# Routine - find_button_clicked_cb
#
# Description - Callback routine called when the user clicks on the find
# button in the find text window.
#
# Data - $widget : The widget object that received the signal.
# $instance : The window instance that is associated with
# this widget.
#
##############################################################################
sub find_button_clicked_cb($$)
{
my($widget, $instance) = @_;
return if ($instance->{in_cb});
local $instance->{in_cb} = 1;
my($case_sensitive,
$done,
$end_iter,
$expr,
$forward,
$found,
$line,
$rect,
$search_term,
$start_iter);
$search_term = $instance->{find_combo}->child()->get_text();
# Just check that the user actually entered something.
if (length($search_term) == 0)
{
my $dialog;
$dialog = Gtk2::MessageDialog->new
($instance->{window},
["modal"],
"info",
"close",
"Enter some text to\nsearch for first");
$dialog->run();
$dialog->destroy();
return;
}
# Store the search term in the history.
$found = 0;
foreach my $entry (@{$instance->{search_history}})
{
if ($entry eq $search_term)
{
$found = 1;
last;
}
}
if (! $found)
{
if (unshift(@{$instance->{search_history}}, $search_term) > 20)
{
pop(@{$instance->{search_history}});
}
$instance->{find_combo}->get_model()->clear();
foreach my $entry (@{$instance->{search_history}})
{
$instance->{find_combo}->append_text($entry);
}
}
# Get the search parameters.
$case_sensitive = $instance->{case_sensitive_tick}->get_active();
$forward = ! $instance->{search_backwards_tick}->get_active();
# Work out where to start searching from.
$rect = $instance->{text_view}->get_visible_rect();
$done = 0;
if ($search_term eq $instance->{old_search_term}
&& $instance->{old_y} == $rect->y()
&& $instance->{match_offset_start} >= 0)
{
# Resume searching from where we left off. Adjust the iters so as to
# encompass the remaining text on the line, or if there isn't any then
# move them to the next/previous line.
if ($forward)
{
$start_iter = $instance->{text_buffer}->
get_iter_at_offset($instance->{match_offset_end});
$end_iter = $instance->{text_buffer}->
get_iter_at_offset($instance->{match_offset_end});
if ($start_iter->ends_line())
{
$done = ! $start_iter->forward_line();
$end_iter->forward_to_line_end();
}
else
{
$end_iter->forward_to_line_end();
}
}
else
{
$start_iter = $instance->{text_buffer}->
get_iter_at_offset($instance->{match_offset_start});
$end_iter = $instance->{text_buffer}->
get_iter_at_offset($instance->{match_offset_start});
if ($start_iter->starts_line())
{
$done = ! $start_iter->backward_line();
$end_iter->backward_line();
$end_iter->forward_to_line_end()
unless ($end_iter->ends_line());
}
else
{
$start_iter->backward_line();
}
}
}
else
{
# Start searching from the visible part of the file.
my $y;
if ($forward)
{
$y = $rect->y();
}
else
{
$y = $rect->y() + $rect->height();
}
$start_iter = ($instance->{text_view}->get_line_at_y($y))[0];
$end_iter = ($instance->{text_view}->get_line_at_y($y))[0];
$end_iter->forward_to_line_end();
}
# Precompile the regular expression based upon the search term.
if ($case_sensitive)
{
$expr = qr/\Q$search_term\E/;
}
else
{
$expr = qr/\Q$search_term\E/i;
}
# Search for the text.
$found = 0;
while (! $done)
{
$line =
$instance->{text_buffer}->get_text($start_iter, $end_iter, TRUE);
if ($line =~ m/$expr/g)
{
$instance->{match_offset_start} =
$start_iter->get_offset() + pos($line) - length($search_term);
$instance->{match_offset_end} =
$start_iter->get_offset() + pos($line);
$done = $found = 1;
}
else
{
if ($forward)
{
$done = ! $start_iter->forward_line();
$end_iter->forward_to_line_end();
}
else
{
$done = ! $start_iter->backward_line();
$end_iter->backward_line();
$end_iter->forward_to_line_end()
unless ($end_iter->ends_line());
}
}
}
# Either select the found text or tell the user that nothing could be
# found.
if ($found)
{
my $start_line_iter;
$start_iter = $instance->{text_buffer}->
get_iter_at_offset($instance->{match_offset_start});
$start_line_iter = $instance->{text_buffer}->
get_iter_at_offset($instance->{match_offset_start});
$start_line_iter->backward_line()
unless $start_line_iter->starts_line();
$end_iter = $instance->{text_buffer}->
get_iter_at_offset($instance->{match_offset_end});
$instance->{text_buffer}->select_range($start_iter, $end_iter);
$instance->{text_view}->scroll_to_iter
($start_line_iter, 0, FALSE, 0, 0);
$instance->{text_view}->scroll_to_iter($end_iter, 0, FALSE, 0, 0);
}
else
{
my $dialog;
$dialog = Gtk2::MessageDialog->new
($instance->{window},
["modal"],
"info",
"close",
sprintf("Could not find\n`%s'", $search_term));
$dialog->run();
$dialog->destroy();
}
$rect = $instance->{text_view}->get_visible_rect();
$instance->{old_y} = $rect->y();
$instance->{old_search_term} = $search_term;
}
#
##############################################################################
#
# Routine - find_combo_changed_cb
#
# Description - Callback routine called when the user changes the value of
# the find text comboboxentry by selecting an entry from its
# pulldown list or entering text directly.
#
# Data - $widget : The widget object that received the signal.
# $instance : The window instance that is associated with
# this widget.
#
##############################################################################
sub find_combo_changed_cb($$)
{
my($widget, $instance) = @_;
return if ($instance->{in_cb});
local $instance->{in_cb} = 1;
$instance->{find_button}->set_sensitive
((length($instance->{find_combo}->child()->get_text()) > 0) ?
TRUE : FALSE);
}
1;
History.pm
640640
641641
642642
643
643
644
644645
646
647
645648
646649
647650
648651
649
650
652
651653
652654
653655
......
660662
661663
662664
663
665
664666
665
667
666668
667669
668670
......
674676
675677
676678
677
679
678680
679681
680682
......
864866
865867
866868
867
869
870
868871
872
873
869874
870875
871876
872877
873
874
878
875879
876880
877881
......
884888
885889
886890
887
888
889
891
892
893
890894
891895
892896
......
907911
908912
909913
910
911
914
912915
913916
914917
my($font,
$height,
$instance,
$width);
$width,
$window_type);
$window_type = "history_window";
# Look for an unused window first.
foreach my $window (@windows)
{
if ($window->{type} eq "history_window"
&& ! $window->{window}->mapped())
if ($window->{type} eq $window_type && ! $window->{window}->mapped())
{
$instance = $window;
last;
if (! defined($instance))
{
$instance = {};
$instance->{type} = "history_window";
$instance->{type} = $window_type;
$instance->{glade} =
Gtk2::GladeXML->new("../mtn-browse.glade", "history_window");
Gtk2::GladeXML->new("../mtn-browse.glade", $window_type);
# Flag to stop recursive calling of callbacks.
# Get the widgets that we are interested in.
$instance->{window} = $instance->{glade}->get_widget("history_window");
$instance->{window} = $instance->{glade}->get_widget($window_type);
$instance->{window}->set_icon($app_icon);
$instance->{appbar} = $instance->{glade}->get_widget("appbar");
$instance->{history_label} =
$height,
$instance,
$renderer,
$width);
$width,
$window_type);
$window_type = "revision_comparison_window";
# Look for an unused window first.
foreach my $window (@windows)
{
if ($window->{type} eq "revision_comparison_window"
&& ! $window->{window}->mapped())
if ($window->{type} eq $window_type && ! $window->{window}->mapped())
{
$instance = $window;
last;
if (! defined($instance))
{
$instance = {};
$instance->{type} = "revision_comparison_window";
$instance->{glade} = Gtk2::GladeXML->new("../mtn-browse.glade",
"revision_comparison_window");
$instance->{type} = $window_type;
$instance->{glade} =
Gtk2::GladeXML->new("../mtn-browse.glade", $window_type);
# Flag to stop recursive calling of callbacks.
# Get the widgets that we are interested in.
$instance->{window} =
$instance->{glade}->get_widget("revision_comparison_window");
$instance->{window} = $instance->{glade}->get_widget($window_type);
$instance->{window}->set_icon($app_icon);
$instance->{appbar} = $instance->{glade}->get_widget("appbar");
$instance->{comparison_label} =
mtn-browse
7979
8080
8181
82
8283
8384
8485
......
108109
109110
110111
112
111113
112114
113115
......
390392
391393
392394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
393422
394423
395424
......
650679
651680
652681
653
682
683
654684
685
686
655687
656
688
657689
658690
659
691
660692
661693
662694
......
672704
673705
674706
675
707
676708
677709
678710
......
12681300
12691301
12701302
1271
1303
1304
12721305
12731306
12741307
......
12771310
12781311
12791312
1313
1314
12801315
12811316
12821317
......
13491384
13501385
13511386
1387
1388
1389
1390
1391
13521392
13531393
13541394
......
13581398
13591399
13601400
1361
1401
1402
13621403
13631404
1405
1406
1407
1408
1409
1410
1411
1412
13641413
13651414
13661415
13671416
13681417
1418
1419
1420
1421
1422
1423
13691424
13701425
13711426
1427
1428
1429
13721430
13731431
13741432
13751433
1434
13761435
13771436
13781437
......
14271486
14281487
14291488
1430
1489
14311490
14321491
14331492
......
14361495
14371496
14381497
1498
14391499
14401500
14411501
use ChangeLog;
use ComboAutoCompletion;
use Completion;
use FindText;
use History;
use Utilities;
sub new_browser_instance();
sub revision_change_history_button_clicked_cb($$);
sub revision_change_log_button_clicked_cb($$);
sub search_text_button_clicked_cb($$);
sub setup_sigchld_handler($);
sub sigchld_handler();
sub update_browser_state($$);
#
##############################################################################
#
# Routine - search_text_button_clicked_cb
#
# Description - Callback routine called when the user clicks on the search
# text button in a main browser window.
#
# Data - $widget : The widget object that received the signal.
# $browser : The browser instance that is associated with
# this widget.
#
##############################################################################
sub search_text_button_clicked_cb($$)
{
my($widget, $browser) = @_;
return if ($browser->{in_cb});
local $browser->{in_cb} = 1;
find_text($browser->{window}, $browser->{file_view_sv});
}
#
##############################################################################
#
# Routine - annotate_button_clicked_cb
#
# Description - Callback routine called when the user clicks on the
$image,
$renderer,
$tv_column,
$div);
$div,
$window_type);
$window_type = "main_window";
$browser = {};
$browser->{type} = "browser_window";
$browser->{type} = $window_type;
$browser->{mtn} = Monotone::AutomateStdio->new();
$browser->{glade} =
Gtk2::GladeXML->new("../mtn-browse.glade", "main_window");
Gtk2::GladeXML->new("../mtn-browse.glade", $window_type);
# Flag to stop recursive calling of callbacks.
# Get the widgets that we are interested in.
$browser->{window} = $browser->{glade}->get_widget("main_window");
$browser->{window} = $browser->{glade}->get_widget($window_type);
$browser->{window}->set_icon($app_icon);
$browser->{appbar} = $browser->{glade}->get_widget("appbar");
$browser->{branch_combo} =
$mime_type,
$scrolled_window);
# Reset the file view buffer.
# Reset the file view buffer and the associated find text
# window.
$browser->{file_button_vbox}->set_sensitive(TRUE);
foreach my $widget (@{$browser->{text_file_sensitive_group}})
}
$browser->{file_view_svbuffer}->set_text("");
$browser->{file_view_svbuffer}->set("highlight", FALSE);
reset_find_text($browser->{file_view_sv});
disable_find_text($browser->{file_view_sv}, 1);
# Get contents.
if ($mime_type =~ m/^text\/.+$/o || $ok_to_render)
{
my $iter;
# Display text file with possible syntax highlighting.
if (defined($lang = $browser->{file_view_svlangmgr}->
get_language_from_mime_type($mime_type)))
{
set_language($lang);
}
# Load in the contents.
# Load in the contents and then delete the trailing
# newline.
$browser->{file_view_svbuffer}->set_text($contents);
$iter = $browser->{file_view_svbuffer}->get_end_iter();
$browser->{file_view_svbuffer}->delete
($iter,
$browser->{file_view_svbuffer}->get_end_iter())
if ($iter->backward_char());
# Enable the file buttons applicable to text files.
foreach my $widget
(@{$browser->{text_file_sensitive_group}})
{
$widget->set_sensitive(TRUE);
}
# Enable any associated find text window that may be
# displayed.
disable_find_text($browser->{file_view_sv}, 0);
}
else
{
# Display mime type for undisplayable file contents.
$browser->{file_view_svbuffer}->
set("highlight", FALSE);
$browser->{file_view_svbuffer}->
set_text("<" . $mime_type . ">\n");
}
}
else
{
# Reset the file view buffer.
# Reset the file view buffer and the associated find text window.
$browser->{file_button_vbox}->set_sensitive(FALSE);
$browser->{file_view_svbuffer}->set_text("");
set_label_value($browser->{file_id_label}, "");
set_label_value($browser->{last_update_label}, "");
set_label_value($browser->{file_revision_id_label}, "");
disable_find_text($browser->{file_view_sv}, 1);
}
mtn-browse.glade
882882
883883
884884
885
885
886886
887887
888888
......
944944
945945
946946
947
947
948948
949949
950950
......
10351035
10361036
10371037
1038
1038
10391039
10401040
10411041
......
10891089
10901090
10911091
1092
1092
10931093
10941094
10951095
......
11521152
11531153
11541154
1155
1155
11561156
11571157
11581158
......
12091209
12101210
12111211
1212
1212
12131213
12141214
12151215
......
12431243
12441244
12451245
1246
1246
12471247
12481248
12491249
......
13191319
13201320
13211321
1322
13221323
13231324
13241325
......
17531754
17541755
17551756
1756
1757
17571758
17581759
17591760
......
18141815
18151816
18161817
1817
1818
18181819
18191820
18201821
......
18711872
18721873
18731874
1874
1875
18751876
18761877
18771878
......
19041905
19051906
19061907
1907
1908
19081909
19091910
19101911
......
20472048
20482049
20492050
2050
2051
20512052
20522053
20532054
......
20692070
20702071
20712072
2072
2073
20732074
20742075
20752076
......
23582359
23592360
23602361
2361
2362
23622363
23632364
23642365
......
29172918
29182919
29192920
2920
2921
29212922
29222923
29232924
......
29512952
29522953
29532954
2954
2955
29552956
29562957
29572958
......
33553356
33563357
33573358
3358
3359
33593360
33603361
33613362
......
34123413
34133414
34143415
3415
3416
34163417
34173418
34183419
......
34483449
34493450
34503451
3452
3453
34513454
34523455
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
34653456
34663457
34673458
......
35563547
35573548
35583549
3559
3550
35603551
35613552
35623553
......
36183609
36193610
36203611
3621
3612
36223613
36233614
36243615
......
36773668
36783669
36793670
3680
3671
36813672
36823673
36833674
......
37113702
37123703
37133704
3714
3705
37153706
37163707
37173708
......
39073898
39083899
39093900
3910
3901
39113902
39123903
39133904
......
42174208
42184209
42194210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
42204400
<property name="tooltip" translatable="yes">Name of the file being displayed</property>
<property name="width">1</property>
<property name="height">1</property>
<property name="hadjustment">0 0 127 10 114.3 127</property>
<property name="hadjustment">0 0 130 10 117 130</property>
<property name="vadjustment">0 0 17 10 15.3 17</property>
<child>
<property name="tooltip" translatable="yes">Date of when file was last changed</property>
<property name="width">1</property>
<property name="height">1</property>
<property name="hadjustment">0 0 127 10 114.3 127</property>
<property name="hadjustment">0 0 130 10 117 130</property>
<property name="vadjustment">0 0 17 10 15.3 17</property>
<child>
<child>
<widget class="GtkLabel" id="last_update_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Last Update:</property>
<property name="label" translatable="yes">Last update:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="tooltip" translatable="yes">File's unique id in database</property>
<property name="width">1</property>
<property name="height">1</property>
<property name="hadjustment">0 0 133 10 119.7 133</property>
<property name="hadjustment">0 0 134 10 120.6 134</property>
<property name="vadjustment">0 0 17 10 15.3 17</property>
<child>
file was last changed</property>
<property name="width">1</property>
<property name="height">1</property>
<property name="hadjustment">0 0 133 10 119.7 133</property>
<property name="hadjustment">0 0 134 10 120.6 134</property>
<property name="vadjustment">0 0 17 10 15.3 17</property>
<child>
<child>
<widget class="GtkLabel" id="file_id_label">
<property name="visible">True</property>
<property name="label" translatable="yes">File Id:</property>
<property name="label" translatable="yes">File id:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<child>
<widget class="GtkLabel" id="file_revision_id_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Revision Id:</property>
<property name="label" translatable="yes">Revision id:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="search_text_button_clicked_cb" last_modification_time="Sun, 16 Mar 2008 11:37:14 GMT"/>
<child>
<widget class="GtkImage" id="image10">
<property name="visible">True</property>
<property name="width">1</property>
<property name="height">1</property>
<property name="hadjustment">0 0 282 10 253.8 282</property>
<property name="hadjustment">0 0 286 10 257.4 286</property>
<property name="vadjustment">0 0 17 10 15.3 17</property>
<child>
<property name="visible">True</property>
<property name="width">1</property>
<property name="height">1</property>
<property name="hadjustment">0 0 282 10 253.8 282</property>
<property name="hadjustment">0 0 286 10 257.4 286</property>
<property name="vadjustment">0 0 17 10 15.3 17</property>
<child>
<child>
<widget class="GtkLabel" id="revision_id_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Revision Id:</property>
<property name="label" translatable="yes">Revision id:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<child>
<widget class="GtkLabel" id="change_log_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Change Log:</property>
<property name="label" translatable="yes">Change log:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="tooltip" translatable="yes">Select Simple Query you you just want to manually
select the branch and revision from drop down lists</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Simple Query</property>
<property name="label" translatable="yes">Simple query</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="tooltip" translatable="yes">Select Advanced Query if you want to
specify very specific selection critia</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Advanced Query</property>
<property name="label" translatable="yes">Advanced query</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<child>
<widget class="GtkLabel" id="search_term_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Search Term:</property>
<property name="label" translatable="yes">Search term:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<child>
<widget class="GtkLabel" id="selected_revision_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Revision Id:</property>
<property name="label" translatable="yes">Revision id:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="visible">True</property>
<property name="width">1</property>
<property name="height">1</property>
<property name="hadjustment">0 0 286 10 257.4 286</property>
<property name="hadjustment">0 0 287 10 258.3 287</property>
<property name="vadjustment">0 0 17 10 15.3 17</property>
<child>
<property name="visible">True</property>
<property name="width">1</property>
<property name="height">1</property>
<property name="hadjustment">0 0 356 10 320.4 356</property>
<property name="hadjustment">0 0 336 10 302.4 336</property>
<property name="vadjustment">0 0 17 10 15.3 17</property>
<child>
<child>
<widget class="GtkLabel" id="numbers_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Number Of Revisions:</property>
<property name="label" translatable="yes">Number of revisions:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="sensitive">False</property>
<property name="tooltip" translatable="yes">Stop gathering history details</property>
<property name="can_focus">True</property>
<property name="label">gtk-stop</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<child>
<widget class="GtkImage" id="image32">
<property name="visible">True</property>
<property name="stock">gtk-stop</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="visible">True</property>
<property name="width">1</property>
<property name="height">1</property>
<property name="hadjustment">0 0 368 10 331.2 368</property>
<property name="hadjustment">0 0 375 10 337.5 375</property>
<property name="vadjustment">0 0 17 10 15.3 17</property>
<child>
<property name="visible">True</property>
<property name="width">1</property>
<property name="height">1</property>
<property name="hadjustment">0 0 368 10 331.2 368</property>
<property name="hadjustment">0 0 375 10 337.5 375</property>
<property name="vadjustment">0 0 17 10 15.3 17</property>
<child>
<child>
<widget class="GtkLabel" id="revision_id_1_label">
<property name="visible">True</property>
<property name="label" translatable="yes">First Revision Id:</property>
<property name="label" translatable="yes">First revision id:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<child>
<widget class="GtkLabel" id="revision_id_2_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Second Revision Id:</property>
<property name="label" translatable="yes">Second revision id:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<child>
<widget class="GtkLabel" id="file_comparison_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Jump To File:</property>
<property name="label" translatable="yes">Jump to file:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
</child>
</widget>
<widget class="GtkDialog" id="find_text_window">
<property name="title" translatable="yes">Find Text</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="modal">False</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog_vbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog_action_area">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="close_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-7</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="find_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-find</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="find_button_clicked_cb" last_modification_time="Sun, 16 Mar 2008 11:46:28 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="main_vbox">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">5</property>
<child>
<widget class="GtkHBox" id="find_hbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">5</property>
<child>
<widget class="GtkEventBox" id="find_eventbox">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Enter the text that is
to be searched for</property>
<property name="visible_window">True</property>
<property name="above_child">False</property>
<child>
<widget class="GtkLabel" id="find_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Search for:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkComboBoxEntry" id="find_comboboxentry">
<property name="width_request">300</property>
<property name="visible">True</property>
<signal name="changed" handler="find_combobox_changed_cb" last_modification_time="Mon, 31 Mar 2008 15:29:43 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="settings_hbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">5</property>
<child>
<widget class="GtkCheckButton" id="case_sensitive_checkbutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Choose whether searches are
to be case sensitive or not</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Case sensitive</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="search_backwards_checkbutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Select the direction
of the search</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Search backwards</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

Archive Download the corresponding diff file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status