]> git.saurik.com Git - wxWidgets.git/commitdiff
Allow using versions of libnotify < 0.7 in wxGTK.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 9 Sep 2012 13:36:43 +0000 (13:36 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 9 Sep 2012 13:36:43 +0000 (13:36 +0000)
libnotify 0.4.5 included in Ubuntu Lucid (10.04) can be used for implementing
wxNotificationMessage too, there is only a minor difference with 0.7 API. So
while we stick check for 0.7 initially, accept lower versions too if 0.7 is
not available.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72456 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

configure
configure.in
setup.h.in
src/gtk/notifmsg.cpp

index 9979575fcc47bb981a733b571bf7918902fffe0a..ab85cccdc20bcfb8e1d0ec5fe672e4fc329d9d46 100755 (executable)
--- a/configure
+++ b/configure
@@ -34032,6 +34032,7 @@ fi
 
     if test "$wxUSE_NOTIFICATION_MESSAGE" = "yes" ; then
         if test "$wxUSE_LIBNOTIFY" = "yes" ; then
 
     if test "$wxUSE_NOTIFICATION_MESSAGE" = "yes" ; then
         if test "$wxUSE_LIBNOTIFY" = "yes" ; then
+            HAVE_LIBNOTIFY=0
 
 pkg_failed=no
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBNOTIFY" >&5
 
 pkg_failed=no
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBNOTIFY" >&5
        echo "$LIBNOTIFY_PKG_ERRORS" >&5
 
 
        echo "$LIBNOTIFY_PKG_ERRORS" >&5
 
 
-                    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&5
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBNOTIFY" >&5
+$as_echo_n "checking for LIBNOTIFY... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$LIBNOTIFY_CFLAGS"; then
+        pkg_cv_LIBNOTIFY_CFLAGS="$LIBNOTIFY_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnotify >= 0.4\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libnotify >= 0.4") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBNOTIFY_CFLAGS=`$PKG_CONFIG --cflags "libnotify >= 0.4" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$LIBNOTIFY_LIBS"; then
+        pkg_cv_LIBNOTIFY_LIBS="$LIBNOTIFY_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnotify >= 0.4\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libnotify >= 0.4") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBNOTIFY_LIBS=`$PKG_CONFIG --libs "libnotify >= 0.4" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               LIBNOTIFY_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libnotify >= 0.4"`
+        else
+               LIBNOTIFY_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libnotify >= 0.4"`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$LIBNOTIFY_PKG_ERRORS" >&5
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&5
 $as_echo "$as_me: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&2;}
 
 $as_echo "$as_me: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&2;}
 
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&5
+$as_echo "$as_me: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&2;}
+
+else
+       LIBNOTIFY_CFLAGS=$pkg_cv_LIBNOTIFY_CFLAGS
+       LIBNOTIFY_LIBS=$pkg_cv_LIBNOTIFY_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       HAVE_LIBNOTIFY=1
+fi
+
 
 elif test $pkg_failed = untried; then
 
 
 elif test $pkg_failed = untried; then
 
-                    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&5
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBNOTIFY" >&5
+$as_echo_n "checking for LIBNOTIFY... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$LIBNOTIFY_CFLAGS"; then
+        pkg_cv_LIBNOTIFY_CFLAGS="$LIBNOTIFY_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnotify >= 0.4\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libnotify >= 0.4") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBNOTIFY_CFLAGS=`$PKG_CONFIG --cflags "libnotify >= 0.4" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$LIBNOTIFY_LIBS"; then
+        pkg_cv_LIBNOTIFY_LIBS="$LIBNOTIFY_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnotify >= 0.4\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libnotify >= 0.4") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBNOTIFY_LIBS=`$PKG_CONFIG --libs "libnotify >= 0.4" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               LIBNOTIFY_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libnotify >= 0.4"`
+        else
+               LIBNOTIFY_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libnotify >= 0.4"`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$LIBNOTIFY_PKG_ERRORS" >&5
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&5
 $as_echo "$as_me: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&2;}
 
 $as_echo "$as_me: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&2;}
 
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&5
+$as_echo "$as_me: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&2;}
 
 else
        LIBNOTIFY_CFLAGS=$pkg_cv_LIBNOTIFY_CFLAGS
        LIBNOTIFY_LIBS=$pkg_cv_LIBNOTIFY_LIBS
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
 else
        LIBNOTIFY_CFLAGS=$pkg_cv_LIBNOTIFY_CFLAGS
        LIBNOTIFY_LIBS=$pkg_cv_LIBNOTIFY_LIBS
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
+       HAVE_LIBNOTIFY=1
+fi
 
 
-                    GUI_TK_LIBRARY="$GUI_TK_LIBRARY $LIBNOTIFY_LIBS"
-                    CFLAGS="$LIBNOTIFY_CFLAGS $CFLAGS"
-                    CXXFLAGS="$LIBNOTIFY_CFLAGS $CXXFLAGS"
-                    $as_echo "#define wxUSE_LIBNOTIFY 1" >>confdefs.h
+
+else
+       LIBNOTIFY_CFLAGS=$pkg_cv_LIBNOTIFY_CFLAGS
+       LIBNOTIFY_LIBS=$pkg_cv_LIBNOTIFY_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+                    HAVE_LIBNOTIFY=1
+                    $as_echo "#define wxUSE_LIBNOTIFY_0_7 1" >>confdefs.h
 
 
 fi
 
 
 fi
