# # # add_file "annotate.png" # content [d846882433f2b6eeed7d25fb085a8a1aee42c059] # # add_file "annotate.svg" # content [d683c9b759975524747a66df7a638c33e7ed6cf5] # # add_file "diffs.png" # content [c666a373e29c6189df0b1b00799e9a2c2c532ca4] # # add_file "diffs.svg" # content [c2ec0e32d111a8a2484251c401df7bc9e2e99c2e] # # add_file "external-diffs.png" # content [b4e167ca3a5e840750243cc24a074c6a1d31d2e7] # # add_file "external-diffs.svg" # content [b3f667edc15ca3cb157245476b321d95ad31c2f4] # # patch "ChangeLog.pm" # from [c0f0ea6467e27326a2467c53d8a3b1aa27d67c21] # to [f9ba345d6a2d3a9fd104b35ce36ef9df8b04d8a2] # # patch "History.pm" # from [7af1487b3922e47371ec29397677d66079442a9d] # to [183536b898fbe722e7cb6785cd59753885dfd3c9] # # patch "Preferences.pm" # from [5ff509a0bfdf6484ffb9209640b0ad5303f375a4] # to [777f8bf59768c400f654b5f4565a7d48dc46791d] # # patch "mtn-browse" # from [489b861517f6b92fcd0c5c8ef67f75e1020b3679] # to [0fbf2034ed0a65482d8700878ae3d6596746a57e] # # patch "mtn-browse.glade" # from [f7bc48479a0ea0c8e98a55c648a89d86d83f4873] # to [330c5bb0527f33a8c4a4d684cb28a976a5056b17] # # set "annotate.png" # attr "mtn:manual_merge" # value "true" # # set "diffs.png" # attr "mtn:manual_merge" # value "true" # # set "external-diffs.png" # attr "mtn:manual_merge" # value "true" # ============================================================ # annotate.png is binary ============================================================ --- annotate.svg d683c9b759975524747a66df7a638c33e7ed6cf5 +++ annotate.svg d683c9b759975524747a66df7a638c33e7ed6cf5 @@ -0,0 +1,416 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ============================================================ # diffs.png is binary ============================================================ --- diffs.svg c2ec0e32d111a8a2484251c401df7bc9e2e99c2e +++ diffs.svg c2ec0e32d111a8a2484251c401df7bc9e2e99c2e @@ -0,0 +1,345 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + ============================================================ # external-diffs.png is binary ============================================================ --- external-diffs.svg b3f667edc15ca3cb157245476b321d95ad31c2f4 +++ external-diffs.svg b3f667edc15ca3cb157245476b321d95ad31c2f4 @@ -0,0 +1,471 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ============================================================ --- ChangeLog.pm c0f0ea6467e27326a2467c53d8a3b1aa27d67c21 +++ ChangeLog.pm f9ba345d6a2d3a9fd104b35ce36ef9df8b04d8a2 @@ -120,7 +120,7 @@ sub display_change_log($$;$$) # on. # $certs_list : A reference to a certs list as returned # by $mtn->certs(). -# $colour : One of "red, "green" or "" depending +# $colour : One of "red", "green" or "" depending # upon the desired colour of the text. # $revision_details : Either a reference to a revision # details list as returned by ============================================================ --- History.pm 7af1487b3922e47371ec29397677d66079442a9d +++ History.pm 183536b898fbe722e7cb6785cd59753885dfd3c9 @@ -48,8 +48,10 @@ use strict; # Constants for the columns within the comparison files ListStore widget. -use constant CLS_NAME_COLUMN => 0; -use constant CLS_LINE_NR_COLUMN => 1; +use constant CLS_FILE_NAME_COLUMN => 0; +use constant CLS_LINE_NR_COLUMN => 1; +use constant CLS_FILE_ID_1_COLUMN => 2; +use constant CLS_FILE_ID_2_COLUMN => 3; # ***** FUNCTIONAL PROTOTYPES ***** @@ -63,6 +65,7 @@ sub comparison_revision_change_log_butto sub compare_button_clicked_cb($$); sub compare_revisions($$$;$); sub comparison_revision_change_log_button_clicked_cb($$); +sub external_diffs_button_clicked_cb($$); sub file_comparison_combobox_changed_cb($$); sub get_file_history_helper($$$); sub get_history_window(); @@ -721,6 +724,8 @@ sub compare_revisions($$$;$) { my($char, + $file_id_1, + $file_id_2, $is_binary, $len, $line, @@ -728,22 +733,38 @@ sub compare_revisions($$$;$) $max_len, $name, $padding, - $rest); + $rest, + $separator); # Yes the user wants pretty printed differences output. @lines = @{$instance->{diff_output}}; - # Find the longest line for future padding. + # Find the longest line for future padding, having expanded tabs + # (except for file details lines as tab is used as a separator (these + # are expanded later)). - $max_len = 0; + $max_len = $separator = 0; foreach my $line (@lines) { - ($char, $rest) = unpack("a1a*", $line); - $rest =~ s/\s+$//o; - $rest = expand($rest); - $max_len = $len if (($len = length($rest)) > $max_len); - $line = $char . $rest; + if ($line =~ m/^==/o) + { + $separator = 1; + } + elsif ($separator) + { + $rest = expand(substr($line, 3)) . " "; + $max_len = $len if (($len = length($rest)) > $max_len); + $separator = 0 if ($line =~ m/^\+\+\+ .+\s+[0-9a-f]{40}$/o); + } + else + { + ($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. @@ -787,24 +808,30 @@ sub compare_revisions($$$;$) 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. + # Attempt to extract the file name and its id, 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); + ($name) = ($lines[$i] =~ m/^--- (.+)\t[0-9a-f]{40}$/o); if (defined($name)) { $is_binary = 0; + ($file_id_1) = + ($lines[$i] =~ m/^--- .+\t([0-9a-f]{40})$/o); + ($file_id_2) = + ($lines[$i + 1] =~ m/^\+\+\+ .+\t([0-9a-f]{40})$/o); } else { + $is_binary = 1; ($name) = ($lines[$i] =~ m/^\# (.+) is binary$/o); - $is_binary = 1; + $file_id_1 = $file_id_2 = ""; } # Print out the details for the first file. - $line = substr(substr($lines[$i], $is_binary ? 1 : 3) + $line = substr(expand(substr($lines[$i], $is_binary ? 1 : 3)) . $padding, 0, $max_len); @@ -818,15 +845,17 @@ sub compare_revisions($$$;$) $iter = $instance->{comparison_buffer}->get_end_iter(); $iter->backward_line(); - push(@files, - {file_name => $name, line_nr => $iter->get_line()}); + push(@files, {file_name => $name, + line_nr => $iter->get_line(), + file_id_1 => $file_id_1, + file_id_2 => $file_id_2}); # Print out the details for the second file if there is one. if (! $is_binary) { ++ $i; - $line = substr(substr($lines[$i], 3) . $padding, + $line = substr(expand(substr($lines[$i], 3)) . $padding, 0, $max_len); $instance->{comparison_buffer}->insert_with_tags_by_name @@ -893,7 +922,9 @@ sub compare_revisions($$$;$) else { - my($is_binary, + my($file_id_1, + $file_id_2, + $is_binary, $name); # No the user wants the raw differences output. @@ -915,16 +946,21 @@ sub compare_revisions($$$;$) ++ $i; ($name) = ($instance->{diff_output}->[$i] =~ - m/^--- (.+)\s+[0-9a-f]{40}$/o); + m/^--- (.+)\t[0-9a-f]{40}$/o); if (defined($name)) { $is_binary = 0; + ($file_id_1) = ($instance->{diff_output}->[$i] =~ + m/^--- .+\t([0-9a-f]{40})$/o); + ($file_id_2) = ($instance->{diff_output}->[$i + 1] + =~ m/^\+\+\+ .+\t([0-9a-f]{40})$/o); } else { ($name) = ($instance->{diff_output}->[$i] =~ m/^\# (.+) is binary$/o); $is_binary = 1; + $file_id_1 = $file_id_2 = ""; } # Print out the details for the first file. @@ -938,8 +974,10 @@ sub compare_revisions($$$;$) $iter = $instance->{comparison_buffer}->get_end_iter(); $iter->backward_line(); - push(@files, - {file_name => $name, line_nr => $iter->get_line()}); + push(@files, {file_name => $name, + line_nr => $iter->get_line(), + file_id_1 => $file_id_1, + file_id_2 => $file_id_2}); # Print out the details for the second file if there is one. @@ -990,18 +1028,31 @@ sub compare_revisions($$$;$) $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_FILE_NAME_COLUMN, __("Summary"), CLS_LINE_NR_COLUMN, - $instance->{comparison_buffer}->get_start_iter()->get_line()); + $instance->{comparison_buffer}->get_start_iter()->get_line(), + CLS_FILE_ID_1_COLUMN, "", + CLS_FILE_ID_2_COLUMN, ""); foreach my $file (@files) { $instance->{file_comparison_combobox}->get_model()->set ($instance->{file_comparison_combobox}->get_model()->append(), - CLS_NAME_COLUMN, $file->{file_name}, - CLS_LINE_NR_COLUMN, $file->{line_nr}); + CLS_FILE_NAME_COLUMN, $file->{file_name}, + CLS_LINE_NR_COLUMN, $file->{line_nr}, + CLS_FILE_ID_1_COLUMN, $file->{file_id_1}, + CLS_FILE_ID_2_COLUMN, $file->{file_id_2}); $instance->{appbar}->set_progress_percentage($i ++ / scalar(@files)); $wm->update_gui(); } + if (defined($file_name)) + { + $instance->{file_comparison_combobox}->set_active(1); + $instance->{external_diffs_button}->set_sensitive(TRUE); + } + else + { + $instance->{file_comparison_combobox}->set_active(0); + } $instance->{appbar}->set_progress_percentage(0); $instance->{appbar}->set_status(""); $wm->update_gui(); @@ -1043,29 +1094,150 @@ sub file_comparison_combobox_changed_cb( local $instance->{in_cb} = 1; my($iter, + $line_iter, $line_nr); # Get the line number related to the selected file and then jump to it. - $line_nr = $instance->{file_comparison_combobox}->get_model()->get - ($instance->{file_comparison_combobox}->get_active_iter(), - CLS_LINE_NR_COLUMN); - $iter = $instance->{comparison_buffer}->get_iter_at_line($line_nr); - $instance->{comparison_textview}->scroll_to_iter($iter, 0, TRUE, 0, 0); + $iter = $instance->{file_comparison_combobox}->get_active_iter(); + $line_nr = $instance->{file_comparison_combobox}->get_model()-> + get($iter, CLS_LINE_NR_COLUMN); + $line_iter = $instance->{comparison_buffer}->get_iter_at_line($line_nr); + $instance->{comparison_textview}-> + scroll_to_iter($line_iter, 0, TRUE, 0, 0); + # Only enable the external differences button if an actual file is + # selected. + + if ($line_nr > 0) + { + my $file_id_1 = $instance->{file_comparison_combobox}->get_model()-> + get($iter, CLS_FILE_ID_1_COLUMN); + my $file_id_2 = $instance->{file_comparison_combobox}->get_model()-> + get($iter, CLS_FILE_ID_2_COLUMN); + if ($file_id_1 ne "" && $file_id_1 ne $file_id_2) + { + $instance->{external_diffs_button}->set_sensitive(TRUE); + } + else + { + $instance->{external_diffs_button}->set_sensitive(FALSE); + } + } + else + { + $instance->{external_diffs_button}->set_sensitive(FALSE); + } + } # ############################################################################## # +# Routine - external_diffs_button_clicked_cb +# +# Description - Callback routine called when the user clicks on the +# external differences button in a revision comparison +# window. +# +# Data - $widget : The widget object that received the signal. +# $instance : The window instance that is associated with +# this widget. +# +############################################################################## + + + +sub external_diffs_button_clicked_cb($$) +{ + + my($widget, $instance) = @_; + + return if ($instance->{in_cb}); + local $instance->{in_cb} = 1; + + my($cmd, + $data, + $file_id_1, + $file_id_2, + $file_name, + $iter, + $new_fh, + $new_file, + $old_fh, + $old_file); + + # Get the details associated with the currently selected file. + + $iter = $instance->{file_comparison_combobox}->get_active_iter(); + $file_name = basename($instance->{file_comparison_combobox}->get_model()-> + get($iter, CLS_FILE_NAME_COLUMN)); + $file_id_1 = $instance->{file_comparison_combobox}->get_model()-> + get($iter, CLS_FILE_ID_1_COLUMN); + $file_id_2 = $instance->{file_comparison_combobox}->get_model()-> + get($iter, CLS_FILE_ID_2_COLUMN); + + # Generate temporary disk file names. + + if (! defined($old_file = generate_tmp_path("OLDER_" . $file_name)) + || ! defined($new_file = generate_tmp_path("NEWER_" . $file_name))) + { + my $dialog = Gtk2::MessageDialog->new + ($instance->{window}, + ["modal"], + "warning", + __x("Cannot generate temporary file name:\n{error_message}.", + error_message => $!)); + $dialog->run(); + $dialog->destroy(); + return; + } + + # Attempt to save the contents to the files. + + if (! defined($old_fh = IO::File->new($old_file, "w")) + || ! defined($new_fh = IO::File->new($new_file, "w"))) + { + my $dialog = Gtk2::MessageDialog->new + ($instance->{window}, + ["modal"], + "warning", + "close", + __x("{error_message}.", error_message => $!)); + $dialog->run(); + $dialog->destroy(); + return; + } + $instance->{mtn}->get_file(\$data, $file_id_1); + $old_fh->print($data); + $instance->{mtn}->get_file(\$data, $file_id_2); + $new_fh->print($data); + $old_fh->close(); + $new_fh->close(); + $old_fh = $new_fh = undef; + + # Use the specified differences application, replacing `{file1}' and + # `{file2}' with the real file names. + + $cmd = $user_preferences->{diffs_application}; + $cmd =~ s/\{file1\}/$old_file/g; + $cmd =~ s/\{file2\}/$new_file/g; + + # Launch it. + + system($cmd . " &"); + +} +# +############################################################################## +# # 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. +# Data - $widget : The widget object that received the signal. +# $instance : The window instance that is associated with +# this widget. # ############################################################################## @@ -1400,6 +1572,7 @@ sub get_revision_comparison_window() foreach my $widget ("appbar", "comparison_label", "file_comparison_combobox", + "external_diffs_button", "comparison_textview", "comparison_scrolledwindow", "revision_change_log_1_button", @@ -1429,15 +1602,20 @@ sub get_revision_comparison_window() # Setup the file combobox. $instance->{file_comparison_combobox}-> - set_model(Gtk2::ListStore->new("Glib::String", "Glib::Int")); + set_model(Gtk2::ListStore->new("Glib::String", + "Glib::Int", + "Glib::String", + "Glib::String")); $renderer = Gtk2::CellRendererText->new(); $instance->{file_comparison_combobox}->pack_start($renderer, TRUE); $instance->{file_comparison_combobox}->add_attribute($renderer, "text" => 0); $instance->{file_comparison_combobox}->get_model()->set ($instance->{file_comparison_combobox}->get_model()->append(), - CLS_NAME_COLUMN, " ", - CLS_LINE_NR_COLUMN, 0); + CLS_FILE_NAME_COLUMN, " ", + CLS_LINE_NR_COLUMN, 0, + CLS_FILE_ID_1_COLUMN, "", + CLS_FILE_ID_2_COLUMN, ""); # Setup the revision comparison viewer. @@ -1489,6 +1667,7 @@ sub get_revision_comparison_window() local $instance->{in_cb} = 1; ($width, $height) = $instance->{window}->get_default_size(); $instance->{window}->resize($width, $height); + $instance->{external_diffs_button}->set_sensitive(FALSE); $instance->{file_comparison_combobox}->get_model()->clear(); $instance->{appbar}->set_progress_percentage(0); $instance->{appbar}->clear_stack(); ============================================================ --- Preferences.pm 5ff509a0bfdf6484ffb9209640b0ad5303f375a4 +++ Preferences.pm 777f8bf59768c400f654b5f4565a7d48dc46791d @@ -146,6 +146,7 @@ sub upgrade_preferences($); sub save_current_mime_types_settings($); sub save_preferences_from_gui($); sub upgrade_preferences($); +sub validate_preferences($); # ############################################################################## # @@ -169,7 +170,8 @@ sub preferences($) my $browser = $_[0]; my($instance, - $preferences); + $preferences, + $valid); my $wm = WindowManager->instance(); # Load in the user's preferences. @@ -196,22 +198,43 @@ sub preferences($) $instance = get_preferences_window($browser->{window}, $preferences); - # Handle all events until the dialog is dismissed. + # Allow the user to change their preferences, validating anything that is + # saved. $wm->make_busy($instance, 1, 1); - $instance->{done} = 0; - while (! $instance->{done}) + do { - Gtk2->main_iteration(); + + # Handle all events until the dialog is dismissed. + + $instance->{done} = 0; + $instance->{preferences_to_be_saved} = 0; + while (! $instance->{done}) + { + Gtk2->main_iteration(); + } + + # Validate any changes. + + if ($instance->{preferences_to_be_saved}) + { + save_preferences_from_gui($instance); + $valid = validate_preferences($instance); + } + else + { + $valid = 1; + } + } + while (! $valid); $wm->make_busy($instance, 0); $instance->{window}->hide(); # Deal with the result. - if ($instance->{preferences_changed}) + if ($instance->{preferences_to_be_saved}) { - save_preferences_from_gui($instance); eval { save_preferences($preferences); @@ -237,7 +260,7 @@ sub preferences($) $instance->{file_name_patterns_liststore}->clear(); $instance->{preferences} = undef; - return $instance->{preferences_changed}; + return $instance->{preferences_to_be_saved}; } # @@ -410,11 +433,12 @@ sub defaults_button_clicked_cb($$) $page_nr = $instance->{notebook}->get_current_page(); if ($page_nr == 0) { - @fields = ("default_mtn_db", "workspace", "query"); + @fields = + ("default_mtn_db", "workspace", "query", "diffs_application"); } elsif ($page_nr == 1) { - @fields = ("fixed_font", "colours"); + @fields = ("fixed_font", "coloured_diffs", "colours"); } else { @@ -977,6 +1001,7 @@ sub get_preferences_window($$) "id_lists_limit_spinbutton", "id_lists_sort_cronologically_radiobutton", "id_lists_sort_by_id_radiobutton", + "external_diffs_app_entry", # Appearance pane widgets. @@ -1031,7 +1056,7 @@ sub get_preferences_window($$) $instance); $instance->{glade}->get_widget("ok_button")->signal_connect ("clicked", - sub { $_[1]->{done} = $_[1]->{preferences_changed} = 1 + sub { $_[1]->{done} = $_[1]->{preferences_to_be_saved} = 1 unless ($_[1]->{in_cb}); }, $instance); @@ -1132,7 +1157,7 @@ sub get_preferences_window($$) } $instance->{done} = 0; - $instance->{preferences_changed} = undef; + $instance->{preferences_to_be_saved} = 0; $instance->{selected_file_name_pattern} = undef; $instance->{selected_mime_types_entry} = undef; $instance->{selected_mime_types_path} = undef; @@ -1191,6 +1216,8 @@ sub load_preferences_into_gui($) { $instance->{id_lists_sort_by_id_radiobutton}->set_active(TRUE); } + $instance->{external_diffs_app_entry}-> + set_text($instance->{preferences}->{diffs_application}); # Do the appearance page. @@ -1277,6 +1304,40 @@ sub load_mime_types_page($) # ############################################################################## # +# Routine - load_file_name_patterns_treeview +# +# Description - Load up the file name patterns treeview with the currently +# selected name patterns. +# +# Data - $instance : The associated window instance. +# +############################################################################## + + + +sub load_file_name_patterns_treeview($) +{ + + my $instance = $_[0]; + + # Load up the file name patterns list. + + $instance->{file_name_patterns_liststore}->clear(); + foreach my $pattern (@{$instance->{selected_mime_types_entry}-> + {file_name_patterns}}) + { + $instance->{file_name_patterns_liststore}-> + set($instance->{file_name_patterns_liststore}->append(), + 0, + $pattern); + } + $instance->{file_name_patterns_treeview}->scroll_to_point(0, 0) + if ($instance->{file_name_patterns_treeview}->realized()); + +} +# +############################################################################## +# # Routine - save_preferences_from_gui # # Description - Saves the user's preferences from the preferences dialog @@ -1293,7 +1354,7 @@ sub save_preferences_from_gui($) my $instance = $_[0]; - # Do the general pane. + # Do the general page. $instance->{preferences}->{default_mtn_db} = $instance->{database_entry}->get_text(); @@ -1311,8 +1372,10 @@ sub save_preferences_from_gui($) $instance->{preferences}->{query}->{id}->{sort_cronologically} = $instance->{id_lists_sort_cronologically_radiobutton}->get_active() ? 1 : 0; + $instance->{preferences}->{diffs_application} = + $instance->{external_diffs_app_entry}->get_text(); - # Do the appearance pane. + # Do the appearance page. $instance->{preferences}->{fixed_font} = $instance->{fonts_fontbutton}->get_font_name(); @@ -1337,7 +1400,7 @@ sub save_preferences_from_gui($) colour_to_string($instance->{$item->{widget}}->get_color()); } - # Do the MIME types pane (most of it has possibly been saved already). + # Do the MIME types page (most of it has possibly been saved already). save_current_mime_types_settings($instance); @@ -1347,6 +1410,81 @@ sub save_preferences_from_gui($) # ############################################################################## # +# Routine - save_current_mime_types_settings +# +# Description - Save the settings for the currently selected MIME typ entry +# back to the preferences record. +# +# Data - $instance : The associated window instance. +# +############################################################################## + + + +sub save_current_mime_types_settings($) +{ + + my $instance = $_[0]; + + $instance->{selected_mime_types_entry}->{display_internally} = + $instance->{display_internally_checkbutton}->get_active() ? 1 : 0; + $instance->{selected_mime_types_entry}->{syntax_highlight} = + $instance->{syntax_highlight_checkbutton}->get_active() ? 1 : 0; + $instance->{selected_mime_types_entry}->{helper_application} = + $instance->{helper_application_entry}->get_text(); + +} +# +############################################################################## +# +# Routine - validate_preferences +# +# Description - Validate the current user's preferences that are associated +# witn the specified window instance. +# +# Data - $instance : The associated window instance. +# Return Value : True if the preferences are valid, otherwise +# false if they are not (the user will have +# already been told). +# +############################################################################## + + + +sub validate_preferences($) +{ + + my $instance = $_[0]; + + my $value; + + # Validate the external differnces application setting. + + $value = $instance->{external_diffs_app_entry}->get_text(); + if ($value ne "") + { + if ($value !~ m/^[^\{]*\{file1\}[^\{]*\{file2\}[^\{]*$/ + && $value !~ m/^[^\{]*\{file2\}[^\{]*\{file1\}[^\{]*$/) + { + my $dialog = Gtk2::MessageDialog->new + ($instance->{window}, + ["modal"], + "warning", + "close", + __("The external file comparison application field is\n") + . __("invalid, please correct before attempting to resave.")); + $dialog->run(); + $dialog->destroy(); + return; + } + } + + return 1; + +} +# +############################################################################## +# # Routine - upgrade_preferences # # Description - Upgrades the given preferences record to the latest @@ -1367,6 +1505,7 @@ sub upgrade_preferences($) if ($preferences->{version} == 1) { $preferences->{coloured_diffs} = 1; + $preferences->{diffs_application} = "kompare '{file1}' '{file2}'"; } $preferences->{version} = PREFERENCES_FORMAT_VERSION; @@ -1395,31 +1534,32 @@ sub initialise_preferences() defined($mime_table = initialise_mime_info_table()) or die(__("Cannot load system MIME types.\n")); %preferences = - (version => PREFERENCES_FORMAT_VERSION, - default_mtn_db => "", - workspace => {takes_precedence => 1, - auto_select => 1}, - query => {tagged => {limit => 200, - sort_cronologically => 1}, - id => {limit => 200, - sort_cronologically => 1}}, - coloured_diffs => 1, - fixed_font => "monospace 10", - colours => {annotate_prefix_1 => {fg => "AliceBlue", - bg => "CadetBlue"}, - annotate_text_1 => {fg => "MidnightBlue", - bg => "PaleTurquoise"}, - annotate_prefix_2 => {fg => "AliceBlue", - bg => "SteelBlue"}, - annotate_text_2 => {fg => "MidnightBlue", - bg => "SkyBlue"}, - cmp_revision_1 => {fg => "DarkRed", - bg => "MistyRose1", - hl => "IndianRed1"}, - cmp_revision_2 => {fg => "DarkGreen", - bg => "DarkSeaGreen1", - hl => "SpringGreen1"}}, - mime_table => $mime_table); + (version => PREFERENCES_FORMAT_VERSION, + default_mtn_db => "", + workspace => {takes_precedence => 1, + auto_select => 1}, + query => {tagged => {limit => 200, + sort_cronologically => 1}, + id => {limit => 200, + sort_cronologically => 1}}, + diffs_application => "kompare '{file1}' '{file2}'", + coloured_diffs => 1, + fixed_font => "monospace 10", + colours => {annotate_prefix_1 => {fg => "AliceBlue", + bg => "CadetBlue"}, + annotate_text_1 => {fg => "MidnightBlue", + bg => "PaleTurquoise"}, + annotate_prefix_2 => {fg => "AliceBlue", + bg => "SteelBlue"}, + annotate_text_2 => {fg => "MidnightBlue", + bg => "SkyBlue"}, + cmp_revision_1 => {fg => "DarkRed", + bg => "MistyRose1", + hl => "IndianRed1"}, + cmp_revision_2 => {fg => "DarkGreen", + bg => "DarkSeaGreen1", + hl => "SpringGreen1"}}, + mime_table => $mime_table); return \%preferences; @@ -1522,67 +1662,6 @@ sub initialise_mime_info_table() # ############################################################################## # -# Routine - load_file_name_patterns_treeview -# -# Description - Load up the file name patterns treeview with the currently -# selected name patterns. -# -# Data - $instance : The associated window instance. -# -############################################################################## - - - -sub load_file_name_patterns_treeview($) -{ - - my $instance = $_[0]; - - # Load up the file name patterns list. - - $instance->{file_name_patterns_liststore}->clear(); - foreach my $pattern (@{$instance->{selected_mime_types_entry}-> - {file_name_patterns}}) - { - $instance->{file_name_patterns_liststore}-> - set($instance->{file_name_patterns_liststore}->append(), - 0, - $pattern); - } - $instance->{file_name_patterns_treeview}->scroll_to_point(0, 0) - if ($instance->{file_name_patterns_treeview}->realized()); - -} -# -############################################################################## -# -# Routine - save_current_mime_types_settings -# -# Description - Save the settings for the currently selected MIME typ entry -# back to the preferences record. -# -# Data - $instance : The associated window instance. -# -############################################################################## - - - -sub save_current_mime_types_settings($) -{ - - my $instance = $_[0]; - - $instance->{selected_mime_types_entry}->{display_internally} = - $instance->{display_internally_checkbutton}->get_active() ? 1 : 0; - $instance->{selected_mime_types_entry}->{syntax_highlight} = - $instance->{syntax_highlight_checkbutton}->get_active() ? 1 : 0; - $instance->{selected_mime_types_entry}->{helper_application} = - $instance->{helper_application_entry}->get_text(); - -} -# -############################################################################## -# # Routine - file_glob_to_regexp # # Description - Converts the specified string containing a file name style ============================================================ --- mtn-browse 489b861517f6b92fcd0c5c8ef67f75e1020b3679 +++ mtn-browse 0fbf2034ed0a65482d8700878ae3d6596746a57e @@ -58,7 +58,7 @@ use File::Spec; use Data::Dumper; use File::Basename; use File::Spec; -use File::Temp; +use File::Temp qw(tempdir); use Glib qw(FALSE TRUE); use Gnome2; use Gnome2::VFS -init; @@ -201,9 +201,7 @@ sub view_button_clicked_cb($$); eval { - $tmp_dir = File::Temp->tempdir("mtn-browse_XXXXXXXXXX", - TMPDIR => 1, - CLEANUP => 1); + $tmp_dir = tempdir("mtn-browse_XXXXXXXXXX", TMPDIR => 1, CLEANUP => 1); }; if ($@ ne "") { @@ -397,7 +395,7 @@ sub about_activate_cb($$) if (! defined($large_logo)); Gnome2::About->new ("mtn-browse", - "0.42b", + "0.43b", __("Copyright \xa9 2007-2009 Anthony Cooper"), __("A graphical front-end browser for Monotone VCS databases"), ["Anthony Cooper "], @@ -994,6 +992,8 @@ sub view_button_clicked_cb($$) $mime_obj, $mime_type); + # Generate temporary disk file name. + if (! defined($file_name = generate_tmp_path($browser->{file_being_viewed}-> {short_name}))) ============================================================ --- mtn-browse.glade f7bc48479a0ea0c8e98a55c648a89d86d83f4873 +++ mtn-browse.glade 330c5bb0527f33a8c4a4d684cb28a976a5056b17 @@ -1426,10 +1426,9 @@ into a viewer - + True - gnome-stock-text-bulleted-list - 4 + annotate.png 0.5 0.5 0 @@ -3581,7 +3580,7 @@ Tag True 1 1 - 0 0 375 10 337.5 375 + 0 0 376 10 338.4 376 0 0 17 10 15.3 17 @@ -3643,7 +3642,7 @@ Tag True 1 1 - 0 0 375 10 337.5 375 + 0 0 376 10 338.4 376 0 0 17 10 15.3 17 @@ -3786,10 +3785,9 @@ file version that is to be compared - + True - gnome-stock-multiple-file - 4 + diffs.png 0.5 0.5 0 @@ -3983,6 +3981,35 @@ file version that is to be compared0 + + True + False + Display the differences for the currently +selected file in an external viewer + True + GTK_RELIEF_NONE + True + + + + + True + external-diffs.png + 0.5 + 0.5 + 0 + 0 + + + + + 0 + False + False + + + + True Save the differences to disk @@ -4490,7 +4517,7 @@ of the search GTK_WIN_POS_CENTER_ON_PARENT True 970 - 400 + 440 True False mtn-browse.png @@ -4608,27 +4635,6 @@ of the search 5 - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 0 - 1 - - - - - True Look for a Monotone @@ -4777,6 +4783,28 @@ loaded into the browser upon startupfill + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + fill + + + @@ -5168,6 +5196,129 @@ the tags to be order aphabeticallyTrue + + + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 0 + 0 + + + + 5 + True + False + 5 + + + + True + Enter a command for displaying +the differences between two text +files + +1) If this field is blank then the +external file comparison button +on a revision/file comparison +window will be disabled + +2) The command to run the +application must take the two +mandatory tokens {file1} and +{file2}, these are replaced with +the files' full path names + +3) The file referred to by the token +{file1} will be the older version than +that referred to by {file2} + True + False + + + + True + Application: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + + + 0 + False + True + + + + + + 300 + True + True + True + True + 0 + + True + * + False + + + 0 + False + True + + + + + + + + + + True + <b>External File Comparison Application</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 0 + False + True + + False @@ -5367,7 +5518,7 @@ colour instead of plain black text 0 - True + False True