Commit 4e12f0b3 authored by Yves Combe's avatar Yves Combe
Browse files

sqlite quote string in conf too.

workaround tuxpaint lockfile bug.
parent 482dbd17
2005-09-13 Yves Combe <yves@ycombe.net>
sqlite quote string in conf too.
workaround tuxpaint lockfile bug.
* po/Makefile.in.in:
* src/boards/py-gcompris-properties.c: typo.
(pyGcomprisPropertiesType_getattr):
* src/boards/python/tuxpaint.py:
* src/gcompris/gcompris_db.c: (gcompris_set_board_conf):
2005-09-12 Bruno coudoin <bruno.coudoin@free.fr>
Added Basque support (from dooteo <dooteo@euskalgnu.org>)
......
......@@ -11,6 +11,11 @@
#
# - Modified by jacob berkman <jacob@ximian.com> to install
# Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
#
# - Modified by Rodney Dawes <dobey@novell.com> for use with intltool
#
# We have the following line for use by intltoolize:
# INTLTOOL_MAKEFILE
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
PACKAGE = @PACKAGE@
......@@ -21,27 +26,33 @@ SHELL = /bin/sh
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = ..
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datadir = @datadir@
datarootdir = @datarootdir@
libdir = @libdir@
localedir = $(libdir)/locale
gnulocaledir = $(datadir)/locale
gettextsrcdir = $(datadir)/glib-2.0/gettext/po
subdir = po
install_sh = @install_sh@
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
CC = @CC@
GENCAT = @GENCAT@
GMSGFMT = @GMSGFMT@
MSGFMT = @MSGFMT@
XGETTEXT = @XGETTEXT@
MSGMERGE = msgmerge
INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
GENPOT = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
DEFS = @DEFS@
CFLAGS = @CFLAGS@
......@@ -54,8 +65,9 @@ COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
SOURCES =
POFILES = @POFILES@
GMOFILES = @GMOFILES@
DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \
$(POFILES) $(GMOFILES) $(SOURCES)
DISTFILES = ChangeLog Makefile.in.in POTFILES.in \
$(POFILES) $(SOURCES)
EXTRA_DISTFILES = POTFILES.skip Makevars LINGUAS
POTFILES = \
......@@ -71,13 +83,13 @@ INSTOBJEXT = @INSTOBJEXT@
.po.pox:
$(MAKE) $(GETTEXT_PACKAGE).pot
$(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
$(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
.po.mo:
$(MSGFMT) -o $@ $<
.po.gmo:
file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
file=`echo $* | sed 's,.*/,,'`.gmo \
&& rm -f $$file && $(GMSGFMT) -o $$file $<
.po.cat:
......@@ -90,20 +102,15 @@ all: all-@USE_NLS@
all-yes: $(CATALOGS)
all-no:
$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
$(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \
--add-comments --keyword=_ --keyword=N_ \
--files-from=$(srcdir)/POTFILES.in \
&& test ! -f $(GETTEXT_PACKAGE).po \
|| ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
&& mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
$(GETTEXT_PACKAGE).pot: $(POTFILES)
$(GENPOT)
install: install-exec install-data
install-exec:
install-data: install-data-@USE_NLS@
install-data-no: all
install-data-yes: all
if test -r "$(MKINSTALLDIRS)"; then \
if test -n "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
......@@ -117,7 +124,7 @@ install-data-yes: all
esac; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
if test -r "$(MKINSTALLDIRS)"; then \
if test -n "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $$dir; \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
......@@ -145,7 +152,7 @@ install-data-yes: all
fi; \
done
if test "$(PACKAGE)" = "glib"; then \
if test -r "$(MKINSTALLDIRS)"; then \
if test -n "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
......@@ -169,29 +176,37 @@ uninstall:
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
done
rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
if test "$(PACKAGE)" = "glib"; then \
rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
fi
check: all
check: all $(GETTEXT_PACKAGE).pot
dvi info tags TAGS ID:
mostlyclean:
rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
rm -f core core.* *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
rm -fr *.o
rm -f .intltool-merge-cache
clean: mostlyclean
distclean: clean
rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
rm -f Makefile Makefile.in POTFILES
rm -f *.mo *.msg *.cat *.cat.m $(GMOFILES)
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
rm -f $(GMOFILES)
rm -f Makefile.in.in
distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
dist distdir: update-po $(DISTFILES)
dist distdir: $(DISTFILES)
dists="$(DISTFILES)"; \
extra_dists="$(EXTRA_DISTFILES)"; \
for file in $$extra_dists; do \
test -f $$file && dists="$$dists $$file"; \
done; \
for file in $$dists; do \
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
|| cp -p $(srcdir)/$$file $(distdir); \
......@@ -199,19 +214,28 @@ dist distdir: update-po $(DISTFILES)
update-po: Makefile
$(MAKE) $(GETTEXT_PACKAGE).pot
cd $(srcdir); \
tmpdir=`pwd`; \
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
mv $$lang.po $$lang.old.po; \
echo "$$lang:"; \
if $(MSGMERGE) $$lang.old.po $(GETTEXT_PACKAGE).pot -o $$lang.po; then \
rm -f $$lang.old.po; \
result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \
if $$result; then \
if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
rm -f $$tmpdir/$$lang.new.po; \
else \
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
:; \
else \
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
rm -f $$tmpdir/$$lang.new.po; \
exit 1; \
fi; \
fi; \
else \
echo "msgmerge for $$cat failed!"; \
rm -f $$lang.po; \
mv $$lang.old.po $$lang.po; \
rm -f $$tmpdir/$$lang.new.po; \
fi; \
done
......@@ -219,17 +243,13 @@ update-po: Makefile
# and Intltool tags (enclosed in square brackets), and appending a full
# relative path to them
POTFILES: POTFILES.in
( if test 'x$(srcdir)' != 'x.'; then \
posrcprefix='$(top_srcdir)/'; \
else \
posrcprefix="../"; \
fi; \
( posrcprefix='$(top_srcdir)/'; \
rm -f $@-t $@ \
&& (sed -e '/^#/d' \
-e "s/^\[.*\] +//" \
-e '/^[ ]*$$/d' \
-e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
| sed -e '$$s/\\$$//') > $@-t \
&& (sed -e '/^#/d' \
-e 's/^[[].*] *//' \
-e '/^[ ]*$$/d' \
-e "s@^@ $$posrcprefix@" $(srcdir)/$@.in \
| sed -e '$$!s/$$/ \\/') > $@-t \
&& chmod a-w $@-t \
&& mv $@-t $@ )
......
......@@ -91,7 +91,7 @@ pyGcomprisPropertiesType_getattr(pyGcomprisPropertiesObject *self, char *name)
}
}
/* enum */
if(strcmp(name,"sreensize")==0) return Py_BuildValue("i", self->cdata->screensize);
if(strcmp(name,"screensize")==0) return Py_BuildValue("i", self->cdata->screensize);
/* enum */
if(strcmp(name,"defaultcursor")==0) return Py_BuildValue("i", self->cdata->defaultcursor);
......
......@@ -79,6 +79,17 @@ class Gcompris_tuxpaint:
if (Prop.fullscreen and eval(self.config_dict['fullscreen'])):
options.append('--fullscreen')
# tuxpaint size are 800x600 and 640x480 in 9.14
# in cvs (future 9.15) it will be
# [--640x480 | --800x600 | --1024x768 |
# --1280x1024 | --1400x1050 | --1600x1200]
if (Prop.screensize and eval(self.config_dict['size'])):
if (Prop.screensize >=1):
print 'Prop.screensize', Prop.screensize
options.append('--800x600')
else:
options.append('--640x480')
if eval(self.config_dict['disable_shape_rotation']):
options.append('--simpleshapes')
......@@ -173,6 +184,10 @@ class Gcompris_tuxpaint:
gcompris.separator()
gcompris.boolean_box(_('Inherit size setting from GCompris (800x600, 640x480)'), 'size', eval(self.config_dict['size']))
gcompris.separator()
gcompris.boolean_box(_('Disable shape rotation'), 'disable_shape_rotation', eval(self.config_dict['disable_shape_rotation']))
gcompris.separator()
......@@ -200,7 +215,8 @@ class Gcompris_tuxpaint:
'disable_shape_rotation' : 'False',
'uppercase_text' : 'False',
'disable_stamps' : 'False',
'disable_stamps_control' : 'False'
'disable_stamps_control' : 'False',
'size' : 'True'
}
return default_config_dict
......@@ -209,6 +225,15 @@ def child_callback(fd, cond, data):
#board.window.set_property("accept-focus", 1)
#board.window.set_keep_above(False)
gcompris.sound.reopen()
#a bug in tuxpaint 9.14: it does not suppress it lockfile
lockfile = os.getenv('HOME') + '/.tuxpaint/lockfile.dat'
try:
os.remove(lockfile)
except:
print lockfile, 'not removed.'
global pid
pid = None
gcompris.bar_hide(0)
......
......@@ -369,8 +369,6 @@ gboolean gcompris_db_check_boards()
}
#define Q(a) a==NULL ? "" : "\'", a==NULL ? "NULL" : a, a==NULL ? "" : "\'"
#define BOARD_INSERT \
"INSERT OR REPLACE INTO boards VALUES (%d, %Q, %d, %Q, %Q, %Q, %Q, %d, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q);"
......@@ -1186,14 +1184,14 @@ GcomprisClass *gcompris_get_class_from_id(gint class_id)
}
#define CHECK_CONF(p, b, k) \
"SELECT * FROM board_profile_conf WHERE profile_id=%d AND board_id=%d AND conf_key=%s%s%s;", p, b, Q(k)
#define CHECK_CONF \
"SELECT * FROM board_profile_conf WHERE profile_id=%d AND board_id=%d AND conf_key=%Q;"
#define INSERT_KEY(p, b, k, v) \
"INSERT INTO board_profile_conf (profile_id, board_id, conf_key, conf_value) VALUES (%d, %d, %s%s%s, %s%s%s);", p, b, Q(k), Q(v)
#define INSERT_KEY \
"INSERT INTO board_profile_conf (profile_id, board_id, conf_key, conf_value) VALUES (%d, %d, %Q, %Q);"
#define UPDATE_KEY(p, b, k, v) \
"UPDATE board_profile_conf SET conf_value=%s%s%s WHERE profile_id=%d AND board_id=%d AND conf_key=%s%s%s;", Q(v), p, b, Q(k)
#define UPDATE_KEY \
"UPDATE board_profile_conf SET conf_value=%Q WHERE profile_id=%d AND board_id=%d AND conf_key=%Q;"
void gcompris_set_board_conf(GcomprisProfile *profile,
GcomprisBoard *board,
......@@ -1208,10 +1206,11 @@ void gcompris_set_board_conf(GcomprisProfile *profile,
gchar *request;
#ifdef USE_SQLITE
request = g_strdup_printf(CHECK_CONF(profile->profile_id,
board->board_id,
key));
request = sqlite3_mprintf(CHECK_CONF,
profile->profile_id,
board->board_id,
key);
rc = sqlite3_get_table(gcompris_db,
request,
&result,
......@@ -1224,13 +1223,14 @@ void gcompris_set_board_conf(GcomprisProfile *profile,
g_error("SQL error: %s\n", zErrMsg);
}
g_free(request);
sqlite3_free(request);
if (nrow == 0){
request = g_strdup_printf(INSERT_KEY(profile->profile_id,
board->board_id,
key,
value));
request = sqlite3_mprintf(INSERT_KEY,
profile->profile_id,
board->board_id,
key,
value);
rc = sqlite3_get_table(gcompris_db,
request,
......@@ -1244,12 +1244,14 @@ void gcompris_set_board_conf(GcomprisProfile *profile,
g_error("SQL error: %s\n", zErrMsg);
}
g_free(request);
sqlite3_free(request);
} else {
request = g_strdup_printf(UPDATE_KEY(profile->profile_id,
board->board_id,
key,
value));
request = sqlite3_mprintf(UPDATE_KEY,
value,
profile->profile_id,
board->board_id,
key
);
rc = sqlite3_get_table(gcompris_db,
request,
......@@ -1262,8 +1264,8 @@ void gcompris_set_board_conf(GcomprisProfile *profile,
if( rc!=SQLITE_OK ){
g_error("SQL error: %s\n", zErrMsg);
}
g_free(request);
sqlite3_free(request);
}
#endif
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment