# # # delete "locale/help/C/figures/non-unique-tag-dialog.png" # # add_file "lib/perl/MultipleRevisions.pm" # content [9dc8cc9e3f7d7c0f4262eaddeaf4913c0b425bf7] # # add_file "locale/help/C/figures/multiple-revisions-dialog.png" # content [d6ce0c3c202e718c1add9157972cd6fb321a4fc0] # # patch "lib/perl/AdvancedFind.pm" # from [856fdd55fe5c47125d357c605a455b477ce02ce2] # to [2710ba47e3cf4d8cb6d3acb421cb518491056f49] # # patch "lib/perl/FindFiles.pm" # from [adc0848bcb3a9f34e12cc65e377fdbf44b58de36] # to [1f7f9f51e6f4c16a4f70e590a7d8907644cc6617] # # patch "lib/perl/FindText.pm" # from [15db71ad8a95650872646ef06553497cdc027908] # to [c688764a2a999f9d1ef8ec3b306f6df990f5afc8] # # patch "lib/perl/Preferences.pm" # from [bc9a565ac54237e185670c70618d24e2507a91d5] # to [81f61fc079d69e125708ac6690f1b18592911637] # # patch "lib/perl/WindowManager.pm" # from [6d30c1472f2e9dfbc86025c9f0601e3626cf9562] # to [a79b7d52387179c2282086b7d3c5a4d031128c4b] # # patch "lib/ui/mtn-browse.glade" # from [a6bd56cb5f32c93dcc636bc6aa1bbf9cd86cd8bb] # to [f6f29a1bebcf6a7b88fe72f9de8163a7719aed80] # # patch "locale/help/C/mtn-browse.xml" # from [18796ea920397941ebbd699f8a44d209d6224e5f] # to [9a72965e410b4f7c40a36ccbf853ab4e582e6da4] # # patch "mtn-browse" # from [9e81bf545d4bf3279fa9981d051ca173845379a9] # to [e9beceba6af5e7e6dcfb9142bbf79456597d2a44] # # set "locale/help/C/figures/multiple-revisions-dialog.png" # attr "mtn:manual_merge" # value "true" # ============================================================ --- lib/perl/MultipleRevisions.pm 9dc8cc9e3f7d7c0f4262eaddeaf4913c0b425bf7 +++ lib/perl/MultipleRevisions.pm 9dc8cc9e3f7d7c0f4262eaddeaf4913c0b425bf7 @@ -0,0 +1,219 @@ +############################################################################## +# +# File Name - MultipleRevisions.pm +# +# Description - The multple revisions module for the mtn-browse +# application. This module contains all the routines for +# implementing the multiple revisions dialog window. +# +# Author - A.E.Cooper. +# +# Legal Stuff - Copyright (c) 2007 Anthony Edward Cooper +# . +# +# This program is free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; +# either version 3 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public +# License along with this software; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307 USA. +# +############################################################################## +# +############################################################################## +# +# Global Data For This Module +# +############################################################################## + + + +# ***** DIRECTIVES ***** + +require 5.008005; + +use locale; +use strict; +use warnings; + +# ***** FUNCTIONAL PROTOTYPES ***** + +# Public routines. + +sub multiple_revisions_selection($$$@); + +# Private routines. + +sub get_multiple_revisions_window($$@); +# +############################################################################## +# +# Routine - multiple_revisions_selection +# +# Description - Displays the multiple revisions dialog window and allows +# the user to select a specific revision. +# +# Data - $parent : The parent window widget for the +# multiple revisions dialog window. +# $message : The message that is to be displayed. +# $selected_revision : A reference to a buffer that is to be +# set to either the selected revision +# id, if the user clicks the ok button, +# or undef if the user gives any other +# response. +# @revision_ids : A list of revision ids that the user +# is to select from. +# Return Value : True if a revision has been selected, +# otherwise false. +# +############################################################################## + + + +sub multiple_revisions_selection($$$@) +{ + + my($parent, $message, $selected_revision, @revision_ids) = @_; + + my($instance, + $response); + + $instance = get_multiple_revisions_window($parent, + $message, + @revision_ids); + WindowManager->instance()->allow_input + (sub { $response = $instance->{window}->run(); }); + $instance->{window}->hide(); + + # Deal with the result, remember that the advanced find button is not a + # standard dialog button and so gets the default response of 0. + + $response = "advanced-find" if ($response eq "0"); + if ($response eq "ok") + { + my $iter; + $iter = $instance->{revisions_combobox}->get_active_iter(); + $$selected_revision = + $instance->{revisions_combobox}->get_model()->get($iter, 0); + } + else + { + $$selected_revision = undef; + } + + return $response; + +} +# +############################################################################## +# +# Routine - get_multiple_revisions_window +# +# Description - Creates or prepares an existing multiple revisions dialog +# window for use. +# +# Data - $parent : The parent window widget for the multiple +# revisions dialog window. +# $message : The message that is to be displayed. +# @revision_ids : A list of revision ids that the user is to +# select from. +# Return Value : A reference to the newly created or unused +# multiple revisions instance record. +# +############################################################################## + + + +sub get_multiple_revisions_window($$@) +{ + + my($parent, $message, @revision_ids) = @_; + + my($instance, + $new); + my $window_type = "multiple_revisions_window"; + my $wm = WindowManager->instance(); + + # Create a new multiple revisions window if an unused one wasn't found, + # otherwise reuse an existing unused one. + + if (! defined($instance = $wm->find_unused($window_type))) + { + + my $renderer; + + $new = 1; + $instance = {}; + $instance->{glade} = Gtk2::GladeXML->new($glade_file, + $window_type, + APPLICATION_NAME); + + # Flag to stop recursive calling of callbacks. + + $instance->{in_cb} = 0; + local $instance->{in_cb} = 1; + + # Connect Glade registered signal handlers. + + glade_signal_autoconnect($instance->{glade}, $instance); + + # Get the widgets that we are interested in. + + $instance->{window} = $instance->{glade}->get_widget($window_type); + foreach my $widget ("message_label", "revisions_combobox") + { + $instance->{$widget} = $instance->{glade}->get_widget($widget); + } + + # Setup the revisions combobox. + + $instance->{revisions_combobox}-> + set_model(Gtk2::ListStore->new("Glib::String")); + $renderer = Gtk2::CellRendererText->new(); + $instance->{revisions_combobox}->pack_start($renderer, TRUE); + $instance->{revisions_combobox}->add_attribute($renderer, "text" => 0); + + } + else + { + $instance->{in_cb} = 0; + } + + local $instance->{in_cb} = 1; + + # Update the message text and the revisions combobox with the supplied + # information. + + $instance->{message_label}->set_markup($message); + $instance->{revisions_combobox}->get_model()->clear(); + foreach my $revision_id (@revision_ids) + { + $instance->{revisions_combobox}->append_text($revision_id); + } + $instance->{revisions_combobox}->set_active(0); + + # Reparent window and display it. + + $instance->{window}->set_transient_for($parent); + $instance->{window}->show_all(); + $instance->{window}->present(); + + # If necessary, register the window for management. + + $wm->manage($instance, $window_type, $instance->{window}) if ($new); + + return $instance; + +} + +1; ============================================================ # locale/help/C/figures/multiple-revisions-dialog.png is binary ============================================================ --- lib/perl/AdvancedFind.pm 856fdd55fe5c47125d357c605a455b477ce02ce2 +++ lib/perl/AdvancedFind.pm 2710ba47e3cf4d8cb6d3acb421cb518491056f49 @@ -4,7 +4,7 @@ # # Description - The advanced find module for the mtn-browse application. # This module contains all the routines for implementing the -# advanced find dialog. +# advanced find dialog window. # # Author - A.E.Cooper. # @@ -660,7 +660,7 @@ sub get_advanced_find_window($) $tv_column->set_fixed_width(100); $tv_column->set_sort_column_id(AFLS_REVISION_ID_COLUMN); $renderer = Gtk2::CellRendererText->new(); - $tv_column->pack_start($renderer, FALSE); + $tv_column->pack_start($renderer, TRUE); $tv_column->set_attributes($renderer, "text" => AFLS_REVISION_ID_COLUMN); $instance->{revisions_treeview}->append_column($tv_column); @@ -671,7 +671,7 @@ sub get_advanced_find_window($) $tv_column->set_sizing("grow-only"); $tv_column->set_sort_column_id(AFLS_BRANCH_COLUMN); $renderer = Gtk2::CellRendererText->new(); - $tv_column->pack_start($renderer, FALSE); + $tv_column->pack_start($renderer, TRUE); $tv_column->set_attributes($renderer, "text" => AFLS_BRANCH_COLUMN); $instance->{revisions_treeview}->append_column($tv_column); @@ -681,7 +681,7 @@ sub get_advanced_find_window($) $tv_column->set_sizing("grow-only"); $tv_column->set_sort_column_id(AFLS_DATE_COLUMN); $renderer = Gtk2::CellRendererText->new(); - $tv_column->pack_start($renderer, FALSE); + $tv_column->pack_start($renderer, TRUE); $tv_column->set_attributes($renderer, "text" => AFLS_DATE_COLUMN); $instance->{revisions_treeview}->append_column($tv_column); @@ -691,7 +691,7 @@ sub get_advanced_find_window($) $tv_column->set_sizing("grow-only"); $tv_column->set_sort_column_id(AFLS_AUTHOR_COLUMN); $renderer = Gtk2::CellRendererText->new(); - $tv_column->pack_start($renderer, FALSE); + $tv_column->pack_start($renderer, TRUE); $tv_column->set_attributes($renderer, "text" => AFLS_AUTHOR_COLUMN); $instance->{revisions_treeview}->append_column($tv_column); ============================================================ --- lib/perl/FindFiles.pm adc0848bcb3a9f34e12cc65e377fdbf44b58de36 +++ lib/perl/FindFiles.pm 1f7f9f51e6f4c16a4f70e590a7d8907644cc6617 @@ -972,7 +972,7 @@ sub get_find_files_window() $tv_column = Gtk2::TreeViewColumn->new(); $tv_column->set_sort_column_id(0); $renderer = Gtk2::CellRendererText->new(); - $tv_column->pack_start($renderer, FALSE); + $tv_column->pack_start($renderer, TRUE); $tv_column->set_attributes($renderer, "text" => 0); $instance->{results_treeview}->append_column($tv_column); $instance->{results_treeview}->set_search_column(0); @@ -1023,6 +1023,8 @@ sub get_find_files_window() } + local $instance->{in_cb} = 1; + $instance->{stop} = 0; $instance->{results_liststore}->clear(); set_label_value($instance->{author_value_label}, ""); ============================================================ --- lib/perl/FindText.pm 15db71ad8a95650872646ef06553497cdc027908 +++ lib/perl/FindText.pm c688764a2a999f9d1ef8ec3b306f6df990f5afc8 @@ -734,12 +734,13 @@ sub get_find_text_window($$) } else { - $new = 0; $instance->{in_cb} = 0; local $instance->{in_cb} = 1; $instance->{main_vbox}->set_sensitive(TRUE); } + local $instance->{in_cb} = 1; + # Reset the search context. $instance->{match_offset_start} = $instance->{match_offset_end} = -1; ============================================================ --- lib/perl/Preferences.pm bc9a565ac54237e185670c70618d24e2507a91d5 +++ lib/perl/Preferences.pm 81f61fc079d69e125708ac6690f1b18592911637 @@ -4,7 +4,7 @@ # # Description - The preferences module for the mtn-browse application. This # module contains all the routines for implementing the -# preferences dialog. +# preferences dialog window. # # Please note that when adding a new preference setting one # needs to: @@ -1119,7 +1119,7 @@ sub get_preferences_window($$) $tv_column->set_sizing("grow-only"); $tv_column->set_sort_column_id(MTLS_NAME_COLUMN); $renderer = Gtk2::CellRendererText->new(); - $tv_column->pack_start($renderer, FALSE); + $tv_column->pack_start($renderer, TRUE); $tv_column->set_attributes($renderer, "text" => MTLS_NAME_COLUMN); $instance->{mime_types_treeview}->append_column($tv_column); @@ -1129,7 +1129,7 @@ sub get_preferences_window($$) $tv_column->set_sizing("grow-only"); $tv_column->set_sort_column_id(MTLS_PATTERNS_COLUMN); $renderer = Gtk2::CellRendererText->new(); - $tv_column->pack_start($renderer, FALSE); + $tv_column->pack_start($renderer, TRUE); $tv_column->set_attributes($renderer, "text" => MTLS_PATTERNS_COLUMN); $instance->{mime_types_treeview}->append_column($tv_column); @@ -1139,7 +1139,7 @@ sub get_preferences_window($$) $tv_column->set_sizing("grow-only"); $tv_column->set_sort_column_id(MTLS_HELPER_COLUMN); $renderer = Gtk2::CellRendererText->new(); - $tv_column->pack_start($renderer, FALSE); + $tv_column->pack_start($renderer, TRUE); $tv_column->set_attributes($renderer, "text" => MTLS_HELPER_COLUMN); $instance->{mime_types_treeview}->append_column($tv_column); @@ -1159,7 +1159,7 @@ sub get_preferences_window($$) $tv_column = Gtk2::TreeViewColumn->new(); $tv_column->set_sizing("grow-only"); $renderer = Gtk2::CellRendererText->new(); - $tv_column->pack_start($renderer, FALSE); + $tv_column->pack_start($renderer, TRUE); $tv_column->set_attributes($renderer, "text" => 0); $instance->{file_name_patterns_treeview}->append_column($tv_column); ============================================================ --- lib/perl/WindowManager.pm 6d30c1472f2e9dfbc86025c9f0601e3626cf9562 +++ lib/perl/WindowManager.pm a79b7d52387179c2282086b7d3c5a4d031128c4b @@ -536,7 +536,7 @@ sub make_busy($$$;$) # Reinstate the event handling context for the head of the state # stack (although a handler is registered, really the only thing - # that has changed is its client data, it's still have same + # that has changed is its client data, it's still the same # handler). Gtk2::Gdk::Event->handler_set ============================================================ --- lib/ui/mtn-browse.glade a6bd56cb5f32c93dcc636bc6aa1bbf9cd86cd8bb +++ lib/ui/mtn-browse.glade f6f29a1bebcf6a7b88fe72f9de8163a7719aed80 @@ -9173,4 +9173,271 @@ last updated with respect to this revisi + + Multiple Revisions + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER_ON_PARENT + True + False + False + mtn-browse.png + True + True + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + GTK_RELIEF_NORMAL + True + 0 + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-find + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + Advanced Find + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + -6 + + + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 5 + True + False + 5 + + + + True + False + 0 + + + + True + gtk-dialog-question + 6 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + True + + + + + 0 + False + True + + + + + + True + False + 5 + + + + True + + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0 + 0 + 0 + + + 0 + False + True + + + + + + True + False + 5 + + + + True + Select the revision +that you want + True + False + + + + True + Revisions: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + + + 0 + False + True + + + + + + True + + + 0 + True + True + + + + + 0 + False + True + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + ============================================================ --- locale/help/C/mtn-browse.xml 18796ea920397941ebbd699f8a44d209d6224e5f +++ locale/help/C/mtn-browse.xml 9a72965e410b4f7c40a36ccbf853ab4e582e6da4 @@ -651,10 +651,10 @@ GNOME or DocBook. The tagged revision that you attempted to select in the parent Monotone Browser window is not unique on the currently selected branch and something like the following dialog window popped up.
- A `Non-Unique Tag' Dialog Window + A `Multiple Revisions' Dialog Window - A non-unique tag dialog window. - + A multiple revisions dialog window. +
============================================================ --- mtn-browse 9e81bf545d4bf3279fa9981d051ca173845379a9 +++ mtn-browse e9beceba6af5e7e6dcfb9142bbf79456597d2a44 @@ -106,6 +106,7 @@ use History; use FindFiles; use FindText; use History; +use MultipleRevisions; use Preferences; use WindowManager; @@ -151,6 +152,7 @@ sub get_browser_window(;$$$$$); sub file_change_history_button_clicked_cb($$); sub find_files_button_clicked_cb($$); sub get_browser_window(;$$$$$); +sub handle_advanced_find($); sub help_on_window_activate_cb($$); sub help_toolbutton_clicked_cb($$); sub home_page_activate_cb($$); @@ -831,53 +833,8 @@ sub advanced_find_button_clicked_cb($$) return if ($browser->{in_cb}); local $browser->{in_cb} = 1; - my(@branches, - $preset_branch, - $revision_id, - $state); + handle_advanced_find($browser); - if (advanced_find($browser, \$revision_id, address@hidden)) - { - - # Preset branch name. If we already have a selected branch then try and - # match branch names, if that fails then just pick the first name. - - $preset_branch = 1; - $state = BRANCH_CHANGED; - if ($browser->{branch_combo_details}->{complete}) - { - foreach my $name (@branches) - { - if ($name eq $browser->{branch_combo_details}->{value}) - { - $preset_branch = 0; - last; - } - } - } - if ($preset_branch) - { - $browser->{branch_combo_details}->{preset} = 1; - $browser->{branch_combo_details}->{value} = - (scalar(@branches) > 0) ? $branches[0] : ""; - $state = ALL_CHANGED; - } - - # Preset revision id. - - $browser->{revision_combo_details}->{preset} = 1; - $browser->{revision_combo_details}->{value} = $revision_id; - - # A revision id is what is returned so switch off the listing of tag - # names. - - $browser->{tagged_checkbutton}->set_active(FALSE); - - $browser->{appbar}->clear_stack(); - &{$browser->{update_handler}}($browser, $state); - - } - } # ############################################################################## @@ -1730,7 +1687,7 @@ sub get_browser_window(;$$$$$) $tv_column->set_fixed_width(180); $tv_column->set_sort_column_id(MLS_NAME_COLUMN); $renderer = Gtk2::CellRendererText->new(); - $tv_column->pack_start($renderer, FALSE); + $tv_column->pack_start($renderer, TRUE); $tv_column->set_attributes($renderer, "text" => MLS_NAME_COLUMN); $browser->{manifest_browser_treeview}->append_column($tv_column); @@ -1744,7 +1701,7 @@ sub get_browser_window(;$$$$$) $tv_column->set_sizing("grow-only"); $tv_column->set_sort_column_id(MLS_DATE_COLUMN); $renderer = Gtk2::CellRendererText->new(); - $tv_column->pack_start($renderer, FALSE); + $tv_column->pack_start($renderer, TRUE); $tv_column->set_attributes($renderer, "text" => MLS_DATE_COLUMN); $browser->{manifest_browser_treeview}->append_column($tv_column); @@ -1754,7 +1711,7 @@ sub get_browser_window(;$$$$$) $tv_column->set_sizing("grow-only"); $tv_column->set_sort_column_id(MLS_AUTHOR_COLUMN); $renderer = Gtk2::CellRendererText->new(); - $tv_column->pack_start($renderer, FALSE); + $tv_column->pack_start($renderer, TRUE); $tv_column->set_attributes($renderer, "text" => MLS_AUTHOR_COLUMN); $browser->{manifest_browser_treeview}->append_column($tv_column); @@ -2050,6 +2007,7 @@ sub update_browser_state($$) my($browser, $changed) = @_; + my $use_advanced_find; my $wm = WindowManager->instance(); $wm->make_busy($browser, 1); @@ -2176,38 +2134,100 @@ sub update_browser_state($$) && $browser->{branch_combo_details}->{complete} && ! $browser->{revision_combo_details}->{preset}) { + my @revision_ids; + + # Get the head revision(s) for the branch. + $browser->{appbar}->set_status(__("Auto selecting head revision")); $wm->update_gui(); $browser->{mtn}->select (address@hidden, "h:" . $browser->{branch_combo_details}->{value}); + + # One head on the branch. + if (scalar(@revision_ids) == 1) { $browser->{revision_combo_details}->{preset} = 1; $browser->{revision_combo_details}->{value} = $revision_ids[0]; $browser->{tagged_checkbutton}->set_active(FALSE); } + + # Multiple heads on the branch. + elsif (scalar(@revision_ids) > 1) { - my $message; - $message = - __x("The `{branch}' branch has multiple heads\nand " - . "Auto select head revision is switched " - . "on.\nPlease manually select the revision.\n" - . "The head revision ids are:", - branch => $browser->{branch_combo_details}->{value}); - foreach my $item (@revision_ids) + + my($response, + $revision_id); + + # Ask the user what they want to do. + + $response = multiple_revisions_selection + ($browser->{window}, + __x("The `{branch}' branch\n" + . "has multiple heads and Auto select head " + . "revision is switched\n" + . "on. Please either select the revision by its " + . "id using the combobox\n" + . "below or use the Advanced Find " + . "feature.", + branch => $browser->{branch_combo_details}->{value}), + \$revision_id, + @revision_ids); + + # Deal with their response (either they have selected a + # revision, they have asked to use the advanced find dialog + # window or they have aborted in some way). + + if ($response eq "ok") { - $message .= "\n" . Glib::Markup::escape_text($item); + + # We have single revision id so simply preset the revision + # selection to that revision. + + $browser->{revision_combo_details}->{preset} = 1; + $browser->{revision_combo_details}->{value} = $revision_id; + $browser->{tagged_checkbutton}->set_active(FALSE); + } - my $dialog = Gtk2::MessageDialog->new_with_markup - ($browser->{window}, ["modal"], "info", "close", $message); - $wm->allow_input(sub { $dialog->run(); }); - $dialog->destroy(); + else + { + + # The user has either selected advanced find or aborted in + # some way. + + # If necessary flag the fact that the user wants to use + # advanced find. + + $use_advanced_find = 1 if ($response eq "advanced-find"); + + # Either way, no revision is currently selected so we need + # to blank out all the revision selection details and + # proceed as normal (this will blank out the rest of the + # browser). + + $browser->{revision_combo_details}->{complete} = 0; + $browser->{revision_combo_details}->{value} = ""; + $browser->{tagged_checkbutton}->set_active(FALSE); + + } + } + + # No heads or revisions on the branch. + + else + { + $browser->{revision_combo_details}->{complete} = 0; + $browser->{revision_combo_details}->{value} = ""; + $browser->{tagged_checkbutton}->set_active(FALSE); + } + $browser->{appbar}->set_status(""); $wm->update_gui(); + } # Reset the revision selection. @@ -2301,39 +2321,101 @@ sub update_browser_state($$) $wm->update_gui(); if ($browser->{revision_combo_details}->{complete}) { - my @revision_ids; + + my($revision_id, + @revision_ids); + + # Get the revision id(s) that match what the user has selected. + # More than one revision id may be returned if the selected tag + # isn't unique on that branch. + get_revision_ids($browser, address@hidden); + + # Deal with more than one revision id being selected. + if (scalar(@revision_ids) > 1) { - my $message; - $message = - __x("The `{tag_name}' tag is not unique on this branch.\n" - . "Please either select the revision by its id\n" - . "or use the Advanced Find feature.\n" - . "The matching revision ids are:", - tag_name => - $browser->{revision_combo_details}->{value}); - foreach my $item (@revision_ids) + + my $response; + + # More than one revision matches the tag that was selected by + # the user. Ask them what they want to do. + + $response = multiple_revisions_selection + ($browser->{window}, + __x("The `{tag_name}' tag is not unique on this\n" + . "branch. Please either select the revision by " + . "its id using the\n" + . "combobox below or use the " + . "Advanced Find feature.", + tag_name => + $browser->{revision_combo_details}->{value}), + \$revision_id, + @revision_ids); + + # Deal with their response (either they have selected a + # revision, they have asked to use the advanced find dialog + # window or they have aborted in some way). + + if ($response eq "ok") { - $message .= "\n" . Glib::Markup::escape_text($item); + + # We have single revision id so we need to redo the + # revision selection bit but with tag names switched off. + # The easiest way to do this is to recursively call this + # routine with $changed set to just REVISION. Afterwards + # just carry on as if a revision id had been selected in + # the first place. + + $browser->{revision_combo_details}->{preset} = 1; + $browser->{revision_combo_details}->{value} = $revision_id; + $browser->{tagged_checkbutton}->set_active(FALSE); + &{$browser->{update_handler}}($browser, REVISION); + } - my $dialog = Gtk2::MessageDialog->new_with_markup - ($browser->{window}, ["modal"], "info", "close", $message); - $wm->allow_input(sub { $dialog->run(); }); - $dialog->destroy(); - $browser->{revision_combo_details}->{complete} = 0; - $browser->{revision_combo_details}->{value} = ""; - $browser->{revision_comboboxentry}->child()->set_text(""); + else + { + + # The user has either selected advanced find or aborted in + # some way. + + # If necessary flag the fact that the user wants to use + # advanced find. + + $use_advanced_find = 1 if ($response eq "advanced-find"); + + # Either way, no revision is currently selected so we need + # to blank out all the revision selection details and + # proceed as normal (this will blank out the rest of the + # browser). + + $browser->{revision_combo_details}->{complete} = 0; + $browser->{revision_combo_details}->{value} = ""; + $browser->{revision_comboboxentry}->child()->set_text(""); + + } + } else { + + # Only one revision id was selected. This is the norm. + + $revision_id = $revision_ids[0]; + + } + + # If we now have one revision selected then get its details. + + if (defined($revision_id)) + { my($author, @certs_list, $change_log, $date); $browser->{mtn}->get_manifest_of(address@hidden, - $revision_ids[0]); - $browser->{mtn}->certs(address@hidden, $revision_ids[0]); + $revision_id); + $browser->{mtn}->certs(address@hidden, $revision_id); $author = $change_log = $date = ""; foreach my $cert (@certs_list) { @@ -2357,6 +2439,7 @@ sub update_browser_state($$) set_label_value($browser->{change_log_value_label}, $change_log); } + } $browser->{manifest} = address@hidden; @@ -2625,10 +2708,84 @@ sub update_browser_state($$) $browser->{appbar}->pop(); $wm->make_busy($browser, 0); + # All done. Now check to see if during the update process the user asked to + # call up the advanced find dialog window, if so then display it now. + + handle_advanced_find($browser) if ($use_advanced_find); + } # ############################################################################## # +# Routine - handle_advanced_find +# +# Description - Call up the advanced find dialog window for the specified +# browser and then populate that browser with any results +# that come back from that search. +# +# Data - $browser : The browser instance from which the advanced +# find is to be done. +# +############################################################################## + + + +sub handle_advanced_find($) +{ + + my $browser = $_[0]; + + my(@branches, + $preset_branch, + $revision_id, + $state); + + if (advanced_find($browser, \$revision_id, address@hidden)) + { + + # Preset branch name. If we already have a selected branch then try and + # match branch names, if that fails then just pick the first name. + + $preset_branch = 1; + $state = BRANCH_CHANGED; + if ($browser->{branch_combo_details}->{complete}) + { + foreach my $name (@branches) + { + if ($name eq $browser->{branch_combo_details}->{value}) + { + $preset_branch = 0; + last; + } + } + } + if ($preset_branch) + { + $browser->{branch_combo_details}->{preset} = 1; + $browser->{branch_combo_details}->{value} = + (scalar(@branches) > 0) ? $branches[0] : ""; + $state = ALL_CHANGED; + } + + # Preset revision id. + + $browser->{revision_combo_details}->{preset} = 1; + $browser->{revision_combo_details}->{value} = $revision_id; + + # A revision id is what is returned so switch off the listing of tag + # names. + + $browser->{tagged_checkbutton}->set_active(FALSE); + + $browser->{appbar}->clear_stack(); + &{$browser->{update_handler}}($browser, $state); + + } + +} +# +############################################################################## +# # Routine - display_file # # Description - Display the currenty selected file in the sourceview