r3313 - in trunk/src/target/OM-2007.2/applications/openmoko-worldclock2: . src
chris at sita.openmoko.org
chris at sita.openmoko.org
Wed Oct 31 17:40:22 CET 2007
Author: chris
Date: 2007-10-31 17:40:21 +0100 (Wed, 31 Oct 2007)
New Revision: 3313
Modified:
trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/ChangeLog
trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/configure.ac
trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/src/Makefile.am
trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/src/worldclock-main.c
Log:
* configure.ac:
* src/Makefile.am:
Remove libnotify dependency
* src/worldclock-main.c: (zoom_map), (settings_clicked_cb),
(map_button_press_event_cb), (main):
Add a digital clock option to the settings dialog, put the world map in
an aspect frame, add a callback when the map is clicked
Modified: trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/ChangeLog 2007-10-31 16:02:35 UTC (rev 3312)
+++ trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/ChangeLog 2007-10-31 16:40:21 UTC (rev 3313)
@@ -1,3 +1,14 @@
+2007-10-31 Chris Lord <chris at openedhand.com>
+
+ * configure.ac:
+ * src/Makefile.am:
+ Remove libnotify dependency
+
+ * src/worldclock-main.c: (zoom_map), (settings_clicked_cb),
+ (map_button_press_event_cb), (main):
+ Add a digital clock option to the settings dialog, put the world map in
+ an aspect frame, add a callback when the map is clicked
+
2007-10-29 Chris Lord <chris at openedhand.com>
* Makefile.am:
Modified: trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/configure.ac
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/configure.ac 2007-10-31 16:02:35 UTC (rev 3312)
+++ trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/configure.ac 2007-10-31 16:40:21 UTC (rev 3313)
@@ -13,7 +13,7 @@
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6.0)
PKG_CHECK_MODULES(MOKOUI, libmokoui2 >= 0.3)
PKG_CHECK_MODULES(JANA, libjana libjana-ecal libjana-gtk)
-PKG_CHECK_MODULES(NOTIFY, libnotify >= 0.4)
+#PKG_CHECK_MODULES(NOTIFY, libnotify >= 0.4)
AC_OUTPUT([
Makefile
Modified: trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/src/Makefile.am
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/src/Makefile.am 2007-10-31 16:02:35 UTC (rev 3312)
+++ trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/src/Makefile.am 2007-10-31 16:40:21 UTC (rev 3313)
@@ -1,6 +1,6 @@
-AM_CPPFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" $(GTK_CFLAGS) $(JANA_CFLAGS) $(MOKOUI_CFLAGS) $(NOTIFY_CFLAGS) -Wall
-AM_LDFLAGS = $(GTK_LIBS) $(JANA_LIBS) $(MOKOUI_LIBS) $(NOTIFY_LIBS)
+AM_CPPFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" $(GTK_CFLAGS) $(JANA_CFLAGS) $(MOKOUI_CFLAGS) -Wall
+AM_LDFLAGS = $(GTK_LIBS) $(JANA_LIBS) $(MOKOUI_LIBS)
bin_PROGRAMS=openmoko-worldclock
Modified: trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/src/worldclock-main.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/src/worldclock-main.c 2007-10-31 16:02:35 UTC (rev 3312)
+++ trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/src/worldclock-main.c 2007-10-31 16:40:21 UTC (rev 3313)
@@ -26,11 +26,15 @@
#include <sys/time.h>
#include "worldclock-data.h"
+#define GCONF_POKY_INTERFACE_PREFIX "/desktop/poky/interface"
+#define GCONF_POKY_DIGITAL "/digital_clock"
+
static gchar *location;
typedef struct {
GtkWidget *window;
GtkWidget *map;
+ GtkWidget *map_aspect;
GtkWidget *load_window;
GtkWidget *load_bar;
@@ -54,14 +58,14 @@
{
if (data->zoom_level <= 0.95) {
data->zoom_level = 1;
- gtk_widget_set_size_request (data->map, -1, -1);
+ gtk_widget_set_size_request (data->map_aspect, -1, -1);
} else {
gint width, height;
gtk_window_get_size (GTK_WINDOW (data->window),
&width, &height);
- gtk_widget_set_size_request (data->map,
- width * data->zoom_level,
- height * data->zoom_level);
+ width *= data->zoom_level;
+ gtk_widget_set_size_request (data->map_aspect,
+ width, (height > (width/2)) ? -1 : width / 2);
}
}
@@ -112,7 +116,7 @@
static void
settings_clicked_cb (GtkToolButton *button, WorldClockData *data)
{
- GtkWidget *time_dialog, *datetime;
+ GtkWidget *time_dialog, *datetime, *check;
gchar *location;
JanaTime *time;
@@ -139,9 +143,19 @@
increment_time_timeout, datetime);
#endif
- gtk_container_add (GTK_CONTAINER (
- GTK_DIALOG (time_dialog)->vbox), datetime);
+ check = gtk_check_button_new_with_label ("Use a digital clock");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check),
+ gconf_client_get_bool (gconf_client_get_default (),
+ GCONF_POKY_INTERFACE_PREFIX GCONF_POKY_DIGITAL, NULL));
+
+ gtk_container_set_border_width (GTK_CONTAINER (time_dialog), 6);
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (time_dialog)->vbox), 12);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (time_dialog)->vbox),
+ datetime, FALSE, TRUE, 0);
gtk_widget_show (datetime);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (time_dialog)->vbox),
+ check, FALSE, TRUE, 0);
+ gtk_widget_show (check);
gtk_dialog_run (GTK_DIALOG (time_dialog));
@@ -166,6 +180,10 @@
g_object_unref (time);
}
+ gconf_client_set_bool (gconf_client_get_default (),
+ GCONF_POKY_INTERFACE_PREFIX GCONF_POKY_DIGITAL,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)), NULL);
+
gtk_widget_destroy (time_dialog);
}
@@ -246,6 +264,18 @@
}
}
+static gboolean
+map_button_press_event_cb (JanaGtkWorldMap *map, GdkEventButton *event,
+ WorldClockData *data)
+{
+ gdouble lat, lon;
+
+ jana_gtk_world_map_get_latlon (map, event->x, event->y, &lat, &lon);
+ g_message ("Map clicked at latitude, longitude: %lg, %lg", lat, lon);
+
+ return FALSE;
+}
+
int
main (int argc, char **argv)
{
@@ -291,9 +321,18 @@
/* Create scrolling map */
data.map = jana_gtk_world_map_new ();
add_marks (&data);
+ gtk_widget_add_events (GTK_WIDGET (data.map), GDK_BUTTON_PRESS_MASK);
+ g_signal_connect (data.map, "button-press-event",
+ G_CALLBACK (map_button_press_event_cb), NULL);
+
+ data.map_aspect = gtk_aspect_frame_new (NULL, 0.5, 0.5, 2.0, FALSE);
+ gtk_frame_set_shadow_type (GTK_FRAME (
+ data.map_aspect), GTK_SHADOW_NONE);
+ gtk_container_add (GTK_CONTAINER (data.map_aspect), data.map);
+
scroll = moko_finger_scroll_new ();
moko_finger_scroll_add_with_viewport (MOKO_FINGER_SCROLL (scroll),
- data.map);
+ data.map_aspect);
g_object_set (G_OBJECT (scroll), "mode", MOKO_FINGER_SCROLL_MODE_PUSH,
NULL);
gtk_widget_show_all (scroll);
More information about the commitlog
mailing list