From 9a2a46d3622863c8d83aa46a884d1cc1f90bfb84 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Wed, 27 Feb 2013 13:14:29 +0100 Subject: Use libnotify instead of libmatenofity --- README | 2 +- configure.ac | 34 +++---- sensors-applet/Makefile.am | 14 +-- sensors-applet/active-sensor-libmatenotify.c | 113 ---------------------- sensors-applet/active-sensor-libmatenotify.h | 35 ------- sensors-applet/active-sensor-libnotify.c | 111 ++++++++++++++++++++++ sensors-applet/active-sensor-libnotify.h | 34 +++++++ sensors-applet/active-sensor.h | 8 +- sensors-applet/config.h.in | 134 --------------------------- sensors-applet/prefs-dialog.c | 8 +- sensors-applet/prefs-dialog.h | 2 +- sensors-applet/sensors-applet.c | 47 +++------- sensors-applet/sensors-applet.h | 8 +- 13 files changed, 197 insertions(+), 353 deletions(-) delete mode 100644 sensors-applet/active-sensor-libmatenotify.c delete mode 100644 sensors-applet/active-sensor-libmatenotify.h create mode 100644 sensors-applet/active-sensor-libnotify.c create mode 100644 sensors-applet/active-sensor-libnotify.h delete mode 100644 sensors-applet/config.h.in diff --git a/README b/README index ef74c2e..e151266 100644 --- a/README +++ b/README @@ -31,7 +31,7 @@ given command at given repeated intervals. MATE HIG v2.0 compliant -libmatenotify[8] support for alarm conditions +libnotify[8] support for alarm conditions The icons bundled as part of MATE Sensors Applet were created by epicbard[9], and are released under the Creative Commons Attribution diff --git a/configure.ac b/configure.ac index 97dd65f..0000bb4 100644 --- a/configure.ac +++ b/configure.ac @@ -49,7 +49,7 @@ AC_CHECK_HEADERS( GLIB_REQUIRED=2.26.0 GTK_REQUIRED=2.14.0 LIBPANEL_REQUIRED=1.1.0 -LIBMATENOTIFY_REQUIRED=1.1.0 +LIBNOTIFY_REQUIRED=0.7.0 LIBCAIRO_REQUIRED=1.0.4 LIBDBUSGLIB_REQUIRED=0.80 LIBATASMART_REQUIRED=0.16 @@ -92,34 +92,34 @@ fi AM_CONDITIONAL(UDISKS, test -n "$DBUSGLIB_CFLAGS" -a -n "$LIBATASMART_CFLAGS") -# support for libmatenotify -LIBMATENOTIFY_CFLAGS= -LIBMATENOTIFY_LIBS= +# support for libnotify +LIBNOTIFY_CFLAGS= +LIBNOTIFY_LIBS= # enable support even if not specifically asked for -AC_ARG_ENABLE(libmatenotify, -[ --enable-libmatenotify Enable libmatenotify support], [ - enable_libmatenotify=$enableval], [ - enable_libmatenotify="yes" +AC_ARG_ENABLE(libnotify, +[ --enable-libnotify Enable libnotify support], [ + enable_libnotify=$enableval], [ + enable_libnotify="yes" ]) -if test "x$enable_libmatenotify" = "xno" +if test "x$enable_libnotify" = "xno" then - echo "Disabling libmatenotify support" + echo "Disabling libnotify support" else - PKG_CHECK_MODULES(LIBMATENOTIFY, libmatenotify >= $LIBMATENOTIFY_REQUIRED, - HAVE_LIBMATENOTIFY="yes", HAVE_LIBMATENOTIFY="no") + PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED, + HAVE_LIBNOTIFY="yes", HAVE_LIBNOTIFY="no") - if test "x$HAVE_LIBMATENOTIFY" = "xyes" + if test "x$HAVE_LIBNOTIFY" = "xyes" then - AC_DEFINE(HAVE_LIBMATENOTIFY, 1, [libmatenotify available]) + AC_DEFINE(HAVE_LIBNOTIFY, 1, [libnotify available]) fi fi -AM_CONDITIONAL(LIBMATENOTIFY, test -n "$LIBMATENOTIFY_LIBS") +AM_CONDITIONAL(LIBNOTIFY, test -n "$LIBNOTIFY_LIBS") -AC_SUBST(LIBMATENOTIFY_CFLAGS) -AC_SUBST(LIBMATENOTIFY_LIBS) +AC_SUBST(LIBNOTIFY_CFLAGS) +AC_SUBST(LIBNOTIFY_LIBS) # allow user to specify libsensors support, but support it anyway if possible diff --git a/sensors-applet/Makefile.am b/sensors-applet/Makefile.am index 367f96c..4bc2fe3 100644 --- a/sensors-applet/Makefile.am +++ b/sensors-applet/Makefile.am @@ -12,16 +12,16 @@ INCLUDES = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DPREFIX=\""$(prefix)"\" \ -I$(top_srcdir) \ - $(GLIB_CFLAGS) $(GTK_CFLAGS) $(MATE_CFLAGS) $(CAIRO_CFLAGS) $(LIBMATENOTIFY_CFLAGS) + $(GLIB_CFLAGS) $(GTK_CFLAGS) $(MATE_CFLAGS) $(CAIRO_CFLAGS) $(LIBNOTIFY_CFLAGS) -LIBS = $(GLIB_LIBS) $(GTK_LIBS) $(MATE_LIBS) $(CAIRO_LIBS) $(LIBMATENOTIFY_LIBS) +LIBS = $(GLIB_LIBS) $(GTK_LIBS) $(MATE_LIBS) $(CAIRO_LIBS) $(LIBNOTIFY_LIBS) -if LIBMATENOTIFY -libmatenotify_SRC = active-sensor-libmatenotify.c \ - active-sensor-libmatenotify.h +if LIBNOTIFY +libnotify_SRC = active-sensor-libnotify.c \ + active-sensor-libnotify.h else -libmatenotify_SRC = +libnotify_SRC = endif libexec_PROGRAMS = mate-sensors-applet @@ -41,7 +41,7 @@ mate_sensors_applet_SOURCES = main.c \ sensors-applet-plugins.h \ sensors-applet-settings.c \ sensors-applet-settings.h \ - $(libmatenotify_SRC) + $(libnotify_SRC) mate_sensors_applet_LDADD = -ldl diff --git a/sensors-applet/active-sensor-libmatenotify.c b/sensors-applet/active-sensor-libmatenotify.c deleted file mode 100644 index fafc500..0000000 --- a/sensors-applet/active-sensor-libmatenotify.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2005-2009 Alex Murray - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#ifdef HAVE_LIBMATENOTIFY -#include -#endif - -#include "active-sensor-libmatenotify.h" - -static void notif_closed_cb(NotifyNotification *notification, - ActiveSensor *active_sensor) -{ - g_assert(notification != NULL && active_sensor != NULL); - - int i; - - g_debug("Notification was closed.. setting reference to NULL so we can show again if needed."); - - // set notif reference to NULL - for (i = 0; i < NUM_NOTIFS; i++) { - if (active_sensor->notification[i] == notification) { - active_sensor->notification[i] = NULL; - break; - } - } -} - - -void active_sensor_libmatenotify_notify_end(ActiveSensor *active_sensor, - NotifType notif_type) { - GError *error = NULL; - if (active_sensor->notification[notif_type]) { - g_debug("Closing notification"); - if(!notify_notification_close(active_sensor->notification[notif_type], - &error)) { - g_warning("Error closing notification: %s", error->message); - g_error_free(error); - } - g_object_unref(active_sensor->notification[notif_type]); - active_sensor->notification[notif_type] = NULL; - } -} - -void active_sensor_libmatenotify_notify(ActiveSensor *active_sensor, - NotifType notif_type, - const gchar *summary, - const gchar *message, - const gchar *icon_filename, - gint timeout_msecs, - GtkWidget *attach) { - GError *error = NULL; - - if (!notify_is_initted()) { - if (!notify_init(PACKAGE)) { - return; - } - } - g_debug("Doing notification %s: %s: %s", (notif_type == SENSOR_INTERFACE_ERROR ? "interface-error" : "other") ,summary, message); - - /* leave any existing notification since most likely hasn't changed */ - if (active_sensor->notification[notif_type] != NULL) { - return; -/* active_sensor_libmatenotify_notify_end(active_sensor, notif_type); */ - } - - /* now create a new one */ - g_debug("Creating new notification"); - active_sensor->notification[notif_type] = notify_notification_new(summary, - message, - icon_filename, - attach); - g_signal_connect(active_sensor->notification[notif_type], "closed", - G_CALLBACK(notif_closed_cb), - active_sensor); - - notify_notification_set_urgency(active_sensor->notification[notif_type], - NOTIFY_URGENCY_CRITICAL); - - - /* timeout may have changed so update it */ - notify_notification_set_timeout(active_sensor->notification[notif_type], - timeout_msecs); - - - g_debug("showing notification"); - if (!notify_notification_show(active_sensor->notification[notif_type], &error)) { - g_debug("Error showing notification: %s", error->message); - g_error_free(error); - } - - - -} - diff --git a/sensors-applet/active-sensor-libmatenotify.h b/sensors-applet/active-sensor-libmatenotify.h deleted file mode 100644 index 6587dea..0000000 --- a/sensors-applet/active-sensor-libmatenotify.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2005-2009 Alex Murray - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef ACTIVE_SESNOR_LIBMATENOTIFY_H -#define ACTIVE_SENSOR_LIBMATENOTIFY_H - -#include "sensors-applet.h" -#include "active-sensor.h" - -void active_sensor_libmatenotify_notify(ActiveSensor *active_sensor, - NotifType notif_type, - const gchar *summary, - const gchar *message, - const gchar *icon_filename, - gint timeout_msecs, - GtkWidget *attach); -void active_sensor_libmatenotify_notify_end(ActiveSensor *active_sensor, - NotifType notif_type); - -#endif /* SENSORS_APPLET_LIBMATENOTIFY_H */ diff --git a/sensors-applet/active-sensor-libnotify.c b/sensors-applet/active-sensor-libnotify.c new file mode 100644 index 0000000..a0a5981 --- /dev/null +++ b/sensors-applet/active-sensor-libnotify.c @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2005-2009 Alex Murray + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* HAVE_CONFIG_H */ + +#ifdef HAVE_LIBNOTIFY +#include +#endif + +#include "active-sensor-libnotify.h" + +static void notif_closed_cb(NotifyNotification *notification, + ActiveSensor *active_sensor) +{ + g_assert(notification != NULL && active_sensor != NULL); + + int i; + + g_debug("Notification was closed.. setting reference to NULL so we can show again if needed."); + + // set notif reference to NULL + for (i = 0; i < NUM_NOTIFS; i++) { + if (active_sensor->notification[i] == notification) { + active_sensor->notification[i] = NULL; + break; + } + } +} + + +void active_sensor_libnotify_notify_end(ActiveSensor *active_sensor, + NotifType notif_type) { + GError *error = NULL; + if (active_sensor->notification[notif_type]) { + g_debug("Closing notification"); + if(!notify_notification_close(active_sensor->notification[notif_type], + &error)) { + g_warning("Error closing notification: %s", error->message); + g_error_free(error); + } + g_object_unref(active_sensor->notification[notif_type]); + active_sensor->notification[notif_type] = NULL; + } +} + +void active_sensor_libnotify_notify(ActiveSensor *active_sensor, + NotifType notif_type, + const gchar *summary, + const gchar *message, + const gchar *icon_filename, + gint timeout_msecs) { + GError *error = NULL; + + if (!notify_is_initted()) { + if (!notify_init(PACKAGE)) { + return; + } + } + g_debug("Doing notification %s: %s: %s", (notif_type == SENSOR_INTERFACE_ERROR ? "interface-error" : "other") ,summary, message); + + /* leave any existing notification since most likely hasn't changed */ + if (active_sensor->notification[notif_type] != NULL) { + return; +/* active_sensor_libnotify_notify_end(active_sensor, notif_type); */ + } + + /* now create a new one */ + g_debug("Creating new notification"); + active_sensor->notification[notif_type] = notify_notification_new(summary, + message, + icon_filename); + g_signal_connect(active_sensor->notification[notif_type], "closed", + G_CALLBACK(notif_closed_cb), + active_sensor); + + notify_notification_set_urgency(active_sensor->notification[notif_type], + NOTIFY_URGENCY_CRITICAL); + + + /* timeout may have changed so update it */ + notify_notification_set_timeout(active_sensor->notification[notif_type], + timeout_msecs); + + + g_debug("showing notification"); + if (!notify_notification_show(active_sensor->notification[notif_type], &error)) { + g_debug("Error showing notification: %s", error->message); + g_error_free(error); + } + + + +} + diff --git a/sensors-applet/active-sensor-libnotify.h b/sensors-applet/active-sensor-libnotify.h new file mode 100644 index 0000000..d2c2173 --- /dev/null +++ b/sensors-applet/active-sensor-libnotify.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2005-2009 Alex Murray + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef ACTIVE_SESNOR_LIBNOTIFY_H +#define ACTIVE_SENSOR_LIBNOTIFY_H + +#include "sensors-applet.h" +#include "active-sensor.h" + +void active_sensor_libnotify_notify(ActiveSensor *active_sensor, + NotifType notif_type, + const gchar *summary, + const gchar *message, + const gchar *icon_filename, + gint timeout_msecs); +void active_sensor_libnotify_notify_end(ActiveSensor *active_sensor, + NotifType notif_type); + +#endif /* SENSORS_APPLET_LIBNOTIFY_H */ diff --git a/sensors-applet/active-sensor.h b/sensors-applet/active-sensor.h index ba4e01f..7258515 100644 --- a/sensors-applet/active-sensor.h +++ b/sensors-applet/active-sensor.h @@ -19,9 +19,9 @@ #ifndef ACTIVE_SENSOR_H #define ACTIVE_SENSOR_H -#ifdef HAVE_LIBMATENOTIFY -#include -#include "active-sensor-libmatenotify.h" +#ifdef HAVE_LIBNOTIFY +#include +#include "active-sensor-libnotify.h" #endif #include "sensors-applet.h" @@ -40,7 +40,7 @@ struct _ActiveSensor { GtkTreeRowReference *sensor_row; -#ifdef HAVE_LIBMATENOTIFY +#ifdef HAVE_LIBNOTIFY NotifyNotification *notification[NUM_NOTIFS]; #endif diff --git a/sensors-applet/config.h.in b/sensors-applet/config.h.in deleted file mode 100644 index a5d04de..0000000 --- a/sensors-applet/config.h.in +++ /dev/null @@ -1,134 +0,0 @@ -/* sensors-applet/config.h.in. Generated from configure.ac by autoheader. */ - -/* aticonfig executable */ -#undef ATICONFIG_EXE - -/* always defined to indicate that i18n is enabled */ -#undef ENABLE_NLS - -/* Package name for gettext */ -#undef GETTEXT_PACKAGE - -/* Define to 1 if you have the header file. */ -#undef HAVE_ARPA_INET_H - -/* using aticonfig */ -#undef HAVE_ATICONFIG - -/* Define to 1 if you have the `bind_textdomain_codeset' function. */ -#undef HAVE_BIND_TEXTDOMAIN_CODESET - -/* Define to 1 if you have the `dcgettext' function. */ -#undef HAVE_DCGETTEXT - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define if the GNU gettext() function is already present or preinstalled. */ -#undef HAVE_GETTEXT - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define if your file defines LC_MESSAGES. */ -#undef HAVE_LC_MESSAGES - -/* libmatenotify available */ -#undef HAVE_LIBMATENOTIFY - -/* libsensors is available */ -#undef HAVE_LIBSENSORS - -/* Define to 1 if you have the header file. */ -#undef HAVE_LOCALE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NVCTRL_NVCTRLLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NVCTRL_NVCTRL_H - -/* nvidia sensors available */ -#undef HAVE_NVIDIA - -/* Define to 1 if you have the header file. */ -#undef HAVE_REGEX_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SENSORS_SENSORS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_IOCTL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_X11_XLIB_H - -/* Define to 1 if you have the <\> header file. */ -#undef HAVE__ - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION diff --git a/sensors-applet/prefs-dialog.c b/sensors-applet/prefs-dialog.c index 386af34..89e4b49 100644 --- a/sensors-applet/prefs-dialog.c +++ b/sensors-applet/prefs-dialog.c @@ -193,7 +193,7 @@ static void prefs_dialog_temperature_scale_changed(GtkComboBox *temperature_scal } -#ifdef HAVE_LIBMATENOTIFY +#ifdef HAVE_LIBNOTIFY static void prefs_dialog_display_notifications_toggled(GtkCheckButton *display_notifications, PrefsDialog *prefs_dialog) { @@ -610,7 +610,7 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) { G_CALLBACK(prefs_dialog_timeout_changed), prefs_dialog); -#ifdef HAVE_LIBMATENOTIFY +#ifdef HAVE_LIBNOTIFY header_text = g_markup_printf_escaped("%s", _("Notifications")); prefs_dialog->notifications_header = g_object_new(GTK_TYPE_LABEL, "use-markup", TRUE, @@ -654,7 +654,7 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) { prefs_dialog->globals_table = g_object_new(GTK_TYPE_TABLE, "homogeneous", FALSE, "n-columns", 3, -#ifdef HAVE_LIBMATENOTIFY +#ifdef HAVE_LIBNOTIFY "n-rows", 9, #else "n-rows", 7, @@ -774,7 +774,7 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) { 0); -#ifdef HAVE_LIBMATENOTIFY +#ifdef HAVE_LIBNOTIFY gtk_table_attach(prefs_dialog->globals_table, GTK_WIDGET(prefs_dialog->notifications_header), 0, 2, diff --git a/sensors-applet/prefs-dialog.h b/sensors-applet/prefs-dialog.h index beb0db6..9ff6525 100644 --- a/sensors-applet/prefs-dialog.h +++ b/sensors-applet/prefs-dialog.h @@ -38,7 +38,7 @@ typedef struct { GtkLabel *timeout_label, *display_mode_label, *layout_mode_label, *temperature_scale_label, *graph_size_label, *update_header, *display_header; GtkAdjustment *timeout_adjust, *graph_size_adjust; -#ifdef HAVE_LIBMATENOTIFY +#ifdef HAVE_LIBNOTIFY GtkCheckButton *display_notifications; GtkLabel *notifications_header; #endif diff --git a/sensors-applet/sensors-applet.c b/sensors-applet/sensors-applet.c index 9dcea39..ae5616d 100644 --- a/sensors-applet/sensors-applet.c +++ b/sensors-applet/sensors-applet.c @@ -36,8 +36,8 @@ #include "sensors-applet-settings.h" #include "sensors-applet-plugins.h" -#ifdef HAVE_LIBMATENOTIFY -#include "active-sensor-libmatenotify.h" +#ifdef HAVE_LIBNOTIFY +#include "active-sensor-libnotify.h" #define DEFAULT_NOTIFY_TIMEOUT 3000 #endif @@ -268,7 +268,7 @@ static const GtkActionEntry sensors_applet_menu_actions[] = { G_CALLBACK(about_cb) } }; -#ifdef HAVE_LIBMATENOTIFY +#ifdef HAVE_LIBNOTIFY static void notif_closed_cb(NotifyNotification *notification, SensorsApplet *sensors_applet) { @@ -276,14 +276,12 @@ static void notif_closed_cb(NotifyNotification *notification, sensors_applet->notification = NULL; } -#endif // HAVE_LIBMATENOTIFY +#endif // HAVE_LIBNOTIFY void sensors_applet_notify_active_sensor(ActiveSensor *active_sensor, NotifType notif_type) { -#ifdef HAVE_LIBMATENOTIFY +#ifdef HAVE_LIBNOTIFY SensorsApplet *sensors_applet; - GList *table_children; - GtkWidget *attach = NULL; gchar *summary, *message; gint timeout_msecs; gchar *sensor_label; @@ -305,23 +303,7 @@ void sensors_applet_notify_active_sensor(ActiveSensor *active_sensor, NotifType g_debug("Wanted to display notification, but user has disabled them"); return; } - - table_children = gtk_container_get_children(GTK_CONTAINER(sensors_applet->table)); - - if (g_list_find(table_children, active_sensor->icon)) { - attach = GTK_WIDGET(active_sensor->icon); - } else if (g_list_find(table_children, active_sensor->label)) { - attach = GTK_WIDGET(active_sensor->label); - } else if (g_list_find(table_children, active_sensor->value)) { - attach = GTK_WIDGET(active_sensor->value); - } else if (g_list_find(table_children, active_sensor->graph)) { - attach = GTK_WIDGET(active_sensor->graph); - } else { - g_warning("Wanted to do notify for a sensor which has no elements in the table!!!"); - return; - } - g_list_free(table_children); - + path = gtk_tree_row_reference_get_path(active_sensor->sensor_row); if (gtk_tree_model_get_iter(GTK_TREE_MODEL(sensors_applet->sensors), &iter, path)) { @@ -415,13 +397,12 @@ void sensors_applet_notify_active_sensor(ActiveSensor *active_sensor, NotifType g_assert_not_reached(); } - active_sensor_libmatenotify_notify(active_sensor, + active_sensor_libnotify_notify(active_sensor, notif_type, summary, message, GTK_STOCK_DIALOG_WARNING, - timeout_msecs, - attach); + timeout_msecs); g_free(sensor_path); g_free(sensor_label); @@ -432,21 +413,21 @@ void sensors_applet_notify_active_sensor(ActiveSensor *active_sensor, NotifType void sensors_applet_notify_end(ActiveSensor *active_sensor, NotifType notif_type) { -#ifdef HAVE_LIBMATENOTIFY - active_sensor_libmatenotify_notify_end(active_sensor, notif_type); +#ifdef HAVE_LIBNOTIFY + active_sensor_libnotify_notify_end(active_sensor, notif_type); #endif } -#ifdef HAVE_LIBMATENOTIFY +#ifdef HAVE_LIBNOTIFY static void sensors_applet_notify_end_all_gfunc(ActiveSensor *active_sensor, gpointer data) { - active_sensor_libmatenotify_notify_end(active_sensor, LOW_ALARM); - active_sensor_libmatenotify_notify_end(active_sensor, HIGH_ALARM); + active_sensor_libnotify_notify_end(active_sensor, LOW_ALARM); + active_sensor_libnotify_notify_end(active_sensor, HIGH_ALARM); } #endif void sensors_applet_notify_end_all(SensorsApplet *sensors_applet) { -#ifdef HAVE_LIBMATENOTIFY +#ifdef HAVE_LIBNOTIFY g_list_foreach(sensors_applet->active_sensors, (GFunc)sensors_applet_notify_end_all_gfunc, NULL); diff --git a/sensors-applet/sensors-applet.h b/sensors-applet/sensors-applet.h index 0cd35ec..fda92b5 100644 --- a/sensors-applet/sensors-applet.h +++ b/sensors-applet/sensors-applet.h @@ -27,8 +27,8 @@ #include "config.h" #endif /* HAVE_CONFIG_H */ -#ifdef HAVE_LIBMATENOTIFY -#include +#ifdef HAVE_LIBNOTIFY +#include #endif typedef struct _ActiveSensor ActiveSensor; @@ -138,9 +138,9 @@ struct _SensorsApplet { GSettings *settings; -#ifdef HAVE_LIBMATENOTIFY +#ifdef HAVE_LIBNOTIFY NotifyNotification *notification; -#endif // HAVE_LIBMATENOTIFY +#endif // HAVE_LIBNOTIFY }; -- cgit v1.2.1