[gnome-python-desktop] Bug 584831 – add python bindings for libbrasero-burn



commit 97d381a4eb3fe1acd8ebfe1a27be1d8a972940ff
Author: Gustavo Carneiro <gjc inescporto pt>
Date:   Sun Jun 21 14:32:37 2009 +0100

    Bug 584831 â?? add python bindings for libbrasero-burn

 braseroburn/Makefile.am           |   34 ++++++
 braseroburn/brasero_burn.defs     |  218 +++++++++++++++++++++++++++++++++++++
 braseroburn/brasero_burn.override |   22 ++++
 braseroburn/brasero_burn_module.c |   46 ++++++++
 braseroburn/wscript               |   24 ++++
 tests/common.py                   |    1 +
 wscript                           |    2 +
 7 files changed, 347 insertions(+), 0 deletions(-)
---
diff --git a/braseroburn/Makefile.am b/braseroburn/Makefile.am
new file mode 100644
index 0000000..3b25649
--- /dev/null
+++ b/braseroburn/Makefile.am
@@ -0,0 +1,34 @@
+INCLUDES = $(PYTHON_INCLUDES)
+
+defsdir = $(datadir)/pygtk/2.0/defs
+defs_DATA = brasero_media.defs
+EXTRA_DIST = $(defs_DATA)
+
+pkgpythondir = $(pyexecdir)/gtk-2.0
+pkgpyexecdir = $(pyexecdir)/gtk-2.0
+
+# braseromedia binding
+pkgpyexec_LTLIBRARIES = braseromedia.la
+braseromedia_la_CFLAGS = $(BRASEROMEDIA_CFLAGS)
+braseromedia_la_LDFLAGS = -module -avoid-version -export-symbols-regex initbraseromedia
+braseromedia_la_LIBADD = $(BRASEROMEDIA_LIBS)
+braseromedia_la_SOURCES = bm_module.c
+
+nodist_braseromedia_la_SOURCES = brasero_media.c
+CLEANFILES = brasero_media.c
+EXTRA_DIST += brasero_media.override  
+brasero_media.c: brasero_media.defs brasero_media.override
+
+.defs.c:
+	(cd $(srcdir) \
+	 && $(PYGTK_CODEGEN) \
+	    --override $*.override \
+	    --py_ssize_t-clean \
+	    --register $(PYGTK_DEFSDIR)/gtk-types.defs \
+	    --register $(PYGTK_DEFSDIR)/gdk-types.defs \
+	    --prefix $* $*.defs) > gen-$*.c \
+	&& cp gen-$*.c $*.c \
+	&& rm -f gen-$*.c
+
+EXTRA_DIST += wscript
+
diff --git a/braseroburn/brasero_burn.defs b/braseroburn/brasero_burn.defs
new file mode 100644
index 0000000..19c67c5
--- /dev/null
+++ b/braseroburn/brasero_burn.defs
@@ -0,0 +1,218 @@
+;; -*- scheme -*-
+; object definitions ...
+(define-object Burn
+  (in-module "Brasero")
+  (parent "GObject")
+  (c-name "BraseroBurn")
+  (gtype-id "BRASERO_TYPE_BURN")
+)
+
+(define-object BurnDialog
+  (in-module "Brasero")
+  (parent "GtkDialog")
+  (c-name "BraseroBurnDialog")
+  (gtype-id "BRASERO_TYPE_BURN_DIALOG")
+)
+
+(define-object BurnOptions
+  (in-module "Brasero")
+  (parent "GtkDialog")
+  (c-name "BraseroBurnOptions")
+  (gtype-id "BRASERO_TYPE_BURN_OPTIONS")
+)
+
+;; Enumerations and flags ...
+
+
+;; From brasero-burn-dialog.h
+
+(define-function dialog_get_type
+  (c-name "brasero_burn_dialog_get_type")
+  (return-type "GType")
+  (parameters
+  )
+)
+
+(define-function dialog_new
+  (c-name "brasero_burn_dialog_new")
+  (is-constructor-of "BraseroBurnDialog")
+  (return-type "GtkWidget*")
+)
+
+(define-method run
+  (of-object "BraseroBurnDialog")
+  (c-name "brasero_burn_dialog_run")
+  (return-type "gboolean")
+  (parameters
+    '("BraseroBurnSession*" "session")
+  )
+)
+
+(define-method cancel
+  (of-object "BraseroBurnDialog")
+  (c-name "brasero_burn_dialog_cancel")
+  (return-type "gboolean")
+  (parameters
+    '("gboolean" "force_cancellation")
+  )
+)
+
+
+
+;; From brasero-burn.h
+
+(define-function get_type
+  (c-name "brasero_burn_get_type")
+  (return-type "GType")
+  (parameters
+  )
+)
+
+(define-function new
+  (c-name "brasero_burn_new")
+  (is-constructor-of "BraseroBurn")
+  (return-type "BraseroBurn*")
+  (parameters
+  )
+)
+
+(define-method record
+  (of-object "BraseroBurn")
+  (c-name "brasero_burn_record")
+  (return-type "BraseroBurnResult")
+  (parameters
+    '("BraseroBurnSession*" "session")
+    '("GError**" "error")
+  )
+)
+
+(define-method check
+  (of-object "BraseroBurn")
+  (c-name "brasero_burn_check")
+  (return-type "BraseroBurnResult")
+  (parameters
+    '("BraseroBurnSession*" "session")
+    '("GError**" "error")
+  )
+)
+
+(define-method blank
+  (of-object "BraseroBurn")
+  (c-name "brasero_burn_blank")
+  (return-type "BraseroBurnResult")
+  (parameters
+    '("BraseroBurnSession*" "session")
+    '("GError**" "error")
+  )
+)
+
+(define-method cancel
+  (of-object "BraseroBurn")
+  (c-name "brasero_burn_cancel")
+  (return-type "BraseroBurnResult")
+  (parameters
+    '("gboolean" "protect")
+  )
+)
+
+(define-method status
+  (of-object "BraseroBurn")
+  (c-name "brasero_burn_status")
+  (return-type "BraseroBurnResult")
+  (parameters
+    '("BraseroMedia*" "info")
+    '("goffset*" "isosize")
+    '("goffset*" "written")
+    '("guint64*" "rate")
+  )
+)
+
+(define-method get_action_string
+  (of-object "BraseroBurn")
+  (c-name "brasero_burn_get_action_string")
+  (return-type "none")
+  (parameters
+    '("BraseroBurnAction" "action")
+    '("gchar**" "string")
+  )
+)
+
+
+
+;; From brasero-burn-lib.h
+
+(define-function library_start
+  (c-name "brasero_burn_library_start")
+  (return-type "gboolean")
+)
+
+(define-function library_stop
+  (c-name "brasero_burn_library_stop")
+  (return-type "none")
+)
+
+(define-function library_get_option_group
+  (c-name "brasero_burn_library_get_option_group")
+  (return-type "GOptionGroup*")
+)
+
+(define-function library_get_plugins_list
+  (c-name "brasero_burn_library_get_plugins_list")
+  (return-type "GSList*")
+)
+
+(define-function library_can_checksum
+  (c-name "brasero_burn_library_can_checksum")
+  (return-type "gboolean")
+)
+
+(define-function library_input_supported
+  (c-name "brasero_burn_library_input_supported")
+  (return-type "BraseroBurnResult")
+  (parameters
+    '("BraseroTrackType*" "type")
+  )
+)
+
+(define-function library_get_media_capabilities
+  (c-name "brasero_burn_library_get_media_capabilities")
+  (return-type "BraseroMedia")
+  (parameters
+    '("BraseroMedia" "media")
+  )
+)
+
+
+
+;; From brasero-burn-options.h
+
+(define-function options_get_type
+  (c-name "brasero_burn_options_get_type")
+  (return-type "GType")
+)
+
+(define-function options_new
+  (c-name "brasero_burn_options_new")
+  (is-constructor-of "BraseroBurnOptions")
+  (return-type "GtkWidget*")
+  (parameters
+    '("BraseroSessionCfg*" "session")
+  )
+)
+
+(define-method get_session
+  (of-object "BraseroBurnOptions")
+  (c-name "brasero_burn_options_get_session")
+  (return-type "BraseroBurnSession*")
+)
+
+(define-method add_options
+  (of-object "BraseroBurnOptions")
+  (c-name "brasero_burn_options_add_options")
+  (return-type "none")
+  (parameters
+    '("GtkWidget*" "options")
+  )
+)
+
+
diff --git a/braseroburn/brasero_burn.override b/braseroburn/brasero_burn.override
new file mode 100644
index 0000000..7a98995
--- /dev/null
+++ b/braseroburn/brasero_burn.override
@@ -0,0 +1,22 @@
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 8 -*- */
+%%
+headers
+#define NO_IMPORT_PYGOBJECT
+#include "pygobject.h"
+#include <brasero-burn.h>
+#include <brasero-burn-lib.h>
+#include <brasero-burn-dialog.h>
+#include <brasero-burn-options.h>
+
+#include "config.h"
+
+%%
+modulename braseroburn
+%%
+import gobject.GObject as PyGObject_Type
+import gtk.Widget as PyGtkWidget_Type
+import gtk.Dialog as PyGtkDialog_Type
+%%
+ignore-glob
+  *_get_type
+
diff --git a/braseroburn/brasero_burn_module.c b/braseroburn/brasero_burn_module.c
new file mode 100644
index 0000000..d303e64
--- /dev/null
+++ b/braseroburn/brasero_burn_module.c
@@ -0,0 +1,46 @@
+/* 
+ * Copyright (C) 2009 Frederic PEters <fpeters 0d be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors: Frederic Peters <fpeters 0d be>
+ */
+
+#include <Python.h>
+#include <pygobject.h>
+#include <brasero-burn.h>
+
+void brasero_burn_register_classes (PyObject *d);
+void brasero_burn_add_constants(PyObject *module, const gchar *strip_prefix);
+extern PyMethodDef brasero_burn_functions[];
+
+DL_EXPORT(void)
+initbraseroburn(void)
+{
+	PyObject *m, *d;
+	
+	if (!pygobject_init (-1, -1, -1))
+            return;
+	
+	m = Py_InitModule ("braseroburn", brasero_burn_functions);
+	d = PyModule_GetDict (m);
+	if (PyErr_Occurred())
+		return;
+	
+	/* init auto-gened classes */
+	brasero_burn_register_classes (d);
+/* 	brasero_burn_add_constants (m, "BRASERO_BURN_"); */
+}
+
diff --git a/braseroburn/wscript b/braseroburn/wscript
new file mode 100644
index 0000000..f620460
--- /dev/null
+++ b/braseroburn/wscript
@@ -0,0 +1,24 @@
+# -*- python -*-
+# encoding: utf-8
+
+def configure(conf):
+    conf.env.append_value('MODULES_AVAILABLE', 'braseroburn')
+    if 'braseroburn' in conf.env['ENABLE_MODULES'] or 'all' in conf.env['ENABLE_MODULES']:
+        if conf.pkg_check_modules('BRASEROBURN',
+                                  'libbrasero-burn pygobject-2.0 pygtk-2.0',
+                                  mandatory=False):
+            conf.env.append_value('MODULES_TO_BUILD', 'braseroburn')
+
+
+def build(bld):
+    if 'braseroburn' in bld.env['MODULES_TO_BUILD']:
+        bld.codegen('brasero_burn', prefix='brasero_burn')
+        pyext = bld.create_pyext()
+        pyext.source = 'brasero_burn_module.c brasero_burn.c'
+        pyext.includes = '.'
+        pyext.target = 'braseroburn'
+        pyext.uselib = 'BRASEROBURN'
+        pyext.install_path = '${PYTHONDIR}/gtk-2.0'
+
+        bld.install_files('${DATADIR}/pygtk/2.0/defs', 'brasero_burn.defs')
+
diff --git a/tests/common.py b/tests/common.py
index d617ba3..6ff5737 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -22,6 +22,7 @@ modules = [
     ("ecal", "evolution"),
     "evince",
     "braseromedia",
+    "braseroburn",
     ]
 
 def run_import_tests(builddir, no_import_hooks):
diff --git a/wscript b/wscript
index f14c5cd..49246ce 100644
--- a/wscript
+++ b/wscript
@@ -118,6 +118,7 @@ def configure(conf):
     conf.sub_config('metacity')
     conf.sub_config('nautilusburn')
     conf.sub_config('braseromedia')
+    conf.sub_config('braseroburn')
     conf.sub_config('rsvg')
     conf.sub_config('totem')
     conf.sub_config('wnck')
@@ -256,6 +257,7 @@ def build(bld):
     bld.add_subdirs('metacity')
     bld.add_subdirs('nautilusburn')
     bld.add_subdirs('braseromedia')
+    bld.add_subdirs('braseroburn')
     bld.add_subdirs('rsvg')
     bld.add_subdirs('totem')
     bld.add_subdirs('wnck')



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