[maemo-commits] [maemo-commits] r8897 - in projects/haf/branches/maemo-af-desktop/example-plugins: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Dec 29 17:15:12 EET 2006
Author: lucasr
Date: 2006-12-29 17:15:10 +0200 (Fri, 29 Dec 2006)
New Revision: 8897

Added:
   projects/haf/branches/maemo-af-desktop/example-plugins/src/python-panel.desktop.in
   projects/haf/branches/maemo-af-desktop/example-plugins/src/pythonpanel.py
Modified:
   projects/haf/branches/maemo-af-desktop/example-plugins/ChangeLog
   projects/haf/branches/maemo-af-desktop/example-plugins/autogen.sh
   projects/haf/branches/maemo-af-desktop/example-plugins/config.h.in
   projects/haf/branches/maemo-af-desktop/example-plugins/configure.ac
   projects/haf/branches/maemo-af-desktop/example-plugins/src/Makefile.am
Log:
2006-12-29  Lucas Rocha  <lucas.rocha at nokia.com>

	* src/pythonpanel.py, src/python-panel.desktop.in, src/Makefile.am:
	added python plugin example.
	* configure.ac: added --enable-python and python dependency checks.


Modified: projects/haf/branches/maemo-af-desktop/example-plugins/ChangeLog
===================================================================
--- projects/haf/branches/maemo-af-desktop/example-plugins/ChangeLog	2006-12-29 14:50:01 UTC (rev 8896)
+++ projects/haf/branches/maemo-af-desktop/example-plugins/ChangeLog	2006-12-29 15:15:10 UTC (rev 8897)
@@ -1,3 +1,9 @@
 2006-12-29  Lucas Rocha  <lucas.rocha at nokia.com>
 
+	* src/pythonpanel.py, src/python-panel.desktop.in, src/Makefile.am:
+	added python plugin example.
+	* configure.ac: added --enable-python and python dependency checks.
+
+2006-12-29  Lucas Rocha  <lucas.rocha at nokia.com>
+
 	* Initial import.

Modified: projects/haf/branches/maemo-af-desktop/example-plugins/autogen.sh
===================================================================
--- projects/haf/branches/maemo-af-desktop/example-plugins/autogen.sh	2006-12-29 14:50:01 UTC (rev 8896)
+++ projects/haf/branches/maemo-af-desktop/example-plugins/autogen.sh	2006-12-29 15:15:10 UTC (rev 8897)
@@ -2,9 +2,7 @@
 # Script for running GNU toolchain for configuration
 
 set -x
-glib-gettextize --copy --force
 libtoolize --automake --copy
-intltoolize --copy --force --automake
 aclocal-1.7
 autoconf
 autoheader

Modified: projects/haf/branches/maemo-af-desktop/example-plugins/config.h.in
===================================================================
--- projects/haf/branches/maemo-af-desktop/example-plugins/config.h.in	2006-12-29 14:50:01 UTC (rev 8896)
+++ projects/haf/branches/maemo-af-desktop/example-plugins/config.h.in	2006-12-29 15:15:10 UTC (rev 8897)
@@ -1,32 +1,14 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
-/* always defined to indicate that i18n is enabled */
-#undef ENABLE_NLS
+/* Define to compile with python support */
+#undef ENABLE_PYTHON
 
-/* Define to 1 if you have the `bind_textdomain_codeset' function. */
-#undef HAVE_BIND_TEXTDOMAIN_CODESET
-
-/* Define to 1 if you have the `dcgettext' function. */
-#undef HAVE_DCGETTEXT
-
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
-/* Define if the GNU gettext() function is already present or preinstalled. */
-#undef HAVE_GETTEXT
-
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
-/* Define if your <locale.h> file defines LC_MESSAGES. */
-#undef HAVE_LC_MESSAGES
-
-/* Define to 1 if you have the <libintl.h> header file. */
-#undef HAVE_LIBINTL_H
-
-/* Define to 1 if you have the <locale.h> header file. */
-#undef HAVE_LOCALE_H
-
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 

