#
#
# patch "History.pm"
# from [ea584ff6344617ca29c75363eaa34b15162b946f]
# to [7af1487b3922e47371ec29397677d66079442a9d]
#
# patch "Preferences.pm"
# from [5fe79c71c6e4fa461f0cc974e4fc2b4213898f7c]
# to [5ff509a0bfdf6484ffb9209640b0ad5303f375a4]
#
# patch "Utilities.pm"
# from [9f25e1efc39b0744b8142f40c54599cbc69c8932]
# to [6271d135e4afb4b089282c157b70dfe11fff7a9d]
#
# patch "WindowManager.pm"
# from [698713b429dd8c88f94fd1b033c08d7f492132ea]
# to [c1312855471bec99e61e1ad38becc4cc413a44e0]
#
# patch "mtn-browse"
# from [55cee1941e1f123e780d00481d07f821c3f8c84f]
# to [489b861517f6b92fcd0c5c8ef67f75e1020b3679]
#
# patch "mtn-browse.glade"
# from [63cdeb4f97a048f4f8e34310956b7a81c413e920]
# to [f7bc48479a0ea0c8e98a55c648a89d86d83f4873]
#
============================================================
--- History.pm ea584ff6344617ca29c75363eaa34b15162b946f
+++ History.pm 7af1487b3922e47371ec29397677d66079442a9d
@@ -60,9 +60,9 @@ sub display_revision_change_history($$);
# Private routines.
-sub coloured_revision_change_log_button_clicked_cb($$);
sub compare_button_clicked_cb($$);
sub compare_revisions($$$;$);
+sub comparison_revision_change_log_button_clicked_cb($$);
sub file_comparison_combobox_changed_cb($$);
sub get_file_history_helper($$$);
sub get_history_window();
@@ -70,6 +70,7 @@ sub mtn_diff($$$$;$);
sub get_revision_history_helper($$$);
sub history_list_button_clicked_cb($$);
sub mtn_diff($$$$;$);
+sub save_differences_button_clicked_cb($$);
#
##############################################################################
#
@@ -140,12 +141,14 @@ sub display_revision_change_history($$)
$instance->{appbar}->set_progress_percentage(0);
$instance->{appbar}->set_status(__("Displaying revision history"));
$wm->update_gui();
- $counter = 1;
+ $counter = 0;
$instance->{stop} = 0;
$instance->{history_buffer}->set_text("");
for my $revision_id (@{$instance->{history}})
{
+ ++ $counter;
+
# Print out the revision summary.
$instance->{mtn}->certs(address@hidden, $revision_id);
@@ -225,6 +228,13 @@ sub display_revision_change_history($$)
get_end_iter()));
$button->show_all();
+ if ($counter % 100 == 0)
+ {
+ $instance->{appbar}->set_progress_percentage
+ ($counter / scalar(@{$instance->{history}}));
+ $wm->update_gui();
+ }
+
# Stop if the user wants to.
last if ($instance->{stop});
@@ -242,14 +252,6 @@ sub display_revision_change_history($$)
insert($instance->{history_buffer}->get_end_iter(), "\n");
}
- if ($counter % 100 == 0)
- {
- $instance->{appbar}->set_progress_percentage
- ($counter / scalar(@{$instance->{history}}));
- $wm->update_gui();
- }
- ++ $counter;
-
}
$instance->{stop_button}->set_sensitive(FALSE);
@@ -345,11 +347,13 @@ sub display_file_change_history($$$)
$instance->{appbar}->set_progress_percentage(0);
$instance->{appbar}->set_status(__("Displaying file history"));
$wm->update_gui();
- $counter = 1;
+ $counter = 0;
$instance->{history_buffer}->set_text("");
for my $revision_id (@{$instance->{history}})
{
+ ++ $counter;
+
# Print out the revision summary.
$instance->{mtn}->certs(address@hidden, $revision_id);
@@ -443,7 +447,7 @@ sub display_file_change_history($$$)
}
$instance->{appbar}->set_progress_percentage
- ($counter ++ / scalar(@{$instance->{history}}));
+ ($counter / scalar(@{$instance->{history}}));
$wm->update_gui();
}
@@ -668,19 +672,10 @@ sub compare_revisions($$$;$)
my($mtn, $revision_id_1, $revision_id_2, $file_name) = @_;
- my($char,
- @files,
+ my(@files,
$i,
$instance,
- $is_binary,
- $iter,
- $len,
- $line,
- @lines,
- $max_len,
- $name,
- $padding,
- $rest);
+ $iter);
my $wm = WindowManager->instance();
$instance = get_revision_comparison_window();
@@ -714,159 +709,266 @@ sub compare_revisions($$$;$)
$instance->{appbar}->set_status(__("Calculating differences"));
$wm->update_gui();
- mtn_diff(address@hidden,
+ mtn_diff($instance->{diff_output},
$mtn->get_db_name(),
$revision_id_1,
$revision_id_2,
$file_name);
- # Find the longest line for future padding.
+ # Does the user want pretty printed differences output?
- $max_len = 0;
- foreach my $line (@lines)
+ if ($user_preferences->{coloured_diffs})
{
- ($char, $rest) = unpack("a1a*", $line);
- $rest =~ s/\s+$//o;
- $rest = expand($rest);
- $max_len = $len if (($len = length($rest)) > $max_len);
- $line = $char . $rest;
- }
- # Display the result, highlighting according to the diff output. Remember
- # the first two lines are just empty comment lines.
+ my($char,
+ $is_binary,
+ $len,
+ $line,
+ @lines,
+ $max_len,
+ $name,
+ $padding,
+ $rest);
- $instance->{appbar}->
- set_status(__("Formatting and displaying differences"));
- $wm->update_gui();
- $padding = " " x $max_len;
- $line = substr(" Summary" . $padding, 0, $max_len);
- $instance->{comparison_buffer}->insert_with_tags_by_name
- ($instance->{comparison_buffer}->get_end_iter(),
- $line . "\n",
- "compare-info");
- for ($i = 1; $i <= $#lines; ++ $i)
- {
+ # Yes the user wants pretty printed differences output.
- # Deal with the initial comment lines that summarise the entire set of
- # differences between the revisions.
+ @lines = @{$instance->{diff_output}};
- if ($lines[$i] =~ m/^\#/o)
+ # Find the longest line for future padding.
+
+ $max_len = 0;
+ foreach my $line (@lines)
{
- $line = substr($lines[$i], 1);
- $instance->{comparison_buffer}->insert
- ($instance->{comparison_buffer}->get_end_iter(),
- $line . "\n");
+ ($char, $rest) = unpack("a1a*", $line);
+ $rest =~ s/\s+$//o;
+ $rest = expand($rest);
+ $max_len = $len if (($len = length($rest)) > $max_len);
+ $line = $char . $rest;
}
- # Deal with lines that introduces a new file comparison.
+ # Display the result, highlighting according to the diff output.
+ # Remember the first two lines are just empty comment lines.
- elsif ($lines[$i] =~ m/^==/o)
+ $instance->{appbar}->
+ set_status(__("Formatting and displaying differences"));
+ $wm->update_gui();
+ $padding = " " x $max_len;
+ $line = substr(" Summary" . $padding, 0, $max_len);
+ $instance->{comparison_buffer}->insert_with_tags_by_name
+ ($instance->{comparison_buffer}->get_end_iter(),
+ $line . "\n",
+ "compare-info");
+ for ($i = 1; $i <= $#lines; ++ $i)
{
- # Print separator.
+ # Deal with the initial comment lines that summarise the entire set
+ # of differences between the revisions.
- $instance->{comparison_buffer}->
- insert_pixbuf($instance->{comparison_buffer}->get_end_iter(),
- $line_image);
- $instance->{comparison_buffer}->
- insert($instance->{comparison_buffer}->get_end_iter(),
- "\n");
+ if ($lines[$i] =~ m/^\#/o)
+ {
+ $line = substr($lines[$i], 1);
+ $instance->{comparison_buffer}->insert
+ ($instance->{comparison_buffer}->get_end_iter(),
+ $line . "\n");
+ }
- # Extract the file name, if this doesn't work then it is probably a
- # comment stating that the file is binary.
+ # Deal with lines that introduce a new file comparison.
- ++ $i;
- ($name) = ($lines[$i] =~ m/^--- (.+)\s+[0-9a-f]{40}$/o);
- if (defined($name))
+ elsif ($lines[$i] =~ m/^==/o)
{
- $is_binary = 0;
+
+ # Print separator.
+
+ $instance->{comparison_buffer}->
+ insert_pixbuf($instance->{comparison_buffer}->
+ get_end_iter(),
+ $line_image);
+ $instance->{comparison_buffer}->
+ insert($instance->{comparison_buffer}->get_end_iter(),
+ "\n");
+
+ # Extract the file name, if this doesn't work then it is
+ # probably a comment stating that the file is binary.
+
+ ++ $i;
+ ($name) = ($lines[$i] =~ m/^--- (.+)\s+[0-9a-f]{40}$/o);
+ if (defined($name))
+ {
+ $is_binary = 0;
+ }
+ else
+ {
+ ($name) = ($lines[$i] =~ m/^\# (.+) is binary$/o);
+ $is_binary = 1;
+ }
+
+ # Print out the details for the first file.
+
+ $line = substr(substr($lines[$i], $is_binary ? 1 : 3)
+ . $padding,
+ 0,
+ $max_len);
+ $instance->{comparison_buffer}->insert_with_tags_by_name
+ ($instance->{comparison_buffer}->get_end_iter(),
+ $line . "\n",
+ "compare-file-info-1");
+
+ # Store the file name and the starting line number so that the
+ # user can later jump straight to it using the file combobox.
+
+ $iter = $instance->{comparison_buffer}->get_end_iter();
+ $iter->backward_line();
+ push(@files,
+ {file_name => $name, line_nr => $iter->get_line()});
+
+ # Print out the details for the second file if there is one.
+
+ if (! $is_binary)
+ {
+ ++ $i;
+ $line = substr(substr($lines[$i], 3) . $padding,
+ 0,
+ $max_len);
+ $instance->{comparison_buffer}->insert_with_tags_by_name
+ ($instance->{comparison_buffer}->get_end_iter(),
+ $line . "\n",
+ "compare-file-info-2");
+ }
+
}
- else
- {
- ($name) = ($lines[$i] =~ m/^\# (.+) is binary$/o);
- $is_binary = 1;
- }
- # Print out the details for the first file.
+ # Deal with difference context lines.
- $line = substr(substr($lines[$i], $is_binary ? 1 : 3) . $padding,
- 0,
- $max_len);
- $instance->{comparison_buffer}->insert_with_tags_by_name
- ($instance->{comparison_buffer}->get_end_iter(),
- $line . "\n",
- "compare-file-info-1");
+ elsif ($lines[$i] =~ m/^@@/o)
+ {
+ $line = substr(substr($lines[$i], 2) . $padding, 0, $max_len);
+ $instance->{comparison_buffer}->insert_with_tags_by_name
+ ($instance->{comparison_buffer}->get_end_iter(),
+ $line . "\n",
+ "compare-info");
+ }
- # Store the file name and the starting line number so that the user
- # can later jump straight to it using the file combobox.
+ # Deal with - change lines.
- $iter = $instance->{comparison_buffer}->get_end_iter();
- $iter->backward_line();
- $instance->{comparison_buffer}->create_mark($name, $iter, FALSE);
- push(@files, {file_name => $name, line_nr => $iter->get_line()});
+ elsif ($lines[$i] =~ m/^-/o)
+ {
+ $line = substr(substr($lines[$i], 1) . $padding, 0, $max_len);
+ $instance->{comparison_buffer}->insert_with_tags_by_name
+ ($instance->{comparison_buffer}->get_end_iter(),
+ $line . "\n",
+ "compare-file-1");
+ }
- # Print out the details for the second file if there is one.
+ # Deal with + change lines.
- if (! $is_binary)
+ elsif ($lines[$i] =~ m/^\+/o)
{
- ++ $i;
- $line = substr(substr($lines[$i], 3) . $padding, 0, $max_len);
+ $line = substr(substr($lines[$i], 1) . $padding, 0, $max_len);
$instance->{comparison_buffer}->insert_with_tags_by_name
($instance->{comparison_buffer}->get_end_iter(),
$line . "\n",
- "compare-file-info-2");
+ "compare-file-2");
}
- }
+ # Print out the rest.
- # Deal with difference context lines.
+ else
+ {
+ $line = substr($lines[$i], 1);
+ $instance->{comparison_buffer}->insert
+ ($instance->{comparison_buffer}->get_end_iter(),
+ $line . "\n");
+ }
- elsif ($lines[$i] =~ m/^@@/o)
- {
- $line = substr(substr($lines[$i], 2) . $padding, 0, $max_len);
- $instance->{comparison_buffer}->insert_with_tags_by_name
- ($instance->{comparison_buffer}->get_end_iter(),
- $line . "\n",
- "compare-info");
+ if (($i % 100) == 0)
+ {
+ $instance->{appbar}->set_progress_percentage
+ (($i + 1) / scalar(@lines));
+ $wm->update_gui();
+ }
+
}
- # Deal with - change lines.
+ }
+ else
+ {
- elsif ($lines[$i] =~ m/^-/o)
- {
- $line = substr(substr($lines[$i], 1) . $padding, 0, $max_len);
- $instance->{comparison_buffer}->insert_with_tags_by_name
- ($instance->{comparison_buffer}->get_end_iter(),
- $line . "\n",
- "compare-file-1");
- }
+ my($is_binary,
+ $name);
- # Deal with + change lines.
+ # No the user wants the raw differences output.
- elsif ($lines[$i] =~ m/^\+/o)
+ # Display the result, storing the locations of the files.
+
+ $instance->{appbar}->set_status(__("Displaying differences"));
+ $wm->update_gui();
+ for ($i = 0; $i <= $#{$instance->{diff_output}}; ++ $i)
{
- $line = substr(substr($lines[$i], 1) . $padding, 0, $max_len);
- $instance->{comparison_buffer}->insert_with_tags_by_name
- ($instance->{comparison_buffer}->get_end_iter(),
- $line . "\n",
- "compare-file-2");
- }
- # Print out the rest.
+ # Deal with lines that introduce a new file comparison.
- else
- {
- $line = substr($lines[$i], 1);
- $instance->{comparison_buffer}->insert
- ($instance->{comparison_buffer}->get_end_iter(),
- $line . "\n");
- }
+ if ($instance->{diff_output}->[$i] =~ m/^==/o)
+ {
- if (($i % 100) == 0)
- {
- $instance->{appbar}->set_progress_percentage
- (($i + 1) / scalar(@lines));
- $wm->update_gui();
+ # Extract the file name, if this doesn't work then it is
+ # probably a comment stating that the file is binary.
+
+ ++ $i;
+ ($name) = ($instance->{diff_output}->[$i] =~
+ m/^--- (.+)\s+[0-9a-f]{40}$/o);
+ if (defined($name))
+ {
+ $is_binary = 0;
+ }
+ else
+ {
+ ($name) = ($instance->{diff_output}->[$i] =~
+ m/^\# (.+) is binary$/o);
+ $is_binary = 1;
+ }
+
+ # Print out the details for the first file.
+
+ $instance->{comparison_buffer}->insert
+ ($instance->{comparison_buffer}->get_end_iter(),
+ $instance->{diff_output}->[$i] . "\n");
+
+ # Store the file name and the starting line number so that the
+ # user can later jump straight to it using the file combobox.
+
+ $iter = $instance->{comparison_buffer}->get_end_iter();
+ $iter->backward_line();
+ push(@files,
+ {file_name => $name, line_nr => $iter->get_line()});
+
+ # Print out the details for the second file if there is one.
+
+ if (! $is_binary)
+ {
+ ++ $i;
+ $instance->{comparison_buffer}->insert
+ ($instance->{comparison_buffer}->get_end_iter(),
+ $instance->{diff_output}->[$i] . "\n");
+ }
+
+ }
+
+ # Print out the rest.
+
+ else
+ {
+ $instance->{comparison_buffer}->insert
+ ($instance->{comparison_buffer}->get_end_iter(),
+ $instance->{diff_output}->[$i] . "\n");
+ }
+
+ if (($i % 100) == 0)
+ {
+ $instance->{appbar}->set_progress_percentage
+ (($i + 1) / scalar(@{$instance->{diff_output}}));
+ $wm->update_gui();
+ }
+
}
}
@@ -886,6 +988,11 @@ sub compare_revisions($$$;$)
@files = sort({ $a->{file_name} cmp $b->{file_name} } @files);
$i = 1;
$instance->{file_comparison_combobox}->get_model()->clear();
+ $instance->{file_comparison_combobox}->get_model()->set
+ ($instance->{file_comparison_combobox}->get_model()->append(),
+ CLS_NAME_COLUMN, "Difference Summary",
+ CLS_LINE_NR_COLUMN,
+ $instance->{comparison_buffer}->get_start_iter()->get_line());
foreach my $file (@files)
{
$instance->{file_comparison_combobox}->get_model()->set
@@ -950,10 +1057,41 @@ sub file_comparison_combobox_changed_cb(
#
##############################################################################
#
-# Routine - coloured_revision_change_log_button_clicked_cb
+# Routine - save_differences_button_clicked_cb
#
+# Description - Callback routine called when the user clicks on the save
+# differences button in a revision comparison window.
+#
+# Data - $widget : The widget object that received the signal.
+# $details : A reference to an anonymous hash containing the
+# window instance, revision and action that is
+# associated with this widget.
+#
+##############################################################################
+
+
+
+sub save_differences_button_clicked_cb($$)
+{
+
+ my($widget, $instance) = @_;
+
+ return if ($instance->{in_cb});
+ local $instance->{in_cb} = 1;
+
+ my $data;
+
+ $data = join("\n", @{$instance->{diff_output}}) . "\n";
+ save_as_file($instance->{window}, "unified_diff.out", \$data);
+
+}
+#
+##############################################################################
+#
+# Routine - comparison_revision_change_log_button_clicked_cb
+#
# Description - Callback routine called when the user clicks on either of
-# the two coloured revision change log buttons in a revision
+# the two revision change log buttons in a revision
# comparison window.
#
# Data - $widget : The widget object that received the signal.
@@ -965,7 +1103,7 @@ sub file_comparison_combobox_changed_cb(
-sub coloured_revision_change_log_button_clicked_cb($$)
+sub comparison_revision_change_log_button_clicked_cb($$)
{
my($widget, $instance) = @_;
@@ -974,24 +1112,42 @@ sub coloured_revision_change_log_button_
local $instance->{in_cb} = 1;
my($colour,
- $revision_id);
+ $revision_id,
+ $revision_name);
- # Work out what revision id to use.
+ # Work out what to do.
if ($widget == $instance->{revision_change_log_1_button})
{
$revision_id = $instance->{revision_id_1};
- $colour = "compare-1";
+ if ($user_preferences->{coloured_diffs})
+ {
+ $colour = "compare-1";
+ }
+ else
+ {
+ $revision_name = "- " . $revision_id;
+ }
}
else
{
$revision_id = $instance->{revision_id_2};
- $colour = "compare-2";
+ if ($user_preferences->{coloured_diffs})
+ {
+ $colour = "compare-2";
+ }
+ else
+ {
+ $revision_name = "+ " . $revision_id;
+ }
}
# Display the full revision change log.
- display_change_log($instance->{mtn}, $revision_id, $colour);
+ display_change_log($instance->{mtn},
+ $revision_id,
+ $colour,
+ $revision_name);
}
#
@@ -1264,6 +1420,7 @@ sub get_revision_comparison_window()
$widget->hide();
$instance->{file_comparison_combobox}->get_model()->clear();
$instance->{comparison_buffer}->set_text("");
+ $instance->{diff_output} = [];
$instance->{mtn} = undef;
return TRUE;
},
@@ -1289,20 +1446,32 @@ sub get_revision_comparison_window()
create_format_tags($instance->{comparison_buffer});
$instance->{comparison_textview}->modify_font($mono_font);
- # Setup the revision log button coloured labels.
+ # Setup the revision log button labels.
- $instance->{revision_change_log_1_button_label}->
- set_markup(""
- . __("Revision Change Log")
- . "");
- $instance->{revision_change_log_2_button_label}->
- set_markup(""
- . __("Revision Change Log")
- . "");
+ if ($user_preferences->{coloured_diffs})
+ {
+ $instance->{revision_change_log_1_button_label}->
+ set_markup(""
+ . __("Revision Change Log")
+ . "");
+ $instance->{revision_change_log_2_button_label}->
+ set_markup(""
+ . __("Revision Change Log")
+ . "");
+ }
+ else
+ {
+ $instance->{revision_change_log_1_button_label}->
+ set_text(__("- Revision Change Log"));
+ $instance->{revision_change_log_2_button_label}->
+ set_text(__("+ Revision Change Log"));
+ }
# Register the window for management.
@@ -1327,6 +1496,7 @@ sub get_revision_comparison_window()
# Empty out the contents.
+ $instance->{diff_output} = [];
$instance->{comparison_buffer}->set_text("");
return $instance;
============================================================
--- Preferences.pm 5fe79c71c6e4fa461f0cc974e4fc2b4213898f7c
+++ Preferences.pm 5ff509a0bfdf6484ffb9209640b0ad5303f375a4
@@ -59,7 +59,7 @@ use constant PREFERENCES_FILE_NAME => ".
# Constant for the preferences file's format version.
-use constant PREFERENCES_FORMAT_VERSION => 1;
+use constant PREFERENCES_FORMAT_VERSION => 2;
# Text viewable application mime types.
@@ -145,6 +145,7 @@ sub save_preferences_from_gui($);
sub remove_mime_type_button_clicked_cb($$);
sub save_current_mime_types_settings($);
sub save_preferences_from_gui($);
+sub upgrade_preferences($);
#
##############################################################################
#
@@ -278,9 +279,12 @@ sub load_preferences()
if ($@ ne "");
$prefs_file->close();
die(__x("Preferences file, `{file_name}',\n", file_name => $file_name)
- . __("is at the wrong version, please remove it.\n"))
+ . __("is corrupt, please remove it.\n"))
if (! exists($preferences{version})
- || $preferences{version} != PREFERENCES_FORMAT_VERSION);
+ || $preferences{version} == 0
+ || $preferences{version} > PREFERENCES_FORMAT_VERSION);
+ upgrade_preferences(\%preferences)
+ if ($preferences{version} < PREFERENCES_FORMAT_VERSION);
return \%preferences;
}
else
@@ -977,6 +981,7 @@ sub get_preferences_window($$)
# Appearance pane widgets.
"fonts_fontbutton",
+ "comparison_pretty_print_checkbutton",
"annotation_prefix_1_foreground_colorbutton",
"annotation_prefix_1_background_colorbutton",
"annotation_text_1_foreground_colorbutton",
@@ -1191,6 +1196,8 @@ sub load_preferences_into_gui($)
$instance->{fonts_fontbutton}->
set_font_name($instance->{preferences}->{fixed_font});
+ $instance->{comparison_pretty_print_checkbutton}->
+ set_active($instance->{preferences}->{coloured_diffs} ? TRUE : FALSE);
for my $item (@colour_mapping_table)
{
my $field;
@@ -1309,6 +1316,8 @@ sub save_preferences_from_gui($)
$instance->{preferences}->{fixed_font} =
$instance->{fonts_fontbutton}->get_font_name();
+ $instance->{preferences}->{coloured_diffs} =
+ $instance->{comparison_pretty_print_checkbutton}->get_active() ? 1 : 0;
for my $item (@colour_mapping_table)
{
my $field;
@@ -1338,6 +1347,33 @@ sub save_preferences_from_gui($)
#
##############################################################################
#
+# Routine - upgrade_preferences
+#
+# Description - Upgrades the given preferences record to the latest
+# version.
+#
+# Data - $preferences : A reference to the preferences record that
+# is to be upgraded.
+#
+##############################################################################
+
+
+
+sub upgrade_preferences($)
+{
+
+ my $preferences = $_[0];
+
+ if ($preferences->{version} == 1)
+ {
+ $preferences->{coloured_diffs} = 1;
+ }
+ $preferences->{version} = PREFERENCES_FORMAT_VERSION;
+
+}
+#
+##############################################################################
+#
# Routine - initialise_preferences
#
# Description - Initialises a brand new preferences record, filled with
@@ -1367,6 +1403,7 @@ sub initialise_preferences()
sort_cronologically => 1},
id => {limit => 200,
sort_cronologically => 1}},
+ coloured_diffs => 1,
fixed_font => "monospace 10",
colours => {annotate_prefix_1 => {fg => "AliceBlue",
bg => "CadetBlue"},
============================================================
--- Utilities.pm 9f25e1efc39b0744b8142f40c54599cbc69c8932
+++ Utilities.pm 6271d135e4afb4b089282c157b70dfe11fff7a9d
@@ -59,6 +59,7 @@ sub run_command($@);
sub hex_dump($);
sub open_database($$$);
sub run_command($@);
+sub save_as_file($$$);
sub set_label_value($$);
#
##############################################################################
@@ -436,6 +437,105 @@ sub open_database($$$)
#
##############################################################################
#
+# Routine - save_as_file
+#
+# Description - Allows the user to save the specified data as a file on
+# disk.
+#
+# Data - $parent : The parent window for any dialogs that are to
+# be displayed.
+# $file_name : The suggested name of the file that is to be
+# saved.
+# $data : A reference to a variable containing the raw
+# file data.
+#
+##############################################################################
+
+
+
+sub save_as_file($$$)
+{
+
+ my($parent, $file_name, $data) = @_;
+
+ my($chooser_dialog,
+ $continue,
+ $done);
+
+ $chooser_dialog = Gtk2::FileChooserDialog->new(__("Save As"),
+ $parent,
+ "save",
+ "gtk-cancel" => "cancel",
+ "gtk-save" => "ok");
+ $chooser_dialog->set_current_name
+ ($file_name) if ($file_name ne "");
+
+ do
+ {
+ if ($chooser_dialog->run() eq "ok")
+ {
+
+ my ($fh,
+ $fname);
+
+ $continue = 1;
+ $fname = $chooser_dialog->get_filename();
+
+ # See if the file exists, if so then get a confirmation from the
+ # user.
+
+ if (-e $fname)
+ {
+ my $dialog = Gtk2::MessageDialog->new
+ ($parent,
+ ["modal"],
+ "question",
+ "yes-no",
+ __("File already exists.\nDo you want to replace it?"));
+ $dialog->set_title(__("Confirm"));
+ $continue = 0 if ($dialog->run() ne "yes");
+ $dialog->destroy();
+ }
+
+ if ($continue)
+ {
+
+ # Attempt to save the contents to the file.
+
+ if (! defined($fh = IO::File->new($fname, "w")))
+ {
+ my $dialog = Gtk2::MessageDialog->new
+ ($parent,
+ ["modal"],
+ "warning",
+ "close",
+ __x("{error_message}.", error_message => $!));
+ $dialog->run();
+ $dialog->destroy();
+ }
+ else
+ {
+ $fh->print($$data);
+ $fh->close();
+ $done = 1;
+ }
+
+ }
+
+ }
+ else
+ {
+ $done = 1;
+ }
+ }
+ while (! $done);
+
+ $chooser_dialog->destroy();
+
+}
+#
+##############################################################################
+#
# Routine - get_branch_revisions
#
# Description - Get a list of revision ids or tags for the specified branch
============================================================
--- WindowManager.pm 698713b429dd8c88f94fd1b033c08d7f492132ea
+++ WindowManager.pm c1312855471bec99e61e1ad38becc4cc413a44e0
@@ -1,9 +1,9 @@
##############################################################################
#
# File Name - WindowManager.pm
#
# Description - Class module that provides a class for managing application
-# window, i.e. their recycling, busy cursor management etc.
+# windows, i.e. their recycling, busy cursor management etc.
#
# Author - A.E.Cooper.
#
@@ -61,12 +61,13 @@ use Gtk2;
# A hash of event types that are to be filtered out when updating a busy GUI.
-my %filtered_events = ("button-press" => 1,
- "2button-press" => 1,
+my %filtered_events = ("2button-press" => 1,
"3button-press" => 1,
+ "button-press" => 1,
"button-release" => 1,
"key-press" => 1,
"key-release" => 1,
+ "motion-notify" => 1,
"scroll" => 1);
# The singleton object.
============================================================
--- mtn-browse 55cee1941e1f123e780d00481d07f821c3f8c84f
+++ mtn-browse 489b861517f6b92fcd0c5c8ef67f75e1020b3679
@@ -951,84 +951,15 @@ sub save_as_button_clicked_cb($$)
return if ($browser->{in_cb});
local $browser->{in_cb} = 1;
- my($chooser_dialog,
- $continue,
- $done);
+ my $data;
- $chooser_dialog = Gtk2::FileChooserDialog->new(__("Save As"),
- $browser->{window},
- "save",
- "gtk-cancel" => "cancel",
- "gtk-save" => "ok");
- $chooser_dialog->set_current_name
- ($browser->{file_being_viewed}->{short_name});
+ $browser->{mtn}->get_file(\$data,
+ $browser->{file_being_viewed}->{manifest_entry}->
+ {file_id});
+ save_as_file($browser->{window},
+ $browser->{file_being_viewed}->{short_name},
+ \$data);
- do
- {
- if ($chooser_dialog->run() eq "ok")
- {
-
- my ($data,
- $fh,
- $file_name);
-
- $continue = 1;
- $file_name = $chooser_dialog->get_filename();
-
- # See if the file exists, if so then get a confirmation from the
- # user.
-
- if (-e $file_name)
- {
- my $dialog = Gtk2::MessageDialog->new
- ($browser->{window},
- ["modal"],
- "question",
- "yes-no",
- __("File already exists.\nDo you want to replace it?"));
- $dialog->set_title(__("Confirm"));
- $continue = 0 if ($dialog->run() ne "yes");
- $dialog->destroy();
- }
-
- if ($continue)
- {
-
- # Attempt to save the contents to the file.
-
- if (! defined($fh = IO::File->new($file_name, "w")))
- {
- my $dialog = Gtk2::MessageDialog->new
- ($browser->{window},
- ["modal"],
- "warning",
- "close",
- __x("{error_message}.", error_message => $!));
- $dialog->run();
- $dialog->destroy();
- }
- else
- {
- $browser->{mtn}->get_file(\$data,
- $browser->{file_being_viewed}->
- {manifest_entry}->{file_id});
- $fh->print($data);
- $fh->close();
- $done = 1;
- }
-
- }
-
- }
- else
- {
- $done = 1;
- }
- }
- while (! $done);
-
- $chooser_dialog->destroy();
-
}
#
##############################################################################
============================================================
--- mtn-browse.glade 63cdeb4f97a048f4f8e34310956b7a81c413e920
+++ mtn-browse.glade f7bc48479a0ea0c8e98a55c648a89d86d83f4873
@@ -3964,6 +3964,58 @@ file version that is to be comparedTrue
+
+
+
+ True
+
+
+ 0
+ True
+ True
+
+
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ Save the differences to disk
+ True
+ GTK_RELIEF_NONE
+ True
+
+
+
+
+ True
+ gtk-save-as
+ 4
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+
+ 0
+ False
+ False
+
+
+
+
+ 0
+ False
+ True
+
+
0
@@ -4017,13 +4069,12 @@ file version that is to be compared
True
- View the change log of the revision
-that had the red highlighted text
+ View the change log of the older revision
True
True
GTK_RELIEF_NORMAL
True
-
+
@@ -4046,13 +4097,12 @@ that had the red highlighted text
True
- View the change log of the revision
-that had the green highlighted text
+ View the change log of the younger revision
True
True
GTK_RELIEF_NORMAL
True
-
+
@@ -5171,14 +5221,11 @@ the tags to be order aphabetically0
-
+
5
True
- 1
- 2
False
- 5
- 5
+ 5
@@ -5206,12 +5253,9 @@ make sure it is mono-spaced)
- 0
- 1
- 0
- 1
- fill
- fill
+ 0
+ False
+ True
@@ -5227,12 +5271,9 @@ make sure it is mono-spaced)
True
- 1
- 2
- 0
- 1
- fill
-
+ 0
+ False
+ False
@@ -5267,6 +5308,71 @@ 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
+ Select if comparisons between files
+and revisions are to be highlighted in
+colour instead of plain black text
+ True
+ Coloured comparison listings
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+
+
+
+
+
+
+
+ True
+ <b>File/Revision Comparison</b>
+ False
+ True
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+ label_item
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
True
0