-/*******************************************************************************
- * Copyright (c) 2007-2008 INdT, (c) 2009 Nokia.
+/*
+ * main.c
*
- * This code example is licensed under a MIT-style license,
- * that can be found in the file called "COPYING" in the package
+ * This file is part of maevies
+ * Copyright (C) 2010 Simón Pena <spenap@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
*
*/
-/*
- ============================================================================
- Name : main.c
- Author : Simón Pena
- Version : 0.1
- Description : Hildon GUI Application in C
- ============================================================================
- */
-/* Includes */
-#include <hildon/hildon-program.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkbutton.h>
-#include <libosso.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "localisation.h"
-/* Defines to add the application to dbus and keep it running
- * Please do not modify "APP_NAME" (or other defines) to different name
- */
-#define APP_NAME "maevies"
-#define APP_VER "0.1"
-#define APP_SERVICE "com.nokia.maevies"
-#define APP_METHOD "/com/nokia/maevies"
-/* end defines */
-
-static void button_clicked (GtkButton* button, gpointer data)
-{
- gtk_main_quit();
-}
-
-static gint
-dbus_callback (const gchar *interface, const gchar *method,
- GArray *arguments, gpointer data,
- osso_rpc_t *retval)
-{
- printf ("dbus: %s, %s\n", interface, method);
-
- if (!strcmp (method, "top_application"))
- gtk_window_present (GTK_WINDOW (data));
+#include <stdio.h>
+#include <glib.h>
- return DBUS_TYPE_INVALID;
-}
-
-int main( int argc, char* argv[] )
+int
+main (int argc, char **argv)
{
- /* Create needed variables */
- HildonProgram *program;
- HildonWindow *window;
- GtkWidget *button;
- osso_context_t *osso_cont;
- osso_return_t ret;
-
- locale_init();
-
- osso_cont = osso_initialize(APP_NAME, APP_VER, TRUE, NULL);
- if (osso_cont == NULL)
- {
- fprintf (stderr, "osso_initialize failed.\n");
- exit (1);
- }
-
- /* Initialize the GTK. */
- gtk_init( &argc, &argv );
-
- /* Create the hildon program and setup the title */
- program = HILDON_PROGRAM(hildon_program_get_instance());
- g_set_application_name("Maevies");
-
- /* Create HildonWindow and set it to HildonProgram */
- window = HILDON_WINDOW(hildon_window_new());
- hildon_program_add_window(program, window);
-
- /* Quit program when window is closed. */
- g_signal_connect (G_OBJECT (window), "delete_event",
- G_CALLBACK (gtk_main_quit), NULL);
-
- /* Quit program when window is otherwise destroyed. */
- g_signal_connect (G_OBJECT (window), "destroy",
- G_CALLBACK (gtk_main_quit), NULL);
-
- /* Create button and add it to main view */
- button = gtk_button_new_with_label(_("Hello World!!!"));
- gtk_container_add(GTK_CONTAINER(window),
- button);
-
- g_signal_connect (G_OBJECT (button), "clicked",
- G_CALLBACK (button_clicked), NULL);
-
- ret = osso_rpc_set_cb_f (osso_cont,
- APP_SERVICE,
- APP_METHOD,
- APP_SERVICE,
- dbus_callback, GTK_WIDGET( window ));
- if (ret != OSSO_OK) {
- fprintf (stderr, "osso_rpc_set_cb_f failed: %d.\n", ret);
- exit (1);
- }
-
- /* Begin the main application */
- gtk_widget_show_all ( GTK_WIDGET ( window ) );
- gtk_main();
+ g_print ("Hello maevies!\n");
- /* Exit */
- return 0;
+ return 0;
}