From fe8aea1c3b5348347633da18a02b0bffd3b266a1 Mon Sep 17 00:00:00 2001 From: Perberos Date: Thu, 1 Dec 2011 21:42:39 -0300 Subject: moving from https://github.com/perberos/mate-desktop-environment --- python/Makefile.am | 37 +++ python/Makefile.in | 652 ++++++++++++++++++++++++++++++++++++++++++++ python/bad__init__.py | 11 + python/demo.py | 7 + python/mateweather.defs | 326 ++++++++++++++++++++++ python/mateweather.override | 104 +++++++ python/mateweathermodule.c | 45 +++ 7 files changed, 1182 insertions(+) create mode 100644 python/Makefile.am create mode 100644 python/Makefile.in create mode 100644 python/bad__init__.py create mode 100644 python/demo.py create mode 100644 python/mateweather.defs create mode 100644 python/mateweather.override create mode 100644 python/mateweathermodule.c (limited to 'python') diff --git a/python/Makefile.am b/python/Makefile.am new file mode 100644 index 0000000..9593a7a --- /dev/null +++ b/python/Makefile.am @@ -0,0 +1,37 @@ +if BUILD_PYTHON +INCLUDES = \ + -I$(top_srcdir) \ + $(PYTHON_INCLUDES) \ + $(PYGOBJECT_CFLAGS) \ + $(GTK_CFLAGS) + +pyunstabledir = $(pyexecdir)/mateweather/I_KNOW_THIS_IS_UNSTABLE +pyunstable_LTLIBRARIES = mateweather.la +mateweather_la_LDFLAGS = -module -avoid-version -export-symbols-regex initmateweather +mateweather_la_LIBADD = ../libmateweather/libmateweather.la +mateweather_la_SOURCES = mateweathermodule.c +nodist_mateweather_la_SOURCES = mateweather.c +mateweather.c: mateweather.defs mateweather.override + +.defs.c: + $(AM_V_GEN)(cd $(srcdir)\ + && pygobject-codegen-2.0 \ + --register $(PYGTK_DEFS) \ + --override $*.override \ + --prefix py$* $*.defs) > gen-$*.c \ + && cp gen-$*.c $*.c \ + && rm -f gen-$*.c + +install-exec-hook: + $(MKDIR_P) "$(DESTDIR)$(pyunstabledir)" + $(INSTALL_DATA) $(srcdir)/bad__init__.py "$(DESTDIR)$(pyexecdir)/mateweather/__init__.py" + touch $(DESTDIR)$(pyunstabledir)/__init__.py + chmod a+x $(DESTDIR)$(pyunstabledir)/__init__.py + +endif + +EXTRA_DIST = mateweather.defs mateweather.override bad__init__.py demo.py + +CLEANFILES = mateweather.c + +-include $(top_srcdir)/git.mk diff --git a/python/Makefile.in b/python/Makefile.in new file mode 100644 index 0000000..3e12868 --- /dev/null +++ b/python/Makefile.in @@ -0,0 +1,652 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = python +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gtk-doc.m4 \ + $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(pyunstabledir)" +LTLIBRARIES = $(pyunstable_LTLIBRARIES) +@BUILD_PYTHON_TRUE@mateweather_la_DEPENDENCIES = \ +@BUILD_PYTHON_TRUE@ ../libmateweather/libmateweather.la +am__mateweather_la_SOURCES_DIST = mateweathermodule.c +@BUILD_PYTHON_TRUE@am_mateweather_la_OBJECTS = mateweathermodule.lo +@BUILD_PYTHON_TRUE@nodist_mateweather_la_OBJECTS = mateweather.lo +mateweather_la_OBJECTS = $(am_mateweather_la_OBJECTS) \ + $(nodist_mateweather_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +mateweather_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(mateweather_la_LDFLAGS) $(LDFLAGS) -o \ + $@ +@BUILD_PYTHON_TRUE@am_mateweather_la_rpath = -rpath $(pyunstabledir) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(mateweather_la_SOURCES) $(nodist_mateweather_la_SOURCES) +DIST_SOURCES = $(am__mateweather_la_SOURCES_DIST) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMPRESS_EXT = @COMPRESS_EXT@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLADEDIR = @GLADEDIR@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ +LIBSOUP_LIBS = @LIBSOUP_LIBS@ +LIBSOUP_MATE_CFLAGS = @LIBSOUP_MATE_CFLAGS@ +LIBSOUP_MATE_LIBS = @LIBSOUP_MATE_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBXML_CFLAGS = @LIBXML_CFLAGS@ +LIBXML_LIBS = @LIBXML_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_VERSION = @LT_VERSION@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MATECONFTOOL = @MATECONFTOOL@ +MATECONF_CFLAGS = @MATECONF_CFLAGS@ +MATECONF_LIBS = @MATECONF_LIBS@ +MATECONF_SCHEMA_CONFIG_SOURCE = @MATECONF_SCHEMA_CONFIG_SOURCE@ +MATECONF_SCHEMA_FILE_DIR = @MATECONF_SCHEMA_FILE_DIR@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +PYGOBJECT_CFLAGS = @PYGOBJECT_CFLAGS@ +PYGOBJECT_LIBS = @PYGOBJECT_LIBS@ +PYGTK_DEFS = @PYGTK_DEFS@ +PYTHON = @PYTHON@ +PYTHONDIR = @PYTHONDIR@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_INCLUDES = @PYTHON_INCLUDES@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +REGEX_LIBS = @REGEX_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +@BUILD_PYTHON_TRUE@INCLUDES = \ +@BUILD_PYTHON_TRUE@ -I$(top_srcdir) \ +@BUILD_PYTHON_TRUE@ $(PYTHON_INCLUDES) \ +@BUILD_PYTHON_TRUE@ $(PYGOBJECT_CFLAGS) \ +@BUILD_PYTHON_TRUE@ $(GTK_CFLAGS) + +@BUILD_PYTHON_TRUE@pyunstabledir = $(pyexecdir)/mateweather/I_KNOW_THIS_IS_UNSTABLE +@BUILD_PYTHON_TRUE@pyunstable_LTLIBRARIES = mateweather.la +@BUILD_PYTHON_TRUE@mateweather_la_LDFLAGS = -module -avoid-version -export-symbols-regex initmateweather +@BUILD_PYTHON_TRUE@mateweather_la_LIBADD = ../libmateweather/libmateweather.la +@BUILD_PYTHON_TRUE@mateweather_la_SOURCES = mateweathermodule.c +@BUILD_PYTHON_TRUE@nodist_mateweather_la_SOURCES = mateweather.c +EXTRA_DIST = mateweather.defs mateweather.override bad__init__.py demo.py +CLEANFILES = mateweather.c +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .defs .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu python/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu python/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pyunstableLTLIBRARIES: $(pyunstable_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pyunstabledir)" || $(MKDIR_P) "$(DESTDIR)$(pyunstabledir)" + @list='$(pyunstable_LTLIBRARIES)'; test -n "$(pyunstabledir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pyunstabledir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pyunstabledir)"; \ + } + +uninstall-pyunstableLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pyunstable_LTLIBRARIES)'; test -n "$(pyunstabledir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pyunstabledir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pyunstabledir)/$$f"; \ + done + +clean-pyunstableLTLIBRARIES: + -test -z "$(pyunstable_LTLIBRARIES)" || rm -f $(pyunstable_LTLIBRARIES) + @list='$(pyunstable_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +mateweather.la: $(mateweather_la_OBJECTS) $(mateweather_la_DEPENDENCIES) + $(AM_V_CCLD)$(mateweather_la_LINK) $(am_mateweather_la_rpath) $(mateweather_la_OBJECTS) $(mateweather_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mateweather.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mateweathermodule.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(pyunstabledir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +@BUILD_PYTHON_FALSE@install-exec-hook: +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pyunstableLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pyunstableLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pyunstableLTLIBRARIES + +.MAKE: install-am install-exec-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pyunstableLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-exec-hook \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-pyunstableLTLIBRARIES install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-pyunstableLTLIBRARIES + +@BUILD_PYTHON_TRUE@mateweather.c: mateweather.defs mateweather.override + +@BUILD_PYTHON_TRUE@.defs.c: +@BUILD_PYTHON_TRUE@ $(AM_V_GEN)(cd $(srcdir)\ +@BUILD_PYTHON_TRUE@ && pygobject-codegen-2.0 \ +@BUILD_PYTHON_TRUE@ --register $(PYGTK_DEFS) \ +@BUILD_PYTHON_TRUE@ --override $*.override \ +@BUILD_PYTHON_TRUE@ --prefix py$* $*.defs) > gen-$*.c \ +@BUILD_PYTHON_TRUE@ && cp gen-$*.c $*.c \ +@BUILD_PYTHON_TRUE@ && rm -f gen-$*.c + +@BUILD_PYTHON_TRUE@install-exec-hook: +@BUILD_PYTHON_TRUE@ $(MKDIR_P) "$(DESTDIR)$(pyunstabledir)" +@BUILD_PYTHON_TRUE@ $(INSTALL_DATA) $(srcdir)/bad__init__.py "$(DESTDIR)$(pyexecdir)/mateweather/__init__.py" +@BUILD_PYTHON_TRUE@ touch $(DESTDIR)$(pyunstabledir)/__init__.py +@BUILD_PYTHON_TRUE@ chmod a+x $(DESTDIR)$(pyunstabledir)/__init__.py + +-include $(top_srcdir)/git.mk + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/python/bad__init__.py b/python/bad__init__.py new file mode 100644 index 0000000..11a6970 --- /dev/null +++ b/python/bad__init__.py @@ -0,0 +1,11 @@ +# The correct idiom is +# from mateweather.I_KNOW_THIS_IS_UNSTABLE import mateweather + +def location_new_world(use_regions): + raise ImportError("libmateweather should only be used if you understand that it's subject to change, and is not supported as a fixed API/ABI or as part of the platform") + +def location_entry_new(top): + raise ImportError("libmateweather should only be used if you understand that it's subject to change, and is not supported as a fixed API/ABI or as part of the platform") + +def timezone_menu_new(top): + raise ImportError("libmateweather should only be used if you understand that it's subject to change, and is not supported as a fixed API/ABI or as part of the platform") diff --git a/python/demo.py b/python/demo.py new file mode 100644 index 0000000..4ecb0f1 --- /dev/null +++ b/python/demo.py @@ -0,0 +1,7 @@ +from mateweather.I_KNOW_THIS_IS_UNSTABLE import mateweather + +for loc in mateweather.location_new_world(False).get_children(): + print loc.get_name() + for zone in loc.get_timezones(): + if zone.get_name() is not None: + print " %s" % zone.get_name() diff --git a/python/mateweather.defs b/python/mateweather.defs new file mode 100644 index 0000000..bfbf24a --- /dev/null +++ b/python/mateweather.defs @@ -0,0 +1,326 @@ +;; -*- scheme -*- +; boxed definitions ... + +(define-boxed Location + (in-module "MateWeather") + (c-name "MateWeatherLocation") + (gtype-id "MATEWEATHER_TYPE_LOCATION") +) + +(define-boxed Timezone + (in-module "MateWeather") + (c-name "MateWeatherTimezone") + (gtype-id "MATEWEATHER_TYPE_TIMEZONE") +) + +; interface definitions ... + +; object definitions ... + +(define-object LocationEntry + (in-module "MateWeather") + (parent "GtkEntry") + (c-name "MateWeatherLocationEntry") + (gtype-id "MATEWEATHER_TYPE_LOCATION_ENTRY") +) + +(define-object TimezoneMenu + (in-module "MateWeather") + (parent "GtkComboBox") + (c-name "MateWeatherTimezoneMenu") + (gtype-id "MATEWEATHER_TYPE_TIMEZONE_MENU") +) + +; pointer definitions ... + +;; Enumerations and Flags ... + +(define-enum LocationLevel + (in-module "MateWeather") + (c-name "MateWeatherLocationLevel") + (gtype-id "MATEWEATHER_TYPE_LOCATION_LEVEL") + (values + '("world" "MATEWEATHER_LOCATION_WORLD") + '("region" "MATEWEATHER_LOCATION_REGION") + '("country" "MATEWEATHER_LOCATION_COUNTRY") + '("adm1" "MATEWEATHER_LOCATION_ADM1") + '("adm2" "MATEWEATHER_LOCATION_ADM2") + '("city" "MATEWEATHER_LOCATION_CITY") + '("weather-station" "MATEWEATHER_LOCATION_WEATHER_STATION") + ) +) + + +;; From mateweather-enum-types.h + +(define-function g_weather_location_level_get_type + (c-name "g_weather_location_level_get_type") + (return-type "GType") +) + + + +;; From mateweather-location.h + +(define-function location_get_type + (c-name "mateweather_location_get_type") + (return-type "GType") +) + +(define-function location_new_world + (c-name "mateweather_location_new_world") + (return-type "MateWeatherLocation*") + (parameters + '("gboolean" "use_regions") + ) +) + +(define-method ref + (of-object "MateWeatherLocation") + (c-name "mateweather_location_ref") + (return-type "MateWeatherLocation*") +) + +(define-method unref + (of-object "MateWeatherLocation") + (c-name "mateweather_location_unref") + (return-type "none") +) + +(define-method get_name + (of-object "MateWeatherLocation") + (c-name "mateweather_location_get_name") + (return-type "const-char*") +) + +(define-method get_sort_name + (of-object "MateWeatherLocation") + (c-name "mateweather_location_get_sort_name") + (return-type "const-char*") +) + +(define-method get_level + (of-object "MateWeatherLocation") + (c-name "mateweather_location_get_level") + (return-type "MateWeatherLocationLevel") +) + +(define-method get_parent + (of-object "MateWeatherLocation") + (c-name "mateweather_location_get_parent") + (return-type "MateWeatherLocation*") +) + +(define-method get_children + (of-object "MateWeatherLocation") + (c-name "mateweather_location_get_children") + (return-type "MateWeatherLocation**") +) + +(define-method free_children + (of-object "MateWeatherLocation") + (c-name "mateweather_location_free_children") + (return-type "none") + (parameters + '("MateWeatherLocation**" "children") + ) +) + +(define-method has_coords + (of-object "MateWeatherLocation") + (c-name "mateweather_location_has_coords") + (return-type "gboolean") +) + +(define-method get_coords + (of-object "MateWeatherLocation") + (c-name "mateweather_location_get_coords") + (return-type "none") + (parameters + '("double*" "latitude") + '("double*" "longitude") + ) +) + +(define-method get_distance + (of-object "MateWeatherLocation") + (c-name "mateweather_location_get_distance") + (return-type "double") + (parameters + '("MateWeatherLocation*" "loc2") + ) +) + +(define-method get_country + (of-object "MateWeatherLocation") + (c-name "mateweather_location_get_country") + (return-type "const-char*") +) + +(define-method get_timezone + (of-object "MateWeatherLocation") + (c-name "mateweather_location_get_timezone") + (return-type "MateWeatherTimezone*") +) + +(define-method get_timezones + (of-object "MateWeatherLocation") + (c-name "mateweather_location_get_timezones") + (return-type "MateWeatherTimezone**") +) + +(define-method free_timezones + (of-object "MateWeatherLocation") + (c-name "mateweather_location_free_timezones") + (return-type "none") + (parameters + '("MateWeatherTimezone**" "zones") + ) +) + +(define-method get_code + (of-object "MateWeatherLocation") + (c-name "mateweather_location_get_code") + (return-type "const-char*") +) + +(define-method get_city_name + (of-object "MateWeatherLocation") + (c-name "mateweather_location_get_city_name") + (return-type "char*") +) + +(define-method get_weather + (of-object "MateWeatherLocation") + (c-name "mateweather_location_get_weather") + (return-type "WeatherInfo*") +) + + + +;; From mateweather-timezone.h + +(define-function timezone_get_type + (c-name "mateweather_timezone_get_type") + (return-type "GType") +) + +(define-method get_name + (of-object "MateWeatherTimezone") + (c-name "mateweather_timezone_get_name") + (return-type "const-char*") +) + +(define-method get_tzid + (of-object "MateWeatherTimezone") + (c-name "mateweather_timezone_get_tzid") + (return-type "const-char*") +) + +(define-method get_offset + (of-object "MateWeatherTimezone") + (c-name "mateweather_timezone_get_offset") + (return-type "int") +) + +(define-method has_dst + (of-object "MateWeatherTimezone") + (c-name "mateweather_timezone_has_dst") + (return-type "gboolean") +) + +(define-method get_dst_offset + (of-object "MateWeatherTimezone") + (c-name "mateweather_timezone_get_dst_offset") + (return-type "int") +) + +(define-method ref + (of-object "MateWeatherTimezone") + (c-name "mateweather_timezone_ref") + (return-type "MateWeatherTimezone*") +) + +(define-method unref + (of-object "MateWeatherTimezone") + (c-name "mateweather_timezone_unref") + (return-type "none") +) + + + +;; From location-entry.h + +(define-function location_entry_get_type + (c-name "mateweather_location_entry_get_type") + (return-type "GType") +) + +(define-function location_entry_new + (c-name "mateweather_location_entry_new") + (is-constructor-of "MateWeatherLocationEntry") + (return-type "GtkWidget*") + (properties + '("top") + ) +) + +(define-method set_location + (of-object "MateWeatherLocationEntry") + (c-name "mateweather_location_entry_set_location") + (return-type "none") + (parameters + '("MateWeatherLocation*" "loc") + ) +) + +(define-method get_location + (of-object "MateWeatherLocationEntry") + (c-name "mateweather_location_entry_get_location") + (return-type "MateWeatherLocation*") +) + +(define-method set_city + (of-object "MateWeatherLocationEntry") + (c-name "mateweather_location_entry_set_city") + (return-type "none") + (parameters + '("const-char*" "city_name") + '("const-char*" "code") + ) +) + + + +;; From timezone-menu.h + +(define-function timezone_menu_get_type + (c-name "mateweather_timezone_menu_get_type") + (return-type "GType") +) + +(define-function timezone_menu_new + (c-name "mateweather_timezone_menu_new") + (is-constructor-of "MateWeatherTimezoneMenu") + (return-type "GtkWidget*") + (properties + '("top") + ) +) + +(define-method set_tzid + (of-object "MateWeatherTimezoneMenu") + (c-name "mateweather_timezone_menu_set_tzid") + (return-type "none") + (parameters + '("const-char*" "tzid") + ) +) + +(define-method get_tzid + (of-object "MateWeatherTimezoneMenu") + (c-name "mateweather_timezone_menu_get_tzid") + (return-type "const-char*") +) + + diff --git a/python/mateweather.override b/python/mateweather.override new file mode 100644 index 0000000..16ce1e0 --- /dev/null +++ b/python/mateweather.override @@ -0,0 +1,104 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * + * mateweather.override: overrides for mateweather + */ +%% +headers +#define NO_IMPORT_PYGOBJECT +#include "pygobject.h" + +#define MATEWEATHER_I_KNOW_THIS_IS_UNSTABLE +#include +#include +#include +#include +#include + +%% +modulename mateweather +%% +import gtk.Entry as PyGtkEntry_Type +import gtk.ComboBox as PyGtkComboBox_Type +%% +ignore + mateweather_location_get_weather + mateweather_location_free_children + mateweather_location_free_timezones +%% +ignore-glob + *_get_type + *_ref + *_unref +%% +override mateweather_location_get_children +static PyObject * +_wrap_mateweather_location_get_children (PyGObject *self, PyObject *args) +{ + MateWeatherLocation *loc, **children; + int i; + PyObject *pychildren, *pychild; + + loc = pyg_boxed_get (self, MateWeatherLocation); + children = mateweather_location_get_children (loc); + for (i = 0; children[i]; i++) + ; + + pychildren = PyList_New (i); + for (i = 0; children[i]; i++) { + pychild = pyg_boxed_new (MATEWEATHER_TYPE_LOCATION, children[i], TRUE, TRUE); + PyList_SetItem (pychildren, i, pychild); + } + + mateweather_location_free_children (loc, children); + return pychildren; +} +%% +override mateweather_location_get_timezones +static PyObject * +_wrap_mateweather_location_get_timezones (PyGObject *self, PyObject *args) +{ + MateWeatherLocation *loc; + MateWeatherTimezone **zones; + int i; + PyObject *pyzones, *pyzone; + + loc = pyg_boxed_get (self, MateWeatherLocation); + zones = mateweather_location_get_timezones (loc); + for (i = 0; zones[i]; i++) + ; + + pyzones = PyList_New (i); + for (i = 0; zones[i]; i++) { + pyzone = pyg_boxed_new (MATEWEATHER_TYPE_TIMEZONE, zones[i], TRUE, TRUE); + PyList_SetItem (pyzones, i, pyzone); + } + + mateweather_location_free_timezones (loc, zones); + return pyzones; +} +%% +override mateweather_location_get_coords +static PyObject * +_wrap_mateweather_location_get_coords (PyGObject *self, PyObject *args) +{ + MateWeatherLocation *loc; + double latitude, longitude; + PyObject *ret; + + loc = pyg_boxed_get (self, MateWeatherLocation); + if (!mateweather_location_has_coords (loc)) { + Py_INCREF (Py_None); + return Py_None; + } + + mateweather_location_get_coords (loc, &latitude, &longitude); + ret = PyTuple_New (2); + PyTuple_SetItem (ret, 0, PyFloat_FromDouble (latitude)); + PyTuple_SetItem (ret, 1, PyFloat_FromDouble (longitude)); + return ret; +} +%% +new-constructor MATEWEATHER_TYPE_LOCATION_ENTRY +%% +new-constructor MATEWEATHER_TYPE_TIMEZONE_MENU +%% diff --git a/python/mateweathermodule.c b/python/mateweathermodule.c new file mode 100644 index 0000000..9427849 --- /dev/null +++ b/python/mateweathermodule.c @@ -0,0 +1,45 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * + * mateweathermodule.c: module wrapping mateweather. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see + * . + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* include this first, before NO_IMPORT_PYGOBJECT is defined */ +#include + +void pymateweather_register_classes (PyObject *d); +void pymateweather_add_constants(PyObject *module, const gchar *strip_prefix); +void _pymateweather_register_boxed_types(void); + +extern PyMethodDef pymateweather_functions[]; + +DL_EXPORT(void) +initmateweather(void) +{ + PyObject *m, *d; + + init_pygobject (); + g_thread_init (NULL); + + m = Py_InitModule ("mateweather", pymateweather_functions); + d = PyModule_GetDict (m); + pymateweather_register_classes (d); + pymateweather_add_constants(m, "MATEWEATHER_"); +} -- cgit v1.2.1