gir: Make use of typedefs for GimpProgressVtable vfuncs

GObject introspection has issues handling random vfuncs (i.e. not part
of a GObject). Most of all, it needs to be able to give these a name
(so they can be used to cast in some higher level languages for
example). As such, give each vfunc in `GimpProgressVtable` a separate
typedef.
This commit is contained in:
Niels De Graef 2020-05-05 19:19:17 +02:00 committed by Jehan
parent 4729fc8dec
commit b680945752
1 changed files with 62 additions and 11 deletions

View File

@ -27,6 +27,62 @@
G_BEGIN_DECLS
/**
* GimpProgressVtableStartFunc:
* @message:
* @cancelable:
* @user_data: (closure):
*
* Starts the progress
*/
typedef void (* GimpProgressVtableStartFunc) (const gchar *message,
gboolean cancelable,
gpointer user_data);
/**
* GimpProgressVtableEndFunc:
* @user_data: (closure):
*
* Ends the progress
*/
typedef void (* GimpProgressVtableEndFunc) (gpointer user_data);
/**
* GimpProgressVtableSetTextFunc:
* @message:
* @user_data: (closure):
*
* Sets a new text on the progress.
*/
typedef void (* GimpProgressVtableSetTextFunc) (const gchar *message,
gpointer user_data);
/**
* GimpProgressVtableSetValueFunc:
* @percentage:
* @user_data: (closure):
*
* Sets a new percentage on the progress.
*/
typedef void (* GimpProgressVtableSetValueFunc) (gdouble percentage,
gpointer user_data);
/**
* GimpProgressVtablePulseFunc:
* @user_data: (closure):
*
* Makes the progress pulse
*/
typedef void (* GimpProgressVtablePulseFunc) (gpointer user_data);
/**
* GimpProgressVtableGetWindowFunc:
* @user_data: (closure):
*
* Returns: the ID of the window where the progress is displayed.
*/
typedef guint32 (* GimpProgressVtableGetWindowFunc) (gpointer user_data);
typedef struct _GimpProgressVtable GimpProgressVtable;
@ -49,17 +105,12 @@ typedef struct _GimpProgressVtable GimpProgressVtable;
**/
struct _GimpProgressVtable
{
void (* start) (const gchar *message,
gboolean cancelable,
gpointer user_data);
void (* end) (gpointer user_data);
void (* set_text) (const gchar *message,
gpointer user_data);
void (* set_value) (gdouble percentage,
gpointer user_data);
void (* pulse) (gpointer user_data);
guint32 (* get_window) (gpointer user_data);
GimpProgressVtableStartFunc start;
GimpProgressVtableEndFunc end;
GimpProgressVtableSetTextFunc set_text;
GimpProgressVtableSetValueFunc set_value;
GimpProgressVtablePulseFunc pulse;
GimpProgressVtableGetWindowFunc get_window;
/* Padding for future expansion. Must be initialized with NULL! */
void (* _gimp_reserved1) (void);