Modified: projects/haf/branches/maemo-af-desktop/example-plugins/configure.ac
===================================================================
--- projects/haf/branches/maemo-af-desktop/example-plugins/configure.ac	2006-12-29 14:50:01 UTC (rev 8896)
+++ projects/haf/branches/maemo-af-desktop/example-plugins/configure.ac	2006-12-29 15:15:10 UTC (rev 8897)
@@ -1,4 +1,4 @@
-AC_INIT(dummy-plugin, 0.0.1)
+AC_INIT(example-plugins, 0.0.1)
 
 AM_INIT_AUTOMAKE
 
@@ -16,14 +16,20 @@
 AC_C_CONST
 AC_HEADER_STDC
 
-AC_CHECK_HEADERS([libintl.h])
-
 AC_HEADER_STDBOOL
 
+#++++++++++++++++++
+# Misc build flags
+#++++++++++++++++++
+
 CFLAGS="$CFLAGS -Wall -ansi -Wmissing-prototypes -Wmissing-declarations -Werror -std=c99 -rdynamic"
 
 AC_SUBST(CFLAGS)
 
+#+++++++++++++++++++++
+# Dependencies checks
+#+++++++++++++++++++++
+
 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6.0)
 AC_SUBST(GTK_LIBS)
 AC_SUBST(GTK_CFLAGS)
@@ -36,22 +42,78 @@
 AC_SUBST(LIBHILDONDESKTOP_LIBS)
 AC_SUBST(LIBHILDONDESKTOP_CFLAGS)
 
-GETTEXT_PACKAGE=$PACKAGE
-AC_SUBST(GETTEXT_PACKAGE)
-AM_GLIB_GNU_GETTEXT
+#+++++++++++++++++++
+# Directories setup
+#+++++++++++++++++++
 
 hildonnavigatorentrydir=${datadir}/applications/hildon-navigator
+AC_SUBST(hildonnavigatorentrydir)
+
 hildonhomeentrydir=${datadir}/applications/hildon-home
+AC_SUBST(hildonhomeentrydir)
+
+pythonpaneldir=${libdir}/hildon-desktop
+AC_SUBST(pythonpaneldir)
+
 dummypaneldir=${libdir}/hildon-desktop
+AC_SUBST(dummypaneldir)
+
 dummyhomedir=${libdir}/hildon-desktop
-AC_SUBST(hildonnavigatorentrydir)
-AC_SUBST(hildonhomeentrydir)
-AC_SUBST(dummypaneldir)
 AC_SUBST(dummyhomedir)
 
+#++++++++
+# Python 
+#++++++++
+
+AC_MSG_CHECKING([whether Python support is requested])
+AC_ARG_ENABLE(python,
+	      AS_HELP_STRING([--enable-python],[Enable python support]),
+	      [enable_python=$enableval have_python=$enableval], 
+              [enable_python=no have_python=no])
+AC_MSG_RESULT([$enable_python])
+
+if test "x$have_python" != "xno"; then
+    AM_PATH_PYTHON([2.3],[],[no])
+    if test "x$PYTHON" = "x:"; then
+        have_python=no
+    fi
+fi
+
+if test "x$have_python" != "xno"; then
+        PYTHON_LIBS="-lpython$PYTHON_VERSION"
+        PYTHON_LIB_LOC="-L$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/config"
+        PYTHON_CFLAGS="-I$PYTHON_PREFIX/include/python$PYTHON_VERSION"
+        AC_SUBST(PYTHON_LIBS)
+        AC_SUBST(PYTHON_LIB_LOC)
+        AC_SUBST(PYTHON_CFLAGS)
+
+        PKG_CHECK_MODULES(PYGOBJECT, pygobject-2.0 >= 2.6)
+        AC_SUBST(PYGOBJECT_LIBS)
+        AC_SUBST(PYGOBJECT_CFLAGS)
+
+        PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= 2.6)
+        AC_SUBST(PYGTK_CFLAGS)
+        AC_SUBST(PYGTK_LIBS)
+fi
+
+if test "x$have_python" != "xyes"; then
+    if test "x$enable_python" = "xyes"; then
+        AC_MSG_ERROR([Python not found])
+    elif test "x$enable_python" = "xautodetect"; then
+        enable_python=no
+        AC_MSG_WARN([Python not found, disabling python support])
+    fi
+elif test "x$enable_python" != "xno"; then
+    enable_python=yes
+    AC_DEFINE([ENABLE_PYTHON],[1],[Define to compile with python support])
+fi
+
+AM_CONDITIONAL([ENABLE_PYTHON],[test "x$enable_python" = "xyes"])
+
 AC_CONFIG_FILES([
 Makefile
 src/Makefile
+src/python-panel.desktop
 src/dummy-panel.desktop
 src/dummy-home.desktop
 ])

