Skip to content

Commit

Permalink
make gtkmm optional
Browse files Browse the repository at this point in the history
  • Loading branch information
statianzo committed Jun 6, 2012
1 parent dcf0b80 commit 8d77ef1
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/libnotify/ffi.rb
Expand Up @@ -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 ]
Expand Down

0 comments on commit 8d77ef1

Please sign in to comment.