From 5d78b148ffe14e1653882bb352afdc8384d8c8e2 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 26 Sep 2006 19:58:54 +0000 Subject: Add a gecko module. Disable popups. --- diff --git a/.gitignore b/.gitignore index ffd6362..fa8f870 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,4 @@ ltmain.sh po/ChangeLog m4/intltool.m4 bindings/globalkeys/globalkeys.c +bindings/gecko/gecko.c diff --git a/activities/browser/BrowserActivity.py b/activities/browser/BrowserActivity.py index 8203a67..7c2c5c6 100644 --- a/activities/browser/BrowserActivity.py +++ b/activities/browser/BrowserActivity.py @@ -7,6 +7,7 @@ from sugar.activity.Activity import Activity from sugar.presence.PresenceService import PresenceService from sugar.p2p.model.LocalModel import LocalModel from sugar.p2p.model.RemoteModel import RemoteModel +import gecko from NotificationBar import NotificationBar from NavigationToolbar import NavigationToolbar @@ -19,6 +20,8 @@ class BrowserActivity(Activity): gtkmozembed.push_startup() gtkmozembed.set_profile_path(env.get_profile_path(), 'gecko') + gecko.startup() + self._share_service = None self._model_service = None self._notif_service = None 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 +#include +#include + +void +gecko_startup(void) +{ + nsCOMPtr prefService; + + prefService = do_GetService(NS_PREFSERVICE_CONTRACTID); + NS_ENSURE_TRUE(prefService, ); + + nsCOMPtr 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 + +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 + +#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 + +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"); + } +} diff --git a/configure.ac b/configure.ac index a81c6d5..e307b53 100644 --- a/configure.ac +++ b/configure.ac @@ -23,6 +23,7 @@ AC_PATH_PROG(PYGTK_CODEGEN, pygtk-codegen-2.0, no) PKG_CHECK_MODULES(PYGTK, pygtk-2.0) PKG_CHECK_MODULES(GLOBALKEYS, gdk-2.0) +PKG_CHECK_MODULES(GECKO, xulrunner-gtkmozembed) # # Setup GETTEXT @@ -43,6 +44,7 @@ activities/chat/Makefile activities/groupchat/Makefile activities/terminal/Makefile bindings/Makefile +bindings/gecko/Makefile bindings/globalkeys/Makefile bindings/threadframe/Makefile services/Makefile -- cgit v0.9.1