Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Make gtkmm optional #16

Merged
merged 1 commit into from almost 2 years ago

2 participants

Jason Staten Peter Suschlik
Jason Staten

This removes the mandatory dependency on gtkmm. I understand that libnotify is provided half-linked in some distributions, as described in #4. However, adding a hard dependency gtkmm when it's not always needed is not the best approach. It makes this gem unusable on Arch Linux without having to install an unnecessary library.

The included changeset attempts to load libnotify on its own. If that fails, then gtk and gtkmm will be loaded in attempt to resolve the dependency.

Peter Suschlik splattael merged commit b5cec5a into from June 10, 2012
Peter Suschlik splattael closed this June 10, 2012
Peter Suschlik
Owner

I've just released 0.7.3. Thanks!

Jason Staten

Thank you for the quick new release. It's much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jun 06, 2012
Jason Staten make gtkmm optional 8d77ef1
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 13 additions and 4 deletions. Show diff stats Hide diff stats

  1. 17  lib/libnotify/ffi.rb
17  lib/libnotify/ffi.rb
@@ -5,15 +5,24 @@ module FFI
5 5
     extend ::FFI::Library
6 6
 
7 7
     def self.included(base)
  8
+      load_libs
  9
+      attach_functions!
  10
+    rescue LoadError => e
  11
+      warn e.message
  12
+    end
  13
+
  14
+    def self.load_libs
  15
+      libnotify_libs = %w[libnotify libnotify.so.4 libnotify.so.3 libnotify.so.2 libnotify.so.1 libnotify.so]
  16
+
8 17
       # Workaround for "half-linked" libnotify.so. Does not work on rubinius (no ffi_lib_flags there)!
9 18
       # See: https://bugzilla.redhat.com/show_bug.cgi?id=626852
10 19
       ffi_lib_flags :lazy, :local, :global if respond_to?(:ffi_lib_flags)
  20
+      ffi_lib libnotify_libs
  21
+
  22
+    rescue LoadError
11 23
       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],
12 24
               %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],
13  
-              %w[libnotify libnotify.so.4 libnotify.so.3 libnotify.so.2 libnotify.so.1 libnotify.so]
14  
-      attach_functions!
15  
-    rescue LoadError => e
16  
-      warn e.message
  25
+              libnotify_libs
17 26
     end
18 27
 
19 28
     URGENCY = [ :low, :normal, :critical ]
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.