[Esbox-commits] r25 - in trunk/org.indt.esbox.ui/templates: EmptyProject HildonGUIApplication HildonGUIApplication/data HildonGUIApplication/debian HildonGUIApplication/src

raul at garage.maemo.org raul at garage.maemo.org
Mon Oct 1 15:22:40 EEST 2007


Author: raul
Date: 2007-10-01 15:22:40 +0300 (Mon, 01 Oct 2007)
New Revision: 25

Added:
   trunk/org.indt.esbox.ui/templates/EmptyProject/template.xml
   trunk/org.indt.esbox.ui/templates/HildonGUIApplication/data/
   trunk/org.indt.esbox.ui/templates/HildonGUIApplication/data/Makefile.am
   trunk/org.indt.esbox.ui/templates/HildonGUIApplication/data/PACKAGE.desktop.in
   trunk/org.indt.esbox.ui/templates/HildonGUIApplication/data/com.nokia.PACKAGE.service.in
   trunk/org.indt.esbox.ui/templates/HildonGUIApplication/debian/
   trunk/org.indt.esbox.ui/templates/HildonGUIApplication/debian/control
   trunk/org.indt.esbox.ui/templates/HildonGUIApplication/debian/postinst
   trunk/org.indt.esbox.ui/templates/HildonGUIApplication/src/
   trunk/org.indt.esbox.ui/templates/HildonGUIApplication/src/localisation.h
   trunk/org.indt.esbox.ui/templates/HildonGUIApplication/src/main.c
Log:
templates created.

Added: trunk/org.indt.esbox.ui/templates/EmptyProject/template.xml
===================================================================
--- trunk/org.indt.esbox.ui/templates/EmptyProject/template.xml	2007-10-01 12:20:14 UTC (rev 24)
+++ trunk/org.indt.esbox.ui/templates/EmptyProject/template.xml	2007-10-01 12:22:40 UTC (rev 25)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
+		copyright="Copyright (c) 2007 Intel Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+		id="EmptyProject" label="Empty Project" description="An empty project template"
+		 help="help.html">
+		 
+	<process type="org.indt.esbox.core.IncludePaths">
+		<simple name="projectName" value="$(projectName)"/>
+		<simple-array name="paths">
+			<element value="$(sboxRoot)/targets/$(targetName)/usr/local/include"/>
+			<element value="$(sboxRoot)/targets/$(targetName)/usr/include"/>
+			<element value="$(sboxRoot)/targets/$(targetName)/usr/lib/gcc/i486-linux-gnu/4.1.2"/>			
+		</simple-array>		
+	</process>
+	
+
+</template>
+

Added: trunk/org.indt.esbox.ui/templates/HildonGUIApplication/data/Makefile.am
===================================================================
--- trunk/org.indt.esbox.ui/templates/HildonGUIApplication/data/Makefile.am	2007-10-01 12:20:14 UTC (rev 24)
+++ trunk/org.indt.esbox.ui/templates/HildonGUIApplication/data/Makefile.am	2007-10-01 12:22:40 UTC (rev 25)
@@ -0,0 +1,23 @@
+# This software is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+#
+ 
+dbusdir=$(datadir)/dbus-1/services
+dbus_DATA=com.nokia.$(packageName).service
+
+desktopdir=$(datadir)/applications/hildon
+desktop_DATA = $(packageName).desktop
+
+EXTRA_DIST = $(dbus_DATA) $(desktop_DATA)

Added: trunk/org.indt.esbox.ui/templates/HildonGUIApplication/data/PACKAGE.desktop.in
===================================================================
--- trunk/org.indt.esbox.ui/templates/HildonGUIApplication/data/PACKAGE.desktop.in	2007-10-01 12:20:14 UTC (rev 24)
+++ trunk/org.indt.esbox.ui/templates/HildonGUIApplication/data/PACKAGE.desktop.in	2007-10-01 12:22:40 UTC (rev 25)
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Name=%PACKAGE
+Exec=@prefix@/bin/$(packageName)
+Icon=qgn_list_documents
+X-Window-Icon=maemopad-window
+X-Window-Icon-Dimmed=maemopad-window-dimmed
+X-Osso-Service=$(packageName)
+X-Osso-Type=application/x-executable
+X-HildonDesk-ShowInToolbar=true
\ No newline at end of file

Added: trunk/org.indt.esbox.ui/templates/HildonGUIApplication/data/com.nokia.PACKAGE.service.in
===================================================================
--- trunk/org.indt.esbox.ui/templates/HildonGUIApplication/data/com.nokia.PACKAGE.service.in	2007-10-01 12:20:14 UTC (rev 24)
+++ trunk/org.indt.esbox.ui/templates/HildonGUIApplication/data/com.nokia.PACKAGE.service.in	2007-10-01 12:22:40 UTC (rev 25)
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=com.nokia.$(packageName)
+Exec=@prefix@/bin/$(packageName)

Added: trunk/org.indt.esbox.ui/templates/HildonGUIApplication/debian/control
===================================================================
--- trunk/org.indt.esbox.ui/templates/HildonGUIApplication/debian/control	2007-10-01 12:20:14 UTC (rev 24)
+++ trunk/org.indt.esbox.ui/templates/HildonGUIApplication/debian/control	2007-10-01 12:22:40 UTC (rev 25)
@@ -0,0 +1,12 @@
+Source: $(packageName)
+Section: user/other
+Priority: optional
+Maintainer: $(author) <$(authorEmail)>
+Build-Depends: debhelper (>= 4.0.0), intltool, hildon-base-lib-dev, hildon-libs-dev, hildon-fm-dev, 
+               libgtk2.0-dev, libosso-gnomevfs2-dev, libglib2.0-dev, libdbus-glib-1-dev, libosso-dev
+Standards-Version: 3.6.0
+
+Package: $(packageName)
+Architecture: any
+#Depends: maemo
+Description: Helloworld with automake & .deb generation

