[gnome-panel] libgnome-panel: add gp_module_get_vtable



commit 585728ef18fb7fae5930c211a6dc36d3f9aacc87
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Oct 27 21:01:12 2016 +0300

    libgnome-panel: add gp_module_get_vtable

 libgnome-panel/gp-module.h |  144 ++++++--------------------------------------
 1 files changed, 19 insertions(+), 125 deletions(-)
---
diff --git a/libgnome-panel/gp-module.h b/libgnome-panel/gp-module.h
index 0be4bab..c5b59e5 100644
--- a/libgnome-panel/gp-module.h
+++ b/libgnome-panel/gp-module.h
@@ -41,79 +41,26 @@ G_BEGIN_DECLS
 #define GP_MODULE_ABI_VERSION 0x0001
 
 /**
- * GpModuleGetInfo:
+ * GpModuleVTable:
+ * @get_module_info: (transfer full): returns a #GpModuleInfo
+ * @get_applet_info: (transfer full): returns a #GpAppletInfo.
+ * @get_applet_type: returns a #GType.
+ * @setup_about: Function for setting up about dialog.
  *
- * Each module must have a function gp_module_get_info() with this
- * prototype.
- *
- * Use gp_module_info_new() to create return value.
- *
- * Returns: (transfer full): a newly created #GpModuleInfo.
- */
-typedef GpModuleInfo *(* GpModuleGetInfo)       (void);
-
-/**
- * GpModuleLoad:
- * @module: a #GTypeModule
- *
- * Each module must have a function gp_module_load() with this prototype.
- *
- * This function is run after the module has been loaded. Typically, this
- * function will register applet types and setup gettext.
+ * The #GpModuleVTable provides the functions required by the #GpModule.
  */
-typedef void          (* GpModuleLoad)          (GTypeModule    *module);
+typedef struct _GpModuleVTable GpModuleVTable;
+struct _GpModuleVTable
+{
+  GpModuleInfo * (* get_module_info) (void);
 
-/**
- * GpModuleUnload:
- * @module: a #GTypeModule
- *
- * Each module must have a function gp_module_unload() with this prototype.
- *
- * This function is run when the module is being unloaded.
- */
-typedef void          (* GpModuleUnload)        (GTypeModule    *module);
-
-/**
- * GpModuleGetAppletInfo:
- * @applet: the applet id
- *
- * Each module must have a function gp_module_get_applet_info() with this
- * prototype.
- *
- * This function will be called to get #GpAppletInfo about all applets
- * that was returned from gp_module_get_info().
- *
- * Use gp_applet_info_new() to create return value.
- *
- * Returns: (transfer full): a newly created #GpAppletInfo.
- */
-typedef GpAppletInfo *(* GpModuleGetAppletInfo) (const gchar    *applet);
+  GpAppletInfo * (* get_applet_info) (const gchar    *applet);
 
-/**
- * GpModuleGetAppletType:
- * @applet: the applet id
- *
- * Each module must have a function gp_module_get_applet_type() with this
- * prototype.
- *
- * This function will be called to get #GType for requested applet.
- *
- * Returns: a previously registered #GType.
- */
-typedef GType         (* GpModuleGetAppletType) (const gchar    *applet);
+  GType          (* get_applet_type) (const gchar    *applet);
 
-/**
- * GpModuleSetupAbout:
- * @dialog: a #GtkAboutDialog
- * @applet: the applet id
- *
- * Each module might have a optional function gp_module_setup_about()
- * with this prototype.
- *
- * Returns: %TRUE if dialog is ready, %FALSE otherwise.
- */
-typedef gboolean      (* GpModuleSetupAbout)    (GtkAboutDialog *dialog,
-                                                 const gchar    *applet);
+  gboolean       (* setup_about)     (GtkAboutDialog *dialog,
+                                      const gchar    *applet);
+};
 
 /**
  * gp_module_get_abi_version:
@@ -123,68 +70,15 @@ typedef gboolean      (* GpModuleSetupAbout)    (GtkAboutDialog *dialog,
  *
  * Returns: the module ABI version.
  */
-guint32       gp_module_get_abi_version (void);
+guint32 gp_module_get_abi_version (void);
 
 /**
- * gp_module_get_info:
- * @abi_version: (out): return location for module ABI version
- *
- * Required API for GNOME Panel modules to implement, see %GpModuleGetInfo.
- *
- * Returns: (transfer full): a newly created #GpModuleInfo.
- */
-GpModuleInfo *gp_module_get_info        (guint32        *abi_version);
-
-/**
- * gp_module_load:
- * @module: a #GTypeModule
+ * gp_module_get_vtable:
+ * @vtable: (out caller-allocates): return location for the #GpModuleVTable
  *
  * Required API for GNOME Panel modules to implement.
  */
-void          gp_module_load            (GTypeModule    *module);
-
-/**
- * gp_module_unload:
- * @module: a #GTypeModule
- *
- * Required API for GNOME Panel modules to implement.
- */
-void          gp_module_unload          (GTypeModule    *module);
-
-/**
- * gp_module_get_applet_info:
- * @applet: the applet id
- *
- * Required API for GNOME Panel modules to implement, see
- * %GpModuleGetAppletInfo.
- *
- * Returns: (transfer full): a newly created #GpAppletInfo.
- */
-GpAppletInfo *gp_module_get_applet_info (const gchar    *applet);
-
-/**
- * gp_module_get_applet_type:
- * @applet: the applet id
- *
- * Required API for GNOME Panel modules to implement, see
- * %GpModuleGetAppletType.
- *
- * Returns: a previously registered #GType.
- */
-GType         gp_module_get_applet_type (const gchar    *applet);
-
-/**
- * gp_module_setup_about:
- * @dialog: a #GtkAboutDialog
- * @applet: the applet id
- *
- * Optional API for GNOME Panel modules to implement, see
- * %GpModuleSetupAbout.
- *
- * Returns: %TRUE if dialog is ready, %FALSE otherwise.
- */
-gboolean      gp_module_setup_about     (GtkAboutDialog *dialog,
-                                         const gchar    *applet);
+void    gp_module_get_vtable      (GpModuleVTable *vtable);
 
 G_END_DECLS
 


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