[Xfce4-commits] <xfce4-sensors-plugin:master> try to suppotr both libnotify 0.5 and >=0.7 at once
Fabian
noreply at xfce.org
Fri May 6 00:08:01 CEST 2011
Updating branch refs/heads/master
to b45106e3439f041fc417a7fd84023991745f3487 (commit)
from 0663f49c3955d538b108977e3a44c83ed3d30a62 (commit)
commit b45106e3439f041fc417a7fd84023991745f3487
Author: Fabian <timystery at arcor.de>
Date: Thu May 5 23:09:07 2011 +0200
try to suppotr both libnotify 0.5 and >=0.7 at once
configure.in.in | 16 ++++++++++++----
include/sensors-interface-plugin.h | 2 ++
lib/Makefile.am | 14 ++++++++++----
lib/configuration.c | 2 +-
lib/hddtemp.c | 25 ++++++++++++++++---------
lib/sensors-interface.c | 15 ++++++++++-----
panel-plugin/Makefile.am | 18 +-----------------
panel-plugin/sensors-plugin.c | 2 ++
8 files changed, 54 insertions(+), 40 deletions(-)
diff --git a/configure.in.in b/configure.in.in
index bd48ec6..bd700e3 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -334,11 +334,15 @@ dnl **************************************
dnl *** Check for notification library ***
dnl **************************************
dnl XDT_CHECK_PACKAGE([LIBNOTIFY], [libnotify], [0.4.0])
-XDT_CHECK_OPTIONAL_PACKAGE([LIBNOTIFY],
+XDT_CHECK_OPTIONAL_PACKAGE([LIBNOTIFY4],
[libnotify],
[0.4], [notification],
- [notification message library])
+ [notification message library < 0.7])
+XDT_CHECK_OPTIONAL_PACKAGE([LIBNOTIFY7],
+ [libnotify],
+ [0.7], [notification],
+ [notification message library >= 0.7])
dnl **************************************
dnl *** Check for Xfce packages ***
@@ -410,8 +414,12 @@ if test x"$enable_xnvctrl" = x"yes"; then
echo "* NVIDIA X CTRL"
fi
echo
-if test x"$LIBNOTIFY_FOUND" = x"yes"; then
-echo "Support for libnotify will be built in."
+if test x"$LIBNOTIFY4_FOUND" = x"yes"; then
+echo "Support for libnotify < 0.7 will be built in."
+echo
+fi
+if test x"$LIBNOTIFY7_FOUND" = x"yes"; then
+echo "Support for libnotify >= 0.7 will be built in."
echo
fi
if test x"$enable_debug" = x"yes"; then
diff --git a/include/sensors-interface-plugin.h b/include/sensors-interface-plugin.h
index cc4cee2..09f4f88 100644
--- a/include/sensors-interface-plugin.h
+++ b/include/sensors-interface-plugin.h
@@ -62,7 +62,9 @@ typedef struct {
/* font size for display in panel */
gchar *font_size;
gint font_size_numerical;
+/*
gchar *font;
+*/
/* temperature scale for display in panel */
t_tempscale scale;
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 25febc7..eeb9926 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -47,8 +47,11 @@ if HAVE_NVIDIA
libxfce4sensors_la_CFLAGS += @NVIDIA_CFLAGS@
endif
-if HAVE_LIBNOTIFY
-libxfce4sensors_la_CFLAGS += @LIBNOTIFY_CFLAGS@
+if HAVE_LIBNOTIFY4
+libxfce4sensors_la_CFLAGS += @LIBNOTIFY4_CFLAGS@
+endif
+if HAVE_LIBNOTIFY7
+libxfce4sensors_la_CFLAGS += @LIBNOTIFY7_CFLAGS@
endif
libxfce4sensors_la_LDFLAGS = \
@@ -68,8 +71,11 @@ if HAVE_NVIDIA
libxfce4sensors_la_LIBADD += @NVIDIA_LIBS@
endif
-if HAVE_LIBNOTIFY
-libxfce4sensors_la_LIBADD += @LIBNOTIFY_LIBS@
+if HAVE_LIBNOTIFY4
+libxfce4sensors_la_LIBADD += @LIBNOTIFY4_LIBS@
+endif
+if HAVE_LIBNOTIFY7
+libxfce4sensors_la_LIBADD += @LIBNOTIFY7_LIBS@
endif
EXTRA_DIST = \
diff --git a/lib/configuration.c b/lib/configuration.c
index f2a0a8b..1dcc1b2 100644
--- a/lib/configuration.c
+++ b/lib/configuration.c
@@ -213,7 +213,7 @@ sensors_read_general_config (XfceRc *rc, t_sensors *sensors)
}
if ((value = xfce_rc_read_entry (rc, "Font", NULL)) && *value) {
- font = g_strdup(value);
+ font = g_strdup(value); // in cpu.h for the tachometers
}
sensors->font_size_numerical = xfce_rc_read_int_entry (rc,
diff --git a/lib/hddtemp.c b/lib/hddtemp.c
index ce64adb..0b7b01e 100644
--- a/lib/hddtemp.c
+++ b/lib/hddtemp.c
@@ -45,7 +45,7 @@
#include <gtk/gtkstock.h> */
/* Global includes */
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBNOTIFY4 || HAVE_LIBNOTIFY7
#include <libnotify/notify.h>
#endif
/* #include <stdio.h> */
@@ -79,7 +79,10 @@
/* forward declaration for GCC 4.3 -Wall */
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBNOTIFY4
+void notification_suppress_messages (NotifyNotification *n, gchar *action, gpointer *data);
+#endif
+#ifdef HAVE_LIBNOTIFY7
void notification_suppress_messages (NotifyNotification *n, gchar *action, gpointer *data);
#endif
@@ -92,7 +95,7 @@ void read_disks_fallback (t_chip *chip);
void remove_unmonitored_drives (t_chip *chip, gboolean *suppressmessage);
void populate_detected_drives (t_chip *chip);
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBNOTIFY4 || HAVE_LIBNOTIFY7
void
notification_suppress_messages (NotifyNotification *n, gchar *action, gpointer *data)
{
@@ -114,8 +117,12 @@ void quick_message_notify (gchar *message)
if (!notify_is_initted())
notify_init(PACKAGE); /* NOTIFY_APPNAME */
-
+#ifdef HAVE_LIBNOTIFY4
nn = notify_notification_new (summary, body, icon, NULL);
+#endif
+#ifdef HAVE_LIBNOTIFY7
+ nn = notify_notification_new (summary, body, icon);
+#endif
/* FIXME: Use channels or propagate private object or use static global variable */
//notify_notification_add_action (nn,
//"confirmed",
@@ -192,7 +199,7 @@ gboolean quick_message_with_checkbox (gchar *message, gchar *checkboxtext) {
void quick_message (gchar *message)
{
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBNOTIFY4 || HAVE_LIBNOTIFY7
quick_message_notify (message);
#else
quick_message_dialog (message);
@@ -502,7 +509,7 @@ get_hddtemp_value (char* disk, gboolean *suppressmessage)
gchar *standard_output=NULL, *standard_error=NULL;
gchar *cmd_line=NULL, *msg_text=NULL;
-#ifndef HAVE_LIBNOTIFY
+#ifndef HAVE_LIBNOTIFY4 || HAVE_LIBNOTIFY7
gchar *checktext = NULL;
#endif
gint exit_status=0;
@@ -597,7 +604,7 @@ get_hddtemp_value (char* disk, gboolean *suppressmessage)
"Calling \"%s\" gave the following error:\n%s\nwith a return value of %d.\n"),
PATH_HDDTEMP, cmd_line, standard_error, exit_status);
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBNOTIFY4 || HAVE_LIBNOTIFY7
//msg_text = g_strconcat(msg_text, _("\nYou can disable these notifications in the settings dialog.\n");
quick_message_notify (msg_text);
nevershowagain = FALSE;
@@ -628,7 +635,7 @@ get_hddtemp_value (char* disk, gboolean *suppressmessage)
if (!nevershowagain) {
msg_text = g_strdup_printf (_("An error occurred when executing"
" \"%s\":\n%s"), cmd_line, error->message);
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBNOTIFY4 || HAVE_LIBNOTIFY7
quick_message_notify (msg_text);
nevershowagain = FALSE;
#else
@@ -661,7 +668,7 @@ get_hddtemp_value (char* disk, gboolean *suppressmessage)
g_free (standard_output);
g_free (standard_error);
g_free (msg_text);
-#ifndef HAVE_LIBNOTIFY
+#ifndef HAVE_LIBNOTIFY4 || HAVE_LIBNOTIFY7
g_free (checktext);
#endif
diff --git a/lib/sensors-interface.c b/lib/sensors-interface.c
index b22210f..f72a608 100644
--- a/lib/sensors-interface.c
+++ b/lib/sensors-interface.c
@@ -24,7 +24,7 @@
#endif
/* Global includes */
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBNOTIFY4 || HAVE_LIBNOTIFY7
#include <libnotify/notify.h>
#endif
/* #include <stdlib.h> */
@@ -71,7 +71,7 @@ fill_gtkTreeStore (GtkTreeStore *model, t_chip *chip, t_tempscale scale, t_senso
t_chipfeature *chipfeature;
gboolean *suppress;
GtkTreeIter *iter;
- #ifdef HAVE_LIBNOTIFY
+ #ifdef HAVE_LIBNOTIFY4 || HAVE_LIBNOTIFY7
NotifyNotification *nn;
GError *error = NULL;
#endif
@@ -101,11 +101,16 @@ fill_gtkTreeStore (GtkTreeStore *model, t_chip *chip, t_tempscale scale, t_senso
(chip, chipfeature->address, &sensorFeature, suppress);
if ( res!=0 && !suppress) {
- #ifdef HAVE_LIBNOTIFY
+ #ifdef HAVE_LIBNOTIFY4 || HAVE_LIBNOTIFY7
if (!notify_is_initted())
notify_init(PACKAGE); /* NOTIFY_APPNAME */
-
- nn = notify_notification_new(summary, body, icon, NULL);
+
+#ifdef HAVE_LIBNOTIFY4
+ nn = notify_notification_new (summary, body, icon, NULL);
+#endif
+#ifdef HAVE_LIBNOTIFY7
+ nn = notify_notification_new (summary, body, icon);
+#endif
notify_notification_show(nn, &error);
#else
DBG("%s\n%s", summary, body);
diff --git a/panel-plugin/Makefile.am b/panel-plugin/Makefile.am
index fab88db..d880d7f 100644
--- a/panel-plugin/Makefile.am
+++ b/panel-plugin/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
plugindir = $(libexecdir)/xfce4/panel-plugins
plugin_PROGRAMS = xfce4-sensors-plugin
@@ -7,17 +5,10 @@ INCLUDES = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib
-# -DG_LOG_DOMAIN=\"xfce4-sensors-plugin\" \
-# -DPACKAGE_LOCALE_DIR=\"$(localedir)\"
-
xfce4_sensors_plugin_SOURCES = \
sensors-plugin.c \
sensors-plugin.h
-# types.h
-# middlelayer.c \
-# middlelayer.h
-
xfce4_sensors_plugin_CFLAGS = \
@LIBXFCE4PANEL_CFLAGS@ \
@LIBXFCE4UI_CFLAGS@ \
@@ -25,20 +16,13 @@ xfce4_sensors_plugin_CFLAGS = \
-DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
@LIBSENSORS_CFLAGS@
-# @GTK_CFLAGS@ \
-# @GLIB_CFLAGS@
-
-
xfce4_sensors_plugin_LDADD = \
$(top_builddir)/lib/libxfce4sensors.la \
@LIBXFCE4PANEL_LIBS@ \
@LIBXFCE4UI_LIBS@ \
@SOLLIBS@ \
@LIBSENSORS_LDFLAGS@ \
- @LIBM@
-
-# @GTK_LIBS@ \
-# @GLIB_LIBS@
+ @LIBM@
# .desktop file
#
diff --git a/panel-plugin/sensors-plugin.c b/panel-plugin/sensors-plugin.c
index 1af3173..0d4cab5 100644
--- a/panel-plugin/sensors-plugin.c
+++ b/panel-plugin/sensors-plugin.c
@@ -1085,7 +1085,9 @@ sensors_free (XfcePanelPlugin *plugin, t_sensors *sensors)
g_free (sensors->plugin_config_file);
g_free (sensors->command_name);
+/*
g_free (sensors->font);
+*/
g_free (sensors->font_size);
g_free (sensors);
More information about the Xfce4-commits
mailing list