[gnome-panel/merge-gnome-applets] Fix gweather applet build
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/merge-gnome-applets] Fix gweather applet build
- Date: Tue, 27 May 2014 20:59:11 +0000 (UTC)
commit d6828ebba4973c4c546453e6a9fa04eb2e285c21
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Tue May 27 23:58:41 2014 +0300
Fix gweather applet build
applets/Makefile.am | 4 +
applets/gweather/Makefile.am | 10 ++-
applets/gweather/gweather-pref.c | 2 +-
applets/gweather/gweather-xml.c | 164 ++++++++++++++++++++++++++++++++++++++
applets/gweather/gweather-xml.h | 39 +++++++++
configure.ac | 73 +++++++++++++++++
gnome-applets/Makefile.am | 6 --
gnome-applets/configure.ac | 79 ------------------
8 files changed, 288 insertions(+), 89 deletions(-)
---
diff --git a/applets/Makefile.am b/applets/Makefile.am
index 01ad964..b70ad4a 100644
--- a/applets/Makefile.am
+++ b/applets/Makefile.am
@@ -19,4 +19,8 @@ if BUILD_CPUFREQ_APPLET
SUBDIRS += cpufreq
endif
+if BUILD_LIBGWEATHER_APPLETS
+SUBDIRS += gweather
+endif
+
-include $(top_srcdir)/git.mk
diff --git a/applets/gweather/Makefile.am b/applets/gweather/Makefile.am
index 24e93a1..33b80f0 100644
--- a/applets/gweather/Makefile.am
+++ b/applets/gweather/Makefile.am
@@ -5,10 +5,12 @@ SUBDIRS = help
AM_CPPFLAGS = \
-I$(srcdir) \
-I$(top_srcdir) \
+ -I$(srcdir)/../../libpanel-applet \
+ -I$(top_builddir)/libpanel-applet \
+ -DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-DGWEATHER_MENU_UI_DIR=\""$(uidir)"\" \
$(DBUS_CFLAGS) \
- $(GNOME_APPLETS_CFLAGS) \
- $(DBUS_CFLAGS) \
+ $(LIBPANEL_APPLET_CFLAGS) \
$(LIBNOTIFY_CFLAGS) \
$(LIBGWEATHER_CFLAGS) \
$(NETWORKMANAGER_CFLAGS) \
@@ -21,13 +23,15 @@ gweather_applet_2_SOURCES = \
main.c \
gweather-about.c gweather-about.h \
gweather-pref.c gweather-pref.h \
+ gweather-xml.c gweather-xml.h \
gweather-dialog.c gweather-dialog.h \
gweather-applet.c gweather-applet.h
gweather_applet_2_LDADD = \
$(DBUS_LIBS) \
$(LIBNOTIFY_LIBS) \
- $(GNOME_APPLETS_LIBS) \
+ ../../libpanel-applet/libpanel-applet-4.la \
+ $(LIBPANEL_APPLET_LIBS) \
$(DBUS_LIBS) \
$(GNOME_LIBS2_LIBS) \
$(LIBGWEATHER_LIBS) \
diff --git a/applets/gweather/gweather-pref.c b/applets/gweather/gweather-pref.c
index 23dd571..738d3b2 100644
--- a/applets/gweather/gweather-pref.c
+++ b/applets/gweather/gweather-pref.c
@@ -29,7 +29,7 @@
#define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
-#include <libgweather/gweather-xml.h>
+#include "gweather-xml.h"
#include "gweather.h"
#include "gweather-pref.h"
#include "gweather-applet.h"
diff --git a/applets/gweather/gweather-xml.c b/applets/gweather/gweather-xml.c
new file mode 100644
index 0000000..a429e8c
--- /dev/null
+++ b/applets/gweather/gweather-xml.c
@@ -0,0 +1,164 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* gweather-xml.c - Locations.xml parsing code
+ *
+ * Copyright (C) 2005 Ryan Lortie, 2004 Gareth Owen
+ *
+ * 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, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <math.h>
+#include <locale.h>
+#include <gtk/gtk.h>
+#include <libxml/xmlreader.h>
+
+#define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
+#include "gweather-xml.h"
+
+
+/**
+ * SECTION:gweather-xml
+ * @Title: gweather-xml
+ */
+
+
+static gboolean
+gweather_xml_parse_node (GWeatherLocation *gloc,
+ GtkTreeStore *store, GtkTreeIter *parent)
+{
+ GtkTreeIter iter, *self = &iter;
+ GWeatherLocation **children, *parent_loc;
+ GWeatherLocationLevel level;
+ const char *name;
+ int i;
+
+ name = gweather_location_get_name (gloc);
+ children = gweather_location_get_children (gloc);
+ level = gweather_location_get_level (gloc);
+
+ if (!children[0] && level < GWEATHER_LOCATION_WEATHER_STATION) {
+ return TRUE;
+ }
+
+ switch (gweather_location_get_level (gloc)) {
+ case GWEATHER_LOCATION_WORLD:
+ case GWEATHER_LOCATION_ADM2:
+ self = parent;
+ break;
+
+ case GWEATHER_LOCATION_REGION:
+ case GWEATHER_LOCATION_COUNTRY:
+ case GWEATHER_LOCATION_ADM1:
+ /* Create a row with a name but no WeatherLocation */
+ gtk_tree_store_append (store, &iter, parent);
+ gtk_tree_store_set (store, &iter,
+ GWEATHER_XML_COL_LOCATION_NAME, name,
+ -1);
+ break;
+
+ case GWEATHER_LOCATION_CITY:
+ /* If multiple children, treat this like a
+ * region/country/adm1. If a single child, merge with that
+ * location.
+ */
+ gtk_tree_store_append (store, &iter, parent);
+ gtk_tree_store_set (store, &iter,
+ GWEATHER_XML_COL_LOCATION_NAME, name,
+ -1);
+ if (children[0] && !children[1]) {
+ const char *code = NULL;
+ gboolean has_coords = FALSE;
+ double latitude = 0;
+ double longitude = 0;
+
+ code = gweather_location_get_code (children[0]);
+ has_coords = gweather_location_has_coords (children[0]);
+ if (has_coords) {
+ gweather_location_get_coords (children[0], &latitude, &longitude);
+ }
+
+ gtk_tree_store_set (store, &iter,
+ GWEATHER_XML_COL_METAR_CODE, code,
+ GWEATHER_XML_COL_LATLON_VALID, has_coords,
+ GWEATHER_XML_COL_LATITUDE, latitude,
+ GWEATHER_XML_COL_LONGITUDE, longitude,
+ -1);
+ }
+ break;
+
+ case GWEATHER_LOCATION_WEATHER_STATION:
+ gtk_tree_store_append (store, &iter, parent);
+ gtk_tree_store_set (store, &iter,
+ GWEATHER_XML_COL_LOCATION_NAME, name,
+ -1);
+
+ parent_loc = gweather_location_get_parent (gloc);
+ if (parent_loc && gweather_location_get_level (parent_loc) == GWEATHER_LOCATION_CITY)
+ name = gweather_location_get_name (parent_loc);
+
+ const char *code = NULL;
+ gboolean has_coords = FALSE;
+ double latitude = 0;
+ double longitude = 0;
+
+ code = gweather_location_get_code (gloc);
+ has_coords = gweather_location_has_coords (gloc);
+ if (has_coords) {
+ gweather_location_get_coords (gloc, &latitude, &longitude);
+ }
+
+ gtk_tree_store_set (store, &iter,
+ GWEATHER_XML_COL_METAR_CODE, code,
+ GWEATHER_XML_COL_LATLON_VALID, has_coords,
+ GWEATHER_XML_COL_LATITUDE, latitude,
+ GWEATHER_XML_COL_LONGITUDE, longitude,
+ -1);
+ break;
+ }
+
+ for (i = 0; children[i]; i++) {
+ if (!gweather_xml_parse_node (children[i], store, self)) {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+GtkTreeModel *
+gweather_xml_load_locations (void)
+{
+ GWeatherLocation *world;
+ GtkTreeStore *store;
+
+ world = gweather_location_get_world ();
+ if (!world)
+ return NULL;
+
+ store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_DOUBLE,
G_TYPE_DOUBLE);
+
+ if (!gweather_xml_parse_node (world, store, NULL)) {
+ g_object_unref (store);
+ store = NULL;
+ }
+
+ gweather_location_unref (world);
+
+ return (GtkTreeModel *)store;
+}
diff --git a/applets/gweather/gweather-xml.h b/applets/gweather/gweather-xml.h
new file mode 100644
index 0000000..b5679c4
--- /dev/null
+++ b/applets/gweather/gweather-xml.h
@@ -0,0 +1,39 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* gweather-xml.h
+ *
+ * Copyright (C) 2004 Gareth Owen
+ *
+ * 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, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GWEATHER_XML_H__
+#define __GWEATHER_XML_H__
+
+#include <gtk/gtk.h>
+#include <libgweather/gweather-weather.h>
+
+enum
+{
+ GWEATHER_XML_COL_LOCATION_NAME = 0,
+ GWEATHER_XML_COL_METAR_CODE,
+ GWEATHER_XML_COL_LATLON_VALID,
+ GWEATHER_XML_COL_LATITUDE,
+ GWEATHER_XML_COL_LONGITUDE,
+ GWEATHER_XML_NUM_COLUMNS
+};
+
+GtkTreeModel *gweather_xml_load_locations (void);
+
+#endif /* __GWEATHER_XML_H__ */
diff --git a/configure.ac b/configure.ac
index 99cf403..3466b25 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,6 +76,7 @@ LIBECAL_REQUIRED=3.5.3
LIBEDATASERVER_REQUIRED=3.5.3
CAIRO_REQUIRED=1.0.0
GWEATHER_REQUIRED=3.5.1
+DBUS_REQUIRED=1.1.2
DBUS_GLIB_REQUIRED=0.80
DCONF_REQUIRED=0.13.4
LIBRSVG_REQUIRED=2.36.2
@@ -83,6 +84,8 @@ GUCHARMAP3_REQUIRED=2.33.0
HAL_REQUIRED=0.5.3
UPOWER_REQUIRED=0.9.4
POLKIT_REQUIRED=0.92
+NETWORKMANAGER_REQUIRED=0.7
+LIBNOTIFY_REQUIRED=0.7
dnl pkg-config dependency checks
@@ -313,6 +316,49 @@ case $host in
;;
esac
+dnl -- check for libnotify (optional) -----------------------------------------
+LIBNOTIFY_CFLAGS=
+LIBNOTIFY_LIBS=
+PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED,
+ HAVE_LIBNOTIFY="yes", HAVE_LIBNOTIFY="no")
+
+if test "x$HAVE_LIBNOTIFY" = "xyes"; then
+ AC_DEFINE(HAVE_LIBNOTIFY, 1, [libnotify available])
+fi
+
+AC_SUBST(LIBNOTIFY_CFLAGS)
+AC_SUBST(LIBNOTIFY_LIBS)
+
+dnl -- check for NetworkManager -----------------------------------------------
+AC_ARG_ENABLE([networkmanager],
+ AC_HELP_STRING([--enable-networkmanager],
+ [Enable NetworkManager support @<:@default=yes@:>@]),
+ ENABLE_NETWORKMANAGER=$enableval, ENABLE_NETWORKMANAGER=yes)
+
+HAVE_NETWORKMANAGER=no
+NETWORKMANAGER_VERSION=unkown
+AC_SUBST(NETWORKMANAGER_VERSION)
+if test "x$ENABLE_NETWORKMANAGER" = "xyes"; then
+ PKG_CHECK_MODULES(NETWORKMANAGER, NetworkManager >= $NETWORKMANAGER_REQUIRED,
+ HAVE_NETWORKMANAGER=yes, HAVE_NETWORKMANAGER=no)
+
+ if test "x$HAVE_NETWORKMANAGER" = "xyes"; then
+ AC_DEFINE(HAVE_NETWORKMANAGER, 1, [NetworkManager available])
+ NETWORKMANAGER_VERSION=`$PKG_CONFIG --modversion NetworkManager`
+ AC_SUBST(NETWORKMANAGER_CFLAGS)
+ AC_SUBST(NETWORKMANAGER_LIBS)
+ fi
+fi
+
+dnl -- check for libgweather (required for gweather applet) ------------------
+build_libgweather_applets=false
+PKG_CHECK_MODULES(LIBGWEATHER, gweather-3.0 >= $GWEATHER_REQUIRED,
+ build_libgweather_applets=true,
+ AC_MSG_WARN([libgweather not found. Not building the weather applet.]))
+AC_SUBST(LIBGWEATHER_CFLAGS)
+AC_SUBST(LIBGWEATHER_LIBS)
+AM_CONDITIONAL(BUILD_LIBGWEATHER_APPLETS, $build_libgweather_applets)
+
dnl -- check for glib/gobject (required) --------------------------------------
PKG_CHECK_MODULES(CPUFREQ_SELECTOR, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED)
AC_SUBST(CPUFREQ_SELECTOR_CFLAGS)
@@ -403,6 +449,28 @@ AC_SUBST(GUCHARMAP_CFLAGS)
AC_SUBST(GUCHARMAP_LIBS)
dnl ***************************************************************************
+dnl *** Check if IPv6 is available ***
+dnl ***************************************************************************
+AC_MSG_CHECKING([whether to enable ipv6])
+AC_ARG_ENABLE(ipv6, [ --enable-ipv6 enable IPv6 extensions], ,enable_ipv6=yes)
+if test $enable_ipv6 = yes; then
+
+ dnl Code for checking presence of AF_INET6 on the system.
+ AC_TRY_COMPILE([
+ #include <sys/types.h>
+ #include <sys/socket.h>], [
+ socket(AF_INET6, SOCK_STREAM, 0)
+ ],
+ have_ipv6=yes,
+ have_ipv6=no
+ )
+ AC_MSG_RESULT($have_ipv6)
+ if test $have_ipv6 = yes; then
+ AC_DEFINE(ENABLE_IPV6, 1, [Define if system is IPv6 enabled])
+ fi
+fi
+
+dnl ***************************************************************************
dnl *** keyboard accessibility status applet check ***
dnl ***************************************************************************
@@ -606,6 +674,8 @@ applets/fish/Makefile
applets/geyes/help/Makefile
applets/geyes/Makefile
applets/geyes/themes/Makefile
+applets/gweather/help/Makefile
+applets/gweather/Makefile
applets/notification_area/Makefile
applets/wncklet/Makefile
doc/Makefile
@@ -671,9 +741,12 @@ echo "
- enabling suid bit $suid
- drivemount always
- geyes always
+ - gweather $build_libgweather_applets
Using DBUS: $HAVE_DBUS
+ Using NetworkManager: $HAVE_NETWORKMANAGER
Using HAL: $HAVE_HAL
Using UPOWER: $HAVE_UPOWER
+ Enabling IPv6: $have_ipv6
"
diff --git a/gnome-applets/Makefile.am b/gnome-applets/Makefile.am
index e39ec2f..5e5566c 100644
--- a/gnome-applets/Makefile.am
+++ b/gnome-applets/Makefile.am
@@ -4,12 +4,6 @@ if BUILD_GTOP_APPLETS
gtop_SUBDIRS = $(gtop_applets)
endif
-libgweather_applets = \
- gweather
-if BUILD_LIBGWEATHER_APPLETS
-libgweather_SUBDIRS = $(libgweather_applets)
-endif
-
modemlights_applets = \
modemlights
if APPLET_MODEMLIGHTS
diff --git a/gnome-applets/configure.ac b/gnome-applets/configure.ac
index f72f426..2d1eb1c 100644
--- a/gnome-applets/configure.ac
+++ b/gnome-applets/configure.ac
@@ -20,13 +20,8 @@ LIBPANEL_REQUIRED=2.91.90
LIBGTOP_REQUIRED=2.11.92
LIBXKLAVIER_REQUIRED=4.0
LIBWNCK_REQUIRED=2.91.0
-LIBNOTIFY_REQUIRED=0.7
-DBUS_REQUIRED=1.1.2
-DBUS_GLIB_REQUIRED=0.74
GNOME_ICON_THEME_REQUIRED=2.15.91
LIBXML_REQUIRED=2.5.0
-GWEATHER_REQUIRED=3.5.0
-NETWORKMANAGER_REQUIRED=0.7
GST10_REQUIRED=0.10.2
dnl ***************************************************************************
@@ -149,19 +144,6 @@ PKG_CHECK_MODULES(LIBWNCK, libwnck-3.0 >= $LIBWNCK_REQUIRED,,
AC_SUBST(LIBWNCK_CFLAGS)
AC_SUBST(LIBWNCK_LIBS)
-dnl -- check for libnotify (optional) -----------------------------------------
-LIBNOTIFY_CFLAGS=
-LIBNOTIFY_LIBS=
-PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED,
- HAVE_LIBNOTIFY="yes", HAVE_LIBNOTIFY="no")
-
-if test "x$HAVE_LIBNOTIFY" = "xyes"; then
- AC_DEFINE(HAVE_LIBNOTIFY, 1, [libnotify available])
-fi
-
-AC_SUBST(LIBNOTIFY_CFLAGS)
-AC_SUBST(LIBNOTIFY_LIBS)
-
dnl -- check for Python/GNOME modules (optional) ------------------------------
PKG_CHECK_MODULES(PYGOBJECT, pygobject-3.0, HAVE_PYGOBJECT="yes", HAVE_PYGOBJECT="no")
@@ -170,39 +152,6 @@ PKG_CHECK_MODULES(XML2, libxml-2.0 >= $LIBXML_REQUIRED)
AC_SUBST(XML2_CFLAGS)
AC_SUBST(XML2_LIBS)
- dnl -- check for libgweather (required for gweather applet) ------------------
-build_libgweather_applets=false
-PKG_CHECK_MODULES(LIBGWEATHER, gweather-3.0 >= $GWEATHER_REQUIRED gweather-3.0 <= 3.7,
- build_libgweather_applets=true,
- AC_MSG_WARN([libgweather not found. Not building the weather applet.]))
-AC_SUBST(LIBGWEATHER_CFLAGS)
-AC_SUBST(LIBGWEATHER_LIBS)
-AM_CONDITIONAL(BUILD_LIBGWEATHER_APPLETS, $build_libgweather_applets)
-
-dnl -- check for GSettings (required for gweather applet)
-GLIB_GSETTINGS
-
-dnl -- check for NetworkManager -----------------------------------------------
-AC_ARG_ENABLE([networkmanager],
- AC_HELP_STRING([--enable-networkmanager],
- [Enable NetworkManager support @<:@default=yes@:>@]),
- ENABLE_NETWORKMANAGER=$enableval, ENABLE_NETWORKMANAGER=yes)
-
-HAVE_NETWORKMANAGER=no
-NETWORKMANAGER_VERSION=unkown
-AC_SUBST(NETWORKMANAGER_VERSION)
-if test "x$ENABLE_NETWORKMANAGER" = "xyes"; then
- PKG_CHECK_MODULES(NETWORKMANAGER, NetworkManager >= $NETWORKMANAGER_REQUIRED,
- HAVE_NETWORKMANAGER=yes, HAVE_NETWORKMANAGER=no)
-
- if test "x$HAVE_NETWORKMANAGER" = "xyes"; then
- AC_DEFINE(HAVE_NETWORKMANAGER, 1, [NetworkManager available])
- NETWORKMANAGER_VERSION=`$PKG_CONFIG --modversion NetworkManager`
- AC_SUBST(NETWORKMANAGER_CFLAGS)
- AC_SUBST(NETWORKMANAGER_LIBS)
- fi
-fi
-
dnl -- check for the Mixer ----------------------------------------------------
AC_ARG_ENABLE([mixer-applet],
AC_HELP_STRING([--enable-mixer-applet], [Enable the gstreamer-based mixer applet.]),
@@ -343,28 +292,6 @@ dnl ***************************************************************************
AM_CONDITIONAL(BUILD_INVEST_APPLET, test "x$HAVE_PYGOBJECT" = "xyes")
dnl ***************************************************************************
-dnl *** Check if IPv6 is available ***
-dnl ***************************************************************************
-AC_MSG_CHECKING([whether to enable ipv6])
-AC_ARG_ENABLE(ipv6, [ --enable-ipv6 enable IPv6 extensions], ,enable_ipv6=yes)
-if test $enable_ipv6 = yes; then
-
- dnl Code for checking presence of AF_INET6 on the system.
- AC_TRY_COMPILE([
- #include <sys/types.h>
- #include <sys/socket.h>], [
- socket(AF_INET6, SOCK_STREAM, 0)
- ],
- have_ipv6=yes,
- have_ipv6=no
- )
- AC_MSG_RESULT($have_ipv6)
- if test $have_ipv6 = yes; then
- AC_DEFINE(ENABLE_IPV6, 1, [Define if system is IPv6 enabled])
- fi
-fi
-
-dnl ***************************************************************************
dnl *** Check for getaddrinfo ***
dnl ***************************************************************************
have_getaddrinfo=no
@@ -419,8 +346,6 @@ AC_OUTPUT([
gnome-applets.spec
Makefile
po/Makefile.in
-gweather/help/Makefile
-gweather/Makefile
invest-applet/data/art/Makefile
invest-applet/data/Makefile
invest-applet/help/Makefile
@@ -456,7 +381,6 @@ gnome-applets-$VERSION configure summary:
Source code location: ${srcdir}
Compiler: ${CC}
- - gweather $build_libgweather_applets
- invest-applet $BUILD_INVEST_APPLET
- mini-commander $enable_mini_commander
- modemlights $BUILD_MODEM_LIGHTS
@@ -464,7 +388,4 @@ gnome-applets-$VERSION configure summary:
- multiload $build_gtop_applets
- stickynotes $enable_stickynotes
- trashapplet always
-
- Using NetworkManager: $HAVE_NETWORKMANAGER
- Enabling IPv6: $have_ipv6
" >&2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]