Add a gecko module. Disable popups.

This commit is contained in:
Marco Pesenti Gritti 2006-09-26 21:58:54 +02:00
parent 92e37fd904
commit 5d78b148ff
10 changed files with 150 additions and 1 deletions

1
.gitignore vendored
View File

@ -48,3 +48,4 @@ ltmain.sh
po/ChangeLog po/ChangeLog
m4/intltool.m4 m4/intltool.m4
bindings/globalkeys/globalkeys.c bindings/globalkeys/globalkeys.c
bindings/gecko/gecko.c

View File

@ -7,6 +7,7 @@ from sugar.activity.Activity import Activity
from sugar.presence.PresenceService import PresenceService from sugar.presence.PresenceService import PresenceService
from sugar.p2p.model.LocalModel import LocalModel from sugar.p2p.model.LocalModel import LocalModel
from sugar.p2p.model.RemoteModel import RemoteModel from sugar.p2p.model.RemoteModel import RemoteModel
import gecko
from NotificationBar import NotificationBar from NotificationBar import NotificationBar
from NavigationToolbar import NavigationToolbar from NavigationToolbar import NavigationToolbar
@ -19,6 +20,8 @@ class BrowserActivity(Activity):
gtkmozembed.push_startup() gtkmozembed.push_startup()
gtkmozembed.set_profile_path(env.get_profile_path(), 'gecko') gtkmozembed.set_profile_path(env.get_profile_path(), 'gecko')
gecko.startup()
self._share_service = None self._share_service = None
self._model_service = None self._model_service = None
self._notif_service = None self._notif_service = None

View File

@ -1,4 +1,4 @@
SUBDIRS = globalkeys threadframe SUBDIRS = gecko globalkeys threadframe
bindingsdir = $(pkgdatadir)/bindings bindingsdir = $(pkgdatadir)/bindings
bindings_PYTHON = __init__.py bindings_PYTHON = __init__.py

View File

@ -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

View File

@ -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);
}

View File

@ -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

13
bindings/gecko/gecko.defs Normal file
View File

@ -0,0 +1,13 @@
;; -*- scheme -*-
; object definitions ...
;; Enumerations and flags ...
;; From sugar-browser.h
(define-function startup
(c-name "gecko_startup")
(return-type "none")
)

View File

@ -0,0 +1,7 @@
/* -*- Mode: C; c-basic-offset: 4 -*- */
%%
headers
#include <Python.h>
#include "gecko-browser.h"
%%

View File

@ -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");
}
}

View File

@ -23,6 +23,7 @@ AC_PATH_PROG(PYGTK_CODEGEN, pygtk-codegen-2.0, no)
PKG_CHECK_MODULES(PYGTK, pygtk-2.0) PKG_CHECK_MODULES(PYGTK, pygtk-2.0)
PKG_CHECK_MODULES(GLOBALKEYS, gdk-2.0) PKG_CHECK_MODULES(GLOBALKEYS, gdk-2.0)
PKG_CHECK_MODULES(GECKO, xulrunner-gtkmozembed)
# #
# Setup GETTEXT # Setup GETTEXT
@ -43,6 +44,7 @@ activities/chat/Makefile
activities/groupchat/Makefile activities/groupchat/Makefile
activities/terminal/Makefile activities/terminal/Makefile
bindings/Makefile bindings/Makefile
bindings/gecko/Makefile
bindings/globalkeys/Makefile bindings/globalkeys/Makefile
bindings/threadframe/Makefile bindings/threadframe/Makefile
services/Makefile services/Makefile