parent
b68e6a3b58
commit
882dab21c3
7 changed files with 113 additions and 12 deletions
@ -0,0 +1,51 @@ |
||||
#include "meson-python-sample.h" |
||||
|
||||
#include <Python.h> |
||||
|
||||
struct _MesonPythonSample |
||||
{ |
||||
GObject parent_instance; |
||||
}; |
||||
|
||||
G_DEFINE_TYPE (MesonPythonSample, meson_python_sample, G_TYPE_OBJECT) |
||||
|
||||
/**
|
||||
* meson_python_sample_new: |
||||
* |
||||
* Allocates a new #MesonPythonSample. |
||||
* |
||||
* Returns: (transfer full): a #MesonPythonSample. |
||||
*/ |
||||
MesonPythonSample * |
||||
meson_python_sample_new (void) |
||||
{ |
||||
return g_object_new (MESON_TYPE_PYTHON_SAMPLE, NULL); |
||||
} |
||||
|
||||
static void |
||||
meson_python_sample_class_init (MesonPythonSampleClass *klass) |
||||
{ |
||||
if (!Py_IsInitialized ()) { |
||||
Py_Initialize (); |
||||
Py_Finalize (); |
||||
} |
||||
} |
||||
|
||||
static void |
||||
meson_python_sample_init (MesonPythonSample *self) |
||||
{ |
||||
} |
||||
|
||||
/**
|
||||
* meson_python_sample_print_message: |
||||
* @self: a #MesonSample2. |
||||
* |
||||
* Prints Hello. |
||||
* |
||||
* Returns: Nothing. |
||||
*/ |
||||
void |
||||
meson_python_sample_print_message (MesonPythonSample *self) |
||||
{ |
||||
g_print ("Message: Hello\n"); |
||||
} |
@ -0,0 +1,4 @@ |
||||
EXPORTS |
||||
meson_python_sample_new |
||||
meson_python_sample_print_message |
||||
meson_python_sample_get_type |
@ -0,0 +1,17 @@ |
||||
#ifndef MESON_PYTHON_SAMPLE_H |
||||
#define MESON_PYTHON_SAMPLE_H |
||||
|
||||
#include <glib-object.h> |
||||
|
||||
G_BEGIN_DECLS |
||||
|
||||
#define MESON_TYPE_PYTHON_SAMPLE (meson_python_sample_get_type()) |
||||
|
||||
G_DECLARE_FINAL_TYPE (MesonPythonSample, meson_python_sample, MESON, SAMPLE, GObject) |
||||
|
||||
MesonPythonSample *meson_python_sample_new (void); |
||||
void meson_python_sample_print_message (MesonPythonSample *self); |
||||
|
||||
G_END_DECLS |
||||
|
||||
#endif /* MESON_PYTHON_SAMPLE_H */ |
Loading…
Reference in new issue