Added: trunk/org.indt.esbox.ui/templates/HildonGUIApplication/debian/postinst
===================================================================
--- trunk/org.indt.esbox.ui/templates/HildonGUIApplication/debian/postinst	2007-10-01 12:20:14 UTC (rev 24)
+++ trunk/org.indt.esbox.ui/templates/HildonGUIApplication/debian/postinst	2007-10-01 12:22:40 UTC (rev 25)
@@ -0,0 +1,9 @@
+#!/bin/sh
+#update the icon cache
+gtk-update-icon-cache -f /usr/share/icons/hicolor
+
+# copy the desktop file for use
+( cd /usr/share/applications/hildon/ && mv $(packageName).inactive $(packageName).desktop )
+
+# select the installation folder
+maemo-select-menu-location $(packageName).desktop
\ No newline at end of file

Added: trunk/org.indt.esbox.ui/templates/HildonGUIApplication/src/localisation.h
===================================================================
--- trunk/org.indt.esbox.ui/templates/HildonGUIApplication/src/localisation.h	2007-10-01 12:20:14 UTC (rev 24)
+++ trunk/org.indt.esbox.ui/templates/HildonGUIApplication/src/localisation.h	2007-10-01 12:22:40 UTC (rev 25)
@@ -0,0 +1,72 @@
+/*
+ ============================================================================
+ Name        : localisation.h
+ Author      : $(author)
+ Version     :
+ Copyright   : $(copyright)
+ Description : Header with localization facilities
+ ============================================================================
+ */
+#ifndef LOCALISATION_H
+#define LOCALISATION_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif                          /* HAVE_CONFIG_H */
+
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#define _(String) gettext(String)
+#ifdef gettext_noop
+#define N_(String) gettext_noop(String)
+#else
+#define N_(String) (String)
+#endif
+#define locale_init() setlocale(LC_ALL, "");\
+    bindtextdomain(GETTEXT_PACKAGE, localedir);\
+    textdomain(GETTEXT_PACKAGE);
+#else                           /* NLS is disabled */
+#define locale_init() 
+#define _(String) (String)
+#define N_(String) (String)
+#define textdomain(String) (String)
+#define gettext(String) (String)
+#define dgettext(Domain,String) (String)
+#define dcgettext(Domain,String,Type) (String)
+#define bindtextdomain(Domain,Directory) (Domain)
+#define bind_textdomain_codeset(Domain,Codeset) (Codeset)
+#endif                          /* ENABLE_NLS */
+
+#endif /* LOCALISATION_H */
+#ifndef LOCALISATION_H
+#define LOCALISATION_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif                          /* HAVE_CONFIG_H */
+
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#define _(String) gettext(String)
+#ifdef gettext_noop
+#define N_(String) gettext_noop(String)
+#else
+#define N_(String) (String)
+#endif
+#define locale_init() setlocale(LC_ALL, "");\
+    bindtextdomain(GETTEXT_PACKAGE, localedir);\
+    textdomain(GETTEXT_PACKAGE);
+#else                           /* NLS is disabled */
+#define locale_init() 
+#define _(String) (String)
+#define N_(String) (String)
+#define textdomain(String) (String)
+#define gettext(String) (String)
+#define dgettext(Domain,String) (String)
+#define dcgettext(Domain,String,Type) (String)
+#define bindtextdomain(Domain,Directory) (Domain)
+#define bind_textdomain_codeset(Domain,Codeset) (Codeset)
+#endif                          /* ENABLE_NLS */
+
+#endif /* LOCALISATION_H */
+

Added: trunk/org.indt.esbox.ui/templates/HildonGUIApplication/src/main.c
===================================================================
--- trunk/org.indt.esbox.ui/templates/HildonGUIApplication/src/main.c	2007-10-01 12:20:14 UTC (rev 24)
+++ trunk/org.indt.esbox.ui/templates/HildonGUIApplication/src/main.c	2007-10-01 12:22:40 UTC (rev 25)
@@ -0,0 +1,98 @@
+/*
+ ============================================================================
+ Name        : main.c
+ Author      : $(author)
+ Version     :
+ Copyright   : $(copyright)
+ Description : Hildon GUI Application in C
+ ============================================================================
+ */
+/* Includes */
+#include <hildon-widgets/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 "$(packageName)"
+#define APP_VER "$(version)"
+#define APP_SERVICE "com.nokia.$(packageName)"
+#define APP_METHOD "/com/nokia/$(packageName)"
+/* 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));
+
+  return DBUS_TYPE_INVALID;
+}
+
+int main( int argc, char* argv[] )
+{
+    /* Create needed variables */
+    HildonProgram *program; 
+    HildonWindow *window;
+    GtkWidget *button;
+    osso_context_t *osso_cont;
+	osso_return_t ret;
+    
+    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("$(applicationName)");
+
+    /* Create HildonWindow and set it to HildonProgram */
+    window = HILDON_WINDOW(hildon_window_new());
+    hildon_program_add_window(program, window);
+    
+
+    /* Create button and add it to main view */
+    button = gtk_button_new_with_label(_("$(message)"));
+    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();
+    
+    /* Exit */
+    return 0;
+}



More information about the Esbox-commits mailing list