<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[728] trunk/alexandria/lib/alexandria/ui/dialogs: Accepting Lennart Karssen's patch to grab focus for the Title field in</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>728</dd>
<dt>Author</dt> <dd>cathalmagus</dd>
<dt>Date</dt> <dd>2007-09-25 01:52:05 -0400 (Tue, 25 Sep 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>Accepting Lennart Karssen's patch to grab focus for the Title field in
all book properties dialogs [bug #14164].
To match this new behaviour, the relevant search field is focused when
a new book dialog is opened.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkalexandrialibalexandriauidialogsbook_properties_dialog_baserb">trunk/alexandria/lib/alexandria/ui/dialogs/book_properties_dialog_base.rb</a></li>
<li><a href="#trunkalexandrialibalexandriauidialogsnew_book_dialogrb">trunk/alexandria/lib/alexandria/ui/dialogs/new_book_dialog.rb</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkalexandrialibalexandriauidialogsbook_properties_dialog_baserb"></a>
<div class="modfile"><h4>Modified: trunk/alexandria/lib/alexandria/ui/dialogs/book_properties_dialog_base.rb (727 => 728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/alexandria/lib/alexandria/ui/dialogs/book_properties_dialog_base.rb        2007-09-23 18:43:18 UTC (rev 727)
+++ trunk/alexandria/lib/alexandria/ui/dialogs/book_properties_dialog_base.rb        2007-09-25 05:52:05 UTC (rev 728)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx">             @parent, @cover_file = parent, cover_file
</span><span class="cx"> 
</span><span class="cx">             @entry_title.complete_titles
</span><ins>+            @entry_title.grab_focus
</ins><span class="cx">             @entry_publisher.complete_publishers
</span><span class="cx">             @entry_edition.complete_editions
</span><span class="cx">             @entry_loaned_to.complete_borrowers
</span><span class="lines">@@ -40,14 +41,14 @@
</span><span class="cx">             renderer.signal_connect('edited') do |cell, path_string, new_text|
</span><span class="cx">                 path = Gtk::TreePath.new(path_string)
</span><span class="cx">                 iter = @treeview_authors.model.get_iter(path)
</span><del>-                iter[0] = new_text 
</del><ins>+                iter[0] = new_text
</ins><span class="cx">             end
</span><del>-            renderer.signal_connect('editing_started') do |cell, entry, 
</del><ins>+            renderer.signal_connect('editing_started') do |cell, entry,
</ins><span class="cx">                                                            path_string|
</span><span class="cx">                 entry.complete_authors
</span><span class="cx">             end
</span><del>-            col = Gtk::TreeViewColumn.new(&quot;&quot;, renderer, 
-                                          :text =&gt; 0, 
</del><ins>+            col = Gtk::TreeViewColumn.new(&quot;&quot;, renderer,
+                                          :text =&gt; 0,
</ins><span class="cx">                                           :editable =&gt; 1)
</span><span class="cx">             @treeview_authors.append_column(col)
</span><span class="cx">         end
</span><span class="lines">@@ -58,62 +59,62 @@
</span><span class="cx">                 _(&quot;Properties for '%s'&quot;) % title
</span><span class="cx">             else
</span><span class="cx">                 _(&quot;Properties&quot;)
</span><del>-            end 
</del><ins>+            end
</ins><span class="cx">         end
</span><del>-        
</del><ins>+
</ins><span class="cx">         def on_add_author
</span><span class="cx">             iter = @treeview_authors.model.append
</span><span class="cx">             iter[0] = _(&quot;Author&quot;)
</span><span class="cx">             iter[1] = true
</span><del>-            @treeview_authors.set_cursor(iter.path, 
-                                         @treeview_authors.get_column(0), 
</del><ins>+            @treeview_authors.set_cursor(iter.path,
+                                         @treeview_authors.get_column(0),
</ins><span class="cx">                                          true)
</span><span class="cx">         end
</span><span class="cx"> 
</span><span class="cx">         def on_remove_author
</span><span class="cx">             if iter = @treeview_authors.selection.selected
</span><del>-                    @treeview_authors.model.remove(iter)
</del><ins>+                    @treeview_authors.model.remove(iter)
</ins><span class="cx">             end
</span><span class="cx">         end
</span><del>-        
</del><ins>+
</ins><span class="cx">         def on_image_rating1_press
</span><span class="cx">             self.rating = 1
</span><span class="cx">         end
</span><del>-        
</del><ins>+
</ins><span class="cx">         def on_image_rating2_press
</span><del>-            self.rating = 2 
</del><ins>+            self.rating = 2
</ins><span class="cx">         end
</span><del>-        
</del><ins>+
</ins><span class="cx">         def on_image_rating3_press
</span><del>-            self.rating = 3 
</del><ins>+            self.rating = 3
</ins><span class="cx">         end
</span><del>-        
</del><ins>+
</ins><span class="cx">         def on_image_rating4_press
</span><del>-            self.rating = 4 
</del><ins>+            self.rating = 4
</ins><span class="cx">         end
</span><del>-        
</del><ins>+
</ins><span class="cx">         def on_image_rating5_press
</span><del>-            self.rating = 5 
</del><ins>+            self.rating = 5
</ins><span class="cx">         end
</span><del>-   
</del><ins>+
</ins><span class="cx">         def on_image_no_rating_press
</span><span class="cx">             self.rating = 0
</span><span class="cx">         end
</span><del>-        
</del><ins>+
</ins><span class="cx">         def redd_toggled
</span><span class="cx">         end
</span><del>-        
</del><ins>+
</ins><span class="cx">         def own_toggled
</span><del>-                if @checkbutton_own.active?
-                        @checkbutton_want.inconsistent = true
-                else
-                        @checkbutton_want.inconsistent = false
-                end
</del><ins>+                if @checkbutton_own.active?
+                        @checkbutton_want.inconsistent = true
+                else
+                        @checkbutton_want.inconsistent = false
+                end
</ins><span class="cx">         end
</span><del>-        
</del><ins>+
</ins><span class="cx">         def want_toggled
</span><span class="cx">         end
</span><del>-  
</del><ins>+
</ins><span class="cx">         @@latest_filechooser_directory = ENV['HOME']
</span><span class="cx">         def on_change_cover
</span><span class="cx">             backend = `uname`.chomp == &quot;FreeBSD&quot; ? &quot;neant&quot; : &quot;gnome-vfs&quot;
</span><span class="lines">@@ -122,10 +123,10 @@
</span><span class="cx">                                                 Gtk::FileChooser::ACTION_OPEN,
</span><span class="cx">                                                 backend,
</span><span class="cx">                                                 [_(&quot;No Cover&quot;),
</span><del>-                                                 Gtk::Dialog::RESPONSE_REJECT], 
-                                                [Gtk::Stock::CANCEL, 
</del><ins>+                                                 Gtk::Dialog::RESPONSE_REJECT],
+                                                [Gtk::Stock::CANCEL,
</ins><span class="cx">                                                  Gtk::Dialog::RESPONSE_CANCEL],
</span><del>-                                                [Gtk::Stock::OPEN, 
</del><ins>+                                                [Gtk::Stock::OPEN,
</ins><span class="cx">                                                  Gtk::Dialog::RESPONSE_ACCEPT])
</span><span class="cx">             dialog.current_folder = @@latest_filechooser_directory
</span><span class="cx">             response = dialog.run
</span><span class="lines">@@ -136,7 +137,7 @@
</span><span class="cx">                     FileUtils.cp(dialog.filename, @cover_file)
</span><span class="cx">                     self.cover = cover
</span><span class="cx">                     @@latest_filechooser_directory = dialog.current_folder
</span><del>-                rescue RuntimeError =&gt; e 
</del><ins>+                rescue RuntimeError =&gt; e
</ins><span class="cx">                     ErrorDialog.new(@book_properties_dialog, e.message)
</span><span class="cx">                 end
</span><span class="cx">             elsif response == Gtk::Dialog::RESPONSE_REJECT
</span><span class="lines">@@ -158,23 +159,23 @@
</span><span class="cx">         def on_loaned_date_changed
</span><span class="cx">             loaned_time = Time.at(@date_loaned_since.time)
</span><span class="cx">             n_days = ((Time.now - loaned_time) / (3600*24)).to_i
</span><del>-            @label_loaning_duration.label = if n_days &gt; 0 
</del><ins>+            @label_loaning_duration.label = if n_days &gt; 0
</ins><span class="cx">                 n_(&quot;%d day&quot;, &quot;%d days&quot;, n_days) % n_days
</span><span class="cx">             else
</span><span class="cx">                 &quot;&quot;
</span><span class="cx">             end
</span><span class="cx">         end
</span><del>-            
</del><ins>+
</ins><span class="cx">         #######
</span><span class="cx">         private
</span><span class="cx">         #######
</span><del>-    
</del><ins>+
</ins><span class="cx">         def rating=(rating)
</span><span class="cx">             images = [
</span><del>-                @image_rating1, 
-                @image_rating2, 
-                @image_rating3, 
-                @image_rating4, 
</del><ins>+                @image_rating1,
+                @image_rating2,
+                @image_rating3,
+                @image_rating4,
</ins><span class="cx">                 @image_rating5
</span><span class="cx">             ]
</span><span class="cx">             raise &quot;out of range&quot; if rating &lt; 0 or rating &gt; images.length
</span><span class="lines">@@ -185,9 +186,9 @@
</span><span class="cx"> 
</span><span class="cx">         def cover=(pixbuf)
</span><span class="cx">             if pixbuf.width &gt; COVER_MAXWIDTH
</span><del>-                new_height = pixbuf.height / 
</del><ins>+                new_height = pixbuf.height /
</ins><span class="cx">                              (pixbuf.width / COVER_MAXWIDTH.to_f)
</span><del>-                # We don't want to modify in place the given pixbuf, 
</del><ins>+                # We don't want to modify in place the given pixbuf,
</ins><span class="cx">                 # that's why we make a copy.
</span><span class="cx">                 pixbuf = pixbuf.scale(COVER_MAXWIDTH, new_height)
</span><span class="cx">             end
</span></span></pre></div>
<a id="trunkalexandrialibalexandriauidialogsnew_book_dialogrb"></a>
<div class="modfile"><h4>Modified: trunk/alexandria/lib/alexandria/ui/dialogs/new_book_dialog.rb (727 => 728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/alexandria/lib/alexandria/ui/dialogs/new_book_dialog.rb        2007-09-23 18:43:18 UTC (rev 727)
+++ trunk/alexandria/lib/alexandria/ui/dialogs/new_book_dialog.rb        2007-09-25 05:52:05 UTC (rev 728)
</span><span class="lines">@@ -51,19 +51,19 @@
</span><span class="cx">         include GetText
</span><span class="cx">         extend GetText
</span><span class="cx">         GetText.bindtextdomain(Alexandria::TEXTDOMAIN, nil, nil, &quot;UTF-8&quot;)
</span><del>-        
</del><ins>+
</ins><span class="cx">         def initialize(parent, selected_library=nil, &amp;block)
</span><span class="cx">             super('new_book_dialog.glade')
</span><span class="cx">             puts &quot;New Book Dialog&quot; if $DEBUG
</span><span class="cx">             @new_book_dialog.transient_for = @parent = parent
</span><span class="cx">             @block = block
</span><del>-                        @destroyed = false
</del><ins>+                        @destroyed = false
</ins><span class="cx">             libraries = Libraries.instance.all_regular_libraries
</span><span class="cx">             if selected_library.is_a?(SmartLibrary)
</span><span class="cx">                 selected_library = libraries.first
</span><span class="cx">             end
</span><span class="cx">             @combo_libraries.populate_with_libraries(libraries,
</span><del>-                                                     selected_library) 
</del><ins>+                                                     selected_library)
</ins><span class="cx"> 
</span><span class="cx">             @treeview_results.model = Gtk::ListStore.new(String, String,
</span><span class="cx">                 Gdk::Pixbuf)
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx">             col = Gtk::TreeViewColumn.new(&quot;&quot;, renderer)
</span><span class="cx">             col.set_cell_data_func(renderer) do |column, cell, model, iter|
</span><span class="cx">                 pixbuf = iter[2]
</span><del>-                max_height = 25 
</del><ins>+                max_height = 25
</ins><span class="cx"> 
</span><span class="cx">                 if pixbuf.height &gt; max_height
</span><span class="cx">                     new_width = pixbuf.width * (max_height.to_f / pixbuf.height)
</span><span class="lines">@@ -87,10 +87,10 @@
</span><span class="cx">             end
</span><span class="cx">             @treeview_results.append_column(col)
</span><span class="cx"> 
</span><del>-            col = Gtk::TreeViewColumn.new(&quot;&quot;, Gtk::CellRendererText.new, 
</del><ins>+            col = Gtk::TreeViewColumn.new(&quot;&quot;, Gtk::CellRendererText.new,
</ins><span class="cx">                                           :text =&gt; 0)
</span><span class="cx">             @treeview_results.append_column(col)
</span><del>-            @entry_isbn.grab_focus
</del><ins>+
</ins><span class="cx">             @combo_search.active = 0
</span><span class="cx"> 
</span><span class="cx">             # Re-select the last selected criterion.
</span><span class="lines">@@ -98,34 +98,41 @@
</span><span class="cx">                 @title_radiobutton.active = @@last_criterion_was_not_isbn
</span><span class="cx">             rescue NameError
</span><span class="cx">                 @@last_criterion_was_not_isbn = false
</span><del>-            end 
</del><ins>+            end
</ins><span class="cx"> 
</span><ins>+            if @@last_criterion_was_not_isbn
+                @entry_search.grab_focus
+            else
+                @entry_isbn.grab_focus
+            end
+
</ins><span class="cx">             @find_thread = nil
</span><span class="cx">             @image_thread = nil
</span><del>-            
-            @new_book_dialog.signal_connect(&quot;destroy&quot;) { @new_book_dialog.destroy
-                                                                                                     @destroyed = true        
-                                                                                                     }
</del><ins>+
+            @new_book_dialog.signal_connect(&quot;destroy&quot;) {
+                @new_book_dialog.destroy
+                @destroyed = true
+            }
</ins><span class="cx">         end
</span><span class="cx"> 
</span><span class="cx">         def on_criterion_toggled(item)
</span><span class="cx">             return unless item.active?
</span><span class="cx">             if is_isbn = item == @isbn_radiobutton
</span><span class="cx">                 @latest_size = @new_book_dialog.size
</span><del>-                @new_book_dialog.resizable = false 
</del><ins>+                @new_book_dialog.resizable = false
</ins><span class="cx">             else
</span><del>-                @new_book_dialog.resizable = true 
</del><ins>+                @new_book_dialog.resizable = true
</ins><span class="cx">                 @new_book_dialog.resize(*@latest_size) unless @latest_size.nil?
</span><span class="cx">             end
</span><del>-            @entry_isbn.sensitive = is_isbn 
-            @combo_search.sensitive = !is_isbn 
-            @entry_search.sensitive = !is_isbn 
</del><ins>+            @entry_isbn.sensitive = is_isbn
+            @combo_search.sensitive = !is_isbn
+            @entry_search.sensitive = !is_isbn
</ins><span class="cx">             @button_find.sensitive = !is_isbn
</span><span class="cx">             @scrolledwindow.visible = !is_isbn
</span><span class="cx">             on_changed(is_isbn ? @entry_isbn : @entry_search)
</span><span class="cx">             unless is_isbn
</span><del>-                @button_add.sensitive = 
-                    @treeview_results.selection.count_selected_rows &gt; 0 
</del><ins>+                @button_add.sensitive =
+                    @treeview_results.selection.count_selected_rows &gt; 0
</ins><span class="cx">             end
</span><span class="cx"> 
</span><span class="cx">             # Remember the last criterion selected (so that we can re-select
</span><span class="lines">@@ -147,20 +154,20 @@
</span><span class="cx">         end
</span><span class="cx"> 
</span><span class="cx">         def get_images_async
</span><del>-                puts &quot;get_images_async&quot; if $DEBUG
</del><ins>+                puts &quot;get_images_async&quot; if $DEBUG
</ins><span class="cx">             @images = {}
</span><span class="cx">             @image_error = nil
</span><span class="cx">             @image_thread = Thread.new do
</span><del>-                    puts &quot;New @image_thread #{Thread.current}&quot; if $DEBUG
</del><ins>+                puts &quot;New @image_thread #{Thread.current}&quot; if $DEBUG
</ins><span class="cx">                 begin
</span><del>-                        @results.each_with_index do |result, i|
</del><ins>+                        @results.each_with_index do |result, i|
</ins><span class="cx">                         uri = result[1]
</span><span class="cx">                         if uri
</span><del>-                                if URI.parse(uri).scheme.nil?
</del><ins>+                                if URI.parse(uri).scheme.nil?
</ins><span class="cx">                                 File.open(uri, &quot;r&quot;) do |io|
</span><span class="cx">                                     @images[i] = io.read
</span><span class="cx">                                 end
</span><del>-                            else                                                    
</del><ins>+                            else
</ins><span class="cx">                                 @images[i] = URI.parse(uri).read
</span><span class="cx">                             end
</span><span class="cx">                         end
</span><span class="lines">@@ -182,8 +189,8 @@
</span><span class="cx"> 
</span><span class="cx">                             if pixbuf.width &gt; 1
</span><span class="cx">                                 iter = @treeview_results.model.get_iter(key.to_s)
</span><del>-                                unless @treeview_results.model.iter_is_valid?(iter) 
-                                        raise &quot;Iter is invalid! %s&quot; % iter
</del><ins>+                                unless @treeview_results.model.iter_is_valid?(iter)
+                                        raise &quot;Iter is invalid! %s&quot; % iter
</ins><span class="cx">                                 end
</span><span class="cx">                                 iter[2] = pixbuf #I bet you this is it!
</span><span class="cx">                             end
</span><span class="lines">@@ -197,17 +204,17 @@
</span><span class="cx"> 
</span><span class="cx">                 # Stop if the image download thread has stopped.
</span><span class="cx">                 if @image_thread.alive?
</span><del>-                        puts &quot;@image_thread (#{@image_thread}) still alive.&quot; if $DEBUG
-                        true
</del><ins>+                        puts &quot;@image_thread (#{@image_thread}) still alive.&quot; if $DEBUG
+                        true
</ins><span class="cx">                 else
</span><del>-                        puts &quot;@image_thread (#{@image_thread}) asleep now.&quot; if $DEBUG
-                        false                        
</del><ins>+                        puts &quot;@image_thread (#{@image_thread}) asleep now.&quot; if $DEBUG
+                        false
</ins><span class="cx">                 end
</span><span class="cx">             end
</span><span class="cx">         end
</span><span class="cx"> 
</span><span class="cx">         def on_find
</span><del>-                puts &quot;on_find&quot; if $DEBUG
</del><ins>+                puts &quot;on_find&quot; if $DEBUG
</ins><span class="cx">             mode = case @combo_search.active
</span><span class="cx">                 when 0
</span><span class="cx">                     BookProviders::SEARCH_BY_TITLE
</span><span class="lines">@@ -219,7 +226,7 @@
</span><span class="cx"> 
</span><span class="cx">             criterion = @entry_search.text.strip
</span><span class="cx">             @treeview_results.model.clear
</span><del>-            puts &quot;TreeStore Model: %s columns; ref_counts: %s&quot; % 
</del><ins>+            puts &quot;TreeStore Model: %s columns; ref_counts: %s&quot; %
</ins><span class="cx">             [@treeview_results.model.n_columns, @treeview_results.model.ref_count] if $DEBUG
</span><span class="cx">             @new_book_dialog.sensitive = false
</span><span class="cx">             @find_error = nil
</span><span class="lines">@@ -227,9 +234,9 @@
</span><span class="cx"> 
</span><span class="cx">             @find_thread.kill if @find_thread
</span><span class="cx">             @image_thread.kill if @image_thread
</span><del>-            
</del><ins>+
</ins><span class="cx">             @find_thread = Thread.new do
</span><del>-                    puts &quot;New @find_thread #{Thread.current}&quot; if $DEBUG
</del><ins>+                puts &quot;New @find_thread #{Thread.current}&quot; if $DEBUG
</ins><span class="cx">                 begin
</span><span class="cx">                     @results = Alexandria::BookProviders.search(criterion, mode)
</span><span class="cx">                     puts &quot;got #{@results.length} results&quot; if $DEBUG
</span><span class="lines">@@ -241,7 +248,7 @@
</span><span class="cx">             Gtk.timeout_add(100) do
</span><span class="cx">                 # This block copies results into the tree view, or shows an
</span><span class="cx">                 # error if the search failed.
</span><del>-                
</del><ins>+
</ins><span class="cx">                 # Err... continue == false if @find_error
</span><span class="cx">                 continue = if @find_error
</span><span class="cx">                     ErrorDialog.new(@parent,
</span><span class="lines">@@ -249,50 +256,50 @@
</span><span class="cx">                                     @find_error)
</span><span class="cx">                     false
</span><span class="cx">                 elsif @results
</span><del>-                        puts &quot;Got results: #{@results[0]}...&quot; if $DEBUG
</del><ins>+                        puts &quot;Got results: #{@results[0]}...&quot; if $DEBUG
</ins><span class="cx">                     @results.each do |book, cover|
</span><span class="cx">                         s = _(&quot;%s, by %s&quot;) % [ book.title,
</span><span class="cx">                                                book.authors.join(', ') ]
</span><del>-                                                if @results.find { |book2, cover2|
</del><ins>+                                                if @results.find { |book2, cover2|
</ins><span class="cx">                                             book.title == book2.title and
</span><span class="cx">                                             book.authors == book2.authors
</span><span class="cx">                                          }.length &gt; 1
</span><span class="cx">                             s += &quot; (#{book.edition}, #{book.publisher})&quot;
</span><span class="cx">                         end
</span><span class="cx">                         puts &quot;Copying %s into tree view.&quot; % book.title if $DEBUG
</span><del>-                                                iter = @treeview_results.model.append
</del><ins>+                                                iter = @treeview_results.model.append
</ins><span class="cx">                         iter[0] = s
</span><span class="cx">                         iter[1] = book.isbn
</span><span class="cx">                         iter[2] = Icons::BOOK
</span><span class="cx">                     end
</span><span class="cx"> 
</span><span class="cx">                     # Kick off the image download thread.
</span><del>-                                        if @find_thread.alive?
-                                                puts &quot;@find_thread (#{@find_thread}) still alive.&quot; if $DEBUG
-                            true
</del><ins>+                                        if @find_thread.alive?
+                                                puts &quot;@find_thread (#{@find_thread}) still alive.&quot; if $DEBUG
+                        true
</ins><span class="cx">                     else
</span><del>-                            puts &quot;@find_thread (#{@find_thread}) asleep now.&quot; if $DEBUG
-                            #Not really async now.
-                            get_images_async
-                            false #continue == false if you get to here. Stop timeout_add.
</del><ins>+                        puts &quot;@find_thread (#{@find_thread}) asleep now.&quot; if $DEBUG
+                        #Not really async now.
+                        get_images_async
+                        false #continue == false if you get to here. Stop timeout_add.
</ins><span class="cx">                     end
</span><span class="cx">                 else
</span><span class="cx">                     # Stop if the book find thread has stopped.
</span><span class="cx">                     @find_thread.alive?
</span><span class="cx">                 end
</span><del>-                # continue == false if @find_error OR if results are returned 
</del><ins>+                # continue == false if @find_error OR if results are returned
</ins><span class="cx">                 # @new_book_dialog.sensitive is a bad call if window has been destroyed
</span><span class="cx">                 # timeout_add ends if continue is false!
</span><del>-                
</del><ins>+
</ins><span class="cx">                 unless continue
</span><del>-                        unless @find_thread.alive? #This happens after find_thread is done
-                                unless @destroyed
-                                        @new_book_dialog.sensitive = true
-                                        @button_add.sensitive = false
-                                end
-                        end
</del><ins>+                        unless @find_thread.alive? #This happens after find_thread is done
+                                unless @destroyed
+                                        @new_book_dialog.sensitive = true
+                                        @button_add.sensitive = false
+                                end
+                        end
</ins><span class="cx">                 end
</span><del>-                
</del><ins>+
</ins><span class="cx">                 continue #timeout_add loop condition
</span><span class="cx">             end
</span><span class="cx">         end
</span><span class="lines">@@ -312,7 +319,7 @@
</span><span class="cx">         def on_results_button_press_event(widget, event)
</span><span class="cx">             # double left click
</span><span class="cx">             if event.event_type == Gdk::Event::BUTTON2_PRESS and
</span><del>-               event.button == 1 
</del><ins>+               event.button == 1
</ins><span class="cx"> 
</span><span class="cx">                 on_add
</span><span class="cx">             end
</span><span class="lines">@@ -325,7 +332,7 @@
</span><span class="cx"> 
</span><span class="cx">             begin
</span><span class="cx">                 libraries = Libraries.instance.all_libraries
</span><del>-                library, new_library = 
</del><ins>+                library, new_library =
</ins><span class="cx">                     @combo_libraries.selection_from_libraries(libraries)
</span><span class="cx">                 books_to_add = []
</span><span class="cx">                 if @isbn_radiobutton.active?
</span><span class="lines">@@ -340,8 +347,8 @@
</span><span class="cx">                     assert_not_exist(library, @entry_isbn.text)
</span><span class="cx">                     books_to_add &lt;&lt; Alexandria::BookProviders.isbn_search(isbn)
</span><span class="cx">                 else
</span><del>-                    @treeview_results.selection.selected_each do |model, path,  
-                                                                 iter| 
</del><ins>+                    @treeview_results.selection.selected_each do |model, path,
+                                                                 iter|
</ins><span class="cx">                         @results.each do |book, cover|
</span><span class="cx">                             next unless book.isbn == iter[1]
</span><span class="cx">                             begin
</span><span class="lines">@@ -355,7 +362,7 @@
</span><span class="cx">                             books_to_add &lt;&lt; [book, cover]
</span><span class="cx">                         end
</span><span class="cx">                     end
</span><del>-                end 
</del><ins>+                end
</ins><span class="cx"> 
</span><span class="cx">                 # Save the books in the library.
</span><span class="cx">                 books_to_add.each do |book, cover_uri|
</span><span class="lines">@@ -369,11 +376,11 @@
</span><span class="cx">                 # Do not destroy if there is no addition.
</span><span class="cx">                 return if books_to_add.empty?
</span><span class="cx"> 
</span><del>-                # Now we can destroy the dialog and go back to the main 
</del><ins>+                # Now we can destroy the dialog and go back to the main
</ins><span class="cx">                 # application.
</span><span class="cx">                 @new_book_dialog.destroy
</span><del>-                @block.call(books_to_add.map { |x| x.first }, 
-                            library, 
</del><ins>+                @block.call(books_to_add.map { |x| x.first },
+                            library,
</ins><span class="cx">                             new_library)
</span><span class="cx">             rescue =&gt; e
</span><span class="cx">                 ErrorDialog.new(@parent, _(&quot;Couldn't add the book&quot;), e.message)
</span><span class="lines">@@ -391,7 +398,7 @@
</span><span class="cx">                 clipboard = Gtk::Clipboard.get(Gdk::Selection::CLIPBOARD)
</span><span class="cx">                 if text = clipboard.wait_for_text
</span><span class="cx">                     @entry_isbn.text = text if
</span><del>-                        Library.valid_isbn?(text) or Library.valid_ean?(text) or 
</del><ins>+                        Library.valid_isbn?(text) or Library.valid_ean?(text) or
</ins><span class="cx">                         Library.valid_upc?(text)
</span><span class="cx">                 end
</span><span class="cx">             end
</span><span class="lines">@@ -403,28 +410,28 @@
</span><span class="cx"> 
</span><span class="cx">                 radio, target_widget, box2, box3 = case widget
</span><span class="cx">                     when @eventbox_entry_search
</span><del>-                        [@title_radiobutton, @entry_search, 
</del><ins>+                        [@title_radiobutton, @entry_search,
</ins><span class="cx">                          @eventbox_combo_search, @eventbox_entry_isbn]
</span><span class="cx"> 
</span><del>-                    when @eventbox_combo_search 
-                        [@title_radiobutton, @combo_search, 
</del><ins>+                    when @eventbox_combo_search
+                        [@title_radiobutton, @combo_search,
</ins><span class="cx">                          @eventbox_entry_search, @eventbox_entry_isbn]
</span><span class="cx"> 
</span><del>-                    when @eventbox_entry_isbn 
-                        [@isbn_radiobutton, @entry_isbn, 
</del><ins>+                    when @eventbox_entry_isbn
+                        [@isbn_radiobutton, @entry_isbn,
</ins><span class="cx">                          @eventbox_entry_search, @eventbox_combo_search]
</span><span class="cx">                 end
</span><span class="cx">                 radio.active = true
</span><del>-                target_widget.grab_focus 
</del><ins>+                target_widget.grab_focus
</ins><span class="cx">                 widget.above_child = false
</span><span class="cx">                 box2.above_child = box3.above_child = true
</span><span class="cx">             end
</span><span class="cx">         end
</span><del>- 
</del><ins>+
</ins><span class="cx">         def on_help
</span><span class="cx">             begin
</span><span class="cx">                 Gnome::Help.display('alexandria', 'add-book-by-isbn')
</span><del>-            rescue =&gt; e 
</del><ins>+            rescue =&gt; e
</ins><span class="cx">                 ErrorDialog.new(@preferences_dialog, e.message)
</span><span class="cx">             end
</span><span class="cx">         end
</span></span></pre>
</div>
</div>

</body>
</html>