[Xfce4-commits] <thunarx-python:master> More cleaning up and removing stuff I don't understand

Adam Plumb noreply at xfce.org
Thu May 27 18:10:13 CEST 2010


Updating branch refs/heads/master
         to 685ec8321d745c1e9c073a219920f04062c87e5b (commit)
       from dcc1181f1821ef4c2dd1afc8d72cf550a90cce9c (commit)

commit 685ec8321d745c1e9c073a219920f04062c87e5b
Author: Adam Plumb <adamplumb at gmail.com>
Date:   Fri Sep 18 13:03:20 2009 -0400

    More cleaning up and removing stuff I don't understand

 src/thunarx-python-object.c |  217 +-----------------------------------------
 src/thunarx-python.c        |   12 +--
 src/thunarx-python.h        |   12 ---
 src/thunarx.defs            |  175 ----------------------------------
 src/thunarx.override        |   53 -----------
 5 files changed, 9 insertions(+), 460 deletions(-)

diff --git a/src/thunarx-python-object.c b/src/thunarx-python-object.c
index 6cfc273..cb6762c 100644
--- a/src/thunarx-python-object.c
+++ b/src/thunarx-python-object.c
@@ -30,12 +30,8 @@
 #include <pygobject.h>
 
 /* Thunarx extension headers */
-#include <thunarx/thunarx-file-info.h>
-#include <thunarx/thunarx-info-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>
 
@@ -95,90 +91,9 @@ static GObjectClass *parent_class;
     	}                                                              \
     }
 
-#define METHOD_NAME "get_property_pages"
+#define METHOD_NAME "get_file_actions"
 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,
