Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
Diffstat (limited to 'bindings')
-rw-r--r--bindings/Makefile.am2
-rw-r--r--bindings/gecko/Makefile.am32
-rw-r--r--bindings/gecko/gecko-browser.cpp38
-rw-r--r--bindings/gecko/gecko-browser.h30
-rw-r--r--bindings/gecko/gecko.defs13
-rw-r--r--bindings/gecko/gecko.override7
-rw-r--r--bindings/gecko/geckomodule.c23
7 files changed, 144 insertions, 1 deletions
diff --git a/bindings/Makefile.am b/bindings/Makefile.am
index e17ee82..076d521 100644
--- a/bindings/Makefile.am
+++ b/bindings/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = globalkeys threadframe
+SUBDIRS = gecko globalkeys threadframe
bindingsdir = $(pkgdatadir)/bindings
bindings_PYTHON = __init__.py
diff --git a/bindings/gecko/Makefile.am b/bindings/gecko/Makefile.am
new file mode 100644
index 0000000..148d8fa
--- /dev/null
+++ b/bindings/gecko/Makefile.am
@@ -0,0 +1,32 @@
+INCLUDES = \
+ $(PYTHON_INCLUDES) \
+ $(PYGTK_CFLAGS) \
+ $(GECKO_CFLAGS)
+
+geckodir = $(pkgdatadir)/bindings
+pkgpyexecdir = $(geckodir)
+
+pkgpyexec_LTLIBRARIES = gecko.la
+
+gecko_la_LDFLAGS = -module -avoid-version
+gecko_la_LIBADD = $(GECKO_LIBS)
+
+gecko_la_SOURCES = \
+ geckomodule.c \
+ gecko-browser.h \
+ gecko-browser.cpp
+
+nodist_gecko_la_SOURCES = gecko.c
+
+gecko.c: gecko.defs gecko.override
+
+CLEANFILES = gecko.c
+EXTRA_DIST = gecko.override gecko.defs
+
+.defs.c:
+ (cd $(srcdir)\
+ && $(PYGTK_CODEGEN) \
+ --override $*.override \
+ --prefix py$* $*.defs) > gen-$*.c \
+ && cp gen-$*.c $*.c \
+ && rm -f gen-$*.c
diff --git a/bindings/gecko/gecko-browser.cpp b/bindings/gecko/gecko-browser.cpp
new file mode 100644
index 0000000..d262774
--- /dev/null
+++ b/bindings/gecko/gecko-browser.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2006 Red Hat, Inc
+ *
+ * Sugar 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.
+ *
+ * Sugar 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.
+ */
+
+#include "gecko-browser.h"
+
+#include <nsCOMPtr.h>
+#include <nsIPrefService.h>
+#include <nsServiceManagerUtils.h>
+
+void
+gecko_startup(void)
+{
+ nsCOMPtr<nsIPrefService> prefService;
+
+ prefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
+ NS_ENSURE_TRUE(prefService, );
+
+ nsCOMPtr<nsIPrefBranch> pref;
+ prefService->GetBranch("", getter_AddRefs(pref));
+ NS_ENSURE_TRUE(pref, );
+
+ pref->SetBoolPref ("dom.disable_open_during_load", TRUE);
+}
diff --git a/bindings/gecko/gecko-browser.h b/bindings/gecko/gecko-browser.h
new file mode 100644
index 0000000..d9564bc
--- /dev/null
+++ b/bindings/gecko/gecko-browser.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2006 Red Hat, Inc
+ *
+ * Sugar 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.
+ *
+ * Sugar 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.
+ */
+
+#ifndef __GECKO_BROWSER_H__
+#define __GECKO_BROWSER_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+void gecko_startup (void);
+
+G_END_DECLS
+
+#endif
diff --git a/bindings/gecko/gecko.defs b/bindings/gecko/gecko.defs
new file mode 100644
index 0000000..2351e19
--- /dev/null
+++ b/bindings/gecko/gecko.defs
@@ -0,0 +1,13 @@
+;; -*- scheme -*-
+; object definitions ...
+;; Enumerations and flags ...
+
+
+;; From sugar-browser.h
+
+(define-function startup
+ (c-name "gecko_startup")
+ (return-type "none")
+)
+
+
diff --git a/bindings/gecko/gecko.override b/bindings/gecko/gecko.override
new file mode 100644
index 0000000..3ef8f3f
--- /dev/null
+++ b/bindings/gecko/gecko.override
@@ -0,0 +1,7 @@
+/* -*- Mode: C; c-basic-offset: 4 -*- */
+%%
+headers
+#include <Python.h>
+
+#include "gecko-browser.h"
+%%
diff --git a/bindings/gecko/geckomodule.c b/bindings/gecko/geckomodule.c
new file mode 100644
index 0000000..ba16813
--- /dev/null
+++ b/bindings/gecko/geckomodule.c
@@ -0,0 +1,23 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/* include this first, before NO_IMPORT_PYGOBJECT is defined */
+#include <pygobject.h>
+
+extern PyMethodDef pygecko_functions[];
+
+DL_EXPORT(void)
+initgecko(void)
+{
+ PyObject *m, *d;
+
+ init_pygobject ();
+
+ m = Py_InitModule ("gecko", pygecko_functions);
+ d = PyModule_GetDict (m);
+
+ if (PyErr_Occurred ()) {
+ Py_FatalError ("can't initialise module globalkeys");
+ }
+}