[Xfce4-commits] <pyxfce:master> add 'menu' module.

Danny Milosavljevic noreply at xfce.org
Sun Jan 2 21:16:01 CET 2011


Updating branch refs/heads/master
         to 8e609a1ac637654e4ec4377f8efb824a5fe0c095 (commit)
       from b8dcfd800d67de1871b8e568df9081e983c8eac4 (commit)

commit 8e609a1ac637654e4ec4377f8efb824a5fe0c095
Author: Danny Milosavljevic <dannym at xfce.org>
Date:   Sun Jan 2 21:13:53 2011 +0100

    add 'menu' module.

 Makefile.am                                        |    4 +-
 configure.ac                                       |    2 +
 menu/Makefile.am                                   |  101 ++++++++++++++
 menu/gen                                           |   36 ++----
 .../binding.override => menu/libxfce4menu.override |    4 +-
 .../libxfce4menu_config.override                   |    4 +-
 xfconf/binding.override => menu/menu.override      |    4 +-
 ui/ui.py => menu/menu.py                           |    2 +-
 .../menu_and_rules.override                        |    4 +-
 .../menu_directory.override                        |    4 +-
 .../binding.override => menu/menu_element.override |    4 +-
 .../menu_environment.override                      |    4 +-
 xfconf/binding.override => menu/menu_item.override |    4 +-
 .../menu_item_cache.override                       |    4 +-
 .../menu_item_pool.override                        |    4 +-
 .../errors.override => menu/menu_layout.override   |    6 +-
 .../binding.override => menu/menu_monitor.override |    4 +-
 xfconf/binding.override => menu/menu_move.override |    4 +-
 .../menu_not_rules.override                        |    4 +-
 .../menu_or_rules.override                         |    4 +-
 .../binding.override => menu/menu_rules.override   |    4 +-
 .../menu_separator.override                        |    4 +-
 .../menu_standard_rules.override                   |    4 +-
 menu/menumodule.c                                  |  141 ++++++++++++++++++++
 panel/panelmodule.c                                |    2 +-
 25 files changed, 298 insertions(+), 64 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 7b3fd10..29d7729 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,8 +13,8 @@ if HAVE_MIGHTY_MOUSE
 SUBDIR_MIGHTY_MOUSE = panel
 endif
 
-SUBDIRS = ui util xfconf $(SUBDIR_MIGHTY_MOUSE)
-DIST_SUBDIRS = ui util xfconf $(SUBDIR_MIGHTY_MOUSE)
+SUBDIRS = ui util xfconf $(SUBDIR_MIGHTY_MOUSE) menu
+DIST_SUBDIRS = ui util xfconf $(SUBDIR_MIGHTY_MOUSE) menu
 
 PLATFORM_VERSION = 4.2
 PLATFORM_WIN32 =
diff --git a/configure.ac b/configure.ac
index 2f93b3c..f8e3a10 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,6 +46,7 @@ export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec)
 BM_DEPEND([XFCE4_UTIL], [libxfce4util-1.0], [4.1.0])
 BM_DEPEND([XFCE4_XFCONF], [libxfconf-0], [4.6.2])
 BM_DEPEND([XFCE4_UI], [libxfce4ui-1], [4.7.5])
+BM_DEPEND([XFCE4_MENU], [libxfce4menu-0.1], [4.6.2])
 
 dnl new panel
 
@@ -89,5 +90,6 @@ AC_CONFIG_FILES(
   panel/Makefile
   util/Makefile
   xfconf/Makefile
+  menu/Makefile
 )
 AC_OUTPUT
