gnome-applets r10780 - in trunk: . gweather
- From: vuntz svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-applets r10780 - in trunk: . gweather
- Date: Mon, 7 Apr 2008 10:10:09 +0100 (BST)
Author: vuntz
Date: Mon Apr 7 10:10:09 2008
New Revision: 10780
URL: http://svn.gnome.org/viewvc/gnome-applets?rev=10780&view=rev
Log:
2008-04-07 Vincent Untz <vuntz gnome org>
* configure.in: check for gweather >= 2.22.1, don't check for libxml2
and the gweather locations file. End of bug #526216.
2008-04-07 Vincent Untz <vuntz gnome org>
Use new gweather-xml API. Patch by Dan Winship <danw gnome org>.
Fix bug #526216.
* gweather-xml.c: gone, moved to libgweather
* gweather-pref.c: Use libgweather's version of the Locations.xml
parser now.
(load_locations): Update for API changes, select the correct row
after constructing the model, since the new
gweather_xml_load_locations() doesn't do that automatically.
Removed:
trunk/gweather/gweather-xml.c
trunk/gweather/gweather-xml.h
Modified:
trunk/ChangeLog
trunk/configure.in
trunk/gweather/ChangeLog
trunk/gweather/Makefile.am
trunk/gweather/gweather-pref.c
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Mon Apr 7 10:10:09 2008
@@ -34,8 +34,7 @@
PYGOBJECT_REQUIRED=2.6
GNOME_PYTHON_REQUIRED=2.10
GNOME_ICON_THEME_REQUIRED=2.15.91
-LIBXML_REQUIRED=2.5.0
-GWEATHER_REQUIRED=2.21.1
+GWEATHER_REQUIRED=2.22.1
dnl ***************************************************************************
AM_MAINTAINER_MODE
@@ -266,17 +265,10 @@
AC_SUBST(PYGTK_LIBS)
AC_SUBST(PYGTK_CFLAGS)
-dnl -- check for libxml2 (required) ------------------------------------------
-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) ------------------
PKG_CHECK_MODULES(LIBGWEATHER, gweather >= $GWEATHER_REQUIRED)
AC_SUBST(LIBGWEATHER_CFLAGS)
AC_SUBST(LIBGWEATHER_LIBS)
-LIBGWEATHER_LOCATIONS=`pkg-config --variable=locations_file gweather`
-AC_SUBST(LIBGWEATHER_LOCATIONS)
dnl ***************************************************************************
dnl *** find paths to installed binaries ***
Modified: trunk/gweather/Makefile.am
==============================================================================
--- trunk/gweather/Makefile.am (original)
+++ trunk/gweather/Makefile.am Mon Apr 7 10:10:09 2008
@@ -9,9 +9,7 @@
$(GNOME_APPLETS_CFLAGS) \
$(GNOME_VFS_APPLETS_CFLAGS) \
$(LIBNOTIFY_CFLAGS) \
- $(XML2_CFLAGS) \
- $(LIBGWEATHER_CFLAGS) \
- -DGWEATHER_XML_LOCATION=\"$(LIBGWEATHER_LOCATIONS)\"
+ $(LIBGWEATHER_CFLAGS)
libexec_PROGRAMS = gweather-applet-2
@@ -21,14 +19,12 @@
gweather-about.c gweather-about.h \
gweather-pref.c gweather-pref.h \
gweather-dialog.c gweather-dialog.h \
- gweather-applet.c gweather-applet.h \
- gweather-xml.c gweather-xml.h
+ gweather-applet.c gweather-applet.h
gweather_applet_2_LDADD = \
$(LIBNOTIFY_LIBS) \
$(GNOME_APPLETS_LIBS) \
$(GNOME_VFS_APPLETS_LIBS) \
- $(XML2_LIBS) \
$(LIBGWEATHER_LIBS)
uidir = $(datadir)/gnome-2.0/ui
Modified: trunk/gweather/gweather-pref.c
==============================================================================
--- trunk/gweather/gweather-pref.c (original)
+++ trunk/gweather/gweather-pref.c Mon Apr 7 10:10:09 2008
@@ -28,15 +28,12 @@
#include <panel-applet.h>
#include <gconf/gconf-client.h>
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-
#define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
+#include <libgweather/gweather-xml.h>
#include "gweather.h"
#include "gweather-pref.h"
#include "gweather-applet.h"
-#include "gweather-xml.h"
#include "gweather-dialog.h"
#define NEVER_SENSITIVE "never_sensitive"
@@ -272,10 +269,33 @@
gweather_update (gw_applet);
}
+static gboolean
+compare_location (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer user_data)
+{
+ GWeatherPref *pref = user_data;
+ WeatherLocation *loc;
+ GtkTreeView *view;
+
+ gtk_tree_model_get (model, iter, GWEATHER_XML_COL_POINTER, &loc, -1);
+ if (!loc)
+ return FALSE;
+
+ if (!weather_location_equal (loc, pref->priv->applet->gweather_pref.location))
+ return FALSE;
+
+ view = GTK_TREE_VIEW (pref->priv->tree);
+ gtk_tree_view_expand_to_path (view, path);
+ gtk_tree_view_set_cursor (view, path, NULL, FALSE);
+ gtk_tree_view_scroll_to_cell (view, path, NULL, TRUE, 0.5, 0.5);
+ return TRUE;
+}
+
static void load_locations (GWeatherPref *pref)
{
GWeatherApplet *gw_applet = pref->priv->applet;
-
GtkTreeView *tree = GTK_TREE_VIEW(pref->priv->tree);
GtkTreeViewColumn *column;
GtkCellRenderer *cell_renderer;
@@ -289,8 +309,8 @@
gtk_tree_view_set_expander_column (GTK_TREE_VIEW (tree), column);
/* load locations from xml file */
- current_location = weather_location_clone (gw_applet->gweather_pref.location);
- if (gweather_xml_load_locations (tree, current_location))
+ pref->priv->model = gweather_xml_load_locations ();
+ if (!pref->priv->model)
{
GtkWidget *d;
@@ -301,8 +321,12 @@
gtk_dialog_run (GTK_DIALOG (d));
gtk_widget_destroy (d);
}
+ gtk_tree_view_set_model (tree, pref->priv->model);
- weather_location_free (current_location);
+ if (pref->priv->applet->gweather_pref.location) {
+ /* Select the current (default) location */
+ gtk_tree_model_foreach (GTK_TREE_MODEL (pref->priv->model), compare_location, pref);
+ }
}
static void
@@ -758,7 +782,6 @@
GtkWidget *pref_loc_note_lbl;
GtkWidget *scrolled_window;
GtkWidget *label, *value_hbox, *tree_label;
- GtkTreeStore *model;
GtkTreeSelection *selection;
GtkWidget *pref_basic_vbox;
GtkWidget *vbox;
@@ -1069,11 +1092,9 @@
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- model = gtk_tree_store_new (GWEATHER_XML_NUM_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER);
- pref->priv->tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
+ pref->priv->tree = gtk_tree_view_new ();
gtk_label_set_mnemonic_widget (GTK_LABEL (tree_label), GTK_WIDGET (pref->priv->tree));
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (pref->priv->tree), FALSE);
- pref->priv->model = GTK_TREE_MODEL (model);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (pref->priv->tree));
g_signal_connect (G_OBJECT (selection), "changed",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]