Gnome-Panel Clock-Applet with Markup text label.



Hi Guys,

I'm not sure if I submit this to the right list, but I made a little
change to the gnome-panel clock applet so it renders markup texts and
you can modify the look of the clock applet from gconf
(/apps/panel/applets/clockapplet/prefs/custom_format)

For e.g. use this format:
<span font_desc="Sans 10" weight="bold">%I:%M <span font_desc="Sans 8"
weight="heavy" rise="4000">%p</span><span rise="3000">    </span>%n<span
font_desc="Sans 8" foreground="#999999" weight="heavy" ><sup>%a, %d %b
'%g</sup></span></span>

to get this result:
http://julius.solutions-i.org/clock_applet.jpg

The patch is attached to the mail, I left the old code in the patch, but
you can remove if you will.

Bests,
Julius
--- gnome-panel-2.13.91/applets/clock/clock.c	2006-01-22 12:23:29.000000000 -0500
+++ gnome-panel-2.13.91.patched/applets/clock/clock.c	2006-02-19 00:41:29.000000000 -0500
@@ -372,7 +372,7 @@
 {
 	struct tm *tm;
 	char date[256], hour[256];
-	char *utf8, *loc;
+	char *utf8, *loc, *markup;
 
 	time (&cd->current_time);
 	
@@ -409,8 +409,15 @@
 	}
 
 	utf8 = g_locale_to_utf8 (hour, -1, NULL, NULL, NULL);
-	gtk_label_set_text (GTK_LABEL (cd->clockw), utf8);
+
+        // Set formatet label for the clock
+        markup = g_markup_printf_escaped (utf8);
+        gtk_label_set_markup (GTK_LABEL (cd->clockw), markup);
+
+        // Old not formated label
+	//gtk_label_set_text (GTK_LABEL (cd->clockw), utf8);
 	g_free (utf8);
+        g_free (markup);
 
         gtk_widget_queue_resize (cd->toggle);
 


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