remove deprecations using ruby-gtk2-3.2.4 on ubuntu 18.04
authorGuillaume Cottenceau <gc@mnc.ch>
Thu, 23 Aug 2018 08:19:28 +0000 (10:19 +0200)
committerGuillaume Cottenceau <gc@mnc.ch>
Thu, 23 Aug 2018 08:26:38 +0000 (10:26 +0200)
bin/booh
bin/booh-classifier
lib/booh/booh-lib.rb

index 0a5ca37..f6ab0e3 100644 (file)
--- a/bin/booh
+++ b/bin/booh
@@ -501,9 +501,9 @@ def update_shown_pixbuf(thumbnail_img, img, desired_x, desired_y)
         pixbuf = rotate_pixbuf(pixbuf, $modified_pixbufs[thumbnail_img][:angle_to_orig])
         msg 3, "sizes: #{pixbuf.width} #{pixbuf.height} - desired #{desired_x}x#{desired_x}"
         if pixbuf.height > desired_y
-            pixbuf = pixbuf.scale(pixbuf.width * (desired_y.to_f/pixbuf.height), desired_y, Gdk::Pixbuf::INTERP_BILINEAR)
+            pixbuf = pixbuf.scale(pixbuf.width * (desired_y.to_f/pixbuf.height), desired_y, :bilinear)
         elsif pixbuf.width < desired_x && pixbuf.height < desired_y
-            pixbuf = pixbuf.scale(desired_x, pixbuf.height * (desired_x.to_f/pixbuf.width), Gdk::Pixbuf::INTERP_BILINEAR)
+            pixbuf = pixbuf.scale(desired_x, pixbuf.height * (desired_x.to_f/pixbuf.width), :bilinear)
         end
     end
 
index 8e5da45..e468807 100644 (file)
@@ -315,14 +315,14 @@ class Entry
             if @pixbuf_full.width.to_f / @pixbuf_full.height > width.to_f / height
                 resized_height = @pixbuf_full.height * (width.to_f/@pixbuf_full.width)
                 if @pixbuf_full.width > width || @pixbuf_full.height > resized_height
-                    @pixbuf_main = @pixbuf_full.scale(width, resized_height, Gdk::Pixbuf::INTERP_BILINEAR)
+                    @pixbuf_main = @pixbuf_full.scale(width, resized_height, :bilinear)
                 else
                     @pixbuf_main = @pixbuf_full
                 end
             else
                 resized_width = @pixbuf_full.width * (height.to_f/@pixbuf_full.height)
                 if @pixbuf_full.width > resized_width || @pixbuf_full.height > height
-                    @pixbuf_main = @pixbuf_full.scale(resized_width, height, Gdk::Pixbuf::INTERP_BILINEAR)
+                    @pixbuf_main = @pixbuf_full.scale(resized_width, height, :bilinear)
                 else
                     @pixbuf_main = @pixbuf_full
                 end
@@ -348,7 +348,7 @@ class Entry
         if @pixbuf_thumbnail.nil?
             if @pixbuf_main
                 msg 3, ">>> pixbuf_thumbnail from main #{path}"