Modified: projects/haf/branches/maemo-af-desktop/example-plugins/src/Makefile.am
===================================================================
--- projects/haf/branches/maemo-af-desktop/example-plugins/src/Makefile.am	2006-12-29 14:50:01 UTC (rev 8896)
+++ projects/haf/branches/maemo-af-desktop/example-plugins/src/Makefile.am	2006-12-29 15:15:10 UTC (rev 8897)
@@ -4,10 +4,18 @@
 
 LDFLAGS = -module -avoid-version
 
+if ENABLE_PYTHON
+pythonpanel_PYTHON = pythonpanel.py 
+endif
+
 dummypanel_LTLIBRARIES = libdummypanel.la
 dummyhome_LTLIBRARIES = libdummyhome.la
 
 hildonnavigatorentry_DATA = dummy-panel.desktop
+if ENABLE_PYTHON
+hildonnavigatorentry_DATA += python-panel.desktop
+endif
+
 hildonhomeentry_DATA = dummy-home.desktop
 
 libdummypanel_la_LIBADD = $(GTK_LIBS) $(GLIB_LIBS) $(LIBHILDONDESKTOP_LIBS)

Added: projects/haf/branches/maemo-af-desktop/example-plugins/src/python-panel.desktop.in
===================================================================
--- projects/haf/branches/maemo-af-desktop/example-plugins/src/python-panel.desktop.in	2006-12-29 14:50:01 UTC (rev 8896)
+++ projects/haf/branches/maemo-af-desktop/example-plugins/src/python-panel.desktop.in	2006-12-29 15:15:10 UTC (rev 8897)
@@ -0,0 +1,4 @@
+[Desktop Entry]
+Name=Python Panel Plugin
+Type=python
+X-Path=pythonpanel

Added: projects/haf/branches/maemo-af-desktop/example-plugins/src/pythonpanel.py
===================================================================
--- projects/haf/branches/maemo-af-desktop/example-plugins/src/pythonpanel.py	2006-12-29 14:50:01 UTC (rev 8896)
+++ projects/haf/branches/maemo-af-desktop/example-plugins/src/pythonpanel.py	2006-12-29 15:15:10 UTC (rev 8897)
@@ -0,0 +1,22 @@
+import gtk
+import pygtk
+import hildondesktop
+
+class DummyPanelPlugin(hildondesktop.TaskNavigatorItem):
+    def clicked(self, widget, data=None):
+        print "Clicked!!!"
+
+    def __init__(self):
+        hildondesktop.TaskNavigatorItem.__init__(self)
+
+        button = gtk.Button("Click me!", gtk.STOCK_CDROM)
+        button.connect("clicked", self.clicked, None)
+	button.set_size_request(80, 80);
+        button.show()
+
+        self.add(button)
+
+def hd_plugin_get_objects():
+    plugin = DummyPanelPlugin()
+
+    return [plugin]


More information about the maemo-commits mailing list