rpms/gnome-panel/devel localtime.patch, NONE, 1.1 pref-dialogs.patch, NONE, 1.1 set-button.patch, NONE, 1.1 gnome-panel.spec, 1.256, 1.257

Matthias Clasen (mclasen) fedora-extras-commits at redhat.com
Sun Feb 17 20:57:22 UTC 2008


Author: mclasen

Update of /cvs/extras/rpms/gnome-panel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv28384

Modified Files:
	gnome-panel.spec 
Added Files:
	localtime.patch pref-dialogs.patch set-button.patch 
Log Message:
first round of intlclock fixes


localtime.patch:

--- NEW FILE localtime.patch ---
--- gnome-panel-2.21.91/applets/clock/clock.c	2008-02-11 16:15:51.000000000 -0500
+++ hacked/applets/clock/clock.c	2008-02-16 01:23:14.000000000 -0500
@@ -508,7 +508,7 @@
                 ClockLocationTile *tile;
 
                 tile = CLOCK_LOCATION_TILE (l->data);
-                clock_location_tile_refresh (tile);
+                clock_location_tile_refresh (tile, FALSE);
         }
 }
 
@@ -1084,12 +1084,12 @@
         gtk_label_set_text (GTK_LABEL (cd->panel_temperature_label), temperature);
 }
 
-static char *
-location_tile_need_formatted_time_cb (ClockLocationTile *tile, gpointer data)
+static ClockFormat
+location_tile_need_clock_format_cb(ClockLocationTile *tile, gpointer data)
 {
         ClockData *cd = data;
 
-        return format_time (cd);
+        return cd->format;
 }
 
 static void
@@ -1133,8 +1133,10 @@
                                   G_CALLBACK (location_tile_timezone_set_cb), cd);
                 g_signal_connect (city, "weather-updated",
                                   G_CALLBACK (location_tile_weather_updated_cb), cd);
-                g_signal_connect (city, "need-formatted-time",
-                                  G_CALLBACK (location_tile_need_formatted_time_cb), cd);
+                g_signal_connect (city, "need-clock-format",
+                                  G_CALLBACK (location_tile_need_clock_format_cb), cd);
+
+		clock_location_tile_refresh (city, TRUE);
 
                 gtk_box_pack_start (GTK_BOX (cd->cities_section),
                                     GTK_WIDGET (city),
--- gnome-panel-2.21.91/applets/clock/clock-location-tile.h	2008-02-11 16:15:51.000000000 -0500
+++ hacked/applets/clock/clock-location-tile.h	2008-02-16 23:42:35.000000000 -0500
@@ -28,7 +28,8 @@
 	void (* tile_pressed) (ClockLocationTile *tile);
 	void (* timezone_set) (ClockLocationTile *tile);
 	void (* weather_updated) (ClockLocationTile *tile, GdkPixbuf *weather_icon, const char *temperature);
-	char *(* need_formatted_time) (ClockLocationTile *tile);
+	char *(* need_formatted_time) (ClockLocationTile *tile); 
+        int  (* need_clock_format) (ClockLocationTile *tile);
 } ClockLocationTileClass;
 
 GType clock_location_tile_get_type (void);
@@ -40,7 +41,8 @@
 
 void weather_info_setup_tooltip (WeatherInfo *info, GtkTooltip *tip);
 
-void clock_location_tile_refresh (ClockLocationTile *this);
+void clock_location_tile_refresh (ClockLocationTile *this,
+                                  gboolean           force_refresh);
 
 G_END_DECLS
 #endif /* __CLOCK_H__ */
--- gnome-panel-2.21.91/applets/clock/clock-location-tile.c	2008-02-11 16:15:51.000000000 -0500
+++ hacked/applets/clock/clock-location-tile.c	2008-02-16 01:24:40.000000000 -0500
@@ -11,6 +11,7 @@
 #include "clock-face.h"
 #include "clock-location-tile.h"
 #include "clock-location.h"
+#include "clock-utils.h"
 #include "clock-marshallers.h"
 #include "set-timezone.h"
 
@@ -21,6 +22,7 @@
 	TIMEZONE_SET,
 	WEATHER_UPDATED,
 	NEED_FORMATTED_TIME,
+	NEED_CLOCK_FORMAT,
 	LAST_SIGNAL
 };
 
@@ -130,6 +132,15 @@
 						     NULL,
 						     _clock_marshal_STRING__VOID,
 						     G_TYPE_STRING, 0);
