Move SugarKeyGrabber in the lib. Keep it private.

We can't install libraries in datadir.
This commit is contained in:
Marco Pesenti Gritti 2007-06-20 15:22:12 +02:00
parent 61314c9705
commit c91bbd18cc
21 changed files with 76 additions and 240 deletions

5
.gitignore vendored
View File

@ -11,6 +11,7 @@ Makefile.in
*.loT
.*.sw?
*.service
stamp-*
# Absolute
@ -25,7 +26,6 @@ compile
install-sh
missing
py-compile
stamp-h1
dbus-installed.conf
intltool-extract
intltool-extract.in
@ -36,7 +36,6 @@ intltool-update.in
mkinstalldirs
po/Makefile.in.in
po/POTFILES
po/stamp-it
po/*.gmo
sugar/__installed__.py
tools/sugar-setup-activity
@ -50,8 +49,6 @@ m4/intltool.m4
sugar/browser/_sugarbrowser.c
browser/sugar-marshal.c
browser/sugar-marshal.h
browser/stamp-sugar-marshal.c
browser/stamp-sugar-marshal.h
bin/sugar
shell/extensions/_extensions.c
data/sugar.gtkrc

View File

@ -45,7 +45,6 @@ lib/xdgmime/Makefile
services/Makefile
services/clipboard/Makefile
shell/Makefile
shell/extensions/Makefile
shell/intro/Makefile
shell/hardware/Makefile
shell/view/Makefile

1
lib/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
sugar-marshal.*

View File

@ -10,7 +10,40 @@ libsugar_la_LIBADD = \
$(top_builddir)/lib/xdgmime/libxdgmime.la
libsugar_la_SOURCES = \
$(BUILT_SOURCES) \
eggaccelerators.c \
eggaccelerators.h \
sugar-address-entry.c \
sugar-address-entry.h \
sugar-key-grabber.c \
sugar-key-grabber.h \
sugar-x11-util.c \
sugar-x11-util.h
BUILT_SOURCES = \
sugar-marshal.c \
sugar-marshal.h
stamp_files = \
stamp-sugar-marshal.c \
stamp-sugar-marshal.h
sugar-marshal.c: stamp-sugar-marshal.c
@true
stamp-sugar-marshal.c: sugar-marshal.list
$(GLIB_GENMARSHAL) --prefix=sugar_marshal \
$(srcdir)/sugar-marshal.list --header --body > \
sugar-marshal.c && echo timestamp > $(@F)
sugar-marshal.h: stamp-sugar-marshal.h
@true
stamp-sugar-marshal.h: sugar-marshal.list
$(GLIB_GENMARSHAL) --prefix=sugar_marshal \
$(srcdir)/sugar-marshal.list --header > \
sugar-marshal.h && echo timestamp > $(@F)
CLEANFILES = $(stamp_files) $(BUILT_SOURCES)
DISTCLEANFILES = $(stamp_files) $(BUILT_SOURCES)
MAINTAINERCLEANFILES = $(stamp_files) $(BUILT_SOURCES)
EXTRA_DIST = sugar-marshal.list

View File

@ -23,7 +23,7 @@
#include "sugar-key-grabber.h"
#include "eggaccelerators.h"
#include "sugar-shell-marshal.h"
#include "sugar-marshal.h"
/* we exclude shift, GDK_CONTROL_MASK and GDK_MOD1_MASK since we know what
these modifiers mean
@ -82,7 +82,7 @@ sugar_key_grabber_class_init(SugarKeyGrabberClass *grabber_class)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (SugarKeyGrabberClass, key_pressed),
NULL, NULL,
sugar_shell_marshal_BOOLEAN__UINT_UINT,
sugar_marshal_BOOLEAN__UINT_UINT,
G_TYPE_BOOLEAN, 2,
G_TYPE_UINT,
G_TYPE_UINT);
@ -91,7 +91,7 @@ sugar_key_grabber_class_init(SugarKeyGrabberClass *grabber_class)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (SugarKeyGrabberClass, key_released),
NULL, NULL,
sugar_shell_marshal_BOOLEAN__UINT_UINT,
sugar_marshal_BOOLEAN__UINT_UINT,
G_TYPE_BOOLEAN, 2,
G_TYPE_UINT,
G_TYPE_UINT);

View File

@ -1,4 +1,4 @@
SUBDIRS = extensions hardware model view intro
SUBDIRS = hardware model view intro
bin_SCRIPTS = sugar-shell

View File

@ -1,2 +0,0 @@
stamp-sugar-shell-marshal.*
sugar-shell-marshal.*

View File

@ -1,68 +0,0 @@
sugardir = $(pkgdatadir)/shell/extensions
sugar_PYTHON = \
__init__.py
pkgpyexecdir = $(pkgdatadir)/shell/extensions
pkgpyexec_LTLIBRARIES = _extensions.la
_extensions_la_LDFLAGS = -module -avoid-version
_extensions_la_CFLAGS = \
$(PYTHON_INCLUDES) \
$(SHELL_CFLAGS) \
-I$(top_srcdir)/shell/extensions
_extensions_la_LIBADD = \
$(SHELL_LIBS) \
-lgstinterfaces-0.10 \
-lgstaudio-0.10
_extensions_la_SOURCES = \
$(BUILT_SOURCES) \
eggaccelerators.h \
eggaccelerators.c \
sugar-key-grabber.h \
sugar-key-grabber.c \
_extensionsmodule.c
BUILT_SOURCES = \
_extensions.c \
sugar-shell-marshal.c \
sugar-shell-marshal.h
stamp_files = \
stamp-sugar-shell-marshal.c \
stamp-sugar-shell-marshal.h
sugar-shell-marshal.c: stamp-sugar-shell-marshal.c
@true
stamp-sugar-shell-marshal.c: sugar-shell-marshal.list
$(GLIB_GENMARSHAL) --prefix=sugar_shell_marshal \
$(srcdir)/sugar-shell-marshal.list --header --body > \
sugar-shell-marshal.c && echo timestamp > $(@F)
sugar-shell-marshal.h: stamp-sugar-shell-marshal.h
@true
stamp-sugar-shell-marshal.h: sugar-shell-marshal.list
$(GLIB_GENMARSHAL) --prefix=sugar_shell_marshal \
$(srcdir)/sugar-shell-marshal.list --header > \
sugar-shell-marshal.h && echo timestamp > $(@F)
CLEANFILES = $(stamp_files) $(BUILT_SOURCES)
DISTCLEANFILES = $(stamp_files) $(BUILT_SOURCES)
MAINTAINERCLEANFILES = $(stamp_files) $(BUILT_SOURCES)
EXTRA_DIST = sugar-shell-marshal.list _extensions.override _extensions.defs
extensions.c: _extensions.defs _extensions.override
.defs.c:
(cd $(srcdir)\
&& $(PYGTK_CODEGEN) \
--register $(PYGTK_DEFSDIR)/gdk-types.defs \
--register $(PYGTK_DEFSDIR)/gtk-types.defs \
--override $*.override \
--prefix py$* $*.defs) > gen-$*.c \
&& cp gen-$*.c $*.c \
&& rm -f gen-$*.c

View File

@ -1,21 +0,0 @@
# Copyright (C) 2007, Red Hat, Inc.
#
# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
try:
from extensions._extensions import *
except ImportError:
from sugar import ltihooks
from extensions._extensions import *

View File

@ -1,37 +0,0 @@
;; -*- scheme -*-
; object definitions ...
(define-object KeyGrabber
(in-module "Sugar")
(parent "GObject")
(c-name "SugarKeyGrabber")
(gtype-id "SUGAR_TYPE_KEY_GRABBER")
)
;; Enumerations and flags ...
;; From sugar-key-grabber.h
(define-function sugar_key_grabber_get_type
(c-name "sugar_key_grabber_get_type")
(return-type "GType")
)
(define-method grab
(of-object "SugarKeyGrabber")
(c-name "sugar_key_grabber_grab")
(return-type "none")
(parameters
'("const-char*" "key")
)
)
(define-method get_key
(of-object "SugarKeyGrabber")
(c-name "sugar_key_grabber_get_key")
(return-type "char*")
(parameters
'("guint" "keycode")
'("guint" "state")
)
)

View File

@ -1,17 +0,0 @@
/* -*- Mode: C; c-basic-offset: 4 -*- */
%%
headers
#include <Python.h>
#include "pygobject.h"
#include "sugar-key-grabber.h"
%%
modulename extensions
%%
import gobject.GObject as PyGObject_Type
import gtk.Entry as PyGtkEntry_Type
%%
ignore-glob
*_get_type
_*

