#
#
# patch "lib/perl/Annotate.pm"
# from [5659c22ef38f8b16a038753c2fba26ed1b0cf84c]
# to [5f1054ba65b5fcc3f5567a65d69bf5140b150192]
#
# patch "lib/perl/Common.pm"
# from [87ec8802818bbb366f78b9ecc11cbcb89bac5072]
# to [0fd38de30c5209b3d6362e7402f2f2290b3553b1]
#
# patch "lib/perl/History.pm"
# from [051b901ef191a7db2d96ed8ecddde62f9afb2d89]
# to [10a62eb5b64d71c54d78184a86ddfde158d7f888]
#
# patch "lib/perl/Preferences.pm"
# from [5de8791183ecbe3cef6590b7fd40ee05b21665a4]
# to [e6965503f418a3e446d43d79af1500449f843089]
#
# patch "lib/ui/mtn-browse.glade"
# from [7a2b7331f893c0f11674a2a72eefd89f3fbb35c5]
# to [d75520e241f852fbacf7e422691c6ad2aca57e8e]
#
# patch "mtn-browse"
# from [41c8d05b4e6cfb670a939161f4656bfa06c8ef42]
# to [898df9702acc2eabd720d63386a89c79422b16b5]
#
============================================================
--- lib/perl/Annotate.pm 5659c22ef38f8b16a038753c2fba26ed1b0cf84c
+++ lib/perl/Annotate.pm 5f1054ba65b5fcc3f5567a65d69bf5140b150192
@@ -819,7 +819,7 @@ sub mtn_annotate($$$$)
eval
{
die("chdir failed: " . $!) unless (chdir(File::Spec->rootdir()));
- run_command(\$buffer, @cmd) or return;
+ return unless (run_command(\$buffer, @cmd));
};
$err = $@;
chdir($cwd);
============================================================
--- lib/perl/Common.pm 87ec8802818bbb366f78b9ecc11cbcb89bac5072
+++ lib/perl/Common.pm 0fd38de30c5209b3d6362e7402f2f2290b3553b1
@@ -697,12 +697,20 @@ sub treeview_column_searcher($$$$)
$value = $model->get($iter, $column);
- # Compile the user's regular expression and return a no-match if it doesn't
- # compile.
+ # Compile the user's search term (either as a regular expression or plain
+ # text depending upon the user's preferences) and return a no-match if it
+ # doesn't compile.
eval
{
- $re = qr/$key/;
+ if ($user_preferences->{list_search_as_re})
+ {
+ $re = qr/$key/;
+ }
+ else
+ {
+ $re = qr/\Q$key\E/;
+ }
};
return TRUE if ($@ ne "");
============================================================
--- lib/perl/History.pm 051b901ef191a7db2d96ed8ecddde62f9afb2d89
+++ lib/perl/History.pm 10a62eb5b64d71c54d78184a86ddfde158d7f888
@@ -2059,7 +2059,7 @@ sub mtn_diff($$$$;$)
eval
{
die("chdir failed: " . $!) unless (chdir(File::Spec->rootdir()));
- run_command(\$buffer, @cmd) or return;
+ return unless (run_command(\$buffer, @cmd));
};
$err = $@;
chdir($cwd);
============================================================
--- lib/perl/Preferences.pm 5de8791183ecbe3cef6590b7fd40ee05b21665a4
+++ lib/perl/Preferences.pm e6965503f418a3e446d43d79af1500449f843089
@@ -6,6 +6,25 @@
# module contains all the routines for implementing the
# preferences dialog.
#
+# Please note that when adding a new preference setting one
+# needs to:
+# 1) Up the preferences format version number by one.
+# 2) Possibly add the field to the field lists in the
+# defaults_button_clicked_cb routine.
+# 3) Get the corresponding widget in the
+# get_preferences_window routine and possibly
+# initialise it.
+# 4) Set the field's value in the
+# load_preferences_into_gui routine.
+# 5) Get the field's value in the
+# save_preferences_from_gui routine.
+# 6) Update the upgrade_preferences routine to upgrade an
+# existing preferences record to contain the new
+# settings (set to their default value).
+# 7) Update the initialise_preferences routine so as to
+# include the new settings (again set to their default
+# value).
+#
# Author - A.E.Cooper.
#
# Legal Stuff - Copyright (c) 2007 Anthony Edward Cooper
@@ -60,7 +79,7 @@ use constant PREFERENCES_FILE_NAME => ".
# Constant for the preferences file's format version.
-use constant PREFERENCES_FORMAT_VERSION => 8;
+use constant PREFERENCES_FORMAT_VERSION => 9;
# Text viewable application mime types.
@@ -294,8 +313,8 @@ sub load_preferences()
if (-f $file_name)
{
- defined($prefs_file = IO::File->new($file_name, "r"))
- or die(__x("open failed: {error_message}\n", error_message => $!));
+ die(__x("open failed: {error_message}\n", error_message => $!))
+ unless (defined($prefs_file = IO::File->new($file_name, "r")));
eval(join("", $prefs_file->getlines()));
die(__x("Invalid user preferences file: {error_message}\n",
error_message => $@))
@@ -345,8 +364,8 @@ sub save_preferences($)
# Write out the preferences record to disk.
- defined($prefs_file = IO::File->new($file_name, "w"))
- or die(__x("open failed: {error_message}\n", error_message => $!));
+ die(__x("open failed: {error_message}\n", error_message => $!))
+ unless (defined($prefs_file = IO::File->new($file_name, "w")));
$prefs_file->print("#\n");
$prefs_file->
print(__("# DO NOT EDIT! This is an automatically generated file.\n"));
@@ -442,11 +461,15 @@ sub defaults_button_clicked_cb($$)
"show_file_details",
"show_line_numbers",
"static_lists",
+ "list_search_as_re",
"diffs_application");
}
elsif ($page_nr == 1)
{
- @fields = ("fixed_font", "coloured_diffs", "colours");
+ @fields = ("fixed_font",
+ "toolbar_settings",
+ "coloured_diffs",
+ "colours");
}
else
{
@@ -1016,11 +1039,14 @@ sub get_preferences_window($$)
"detailed_file_listing_checkbutton",
"show_line_numbers_checkbutton",
"static_lists_checkbutton",
+ "search_as_regular_expression_checkbutton",
"external_diffs_app_entry",
# Appearance pane widgets.
"fonts_fontbutton",
+ "hide_text_checkbutton",
+ "fixed_checkbutton",
"comparison_pretty_print_checkbutton",
"annotation_prefix_1_foreground_colorbutton",
"annotation_prefix_1_background_colorbutton",
@@ -1259,6 +1285,9 @@ sub load_preferences_into_gui($)
TRUE : FALSE);
$instance->{static_lists_checkbutton}->
set_active($instance->{preferences}->{static_lists} ? TRUE : FALSE);
+ $instance->{search_as_regular_expression_checkbutton}->
+ set_active($instance->{preferences}->{list_search_as_re} ?
+ TRUE : FALSE);
$instance->{external_diffs_app_entry}->
set_text($instance->{preferences}->{diffs_application});
@@ -1266,6 +1295,12 @@ sub load_preferences_into_gui($)
$instance->{fonts_fontbutton}->
set_font_name($instance->{preferences}->{fixed_font});
+ $instance->{hide_text_checkbutton}->
+ set_active($instance->{preferences}->{toolbar_settings}->{hide_text}
+ ? TRUE : FALSE);
+ $instance->{fixed_checkbutton}->
+ set_active($instance->{preferences}->{toolbar_settings}->{fixed}
+ ? TRUE : FALSE);
$instance->{comparison_pretty_print_checkbutton}->
set_active($instance->{preferences}->{coloured_diffs} ? TRUE : FALSE);
for my $item (@colour_mapping_table)
@@ -1438,6 +1473,9 @@ sub save_preferences_from_gui($)
$instance->{show_line_numbers_checkbutton}->get_active() ? 1 : 0;
$instance->{preferences}->{static_lists} =
$instance->{static_lists_checkbutton}->get_active() ? 1 : 0;
+ $instance->{preferences}->{list_search_as_re} =
+ $instance->{search_as_regular_expression_checkbutton}->get_active() ?
+ 1 : 0;
$instance->{preferences}->{diffs_application} =
$instance->{external_diffs_app_entry}->get_text();
@@ -1445,6 +1483,10 @@ sub save_preferences_from_gui($)
$instance->{preferences}->{fixed_font} =
$instance->{fonts_fontbutton}->get_font_name();
+ $instance->{preferences}->{toolbar_settings}->{hide_text} =
+ $instance->{hide_text_checkbutton}->get_active() ? 1 : 0;
+ $instance->{preferences}->{toolbar_settings}->{fixed} =
+ $instance->{fixed_checkbutton}->get_active() ? 1 : 0;
$instance->{preferences}->{coloured_diffs} =
$instance->{comparison_pretty_print_checkbutton}->get_active() ? 1 : 0;
for my $item (@colour_mapping_table)
@@ -1615,6 +1657,13 @@ sub upgrade_preferences($)
delete($preferences->{query}->{id}->{sort_cronologically});
$preferences->{version} = 8;
}
+ if ($preferences->{version} == 8)
+ {
+ $preferences->{list_search_as_re} = 0;
+ $preferences->{toolbar_settings} = {hide_text => 0,
+ fixed => 0};
+ $preferences->{version} = 9;
+ }
$preferences->{version} = PREFERENCES_FORMAT_VERSION;
@@ -1640,8 +1689,8 @@ sub initialise_preferences()
my($mime_table,
%preferences);
- defined($mime_table = initialise_mime_info_table())
- or die(__("Cannot load system MIME types.\n"));
+ die(__("Cannot load system MIME types.\n"))
+ unless (defined($mime_table = initialise_mime_info_table()));
%preferences =
(version => PREFERENCES_FORMAT_VERSION,
default_mtn_db => "",
@@ -1657,8 +1706,11 @@ sub initialise_preferences()
show_file_details => 1,
show_line_numbers => 0,
static_lists => 0,
+ list_search_as_re => 0,
diffs_application => "kompare '{file1}' '{file2}'",
fixed_font => "monospace 10",
+ toolbar_settings => {hide_text => 0,
+ fixed => 0},
coloured_diffs => 1,
colours => {annotate_prefix_1 => {fg => "AliceBlue",
bg => "CadetBlue"},
============================================================
--- lib/ui/mtn-browse.glade 7a2b7331f893c0f11674a2a72eefd89f3fbb35c5
+++ lib/ui/mtn-browse.glade d75520e241f852fbacf7e422691c6ad2aca57e8e
@@ -4539,7 +4539,7 @@ search patterns
GTK_WIN_POS_CENTER_ON_PARENT
False
970
- 440
+ 495
True
False
mtn-browse.png
@@ -4755,7 +4755,7 @@ inside a Monotone workspace
True
- Select if the workspace's database
+ Select this if the workspace's database
is to be opened instead of the named
database above upon startup
True
@@ -4777,7 +4777,7 @@ database above upon startup
True
- Select if the workspace's branch
+ Select this if the workspace's branch
and revision are to be automatically
loaded into the browser upon startup
True
@@ -5406,10 +5406,9 @@ history stored in ComboBox menus
True
- Select Show suspended revisions
-if you want suspended revisions
-and their related branches to be
-displayed
+ Select this if you want suspended
+revisions and their related branches
+to be displayed
True
Show suspended revisions
True
@@ -5429,9 +5428,9 @@ displayed
True
- Select Detailed file listings if you
-want a file's latest modification
-time and author to be displayed
+ Select this if you want a file's
+latest modification time and
+author to be displayed
alongside the file name
Please note that selecting this
@@ -5458,9 +5457,8 @@ that you are using
True
- Select Show line numbers if you
-want line numbers to be shown
-in file listings by default
+ Select this if you want line numbers
+to be shown in file listings by default
True
Show line numbers
True
@@ -5480,10 +5478,9 @@ in file listings by default
True
- 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
+ Select this 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)
True
@@ -5533,6 +5530,72 @@ with large lists)
+
+ True
+ 0
+ 0.5
+ GTK_SHADOW_ETCHED_IN
+
+
+
+ True
+ 0.5
+ 0.5
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+
+
+
+ 5
+ True
+ Select this if the search terms used when
+searching lists (invoked by typing Ctrl-F)
+are to be treated as regular expressions
+instead of plain text
+ True
+ Search as regular expression
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+
+
+
+
+
+
+
+ True
+ <b>List Options</b>
+ False
+ True
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+ label_item
+
+
+
+
+ 0
+ False
+ True
+
+
+
+
True
0
@@ -5794,6 +5857,104 @@ make sure it is mono-spaced)
+
+ True
+ 0
+ 0.5
+ GTK_SHADOW_ETCHED_IN
+
+
+
+ True
+ 0.5
+ 0.5
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+
+
+
+ 5
+ True
+ False
+ 5
+
+
+
+ True
+ Select if the toolbar buttons are to
+hide their text labels
+ True
+ Hide text
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ Select if the toolbars are to be fixed
+rather than movable
+ True
+ Fixed
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+
+
+ 0
+ False
+ False
+
+
+
+
+
+
+
+
+
+ True
+ <b>Toolbar Settings</b>
+ False
+ True
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+ label_item
+
+
+
+
+ 0
+ False
+ True
+
+
+
+
True
0
============================================================
--- mtn-browse 41c8d05b4e6cfb670a939161f4656bfa06c8ef42
+++ mtn-browse 898df9702acc2eabd720d63386a89c79422b16b5
@@ -48,7 +48,6 @@ BEGIN
use constant MIME_GLOB_FILE => "@INST:GLOBS_FILE@";
use constant PREFIX_DIR => "@INST:PREFIX_DIR@";
}
-use lib LIB_DIR . "/perl";
use locale;
use strict;
use warnings;
@@ -80,6 +79,10 @@ use Time::Local;
use Text::Tabs;
use Time::Local;
+# Add custom module directories to the module load search path.
+
+use lib File::Spec->catfile(LIB_DIR, "perl");
+
# Monotone AutomateStdio module.
use Monotone::AutomateStdio qw(:capabilities :severities);
@@ -109,6 +112,10 @@ use constant MLS_MANIFEST_ENTRY_COLUMN =
use constant MLS_AUTHOR_COLUMN => 3;
use constant MLS_MANIFEST_ENTRY_COLUMN => 4;
+# Constants for various file paths.
+
+use constant UI_DIR => File::Spec->catfile(LIB_DIR, "ui");
+
# The type of window that is going to be managed by this module.
my $window_type = "main_window";
@@ -126,6 +133,7 @@ sub context_help_activate_cb($$);
sub annotate_button_clicked_cb($$);
sub close_toolbutton_clicked_cb($$);
sub context_help_activate_cb($$);
+sub create_browser_widgets();
sub determine_mime_type($$$$);
sub directory_up_button_clicked_cb($$);
sub display_file($$);
@@ -186,10 +194,10 @@ sub view_button_clicked_cb($$);
undef,
app_datadir => File::Spec->catfile(PREFIX_DIR, "share"));
setup_sigchld_handler(\&sigchld_handler);
- $glade_file = File::Spec->catfile(LIB_DIR, "ui", "mtn-browse.glade");
+ $glade_file = File::Spec->catfile(UI_DIR, "mtn-browse.glade");
$tooltips = Gtk2::Tooltips->new();
- $line_image = Gtk2::Gdk::Pixbuf->new_from_file
- (File::Spec->catfile(LIB_DIR, "ui", "line.png"));
+ $line_image = Gtk2::Gdk::Pixbuf->
+ new_from_file(File::Spec->catfile(UI_DIR, "line.png"));
# Set up the default database locked and I/O wait handlers for the Monotone
# class.
@@ -1597,9 +1605,7 @@ sub get_browser_window(;$$$$$)
$browser = {};
$browser->{mtn} = $mtn;
- $browser->{glade} = Gtk2::GladeXML->new($glade_file,
- $window_type,
- APPLICATION_NAME);
+ $browser->{glade} = create_browser_widgets();
# Flag to stop recursive calling of callbacks.
@@ -1901,6 +1907,109 @@ sub get_browser_window(;$$$$$)
#
##############################################################################
#
+# Routine - create_browser_widgets
+#
+# Description - Basically calls Gtk2::GladeXML->new() having first modified
+# the Glade XML GUI specification data so as to take into
+# account the user's toolbar appearance settings
+# (unfortunately these settings have to be in place at
+# creation time).
+#
+# Data - Return Value : The newly create Glade object.
+#
+##############################################################################
+
+
+
+sub create_browser_widgets()
+{
+
+ # If the user's preferences indicate non-default toolbar settings then
+ # pre-edit the XML before passing it to Gtk2::GladeXML->new_from_buffer(),
+ # otherwise proceed as normal.
+
+ if ($user_preferences->{toolbar_settings}->{hide_text}
+ || $user_preferences->{toolbar_settings}->{fixed})
+ {
+
+ my($file,
+ @glade_data,
+ $seen_toolbar);
+ my $fixed = $user_preferences->{toolbar_settings}->{fixed};
+ my $hide_text = $user_preferences->{toolbar_settings}->{hide_text};
+
+ # Open the Glade file and read it into an array.
+
+ die(__x("open failed: {error_message}\n", error_message => $!))
+ unless (defined($file = IO::File->new($glade_file, "r")));
+ @glade_data = $file->getlines();
+ $file->close();
+
+ # Change the XML data depending upon the user's preferences.
+
+ foreach my $line (@glade_data)
+ {
+
+ # Deal with the toolbar's icon only or both setting.
+
+ if ($hide_text && $line =~ m/>GTK_TOOLBAR_BOTH)
+ {
+ $line =~ s/>GTK_TOOLBAR_BOTH>GTK_TOOLBAR_ICONS/)
+ {
+ $seen_toolbar = 1;
+ }
+ }
+
+ # Deal with the toolbar's fixed or floating setting.
+
+ if ($hide_text && $line =~ m/>GTK_TOOLBAR_BOTH)
+ {
+ $line =~ s/>GTK_TOOLBAR_BOTH>GTK_TOOLBAR_ICONScatfile(UI_DIR, $2) . $3
+ if ($line =~ m/^(.*>)([^<>]+\.png)(<.*)$/);
+
+ }
+
+ # Create and return the Glade object.
+
+ return Gtk2::GladeXML->new_from_buffer(join("", @glade_data),
+ $window_type,
+ APPLICATION_NAME);
+
+ }
+ else
+ {
+ return Gtk2::GladeXML->new($glade_file,
+ $window_type,
+ APPLICATION_NAME);
+ }
+
+}
+#
+##############################################################################
+#
# Routine - update_browser_state
#
# Description - Update the display of the specified browser instance
@@ -2996,8 +3105,8 @@ sub setup_sigchld_handler($)
# with Gtk2 as a file activity handler. This is efficient and safer than
# some alternatives.
- pipe($reader, $writer)
- or die(__x("pipe failed: {error_message}", error_message => $!));
+ die(__x("pipe failed: {error_message}", error_message => $!))
+ unless (pipe($reader, $writer));
$SIG{CHLD} = sub { syswrite($writer, "\n", 1); };
Gtk2::Helper->add_watch(fileno($reader), "in",
sub {