monotone

monotone Commit Details

Date:2009-02-07 17:31:43 (10 years 4 months ago)
Author:Tony Cooper
Branch:net.venge.monotone.contrib.mtn-browse
Commit:f0d902f893c8aee6ff0a229584a873b5f6bf9e70
Parents: 9cebff648f0035afc47937e3169d06c09fbae4dd
Message:- Added a user preference option for controlling whether line numbers are

displayed by default when showing a file's contents.
- Added a user preference option for controlling whether branch and revision
comboboxentries update their lists when the user is typing in values (a
performance tuning option).
- A scroll margin is now used when finding text. This makes it easier to see the
context of a found string when it is at the top or bottom of the window.
- Directory separators are no longer assumed to be '/'.
- The get_revision_ids routine now correctly uses the current branch to refine
the query (can now cope with multiple tags on different branches).
- Renamed the find_button widget to find_text_button to make it more specific.
Changes:
Mlib/perl/ComboAutoCompletion.pm (1 diff)
Mlib/perl/Common.pm (2 diffs)
Mlib/perl/FindText.pm (9 diffs)
Mlib/perl/Preferences.pm (7 diffs)
Mlib/ui/mtn-browse.glade (6 diffs)
Mmtn-browse (5 diffs)

File differences

lib/perl/ComboAutoCompletion.pm
256256
257257
258258
259
259
260260
261
262
261
263262
264
265
263
264
265
266
267
268
269
270
271
272
273
274
266275
267276
268277
$combo_details->{value} = $value;
$combo_details->{complete} = $complete;
# Update the pulldown choices.
# Update the pulldown choices if that is what the user wants.
$combo->get_model()->clear();
foreach $item (@{$combo_details->{list}})
if (! $user_preferences->{static_lists})
{
$combo->append_text($item) if ($value eq substr($item, 0, $len));
$combo_details->{complete} = 1 if (! $complete && $value eq $item);
$combo->get_model()->clear();
foreach $item (@{$combo_details->{list}})
{
$combo->append_text($item)
if ($value eq substr($item, 0, $len));
# The following check is needed in the case when the user is
# simply deleting characters from the right.
$combo_details->{complete} = 1
if (! $complete && $value eq $item);
}
}
# Update the window state on a significant change.
lib/perl/Common.pm
105105
106106
107107
108
108
109109
110
110
111111
112112
113113
114114
115115
116116
117
118
117
118
119119
120120
121121
......
916916
917917
918918
919
920
921
919
920
921
922
923
922924
923925
924926
for ($i = 0; ; ++ $i)
{
if (-d ($tmp_dir . "/" . $i))
if (-d File::Spec->catfile($tmp_dir, $i))
{
if (! -e ($path = $tmp_dir . "/" . $i . "/" . $file_name))
if (! -e ($path = File::Spec->catfile($tmp_dir, $i, $file_name)))
{
return $path;
}
}
else
{
return unless mkdir($tmp_dir . "/" . $i);
return $tmp_dir . "/" . $i . "/" . $file_name;
return unless mkdir(File::Spec->catfile($tmp_dir, $i));
return File::Spec->catfile($tmp_dir, $i, $file_name);
}
}
return unless ($instance->{revision_combo_details}->{complete});
if ($instance->{tagged_checkbutton}->get_active())
{
$instance->{mtn}->
select($revision_ids,
"t:" . $instance->{revision_combo_details}->{value});
my $query = "";
$query = "b:" . $instance->{branch_combo_details}->{value} . "/"
if ($instance->{branch_combo_details}->{complete});
$query .= "t:" . $instance->{revision_combo_details}->{value};
$instance->{mtn}->select($revision_ids, $query);
$$tag = $instance->{revision_combo_details}->{value}
if (defined($tag));
}
lib/perl/FindText.pm
6666
6767
6868
69
6970
7071
7172
......
157158
158159
159160
160
161
161162
162163
163164
......
165166
166167
167168
168
169
169170
170171
171172
......
330331
331332
332333
333
334
334335
335336
336337
......
343344
344345
345346
346
347
347348
348349
349350
......
559560
560561
561562
562
563
563
564
564565
565566
566567
......
606607
607608
608609
609
610
610611
611612
612613
......
694695
695696
696697
697
698
698699
699700
700701
......
754755
755756
756757
757
758
758759
759760
760761
sub find_comboboxentry_changed_cb($$);
sub find_current_window($);
sub find_text_button_clicked_cb($$);
sub get_find_text_window($$);
#
##############################################################################
if ($enable)
{
$instance->{main_vbox}->set_sensitive(TRUE);
$instance->{find_button}->set_sensitive
$instance->{find_text_button}->set_sensitive
((length($instance->{find_comboboxentry}->child()->get_text())
> 0) ?
TRUE : FALSE);
else
{
$instance->{main_vbox}->set_sensitive(FALSE);
$instance->{find_button}->set_sensitive(FALSE);
$instance->{find_text_button}->set_sensitive(FALSE);
}
}
#
##############################################################################
#
# Routine - find_button_clicked_cb
# Routine - find_text_button_clicked_cb
#
# Description - Callback routine called when the user clicks on the find
# button in the find text window.
sub find_button_clicked_cb($$)
sub find_text_button_clicked_cb($$)
{
my($widget, $instance) = @_;
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);
($start_line_iter, 0.05, FALSE, 0, 0);
$instance->{text_view}->scroll_to_iter($end_iter, 0.05, FALSE, 0, 0);
}
else
{
return if ($instance->{in_cb});
local $instance->{in_cb} = 1;
$instance->{find_button}->set_sensitive
$instance->{find_text_button}->set_sensitive
((length($instance->{find_comboboxentry}->child()->get_text()) > 0) ?
TRUE : FALSE);
"case_sensitive_checkbutton",
"search_backwards_checkbutton",
"regular_expression_checkbutton",
"find_button")
"find_text_button")
{
$instance->{$widget} = $instance->{glade}->get_widget($widget);
}
# Make sure the find button is only enabled when there is something entered
# into the comboboxentry widget.
$instance->{find_button}->set_sensitive
$instance->{find_text_button}->set_sensitive
((length($instance->{find_comboboxentry}->child()->get_text()) > 0) ?
TRUE : FALSE);
lib/perl/Preferences.pm
6060
6161
6262
63
63
6464
6565
6666
......
440440
441441
442442
443
444
443445
444446
445447
......
10121014
10131015
10141016
1017
1018
10151019
10161020
10171021
......
12441248
12451249
12461250
1251
1252
1253
1254
1255
12471256
12481257
12491258
......
14091418
14101419
14111420
1421
1422
1423
1424
14121425
14131426
14141427
......
15701583
15711584
15721585
1586
1587
1588
1589
1590
1591
15731592
15741593
15751594
......
16101629
16111630
16121631
1632
1633
16131634
16141635
16151636
# Constant for the preferences file's format version.
use constant PREFERENCES_FORMAT_VERSION => 6;
use constant PREFERENCES_FORMAT_VERSION => 7;
# Text viewable application mime types.
"history_size",
"show_suspended",
"show_file_details",
"show_line_numbers",
"static_lists",
"diffs_application");
}
elsif ($page_nr == 1)
"history_size_spinbutton",
"show_suspended_revisions_checkbutton",
"detailed_file_listing_checkbutton",
"show_line_numbers_checkbutton",
"static_lists_checkbutton",
"external_diffs_app_entry",
# Appearance pane widgets.
$instance->{detailed_file_listing_checkbutton}->
set_active($instance->{preferences}->{show_file_details} ?
TRUE : FALSE);
$instance->{show_line_numbers_checkbutton}->
set_active($instance->{preferences}->{show_line_numbers} ?
TRUE : FALSE);
$instance->{static_lists_checkbutton}->
set_active($instance->{preferences}->{static_lists} ? TRUE : FALSE);
$instance->{external_diffs_app_entry}->
set_text($instance->{preferences}->{diffs_application});
1 : 0;
$instance->{preferences}->{show_file_details} =
$instance->{detailed_file_listing_checkbutton}->get_active() ? 1 : 0;
$instance->{preferences}->{show_line_numbers} =
$instance->{show_line_numbers_checkbutton}->get_active() ? 1 : 0;
$instance->{preferences}->{static_lists} =
$instance->{static_lists_checkbutton}->get_active() ? 1 : 0;
$instance->{preferences}->{diffs_application} =
$instance->{external_diffs_app_entry}->get_text();
$preferences->{history_size} = 20;
$preferences->{version} = 6;
}
if ($preferences->{version} == 6)
{
$preferences->{show_line_numbers} = 0;
$preferences->{static_lists} = 0;
$preferences->{version} = 7;
}
$preferences->{version} = PREFERENCES_FORMAT_VERSION;
history_size => 20,
show_suspended => 0,
show_file_details => 1,
show_line_numbers => 0,
static_lists => 0,
diffs_application => "kompare '{file1}' '{file2}'",
fixed_font => "monospace 10",
coloured_diffs => 1,
lib/ui/mtn-browse.glade
2121
2222
2323
24
24
2525
2626
2727
......
34533453
34543454
34553455
3456
3456
34573457
34583458
34593459
......
35153515
35163516
35173517
3518
3518
35193519
35203520
35213521
......
42674267
42684268
42694269
4270
4270
42714271
42724272
42734273
......
42764276
42774277
42784278
4279
4279
42804280
42814281
42824282
......
53585358
53595359
53605360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
53615408
53625409
53635410
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="enable_layout_config">True</property>
<property name="enable_layout_config">False</property>
<signal name="delete_event" handler="main_window_delete_event_cb" last_modification_time="Sat, 12 Apr 2008 11:07:39 GMT"/>
<child internal-child="dock">
<property name="visible">True</property>
<property name="width">1</property>
<property name="height">1</property>
<property name="hadjustment">0 0 376 10 338.4 376</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 376 10 338.4 376</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>
<child>
<widget class="GtkButton" id="find_button">
<widget class="GtkButton" id="find_text_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">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"/>
<signal name="clicked" handler="find_text_button_clicked_cb" last_modification_time="Sat, 07 Feb 2009 14:29:38 GMT"/>
</widget>
</child>
</widget>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="show_line_numbers_checkbutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Select Show line numbers if you
want line numbers to be shown
in file listings by default</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show line numbers</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="static_lists_checkbutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Select Static branch and revision
lists if you do not want the branch
and revision combobox entry lists
to update as you type in values
(can help with speed when dealing
with large lists)</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Static branch and revision lists</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>
</child>
</widget>
mtn-browse
7171
7272
7373
74
74
75
7576
7677
7778
......
176177
177178
178179
179
180
181
182
180
181
182
183
184
183185
184
186
185187
186
188
189
187190
188191
189192
......
413416
414417
415418
416
419
417420
418421
419422
......
16621665
16631666
16641667
1668
1669
1670
1671
1672
1673
1674
1675
1676
16651677
16661678
16671679
......
17051717
17061718
17071719
1708
1709
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
17101730
17111731
17121732
use Gtk2::Helper;
use Gtk2::Pango;
use Gtk2::SourceView;
use Locale::TextDomain ("mtn-browse", PREFIX_DIR . "/share/locale");
use Locale::TextDomain ("mtn-browse",
File::Spec->catfile(PREFIX_DIR, "share", "locale"));
use IO::File;
use IPC::Open3;
use POSIX qw(:errno_h :locale_h :sys_wait_h strftime);
# Initialise stuff.
Gnome2::Program->init(APPLICATION_NAME,
APPLICATION_VERSION,
undef,
app_datadir => PREFIX_DIR . "/share");
Gnome2::Program->init
(APPLICATION_NAME,
APPLICATION_VERSION,
undef,
app_datadir => File::Spec->catfile(PREFIX_DIR, "share"));
setup_sigchld_handler(\&sigchld_handler);
$glade_file = LIB_DIR . "/ui/mtn-browse.glade";
$glade_file = File::Spec->catfile(LIB_DIR, "ui", "mtn-browse.glade");
$tooltips = Gtk2::Tooltips->new();
$line_image = Gtk2::Gdk::Pixbuf->new_from_file(LIB_DIR . "/ui/line.png");
$line_image = Gtk2::Gdk::Pixbuf->new_from_file
(File::Spec->catfile(LIB_DIR, "ui", "line.png"));
# Set up the default database locked and I/O wait handlers for the Monotone
# class.
local $browser->{in_cb} = 1;
$large_logo = Gtk2::Gdk::Pixbuf->new_from_file
(LIB_DIR . "/ui/mtn-browse-large.png")
(File::Spec->catfile(LIB_DIR, "ui", "mtn-browse-large.png"))
if (! defined($large_logo));
Gnome2::About->new
(APPLICATION_NAME,
$browser);
$browser->{file_view_sv}->show_all();
# Enable the showing of line numbers by default if that is what the
# user wants.
if ($user_preferences->{show_line_numbers})
{
$browser->{show_line_numbers_togglebutton}->set_active(TRUE);
$browser->{file_view_sv}->set_show_line_numbers(TRUE);
}
local $browser->{in_cb} = 1;
$browser->{window}->show_all();
$browser->{file_being_viewed_preset_value} = "";
$browser->{manifest_browser_treeview}->
set_search_column(MLS_NAME_COLUMN);
$browser->{show_line_numbers_togglebutton}->set_active(FALSE);
$browser->{file_view_sv}->set_show_line_numbers(FALSE);
if ($user_preferences->{show_line_numbers})
{
$browser->{show_line_numbers_togglebutton}->set_active(TRUE);
$browser->{file_view_sv}->set_show_line_numbers(TRUE);
}
else
{
$browser->{show_line_numbers_togglebutton}->set_active(FALSE);
$browser->{file_view_sv}->set_show_line_numbers(FALSE);
}
&{$browser->{update_handler}}($browser, ALL_CHANGED);
$browser->{window}->show_all();

Archive Download the corresponding diff file

Branches

Tags

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