r3255 - in trunk/src/target/OM-2007.2/applications/openmoko-today2: . src

chris at sita.openmoko.org chris at sita.openmoko.org
Tue Oct 23 12:29:58 CEST 2007


Author: chris
Date: 2007-10-23 12:29:57 +0200 (Tue, 23 Oct 2007)
New Revision: 3255

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-today2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-today2/configure.ac
   trunk/src/target/OM-2007.2/applications/openmoko-today2/src/Makefile.am
   trunk/src/target/OM-2007.2/applications/openmoko-today2/src/today-main.c
   trunk/src/target/OM-2007.2/applications/openmoko-today2/src/today.h
Log:
        * configure.ac:
        * src/Makefile.am:
        * src/today-main.c: (set_time_idle), (today_create_home_page),
        (main):
        * src/today.h:
        Use libjana-gtk/libjana-ecal and put an analog clock on the main screen


Modified: trunk/src/target/OM-2007.2/applications/openmoko-today2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-today2/ChangeLog	2007-10-23 10:21:01 UTC (rev 3254)
+++ trunk/src/target/OM-2007.2/applications/openmoko-today2/ChangeLog	2007-10-23 10:29:57 UTC (rev 3255)
@@ -1,6 +1,15 @@
 2007-10-23  Chris Lord  <chris at openedhand.com>
 
+	* configure.ac:
 	* src/Makefile.am:
+	* src/today-main.c: (set_time_idle), (today_create_home_page),
+	(main):
+	* src/today.h:
+	Use libjana-gtk/libjana-ecal and put an analog clock on the main screen
+
+2007-10-23  Chris Lord  <chris at openedhand.com>
+
+	* src/Makefile.am:
 	Revert change that I didn't mean to commit
 
 2007-10-22  Chris Lord  <chris at openedhand.com>

Modified: trunk/src/target/OM-2007.2/applications/openmoko-today2/configure.ac
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-today2/configure.ac	2007-10-23 10:21:01 UTC (rev 3254)
+++ trunk/src/target/OM-2007.2/applications/openmoko-today2/configure.ac	2007-10-23 10:29:57 UTC (rev 3255)
@@ -35,6 +35,7 @@
 PKG_CHECK_MODULES(ECAL, libecal-1.2 >= $LIBECAL_VERSION)
 PKG_CHECK_MODULES(EBOOK, libebook-1.2 >= $LIBEBOOK_VERSION)
 PKG_CHECK_MODULES(GCONF, gconf-2.0)
+PKG_CHECK_MODULES(JANA, libjana libjana-ecal libjana-gtk)
 
 AC_ARG_ENABLE(startup_notification,
         AC_HELP_STRING([--enable-startup-notification], [enable startup notification support]),

Modified: trunk/src/target/OM-2007.2/applications/openmoko-today2/src/Makefile.am
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-today2/src/Makefile.am	2007-10-23 10:21:01 UTC (rev 3254)
+++ trunk/src/target/OM-2007.2/applications/openmoko-today2/src/Makefile.am	2007-10-23 10:29:57 UTC (rev 3255)
@@ -6,7 +6,7 @@
 
 AM_CFLAGS    = -Wall -pedantic -std=c99 @GTK_CFLAGS@ @ECAL_CFLAGS@ \
 		@EBOOK_CFLAGS@ @MOKOUI_CFLAGS@ @MOKOJOURNAL_CFLAGS@ \
-		@GCONF_CFLAGS@
+		@GCONF_CFLAGS@ @JANA_CFLAGS@
 
 bin_PROGRAMS = openmoko-today
 
@@ -32,7 +32,7 @@
 			$(top_builddir)/libtaku/libtaku.a	\
 			@GTK_LIBS@ @ECAL_LIBS@ @EBOOK_LIBS@ @SEXY_LIBS@ \
 			@SN_LIBS@ @MOKOUI_LIBS@ @MOKOJOURNAL_LIBS@ \
-			@GCONF_LIBS@
+			@GCONF_LIBS@ @JANA_LIBS@
 
 MAINTAINERCLEANFILES  = config.h.in Makefile.in
 

Modified: trunk/src/target/OM-2007.2/applications/openmoko-today2/src/today-main.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-today2/src/today-main.c	2007-10-23 10:21:01 UTC (rev 3254)
+++ trunk/src/target/OM-2007.2/applications/openmoko-today2/src/today-main.c	2007-10-23 10:29:57 UTC (rev 3255)
@@ -9,6 +9,9 @@
 #include <libtaku/launcher-util.h>
 #include <libtaku/xutil.h>
 #include <unistd.h>
+#include <libjana/jana.h>
+#include <libjana-ecal/jana-ecal.h>
+#include <libjana-gtk/jana-gtk.h>
 #include "today.h"
 #include "today-utils.h"
 #include "today-pim-summary.h"
@@ -86,6 +89,27 @@
 	}
 }
 
