Blob Blame History Raw
--- alexandria-0.6.9/lib/alexandria/ui/icons.rb.rg309	2009-08-29 21:27:15.000000000 +0900
+++ alexandria-0.6.9/lib/alexandria/ui/icons.rb	2016-08-15 17:32:58.220820991 +0900
@@ -15,18 +15,26 @@
 # write to the Free Software Foundation, Inc., 51 Franklin Street,
 # Fifth Floor, Boston, MA 02110-1301 USA.
 
-class Gdk::Pixbuf
+if !defined?(GDK_PIXBUF)
+  if defined?(GdkPixbuf)
+    GDK_PIXBUF = GdkPixbuf::Pixbuf
+  else
+    GDK_PIXBUF = Gdk::Pixbuf
+  end
+end
+
+class GDK_PIXBUF
   def tag(tag_pixbuf)
     # Computes some tweaks.
     tweak_x = tag_pixbuf.width / 3
     tweak_y = tag_pixbuf.height / 3
 
     # Creates the destination pixbuf.
-    new_pixbuf = Gdk::Pixbuf.new(Gdk::Pixbuf::COLORSPACE_RGB,
-                                 true,
-                                 8,
-                                 self.width + tweak_x,
-                                 self.height + tweak_y)
+    new_pixbuf = GDK_PIXBUF.new(:colorspace => :rgb,
+                                 :has_alpha => true,
+                                 :bits_per_sample => 8,
+                                 :width => self.width + tweak_x,
+                                 :height => self.height + tweak_y)
 
     # Fills with blank.
     new_pixbuf.fill!(0)
@@ -39,13 +47,24 @@
 
     # Copies the tag pixbuf there (north-est).
     tag_pixbuf_x = self.width - (tweak_x * 2)
-    new_pixbuf.composite!(tag_pixbuf,
+    if defined?(GdkPixbuf)
+      new_pixbuf.composite!(tag_pixbuf,
+                          :dest_x =>0, :dest_y => 0,
+                          :dest_width => tag_pixbuf.width + tag_pixbuf_x,
+                          :dest_height => tag_pixbuf.height,
+                          :offset_x => tag_pixbuf_x, :offset_y => 0,
+                          :scale_x => 1, :scale_y => 1,
+                          :interpolation_type => :hyper, :overall_alpha => 255
+                          )
+    else
+      new_pixbuf.composite!(tag_pixbuf,
                           0, 0,
                           tag_pixbuf.width + tag_pixbuf_x,
                           tag_pixbuf.height,
                           tag_pixbuf_x, 0,
                           1, 1,
                           Gdk::Pixbuf::INTERP_HYPER, 255)
+    end
     return new_pixbuf
   end
 end
@@ -66,7 +85,7 @@
             # Don't use upcase and use tr instead
             # For example in Turkish the upper case of 'i' is still 'i'.
             name = File.basename(file, ".png").tr('a-z', 'A-Z')
-          const_set(name, Gdk::Pixbuf.new(File.join(ICONS_DIR, file)))
+          const_set(name, GDK_PIXBUF.new(:file => File.join(ICONS_DIR, file)))
         end
       end
 
@@ -75,7 +94,7 @@
           return BOOK_ICON if library.nil?
           filename = library.cover(book)
           if File.exists?(filename)
-            return Gdk::Pixbuf.new(filename)
+            return GDK_PIXBUF.new(:file => filename)
           end
         rescue Exception => err
             # report load error; FIX should go to a Logger...
@@ -88,7 +107,7 @@
 
       def self.blank?(filename)
         begin
-          pixbuf = Gdk::Pixbuf.new(filename)
+          pixbuf = GdkPixbuf::Pixbuf.new(:file => filename)
           pixbuf.width == 1 and pixbuf.height == 1
         rescue Exception => err
           puts err.message
--- alexandria-0.6.9/lib/alexandria/ui/sidepane.rb.rg309	2009-03-26 08:09:32.000000000 +0900
+++ alexandria-0.6.9/lib/alexandria/ui/sidepane.rb	2016-08-15 17:13:47.764552444 +0900
@@ -1,3 +1,11 @@
+if !defined?(GDK_PIXBUF)
+  if defined?(GdkPixbuf)
+    GDK_PIXBUF = GdkPixbuf::Pixbuf
+  else
+    GDK_PIXBUF = Gdk::Pixbuf
+  end
+end
+
 module Alexandria
   module UI
     class SidePaneManager
@@ -80,7 +88,7 @@
       end
 
       def setup_sidepane
-        @library_listview.model = Gtk::ListStore.new(Gdk::Pixbuf,
+        @library_listview.model = Gtk::ListStore.new(GDK_PIXBUF,
                                                      String,
                                                      TrueClass,
                                                      TrueClass)
--- alexandria-0.6.9/lib/alexandria/ui/ui_manager.rb.rg309	2016-08-15 21:32:21.259657750 +0900
+++ alexandria-0.6.9/lib/alexandria/ui/ui_manager.rb	2016-08-15 17:12:04.362982918 +0900
@@ -16,6 +16,14 @@
 # write to the Free Software Foundation, Inc., 51 Franklin Street,
 # Fifth Floor, Boston, MA 02110-1301 USA.
 
+if !defined?(GDK_PIXBUF)
+  if defined?(GdkPixbuf)
+    GDK_PIXBUF = GdkPixbuf::Pixbuf
+  else
+    GDK_PIXBUF = Gdk::Pixbuf
+  end
+end
+
 module Alexandria
   module UI
     MAX_RATING_STARS = 5
@@ -263,8 +271,8 @@
         log.debug { "setting up active model" }
         # The active model.
 
-        list = [Gdk::Pixbuf,    # COVER_LIST
-          Gdk::Pixbuf,    # COVER_ICON
+        list = [GDK_PIXBUF,    # COVER_LIST
+          GDK_PIXBUF,    # COVER_ICON
           String,         # TITLE
           String,         # TITLE_REDUCED
           String,         # AUTHORS