+
+            if test "$HAVE_LIBNOTIFY" = "1" ; then
+                GUI_TK_LIBRARY="$GUI_TK_LIBRARY $LIBNOTIFY_LIBS"
+                CFLAGS="$LIBNOTIFY_CFLAGS $CFLAGS"
+                CXXFLAGS="$LIBNOTIFY_CFLAGS $CXXFLAGS"
+                $as_echo "#define wxUSE_LIBNOTIFY 1" >>confdefs.h
+
+            fi
         fi
     fi
 
         fi
     fi
 
index 8b0c1250b88292ee4791b8f4995b72f1677170c6..0ca7b1a007034f026fcc9cd58df16b394c5950e4 100644 (file)
@@ -5668,17 +5668,26 @@ if test "$WXGTK2" = 1; then
 
     if test "$wxUSE_NOTIFICATION_MESSAGE" = "yes" ; then
         if test "$wxUSE_LIBNOTIFY" = "yes" ; then
 
     if test "$wxUSE_NOTIFICATION_MESSAGE" = "yes" ; then
         if test "$wxUSE_LIBNOTIFY" = "yes" ; then
+            HAVE_LIBNOTIFY=0
             PKG_CHECK_MODULES(LIBNOTIFY, [libnotify >= 0.7],
                 [
             PKG_CHECK_MODULES(LIBNOTIFY, [libnotify >= 0.7],
                 [
-                    GUI_TK_LIBRARY="$GUI_TK_LIBRARY $LIBNOTIFY_LIBS"
-                    CFLAGS="$LIBNOTIFY_CFLAGS $CFLAGS"
-                    CXXFLAGS="$LIBNOTIFY_CFLAGS $CXXFLAGS"
-                    AC_DEFINE(wxUSE_LIBNOTIFY)
+                    HAVE_LIBNOTIFY=1
+                    AC_DEFINE(wxUSE_LIBNOTIFY_0_7)
                 ],
                 [
                 ],
                 [
-                    AC_MSG_WARN([libnotify not found, wxNotificationMessage will use generic implementation.])
+                    PKG_CHECK_MODULES(LIBNOTIFY, [libnotify >= 0.4],
+                        [HAVE_LIBNOTIFY=1],
+                        [AC_MSG_WARN([libnotify not found, wxNotificationMessage will use generic implementation.])]
+                    )
                 ]
             )
                 ]
             )
+
+            if test "$HAVE_LIBNOTIFY" = "1" ; then
+                GUI_TK_LIBRARY="$GUI_TK_LIBRARY $LIBNOTIFY_LIBS"
+                CFLAGS="$LIBNOTIFY_CFLAGS $CFLAGS"
+                CXXFLAGS="$LIBNOTIFY_CFLAGS $CXXFLAGS"
+                AC_DEFINE(wxUSE_LIBNOTIFY)
+            fi
         fi
     fi
 
         fi
     fi
 
index 8d690563561a6896451c16c6d873302293e0f118..bda2a49482f2382deb21e090e86be8ae218e609c 100644 (file)
  * Use libnotify library.
  */
 #define wxUSE_LIBNOTIFY 0
  * Use libnotify library.
  */
 #define wxUSE_LIBNOTIFY 0
+/*
+ * Use libnotify 0.7+ API.
+ */
+#define wxUSE_LIBNOTIFY_0_7 0
 /*
  * Use libXpm
  */
 /*
  * Use libXpm
  */
index d50dee214084814ee66517d9172e5b3f908812dd..a3cf7ff39cb951150e9f0f67fc5d8dfd79e05cb1 100644 (file)
@@ -138,6 +138,13 @@ bool wxNotificationMessage::Show(int timeout)
                             GetTitle().utf8_str(),
                             GetMessage().utf8_str(),
                             icon
                             GetTitle().utf8_str(),
                             GetMessage().utf8_str(),
                             icon
+#if !wxUSE_LIBNOTIFY_0_7
+                            // There used to be an "associated window"
+                            // parameter in this function but it has
+                            // disappeared by 0.7, so use it for previous
+                            // versions only.
+                            , 0
+#endif // libnotify < 0.7
                          );
         if ( !m_notification )
         {
                          );
         if ( !m_notification )
         {