diff --git a/menu/Makefile.am b/menu/Makefile.am
new file mode 100644
index 0000000..0701ebb
--- /dev/null
+++ b/menu/Makefile.am
@@ -0,0 +1,101 @@
+ at SET_MAKE@
+
+PLATFORM_VERSION = 4.2
+
+CODEGEN_PATH = @CODEGEN_PATH@
+
+common_ldflags = -module -avoid-version -export-symbols-regex init_menu
+if PLATFORM_WIN32
+common_ldflags += -no-undefined
+endif
+
+INCLUDES = $(PYTHON_INCLUDES)
+
+pyxfceexecdir = $(pyexecdir)/xfce4
+pyxfceexec_LTLIBRARIES = _menu.la
+pyxfceexec_PYTHON = menu.py
+
+_menu_la_CFLAGS = $(XFCE4_MENU_CFLAGS) $(PYTHON_CFLAGS) $(PYGTK_CFLAGS)
+_menu_la_LDFLAGS = $(common_ldflags)
+_menu_la_LIBADD = $(XFCE4_MENU_LIBS)
+#-export-symbols-regex
+_menu_la_SOURCES = \
+	libxfce4menu_config.c \
+	libxfce4menu.c \
+	menu_and_rules.c \
+	menu_directory.c \
+	menu_element.c \
+	menu_environment.c \
+	menu_item_cache.c \
+	menu_item.c \
+	menu_item_pool.c \
+	menu_layout.c \
+	menu_monitor.c \
+	menu_move.c \
+	menu_not_rules.c \
+	menu_or_rules.c \
+	menu.c \
+	menu_rules.c \
+	menu_separator.c \
+	menu_standard_rules.c \
+	menumodule.c
+
+defsdir = $(pkgdatadir)/$(PLATFORM_VERSION)/defs
+defs_DATA = \
+	libxfce4menu_config.defs \
+	libxfce4menu.defs \
+	menu_and_rules.defs \
+	menu_directory.defs \
+	menu_element.defs \
+	menu_environment.defs \
+	menu_item_cache.defs \
+	menu_item.defs \
+	menu_item_pool.defs \
+	menu_layout.defs \
+	menu_monitor.defs \
+	menu_move.defs \
+	menu_not_rules.defs \
+	menu_or_rules.defs \
+	menu.defs \
+	menu_rules.defs \
+	menu_separator.defs \
+	menu_standard_rules.defs
+
+menu_overrides = \
+	libxfce4menu_config.override \
+	libxfce4menu.override \
+	menu_and_rules.override \
+	menu_directory.override \
+	menu_element.override \
+	menu_environment.override \
+	menu_item_cache.override \
+	menu_item.override \
+	menu_item_pool.override \
+	menu_layout.override \
+	menu_monitor.override \
+	menu_move.override \
+	menu_not_rules.override \
+	menu_or_rules.override \
+	menu.override \
+	menu_rules.override \
+	menu_separator.override \
+	menu_standard_rules.override
+
+EXTRA_DIST = $(defs_DATA) $(menu_overrides) gen
+
+nodist__menu_la_SOURCES = 
+
+PYGTK_DEFS="`pkg-config --variable=defsdir pygtk-2.0`"
+
+.defs.c:
+	(cd $(srcdir) \
+	 && $(PYTHON) $(CODEGEN_PATH)/codegen.py \
+	   $(PYGTK_CODEGEN_DEFINES) \
+	     --override $*.override \
+	     --register $(PYGTK_DEFS)/gtk-types.defs \
+	     --register $(PYGTK_DEFS)/gdk-types.defs \
+	     --register ../util/desktopentry.defs \
+	     --prefix py$* $*.defs) > gen-$*.c \
+	 && cp gen-$*.c $*.c \
+	 && rm -f gen-$*.c
+
diff --git a/menu/gen b/menu/gen
index f01b987..a4e22f5 100755
--- a/menu/gen
+++ b/menu/gen
@@ -1,13 +1,8 @@
 #!/bin/sh
 
-inc="`pkg-config --variable=includedir libxfce4menu-1.0`"/xfce4
+inc="`pkg-config --variable=includedir libxfce4menu-0.1`"/xfce4
 
