Commit 32e0353d authored by Bastien Nocera's avatar Bastien Nocera Committed by Bastien Nocera
Browse files

Add, mostly copied from gnome-applets

2007-11-22  Bastien Nocera  <hadess@hadess.net>

	* Makefile.am:
	* autogen.sh:
	* configure.in: Add, mostly copied from gnome-applets

2007-11-22  Bastien Nocera  <hadess@hadess.net>

	* *: Move and update from gnome-applets

2007-11-22  Bastien Nocera  <hadess@hadess.net>

	* *: Import from gnome-applets trunk


svn path=/trunk/; revision=3
parent 09ba31d4
2007-11-22 Bastien Nocera <hadess@hadess.net>
* Makefile.am:
* autogen.sh:
* configure.in: Add, mostly copied from gnome-applets
2007-11-22 Bastien Nocera <hadess@hadess.net>
* MAINTAINERS: add
......
SUBDIRS = po libgweather
EXTRA_DIST = \
MAINTAINERS \
intltool-update.in \
intltool-extract.in \
intltool-merge.in
DISTCLEANFILES = intltool-extract \
intltool-merge \
intltool-update
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
PKG_NAME="libgweather"
(test -f $srcdir/configure.in \
&& test -d $srcdir/libgweather) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level libgweather directory"
exit 1
}
which gnome-autogen.sh || {
echo "You need to install gnome-common from the GNOME CVS"
exit 1
}
REQUIRED_AUTOMAKE_VERSION=1.8 \
USE_GNOME2_MACROS=1 \
. gnome-autogen.sh
AC_INIT(libgweather, 2.21.1)
AC_PREREQ(2.59)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(1.8)
GTK_REQUIRED=2.11.0
GLIB_REQUIRED=2.13.0
GNOME_VFS_REQUIRED=2.15.4
GCONF_REQUIRED=2.8.0
AM_MAINTAINER_MODE
IT_PROG_INTLTOOL([0.35.0])
PKG_PROG_PKG_CONFIG([0.19])
AC_PROG_CC
AM_PROG_CC_C_O
AC_ISC_POSIX
AC_STDC_HEADERS
AM_PROG_LIBTOOL
GNOME_COMPILE_WARNINGS
dnl ***************************************************************************
dnl *** --enable-more-warnings turns on more compiler warnings ***
dnl ***************************************************************************
AC_ARG_ENABLE(more-warnings,
[ --enable-more-warnings Maximum compiler warnings],
set_more_warnings="$enableval",[
set_more_warnings=no
])
AC_MSG_CHECKING(for more warnings, including -Werror)
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
AC_MSG_RESULT(yes)
CFLAGS="\
-Wall \
-Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
-Wnested-externs -Wpointer-arith \
-Wcast-align -Wsign-compare \
-std=gnu89 \
$CFLAGS"
for option in -Wno-strict-aliasing -Wno-sign-compare; do
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $option"
AC_MSG_CHECKING([whether gcc understands $option])
AC_TRY_COMPILE([], [],
has_option=yes,
has_option=no,)
if test $has_option = no; then
CFLAGS="$SAVE_CFLAGS"
fi
AC_MSG_RESULT($has_option)
unset has_option
unset SAVE_CFLAGS
done
unset option
else
AC_MSG_RESULT(no)
fi
dnl -- Check for GTK+ 2.0 (required) ------------------------------------------
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_REQUIRED)
AC_SUBST(GTK_FLAGS)
AC_SUBST(GTK_LIBS)
dnl -- check for gnome-vfs (optional) -----------------------------------------
PKG_CHECK_MODULES(GNOME_VFS_APPLETS,
[gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED])
AC_SUBST(GNOME_VFS_APPLETS_CFLAGS)
AC_SUBST(GNOME_VFS_APPLETS_LIBS)
AM_GCONF_SOURCE_2
dnl gettext
GETTEXT_PACKAGE=libgweather
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext Package])
dnl AC_DEFINE_DIR(GNOMELOCALEDIR, "${datadir}/locale", [locale directory])
AM_GLIB_GNU_GETTEXT
# this is the directory where the *.{mo,gmo} files are installed
gnomelocaledir='${prefix}/${DATADIRNAME}/locale'
AC_SUBST(gnomelocaledir)
dnl ***************************************************************************
dnl *** Check for presence of tm.tm_gmtoff on the system ***
dnl ***************************************************************************
AC_CHECK_MEMBER([struct tm.tm_gmtoff],[struct_tm_tm_gmtoff=true],[struct_tm_tm_gmtoff=false],[#include <time.h>])
case $struct_tm_tm_gmtoff in
true)
AC_DEFINE_UNQUOTED(HAVE_TM_TM_GMOFF, 1, Have the tm.tm_gmtoff member.)
;;
*)
AC_CHECK_DECL(timezone,AC_DEFINE(HAVE_TIMEZONE,1,Have timezone),,
[
#include <time.h>
])
;;
esac
dnl ***************************************************************************
dnl *** _NL_MEASUREMENT_MEASUREMENT is an enum and not a define ***
dnl ***************************************************************************
AC_MSG_CHECKING([for _NL_MEASUREMENT_MEASUREMENT])
AC_TRY_LINK([#include <langinfo.h>], [
char c;
c = *((unsigned char *) nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));
], gtk_ok=yes, gtk_ok=no)
AC_MSG_RESULT($gtk_ok)
if test "$gtk_ok" = "yes"; then
AC_DEFINE([HAVE__NL_MEASUREMENT_MEASUREMENT], [1],
[Define if _NL_MEASUREMENT_MEASUREMENT is available])
fi
dnl ***************************************************************************
dnl *** Honour aclocal flags ***
dnl ***************************************************************************
ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}"
AC_SUBST(ACLOCAL_AMFLAGS)
AC_SUBST(VERSION)
AC_SUBST(PACKAGE)
AC_SUBST(DATADIR)
AC_SUBST(LIBDIR)
AC_SUBST(PYTHONDIR)
AC_SUBST(GLADEDIR)
dnl ***************************************************************************
dnl *** Output Makefiles et al ***
dnl ***************************************************************************
AC_OUTPUT([
Makefile
po/Makefile.in
libgweather/Makefile
libgweather/gweather.pc
])
dnl ***************************************************************************
dnl *** Display Summary ***
dnl ***************************************************************************
echo "
libgweather-$VERSION configure summary:
Prefix: ${prefix}
Source code location: ${srcdir}
Compiler: ${CC}
Building:
Enabling IPv6: $have_ipv6
" >&2
The library:
Philip Langdale <philipl@mail.utexas.edu>
Almost all of the code is refactored from the gweather applet,
so checkout that AUTHORS file too.
2007-11-22 Bastien Nocera <hadess@hadess.net>
* *: Import from gnome-applets trunk
2007-11-16 Callum McKenzie <callum@spooky-possum.org>
* weather-iwin.c: Removed unused (#if 0) code, look in SVN if it
turns out to have been important. Prevent a random space appearing
in the forecast (patch from Michael Vrable, Bug #497204). Add a
bit of explanation about what that piece of code is trying to do.
2007-11-04 Callum McKenzie <callum@spooky-possum.org>
* gweather-prefs.c: Change the guard #ifdefs for nl_langinfo stuff
so that autoconfig works correctly. Patch from Matthias Clasen
(Bug #491438). Also added an #ifdef around the langingo.h #include
in case the file isn't present at all (Mac OS X?).
* weather.c (weather_info_abort): Ensure the requests_pending flag
is cleared on abort. Another Matias Clasen special (Bug #491437).
* weather.h (weather_info_update): Remove a trailing ; from the
macro. Spotted by Matthias Clasen (Bug #491435).
2007-10-13 Callum McKenzie <callum@spooky-possum.org>
* weather.c (temperature_string): Use appropriate unicode Degree
Celsius and Degree Fahrenheit symbols instead of the generic
Degree symbol. Patch from Alex Jones (Bug #468887).
* gweather.pc.in (Libs): Make sure the library is linked in. Patch
courtesy of Matthias Clasen (bug #479172). Also added -lm to the
libs list for completeness.
2007-07-12 Callum McKenzie <callum@spooky-possum.org>
* weather-metar.c (make_time): Fix the logic to only fiddle the
day number on the 1st. Based on Elliott Hughes patch from bug
#455012. Improved comments.
2007-07-11 Callum McKenzie <callum@spooky-possum.org>
* weather-sun.c (calc_sun): Use the current time rather than the
observation time to calculate the sunrise and sunset times. Fixes
the case where the observation gets horribly out of date. See bug
#455012.
2007-05-13 Kjartan Maraas <kmaraas@gnome.org>
* Makefile.am: Add GNOME_APPLETS_CFLAGS to get
GConf includes. Fixes the build for me.
2007-01-05 Kjartan Maraas <kmaraas@gnome.org>
* weather-met.c: s/malloc.h/stdlib.h/
Closes bug #387179. Patch from Roy Marples.
2006-08-07 Davyd Madeley <davyd@madeley.id.au>
* weather-bom.c:
* weather-met.c:
- catch possible NULL pointers when parsing strings. Patches from
Kevin Bauder <kevin.bauder@gmail.com>. Closes #170628.
2006-07-23 Davyd Madeley <davyd@madeley.id.au>
* gweather.schemas.in: update schema descriptions, patch from
Adam Petaccia. Closes #167195.
2006-07-02 Kjartan Maraas <kmaraas@gnome.org>
* Makefile.am: Cygwin portability. Patch from Cygwin Ports Maintainer.
Closes bug #341495.
2006-01-31 Davyd Madeley <davyd@madeley.id.au>
* weather.c: replace sscanf with g_strsplit to prevent stack smashing.
Closes original #327406.
2006-01-17 Theppitak Karoonboonyanan <thep@linux.thai.net>
* gweather-prefs.c: add "atm" as possible unit in translator comment
for DEFAULT_PRESSURE_UNIT. Closes #327275.
2006-01-15 Davyd Madeley <davyd@madeley.id.au>
* gweather-prefs.c:
* weather-priv.h:
* weather.c:
* weather.h: add atmospheres as a unit of pressure
Patch from Alexandros Frantzis <alfius@freemail.gr>. Closes
#325447.
2006-01-15 Davyd Madeley <davyd@madeley.id.au>
* weather-sun.c: fix a crasher that was hinted to at a compiler
warning
2006-01-15 Davyd Madeley <davyd@madeley.id.au>
* Makefile.am:
* test_metar.c: New program to test station report parsing
* weather-metar.c: (metar_parse): remove 'static'
* weather-priv.h: add metar_parse()
Patch from Frank Solensky <frank@solensky.org>. Closes #144792.
2006-01-15 Davyd Madeley <davyd@madeley.id.au>
* weather.c:
* weather-priv.h: move prototype for calc_sun to header and remove
static declaration.
2006-01-12 Frank Solensky <frank@solensky.org>
* Makefile.am:
* weather.h:
* weather.c:
* weather-sun.c: move sun calculations out to new source file
2005-12-31 Davyd Madeley <davyd@madeley.id.au>
* weather-metar.c: (metar_tok_temp):
* weather.c: (calc_humidity): dewpoint is optional
Closes gweather bug 172711. Patch from Frank Solensky
<frank@solensky.org>
* gweather-gconf.c: looks like the last commit stopped this compiling,
fixed it up
2005-12-31 Simos Xenitellis <simos@gnome.org>
* gweather-gconf.c: Added translator comments for the DEFAULT_*
strings, the strings to specify the default location per locale.
2005-12-11 Philip Langdale <philipl@mail.utexas.edu>
A gweather-gconf.c
A gweather-gconf.h
A gweather-prefs.c
A gweather-prefs.h
A gweather.schemas.in: Merge libgweatherprefs into
libgweather. The extra library isn't worth the hassle
considering that gconf is already a dependency of
libgweather and we currently have no clients that want
the backend without the prefs.
I have merged the libgweathepref ChangeLong entries.
* .cvsignore
* ChangeLog
* Makefile.am
* README
* weather-iwin.c
* weather-metar.c
* weather-wx.c
* weather.c: Update to reflect the merged files.
A AUTHORS:
R MAINTAINERS: A more accurate description of what
I want to claim at this time. :-)
2005-12-04 Philip Langdale <philipl@mail.utexas.edu>
* gweather-gconf.c
* gweather-gconf.h: Add gweather_gconf_get_client
to provide access to the GConfClient.
* gweather-prefs.c: make gweather_prefs_load work
correctly when called multiple times. The old
radar url was not previously being freed.
2005-11-27 Philip Langdale <philipl@mail.utexas.edu>
Initial checkin of libgweatherprefs.
A .cvsignore
A ChangeLog
A MAINTAINERS
A Makefile.am
A README: Usual building blocks.
A gweather.schemas.in: Brought the schemas over
unchanged from gweather.
A gweatherprefs.pc.in: pkgconfig descriptor.
A gweather-gconf.c
A gweather-gconf.h: Primarily, this encapsulates
the 'current path' notion in an identical way
to libpanelapplet. It is also the new home of
'weather_location_config_read' which files out
a WeatherLocation struct based on the values in
gconf.
A gweather-prefs.c
A gweather-prefs.h: This is, essentially unchanged,
the 'gweather_pref_load' function along with the
enum-to-string helpers it depends on. Obviously
the gconf access now uses the gweather-gconf
methods rather than the panel applet ones.
2005-11-27 Philip Langdale <philipl@mail.utexas.edu>
A .cvsignore:
A Makefile.am: The things no self respecting directory
can be without.
A gweather.pc.in: pkgconfig descriptor.
* weather.c: Remove entanglement with the gweather applet:
- Introduce a simple WeatherPrefs struct to replace the
direct gconf access. The caller can set these prefs as
they wish (reading from gconf is obviously a possibility).
This struct also encapsulates the two odd-man-out global
variables - so the library is now safe for multiple
instances of WeatherInfo.
- Actually use the WeatherInfoFunc callback instead of
hardcoding the applet callback.
- Refactor the cancelling of an outstanding retrieval
into a public abort method.
- Update the weather_info_[new|update] methods to take
the WeatherPrefs parameter and return the WeatherInfo
rather than directly storing it in GWeatherApplet.
The boolean return semantics are retained in that
NULL will be returned if the call fails.
A weather-priv.h
* weather.h: The refactored header. Now private calls
and the WeatherInfo definition are actually kept private.
Gratuitous 'extern' keywords removed.
* weather-bom.c
* weather-iwin.c
* weather-met.c
* weather-metar.c
* weather-wx.c: The service-specific backend files are
only minimally modified:
- Added Copyright header from weather.c
- Fixed any warnings reported by -Wall
- Included weather-priv.h
- Minimised required header set
- Updated to reflect that WeatherInfo is passed as
callback data instead of GWeatherApplet.
2005-11-27 Philip Langdale <philipl@mail.utexas.edu>
* ChangeLog
* MAINTAINERS
* README
* weather-bom.c
* weather.c
* weather.h
* weather-iwin.c
* weather-metar.c
* weather-met.c
* weather-wx.c: Initial checkin of libgweather.
I'm checking these in first so that there's a an easy way
to see the diff to the versions of these files that actually
compile.
LIBRARY_VERSION = 0:0:0
lib_LTLIBRARIES = libgweather.la
libgweatherincdir = $(includedir)/libgweather
libgweatherinc_HEADERS = weather.h gweather-gconf.h gweather-prefs.h
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = gweather.pc
libgweather_la_SOURCES = \
weather.c weather.h weather-priv.h \
weather-metar.c weather-iwin.c weather-met.c \
weather-bom.c weather-wx.c \
weather-sun.c \
gweather-prefs.c gweather-prefs.h \
gweather-gconf.c gweather-gconf.h
libgweather_la_CFLAGS = \
-I$(top_srcdir) \
-I$(srcdir) \
$(WARN_CFLAGS) \
$(GTK_CFLAGS) \
$(GNOME_VFS_APPLETS_CFLAGS) \
$(GNOME_APPLETS_CFLAGS) \
-DG_LOG_DOMAIN=\"GWeather\" \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\"
libgweather_la_LIBADD = \
$(GTK_LIBS) \
$(GNOME_VFS_APPLETS_LIBS)
libgweather_la_LDFLAGS = \
-version-info $(LIBRARY_VERSION) -no-undefined
test_metar_SOURCES = test_metar.c
test_metar_CFLAGS = \
-I$(top_srcdir) \
-I$(srcdir) \
$(WARN_CFLAGS) \
$(GTK_CFLAGS) \
$(GNOME_APPLETS_CFLAGS) \
$(GNOME_VFS_APPLETS_CFLAGS) \
-DG_LOG_DOMAIN=\"GWeather\"
test_metar_LDADD = \
$(GNOME_APPLETS_LIB) \
$(GNOME_VFS_APPLETS_LIB) \
libgweather.la
noinst_HEADERS = weather-priv.h
noinst_PROGRAMS = test_metar
schemasdir = @GCONF_SCHEMA_FILE_DIR@
schemas_in_files = gweather.schemas.in
schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
@INTLTOOL_SCHEMAS_RULE@
if GCONF_SCHEMAS_INSTALL
install-data-local:
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(schemas_DATA) ;
uninstall-local:
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-uninstall-rule $(schemas_DATA) ;
endif
EXTRA_DIST = gweather.pc.in $(schemas_in_files)
EXTRA_PROGRAMS = test_metar
CLEANFILES = $(schemas_DATA) $(EXTRA_PROGRAMS)
libgweather
-----------
libgweather is the retrieval backend from the gweather gnome-applet.
It's generally useful for applications that need to get weather
information. It also includes helper functions to access the gweather
gconf schema.
/*
* gweather-gconf.c: GConf interaction methods for gweather.
*
* Copyright (C) 2005 Philip Langdale, Papadimitriou Spiros
*
* This library 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 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors:
* Philip Langdale <philipl@mail.utexas.edu>
* Papadimitriou Spiros <spapadim+@cs.cmu.edu>
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <string.h>
#include <glib/gi18n-lib.h>
#include <libgweather/gweather-gconf.h>
struct _GWeatherGConf
{
GConfClient *gconf;
char *prefix;
};
GWeatherGConf *
gweather_gconf_new(const char *prefix)
{
GWeatherGConf *ctx = g_new0(GWeatherGConf, 1);
ctx->gconf = gconf_client_get_default();
ctx->prefix = g_strdup(prefix);
return ctx;
}
void
gweather_gconf_free(GWeatherGConf *ctx)
{
g_object_unref(ctx->gconf);
g_free(ctx->prefix);
g_free(ctx);
}
GConfClient *
gweather_gconf_get_client(GWeatherGConf *ctx)
{
return ctx->gconf;
}
gchar *
gweather_gconf_get_full_key (GWeatherGConf *ctx,
const gchar *key)
{
return g_strdup_printf ("%s/%s", ctx->prefix, key);
}
void
gweather_gconf_set_bool (GWeatherGConf *ctx,
const gchar *key,
gboolean the_bool,
GError **opt_error)
{
gchar *full_key = gweather_gconf_get_full_key (ctx, key);
gconf_client_set_bool (ctx->gconf, full_key, the_bool, opt_error);
g_free (full_key);
}
void
gweather_gconf_set_int (GWeatherGConf *ctx,
const gchar *key,
gint the_int,
GError **opt_error)
{
gchar *full_key = gweather_gconf_get_full_key (ctx, key);
gconf_client_set_int (ctx->gconf, full_key, the_int, opt_error);