[Xfce4-commits] <thunarx-python:master> Check python dependency better
Adam Plumb
noreply at xfce.org
Thu May 27 18:10:05 CEST 2010
Updating branch refs/heads/master
to 68c1b1b2b29ba507ebbdf942ec2c98b7113ff87b (commit)
from cbc0041f04a13e9786204b9f98d43e1d7a00f3a4 (commit)
commit 68c1b1b2b29ba507ebbdf942ec2c98b7113ff87b
Author: Adam Plumb <adamplumb at gmail.com>
Date: Thu Sep 17 21:11:08 2009 -0400
Check python dependency better
Makefile.am | 52 -----
configure.ac | 17 +-
src/.cvsignore | 5 -
src/Makefile.am | 3 +-
thunarx-python-object.c | 487 -----------------------------------------------
thunarx-python-object.h | 50 -----
thunarx-python.c | 365 -----------------------------------
thunarx-python.h | 79 --------
thunarx.defs | 320 -------------------------------
thunarx.override | 58 ------
thunarxmodule.c | 56 ------
11 files changed, 8 insertions(+), 1484 deletions(-)
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index 19d2c41..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,52 +0,0 @@
-# $Id$
-
-INCLUDES = \
- -I$(top_builddir) \
- -I$(top_builddir)/plugins \
- -I$(top_srcdir) \
- -I$(top_srcdir)/plugins \
- -DBINDIR=\"$(bindir)\" \
- -DDATADIR=\"$(datadir)\" \
- -DG_LOG_DOMAIN=\"thunarx-python\" \
- -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
- $(PLATFORM_CPPFLAGS)
-
-extensionsdir = $(libdir)/thunarx-$(THUNARX_VERSION_API)
-extensions_LTLIBRARIES = \
- thunarx-python.la
-
-thunarx-python_la_SOURCES = \
- thunarx-python-object.c \
- thunarx-python-object.h \
- thunarx-python.c \
- thunarx-python.h \
- thunarxmodule.c
-
-thunarx-python_la_CFLAGS = \
- $(EXO_CFLAGS) \
- $(LIBXFCE4UTIL_CFLAGS) \
- $(PLATFORM_CFLAGS)
-
-thunarx-python_la_LDFLAGS = \
- -avoid-version \
- -export-dynamic \
- -module \
- $(PLATFORM_LDFLAGS)
-
-defaultsdir = $(sysconfdir)/xdg/Thunar
-
-EXTRA_DIST = \
- README \
- nautilus.defs \
- nautilus.override
-
-.defs.c:
- (cd $(srcdir)\
- && $(PYGTK_CODEGEN) \
- --register $(PYGTK_DEFSDIR)/pango-types.defs \
- --register $(PYGTK_DEFSDIR)/gdk-types.defs \
- --register $(PYGTK_DEFSDIR)/gtk-types.defs \
- --override $*.override \
- --prefix py$* $*.defs) > gen-$*.c \
- && cp gen-$*.c $*.c \
- && rm -f gen-$*.c
diff --git a/configure.ac b/configure.ac
index fc6b3f2..c6e5859 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,21 +10,18 @@ AC_CONFIG_HEADER([config.h])
# Checks for programs.
AC_PROG_CC
-# Check for Python
-AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
-AM_CHECK_PYTHON_LIBS(,[AC_MSG_ERROR(could not find Python lib)])
-
# Check for programs
PKG_CHECK_MODULES([THUNARX], [thunarx-1 >= 0.4.0])
PKG_CHECK_PACKAGE([GTK], [gtk+-2.0 >= 2.6.0])
PKG_CHECK_PACKAGE([GLIB], [glib-2.0 >= 2.6.0])
PKG_CHECK_PACKAGE([GOBJECT], [gobject-2.0 >= 2.6.0])
-PKG_CHECK_PACKAGE([PYGTK], [pygtk-2.0 >= 2.8.0]
+PKG_CHECK_PACKAGE([PYTHON], [python >= 2.4.0])
+PKG_CHECK_PACKAGE([PYGTK], [pygtk-2.0 >= 2.8.0])
-PACKAGE_CFLAGS="-g -Wall $THUNARX_CFLAGS $APR_CFLAGS $GTK_CFLAGS $GLIB_CFLAGS $GOBJECT_CFLAGS"
-PACKAGE_LIBS="-g $THUNARX_LIBS $APR_LIBS $GTK_LIBS $GLIB_LIBS $GOBJECT_LIBS"
-PACKAGE_LDFLAGS="$THUNARX_LDFLAGS $APR_LDFLAGS $GTK_LDFLAGS $GLIB_LDFLAGS $GOBJECT_LDFLAGS"
-PACKAGE_CPPFLAGS="$THUNARX_CPPFLAGS $APR_CPPFLAGS $GTK_CPPFLAGS $GLIB_CPPFLAGS $GOBJECT_CPPFLAGS"
+PACKAGE_CFLAGS="-g -Wall $THUNARX_CFLAGS $APR_CFLAGS $GTK_CFLAGS $GLIB_CFLAGS $GOBJECT_CFLAGS $PYTHON_CFLAGS"
+PACKAGE_LIBS="-g $THUNARX_LIBS $APR_LIBS $GTK_LIBS $GLIB_LIBS $GOBJECT_LIBS $PYTHON_LIBS"
+PACKAGE_LDFLAGS="$THUNARX_LDFLAGS $APR_LDFLAGS $GTK_LDFLAGS $GLIB_LDFLAGS $GOBJECT_LDFLAGS $PYTHON_LDFLAGS"
+PACKAGE_CPPFLAGS="$THUNARX_CPPFLAGS $APR_CPPFLAGS $GTK_CPPFLAGS $GLIB_CPPFLAGS $GOBJECT_CPPFLAGS $PYTHON_CPPFLAGS"
# Make dependency CFLAGS and LIBS available
AC_SUBST(PACKAGE_CFLAGS)
@@ -38,7 +35,7 @@ AC_SUBST(PYGTK_DEFSDIR)
AC_MSG_RESULT($PYGTK_DEFSDIR)
AC_MSG_CHECKING(for pygtk codegen)
-PYGTK_CODEGEN="$PYTHON `$PKG_CONFIG --variable=codegendir pygtk-2.0`/codegen.py"
+PYGTK_CODEGEN="/usr/bin/python `$PKG_CONFIG --variable=codegendir pygtk-2.0`/codegen.py"
AC_SUBST(PYGTK_CODEGEN)
AC_MSG_RESULT($PYGTK_CODEGEN)
diff --git a/src/.cvsignore b/src/.cvsignore
deleted file mode 100644
index 3d710cc..0000000
--- a/src/.cvsignore
+++ /dev/null
@@ -1,5 +0,0 @@
-Makefile
-Makefile.in
-*.pyc
-*.pyo
-nautilus.c
diff --git a/src/Makefile.am b/src/Makefile.am
index d45f29b..b693e13 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -9,8 +9,7 @@ thunarx_python_la_SOURCES = \
thunarx_python.h
thunarx_python_la_LIBADD = \
- $(PACKAGE_LIBS) \
- $(PYTHON_LIBS)
+ $(PACKAGE_LIBS)
thunarx_python_la_LDFLAGS = \
-module -pthread
diff --git a/thunarx-python-object.c b/thunarx-python-object.c
deleted file mode 100644
index 2268835..0000000
--- a/thunarx-python-object.c
+++ /dev/null
@@ -1,487 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
-/*
- * Copyright (C) 2004 Novell, Inc.
- *
- * This library 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 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: Dave Camp <dave at ximian.com>
- *
- */
-
-#include <config.h>
-
-#include "thunarx-python-object.h"
-#include "thunarx-python.h"
-
-#include <thunarx/thunarx-extension-types.h>
-
-#include <pygobject.h>
-
-/* Thunarx extension headers */
-#include <thunarx/thunarx-file-info.h>
-#include <thunarx/thunarx-info-provider.h>
-#include <thunarx/thunarx-column-provider.h>
-#include <thunarx/thunarx-location-widget-provider.h>
-#include <thunarx/thunarx-menu-item.h>
-#include <thunarx/thunarx-menu-provider.h>
-#include <thunarx/thunarx-property-page-provider.h>
-
-#include <string.h>
-
-#define METHOD_PREFIX ""
-
-static GObjectClass *parent_class;
-
-/* These macros assumes the following things:
- * a METHOD_NAME is defined with is a string
- * a goto label called beach
- * the return value is called ret
- */
-
-#define CHECK_METHOD_NAME(self) \
- if (!PyObject_HasAttrString(self, METHOD_NAME)) \
- goto beach;
-
-#define CONVERT_LIST(py_files, files) \
- { \
- GList *l; \
- py_files = PyList_New(0); \
- for (l = files; l; l = l->next) { \
- PyObject *obj = pygobject_new((GObject*)l->data); \
- PyList_Append(py_files, obj); \
- Py_DECREF(obj); \
- } \
- }
-
-#define HANDLE_RETVAL(py_ret) \
- if (!py_ret) { \
- PyErr_Print(); \
- goto beach; \
- } else if (py_ret == Py_None) { \
- goto beach; \
- }
-
-#define HANDLE_LIST(py_ret, type, type_name) \
- { \
- Py_ssize_t i = 0; \
- if (!PySequence_Check(py_ret) || PyString_Check(py_ret)) { \
- PyErr_SetString(PyExc_TypeError, \
- METHOD_NAME " must return a sequence"); \
- goto beach; \
- } \
- for (i = 0; i < PySequence_Size (py_ret); i++) { \
- PyGObject *py_item; \
- py_item = (PyGObject*)PySequence_GetItem (py_ret, i); \
- if (!pygobject_check(py_item, &Py##type##_Type)) { \
- PyErr_SetString(PyExc_TypeError, \
- METHOD_NAME \
- " must return a sequence of " \
- type_name); \
- goto beach; \
- } \
- ret = g_list_append (ret, (type*) g_object_ref(py_item->obj)); \
- Py_DECREF(py_item); \
- } \
- }
-
-#define METHOD_NAME "get_property_pages"
-static GList *
-thunarx_python_object_get_property_pages (ThunarxPropertyPageProvider *provider,
- GList *files)
-{
- ThunarxPythonObject *object = (ThunarxPythonObject*)provider;
- PyObject *py_files, *py_ret = NULL;
- GList *ret = NULL;
- PyGILState_STATE state = pyg_gil_state_ensure(); \
-
- debug_enter();
-
- CHECK_METHOD_NAME(object->instance);
-
- CONVERT_LIST(py_files, files);
-
- py_ret = PyObject_CallMethod(object->instance, METHOD_PREFIX METHOD_NAME,
- "(N)", py_files);
- HANDLE_RETVAL(py_ret);
-
- HANDLE_LIST(py_ret, ThunarxPropertyPage, "thunarx.PropertyPage");
-
- beach:
- Py_XDECREF(py_ret);
- pyg_gil_state_release(state);
- return ret;
-}
-#undef METHOD_NAME
-
-
-static void
-thunarx_python_object_property_page_provider_iface_init (ThunarxPropertyPageProviderIface *iface)
-{
- iface->get_pages = thunarx_python_object_get_property_pages;
-}
-
-#define METHOD_NAME "get_widget"
-static GtkWidget *
-thunarx_python_object_get_widget (ThunarxLocationWidgetProvider *provider,
- const char *uri,
- GtkWidget *window)
-{
- ThunarxPythonObject *object = (ThunarxPythonObject*)provider;
- GtkWidget *ret = NULL;
- PyObject *py_ret = NULL;
- PyGObject *py_ret_gobj;
- PyObject *py_uri = NULL;
- PyGILState_STATE state = pyg_gil_state_ensure();
-
- debug_enter();
-
- CHECK_METHOD_NAME(object->instance);
-
- py_uri = PyString_FromString(uri);
-
- py_ret = PyObject_CallMethod(object->instance, METHOD_PREFIX METHOD_NAME,
- "(NN)", py_uri,
- pygobject_new((GObject *)window));
- HANDLE_RETVAL(py_ret);
-
- py_ret_gobj = (PyGObject *)py_ret;
- if (!pygobject_check(py_ret_gobj, &PyGtkWidget_Type)) {
- PyErr_SetString(PyExc_TypeError,
- METHOD_NAME "should return a gtk.Widget");
- goto beach;
- }
- ret = (GtkWidget *)g_object_ref(py_ret_gobj->obj);
-
- beach:
- Py_XDECREF(py_ret);
- pyg_gil_state_release(state);
- return ret;
-}
-#undef METHOD_NAME
-
-static void
-thunarx_python_object_location_widget_provider_iface_init (ThunarxLocationWidgetProviderIface *iface)
-{
- iface->get_widget = thunarx_python_object_get_widget;
-}
-
-#define METHOD_NAME "get_file_items"
-static GList *
-thunarx_python_object_get_file_items (ThunarxMenuProvider *provider,
- GtkWidget *window,
- GList *files)
-{
- ThunarxPythonObject *object = (ThunarxPythonObject*)provider;
- GList *ret = NULL;
- PyObject *py_ret = NULL, *py_files;
- PyGILState_STATE state = pyg_gil_state_ensure();
-
- debug_enter();
-
- CHECK_METHOD_NAME(object->instance);
-
- CONVERT_LIST(py_files, files);
-
- py_ret = PyObject_CallMethod(object->instance, METHOD_PREFIX METHOD_NAME,
- "(NN)", pygobject_new((GObject *)window), py_files);
- HANDLE_RETVAL(py_ret);
-
- HANDLE_LIST(py_ret, ThunarxMenuItem, "thunarx.MenuItem");
-
- beach:
- Py_XDECREF(py_ret);
- pyg_gil_state_release(state);
- return ret;
-}
-#undef METHOD_NAME
-
-#define METHOD_NAME "get_background_items"
-static GList *
-thunarx_python_object_get_background_items (ThunarxMenuProvider *provider,
- GtkWidget *window,
- ThunarxFileInfo *file)
-{
- ThunarxPythonObject *object = (ThunarxPythonObject*)provider;
- GList *ret = NULL;
- PyObject *py_ret = NULL;
- PyGILState_STATE state = pyg_gil_state_ensure(); \
-
- debug_enter();
-
- CHECK_METHOD_NAME(object->instance);
-
- py_ret = PyObject_CallMethod(object->instance, METHOD_PREFIX METHOD_NAME,
- "(NN)",
- pygobject_new((GObject *)window),
- pygobject_new((GObject *)file));
-
- HANDLE_RETVAL(py_ret);
-
- HANDLE_LIST(py_ret, ThunarxMenuItem, "thunarx.MenuItem");
-
- beach:
- Py_XDECREF(py_ret);
- pyg_gil_state_release(state);
- return ret;
-}
-#undef METHOD_NAME
-
-#define METHOD_NAME "get_toolbar_items"
-static GList *
-thunarx_python_object_get_toolbar_items (ThunarxMenuProvider *provider,
- GtkWidget *window,
- ThunarxFileInfo *file)
-{
- ThunarxPythonObject *object = (ThunarxPythonObject*)provider;
- GList *ret = NULL;
- PyObject *py_ret = NULL;
- PyGILState_STATE state = pyg_gil_state_ensure(); \
-
- debug_enter();
-
- CHECK_METHOD_NAME(object->instance);
-
- py_ret = PyObject_CallMethod(object->instance, METHOD_PREFIX METHOD_NAME,
- "(NN)",
- pygobject_new((GObject *)window),
- pygobject_new((GObject *)file));
- HANDLE_RETVAL(py_ret);
-
- HANDLE_LIST(py_ret, ThunarxMenuItem, "thunarx.MenuItem");
-
- beach:
- Py_XDECREF(py_ret);
- pyg_gil_state_release(state);
- return ret;
-}
-#undef METHOD_NAME
-
-static void
-thunarx_python_object_menu_provider_iface_init (ThunarxMenuProviderIface *iface)
-{
- iface->get_background_items = thunarx_python_object_get_background_items;
- iface->get_toolbar_items = thunarx_python_object_get_toolbar_items;
- iface->get_file_items = thunarx_python_object_get_file_items;
-}
-
-#define METHOD_NAME "get_columns"
-static GList *
-thunarx_python_object_get_columns (ThunarxColumnProvider *provider)
-{
- ThunarxPythonObject *object = (ThunarxPythonObject*)provider;
- GList *ret = NULL;
- PyObject *py_ret;
- PyGILState_STATE state = pyg_gil_state_ensure(); \
-
- debug_enter();
-
- CHECK_METHOD_NAME(object->instance);
-
- py_ret = PyObject_CallMethod(object->instance, METHOD_PREFIX METHOD_NAME,
- NULL);
-
- HANDLE_RETVAL(py_ret);
-
- HANDLE_LIST(py_ret, ThunarxColumn, "thunarx.Column");
-
- beach:
- pyg_gil_state_release(state);
- return ret;
-}
-#undef METHOD_NAME
-
-static void
-thunarx_python_object_column_provider_iface_init (ThunarxColumnProviderIface *iface)
-{
- iface->get_columns = thunarx_python_object_get_columns;
-}
-
-
-#define METHOD_NAME "cancel_update"
-static void
-thunarx_python_object_cancel_update (ThunarxInfoProvider *provider,
- ThunarxOperationHandle *handle)
-{
- debug_enter();
-}
-#undef METHOD_NAME
-
-#define METHOD_NAME "update_file_info"
-static ThunarxOperationResult
-thunarx_python_object_update_file_info (ThunarxInfoProvider *provider,
- ThunarxFile *file,
- GClosure *update_complete,
- ThunarxOperationHandle **handle)
-{
- ThunarxPythonObject *object = (ThunarxPythonObject*)provider;
- ThunarxOperationResult ret = NAUTILUS_OPERATION_COMPLETE;
- PyObject *py_ret = NULL;
- PyGILState_STATE state = pyg_gil_state_ensure(); \
-
- debug_enter();
-
- CHECK_METHOD_NAME(object->instance);
-
- py_ret = PyObject_CallMethod(object->instance,
- METHOD_PREFIX METHOD_NAME, "(N)",
- pygobject_new((GObject*)file));
- HANDLE_RETVAL(py_ret);
-
-
- if (!PyInt_Check(py_ret)) {
- PyErr_SetString(PyExc_TypeError,
- METHOD_NAME " must return None or a int");
- goto beach;
- }
-
- ret = PyInt_AsLong(py_ret);
-
- beach:
- Py_XDECREF(py_ret);
- pyg_gil_state_release(state);
- return ret;
-}
-#undef METHOD_NAME
-
-static void
-thunarx_python_object_info_provider_iface_init (ThunarxInfoProviderIface *iface)
-{
- iface->cancel_update = thunarx_python_object_cancel_update;
- iface->update_file_info = thunarx_python_object_update_file_info;
-}
-
-static void
-thunarx_python_object_instance_init (ThunarxPythonObject *object)
-{
- ThunarxPythonObjectClass *class;
- debug_enter();
-
- class = (ThunarxPythonObjectClass*)(((GTypeInstance*)object)->g_class);
-
- object->instance = PyObject_CallObject(class->type, NULL);
- if (object->instance == NULL)
- PyErr_Print();
-}
-
-static void
-thunarx_python_object_finalize (GObject *object)
-{
- debug_enter();
-
- Py_DECREF(((ThunarxPythonObject *)object)->instance);
-}
-
-static void
-thunarx_python_object_class_init (ThunarxPythonObjectClass *class,
- gpointer class_data)
-{
- debug_enter();
-
- parent_class = g_type_class_peek_parent (class);
-
- class->type = (PyObject*)class_data;
-
- G_OBJECT_CLASS (class)->finalize = thunarx_python_object_finalize;
-}
-
-GType
-thunarx_python_object_get_type (GTypeModule *module,
- PyObject *type)
-{
- GTypeInfo *info;
- const char *type_name;
- GType gtype;
-
- static const GInterfaceInfo property_page_provider_iface_info = {
- (GInterfaceInitFunc) thunarx_python_object_property_page_provider_iface_init,
- NULL,
- NULL
- };
-
- static const GInterfaceInfo location_widget_provider_iface_info = {
- (GInterfaceInitFunc) thunarx_python_object_location_widget_provider_iface_init,
- NULL,
- NULL
- };
-
- static const GInterfaceInfo menu_provider_iface_info = {
- (GInterfaceInitFunc) thunarx_python_object_menu_provider_iface_init,
- NULL,
- NULL
- };
-
- static const GInterfaceInfo column_provider_iface_info = {
- (GInterfaceInitFunc) thunarx_python_object_column_provider_iface_init,
- NULL,
- NULL
- };
-
- static const GInterfaceInfo info_provider_iface_info = {
- (GInterfaceInitFunc) thunarx_python_object_info_provider_iface_init,
- NULL,
- NULL
- };
-
- debug_enter_args("type=%s", PyString_AsString(PyObject_GetAttrString(type, "__name__")));
- info = g_new0 (GTypeInfo, 1);
-
- info->class_size = sizeof (ThunarxPythonObjectClass);
- info->class_init = (GClassInitFunc)thunarx_python_object_class_init;
- info->instance_size = sizeof (ThunarxPythonObject);
- info->instance_init = (GInstanceInitFunc)thunarx_python_object_instance_init;
-
- info->class_data = type;
- Py_INCREF(type);
-
- type_name = g_strdup_printf("%s+ThunarxPython",
- PyString_AsString(PyObject_GetAttrString(type, "__name__")));
-
- gtype = g_type_module_register_type (module,
- G_TYPE_OBJECT,
- type_name,
- info, 0);
-
- if (PyObject_IsSubclass(type, (PyObject*)&PyThunarxPropertyPageProvider_Type)) {
- g_type_module_add_interface (module, gtype,
- NAUTILUS_TYPE_PROPERTY_PAGE_PROVIDER,
- &property_page_provider_iface_info);
- }
-
- if (PyObject_IsSubclass(type, (PyObject*)&PyThunarxLocationWidgetProvider_Type)) {
- g_type_module_add_interface (module, gtype,
- NAUTILUS_TYPE_LOCATION_WIDGET_PROVIDER,
- &location_widget_provider_iface_info);
- }
-
- if (PyObject_IsSubclass(type, (PyObject*)&PyThunarxMenuProvider_Type)) {
- g_type_module_add_interface (module, gtype,
- NAUTILUS_TYPE_MENU_PROVIDER,
- &menu_provider_iface_info);
- }
-
- if (PyObject_IsSubclass(type, (PyObject*)&PyThunarxColumnProvider_Type)) {
- g_type_module_add_interface (module, gtype,
- NAUTILUS_TYPE_COLUMN_PROVIDER,
- &column_provider_iface_info);
- }
-
- if (PyObject_IsSubclass(type, (PyObject*)&PyThunarxInfoProvider_Type)) {
- g_type_module_add_interface (module, gtype,
- NAUTILUS_TYPE_INFO_PROVIDER,
- &info_provider_iface_info);
- }
-
- return gtype;
-}
diff --git a/thunarx-python-object.h b/thunarx-python-object.h
deleted file mode 100644
index e101580..0000000
--- a/thunarx-python-object.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * thunarx-python-object.h - Generation of wrapper objects for thunarx
- * extension objects in python.
- *
- * Copyright (C) 2003 Novell, Inc.
- *
- * This library 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 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: Dave Camp <dave at ximian.com>
- *
- */
-
-#ifndef NAUTILUS_PYTHON_OBJECT_H
-#define NAUTILUS_PYTHON_OBJECT_H
-
-#include <Python.h>
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-typedef struct _ThunarxPythonObject ThunarxPythonObject;
-typedef struct _ThunarxPythonObjectClass ThunarxPythonObjectClass;
-
-struct _ThunarxPythonObject {
- GObject parent_slot;
- PyObject *instance;
-};
-
-struct _ThunarxPythonObjectClass {
- GObjectClass parent_slot;
- PyObject *type;
-};
-
-GType thunarx_python_object_get_type (GTypeModule *module, PyObject *type);
-
-G_END_DECLS
-
-#endif
diff --git a/thunarx-python.c b/thunarx-python.c
deleted file mode 100644
index bc73026..0000000
--- a/thunarx-python.c
+++ /dev/null
@@ -1,365 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
-/*
- * Copyright (C) 2004,2005 Johan Dahlin
- *
- * 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 2, 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <Python.h>
-#include <pygobject.h>
-#include <pygtk/pygtk.h>
-
-#include "thunarx-python.h"
-#include "thunarx-python-object.h"
-#include "pygnomevfs.h"
-
-#include <thunarx/thunarx-extension-types.h>
-
-static const GDebugKey thunarx_python_debug_keys[] = {
- {"misc", NAUTILUS_PYTHON_DEBUG_MISC},
-};
-static const guint thunarx_python_ndebug_keys = sizeof (thunarx_python_debug_keys) / sizeof (GDebugKey);
-ThunarxPythonDebug thunarx_python_debug;
-
-static gboolean thunarx_python_init_python(void);
-
-static GArray *all_types = NULL;
-
-
-static inline gboolean np_init_pygobject(void)
-{
- PyObject *gobject = PyImport_ImportModule("gobject");
- if (gobject != NULL) {
- PyObject *mdict = PyModule_GetDict(gobject);
- PyObject *cobject = PyDict_GetItemString(mdict, "_PyGObject_API");
- if (PyCObject_Check(cobject))
- _PyGObject_API = (struct _PyGObject_Functions *)PyCObject_AsVoidPtr(cobject);
- else {
- PyErr_SetString(PyExc_RuntimeError,
- "could not find _PyGObject_API object");
- PyErr_Print();
- return FALSE;
- }
- } else {
- PyErr_Print();
- g_warning("could not import gobject");
- return FALSE;
- }
- return TRUE;
-}
-
-static inline gboolean np_init_pygtk(void)
-{
- PyObject *pygtk = PyImport_ImportModule("gtk._gtk");
- if (pygtk != NULL) {
- PyObject *module_dict = PyModule_GetDict(pygtk);
- PyObject *cobject = PyDict_GetItemString(module_dict, "_PyGtk_API");
- if (PyCObject_Check(cobject))
- _PyGtk_API = (struct _PyGtk_FunctionStruct*)
- PyCObject_AsVoidPtr(cobject);
- else {
- PyErr_SetString(PyExc_RuntimeError,
- "could not find _PyGtk_API object");
- PyErr_Print();
- return FALSE;
- }
- } else {
- PyErr_Print();
- g_warning("could not import gtk._gtk");
- return FALSE;
- }
- return TRUE;
-}
-
-static inline gboolean np_init_pygnomevfs(void)
-{
- PyObject *module = PyImport_ImportModule("gnomevfs");
- if (module != NULL) {
- PyObject *mdict = PyModule_GetDict(module);
- PyObject *cobject = PyDict_GetItemString(mdict, "_PyGnomeVFS_API");
- if (PyCObject_Check(cobject))
- _PyGnomeVFS_API = (struct _PyGnomeVFS_Functions *)PyCObject_AsVoidPtr(cobject);
- else {
- g_warning("could not find _PyGnomeVFS_API object in the gnomevfs module");
- return FALSE;
- }
- } else {
- PyErr_Print();
- g_warning("could not import gnomevfs");
- return FALSE;
- }
- return TRUE;
-}
-
-
-static void
-thunarx_python_load_file(GTypeModule *type_module, const gchar *filename)
-{
- PyObject *main_module, *main_locals, *locals, *key, *value;
- PyObject *module;
- GType gtype;
- Py_ssize_t pos = 0;
-
- debug_enter_args("filename=%s", filename);
-
- main_module = PyImport_AddModule("__main__");
- if (main_module == NULL) {
- g_warning("Could not get __main__.");
- return;
- }
-
- main_locals = PyModule_GetDict(main_module);
- module = PyImport_ImportModuleEx((char *) filename, main_locals, main_locals, NULL);
- if (!module) {
- PyErr_Print();
- return;
- }
-
- locals = PyModule_GetDict(module);
-
- while (PyDict_Next(locals, &pos, &key, &value)) {
- if (!PyType_Check(value))
- continue;
-
- if (PyObject_IsSubclass(value, (PyObject*)&PyThunarxColumnProvider_Type) ||
- PyObject_IsSubclass(value, (PyObject*)&PyThunarxInfoProvider_Type) ||
- PyObject_IsSubclass(value, (PyObject*)&PyThunarxLocationWidgetProvider_Type) ||
- PyObject_IsSubclass(value, (PyObject*)&PyThunarxMenuProvider_Type) ||
- PyObject_IsSubclass(value, (PyObject*)&PyThunarxPropertyPageProvider_Type)) {
-
- gtype = thunarx_python_object_get_type(type_module, value);
- g_array_append_val(all_types, gtype);
- }
- }
-
- debug("Loaded python modules");
-}
-
-static void
-thunarx_python_load_dir (GTypeModule *module, const char *dirname)
-{
- GDir *dir;
- const char *name;
- gboolean initialized = FALSE;
-
- debug_enter_args("dirname=%s", dirname);
-
- dir = g_dir_open(dirname, 0, NULL);
- if (!dir)
- return;
-
-
- while ((name = g_dir_read_name(dir))) {
- if (g_str_has_suffix(name, ".py")) {
- char *modulename;
- int len;
-
- len = strlen(name) - 3;
- modulename = g_new0(char, len + 1 );
- strncpy(modulename, name, len);
-
- if (!initialized) {
- PyObject *sys_path, *py_path;
- /* n-p python part is initialized on demand (or not
- * at all if no extensions are found) */
- if (!thunarx_python_init_python()) {
- g_warning("thunarx_python_init_python failed");
- goto exit;
- }
- /* sys.path.insert(0, dirname) */
- sys_path = PySys_GetObject("path");
- py_path = PyString_FromString(dirname);
- PyList_Insert(sys_path, 0, py_path);
- Py_DECREF(py_path);
- }
- thunarx_python_load_file(module, modulename);
- }
- }
-exit:
- g_dir_close(dir);
-}
-
-static gboolean
-thunarx_python_init_python (void)
-{
- PyObject *pygtk, *mdict, *require;
- PyObject *sys_path, *tmp, *thunarx, *gtk, *pygtk_version, *pygtk_required_version;
- GModule *libpython;
- char *argv[] = { "thunarx", NULL };
-
- if (Py_IsInitialized())
- return TRUE;
-
- debug("g_module_open " PY_LIB_LOC "/libpython" PYTHON_VERSION "." G_MODULE_SUFFIX);
- libpython = g_module_open(PY_LIB_LOC "/libpython" PYTHON_VERSION "." G_MODULE_SUFFIX, 0);
- if (!libpython)
- g_warning("g_module_open libpython failed: %s", g_module_error());
- debug("Py_Initialize");
- Py_Initialize();
- if (PyErr_Occurred()) {
- PyErr_Print();
- return FALSE;
- }
-
- debug("PySys_SetArgv");
- PySys_SetArgv(1, argv);
- if (PyErr_Occurred()) {
- PyErr_Print();
- return FALSE;
- }
-
- /* pygtk.require("2.0") */
- debug("pygtk.require(\"2.0\")");
- pygtk = PyImport_ImportModule("pygtk");
- if (!pygtk) {
- PyErr_Print();
- return FALSE;
- }
- mdict = PyModule_GetDict(pygtk);
- require = PyDict_GetItemString(mdict, "require");
- PyObject_CallObject(require, Py_BuildValue("(S)", PyString_FromString("2.0")));
- if (PyErr_Occurred()) {
- PyErr_Print();
- return FALSE;
- }
-
- /* import gobject */
- debug("init_pygobject");
- if (!np_init_pygobject()) {
- g_warning("pygobject initialization failed");
- return FALSE;
- }
- /* import gtk */
- debug("init_pygtk");
- if (!np_init_pygtk()) {
- g_warning("pygtk initialization failed");
- return FALSE;
- }
- /* import gnomevfs */
- debug("init_gnomevfs");
- if (!np_init_pygnomevfs())
- return FALSE;
-
- /* gobject.threads_init() */
- debug("pyg_enable_threads");
- setenv("PYGTK_USE_GIL_STATE_API", "", 0);
- pyg_enable_threads();
-
- /* gtk.pygtk_version < (2, 4, 0) */
- gtk = PyImport_ImportModule("gtk");
- mdict = PyModule_GetDict(gtk);
- pygtk_version = PyDict_GetItemString(mdict, "pygtk_version");
- pygtk_required_version = Py_BuildValue("(iii)", 2, 4, 0);
- if (PyObject_Compare(pygtk_version, pygtk_required_version) == -1) {
- g_warning("PyGTK %s required, but %s found.",
- PyString_AsString(PyObject_Repr(pygtk_required_version)),
- PyString_AsString(PyObject_Repr(pygtk_version)));
- Py_DECREF(pygtk_required_version);
- return FALSE;
- }
- Py_DECREF(pygtk_required_version);
-
- /* sys.path.insert(., ...) */
- debug("sys.path.insert(0, ...)");
- sys_path = PySys_GetObject("path");
- PyList_Insert(sys_path, 0,
- (tmp = PyString_FromString(NAUTILUS_LIBDIR "/thunarx-python")));
- Py_DECREF(tmp);
-
- /* import thunarx */
- g_setenv("INSIDE_NAUTILUS_PYTHON", "", FALSE);
- debug("import thunarx");
- thunarx = PyImport_ImportModule("thunarx");
- if (!thunarx) {
- PyErr_Print();
- return FALSE;
- }
-
- /* Extract types and interfaces from thunarx */
- mdict = PyModule_GetDict(thunarx);
-
- _PyGtkWidget_Type = pygobject_lookup_class(GTK_TYPE_WIDGET);
- g_assert(_PyGtkWidget_Type != NULL);
-
-#define IMPORT(x, y) \
- _PyThunarx##x##_Type = (PyTypeObject *)PyDict_GetItemString(mdict, y); \
- if (_PyThunarx##x##_Type == NULL) { \
- PyErr_Print(); \
- return FALSE; \
- }
-
- IMPORT(Column, "Column");
- IMPORT(ColumnProvider, "ColumnProvider");
- IMPORT(InfoProvider, "InfoProvider");
- IMPORT(LocationWidgetProvider, "LocationWidgetProvider");
- IMPORT(Menu, "Menu");
- IMPORT(MenuItem, "MenuItem");
- IMPORT(MenuProvider, "MenuProvider");
- IMPORT(PropertyPage, "PropertyPage");
- IMPORT(PropertyPageProvider, "PropertyPageProvider");
-
-#undef IMPORT
-
- return TRUE;
-}
-
-void
-thunarx_module_initialize(GTypeModule *module)
-{
- gchar *user_extensions_dir;
- const gchar *env_string;
-
- env_string = g_getenv("NAUTILUS_PYTHON_DEBUG");
- if (env_string != NULL) {
- thunarx_python_debug = g_parse_debug_string(env_string,
- thunarx_python_debug_keys,
- thunarx_python_ndebug_keys);
- env_string = NULL;
- }
-
- debug_enter();
-
- all_types = g_array_new(FALSE, FALSE, sizeof(GType));
-
- thunarx_python_load_dir(module, NAUTILUS_EXTENSION_DIR "/python");
- user_extensions_dir = g_strdup_printf("%s/.thunarx/python-extensions/",
- g_get_home_dir());
- thunarx_python_load_dir(module, user_extensions_dir);
- g_free(user_extensions_dir);
-}
-
-void
-thunarx_module_shutdown(void)
-{
- debug_enter();
- if (Py_IsInitialized()) {
- Py_Finalize();
- }
- g_array_free(all_types, TRUE);
-}
-
-void
-thunarx_module_list_types(const GType **types,
- int *num_types)
-{
- debug_enter();
-
- *types = (GType*)all_types->data;
- *num_types = all_types->len;
-}
diff --git a/thunarx-python.h b/thunarx-python.h
deleted file mode 100644
index d6d8dec..0000000
--- a/thunarx-python.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * thunarx-python.c - Thunarx Python extension
- *
- * Copyright (C) 2004 Johan Dahlin
- *
- * This library 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 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#ifndef NAUTILUS_PYTHON_H
-#define NAUTILUS_PYTHON_H
-
-#include <glib-object.h>
-#include <glib/gprintf.h>
-#include <Python.h>
-
-#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
-typedef int Py_ssize_t;
-#define PY_SSIZE_T_MAX INT_MAX
-#define PY_SSIZE_T_MIN INT_MIN
-#endif
-
-typedef enum {
- NAUTILUS_PYTHON_DEBUG_MISC = 1 << 0,
-} ThunarxPythonDebug;
-
-extern ThunarxPythonDebug thunarx_python_debug;
-
-#define debug(x) { if (thunarx_python_debug & NAUTILUS_PYTHON_DEBUG_MISC) \
- g_printf( "thunarx-python:" x "\n"); }
-#define debug_enter() { if (thunarx_python_debug & NAUTILUS_PYTHON_DEBUG_MISC) \
- g_printf("%s: entered\n", __FUNCTION__); }
-#define debug_enter_args(x, y) { if (thunarx_python_debug & NAUTILUS_PYTHON_DEBUG_MISC) \
- g_printf("%s: entered " x "\n", __FUNCTION__, y); }
-
-
-PyTypeObject *_PyGtkWidget_Type;
-#define PyGtkWidget_Type (*_PyGtkWidget_Type)
-
-PyTypeObject *_PyThunarxColumn_Type;
-#define PyThunarxColumn_Type (*_PyThunarxColumn_Type)
-
-PyTypeObject *_PyThunarxColumnProvider_Type;
-#define PyThunarxColumnProvider_Type (*_PyThunarxColumnProvider_Type)
-
-PyTypeObject *_PyThunarxInfoProvider_Type;
-#define PyThunarxInfoProvider_Type (*_PyThunarxInfoProvider_Type)
-
-PyTypeObject *_PyThunarxLocationWidgetProvider_Type;
-#define PyThunarxLocationWidgetProvider_Type (*_PyThunarxLocationWidgetProvider_Type)
-
-PyTypeObject *_PyThunarxMenu_Type;
-#define PyThunarxMenu_Type (*_PyThunarxMenu_Type)
-
-PyTypeObject *_PyThunarxMenuItem_Type;
-#define PyThunarxMenuItem_Type (*_PyThunarxMenuItem_Type)
-
-PyTypeObject *_PyThunarxMenuProvider_Type;
-#define PyThunarxMenuProvider_Type (*_PyThunarxMenuProvider_Type)
-
-PyTypeObject *_PyThunarxPropertyPage_Type;
-#define PyThunarxPropertyPage_Type (*_PyThunarxPropertyPage_Type)
-
-PyTypeObject *_PyThunarxPropertyPageProvider_Type;
-#define PyThunarxPropertyPageProvider_Type (*_PyThunarxPropertyPageProvider_Type)
-
-#endif /* NAUTILUS_PYTHON_H */
diff --git a/thunarx.defs b/thunarx.defs
deleted file mode 100644
index 0e87d96..0000000
--- a/thunarx.defs
+++ /dev/null
@@ -1,320 +0,0 @@
-;; -*- scheme -*-
-; object definitions ...
-(define-object Column
- (in-module "Thunarx")
- (parent "GObject")
- (c-name "ThunarxColumn")
- (gtype-id "NAUTILUS_TYPE_COLUMN")
-)
-
-(define-interface ColumnProvider
- (in-module "Thunarx")
- (c-name "ThunarxColumnProvider")
- (gtype-id "NAUTILUS_TYPE_COLUMN_PROVIDER")
-)
-
-(define-interface FileInfo
- (in-module "Thunarx")
- (c-name "ThunarxFileInfo")
- (gtype-id "NAUTILUS_TYPE_FILE_INFO")
-)
-
-(define-interface InfoProvider
- (in-module "Thunarx")
- (c-name "ThunarxInfoProvider")
- (gtype-id "NAUTILUS_TYPE_INFO_PROVIDER")
-)
-
-(define-interface LocationWidgetProvider
- (in-module "Thunarx")
- (c-name "ThunarxLocationWidgetProvider")
- (gtype-id "NAUTILUS_TYPE_LOCATION_WIDGET_PROVIDER")
-)
-
-(define-object Menu
- (in-module "Thunarx")
- (parent "GObject")
- (c-name "ThunarxMenu")
- (gtype-id "NAUTILUS_TYPE_MENU")
-)
-
-(define-object MenuItem
- (in-module "Thunarx")
- (parent "GObject")
- (c-name "ThunarxMenuItem")
- (gtype-id "NAUTILUS_TYPE_MENU_ITEM")
-)
-
-(define-interface MenuProvider
- (in-module "Thunarx")
- (c-name "ThunarxMenuProvider")
- (gtype-id "NAUTILUS_TYPE_MENU_PROVIDER")
-)
-
-(define-object PropertyPage
- (in-module "Thunarx")
- (parent "GObject")
- (c-name "ThunarxPropertyPage")
- (gtype-id "NAUTILUS_TYPE_PROPERTY_PAGE")
-)
-
-(define-interface PropertyPageProvider
- (in-module "Thunarx")
- (c-name "ThunarxPropertyPageProvider")
- (gtype-id "NAUTILUS_TYPE_PROPERTY_PAGE_PROVIDER")
-)
-
-;; Enumerations and flags ...
-
-(define-enum OperationResult
- (in-module "Thunarx")
- (c-name "ThunarxOperationResult")
- (gtype-id "NAUTILUS_TYPE_OPERATION_RESULT")
- (values
- '("complete" "NAUTILUS_OPERATION_COMPLETE")
- '("failed" "NAUTILUS_OPERATION_FAILED")
- '("in-progress" "NAUTILUS_OPERATION_IN_PROGRESS")
- )
-)
-
-
-;; From /usr/include/thunarx/libthunarx-extension/thunarx-column.h
-
-(define-function thunarx_column_get_type
- (c-name "thunarx_column_get_type")
- (return-type "GType")
-)
-
-(define-function thunarx_column_new
- (c-name "thunarx_column_new")
- (is-constructor-of "ThunarxColumn")
- (return-type "ThunarxColumn*")
- (parameters
- '("const-char*" "name")
- '("const-char*" "attribute")
- '("const-char*" "label")
- '("const-char*" "description")
- )
-)
-
-
-
-;; From /usr/include/thunarx/libthunarx-extension/thunarx-extension-types.h
-
-(define-function thunarx_operation_result_get_type
- (c-name "thunarx_operation_result_get_type")
- (return-type "GType")
-)
-
-;; From /usr/include/thunarx/libthunarx-extension/thunarx-file-info.h
-
-(define-function thunarx_file_info_list_copy
- (c-name "thunarx_file_info_list_copy")
- (return-type "GList*")
- (parameters
- '("GList*" "files")
- )
-)
-
-(define-function thunarx_file_info_list_free
- (c-name "thunarx_file_info_list_free")
- (return-type "none")
- (parameters
- '("GList*" "files")
- )
-)
-
-(define-function thunarx_file_info_get_type
- (c-name "thunarx_file_info_get_type")
- (return-type "GType")
-)
-
-(define-method is_gone
- (of-object "ThunarxFileInfo")
- (c-name "thunarx_file_info_is_gone")
- (return-type "gboolean")
-)
-
-(define-method get_file_type
- (of-object "ThunarxFileInfo")
- (c-name "thunarx_file_info_get_file_type")
- (return-type "GFileType")
-)
-
-(define-method get_location
- (of-object "ThunarxFileInfo")
- (c-name "thunarx_file_info_get_location")
- (return-type "GFile")
-)
-
-(define-method get_name
- (of-object "ThunarxFileInfo")
- (c-name "thunarx_file_info_get_name")
- (return-type "char*")
-)
-
-(define-method get_uri
- (of-object "ThunarxFileInfo")
- (c-name "thunarx_file_info_get_uri")
- (return-type "char*")
-)
-
-(define-method get_activation_uri
- (of-object "ThunarxFileInfo")
- (c-name "thunarx_file_info_get_activation_uri")
- (return-type "char*")
-)
-
-(define-method get_parent_location
- (of-object "ThunarxFileInfo")
- (c-name "thunarx_file_info_get_parent_location")
- (return-type "GFile")
-)
-
-(define-method get_parent_uri
- (of-object "ThunarxFileInfo")
- (c-name "thunarx_file_info_get_parent_uri")
- (return-type "char*")
-)
-
-(define-method get_uri_scheme
- (of-object "ThunarxFileInfo")
- (c-name "thunarx_file_info_get_uri_scheme")
- (return-type "char*")
-)
-
-(define-method get_mime_type
- (of-object "ThunarxFileInfo")
- (c-name "thunarx_file_info_get_mime_type")
- (return-type "char*")
-)
-
-(define-method is_mime_type
- (of-object "ThunarxFileInfo")
- (c-name "thunarx_file_info_is_mime_type")
- (return-type "gboolean")
- (parameters
- '("const-char*" "mime_type")
- )
-)
-
-(define-method is_directory
- (of-object "ThunarxFileInfo")
- (c-name "thunarx_file_info_is_directory")
- (return-type "gboolean")
-)
-
-(define-method add_emblem
- (of-object "ThunarxFileInfo")
- (c-name "thunarx_file_info_add_emblem")
- (return-type "none")
- (parameters
- '("const-char*" "emblem_name")
- )
-)
-
-(define-method get_string_attribute
- (of-object "ThunarxFileInfo")
- (c-name "thunarx_file_info_get_string_attribute")
- (return-type "char*")
- (parameters
- '("const-char*" "attribute_name")
- )
-)
-
-(define-method add_string_attribute
- (of-object "ThunarxFileInfo")
- (c-name "thunarx_file_info_add_string_attribute")
- (return-type "none")
- (parameters
- '("const-char*" "attribute_name")
- '("const-char*" "value")
- )
-)
-
-(define-method invalidate_extension_info
- (of-object "ThunarxFileInfo")
- (c-name "thunarx_file_info_invalidate_extension_info")
- (return-type "none")
-)
-
-;; From /usr/include/thunarx/libthunarx-extension/thunarx-menu-item.h
-
-(define-function thunarx_menu_item_get_type
- (c-name "thunarx_menu_item_get_type")
- (return-type "GType")
-)
-
-(define-function thunarx_menu_new
- (c-name "thunarx_menu_new")
- (is-constructor-of "ThunarxMenu")
- (return-type "ThunarxMenu*")
-)
-
-(define-method append_item
- (of-object "ThunarxMenu")
- (c-name "thunarx_menu_append_item")
- (return-type "none")
- (parameters
- '("ThunarxMenuItem*" "item")
- )
-)
-
-(define-method get_items
- (of-object "ThunarxMenu")
- (c-name "thunarx_menu_get_items")
- (return-type "GList*")
-)
-
-(define-function thunarx_menu_item_list_free
- (c-name "thunarx_menu_item_list_free")
- (return-type "none")
- (parameters
- '("GList*", "item_list")
- )
-)
-
-(define-function thunarx_menu_item_new
- (c-name "thunarx_menu_item_new")
- (is-constructor-of "ThunarxMenuItem")
- (return-type "ThunarxMenuItem*")
- (parameters
- '("const-char*" "name")
- '("const-char*" "label")
- '("const-char*" "tip")
- '("const-char*" "icon" (null-ok) (default "NULL"))
- )
-)
-
-(define-method set_submenu
- (of-object "ThunarxMenuItem")
- (c-name "thunarx_menu_item_set_submenu")
- (return-type "none")
- (parameters
- '("ThunarxMenu*" "menu")
- )
-)
-
-(define-method activate
- (of-object "ThunarxMenuItem")
- (c-name "thunarx_menu_item_activate")
- (return-type "none")
-)
-
-;; From /usr/include/thunarx/libthunarx-extension/thunarx-property-page.h
-
-(define-function thunarx_property_page_get_type
- (c-name "thunarx_property_page_get_type")
- (return-type "GType")
-)
-
-(define-function thunarx_property_page_new
- (c-name "thunarx_property_page_new")
- (is-constructor-of "ThunarxPropertyPage")
- (return-type "ThunarxPropertyPage*")
- (parameters
- '("const-char*" "name")
- '("GtkWidget*" "label")
- '("GtkWidget*" "page")
- )
-)
diff --git a/thunarx.override b/thunarx.override
deleted file mode 100644
index ea72b09..0000000
--- a/thunarx.override
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 4 -*-
- * Copyright (C) 2004 Johan Dahlin
- *
- * thunarx.override: overrides for the thunarx extension library
- *
- * This library 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 library 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 library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-%%
-headers
-#define NO_IMPORT_PYGOBJECT
-#include "pygobject.h"
-
-#include "pygnomevfs.h"
-
-#include <thunarx/thunarx-file-info.h>
-#include <thunarx/thunarx-info-provider.h>
-#include <thunarx/thunarx-column-provider.h>
-#include <thunarx/thunarx-location-widget-provider.h>
-#include <thunarx/thunarx-menu-provider.h>
-#include <thunarx/thunarx-property-page-provider.h>
-
-%%
-modulename thunarx
-%%
-import gobject.GObject as PyGObject_Type
-import gtk.Widget as PyGtkWidget_Type
-import gtk.Window as PyGtkWindow_Type
-%%
-ignore-glob
- *_get_type
-%%
-override thunarx_file_info_get_vfs_file_info noargs
-static PyObject *
-_wrap_thunarx_file_info_get_vfs_file_info(PyGObject *self)
-{
- GnomeVFSFileInfo *ret;
-
- ret = thunarx_file_info_get_vfs_file_info(NAUTILUS_FILE_INFO(self->obj));
- if (ret) {
- return pygnome_vfs_file_info_new(ret);
- }
-
- Py_INCREF(Py_None);
- return Py_None;
-}
diff --git a/thunarxmodule.c b/thunarxmodule.c
deleted file mode 100644
index a72ac2e..0000000
--- a/thunarxmodule.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 4 -*-
- * Copyright (C) 2004 Johan Dahlin
- *
- * thunarx.override: overrides for the thunarx extension library
- *
- * This library 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 library 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 library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-/* include this first, before NO_IMPORT_PYGOBJECT is defined */
-#include <pygobject.h>
-#include <pygtk/pygtk.h>
-#include "pygnomevfs.h"
-
-void pythunarx_register_classes (PyObject *d);
-void pythunarx_add_constants(PyObject *module, const gchar *strip_prefix);
-
-extern PyMethodDef pythunarx_functions[];
-
-DL_EXPORT(void)
-initthunarx(void)
-{
- PyObject *m, *d;
-
- if (!g_getenv("INSIDE_NAUTILUS_PYTHON")) {
- Py_FatalError("This module can only be used from thunarx");
- return;
- }
-
- init_pygobject ();
- init_pygtk ();
- init_pygnomevfs();
-
- m = Py_InitModule ("thunarx", pythunarx_functions);
- d = PyModule_GetDict (m);
-
- pythunarx_register_classes (d);
- pythunarx_add_constants(m, "NAUTILUS_");
-}
More information about the Xfce4-commits
mailing list