+thunarx_python_object_get_file_actions (ThunarxMenuProvider *provider,
 									   GtkWidget *window,
 									   GList *files)
 {
@@ -206,9 +121,9 @@ thunarx_python_object_get_file_items (ThunarxMenuProvider *provider,
 }
 #undef METHOD_NAME
 
-#define METHOD_NAME "get_background_items"
+#define METHOD_NAME "get_folder_actions"
 static GList *
-thunarx_python_object_get_background_items (ThunarxMenuProvider *provider,
+thunarx_python_object_get_folder_actions (ThunarxMenuProvider *provider,
 											 GtkWidget *window,
 											 ThunarxFileInfo *file)
 {
@@ -237,95 +152,11 @@ thunarx_python_object_get_background_items (ThunarxMenuProvider *provider,
 }
 #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 "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 = THUNARX_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;
+	iface->get_folder_actions = thunarx_python_object_get_folder_actions;
+	iface->get_file_actions = thunarx_python_object_get_file_actions;
 }
 
 static void 
@@ -369,18 +200,6 @@ thunarx_python_object_get_type (GTypeModule *module,
 	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,
@@ -388,12 +207,6 @@ thunarx_python_object_get_type (GTypeModule *module,
 		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);
 	
@@ -413,29 +226,11 @@ thunarx_python_object_get_type (GTypeModule *module,
 										 type_name,
 										 info, 0);
 
-	if (PyObject_IsSubclass(type, (PyObject*)&PyThunarxPropertyPageProvider_Type)) {
-		g_type_module_add_interface (module, gtype, 
-									 THUNARX_TYPE_PROPERTY_PAGE_PROVIDER,
-									 &property_page_provider_iface_info);
-	}
-
-	if (PyObject_IsSubclass(type, (PyObject*)&PyThunarxLocationWidgetProvider_Type)) {
-		g_type_module_add_interface (module, gtype,
-									 THUNARX_TYPE_LOCATION_WIDGET_PROVIDER,
-									 &location_widget_provider_iface_info);
-	}
-	
 	if (PyObject_IsSubclass(type, (PyObject*)&PyThunarxMenuProvider_Type)) {
 		g_type_module_add_interface (module, gtype, 
 									 THUNARX_TYPE_MENU_PROVIDER,
 									 &menu_provider_iface_info);
 	}
 
-	if (PyObject_IsSubclass(type, (PyObject*)&PyThunarxInfoProvider_Type)) {
-		g_type_module_add_interface (module, gtype, 
-									 THUNARX_TYPE_INFO_PROVIDER,
-									 &info_provider_iface_info);
-	}
-	
 	return gtype;
 }
diff --git a/src/thunarx-python.c b/src/thunarx-python.c
index 7614b38..252150b 100644
--- a/src/thunarx-python.c
+++ b/src/thunarx-python.c
@@ -137,10 +137,7 @@ thunarx_python_load_file(GTypeModule *type_module, const gchar *filename)
 		if (!PyType_Check(value))
 			continue;
 
-		if (PyObject_IsSubclass(value, (PyObject*)&PyThunarxInfoProvider_Type) ||
-			PyObject_IsSubclass(value, (PyObject*)&PyThunarxLocationWidgetProvider_Type) ||
-			PyObject_IsSubclass(value, (PyObject*)&PyThunarxMenuProvider_Type) ||
-			PyObject_IsSubclass(value, (PyObject*)&PyThunarxPropertyPageProvider_Type)) {
+		if (PyObject_IsSubclass(value, (PyObject*)&PyThunarxMenuProvider_Type)) {
 			
 			gtype = thunarx_python_object_get_type(type_module, value);
 			g_array_append_val(all_types, gtype);
@@ -278,7 +275,7 @@ thunarx_python_init_python (void)
 	debug("sys.path.insert(0, ...)");
 	sys_path = PySys_GetObject("path");
 	PyList_Insert(sys_path, 0,
-				  (tmp = PyString_FromString(THUNARX_LIBDIR "/thunarx-python")));
+				  (tmp = PyString_FromString("/usr/lib/thunarx-1/thunarx-python")));
 	Py_DECREF(tmp);
 	
 	/* import thunarx */
@@ -303,13 +300,10 @@ thunarx_python_init_python (void)
 		return FALSE; \
 	}
 
-	IMPORT(InfoProvider, "InfoProvider");
-	IMPORT(LocationWidgetProvider, "LocationWidgetProvider");
+
 	IMPORT(Menu, "Menu");
 	IMPORT(MenuItem, "MenuItem");
 	IMPORT(MenuProvider, "MenuProvider");
-	IMPORT(PropertyPage, "PropertyPage");
-	IMPORT(PropertyPageProvider, "PropertyPageProvider");
 
 #undef IMPORT
 	
diff --git a/src/thunarx-python.h b/src/thunarx-python.h
index f3d813c..7d7d61e 100644
--- a/src/thunarx-python.h
+++ b/src/thunarx-python.h
@@ -49,12 +49,6 @@ extern ThunarxPythonDebug thunarx_python_debug;
 PyTypeObject *_PyGtkWidget_Type;
 #define PyGtkWidget_Type (*_PyGtkWidget_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)
 
@@ -64,10 +58,4 @@ PyTypeObject *_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 /* THUNARX_PYTHON_H */
diff --git a/src/thunarx.defs b/src/thunarx.defs
index d0853a4..a6431d3 100644
--- a/src/thunarx.defs
+++ b/src/thunarx.defs
@@ -1,24 +1,6 @@
 ;; -*- scheme -*-
 ; object definitions ...
 
-(define-interface FileInfo
-  (in-module "Thunarx")
-  (c-name "ThunarxFileInfo")
-  (gtype-id "THUNARX_TYPE_FILE_INFO")
-)
-
-(define-interface InfoProvider
-  (in-module "Thunarx")
-  (c-name "ThunarxInfoProvider")
-  (gtype-id "THUNARX_TYPE_INFO_PROVIDER")
-)
-
-(define-interface LocationWidgetProvider
-  (in-module "Thunarx")
-  (c-name "ThunarxLocationWidgetProvider")
-  (gtype-id "THUNARX_TYPE_LOCATION_WIDGET_PROVIDER")
-)
-
 (define-object Menu
   (in-module "Thunarx")
   (parent "GObject")
@@ -39,19 +21,6 @@
   (gtype-id "THUNARX_TYPE_MENU_PROVIDER")
 )
 
-(define-object PropertyPage
-  (in-module "Thunarx")
-  (parent "GObject")
-  (c-name "ThunarxPropertyPage")
-  (gtype-id "THUNARX_TYPE_PROPERTY_PAGE")
-)
-
-(define-interface PropertyPageProvider
-  (in-module "Thunarx")
-  (c-name "ThunarxPropertyPageProvider")
-  (gtype-id "THUNARX_TYPE_PROPERTY_PAGE_PROVIDER")
-)
-
 ;; Enumerations and flags ...
 
 (define-enum OperationResult
@@ -73,132 +42,6 @@
   (return-type "GType")
 )
 
-;; From /usr/include/thunarx-1/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_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 has_mime_type
-  (of-object "ThunarxFileInfo")
-  (c-name "thunarx_file_info_has_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-1/libthunarx-extension/thunarx-menu-item.h
 
 (define-function thunarx_menu_item_get_type
@@ -255,21 +98,3 @@
   (c-name "thunarx_menu_item_activate")
   (return-type "none")
 )
-
-;; From /usr/include/thunarx-1/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/src/thunarx.override b/src/thunarx.override
deleted file mode 100644
index c95f712..0000000
--- a/src/thunarx.override
+++ /dev/null
@@ -1,53 +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.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(THUNARX_FILE_INFO(self->obj));
-    if (ret) {
-        return pygnome_vfs_file_info_new(ret);
-    }
-    
-    Py_INCREF(Py_None);
-    return Py_None;
-}



More information about the Xfce4-commits mailing list