[arch-commits] Commit in gnome-panel/trunk (PKGBUILD clock.patch)

Jan de Groot jgc at archlinux.org
Thu Apr 24 18:05:19 UTC 2008


    Date: Thursday, April 24, 2008 @ 14:05:19
  Author: jgc
Revision: 879

upgpkg: gnome-panel 2.22.1.3-1

Modified:
  gnome-panel/trunk/PKGBUILD
Deleted:
  gnome-panel/trunk/clock.patch

-------------+
 PKGBUILD    |   12 -
 clock.patch |  660 ----------------------------------------------------------
 2 files changed, 5 insertions(+), 667 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2008-04-24 17:53:00 UTC (rev 878)
+++ PKGBUILD	2008-04-24 18:05:19 UTC (rev 879)
@@ -2,24 +2,22 @@
 # Maintainer: Jan de Groot <jgc at archlinux.org>
 
 pkgname=gnome-panel
-pkgver=2.22.1.2
-pkgrel=3
+pkgver=2.22.1.3
+pkgrel=1
 pkgdesc="The GNOME Panel"
 arch=(i686 x86_64)
 license=('GPL')
 url="http://www.gnome.org"
-depends=('libwnck>=2.22.1' 'gnome-menus>=2.22.1' 'evolution-data-server>=2.22.1' 'gnome-desktop>=2.22.1' 'libgweather>=2.22.1.1' 'librsvg>=2.22.2')
+depends=('libwnck>=2.22.1' 'gnome-menus>=2.22.1' 'evolution-data-server>=2.22.1' 'gnome-desktop>=2.22.1' 'libgweather>=2.22.1.2' 'librsvg>=2.22.2')
 makedepends=('perlxml' 'gnome-doc-utils>=0.12.2' 'pkgconfig')
 options=('!libtool' '!emptydirs')
 groups=('gnome')
 install=gnome-panel.install
