gnome-panel r10994 - trunk/applets/clock



Author: vuntz
Date: Mon Apr  7 20:18:31 2008
New Revision: 10994
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=10994&view=rev

Log:
2008-04-07  Vincent Untz  <vuntz gnome org>

	Don't show weather information of the last location once it has been
	removed. Fix bug #526300.
	Also fixes the empty space at the left of the clock when there's no
	location.

	* clock.c: (update_panel_weather): show the weather obox only if there
	is at least one location
	(locations_changed): show/hide weather obox if there's locations/no
	location
	(location_weather_updated_cb): add FIXME for later


Modified:
   trunk/applets/clock/ChangeLog
   trunk/applets/clock/clock.c

Modified: trunk/applets/clock/clock.c
==============================================================================
--- trunk/applets/clock/clock.c	(original)
+++ trunk/applets/clock/clock.c	Mon Apr  7 20:18:31 2008
@@ -1994,7 +1994,8 @@
         else
                 gtk_widget_hide (cd->panel_temperature_label);
 
-	if (cd->show_weather || cd->show_temperature)
+	if ((cd->show_weather || cd->show_temperature) &&
+	    g_list_length (cd->locations) > 0)
                 gtk_widget_show (cd->weather_obox);
         else
                 gtk_widget_hide (cd->weather_obox);
@@ -2062,6 +2063,7 @@
 		return;
 
 	icon_name = weather_info_get_icon_name (info);
+	/* FIXME: mmh, screen please? Also, don't hardcode to 16 */
 	theme = gtk_icon_theme_get_default ();
 	pixbuf = gtk_icon_theme_load_icon (theme, icon_name, 16, 0, NULL);
 
@@ -2093,6 +2095,20 @@
 	ClockLocation *loc;
 	glong id;
 
+	if (!cd->locations) {
+		if (cd->weather_obox)
+			gtk_widget_hide (cd->weather_obox);
+		if (cd->panel_weather_icon)
+			gtk_image_set_from_pixbuf (GTK_IMAGE (cd->panel_weather_icon),
+						   NULL);
+		if (cd->panel_temperature_label)
+			gtk_label_set_text (GTK_LABEL (cd->panel_temperature_label),
+					    "");
+	} else {
+		if (cd->weather_obox)
+			gtk_widget_show (cd->weather_obox);
+	}
+
 	for (l = cd->locations; l; l = l->next) {
 		loc = l->data;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]