-if [ -z "${inc}" ]
-then
-	inc="`pkg-config --variable=includedir libxfcegui4-1.0`"/xfce4
-fi
-
-for s in "${inc}"/libxfce4menu/*.h
+for s in "${inc}"/libxfce4menu-0.1/libxfce4menu/*.h
 do
 	if [ "${s%-private.h}" != "${s}" ]
 	then
@@ -20,24 +15,17 @@ do
 	if [ "${t#netk-}" = "$t" ]
 	then
 		defs="${t/-/_}.defs"
+		defs="${defs/-/_}"  
+		defs="${defs/-/_}"  
+		defs="${defs/-/_}"  
+		defs="${defs/-/_}"  
 		# doesn't work: python -m codegen.h2def "$s" >"${defs}"
-		python /usr/lib/python2.5/site-packages/gtk-2.0/codegen/h2def.py "$s" >"${defs}"
+		python2 /usr/lib/python2.6/site-packages/gtk-2.0/codegen/h2def.py "$s" >"${defs}"
 	fi
 done
 
-#rm -f util.defs
-#mmv -o 'xfce-*.defs' '#1.defs'
-#rm -f libxfce4util.defs
-#rm -f libxfce4util-config.defs
-#rm -f generics.defs
-#rm -f debug.defs
-#cat menu.defs | grep -v '(gtype-id "MCS_TYPE_ACTION")' >menu.defs.new && mv mcs_client.defs.new mcs_client.defs
-
-#cat mcs_common.defs | egrep -v '\(gtype-id "(MCS_TYPE_RESULT|MCS_TYPE_TYPE|MCS_TYPE_MANAGER_CHECK)"\)' >mcs_common.defs.new && mv mcs_common.defs.new mcs_common.defs
-
-#  (release-func mcs_manager_destroy))
-
-#sed -e 's;(define-object McsClient;(define-object Client;' xfce_mcs-client.defs > xfce_mcs-client.defs.new && mv xfce_mcs-client.defs.new xfce_mcs-client.defs
-#sed -e 's;(define-object McsChannel;(define-object Channel;' xfce_mcs-channel.defs > xfce_mcs-channel.defs.new && mv xfce_mcs-channel.defs.new xfce_mcs-channel.defs
-#sed -e 's;(define-object McsManager;(define-object Manager;' xfce_mcs-manager.defs > xfce_mcs-manager.defs.new && mv xfce_mcs-manager.defs.new xfce_mcs-manager.defs
-
+for s in xfce_*.defs
+do
+	t="${s#xfce_}"
+	mv "$s" "$t"
+done
diff --git a/xfconf/binding.override b/menu/libxfce4menu.override
similarity index 79%
copy from xfconf/binding.override
copy to menu/libxfce4menu.override
index fa9bf76..311f7e4 100644
--- a/xfconf/binding.override
+++ b/menu/libxfce4menu.override
@@ -5,12 +5,12 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
 
 %%
 include
 %%
-modulename classgroup
+modulename menu
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/xfconf/binding.override b/menu/libxfce4menu_config.override
similarity index 78%
copy from xfconf/binding.override
copy to menu/libxfce4menu_config.override
index fa9bf76..903f008 100644
--- a/xfconf/binding.override
+++ b/menu/libxfce4menu_config.override
@@ -5,12 +5,12 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
 
 %%
 include
 %%
-modulename classgroup
+modulename config
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/xfconf/binding.override b/menu/menu.override
similarity index 79%
copy from xfconf/binding.override
copy to menu/menu.override
index fa9bf76..311f7e4 100644
--- a/xfconf/binding.override
+++ b/menu/menu.override
@@ -5,12 +5,12 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
 
 %%
 include
 %%
-modulename classgroup
+modulename menu
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/ui/ui.py b/menu/menu.py
similarity index 54%
copy from ui/ui.py
copy to menu/menu.py
index c2facbe..f6c5978 100644
--- a/ui/ui.py
+++ b/menu/menu.py
@@ -1,4 +1,4 @@
 #!/usr/bin/env python
 
-from _ui import *
+from _menu import *
 
diff --git a/xfconf/binding.override b/menu/menu_and_rules.override
similarity index 76%
copy from xfconf/binding.override
copy to menu/menu_and_rules.override
index fa9bf76..9cfe9d9 100644
--- a/xfconf/binding.override
+++ b/menu/menu_and_rules.override
@@ -5,12 +5,12 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
 
 %%
 include
 %%
-modulename classgroup
+modulename menu_and_rules
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/xfconf/binding.override b/menu/menu_directory.override
similarity index 76%
copy from xfconf/binding.override
copy to menu/menu_directory.override
index fa9bf76..121f8fd 100644
--- a/xfconf/binding.override
+++ b/menu/menu_directory.override
@@ -5,12 +5,12 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
 
 %%
 include
 %%
-modulename classgroup
+modulename menu_directory
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/xfconf/binding.override b/menu/menu_element.override
similarity index 77%
copy from xfconf/binding.override
copy to menu/menu_element.override
index fa9bf76..f1c056a 100644
--- a/xfconf/binding.override
+++ b/menu/menu_element.override
@@ -5,12 +5,12 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
 
 %%
 include
 %%
-modulename classgroup
+modulename menu_element
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/xfconf/binding.override b/menu/menu_environment.override
similarity index 76%
copy from xfconf/binding.override
copy to menu/menu_environment.override
index fa9bf76..4383411 100644
--- a/xfconf/binding.override
+++ b/menu/menu_environment.override
@@ -5,12 +5,12 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
 
 %%
 include
 %%
-modulename classgroup
+modulename menu_environment
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/xfconf/binding.override b/menu/menu_item.override
similarity index 78%
copy from xfconf/binding.override
copy to menu/menu_item.override
index fa9bf76..f59800b 100644
--- a/xfconf/binding.override
+++ b/menu/menu_item.override
@@ -5,12 +5,12 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
 
 %%
 include
 %%
-modulename classgroup
+modulename menu_item
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/xfconf/binding.override b/menu/menu_item_cache.override
similarity index 76%
copy from xfconf/binding.override
copy to menu/menu_item_cache.override
index fa9bf76..7268f70 100644
--- a/xfconf/binding.override
+++ b/menu/menu_item_cache.override
@@ -5,12 +5,12 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
 
 %%
 include
 %%
-modulename classgroup
+modulename menu_item_cache
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/xfconf/binding.override b/menu/menu_item_pool.override
similarity index 76%
copy from xfconf/binding.override
copy to menu/menu_item_pool.override
index fa9bf76..60832e3 100644
--- a/xfconf/binding.override
+++ b/menu/menu_item_pool.override
@@ -5,12 +5,12 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
 
 %%
 include
 %%
-modulename classgroup
+modulename menu_item_pool
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/xfconf/errors.override b/menu/menu_layout.override
similarity index 56%
copy from xfconf/errors.override
copy to menu/menu_layout.override
index fa9bf76..f961c4c 100644
--- a/xfconf/errors.override
+++ b/menu/menu_layout.override
@@ -5,12 +5,14 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
+#define XFCE_TYPE_MENU_LAYOUT_TYPE XFCE_TYPE_MENU_LAYOUT
+#define XFCE_MENU_LAYOUT_TYPE XFCE_MENU_LAYOUT
 
 %%
 include
 %%
-modulename classgroup
+modulename menu_layout
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/xfconf/binding.override b/menu/menu_monitor.override
similarity index 77%
copy from xfconf/binding.override
copy to menu/menu_monitor.override
index fa9bf76..8cc881f 100644
--- a/xfconf/binding.override
+++ b/menu/menu_monitor.override
@@ -5,12 +5,12 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
 
 %%
 include
 %%
-modulename classgroup
+modulename menu_monitor
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/xfconf/binding.override b/menu/menu_move.override
similarity index 78%
copy from xfconf/binding.override
copy to menu/menu_move.override
index fa9bf76..faecbdd 100644
--- a/xfconf/binding.override
+++ b/menu/menu_move.override
@@ -5,12 +5,12 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
 
 %%
 include
 %%
-modulename classgroup
+modulename menu_move
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/xfconf/binding.override b/menu/menu_not_rules.override
similarity index 76%
copy from xfconf/binding.override
copy to menu/menu_not_rules.override
index fa9bf76..44f096e 100644
--- a/xfconf/binding.override
+++ b/menu/menu_not_rules.override
@@ -5,12 +5,12 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
 
 %%
 include
 %%
-modulename classgroup
+modulename menu_not_rules
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/xfconf/binding.override b/menu/menu_or_rules.override
similarity index 76%
copy from xfconf/binding.override
copy to menu/menu_or_rules.override
index fa9bf76..959eda3 100644
--- a/xfconf/binding.override
+++ b/menu/menu_or_rules.override
@@ -5,12 +5,12 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
 
 %%
 include
 %%
-modulename classgroup
+modulename menu_or_rules
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/xfconf/binding.override b/menu/menu_rules.override
similarity index 77%
copy from xfconf/binding.override
copy to menu/menu_rules.override
index fa9bf76..c1585d4 100644
--- a/xfconf/binding.override
+++ b/menu/menu_rules.override
@@ -5,12 +5,12 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
 
 %%
 include
 %%
-modulename classgroup
+modulename menu_rules
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/xfconf/binding.override b/menu/menu_separator.override
similarity index 76%
copy from xfconf/binding.override
copy to menu/menu_separator.override
index fa9bf76..f5e7137 100644
--- a/xfconf/binding.override
+++ b/menu/menu_separator.override
@@ -5,12 +5,12 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
 
 %%
 include
 %%
-modulename classgroup
+modulename menu_separator
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/xfconf/binding.override b/menu/menu_standard_rules.override
similarity index 75%
copy from xfconf/binding.override
copy to menu/menu_standard_rules.override
index fa9bf76..37230be 100644
--- a/xfconf/binding.override
+++ b/menu/menu_standard_rules.override
@@ -5,12 +5,12 @@
 headers
 #include "pygobject.h"
 #include <glib.h>
-#include <xfconf/xfconf.h>
+#include <libxfce4menu/libxfce4menu.h>
 
 %%
 include
 %%
-modulename classgroup
+modulename menu_standard_rules
 %%
 import gobject.GObject as PyGObject_Type
 %%
diff --git a/menu/menumodule.c b/menu/menumodule.c
new file mode 100644
index 0000000..cc04061
--- /dev/null
+++ b/menu/menumodule.c
@@ -0,0 +1,141 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <locale.h>
+  
+/* include this first, before NO_IMPORT_PYGOBJECT is defined */
+#include <pygobject.h>
+#include <pyerrors.h>
+
+#include <libxfce4menu/libxfce4menu.h>
+
+extern PyMethodDef pylibxfce4menu_functions[];
+extern PyMethodDef pylibxfce4menu_config_functions[];
+extern PyMethodDef pymenu_and_rules_functions[];
+extern PyMethodDef pymenu_functions[];
+extern PyMethodDef pymenu_directory_functions[];
+extern PyMethodDef pymenu_element_functions[];
+extern PyMethodDef pymenu_environment_functions[];
+extern PyMethodDef pymenu_item_functions[];
+extern PyMethodDef pymenu_item_cache_functions[];
+extern PyMethodDef pymenu_item_pool_functions[];
+extern PyMethodDef pymenu_layout_functions[];
+extern PyMethodDef pymenu_monitor_functions[];
+extern PyMethodDef pymenu_move_functions[];
+extern PyMethodDef pymenu_not_rules_functions[];
+extern PyMethodDef pymenu_or_rules_functions[];
+extern PyMethodDef pymenu_rules_functions[];
+extern PyMethodDef pymenu_separator_functions[];
+extern PyMethodDef pymenu_standard_rules_functions[];
+
+void pylibxfce4menu_register_classes(PyObject *d);
+void pylibxfce4menu_config_register_classes(PyObject *d);
+void pymenu_and_rules_register_classes(PyObject *d);
+void pymenu_register_classes(PyObject *d);
+void pymenu_directory_register_classes(PyObject *d);
+void pymenu_element_register_classes(PyObject *d);
+void pymenu_environment_register_classes(PyObject *d);
+void pymenu_item_register_classes(PyObject *d);
+void pymenu_item_cache_register_classes(PyObject *d);
+void pymenu_item_pool_register_classes(PyObject *d);
+void pymenu_layout_register_classes(PyObject *d);
+void pymenu_monitor_register_classes(PyObject *d);
+void pymenu_move_register_classes(PyObject *d);
+void pymenu_not_rules_register_classes(PyObject *d);
+void pymenu_or_rules_register_classes(PyObject *d);
+void pymenu_rules_register_classes(PyObject *d);
+void pymenu_separator_register_classes(PyObject *d);
+void pymenu_standard_rules_register_classes(PyObject *d);
+
+void pymenu_layout_add_constants(PyObject *module, const gchar *strip_prefix);
+void pymenu_monitor_add_constants(PyObject *module, const gchar *strip_prefix);
+
+
+static PyMethodDef all_functions[1000];
+
+static PyMethodDef* each_functions[] = {
+	pylibxfce4menu_functions,
+	pylibxfce4menu_config_functions,
+	pymenu_and_rules_functions,
+	pymenu_functions,
+	pymenu_directory_functions,
+	pymenu_element_functions,
+	pymenu_environment_functions,
+	pymenu_item_functions,
+	pymenu_item_cache_functions,
+	pymenu_item_pool_functions,
+	pymenu_layout_functions,
+	pymenu_monitor_functions,
+	pymenu_move_functions,
+	pymenu_not_rules_functions,
+	pymenu_or_rules_functions,
+	pymenu_rules_functions,
+	pymenu_separator_functions,
+	pymenu_standard_rules_functions,
+};
+
+static void
+my_register1()
+{
+	PyObject *m, *d;
+	int	i;
+	int	j;
+	int	cnt;
+
+	cnt = 0;
+	
+	for(i = 0; i < sizeof(each_functions) / sizeof(each_functions[0]); i++) {
+		for(j = 0; each_functions[i][j].ml_name != NULL; j++) {
+			if (cnt >= sizeof(all_functions) / sizeof(all_functions[0])) {
+				fprintf (stderr, "pyxfce: Internal Error: too many functions");
+				exit (1);
+			}
+			
+			all_functions[cnt++] = each_functions[i][j];
+		}
+	}
+	
+	m = Py_InitModule("_menu", all_functions);
+	
+	pymenu_layout_add_constants(m, "XFCE_");
+	pymenu_monitor_add_constants(m, "XFCE_");
+	
+	/*PyModule_AddStringConstant(m, "STARTUP_NOTIFICATION_ID_KEY", XFCE_STARTUP_NOTIFICATION_ENVIRONMENT_DESKTOP_STARTUP_ID);*/
+
+        d = PyModule_GetDict(m);
+	pylibxfce4menu_register_classes(d);
+	pylibxfce4menu_config_register_classes(d);
+	pymenu_and_rules_register_classes(d);
+	pymenu_register_classes(d);
+	pymenu_directory_register_classes(d);
+	pymenu_element_register_classes(d);
+	pymenu_environment_register_classes(d);
+	pymenu_item_register_classes(d);
+	pymenu_item_cache_register_classes(d);
+	pymenu_item_pool_register_classes(d);
+	pymenu_layout_register_classes(d);
+	pymenu_monitor_register_classes(d);
+	pymenu_move_register_classes(d);
+	pymenu_not_rules_register_classes(d);
+	pymenu_or_rules_register_classes(d);
+	pymenu_rules_register_classes(d);
+	pymenu_separator_register_classes(d);
+	pymenu_standard_rules_register_classes(d);
+}
+
+DL_EXPORT(void)
+init_menu(void)
+{
+	/* set the default python encoding to utf-8 */
+	PyUnicode_SetDefaultEncoding("utf-8");
+
+	init_pygobject ();
+
+	my_register1 ();
+}
+
+
diff --git a/panel/panelmodule.c b/panel/panelmodule.c
index ca01f9c..8fa5b36 100644
--- a/panel/panelmodule.c
+++ b/panel/panelmodule.c
@@ -25,7 +25,7 @@ void pyenums_add_constants(PyObject *module, const gchar *strip_prefix);
 
 static PyMethodDef all_functions[1000];
 
-static PyMethodDef* each_functions[] = {
+static const PyMethodDef* each_functions[] = {
   pyarrow_button_functions,
   pyenums_functions,
   pyexternal_plugin_functions,



More information about the Xfce4-commits mailing list