Active Topics

 


Reply
Thread Tools
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#1
Code:
//gcc time.c $(pkg-config --cflags --libs hildon-1 libcityinfo0-0 libclockcore0-0) -ltime -lhildon-time-zone-chooser0 -I/usr/include/clockd -Wall

#include <stdlib.h>
#include <clock/clockcore.h> /* Includes cityinfo, libtime and **** for us */
#include <gtk/gtk.h>
#include <hildon/hildon.h>

/* Refs:
 * /usr/include/clockd/libtime.h 
 * All headers in /usr/include/clock/
 * /usr/include/cityinfo.h
 * maemo.org/api_refs/5.0/5.0-final/cityinfo/cityinfo-cityinfo.html
 * maemo.org/api_refs/5.0/5.0-final/libtime/libtime_8h.html
 * maemo.org/api_refs/5.0/5.0-final/clockd
 */

extern GtkWidget* hildon_time_zone_chooser_new (void); /* Knowing GObject, this is probably a "HildonTimeZoneChooser" type, derived from HildonStackableWindow -- actually, probably a GObject that has a HildonStackableWindow in its private struct */
extern gint hildon_time_zone_chooser_run (gpointer); /* Probably guint */
extern void hildon_time_zone_chooser_set_city (gpointer, Cityinfo*);
extern Cityinfo* hildon_time_zone_chooser_get_city (gpointer);
extern void hildon_time_zone_chooser_free (gpointer); /* Probably guint */

static GtkWidget *time_chooser;

gint main (gint argc, gchar *argv[])
{
	Citytime *home_loc;

	hildon_gtk_init (&argc, &argv);

	home_loc = clock_get_home_location ();

	time_chooser = hildon_time_zone_chooser_new ();
	hildon_time_zone_chooser_set_city (time_chooser, home_loc->city);

	switch (hildon_time_zone_chooser_run (time_chooser))
	{
		case 1: /* City chosen */
			break;

		case 2: /* Back button hit */
		default: /* Head for the choppers, everybody get out! I am not Triumph, I am Arnold; get down! */
			g_assert_not_reached ();
	}

	const Cityinfo *time_chooser_time = hildon_time_zone_chooser_get_city (time_chooser);
	g_printerr ("%s\n", cityinfo_get_zone (time_chooser_time));
	hildon_time_zone_chooser_free (time_chooser);	

	g_idle_add ((GSourceFunc) gtk_main_quit, NULL);

	gtk_main ();

	return EXIT_SUCCESS;
}

Last edited by qwerty12; 2010-06-15 at 15:10.
 

The Following 2 Users Say Thank You to qwerty12 For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 22:55.