-                @pixbuf_thumbnail = @pixbuf_main.scale(@pixbuf_main.width * (Entry.thumbnails_height.to_f/@pixbuf_main.height), Entry.thumbnails_height, Gdk::Pixbuf::INTERP_BILINEAR)
+                @pixbuf_thumbnail = @pixbuf_main.scale(@pixbuf_main.width * (Entry.thumbnails_height.to_f/@pixbuf_main.height), Entry.thumbnails_height, :bilinear)
             else
                 msg 3, ">>> pixbuf_thumbnail from file #{path}"
                 @pixbuf_thumbnail = load_into_pixbuf_at_size { |w, h|
@@ -477,7 +477,7 @@ class Entry
             #- use a pixbuf loader and check Gtk.events_pending? on each chunk, to keep the UI responsive even
             #- if loaded pictures are several MBs large
             if @loader.nil?
-                @loader = Gdk::PixbufLoader.new
+                @loader = GdkPixbuf::PixbufLoader.new
                 @loader.signal_connect('size-prepared') { |l, w, h|
                     @loader.set_size(*specify_size.call(w, h))
                 }
@@ -1243,7 +1243,7 @@ def show_entries(allentries)
     update_counters
     sb_msg(_("Loading images..."))
     $loading_progressbar.fraction = 0
-    $loading_progressbar.text = utf8(_("Loading... %d%") % 0)
+    $loading_progressbar.text = utf8(_("Loading... %d%%") % 0)
     $loading_progressbar.show
     t1 = Time.now
     total_loaded_files = 0
@@ -1295,7 +1295,7 @@ def show_entries(allentries)
             allentries.delete_at(i)
         end
         $loading_progressbar.fraction = i.to_f / allentries.size
-        $loading_progressbar.text = utf8(_("Loading... %d%") % (100 * $loading_progressbar.fraction))
+        $loading_progressbar.text = utf8(_("Loading... %d%%") % (100 * $loading_progressbar.fraction))
         if $quit
             return
         end
@@ -2023,7 +2023,7 @@ end
 
 def create_main_window
 
-    $videoborder_pixbuf = Gdk::Pixbuf.new("#{$FPATH}/images/video_border.png")
+    $videoborder_pixbuf = GdkPixbuf::Pixbuf.new(:file => "#{$FPATH}/images/video_border.png")
     $videoborder_pixmap, = $videoborder_pixbuf.render_pixmap_and_mask(0)
 
     mb = create_menubar
@@ -2033,7 +2033,7 @@ def create_main_window
     mainview_hbox = Gtk::HBox.new
     mainview_hbox.pack_start(Gtk::Alignment.new(0.5, 0, 1, 1).add(left_vbox = Gtk::VBox.new(false, 5)), false, true)
     left_vbox.pack_start(($labels_vbox = Gtk::VBox.new(false, 5)), false, true)
-    left_vbox.pack_end($loading_progressbar = Gtk::ProgressBar.new.set_text(utf8(_("Loading... %d%") % 0)), false, true)
+    left_vbox.pack_end($loading_progressbar = Gtk::ProgressBar.new.set_text(utf8(_("Loading... %d%%") % 0)), false, true)
     mainview_hbox.pack_start($mainview = MainView.new, true, true)
     main_vbox.pack_start(mainview_hbox, true, true)
     $imagesline_sw = Gtk::ScrolledWindow.new(nil, nil)
index af6f331..c8ce3d3 100644 (file)
@@ -258,7 +258,7 @@ module Booh
                         $sizes_cache[fullpath] = { :x => $1.to_i, :y => $2.to_i }
                     end
                 else
-                    format, width, height = Gdk::Pixbuf.get_file_info(fullpath)
+                    format, width, height = GdkPixbuf::Pixbuf.get_file_info(fullpath)
                     if width
                         $sizes_cache[fullpath] = { :x => width, :y => height }
                     end
@@ -897,7 +897,7 @@ EOF
 Japanese: Masao Mutoh
 German: Roland Eckert
 French: Guillaume Cottenceau')),
-                                              :logo => Gdk::Pixbuf.new("#{$FPATH}/images/logo.png") })
+                                              :logo => GdkPixbuf::Pixbuf.new(:file => "#{$FPATH}/images/logo.png") })
     end
 
     def smartsort(entries, sort_criterions)
@@ -922,9 +922,9 @@ French: Guillaume Cottenceau')),
 
     def create_window
         w = Gtk::Window.new
-        w.icon_list = [ Gdk::Pixbuf.new("#{$FPATH}/images/booh-16x16.png"),
-                        Gdk::Pixbuf.new("#{$FPATH}/images/booh-32x32.png"),
-                        Gdk::Pixbuf.new("#{$FPATH}/images/booh-48x48.png") ]
+        w.icon_list = [ GdkPixbuf::Pixbuf.new(:file => "#{$FPATH}/images/booh-16x16.png"),
+                        GdkPixbuf::Pixbuf.new(:file => "#{$FPATH}/images/booh-32x32.png"),
+                        GdkPixbuf::Pixbuf.new(:file => "#{$FPATH}/images/booh-48x48.png") ]
         return w
     end