Hildonizing..
[speedometer] / main.c
diff --git a/main.c b/main.c
index a082549..e2bfcc6 100644 (file)
--- a/main.c
+++ b/main.c
 
        You should have received a copy of the GNU General Public License
        along with this program.  If not, see <http://www.gnu.org/licenses/>.
-****/
+ ****/
 
+#include <hildon/hildon-program.h>
+#include <hildon/hildon-window.h>
 #include <stdlib.h>
 #include <gtk/gtk.h>
 #include <location/location-gps-device.h>
 
 int main(int argc, char** argv) {
 
-  /* We'll have two references to two GTK+ widgets. */
-  GtkWindow* window;
-  GtkLabel* label;
 
-  /* Initialize the GTK+ library. */
-  gtk_init(&argc, &argv);
+       HildonProgram *program;
+       HildonWindow *window;
 
+       gtk_init(&argc, &argv);
 
 
+       program = HILDON_PROGRAM(hildon_program_get_instance());
+       g_set_application_name("Speedometer");
 
+       /* Create HildonWindow and set it to HildonProgram */
+       window = HILDON_WINDOW(hildon_window_new());
+       hildon_program_add_window(program, window);
 
-  /* Create a window with window border width of 12 pixels and a
-     title text. */
-  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 
-  /* Show all widgets that are contained by the window. */
-  gtk_widget_show_all(GTK_WIDGET(window));
 
+       /* Show all widgets that are contained by the window. */
+       gtk_widget_show_all(GTK_WIDGET(window));
 
 
-  g_thread_init(NULL);
 
-  // gps device
-  LocationGPSDevice *device;
-  device = g_object_new (LOCATION_TYPE_GPS_DEVICE, NULL);
+       g_thread_init(NULL);
 
-  g_signal_connect (device, "changed", G_CALLBACK (location_changed), NULL);
+       // gps device
+       LocationGPSDevice *device;
+       device = g_object_new (LOCATION_TYPE_GPS_DEVICE, NULL);
 
 
-  LocationGPSDControl *control;
+       // connect some signal handlers
+       g_signal_connect (device, "changed", G_CALLBACK (location_changed), NULL);
 
-  control = location_gpsd_control_get_default();
-  location_gpsd_control_start(control);
+       /* Connect signal to X in the upper corner */
+       g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(gtk_main_quit), NULL);
 
+    g_signal_connect(G_OBJECT(window),  "key_press_event", G_CALLBACK(key_press_cb), window);
 
+       LocationGPSDControl *control;
 
-  /* Start the main event loop. */
-  gtk_main();
+       control = location_gpsd_control_get_default();
+       location_gpsd_control_start(control);
 
 
 
-  return EXIT_SUCCESS;
+       /* Start the main event loop. */
+       gtk_main();
+
+
+
+       return EXIT_SUCCESS;
 }