[glib/pgriffis/low-power-monitor] Apply 8 suggestion(s) to 3 file(s)



commit a05ba67033487e67f6b8e6e0188c5f86a2eaeeee
Author: Philip Withnall <philip tecnocode co uk>
Date:   Wed Jul 28 12:46:06 2021 +0000

    Apply 8 suggestion(s) to 3 file(s)

 gio/gpowerprofilemonitor.c        |  7 +++++--
 gio/gpowerprofilemonitor.h        |  2 +-
 gio/tests/power-profile-monitor.c | 10 +++++++---
 3 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/gio/gpowerprofilemonitor.c b/gio/gpowerprofilemonitor.c
index 4c8b312f7..ca2a75c82 100644
--- a/gio/gpowerprofilemonitor.c
+++ b/gio/gpowerprofilemonitor.c
@@ -86,8 +86,11 @@ g_power_profile_monitor_dup_default (void)
 
 /**
  * g_power_profile_monitor_get_power_saver_enabled:
+ * @monitor: a #GPowerProfileMonitor
  *
- * Gets whether the system is in “Power Saver” mode.  * You are expected to listen to the
+ * Gets whether the system is in “Power Saver” mode.
+ *
+ * You are expected to listen to the
  * #GPowerProfileMonitor::notify::power-saver-enabled signal to know when the profile has
  * changed.
  *
@@ -107,7 +110,7 @@ static void
 g_power_profile_monitor_default_init (GPowerProfileMonitorInterface *iface)
 {
   /**
-   * GPowerProfileMonitor::power-saver-enabled:
+   * GPowerProfileMonitor:power-saver-enabled:
    *
    * Whether “Power Saver” mode is enabled on the system.
    *
diff --git a/gio/gpowerprofilemonitor.h b/gio/gpowerprofilemonitor.h
index a2f529d4e..0891fc3dc 100644
--- a/gio/gpowerprofilemonitor.h
+++ b/gio/gpowerprofilemonitor.h
@@ -31,7 +31,7 @@ G_BEGIN_DECLS
 /**
  * G_POWER_PROFILE_MONITOR_EXTENSION_POINT_NAME:
  *
- * Extension point for power_profile usage monitoring functionality.
+ * Extension point for power profile usage monitoring functionality.
  * See [Extending GIO][extending-gio].
  *
  * Since: 2.70
diff --git a/gio/tests/power-profile-monitor.c b/gio/tests/power-profile-monitor.c
index 82044bb37..bb32f181f 100644
--- a/gio/tests/power-profile-monitor.c
+++ b/gio/tests/power-profile-monitor.c
@@ -36,7 +36,7 @@ power_saver_enabled_cb (GPowerProfileMonitor *monitor,
   gboolean enabled;
 
   enabled = g_power_profile_monitor_get_power_saver_enabled (monitor);
-  g_debug ("Power Saver %s (%d)", enabled ? "enabled" : "disabled" , enabled);
+  g_debug ("Power Saver %s (%d)", enabled ? "enabled" : "disabled", enabled);
 }
 
 static void
@@ -44,14 +44,18 @@ do_watch_power_profile (void)
 {
   GPowerProfileMonitor *monitor;
   GMainLoop *loop;
+  gulong signal_id;
 
   monitor = g_power_profile_monitor_dup_default ();
-  g_signal_connect (G_OBJECT (monitor), "notify::power-saver-enabled",
-                   G_CALLBACK (power_saver_enabled_cb), NULL);
+  signal_id = g_signal_connect (G_OBJECT (monitor), "notify::power-saver-enabled",
+                               G_CALLBACK (power_saver_enabled_cb), NULL);
 
   loop = g_main_loop_new (NULL, TRUE);
   g_main_loop_run (loop);
+
+  g_signal_handler_disconnect (monitor, signal_id);
   g_object_unref (monitor);
+  g_main_loop_unref (loop);
 }
 
 int


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