Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make gtkmm optional

  • Loading branch information...
commit 8d77ef115f2bd9b2d1b7630e91af9a1f8d7f924d 1 parent dcf0b80
@statianzo statianzo authored
Showing with 13 additions and 4 deletions.
  1. +13 −4 lib/libnotify/ffi.rb
View
17 lib/libnotify/ffi.rb
@@ -5,15 +5,24 @@ module FFI
extend ::FFI::Library
def self.included(base)
+ load_libs
+ attach_functions!
+ rescue LoadError => e
+ warn e.message
+ end
+
+ def self.load_libs
+ libnotify_libs = %w[libnotify libnotify.so.4 libnotify.so.3 libnotify.so.2 libnotify.so.1 libnotify.so]
+
# Workaround for "half-linked" libnotify.so. Does not work on rubinius (no ffi_lib_flags there)!
# See: https://bugzilla.redhat.com/show_bug.cgi?id=626852
ffi_lib_flags :lazy, :local, :global if respond_to?(:ffi_lib_flags)
+ ffi_lib libnotify_libs
+
+ rescue LoadError
ffi_lib %w[libgtk-x11-2.0 libgtk-x11-2.0.so.0 libgtk-x11-2.0.so libgtk-3 libgtk-3.so.0 libgtk-3.so],
%w[libgtkmm-2.4 libgtkmm-2.4.so.1 libgtkmm-2.4.so libgtkmm-3.0 libgtkmm-3.0.so.1 libgtkmm-3.0.so],
- %w[libnotify libnotify.so.4 libnotify.so.3 libnotify.so.2 libnotify.so.1 libnotify.so]
- attach_functions!
- rescue LoadError => e
- warn e.message
+ libnotify_libs
end
URGENCY = [ :low, :normal, :critical ]
Please sign in to comment.
Something went wrong with that request. Please try again.