[gnome-panel] libgnome-panel: add gp_module_info_set_applets



commit 6b69816d966c76bb835581d89f11f73ed30a37bd
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Oct 25 17:17:48 2016 +0300

    libgnome-panel: add gp_module_info_set_applets

 libgnome-panel/gp-module-info.c |   26 +++++++++++++++++++-------
 libgnome-panel/gp-module-info.h |   10 ++++++----
 2 files changed, 25 insertions(+), 11 deletions(-)
---
diff --git a/libgnome-panel/gp-module-info.c b/libgnome-panel/gp-module-info.c
index fa509cb..d1d2d20 100644
--- a/libgnome-panel/gp-module-info.c
+++ b/libgnome-panel/gp-module-info.c
@@ -50,7 +50,6 @@ get_applets (va_list args)
  * @id: the id of this module
  * @version: the version of this module
  * @translation_domain: the translation domain or NULL
- * @...: a %NULL-terminated list of applet ids in this module
  *
  * Creates a new #GpModuleInfo.
  *
@@ -59,11 +58,9 @@ get_applets (va_list args)
 GpModuleInfo *
 gp_module_info_new (const gchar *id,
                     const gchar *version,
-                    const gchar *translation_domain,
-                    ...)
+                    const gchar *translation_domain)
 {
   GpModuleInfo *info;
-  va_list args;
 
   info = g_new0 (GpModuleInfo, 1);
 
@@ -71,11 +68,26 @@ gp_module_info_new (const gchar *id,
   info->version = g_strdup (version);
   info->translation_domain = g_strdup (translation_domain);
 
-  va_start (args, translation_domain);
+  return info;
+}
+
+/**
+ * gp_module_info_set_applets:
+ * @info: a #GpModuleInfo
+ * @...: a %NULL-terminated list of applet ids in this module
+ *
+ * Sets the applets available in this module.
+ */
+void
+gp_module_info_set_applets (GpModuleInfo *info,
+                            ...)
+{
+  va_list args;
+
+  va_start (args, info);
+  g_strfreev (info->applets);
   info->applets = get_applets (args);
   va_end (args);
-
-  return info;
 }
 
 void
diff --git a/libgnome-panel/gp-module-info.h b/libgnome-panel/gp-module-info.h
index a37408a..6cf1044 100644
--- a/libgnome-panel/gp-module-info.h
+++ b/libgnome-panel/gp-module-info.h
@@ -29,10 +29,12 @@ G_BEGIN_DECLS
  */
 typedef struct _GpModuleInfo GpModuleInfo;
 
-GpModuleInfo *gp_module_info_new (const gchar *id,
-                                  const gchar *version,
-                                  const gchar *translation_domain,
-                                  ...);
+GpModuleInfo *gp_module_info_new         (const gchar *id,
+                                          const gchar  *version,
+                                          const gchar  *translation_domain);
+
+void          gp_module_info_set_applets (GpModuleInfo *info,
+                                          ...);
 
 G_END_DECLS
 


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