View File

@ -1,27 +0,0 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* include this first, before NO_IMPORT_PYGOBJECT is defined */
#include <pygobject.h>
void py_extensions_register_classes (PyObject *d);
extern PyMethodDef py_extensions_functions[];
DL_EXPORT(void)
init_extensions(void)
{
PyObject *m, *d;
init_pygobject ();
m = Py_InitModule ("_extensions", py_extensions_functions);
d = PyModule_GetDict (m);
py_extensions_register_classes (d);
if (PyErr_Occurred ()) {
Py_FatalError ("can't initialise module _sugar");
}
}

View File

@ -1,57 +0,0 @@
#ifndef __sugar_shell_marshal_MARSHAL_H__
#define __sugar_shell_marshal_MARSHAL_H__
#include <glib-object.h>
G_BEGIN_DECLS
#ifdef G_ENABLE_DEBUG
#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
#define g_marshal_value_peek_char(v) g_value_get_char (v)
#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v)
#define g_marshal_value_peek_int(v) g_value_get_int (v)
#define g_marshal_value_peek_uint(v) g_value_get_uint (v)
#define g_marshal_value_peek_long(v) g_value_get_long (v)
#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v)
#define g_marshal_value_peek_int64(v) g_value_get_int64 (v)
#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v)
#define g_marshal_value_peek_enum(v) g_value_get_enum (v)
#define g_marshal_value_peek_flags(v) g_value_get_flags (v)
#define g_marshal_value_peek_float(v) g_value_get_float (v)
#define g_marshal_value_peek_double(v) g_value_get_double (v)
#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v)
#define g_marshal_value_peek_param(v) g_value_get_param (v)
#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v)
#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v)
#define g_marshal_value_peek_object(v) g_value_get_object (v)
#else /* !G_ENABLE_DEBUG */
/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
* Do not access GValues directly in your code. Instead, use the
* g_value_get_*() functions
*/
#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int
#define g_marshal_value_peek_char(v) (v)->data[0].v_int
#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint
#define g_marshal_value_peek_int(v) (v)->data[0].v_int
#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint
#define g_marshal_value_peek_long(v) (v)->data[0].v_long
#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong
#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64
#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64
#define g_marshal_value_peek_enum(v) (v)->data[0].v_long
#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong
#define g_marshal_value_peek_float(v) (v)->data[0].v_float
#define g_marshal_value_peek_double(v) (v)->data[0].v_double
#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer
#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer
#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer
#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer
#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer
#endif /* !G_ENABLE_DEBUG */
G_END_DECLS
#endif /* __sugar_shell_marshal_MARSHAL_H__ */

