<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -2,6 +2,7 @@
 #include &lt;stdlib.h&gt;
 #include &lt;signal.h&gt;
 #include &lt;dirent.h&gt;
+#include &lt;locale.h&gt;
 #include &quot;gui.h&quot;
 #include &quot;config-parser.h&quot;
 #include &quot;xdg.h&quot;
@@ -278,6 +279,7 @@ static void parse_bmpanel2_args(int argc, char **argv)
 
 int main(int argc, char **argv)
 {
+	setlocale(LC_TIME, &quot;&quot;);
 	g_thread_init(0);
 	if (!g_thread_supported())
 		XDIE(&quot;bmpanel2 requires glib with thread support enabled&quot;);</diff>
      <filename>bmpanel.c</filename>
    </modified>
    <modified>
      <diff>@@ -48,40 +48,50 @@ static void free_clock_theme(struct clock_theme *ct)
   Clock interface
 **************************************************************************/
 
-static int create_widget_private(struct widget *w, struct config_format_entry *e, 
-		struct config_format_tree *tree)
+static void fill_buftime(char *buf, size_t size, struct clock_theme *ct)
 {
-	struct clock_widget *cw = xmallocz(sizeof(struct clock_widget));
-	if (parse_clock_theme(&amp;cw-&gt;theme, e, tree)) {
-		xfree(cw);
-		XWARNING(&quot;Failed to parse clock theme&quot;);
-		return -1;
-	}
+	time_t current_time;
+	current_time = time(0);
+	strftime(buf, size, ct-&gt;time_format, localtime(&amp;current_time));
+}
 
-	/* get widget width */
+static int get_clock_width(struct widget *w, const char *bufover)
+{
+	struct clock_widget *cw = (struct clock_widget*)w-&gt;private;
 	int text_width = 0;
 	int pics_width = 0;
 
 	char buftime[128];
-	struct tm tm;
-	CLEAR_STRUCT(&amp;tm);
-	strftime(buftime, sizeof(buftime), cw-&gt;theme.time_format, &amp;tm);
-
+	if (!bufover) {
+		fill_buftime(buftime, sizeof(buftime), &amp;cw-&gt;theme);
+		bufover = buftime;
+	}
 	text_extents(w-&gt;panel-&gt;layout, cw-&gt;theme.font.pfd, 
-			buftime, &amp;text_width, 0);
-
-	/* background is drawn only if the center is here */
+			bufover, &amp;text_width, 0);
 	if (cw-&gt;theme.background.center) {
 		pics_width += image_width(cw-&gt;theme.background.left);
 		pics_width += image_width(cw-&gt;theme.background.right);
 	}
+	return text_width + pics_width;
+}
+
+static int create_widget_private(struct widget *w, struct config_format_entry *e, 
+		struct config_format_tree *tree)
+{
+	struct clock_widget *cw = xmallocz(sizeof(struct clock_widget));
+	if (parse_clock_theme(&amp;cw-&gt;theme, e, tree)) {
+		xfree(cw);
+		XWARNING(&quot;Failed to parse clock theme&quot;);
+		return -1;
+	}
+
 	cw-&gt;clock_prog = parse_string_or_null(&quot;clock_prog&quot;, 
 					      &amp;g_settings.root);
 	cw-&gt;mouse_button = parse_int(&quot;clock_mouse_button&quot;, 
 				     &amp;g_settings.root, 1);
 
-	w-&gt;width = text_width + pics_width;
 	w-&gt;private = cw;
+	w-&gt;width = get_clock_width(w, 0);
 	return 0;
 }
 
@@ -100,10 +110,7 @@ static void draw(struct widget *w)
 
 	/* time */
 	char buftime[128];
-	time_t current_time;
-	current_time = time(0);
-	strftime(buftime, sizeof(buftime), cw-&gt;theme.time_format, 
-			localtime(&amp;current_time));
+	fill_buftime(buftime, sizeof(buftime), &amp;cw-&gt;theme);
 
 	/* drawing */
 	cairo_t *cr = w-&gt;panel-&gt;cr;
@@ -155,6 +162,13 @@ static void clock_tick(struct widget *w)
 		return;
 	strcpy(buflasttime, buftime);
 
+	int nw = get_clock_width(w, buftime);
+	if (nw != w-&gt;width) {
+		w-&gt;width = nw;
+		recalculate_widgets_sizes(w-&gt;panel);
+		return;
+	}
+
 	w-&gt;needs_expose = 1;
 }
 </diff>
      <filename>widget-clock.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b08c4376df161d9b4f71b4dc69df9cd07bd3b270</id>
    </parent>
  </parents>
  <author>
    <name>nsf</name>
    <email>no.smile.face@gmail.com</email>
  </author>
  <url>http://github.com/nsf/bmpanel2/commit/b417d0725e19f9260a9420fd4c2c9938b770ca7a</url>
  <id>b417d0725e19f9260a9420fd4c2c9938b770ca7a</id>
  <committed-date>2009-11-13T05:13:56-08:00</committed-date>
  <authored-date>2009-11-13T05:13:56-08:00</authored-date>
  <message>Enable locale and fix bug.

http://code.google.com/p/bmpanel2/issues/detail?id=13</message>
  <tree>e34a655d16cd2650f58f654f31ff1c1b49c87c09</tree>
  <committer>
    <name>nsf</name>
    <email>no.smile.face@gmail.com</email>
  </committer>
</commit>