-source=(http://ftp.gnome.org/pub/gnome/sources/${pkgname}/2.22/${pkgname}-${pkgver}.tar.bz2
-	clock.patch)
-md5sums=('bf89eb75655557c6a1ab9dbd37f028a6' 'ba7e950377e44297b7b964d74b3e635b')
+source=(http://ftp.gnome.org/pub/gnome/sources/${pkgname}/2.22/${pkgname}-${pkgver}.tar.bz2)
+md5sums=('af5e33b27c4b4a8f932baa8530dd79b9')
 
 build() {
   cd ${startdir}/src/${pkgname}-${pkgver}
-  patch -Np0 -i ${startdir}/src/clock.patch || return 1
   ./configure --prefix=/usr --sysconfdir=/etc \
               --localstatedir=/var --disable-static \
 	      --libexecdir=/usr/lib/gnome-panel \

Deleted: clock.patch
===================================================================
--- clock.patch	2008-04-24 17:53:00 UTC (rev 878)
+++ clock.patch	2008-04-24 18:05:19 UTC (rev 879)
@@ -1,660 +0,0 @@
-Index: clock-location.c
-===================================================================
---- applets/clock/clock-location.c	(revision 11043)
-+++ applets/clock/clock-location.c	(revision 11054)
-@@ -67,6 +67,34 @@
- #define PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CLOCK_LOCATION_TYPE, ClockLocationPrivate))
- 
- ClockLocation *
-+clock_location_find_and_ref (GList       *locations,
-+                             const gchar *name,
-+                             const gchar *timezone,
-+                             gfloat       latitude,
-+                             gfloat       longitude,
-+                             const gchar *code)
-+{
-+        GList *l;
-+        ClockLocationPrivate *priv;
-+
-+        for (l = locations; l != NULL; l = l->next) {
-+                priv = PRIVATE (l->data);
-+
-+                if (priv->latitude == latitude &&
-+                    priv->longitude == longitude &&
-+                    g_strcmp0 (priv->weather_code, code) == 0 &&
-+                    g_strcmp0 (priv->timezone, timezone) == 0 &&
-+                    g_strcmp0 (priv->name, name) == 0)
-+                        break;
-+        }
-+
-+        if (l != NULL)
-+                return g_object_ref (CLOCK_LOCATION (l->data));
-+        else
-+                return NULL;
-+}
-+
-+ClockLocation *
- clock_location_new (const gchar *name, const gchar *timezone,
- 		    gfloat latitude, gfloat longitude,
- 		    const gchar *code, WeatherPrefs *prefs)
-@@ -467,6 +495,12 @@
-         gchar *filename;
- 	MakeCurrentData *mcdata;
- 
-+        if (loc == current_location) {
-+                if (destroy)
-+                        destroy (data);
-+                return;
-+        }
-+
- 	if (clock_location_is_current_timezone (loc)) {
- 		if (current_location)
- 			g_object_remove_weak_pointer (G_OBJECT (current_location), 
-Index: clock-location.h
-===================================================================
---- applets/clock/clock-location.h	(revision 11043)
-+++ applets/clock/clock-location.h	(revision 11054)
-@@ -38,6 +38,13 @@
- 				   const gchar *code,
- 				   WeatherPrefs *prefs);
- 
-+ClockLocation *clock_location_find_and_ref (GList       *locations,
-+                                            const gchar *name,
-+                                            const gchar *timezone,
-+                                            gfloat       latitude,
-+                                            gfloat       longitude,
-+                                            const gchar *code);
-+
- gchar *clock_location_get_tzname (ClockLocation *loc);
- 
- const gchar *clock_location_get_name (ClockLocation *loc);
-Index: ChangeLog
-===================================================================
---- applets/clock/ChangeLog	(revision 11043)
-+++ applets/clock/ChangeLog	(revision 11054)
-@@ -1,5 +1,78 @@
-+2008-04-11  Vincent Untz  <vuntz at gnome.org>
-+
-+	* system-timezone.c: (system_timezone_write_key_file),
-+	(recursive_compare), (files_are_identical_inode),
-+	(files_are_identical_content),
-+	(system_timezone_read_etc_localtime_content),
-+	(system_timezone_is_zone_file_valid),
-+	(system_timezone_set_etc_timezone): s/unsigned int/gsize/ since it's
-+	not the same on 64 bits machines. Fix bug #527441.
-+	Thanks to Jan de Groot <jan at jgc.homeip.net> for debugging this.
-+
-+2008-04-11  Vincent Untz  <vuntz at gnome.org>
-+
-+	Add support for Arch Linux system timezone.
-+
-+	* system-timezone.c: (system_timezone_read_etc_rc_conf),
-+	(system_timezone_write_etc_rc_conf): new methods for config in Arch
-+	Linux
-+	Add the new methods to the list of methods.
-+
-+2008-04-11  Vincent Untz  <vuntz at gnome.org>
-+
-+	* system-timezone.c: add/clarify some comments
-+	change the default order of methods to get the timezone. First look if
-+	/etc/locatime is a symlink, since it's cheap.
-+	(system_timezone_strip_path_if_valid): new, to strip the prefix path of
-+	a timezone filename
-+	(system_timezone_read_etc_localtime_softlink): use
-+	system_timezone_strip_path_if_valid() to also strip "posix/" if this is
-+	the case
-+	(recursive_compare): now use system_timezone_strip_path_if_valid()
-+
-+2008-04-11  Vincent Untz  <vuntz at gnome.org>
-+
-+	* system-timezone.c: (recursive_compare): handle the case where the
-+	found file is /usr/share/zoneinfo/posix/Europe/Paris (ie, strip the
-+	"posix/" too)
-+	(system_timezone_read_etc_localtime_content): plug leak
-+
- 2008-04-10  Vincent Untz  <vuntz at gnome.org>
- 
-+	Improve how the find entry is filled: always use the location name as a
-+	start, and put the cursor at the end of the string so the user can
-+	continue to type. Fix bug #527403
-+	Be more solid against cases where there's no Locations.xml
-+
-+	* clock.c: (fill_location_tree): be more solid
-+	(find_next_location): ditto
-+	(find_entry_changed): ditto
-+	(find_weather_code): ditto
-+	(edit_clear): don't reset the state of the find window here, it's done
-+	in run_find_location()
-+	(run_find_location): improve the behavior of the find entry
-+
-+2008-04-10  Vincent Untz  <vuntz at gnome.org>
-+
-+	Do not create lots of new ClockLocation everytime we load the locations
-+	from gconf, and try to re-use the old ones.
-+	As a side-effect, it fixes a bug where you need to click twice on Set
-+	to set the current location from a different timezone.
-+
-+	* clock-location.[ch]: (clock_location_find_and_ref): new, find a
-+	ClockLocation if it already exists, and ref it
-+	(clock_location_make_current): do not do anything if the location is
-+	already the current one
-+	* clock.c: (location_start_element): try to find the location among
-+	existing ones first, and then fallback on creating a new one
-+	(run_prefs_edit_save): do not explicitly call locations_changed(), it
-+	will be done later via gconf notification
-+	(remove_tree_row): ditto
-+
-+==================== 2.22.1.2 ====================
-+
-+2008-04-10  Vincent Untz  <vuntz at gnome.org>
-+
- 	* clock.c: (zone_combo_changed): add FIXME
- 
- 2008-04-10  Vincent Untz  <vuntz at gnome.org>
-Index: system-timezone.c
-===================================================================
---- applets/clock/system-timezone.c	(revision 11043)
-+++ applets/clock/system-timezone.c	(revision 11054)
-@@ -41,9 +41,9 @@
-  */
- 
- /* To compile a test program, do:
-- * $ gcc -DSYSTZ_GET_TEST -Wall -o system-timezone-get `pkg-config --cflags --libs glib-2.0 gobject-2.0 gio-2.0` system-timezone.c
-+ * $ gcc -DSYSTZ_GET_TEST -Wall -g -O0 -o system-timezone-get `pkg-config --cflags --libs glib-2.0 gobject-2.0 gio-2.0` system-timezone.c
-  * or:
-- * $ gcc -DSYSTZ_SET_TEST -Wall -o system-timezone-set `pkg-config --cflags --libs glib-2.0 gobject-2.0 gio-2.0` system-timezone.c
-+ * $ gcc -DSYSTZ_SET_TEST -Wall -g -O0 -o system-timezone-set `pkg-config --cflags --libs glib-2.0 gobject-2.0 gio-2.0` system-timezone.c
-  *
-  * You can then read the system timezone with:
-  * $ system-timezone-get
-@@ -53,7 +53,9 @@
- 
- 
- /* FIXME: it'd be nice to filter out the timezones that we might get when
-- * parsing config files that are not in zone.tab */
-+ * parsing config files that are not in zone.tab. Note that it's also wrong
-+ * in some cases: eg, in tzdata2008b, Asia/Calcutta got renamed to
-+ * Asia/Kolkata and the old name is not in zone.tab. */
- 
- #include <string.h>
- #include <unistd.h>
-@@ -69,6 +71,7 @@
- #ifndef SYSTZ_SET_TEST
- #define ETC_TIMEZONE        "/etc/timezone"
- #define ETC_TIMEZONE_MAJ    "/etc/TIMEZONE"
-+#define ETC_RC_CONF         "/etc/rc.conf"
- #define ETC_SYSCONFIG_CLOCK "/etc/sysconfig/clock"
- #define ETC_CONF_D_CLOCK    "/etc/conf.d/clock"
- #define ETC_LOCALTIME       "/etc/localtime"
-@@ -77,6 +80,7 @@
- #define TEST_PREFIX         "/tmp/systz-test"
- #define ETC_TIMEZONE        TEST_PREFIX"/etc/timezone"
- #define ETC_TIMEZONE_MAJ    TEST_PREFIX"/etc/TIMEZONE"
-+#define ETC_RC_CONF         TEST_PREFIX"/etc/rc.conf"
- #define ETC_SYSCONFIG_CLOCK TEST_PREFIX"/etc/sysconfig/clock"
- #define ETC_CONF_D_CLOCK    TEST_PREFIX"/etc/conf.d/clock"
- #define ETC_LOCALTIME       TEST_PREFIX"/etc/localtime"
-@@ -303,14 +307,14 @@
-  *  + However, most distributions also have the timezone setting
-  *    configured somewhere else. This might be better to read it from there.
-  *
-+ *    Debian/Ubuntu/Gentoo (new): content of /etc/timezone
-  *    Fedora/Mandriva: the ZONE key in /etc/sysconfig/clock
-  *    openSUSE: the TIMEZONE key in /etc/sysconfig/clock
-+ *    Solaris/OpenSolaris: the TZ key in /etc/TIMEZONE
-+ *    Arch Linux: the TIMEZONE key in /etc/rc.conf
-  *    Gentoo (old): the ZONE key in /etc/conf.d/clock
-- *    Debian/Ubuntu/Gentoo (new): content of /etc/timezone
-- *    Solaris/OpenSolaris: the TZ key in /etc/TIMEZONE
-  *
-  *    FIXME: reading the system-tools-backends, it seems there's this too:
-- *           ArchLinux: the TIMEZONE key in /etc/rc.conf
-  *           Solaris: the TZ key in /etc/default/init
-  *                    /etc/TIMEZONE seems to be a link to /etc/default/init
-  *
-@@ -318,7 +322,7 @@
-  *
-  */
- 
--/* This works for Debian and derivatives (including Ubuntu) */
-+/* This works for Debian and derivatives (including Ubuntu), and new Gentoo */
- static char *
- system_timezone_read_etc_timezone (void)
- {
-@@ -443,14 +447,14 @@
-                                 const char  *value,
-                                 GError     **error)
- {
--        GError        *our_error;
--        char          *content;
--        unsigned int   len;
--        char          *key_eq;
--        char         **lines;
--        gboolean       replaced;
--        gboolean       retval;
--        int            n;
-+        GError    *our_error;
-+        char      *content;
-+        gsize      len;
-+        char      *key_eq;
-+        char     **lines;
-+        gboolean   replaced;
-+        gboolean   retval;
-+        int        n;
-         
-         if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR))
-                 return TRUE;
-@@ -582,12 +586,50 @@
-                                                "TIMEZONE", tz, error);
- }
- 
-+/* This works for Arch Linux */
-+static char *
-+system_timezone_read_etc_rc_conf (void)
-+{
-+        return system_timezone_read_key_file (ETC_RC_CONF,
-+                                              "TIMEZONE");
-+}
-+
-+static gboolean
-+system_timezone_write_etc_rc_conf (const char  *tz,
-+                                   GError     **error)
-+{
-+        return system_timezone_write_key_file (ETC_RC_CONF,
-+                                               "TIMEZONE", tz, error);
-+}
-+
- /*
-  *
-  * First, getting the timezone.
-  *
-  */
- 
-+static char *
-+system_timezone_strip_path_if_valid (const char *filename)
-+{
-+        int skip;
-+
-+        if (!filename || !g_str_has_prefix (filename, SYSTEM_ZONEINFODIR"/"))
-+                return NULL;
-+
-+        /* Timezone data files also live under posix/ and right/ for some
-+         * reason.
-+         * FIXME: make sure accepting those files is valid. I think "posix" is
-+         * okay, not sure about "right" */
-+        if (g_str_has_prefix (filename, SYSTEM_ZONEINFODIR"/posix/"))
-+                skip = strlen (SYSTEM_ZONEINFODIR"/posix/");
-+        else if (g_str_has_prefix (filename, SYSTEM_ZONEINFODIR"/right/"))
-+                skip = strlen (SYSTEM_ZONEINFODIR"/right/");
-+        else
-+                skip = strlen (SYSTEM_ZONEINFODIR"/");
-+
-+        return g_strdup (filename + skip);
-+}
-+
- /* Read the soft symlink from /etc/localtime */
- static char *
- system_timezone_read_etc_localtime_softlink (void)
-@@ -598,31 +640,23 @@
-         if (!g_file_test (ETC_LOCALTIME, G_FILE_TEST_IS_SYMLINK))
-                 return NULL;
- 
--        tz = NULL;
--
-         file = g_file_read_link (ETC_LOCALTIME, NULL);
--        if (g_str_has_prefix (file, SYSTEM_ZONEINFODIR"/"))
--                tz = g_strdup (file + strlen (SYSTEM_ZONEINFODIR"/"));
-+        tz = system_timezone_strip_path_if_valid (file);
-         g_free (file);
- 
--        if (!tz || tz[0] == '\0') {
--                g_free (tz);
--                tz = NULL;
--        }
--
-         return tz;
- }
- 
--typedef gboolean (*CompareFiles) (struct stat  *a_stat,
--                                  struct stat  *b_stat,
--                                  const char   *a_content,
--                                  unsigned int  a_content_len,
--                                  const char   *b_filename);
-+typedef gboolean (*CompareFiles) (struct stat *a_stat,
-+                                  struct stat *b_stat,
-+                                  const char  *a_content,
-+                                  gsize        a_content_len,
-+                                  const char  *b_filename);
- 
- static char *
- recursive_compare (struct stat  *localtime_stat,
-                    const char   *localtime_content,
--                   unsigned int  localtime_content_len,
-+                   gsize         localtime_content_len,
-                    char         *file,
-                    CompareFiles  compare_func)
- {
-@@ -637,7 +671,7 @@
-                                   localtime_content,
-                                   localtime_content_len,
-                                   file))
--                        return g_strdup (file + strlen (SYSTEM_ZONEINFODIR"/"));
-+                        return system_timezone_strip_path_if_valid (file);
-                 else
-                         return NULL;
-         } else if (S_ISDIR (file_stat.st_mode)) {
-@@ -675,11 +709,11 @@
- 
- 
- static gboolean
--files_are_identical_inode (struct stat  *a_stat,
--                           struct stat  *b_stat,
--                           const char   *a_content,
--                           unsigned int  a_content_len,
--                           const char   *b_filename)
-+files_are_identical_inode (struct stat *a_stat,
-+                           struct stat *b_stat,
-+                           const char  *a_content,
-+                           gsize        a_content_len,
-+                           const char  *b_filename)
- {
-         return (a_stat->st_ino == b_stat->st_ino);
- }
-@@ -706,15 +740,15 @@
- }
- 
- static gboolean
--files_are_identical_content (struct stat  *a_stat,
--                             struct stat  *b_stat,
--                             const char   *a_content,
--                             unsigned int  a_content_len,
--                             const char   *b_filename)
-+files_are_identical_content (struct stat *a_stat,
-+                             struct stat *b_stat,
-+                             const char  *a_content,
-+                             gsize        a_content_len,
-+                             const char  *b_filename)
- {
--        char         *b_content = NULL;
--        unsigned int  b_content_len = -1;
--        int           cmp;
-+        char  *b_content = NULL;
-+        gsize  b_content_len = -1;
-+        int    cmp;
- 
-         if (a_stat->st_size != b_stat->st_size)
-                 return FALSE;
-@@ -738,9 +772,10 @@
- static char *
- system_timezone_read_etc_localtime_content (void)
- {
--        struct stat   stat_localtime;
--        char         *localtime_content = NULL;
--        unsigned int  localtime_content_len = -1;
-+        struct stat  stat_localtime;
-+        char        *localtime_content = NULL;
-+        gsize        localtime_content_len = -1;
-+        char        *retval;
- 
-         if (g_stat (ETC_LOCALTIME, &stat_localtime) != 0)
-                 return NULL;
-@@ -754,21 +789,33 @@
-                                   NULL))
-                 return NULL;
- 
--        return recursive_compare (&stat_localtime,
--                                  localtime_content,
--                                  localtime_content_len,
--                                  SYSTEM_ZONEINFODIR,
--                                  files_are_identical_content);
-+        retval = recursive_compare (&stat_localtime,
-+                                   localtime_content,
-+                                   localtime_content_len,
-+                                   SYSTEM_ZONEINFODIR,
-+                                   files_are_identical_content);
-+
-+        g_free (localtime_content);
-+
-+        return retval;
- }
- 
- typedef char * (*GetSystemTimezone) (void);
-+/* The order of the functions here define the priority of the methods used
-+ * to find the timezone. First method has higher priority. */
- static GetSystemTimezone get_system_timezone_methods[] = {
-+        /* cheap and "more correct" than data from a config file */
-+        system_timezone_read_etc_localtime_softlink,
-+        /* reading various config files */
-         system_timezone_read_etc_timezone,
--        system_timezone_read_etc_TIMEZONE,
-         system_timezone_read_etc_sysconfig_clock,
-         system_timezone_read_etc_sysconfig_clock_alt,
-+        system_timezone_read_etc_TIMEZONE,
-+        system_timezone_read_etc_rc_conf,
-+        /* reading deprecated config files */
-         system_timezone_read_etc_conf_d_clock,
--        system_timezone_read_etc_localtime_softlink,
-+        /* reading /etc/timezone directly. Expensive since we have to stat
-+         * many files */
-         system_timezone_read_etc_localtime_hardlink,
-         system_timezone_read_etc_localtime_content,
-         NULL
-@@ -819,11 +866,11 @@
- system_timezone_is_zone_file_valid (const char  *zone_file,
-                                     GError     **error)
- {
--        GError       *our_error;
--        GIOChannel   *channel;
--        GIOStatus     status;
--        char          buffer[strlen (TZ_MAGIC)];
--        unsigned int  read;
-+        GError     *our_error;
-+        GIOChannel *channel;
-+        GIOStatus   status;
-+        char        buffer[strlen (TZ_MAGIC)];
-+        gsize       read;
- 
-         /* First, check the zone_file is properly rooted */
-         if (!g_str_has_prefix (zone_file, SYSTEM_ZONEINFODIR"/")) {
-@@ -878,9 +925,9 @@
- system_timezone_set_etc_timezone (const char  *zone_file,
-                                   GError     **error)
- {
--        GError       *our_error;
--        char         *content;
--        unsigned int  len;
-+        GError *our_error;
-+        char   *content;
-+        gsize   len;
- 
-         if (!system_timezone_is_zone_file_valid (zone_file, error))
-                 return FALSE;
-@@ -924,11 +971,20 @@
- 
- typedef gboolean (*SetSystemTimezone) (const char  *tz,
-                                        GError     **error);
-+/* The order here does not matter too much: we'll try to change all files
-+ * that already have a timezone configured. It matters in case of error,
-+ * since the process will be stopped and the last methods won't be called.
-+ * So we use the same order as in get_system_timezone_methods */
- static SetSystemTimezone set_system_timezone_methods[] = {
-+        /* writing various config files if they exist and have the
-+         * setting already present */
-         system_timezone_write_etc_timezone,
--        system_timezone_write_etc_TIMEZONE,
-         system_timezone_write_etc_sysconfig_clock,
-         system_timezone_write_etc_sysconfig_clock_alt,
-+        system_timezone_write_etc_TIMEZONE,
-+        system_timezone_write_etc_rc_conf,
-+        /* writing deprecated config files if they exist and have the
-+         * setting already present */
-         system_timezone_write_etc_conf_d_clock,
-         NULL
- };
-Index: clock.c
-===================================================================
---- applets/clock/clock.c	(revision 11043)
-+++ applets/clock/clock.c	(revision 11054)
-@@ -2208,7 +2208,11 @@
-                 return;
-         }
- 
--        loc = clock_location_new (name, timezone, latitude, longitude, code, &prefs);
-+	loc = clock_location_find_and_ref (cd->locations, name, timezone,
-+					   latitude, longitude, code);
-+	if (!loc)
-+		loc = clock_location_new (name, timezone,
-+					  latitude, longitude, code, &prefs);
- 
- 	if (current && clock_location_is_current_timezone (loc))
- 		clock_location_make_current (loc, NULL, NULL, NULL);
-@@ -3087,9 +3091,10 @@
- 		clock_location_is_current (loc);
- 
-                 cd->locations = g_list_append (cd->locations, loc);
--                locations_changed (cd);
-         }
- 
-+	/* This will update everything related to locations to take into
-+	 * account the new location (via the gconf notification) */
-         save_cities_store (cd);
- 
-         edit_hide (edit_window, cd);
-@@ -3405,8 +3410,12 @@
-                           G_CALLBACK (location_row_activated), cd);
- 
- 	model = gweather_xml_load_locations ();
--	gtk_tree_view_set_model (tree, model);
--        g_object_unref (model);
-+
-+	/* Can be NULL if libgweather is not correctly installed */
-+	if (model) {
-+		gtk_tree_view_set_model (tree, model);
-+		g_object_unref (model);
-+	}
- }
- 
- static void
-@@ -3416,23 +3425,41 @@
- 	GtkWidget *name_entry = glade_xml_get_widget (cd->glade_xml, "edit-location-name-entry");
-         GtkWidget *window;
- 	const char *find;
-+	const char *location;
- 
- 	fill_location_tree (cd);
-         window = glade_xml_get_widget (cd->glade_xml, "find-location-window");
- 
- 	/* prefill the find entry if it's empty */
- 	find = gtk_entry_get_text (GTK_ENTRY (cd->find_location_entry));
--	if (!find || !find[0]) {
--		const char *location;
-+	location = gtk_entry_get_text (GTK_ENTRY (name_entry));
- 
--		location = gtk_entry_get_text (GTK_ENTRY (name_entry));
--		gtk_entry_set_text (GTK_ENTRY (cd->find_location_entry),
--				    location);
-+	if (g_strcmp0 (find, location) != 0 || !find || !find[0]) {
-+		GtkWidget *scroll = glade_xml_get_widget (cd->glade_xml, "find-location-scroll");
-+		GtkAdjustment *adjustment;
-+
-+		/* If we autofill the entry, reset the state of the treeview
-+		 * first so that it looks like a brand new search */
-+		gtk_tree_view_collapse_all (GTK_TREE_VIEW (cd->location_tree));
-+
-+		adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scroll));
-+		gtk_adjustment_set_value (adjustment, 0);
-+		gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (scroll),
-+						     adjustment);
-+
-+		if (g_strcmp0 (find, location) != 0)
-+			gtk_entry_set_text (GTK_ENTRY (cd->find_location_entry),
-+					    location);
- 	}
-+
- 	gtk_widget_grab_focus (cd->find_location_entry);
-+	gtk_editable_set_position (GTK_EDITABLE (cd->find_location_entry),
-+				   -1);
- 
--        gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (edit_window));
--        gtk_window_present_with_time (GTK_WINDOW (window), gtk_get_current_event_time ());
-+        gtk_window_set_transient_for (GTK_WINDOW (window),
-+				      GTK_WINDOW (edit_window));
-+        gtk_window_present_with_time (GTK_WINDOW (window),
-+				      gtk_get_current_event_time ());
- }
- 
- static gboolean
-@@ -3507,6 +3534,10 @@
- 
- 	tree = GTK_TREE_VIEW (cd->location_tree);
- 	model = gtk_tree_view_get_model (tree);
-+	/* Can happen if libgweather is not correctly installed */
-+	if (!model)
-+		return;
-+
- 	entry = GTK_ENTRY (cd->find_location_entry);
- 	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
- 
-@@ -3551,6 +3582,9 @@
- 
- 	tree = GTK_TREE_VIEW (cd->location_tree);
- 	model = gtk_tree_view_get_model (tree);
-+	/* Can happen if libgweather is not correctly installed */
-+	if (!model)
-+		return;
- 
- 	selection = gtk_tree_view_get_selection (tree);
- 	gtk_tree_model_get_iter_first (model, &iter);
-@@ -3596,8 +3630,6 @@
-         GtkWidget *lon_entry = glade_xml_get_widget (cd->glade_xml, "edit-location-longitude-entry");
-         GtkWidget *lat_combo = glade_xml_get_widget (cd->glade_xml, "edit-location-latitude-combo");
-         GtkWidget *lon_combo = glade_xml_get_widget (cd->glade_xml, "edit-location-longitude-combo");
--        GtkWidget *scroll = glade_xml_get_widget (cd->glade_xml, "find-location-scroll");
--	GtkAdjustment *adjustment;
- 
-         /* clear out the old data */
-         gtk_combo_box_set_active (GTK_COMBO_BOX (zone_combo), -1);
-@@ -3609,16 +3641,6 @@
- 
-         gtk_combo_box_set_active (GTK_COMBO_BOX (lat_combo), -1);
-         gtk_combo_box_set_active (GTK_COMBO_BOX (lon_combo), -1);
--
--	/* reset the state of the find window */
--	gtk_entry_set_text (GTK_ENTRY (cd->find_location_entry), "");
--
--	gtk_tree_view_collapse_all (GTK_TREE_VIEW (cd->location_tree));
--
--	adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scroll));
--	gtk_adjustment_set_value (adjustment, 0);
--	gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (scroll),
--					     adjustment);
- }
- 
- static void
-@@ -3725,7 +3747,10 @@
-   data.distance = 1e6;
-   data.location = NULL;
- 
--  gtk_tree_model_foreach (GTK_TREE_MODEL (model), compare_location, &data);
-+  /* Can be NULL if libgweather is not correctly installed */
-+  if (model)
-+	  gtk_tree_model_foreach (GTK_TREE_MODEL (model),
-+			  	  compare_location, &data);
- 
-   if (data.location)
-     code = g_strdup (data.location->code);
-@@ -3828,12 +3853,11 @@
-         ClockLocation *loc = NULL;
- 
-         gtk_tree_model_get (model, iter, COL_CITY_LOC, &loc, -1);
--
--        gtk_list_store_remove (cd->cities_store, iter);
- 	cd->locations = g_list_remove (cd->locations, loc);
--	locations_changed (cd);
- 	g_object_unref (loc);
- 
-+	/* This will update everything related to locations to take into
-+	 * account the removed location (via the gconf notification) */
-         save_cities_store (cd);
- }
- 





More information about the arch-commits mailing list