+static gboolean
+set_time_idle (TodayData *data)
+{
+	JanaTime *time;
+	
+	time = jana_ecal_utils_time_now (data->location);
+	jana_gtk_clock_set_time (JANA_GTK_CLOCK (data->clock), time);
+	
+#if GLIB_CHECK_VERSION(2,14,0)
+	g_timeout_add_seconds (60 - jana_time_get_seconds (time),
+		(GSourceFunc)set_time_idle, data);
+#else
+	g_timeout_add ((60 - jana_time_get_seconds (time)) * 1000,
+		(GSourceFunc)set_time_idle, data);
+#endif
+
+	g_object_unref (time);
+	
+	return TRUE;
+}
+
 static GtkWidget *
 today_create_home_page (TodayData *data)
 {
@@ -129,6 +153,20 @@
 	g_signal_connect (G_OBJECT (data->dial_button), "clicked",
 		G_CALLBACK (today_dial_button_clicked_cb), data);
 
+	/* Create event box with background */
+	data->bg_ebox = gtk_event_box_new ();
+	gtk_widget_set_app_paintable (data->bg_ebox, TRUE);
+	g_signal_connect (data->bg_ebox, "expose-event",
+		G_CALLBACK (bg_expose_cb), data);
+	g_signal_connect (data->bg_ebox, "size-allocate",
+		G_CALLBACK (bg_size_allocate_cb), data);
+	
+	/* Get location and create clock widget */
+	data->location = jana_ecal_utils_guess_location ();
+	data->clock = jana_gtk_clock_new ();
+	jana_gtk_clock_set_draw_shadow (JANA_GTK_CLOCK (data->clock), TRUE);
+
+	/* Create viewport for clock/journal/PIM summary widgets */
 	viewport = gtk_viewport_new (NULL, NULL);
 	scroll = moko_finger_scroll_new ();
 	gtk_container_add (GTK_CONTAINER (scroll), viewport);
@@ -137,8 +175,12 @@
 				      GTK_SHADOW_NONE);
 	gtk_widget_show_all (scroll);
 
+	/* Pack widgets */
 	vbox = gtk_vbox_new (FALSE, 6);
 
+	gtk_box_pack_start (GTK_BOX (vbox), data->clock, TRUE, TRUE, 0);
+	gtk_widget_show_all (data->clock);
+	
 	data->message_box = today_pim_journal_box_new (data);
 	gtk_box_pack_start (GTK_BOX (vbox), data->message_box, FALSE, TRUE, 0);
 	gtk_widget_show (data->message_box);
@@ -147,14 +189,6 @@
 	gtk_box_pack_start (GTK_BOX (vbox), data->summary_box, FALSE, TRUE, 6);
 	gtk_widget_show (data->summary_box);
 	
-	/* Create event box with background */
-	data->bg_ebox = gtk_event_box_new ();
-	gtk_widget_set_app_paintable (data->bg_ebox, TRUE);
-	g_signal_connect (data->bg_ebox, "expose-event",
-		G_CALLBACK (bg_expose_cb), data);
-	g_signal_connect (data->bg_ebox, "size-allocate",
-		G_CALLBACK (bg_size_allocate_cb), data);
-
 	align = gtk_alignment_new (0.5, 0.5, 1, 1);
 	gtk_alignment_set_padding (GTK_ALIGNMENT (align), 6, 6, 6, 6);
 	gtk_container_add (GTK_CONTAINER (viewport), data->bg_ebox);
@@ -162,6 +196,9 @@
 	gtk_container_add (GTK_CONTAINER (align), vbox);
 	gtk_widget_show_all (data->bg_ebox);
 	
+	/* Set the time on the clock */
+	set_time_idle (data);
+	
 	return main_vbox;
 }
 
@@ -285,8 +322,10 @@
 #if 0
 	/* Force theme settings */
 	g_object_set (gtk_settings_get_default (),
-		"gtk-theme-name", "openmoko-standard-2", 
+		"gtk-theme-name", "openmoko-standard-2", /* Moko */
 		"gtk-icon-theme-name", "openmoko-standard",
+		"gtk-xft-dpi", 285 * 1024,
+		"gtk-font-name", "Sans 6",
 		NULL);
 #endif
 
@@ -299,6 +338,8 @@
 		gtk_window_set_default_size (GTK_WINDOW (data.window), w, h);
 		gtk_window_move (GTK_WINDOW (data.window), x, y);
 	}
+#else
+	gtk_window_set_default_size (GTK_WINDOW (data.window), 480, 600);
 #endif
 	
 	/* Show and start */

Modified: trunk/src/target/OM-2007.2/applications/openmoko-today2/src/today.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-today2/src/today.h	2007-10-23 10:21:01 UTC (rev 3254)
+++ trunk/src/target/OM-2007.2/applications/openmoko-today2/src/today.h	2007-10-23 10:29:57 UTC (rev 3255)
@@ -14,6 +14,7 @@
 	GtkWidget *window;
 	GtkWidget *notebook;
 	GtkWidget *home_toolbar;
+	GtkWidget *clock;
 	GtkWidget *message_box;
 	GtkWidget *summary_box;
 	GtkToolItem *dial_button;
@@ -22,6 +23,7 @@
 	GtkToolItem *dates_button;
 	GtkWidget *bg_ebox;
 	GdkPixmap *wallpaper;
+	gchar *location;
 	
 	GtkTreeModel *events_model;
 	GtkTreeModel *tasks_model;





More information about the commitlog mailing list