+
+	signals[NEED_CLOCK_FORMAT] = g_signal_new ("need-clock-format",
+						   G_TYPE_FROM_CLASS (g_obj_class),
+						   G_SIGNAL_RUN_LAST,
+						   G_STRUCT_OFFSET (ClockLocationTileClass, need_clock_format),
+						   NULL,
+						   NULL,
+						   _clock_marshal_INT__VOID,
+						   G_TYPE_INT, 0);
 }
 
 static void
@@ -310,7 +321,7 @@
         gtk_container_add (GTK_CONTAINER (priv->box), alignment);
         gtk_container_add (GTK_CONTAINER (this), priv->box);
 
-        clock_location_tile_refresh (this);
+        clock_location_tile_refresh (this, TRUE);
 }
 
 static gboolean
@@ -378,13 +389,72 @@
 	g_signal_emit (this, signals[WEATHER_UPDATED], 0, weather_icon, temperature);
 }
 
+static char *
+format_time (struct tm   *now, 
+             char        *tzname,
+             ClockFormat  clock_format,
+	     long         offset)
+{
+	char buf[256];
+	char *format;
+	time_t local_t;
+	struct tm local_now;
+	char *utf8;	
+	char *tmp;	
+	long hours, minutes;
+
+	time (&local_t);
+	localtime_r (&local_t, &local_now);
+
+	if (local_now.tm_wday != now->tm_wday) {
+		if (clock_format == CLOCK_FORMAT_12) {
+			format = _("%l:%M <small>%p (%A)</small>");
+		}
+		else {
+			format = _("%H:%M <small>(%A)</small>");
+		}
+	}
+	else {
+		if (clock_format == CLOCK_FORMAT_12) {
+			format = _("%l:%M <small>%p</small>");
+		}
+		else {
+			format = _("%H:%M");
+		}
+	}
+
+	if (strftime (buf, sizeof (buf), format, now) <= 0) {
+		strcpy (buf, "???");
+	}
+
+        hours = offset / 3600;
+        minutes = labs (offset % 3600) / 60;
+
+	if (hours != 0 && minutes != 0) {
+		tmp = g_strdup_printf ("%s <small>%s %+d:%d</small>", buf, tzname, hours, minutes);
+	}
+	else if (hours != 0) {
+		tmp = g_strdup_printf ("%s <small>%s %+d</small>", buf, tzname, hours);
+	}
+	else {
+		tmp = g_strdup_printf ("%s <small>%s</small>", buf, tzname);
+	}
+
+	utf8 = g_locale_to_utf8 (tmp, -1, NULL, NULL, NULL);
+
+	g_free (tmp);
+
+	return utf8;
+}
+
 void
-clock_location_tile_refresh (ClockLocationTile *this)
+clock_location_tile_refresh (ClockLocationTile *this, gboolean force_refresh)
 {
         ClockLocationTilePrivate *priv = PRIVATE (this);
-        gchar *tmp, *tmp2, *tzname;
+        gchar *tmp, *tzname;
         struct tm now;
 	long offset, hours, minutes;
+	int format;
 
 	g_return_if_fail (IS_CLOCK_LOCATION_TILE (this));
 
@@ -411,7 +481,7 @@
                 clock_face_refresh (CLOCK_FACE (priv->clock_face));
         }
 
-        if (!clock_needs_label_refresh (this)) {
+        if (!force_refresh && !clock_needs_label_refresh (this)) {
                 return;
         }
 
@@ -426,26 +496,15 @@
         gtk_label_set_markup (GTK_LABEL (priv->city_label), tmp);
         g_free (tmp);
 
-	tmp = NULL;
-	g_signal_emit (this, signals[NEED_FORMATTED_TIME], 0, &tmp);
+	g_signal_emit (this, signals[NEED_CLOCK_FORMAT], 0, &format);
 
 	offset = - priv->last_offset;
 
-	hours = offset / 3600;
-	minutes = labs (offset % 3600) / 60;
+	tmp = format_time (&now, tzname, format, offset);
 
-	if (hours != 0 && minutes != 0)
-		tmp2 = g_strdup_printf ("%s  <small>%+ld:%ld</small>", tmp ? tmp : "", hours, minutes);
-	else if (hours != 0)
-		tmp2 = g_strdup_printf ("%s  <small>%+ld</small>", tmp ? tmp : "", hours);
-	else {
-		tmp2 = tmp;
-		tmp = NULL;
-	}
+        gtk_label_set_markup (GTK_LABEL (priv->time_label), tmp);
 
-        gtk_label_set_markup (GTK_LABEL (priv->time_label), tmp2);
         g_free (tmp);
-	g_free (tmp2);
 }
 
 void

