[vino] Stay compatible with both old and new libnotify



commit da16014b2453222003100824a7d0ec318e271a2c
Author: Vincent Untz <vuntz gnome org>
Date:   Thu Dec 23 14:49:59 2010 +0100

    Stay compatible with both old and new libnotify
    
    Since this is still a stable branch, it's worth supporting libnotify <
    0.7.

 configure.in                   |    5 +++++
 server/vino-status-icon.c      |    7 +++++++
 server/vino-status-tube-icon.c |    5 +++++
 3 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/configure.in b/configure.in
index e97abcf..3062dd8 100644
--- a/configure.in
+++ b/configure.in
@@ -105,6 +105,11 @@ fi
 
 if test "x$have_libnotify" = "xyes" ; then
     AC_DEFINE(VINO_ENABLE_LIBNOTIFY, [], [Set if we should use libnotify])
+    PKG_CHECK_EXISTS(libnotify >= 0.7.0,
+                     have_libnotify_0_7=yes, have_libnotify_0_7=no)
+    if test "x$have_libnotify_0_7" = "xyes" ; then
+        AC_DEFINE(VINO_HAS_LIBNOTIFY_0_7, [], [Set if libnotify 0.7.0 or greater is available])
+    fi
 fi
 
 dnl -- check for NetworkManager -----------------------------------------------
diff --git a/server/vino-status-icon.c b/server/vino-status-icon.c
index 31faaf6..e11c15c 100644
--- a/server/vino-status-icon.c
+++ b/server/vino-status-icon.c
@@ -622,9 +622,16 @@ vino_status_icon_show_new_client_notification (gpointer user_data)
     }
 
   icon->priv->new_client_notification =
+#ifdef VINO_HAS_LIBNOTIFY_0_7
     notify_notification_new (summary,
                              body,
                              "preferences-desktop-remote-desktop");
+#else
+    notify_notification_new_with_status_icon (summary,
+                                              body,
+                                              "preferences-desktop-remote-desktop",
+                                              GTK_STATUS_ICON (icon));
+#endif
 
   g_free (body);
 
diff --git a/server/vino-status-tube-icon.c b/server/vino-status-tube-icon.c
index 2e84d51..473458b 100644
--- a/server/vino-status-tube-icon.c
+++ b/server/vino-status-tube-icon.c
@@ -405,7 +405,12 @@ vino_status_tube_icon_show_notif (VinoStatusTubeIcon *icon,
       filename = "stock_person";
 
   icon->priv->new_client_notification =
+#ifdef VINO_HAS_LIBNOTIFY_0_7
       notify_notification_new (summary, body, filename);
+#else
+      notify_notification_new_with_status_icon (summary, body,
+      filename, GTK_STATUS_ICON (icon));
+#endif
 
   notify_notification_set_timeout (icon->priv->new_client_notification,
       NOTIFICATION_TIMEOUT * 1000);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]