[gnome-panel] applet-info: make reason non-optional parameter



commit 599dd93a51c39a2fe70ac9b8af60f4535168845e
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Wed Oct 14 23:33:21 2020 +0300

    applet-info: make reason non-optional parameter

 libgnome-panel/gp-applet-info.h |  6 +++---
 libgnome-panel/gp-module.c      | 12 +++++++++++-
 2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/libgnome-panel/gp-applet-info.h b/libgnome-panel/gp-applet-info.h
index 266ee860d..180a8d77d 100644
--- a/libgnome-panel/gp-applet-info.h
+++ b/libgnome-panel/gp-applet-info.h
@@ -67,11 +67,11 @@ typedef void  (* GpAboutDialogFunc) (GtkAboutDialog *dialog);
 /**
  * GpIsDisabledFunc:
  * @flags: a #GpLockdownFlags with active lockdowns
- * @reason: (out) (transfer full) (allow-none): return location for reason, or %NULL
+ * @reason: (out) (transfer full): return location for reason
  *
  * This function must return %TRUE if applet must be fully disabled (applet
- * will not be loaded not user will be able to add it to panel). Function also
- * should return reason why applet is disabled if @reason is not %NULL.
+ * will not be loaded nor user will be able to add it to panel). Function also
+ * should return reason why applet is disabled.
  *
  * If applet is usable with some active lockdowns it should return %FALSE and
  * use #GpApplet:lockdows property to adjust behaviour/functionality.
diff --git a/libgnome-panel/gp-module.c b/libgnome-panel/gp-module.c
index a4a29c031..5c0187b08 100644
--- a/libgnome-panel/gp-module.c
+++ b/libgnome-panel/gp-module.c
@@ -673,6 +673,8 @@ gp_module_is_applet_disabled (GpModule         *module,
                               char            **reason)
 {
   GpAppletInfo *info;
+  char *local_reason;
+  gboolean is_disabled;
 
   g_return_val_if_fail (reason == NULL || *reason == NULL, FALSE);
 
@@ -703,5 +705,13 @@ gp_module_is_applet_disabled (GpModule         *module,
       g_strfreev (backends);
     }
 
-  return info->is_disabled_func (lockdowns, reason);
+  local_reason = NULL;
+  is_disabled = info->is_disabled_func (lockdowns, &local_reason);
+
+  if (reason != NULL)
+    *reason = local_reason;
+  else
+    g_free (local_reason);
+
+  return is_disabled;
 }


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