pref-dialogs.patch:

--- NEW FILE pref-dialogs.patch ---
--- gnome-panel-2.21.91/applets/clock/clock.glade	2008-02-11 16:15:51.000000000 -0500
+++ hacked/applets/clock/clock.glade	2008-02-16 01:43:05.000000000 -0500
@@ -14,7 +14,7 @@
   <property name="decorated">True</property>
   <property name="skip_taskbar_hint">False</property>
   <property name="skip_pager_hint">False</property>
-  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
   <property name="focus_on_map">True</property>
   <property name="urgency_hint">False</property>
@@ -484,7 +484,7 @@
   <property name="decorated">True</property>
   <property name="skip_taskbar_hint">False</property>
   <property name="skip_pager_hint">False</property>
-  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
   <property name="focus_on_map">True</property>
   <property name="urgency_hint">False</property>
@@ -818,7 +818,7 @@
   <property name="decorated">True</property>
   <property name="skip_taskbar_hint">False</property>
   <property name="skip_pager_hint">False</property>
-  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
   <property name="focus_on_map">True</property>
   <property name="urgency_hint">False</property>

set-button.patch:

--- NEW FILE set-button.patch ---
diff -up gnome-panel-2.21.91/applets/clock/clock-location-tile.c.set-button gnome-panel-2.21.91/applets/clock/clock-location-tile.c
--- gnome-panel-2.21.91/applets/clock/clock-location-tile.c.set-button	2008-02-17 15:52:17.000000000 -0500
+++ gnome-panel-2.21.91/applets/clock/clock-location-tile.c	2008-02-17 15:52:54.000000000 -0500
@@ -223,6 +223,9 @@ enter_or_leave_tile (GtkWidget          
 {
         ClockLocationTilePrivate *priv = PRIVATE (tile);
 
+	if (event->mode != GDK_CROSSING_NORMAL) {
+		return TRUE;
+	}
         if (event->type == GDK_ENTER_NOTIFY) {
 	      	gint can_set;
 


Index: gnome-panel.spec
===================================================================
RCS file: /cvs/extras/rpms/gnome-panel/devel/gnome-panel.spec,v
retrieving revision 1.256
retrieving revision 1.257
diff -u -r1.256 -r1.257
--- gnome-panel.spec	15 Feb 2008 14:35:51 -0000	1.256
+++ gnome-panel.spec	17 Feb 2008 20:56:40 -0000	1.257
@@ -22,7 +22,7 @@
 Summary: GNOME panel
 Name: gnome-panel
 Version: 2.21.91
-Release: 2%{?dist}
+Release: 3%{?dist}
 URL: http://www.gnome.org
 Source0: http://download.gnome.org/sources/gnome-panel/2.21/%{name}-%{version}.tar.bz2
 
@@ -108,6 +108,15 @@
 
 Patch14: gnome-panel-2.21.5-ck-shutdown.patch
 
+# fix display of times in location tiles in the clock
+Patch15: localtime.patch
+
+# fix some focus issues with preference dialogs
+Patch16: pref-dialogs.patch
+
+# make set buttons on location tiles work
+Patch17: set-button.patch
+
 Conflicts: gnome-power-manager < 2.15.3
 
 %description
@@ -153,6 +162,9 @@
 %patch10 -p1 -b .preferred-apps
 %patch11 -p1 -b .applet-error
 %patch14 -p1 -b .ck-shutdown
+%patch15 -p1 -b .localtime
+%patch16 -p1 -b .pref-dialogs
+%patch17 -p1 -b .set-button
 
 . %{SOURCE6}
 
@@ -337,6 +349,9 @@
 %{_datadir}/gtk-doc/html/*
 
 %changelog
+* Sun Feb 17 2008 Matthias Clasen <mclasen at redhat.com> - 2.21.91-3
+- First round of intlclock fixes
+
 * Fri Feb 15 2008 Matthias Clasen <mclasen at redhat.com> - 2.21.91-2
 - Drop gnome-vfs BR
 




More information about the fedora-extras-commits mailing list