monotone

monotone Commit Details

Date:2009-01-24 18:20:21 (10 years 4 months ago)
Author:Tony Cooper
Branch:net.venge.monotone.contrib.mtn-browse
Commit:1b48e8da92f4774222d4a057fd701c95d8b9e414
Parents: b596f518d7116e3feb10ad1be8346d815b8fc9c6
Message:- Vertical panes now maintain the size of the left hand window.

- Implemented the option of selecting a search column in a treeview widget.
- Searching in a treeview now used REs.
Changes:
Mlib/perl/AdvancedFind.pm (2 diffs)
Mlib/perl/Common.pm (2 diffs)
Mlib/perl/FindFiles.pm (1 diff)
Mlib/perl/Preferences.pm (3 diffs)
Mlib/ui/mtn-browse.glade (3 diffs)
Mmtn-browse (2 diffs)

File differences

lib/perl/AdvancedFind.pm
665665
666666
667667
668
669
668670
669671
672
673
670674
671675
672676
......
715719
716720
717721
722
723
718724
719725
720726
$tv_column->set_attributes($renderer, "text" => AFLS_AUTHOR_COLUMN);
$instance->{revisions_treeview}->append_column($tv_column);
treeview_setup_search_column_selection
($instance->{revisions_treeview}, 0 .. 3);
$instance->{revisions_treeview}->
set_search_column(AFLS_REVISION_ID_COLUMN);
$instance->{revisions_treeview}->
set_search_equal_func(\&treeview_column_searcher);
# Setup the revision details viewer.
$instance->{revision_combo_details}->{preset} = 0;
$instance->{appbar}->set_progress_percentage(0);
$instance->{appbar}->clear_stack();
$instance->{revisions_treeview}->
set_search_column(AFLS_REVISION_ID_COLUMN);
&{$instance->{update_handler}}($instance, NEW_FIND);
$instance->{window}->show_all();
lib/perl/Common.pm
7373
7474
7575
76
77
7678
7779
7880
......
546548
547549
548550
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
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
549708
550709
551710
sub run_command($@);
sub save_as_file($$$);
sub set_label_value($$);
sub treeview_column_searcher($$$$);
sub treeview_setup_search_column_selection($@);
#
##############################################################################
#
#
##############################################################################
#
# Routine - treeview_setup_search_column_selection
#
# Description - Setup the specified treeview column headers so that the
# user can select which column to search in.
#
# Data - $treeview : The treeview widget that is to have this
# feature enabled on it.
# @columns : A list of column numbers that are to be setup.
#
##############################################################################
sub treeview_setup_search_column_selection($@)
{
my($treeview, @columns) = @_;
foreach my $col_nr (@columns)
{
my($button,
$col,
$label);
next unless (defined($col = $treeview->get_column($col_nr)));
# We need to add a widget if we are going to get back a button widget
# from $treeview->get_parent() (this is just how Gtk2 works, I guess
# the header widgets are by default some sort of cut down affair).
$label = Gtk2::Label->new($col->get_title());
$col->set_widget($label);
$label->show();
# Find the header button widget.
for ($button = $col->get_widget();
defined($button) && ! $button->isa("Gtk2::Button");
$button = $button->get_parent())
{
}
next unless (defined($button));
# Attach a mouse button press event callback to the column header
# button.
$button->signal_connect
("button_press_event",
sub {
my($widget, $event, $data) = @_;
# We are only interested in right button mouse clicks.
return FALSE unless ($event->button() == 3);
my($menu,
$menu_item);
# Create a popup menu with the search option in it.
$menu = Gtk2::Menu->new();
$menu_item = Gtk2::MenuItem->new("Select As Search Column");
$menu->append($menu_item);
$menu_item->show();
# Setup a callback that will set up that column for searchin
# if the user should select the option.
$menu_item->signal_connect
("activate",
sub {
my($widget, $data) = @_;
$data->{treeview}->
set_search_column($data->{col_nr});
},
$data);
# Display the popup menu.
$menu->popup(undef,
undef,
undef,
undef,
$event->button(),
$event->time());
return TRUE;
},
{treeview => $treeview,
col_nr => $col_nr});
}
}
#
##############################################################################
#
# Routine - treeview_column_searcher
#
# Description - Callback routine used for comparing search terms with data
# inside a particular treeview's cell.
#
# Data - $model : The underlying data model used by the
# treeview.
# $column : The number of the search column.
# $key : The data that is to be searched for.
# $iter : The treeview iterator for the row that is to
# be compared.
# Return Value : TRUE if there is no match, otherwise FALSE
# if there is.
#
##############################################################################
sub treeview_column_searcher($$$$)
{
my($model, $column, $key, $iter) = @_;
my($re,
$value);
# Get the value in the treeview's cell.
$value = $model->get($iter, $column);
# Compile the user's regular expression and return a no-match if it doesn't
# compile.
eval
{
$re = qr/$key/;
};
return TRUE if ($@ ne "");
# Actually do the match.
if ($value =~ m/$re/)
{
return FALSE;
}
else
{
return TRUE;
}
}
#
##############################################################################
#
# Routine - get_branch_revisions
#
# Description - Get a list of revision ids or tags for the specified branch
lib/perl/FindFiles.pm
971971
972972
973973
974
975
974976
975
977
976978
977979
978980
$tv_column->set_attributes($renderer, "text" => 0);
$instance->{results_treeview}->append_column($tv_column);
$instance->{results_treeview}->set_search_column(0);
$instance->{results_treeview}->
set_search_equal_func(\&treeview_column_searcher);
# Disable the approprate widgets by default.
# Disable the appropriate widgets by default.
for my $widget (@{$instance->{date_sensitive_group}},
@{$instance->{size_sensitive_group}})
lib/perl/Preferences.pm
11111111
11121112
11131113
1114
1115
11141116
1117
1118
11151119
11161120
11171121
......
11281132
11291133
11301134
1135
1136
11311137
11321138
11331139
......
11621168
11631169
11641170
1171
11651172
11661173
11671174
$tv_column->set_attributes($renderer, "text" => MTLS_HELPER_COLUMN);
$instance->{mime_types_treeview}->append_column($tv_column);
treeview_setup_search_column_selection
($instance->{mime_types_treeview}, 0 .. 2);
$instance->{mime_types_treeview}->set_search_column(MTLS_NAME_COLUMN);
$instance->{mime_types_treeview}->
set_search_equal_func(\&treeview_column_searcher);
# Setup the file name patterns list.
$instance->{file_name_patterns_treeview}->append_column($tv_column);
$instance->{file_name_patterns_treeview}->set_search_column(0);
$instance->{file_name_patterns_treeview}->
set_search_equal_func(\&treeview_column_searcher);
# Reparent the preferences window to the specified parent.
$instance->{mime_types_hpaned}->set_position(700);
$instance->{window}->set_transient_for($parent);
$instance->{preferences} = $preferences;
$instance->{mime_types_treeview}->set_search_column(MTLS_NAME_COLUMN);
load_preferences_into_gui($instance);
$instance->{window}->show_all();
lib/ui/mtn-browse.glade
901901
902902
903903
904
904
905905
906906
907907
......
28352835
28362836
28372837
2838
2838
28392839
28402840
28412841
......
72917291
72927292
72937293
7294
7294
72957295
72967296
72977297
</widget>
<packing>
<property name="shrink">False</property>
<property name="resize">True</property>
<property name="resize">False</property>
</packing>
</child>
</widget>
<packing>
<property name="shrink">False</property>
<property name="resize">True</property>
<property name="resize">False</property>
</packing>
</child>
</widget>
<packing>
<property name="shrink">False</property>
<property name="resize">True</property>
<property name="resize">False</property>
</packing>
</child>
</widget>
mtn-browse
15891589
15901590
15911591
1592
1593
15921594
15931595
15941596
15951597
15961598
1599
1600
15971601
15981602
15991603
......
16611665
16621666
16631667
1668
1669
16641670
16651671
16661672
$tv_column->set_attributes($renderer, "text" => MLS_AUTHOR_COLUMN);
$browser->{manifest_browser_treeview}->append_column($tv_column);
treeview_setup_search_column_selection
($browser->{manifest_browser_treeview}, 1 .. 3);
}
$browser->{show_file_details} = $user_preferences->{show_file_details};
$browser->{manifest_browser_treeview}->
set_search_column(MLS_NAME_COLUMN);
$browser->{manifest_browser_treeview}->
set_search_equal_func(\&treeview_column_searcher);
# Setup the file file viewer (with syntax highlighting).
$browser->{revision_combo_details}->{preset} = 0;
$browser->{directory_combo_details}->{preset} = 0;
$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);
&{$browser->{update_handler}}($browser, ALL_CHANGED);

Archive Download the corresponding diff file

Branches

Tags

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