View File

@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4

View File

@ -9,7 +9,7 @@ import gtk
from sugar import env
from hardware import hardwaremanager
from model.ShellModel import ShellModel
from extensions import KeyGrabber
from sugar._sugarext import KeyGrabber
import sugar
_actions_table = {

View File

@ -8,6 +8,40 @@
(gtype-id "SUGAR_TYPE_ADDRESS_ENTRY")
)
(define-object KeyGrabber
(in-module "Sugar")
(parent "GObject")
(c-name "SugarKeyGrabber")
(gtype-id "SUGAR_TYPE_KEY_GRABBER")
)
;; Enumerations and flags ...
;; From sugar-key-grabber.h
(define-function sugar_key_grabber_get_type
(c-name "sugar_key_grabber_get_type")
(return-type "GType")
)
(define-method grab
(of-object "SugarKeyGrabber")
(c-name "sugar_key_grabber_grab")
(return-type "none")
(parameters
'("const-char*" "key")
)
)
(define-method get_key
(of-object "SugarKeyGrabber")
(c-name "sugar_key_grabber_get_key")
(return-type "char*")
(parameters
'("guint" "keycode")
'("guint" "state")
)
)
; functions
(define-function get_mime_type_from_file_name

View File

@ -5,6 +5,7 @@ headers
#include "pygobject.h"
#include "sugar-address-entry.h"
#include "sugar-key-grabber.h"
#include "sugar-x11-util.h"
#include "xdgmime.h"
@ -14,6 +15,7 @@ headers
%%
modulename _sugarext
%%
import gobject.GObject as PyGObject_Type
import gtk.Entry as PyGtkEntry_Type
import gtk.gdk.Window as PyGdkWindow_Type
%%