From e493e98f479c5559adfe2451b6c80bf87318149a Mon Sep 17 00:00:00 2001 From: info-cppsp Date: Sat, 18 Nov 2017 16:24:13 +0100 Subject: Fix indents 06 --- sensors-applet/active-sensor-libnotify.c | 116 ++++++++++++++----------------- 1 file changed, 54 insertions(+), 62 deletions(-) (limited to 'sensors-applet/active-sensor-libnotify.c') diff --git a/sensors-applet/active-sensor-libnotify.c b/sensors-applet/active-sensor-libnotify.c index a0a5981..ce0d07c 100644 --- a/sensors-applet/active-sensor-libnotify.c +++ b/sensors-applet/active-sensor-libnotify.c @@ -27,37 +27,36 @@ #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; - } + 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; + + 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, @@ -66,46 +65,39 @@ void active_sensor_libnotify_notify(ActiveSensor *active_sensor, 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); + GError *error = NULL; - /* 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); */ + if (!notify_is_initted()) { + if (!notify_init(PACKAGE)) { + return; } - - /* 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); - } - - + } + 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); + } } -- cgit v1.2.1