diff options
author | monsta <[email protected]> | 2016-11-21 22:24:00 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2016-11-21 22:24:00 +0300 |
commit | e85aca3ba0c5f59b12fd557285cc74dbbb8bf909 (patch) | |
tree | 110b2bd894f1ba0dee8ab3968590b13ce41b7357 | |
parent | 2d9c33aa5d3020beb58866279d1a9bead67a617b (diff) | |
download | eom-e85aca3ba0c5f59b12fd557285cc74dbbb8bf909.tar.bz2 eom-e85aca3ba0c5f59b12fd557285cc74dbbb8bf909.tar.xz |
drop Python plugins support and --enable-python build option
it requires PyGTK so won't even build with GTK+3
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | bindings/Makefile.am | 7 | ||||
-rw-r--r-- | bindings/python/Makefile.am | 77 | ||||
-rw-r--r-- | bindings/python/eom.defs | 1230 | ||||
-rw-r--r-- | bindings/python/eom.override | 126 | ||||
-rw-r--r-- | configure.ac | 114 | ||||
-rw-r--r-- | doc/reference/Makefile.am | 4 | ||||
-rw-r--r-- | doc/reference/eom-sections.txt | 1 | ||||
-rw-r--r-- | src/Makefile.am | 25 | ||||
-rw-r--r-- | src/eom-plugin-engine.c | 83 | ||||
-rw-r--r-- | src/eom-plugin-engine.h | 3 | ||||
-rw-r--r-- | src/eom-python-module.c | 527 | ||||
-rw-r--r-- | src/eom-python-module.h | 72 | ||||
-rw-r--r-- | src/eom-python-plugin.c | 282 | ||||
-rw-r--r-- | src/eom-python-plugin.h | 55 | ||||
-rw-r--r-- | src/eom-window.c | 4 |
17 files changed, 5 insertions, 2610 deletions
diff --git a/Makefile.am b/Makefile.am index b12d22c..aaabc08 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,7 +4,7 @@ if ENABLE_JPEG jpeg_DIRS = jpegutils endif -SUBDIRS = $(jpeg_DIRS) cut-n-paste bindings src man plugins po help data doc +SUBDIRS = $(jpeg_DIRS) cut-n-paste src man plugins po help data doc EXTRA_DIST = \ AUTHORS \ @@ -43,8 +43,7 @@ In order to make 'Eye of MATE' work as a single instance application you'll need D-Bus installed in your system. You can get it from http://www.freedesktop.org/wiki/Software/dbus . -Other optional dependencies include Little cms for color management, -Python, pygtk, and mate-python for python plugins support, and +Other optional dependencies include Little cms for color management and Exempi for XMP metadata reading. Availability diff --git a/bindings/Makefile.am b/bindings/Makefile.am deleted file mode 100644 index 8f1fc83..0000000 --- a/bindings/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -SUBDIRS = - -if ENABLE_PYTHON -SUBDIRS += python -endif - --include $(top_srcdir)/git.mk diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am deleted file mode 100644 index 9841596..0000000 --- a/bindings/python/Makefile.am +++ /dev/null @@ -1,77 +0,0 @@ -noinst_LTLIBRARIES = \ - eom.la - -nodist_eom_la_SOURCES = \ - eom.c - -eom_la_LDFLAGS = \ - -module -avoid-version - -eom_la_LIBADD = \ - $(PYTHON_LIB_LOC) \ - $(PYTHON_LIBS) \ - $(PYTHON_EXTRA_LIBS) \ - $(PYGTK_LIBS) - -eom_la_CFLAGS = \ - -I$(top_srcdir) \ - -I$(top_builddir) \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src \ - -I$(top_srcdir)/cut-n-paste/toolbar-editor \ - $(EOM_CFLAGS) \ - $(NO_STRICT_ALIASING_CFLAGS) \ - $(PYGTK_CFLAGS) \ - $(PYTHON_CFLAGS) \ - $(AM_CFLAGS) - -$(top_builddir)/src/eom-enum-types.h: - $(AM_V_GEN)cd $(top_builddir)/src && $(MAKE) eom-enum-types.h - -eom.c: eom.defs eom.override $(top_builddir)/src/eom-enum-types.h - $(AM_V_GEN)( cd $(srcdir) && $(PYGOBJECT_CODEGEN) \ - --register $(PYGOBJECT_DEFSDIR)/gio-types.defs \ - --register $(PYGTK_DEFSDIR)/pango-types.defs \ - --register $(PYGTK_DEFSDIR)/gdk-types.defs \ - --register $(PYGTK_DEFSDIR)/gtk-types.defs \ - --override $*.override \ - --prefix py$* $(<F) ) > $@ - -BINDING_EOM_HEADERS_SRCDIR_IN = \ - src/eom-application.h \ - src/eom-window.h \ - src/eom-dialog.h \ - src/eom-properties-dialog.h \ - src/eom-message-area.h \ - src/eom-statusbar.h \ - src/eom-thumb-nav.h \ - src/eom-image.h \ - src/eom-scroll-view.h \ - src/eom-thumb-view.h \ - src/eom-list-store.h \ - src/eom-job-queue.h \ - src/eom-jobs.h \ - src/eom-plugin.h - -BINDING_HEADERS_BUILDDIR_IN = - -BINDING_EOM_HEADERS_SRCDIR := $(addprefix $(top_srcdir)/,$(BINDING_EOM_HEADERS_SRCDIR_IN)) - -BINDING_HEADERS_BUILDDIR := $(addprefix $(top_builddir)/,$(BINDING_HEADERS_BUILDDIR_IN)) - -regenerate-python-binding: - $(PYGTK_H2DEF) $(sort $(BINDING_EOM_HEADERS_SRCDIR) $(BINDING_HEADERS_BUILDDIR)) > eom.defs.new - -BUILT_SOURCES = \ - eom.c - -EXTRA_DIST = \ - eom.override \ - eom.defs - -CLEANFILES = $(BUILT_SOURCES) - -dist-hook: - cd $(distdir); rm -f $(BUILT_SOURCES) - --include $(top_srcdir)/git.mk diff --git a/bindings/python/eom.defs b/bindings/python/eom.defs deleted file mode 100644 index 7d6d272..0000000 --- a/bindings/python/eom.defs +++ /dev/null @@ -1,1230 +0,0 @@ -;; -*- scheme -*- -; object definitions ... -(define-object Application - (in-module "Eom") - (parent "GObject") - (c-name "EomApplication") - (gtype-id "EOM_TYPE_APPLICATION") -) - -(define-object Dialog - (in-module "Eom") - (parent "GObject") - (c-name "EomDialog") - (gtype-id "EOM_TYPE_DIALOG") -) - -(define-object Image - (in-module "Eom") - (parent "GObject") - (c-name "EomImage") - (gtype-id "EOM_TYPE_IMAGE") -) - -(define-object Job - (in-module "Eom") - (parent "GObject") - (c-name "EomJob") - (gtype-id "EOM_TYPE_JOB") -) - -(define-object JobLoad - (in-module "Eom") - (parent "EomJob") - (c-name "EomJobLoad") - (gtype-id "EOM_TYPE_JOB_LOAD") -) - -(define-object JobModel - (in-module "Eom") - (parent "EomJob") - (c-name "EomJobModel") - (gtype-id "EOM_TYPE_JOB_MODEL") -) - -(define-object JobSave - (in-module "Eom") - (parent "EomJob") - (c-name "EomJobSave") - (gtype-id "EOM_TYPE_JOB_SAVE") -) - -(define-object JobSaveAs - (in-module "Eom") - (parent "EomJobSave") - (c-name "EomJobSaveAs") - (gtype-id "EOM_TYPE_JOB_SAVE_AS") -) - -(define-object JobThumbnail - (in-module "Eom") - (parent "EomJob") - (c-name "EomJobThumbnail") - (gtype-id "EOM_TYPE_JOB_THUMBNAIL") -) - -(define-object JobTransform - (in-module "Eom") - (parent "EomJob") - (c-name "EomJobTransform") - (gtype-id "EOM_TYPE_JOB_TRANSFORM") -) - -(define-object ListStore - (in-module "Eom") - (parent "GtkListStore") - (c-name "EomListStore") - (gtype-id "EOM_TYPE_LIST_STORE") -) - -(define-object Plugin - (in-module "Eom") - (parent "GObject") - (c-name "EomPlugin") - (gtype-id "EOM_TYPE_PLUGIN") -) - -(define-object PropertiesDialog - (in-module "Eom") - (parent "EomDialog") - (c-name "EomPropertiesDialog") - (gtype-id "EOM_TYPE_PROPERTIES_DIALOG") -) - -(define-object ScrollView - (in-module "Eom") - (parent "GtkTable") - (c-name "EomScrollView") - (gtype-id "EOM_TYPE_SCROLL_VIEW") -) - -(define-object Sidebar - (in-module "Eom") - (parent "GtkVBox") - (c-name "EomSidebar") - (gtype-id "EOM_TYPE_SIDEBAR") -) - -(define-object Statusbar - (in-module "Eom") - (parent "GtkStatusbar") - (c-name "EomStatusbar") - (gtype-id "EOM_TYPE_STATUSBAR") -) - -(define-object ThumbNav - (in-module "Eom") - (parent "GtkHBox") - (c-name "EomThumbNav") - (gtype-id "EOM_TYPE_THUMB_NAV") -) - -(define-object ThumbView - (in-module "Eom") - (parent "GtkIconView") - (c-name "EomThumbView") - (gtype-id "EOM_TYPE_THUMB_VIEW") -) - -(define-object Window - (in-module "Eom") - (parent "GtkWindow") - (c-name "EomWindow") - (gtype-id "EOM_TYPE_WINDOW") -) - -;; Enumerations and flags ... - -(define-flags ImageData - (in-module "Eom") - (c-name "EomImageData") - (gtype-id "EOM_TYPE_IMAGE_DATA") - (values - '("image" "EOM_IMAGE_DATA_IMAGE") - '("dimension" "EOM_IMAGE_DATA_DIMENSION") - '("exif" "EOM_IMAGE_DATA_EXIF") - ) -) - -(define-enum ImageError - (in-module "Eom") - (c-name "EomImageError") - (gtype-id "EOM_TYPE_IMAGE_ERROR") - (values - '("save-not-local" "EOM_IMAGE_ERROR_SAVE_NOT_LOCAL") - '("not-loaded" "EOM_IMAGE_ERROR_NOT_LOADED") - '("vfs" "EOM_IMAGE_ERROR_VFS") - '("file-exists" "EOM_IMAGE_ERROR_FILE_EXISTS") - '("tmp-file-failed" "EOM_IMAGE_ERROR_TMP_FILE_FAILED") - '("generic" "EOM_IMAGE_ERROR_GENERIC") - '("unknown" "EOM_IMAGE_ERROR_UNKNOWN") - ) -) - -(define-enum ImageStatus - (in-module "Eom") - (c-name "EomImageStatus") - (gtype-id "EOM_TYPE_IMAGE_STATUS") - (values - '("unknown" "EOM_IMAGE_STATUS_UNKNOWN") - '("loading" "EOM_IMAGE_STATUS_LOADING") - '("loaded" "EOM_IMAGE_STATUS_LOADED") - '("failed" "EOM_IMAGE_STATUS_FAILED") - ) -) - -(define-enum JobSaveResponse - (in-module "Eom") - (c-name "EomJobSaveResponse") - (gtype-id "EOM_TYPE_JOB_SAVE_RESPONSE") - (values - '("none" "EOM_SAVE_RESPONSE_NONE") - '("retry" "EOM_SAVE_RESPONSE_RETRY") - '("skip" "EOM_SAVE_RESPONSE_SKIP") - '("overwrite" "EOM_SAVE_RESPONSE_OVERWRITE") - '("cancel" "EOM_SAVE_RESPONSE_CANCEL") - '("last" "EOM_SAVE_RESPONSE_LAST") - ) -) - -(define-enum ListStoreColumn - (in-module "Eom") - (c-name "EomListStoreColumn") - (gtype-id "EOM_TYPE_LIST_STORE_COLUMN") - (values - '("thumbnail" "EOM_LIST_STORE_THUMBNAIL") - '("thumb-set" "EOM_LIST_STORE_THUMB_SET") - '("eom-image" "EOM_LIST_STORE_EOM_IMAGE") - '("eom-job" "EOM_LIST_STORE_EOM_JOB") - '("num-columns" "EOM_LIST_STORE_NUM_COLUMNS") - ) -) - -(define-enum PropertiesDialogPage - (in-module "Eom") - (c-name "EomPropertiesDialogPage") - (gtype-id "EOM_TYPE_PROPERTIES_DIALOG_PAGE") - (values - '("general" "EOM_PROPERTIES_DIALOG_PAGE_GENERAL") - '("exif" "EOM_PROPERTIES_DIALOG_PAGE_EXIF") - ) -) - -(define-enum TransparencyStyle - (in-module "Eom") - (c-name "EomTransparencyStyle") - (gtype-id "EOM_TYPE_TRANSPARENCY_STYLE") - (values - '("background" "EOM_TRANSP_BACKGROUND") - '("checked" "EOM_TRANSP_CHECKED") - '("color" "EOM_TRANSP_COLOR") - ) -) - -(define-enum ThumbNavMode - (in-module "Eom") - (c-name "EomThumbNavMode") - (gtype-id "EOM_TYPE_THUMB_NAV_MODE") - (values - '("one-row" "EOM_THUMB_NAV_MODE_ONE_ROW") - '("one-column" "EOM_THUMB_NAV_MODE_ONE_COLUMN") - '("multiple-rows" "EOM_THUMB_NAV_MODE_MULTIPLE_ROWS") - '("multiple-columns" "EOM_THUMB_NAV_MODE_MULTIPLE_COLUMNS") - ) -) - -(define-enum ThumbViewSelectionChange - (in-module "Eom") - (c-name "EomThumbViewSelectionChange") - (gtype-id "EOM_TYPE_THUMB_VIEW_SELECTION_CHANGE") - (values - '("left" "EOM_THUMB_VIEW_SELECT_LEFT") - '("right" "EOM_THUMB_VIEW_SELECT_RIGHT") - '("first" "EOM_THUMB_VIEW_SELECT_FIRST") - '("last" "EOM_THUMB_VIEW_SELECT_LAST") - ) -) - -(define-enum WindowMode - (in-module "Eom") - (c-name "EomWindowMode") - (gtype-id "EOM_TYPE_WINDOW_MODE") - (values - '("unknown" "EOM_WINDOW_MODE_UNKNOWN") - '("normal" "EOM_WINDOW_MODE_NORMAL") - '("fullscreen" "EOM_WINDOW_MODE_FULLSCREEN") - '("slideshow" "EOM_WINDOW_MODE_SLIDESHOW") - ) -) - -(define-enum WindowError - (in-module "Eom") - (c-name "EomWindowError") - (gtype-id "EOM_TYPE_WINDOW_ERROR") - (values - '("control-not-found" "EOM_WINDOW_ERROR_CONTROL_NOT_FOUND") - '("ui-not-found" "EOM_WINDOW_ERROR_UI_NOT_FOUND") - '("no-persist-file-interface" "EOM_WINDOW_ERROR_NO_PERSIST_FILE_INTERFACE") - '("io" "EOM_WINDOW_ERROR_IO") - '("trash-not-found" "EOM_WINDOW_ERROR_TRASH_NOT_FOUND") - '("generic" "EOM_WINDOW_ERROR_GENERIC") - '("unknown" "EOM_WINDOW_ERROR_UNKNOWN") - ) -) - -(define-flags StartupFlags - (in-module "Eom") - (c-name "EomStartupFlags") - (gtype-id "EOM_TYPE_STARTUP_FLAGS") - (values - '("fullscreen" "EOM_STARTUP_FULLSCREEN") - '("slide-show" "EOM_STARTUP_SLIDE_SHOW") - '("disable-collection" "EOM_STARTUP_DISABLE_COLLECTION") - ) -) - - -;; From eom-application.h - -(define-function eom_application_get_type - (c-name "eom_application_get_type") - (return-type "GType") -) - -(define-function eom_application_get_instance - (c-name "eom_application_get_instance") - (return-type "EomApplication*") -) - -(define-method shutdown - (of-object "EomApplication") - (c-name "eom_application_shutdown") - (return-type "none") -) - -(define-method open_window - (of-object "EomApplication") - (c-name "eom_application_open_window") - (return-type "gboolean") - (parameters - '("guint" "timestamp") - '("EomStartupFlags" "flags") - '("GError**" "error") - ) -) - -(define-method open_uri_list - (of-object "EomApplication") - (c-name "eom_application_open_uri_list") - (return-type "gboolean") - (parameters - '("GSList*" "uri_list") - '("guint" "timestamp") - '("EomStartupFlags" "flags") - '("GError**" "error") - ) -) - -(define-method get_windows - (of-object "EomApplication") - (c-name "eom_application_get_windows") - (return-type "GList*") -) - - - - -;; From eom-dialog.h - -(define-function eom_dialog_get_type - (c-name "eom_dialog_get_type") - (return-type "GType") -) - -(define-method construct - (of-object "EomDialog") - (c-name "eom_dialog_construct") - (return-type "none") - (parameters - '("const-gchar*" "ui_file") - '("const-gchar*" "dlg_node") - ) -) - -(define-method show - (of-object "EomDialog") - (c-name "eom_dialog_show") - (return-type "none") -) - -(define-method hide - (of-object "EomDialog") - (c-name "eom_dialog_hide") - (return-type "none") -) - -(define-method get_controls - (of-object "EomDialog") - (c-name "eom_dialog_get_controls") - (return-type "none") - (parameters - '("const-gchar*" "property_id") - ) - (varargs #t) -) - - - -;; From eom-image.h - -(define-function eom_image_get_type - (c-name "eom_image_get_type") - (return-type "GType") -) - -(define-function eom_image_new - (c-name "eom_image_new") - (is-constructor-of "EomImage") - (return-type "EomImage*") - (parameters - '("const-char*" "txt_uri") - ) -) - -(define-function eom_image_new_file - (c-name "eom_image_new_file") - (return-type "EomImage*") - (parameters - '("GFile*" "file") - ) -) - -(define-method has_data - (of-object "EomImage") - (c-name "eom_image_has_data") - (return-type "gboolean") - (parameters - '("EomImageData" "data") - ) -) - -(define-method load - (of-object "EomImage") - (c-name "eom_image_load") - (return-type "gboolean") - (parameters - '("EomImageData" "data2read") - '("EomJob*" "job" (null-ok)) - '("GError**" "error") - ) -) - -(define-method set_thumbnail - (of-object "EomImage") - (c-name "eom_image_set_thumbnail") - (return-type "none") - (parameters - '("GdkPixbuf*" "pixbuf") - ) -) - -(define-method get_pixbuf - (of-object "EomImage") - (c-name "eom_image_get_pixbuf") - (return-type "GdkPixbuf*") -) - -(define-method get_thumbnail - (of-object "EomImage") - (c-name "eom_image_get_thumbnail") - (return-type "GdkPixbuf*") -) - -(define-method get_size - (of-object "EomImage") - (c-name "eom_image_get_size") - (return-type "none") - (parameters - '("gint*" "width") - '("gint*" "height") - ) -) - -(define-method get_bytes - (of-object "EomImage") - (c-name "eom_image_get_bytes") - (return-type "goffset") -) - -(define-method is_modified - (of-object "EomImage") - (c-name "eom_image_is_modified") - (return-type "gboolean") -) - -(define-method modified - (of-object "EomImage") - (c-name "eom_image_modified") - (return-type "none") -) - -(define-method get_caption - (of-object "EomImage") - (c-name "eom_image_get_caption") - (return-type "const-gchar*") -) - -(define-method get_exif_info - (of-object "EomImage") - (c-name "eom_image_get_exif_info") - (return-type "gpointer") -) - -(define-method get_file - (of-object "EomImage") - (c-name "eom_image_get_file") - (return-type "GFile*") -) - -(define-method get_uri_for_display - (of-object "EomImage") - (c-name "eom_image_get_uri_for_display") - (return-type "gchar*") -) - -(define-method undo - (of-object "EomImage") - (c-name "eom_image_undo") - (return-type "none") -) - - - -;; From eom-job-queue.h - -(define-method queue_add_job - (of-object "EomJob") - (c-name "eom_job_queue_add_job") - (return-type "none") -) - -(define-method queue_remove_job - (of-object "EomJob") - (c-name "eom_job_queue_remove_job") - (return-type "gboolean") -) - - - -;; From eom-jobs.h - -(define-function eom_job_get_type - (c-name "eom_job_get_type") - (return-type "GType") -) - -(define-method finished - (of-object "EomJob") - (c-name "eom_job_finished") - (return-type "none") -) - -(define-method run - (of-object "EomJob") - (c-name "eom_job_run") - (return-type "none") -) - -(define-method set_progress - (of-object "EomJob") - (c-name "eom_job_set_progress") - (return-type "none") - (parameters - '("float" "progress") - ) -) - -(define-function eom_job_thumbnail_get_type - (c-name "eom_job_thumbnail_get_type") - (return-type "GType") -) - -(define-function eom_job_thumbnail_new - (c-name "eom_job_thumbnail_new") - (is-constructor-of "EomJobThumbnail") - (return-type "EomJob*") - (parameters - '("EomImage*" "image") - ) -) - -(define-function eom_job_load_get_type - (c-name "eom_job_load_get_type") - (return-type "GType") -) - -(define-function eom_job_load_new - (c-name "eom_job_load_new") - (is-constructor-of "EomJobLoad") - (return-type "EomJob*") - (parameters - '("EomImage*" "image") - '("EomImageData" "data") - ) -) - -(define-function eom_job_model_get_type - (c-name "eom_job_model_get_type") - (return-type "GType") -) - -(define-function eom_job_model_new - (c-name "eom_job_model_new") - (is-constructor-of "EomJobModel") - (return-type "EomJob*") - (parameters - '("GSList*" "uri_list") - ) -) - -(define-function eom_job_transform_get_type - (c-name "eom_job_transform_get_type") - (return-type "GType") -) - -(define-function eom_job_transform_new - (c-name "eom_job_transform_new") - (is-constructor-of "EomJobTransform") - (return-type "EomJob*") - (parameters - '("GList*" "images") - '("EomTransform*" "trans") - ) -) - -;; From eom-list-store.h - -(define-function eom_list_store_get_type - (c-name "eom_list_store_get_type") - (return-type "GType") -) - -(define-function eom_list_store_new - (c-name "eom_list_store_new") - (is-constructor-of "EomListStore") - (return-type "GtkListStore*") -) - -(define-method append_image - (of-object "EomListStore") - (c-name "eom_list_store_append_image") - (return-type "none") - (parameters - '("EomImage*" "image") - ) -) - -(define-method add_uris - (of-object "EomListStore") - (c-name "eom_list_store_add_uris") - (return-type "none") - (parameters - '("GList*" "uri_list") - ) -) - -(define-method remove_image - (of-object "EomListStore") - (c-name "eom_list_store_remove_image") - (return-type "none") - (parameters - '("EomImage*" "image") - ) -) - -(define-method get_pos_by_image - (of-object "EomListStore") - (c-name "eom_list_store_get_pos_by_image") - (return-type "gint") - (parameters - '("EomImage*" "image") - ) -) - -(define-method get_image_by_pos - (of-object "EomListStore") - (c-name "eom_list_store_get_image_by_pos") - (return-type "EomImage*") - (parameters - '("gint" "pos") - ) -) - -(define-method get_pos_by_iter - (of-object "EomListStore") - (c-name "eom_list_store_get_pos_by_iter") - (return-type "gint") - (parameters - '("GtkTreeIter*" "iter") - ) -) - -(define-method length - (of-object "EomListStore") - (c-name "eom_list_store_length") - (return-type "gint") -) - -(define-method get_initial_pos - (of-object "EomListStore") - (c-name "eom_list_store_get_initial_pos") - (return-type "gint") -) - -;; From eom-plugin.h - -(define-function eom_plugin_get_type - (c-name "eom_plugin_get_type") - (return-type "GType") -) - -(define-method activate - (of-object "EomPlugin") - (c-name "eom_plugin_activate") - (return-type "none") - (parameters - '("EomWindow*" "window") - ) -) - -(define-method deactivate - (of-object "EomPlugin") - (c-name "eom_plugin_deactivate") - (return-type "none") - (parameters - '("EomWindow*" "window") - ) -) - -(define-method update_ui - (of-object "EomPlugin") - (c-name "eom_plugin_update_ui") - (return-type "none") - (parameters - '("EomWindow*" "window") - ) -) - -(define-method is_configurable - (of-object "EomPlugin") - (c-name "eom_plugin_is_configurable") - (return-type "gboolean") -) - -(define-method create_configure_dialog - (of-object "EomPlugin") - (c-name "eom_plugin_create_configure_dialog") - (return-type "GtkWidget*") -) - - - -;; From eom-properties-dialog.h - -(define-function eom_properties_dialog_get_type - (c-name "eom_properties_dialog_get_type") - (return-type "GType") -) - -(define-function eom_properties_dialog_new - (c-name "eom_properties_dialog_new") - (is-constructor-of "EomPropertiesDialog") - (return-type "GObject*") - (parameters - '("GtkWindow*" "parent") - '("EomThumbView*" "thumbview") - '("GtkAction*" "next_image_action") - '("GtkAction*" "previous_image_action") - ) -) - -(define-method update - (of-object "EomPropertiesDialog") - (c-name "eom_properties_dialog_update") - (return-type "none") - (parameters - '("EomImage*" "image") - ) -) - -(define-method set_page - (of-object "EomPropertiesDialog") - (c-name "eom_properties_dialog_set_page") - (return-type "none") - (parameters - '("EomPropertiesDialogPage" "page") - ) -) - - - -;; From eom-scroll-view.h - -(define-function eom_scroll_view_get_type - (c-name "eom_scroll_view_get_type") - (return-type "GType") -) - -(define-function eom_scroll_view_new - (c-name "eom_scroll_view_new") - (is-constructor-of "EomScrollView") - (return-type "GtkWidget*") -) - -(define-method set_image - (of-object "EomScrollView") - (c-name "eom_scroll_view_set_image") - (return-type "none") - (parameters - '("EomImage*" "image") - ) -) - -(define-method set_zoom_upscale - (of-object "EomScrollView") - (c-name "eom_scroll_view_set_zoom_upscale") - (return-type "none") - (parameters - '("gboolean" "upscale") - ) -) - -(define-method set_zoom_multiplier - (of-object "EomScrollView") - (c-name "eom_scroll_view_set_zoom_multiplier") - (return-type "none") - (parameters - '("gdouble" "multiplier") - ) -) - -(define-method set_antialiasing_in - (of-object "EomScrollView") - (c-name "eom_scroll_view_set_antialiasing_in") - (return-type "none") - (parameters - '("gboolean" "state") - ) -) - -(define-method set_antialiasing_out - (of-object "EomScrollView") - (c-name "eom_scroll_view_set_antialiasing_out") - (return-type "none") - (parameters - '("gboolean" "state") - ) -) - -(define-method set_transparency_color - (of-object "EomScrollView") - (c-name "eom_scroll_view_set_transparency_color") - (return-type "none") - (parameters - '("GdkColor*" "color") - ) -) - -(define-method set_transparency - (of-object "EomScrollView") - (c-name "eom_scroll_view_set_transparency") - (return-type "none") - (parameters - '("EomTransparencyStyle" "style") - ) -) - -(define-method scrollbars_visible - (of-object "EomScrollView") - (c-name "eom_scroll_view_scrollbars_visible") - (return-type "gboolean") -) - -(define-method zoom_in - (of-object "EomScrollView") - (c-name "eom_scroll_view_zoom_in") - (return-type "none") - (parameters - '("gboolean" "smooth") - ) -) - -(define-method zoom_out - (of-object "EomScrollView") - (c-name "eom_scroll_view_zoom_out") - (return-type "none") - (parameters - '("gboolean" "smooth") - ) -) - -(define-method zoom_fit - (of-object "EomScrollView") - (c-name "eom_scroll_view_zoom_fit") - (return-type "none") -) - -(define-method set_zoom - (of-object "EomScrollView") - (c-name "eom_scroll_view_set_zoom") - (return-type "none") - (parameters - '("double" "zoom") - ) -) - -(define-method get_zoom - (of-object "EomScrollView") - (c-name "eom_scroll_view_get_zoom") - (return-type "double") -) - -(define-method get_zoom_is_min - (of-object "EomScrollView") - (c-name "eom_scroll_view_get_zoom_is_min") - (return-type "gboolean") -) - -(define-method get_zoom_is_max - (of-object "EomScrollView") - (c-name "eom_scroll_view_get_zoom_is_max") - (return-type "gboolean") -) - -(define-method show_cursor - (of-object "EomScrollView") - (c-name "eom_scroll_view_show_cursor") - (return-type "none") -) - -(define-method hide_cursor - (of-object "EomScrollView") - (c-name "eom_scroll_view_hide_cursor") - (return-type "none") -) - - - -;; From eom-sidebar.h - -(define-function eom_sidebar_get_type - (c-name "eom_sidebar_get_type") - (return-type "GType") -) - -(define-function eom_sidebar_new - (c-name "eom_sidebar_new") - (is-constructor-of "EomSidebar") - (return-type "GtkWidget*") -) - -(define-method add_page - (of-object "EomSidebar") - (c-name "eom_sidebar_add_page") - (return-type "none") - (parameters - '("const-gchar*" "title") - '("GtkWidget*" "main_widget") - ) -) - -(define-method remove_page - (of-object "EomSidebar") - (c-name "eom_sidebar_remove_page") - (return-type "none") - (parameters - '("GtkWidget*" "main_widget") - ) -) - -(define-method set_page - (of-object "EomSidebar") - (c-name "eom_sidebar_set_page") - (return-type "none") - (parameters - '("GtkWidget*" "main_widget") - ) -) - -(define-method get_n_pages - (of-object "EomSidebar") - (c-name "eom_sidebar_get_n_pages") - (return-type "gint") -) - -(define-method is_empty - (of-object "EomSidebar") - (c-name "eom_sidebar_is_empty") - (return-type "gboolean") -) - - - -;; From eom-statusbar.h - -(define-function eom_statusbar_get_type - (c-name "eom_statusbar_get_type") - (return-type "GType") -) - -(define-function eom_statusbar_new - (c-name "eom_statusbar_new") - (is-constructor-of "EomStatusbar") - (return-type "GtkWidget*") -) - -(define-method set_image_number - (of-object "EomStatusbar") - (c-name "eom_statusbar_set_image_number") - (return-type "none") - (parameters - '("gint" "num") - '("gint" "tot") - ) -) - -(define-method set_progress - (of-object "EomStatusbar") - (c-name "eom_statusbar_set_progress") - (return-type "none") - (parameters - '("gdouble" "progress") - ) -) - - - -;; From eom-thumb-nav.h - -(define-function eom_thumb_nav_get_type - (c-name "eom_thumb_nav_get_type") - (return-type "GType") -) - -(define-function eom_thumb_nav_new - (c-name "eom_thumb_nav_new") - (is-constructor-of "EomThumbNav") - (return-type "GtkWidget*") - (parameters - '("GtkWidget*" "thumbview") - '("EomThumbNavMode" "mode") - '("gboolean" "show_buttons") - ) -) - -(define-method get_show_buttons - (of-object "EomThumbNav") - (c-name "eom_thumb_nav_get_show_buttons") - (return-type "gboolean") -) - -(define-method set_show_buttons - (of-object "EomThumbNav") - (c-name "eom_thumb_nav_set_show_buttons") - (return-type "none") - (parameters - '("gboolean" "show_buttons") - ) -) - -(define-method get_mode - (of-object "EomThumbNav") - (c-name "eom_thumb_nav_get_mode") - (return-type "EomThumbNavMode") -) - -(define-method set_mode - (of-object "EomThumbNav") - (c-name "eom_thumb_nav_set_mode") - (return-type "none") - (parameters - '("EomThumbNavMode" "mode") - ) -) - - - -;; From eom-thumb-view.h - -(define-function eom_thumb_view_get_type - (c-name "eom_thumb_view_get_type") - (return-type "GType") -) - -(define-function eom_thumb_view_new - (c-name "eom_thumb_view_new") - (is-constructor-of "EomThumbView") - (return-type "GtkWidget*") -) - -(define-method set_model - (of-object "EomThumbView") - (c-name "eom_thumb_view_set_model") - (return-type "none") - (parameters - '("EomListStore*" "store") - ) -) - -(define-method set_item_height - (of-object "EomThumbView") - (c-name "eom_thumb_view_set_item_height") - (return-type "none") - (parameters - '("gint" "height") - ) -) - -(define-method get_n_selected - (of-object "EomThumbView") - (c-name "eom_thumb_view_get_n_selected") - (return-type "guint") -) - -(define-method get_first_selected_image - (of-object "EomThumbView") - (c-name "eom_thumb_view_get_first_selected_image") - (return-type "EomImage*") -) - -(define-method get_selected_images - (of-object "EomThumbView") - (c-name "eom_thumb_view_get_selected_images") - (return-type "GList*") -) - -(define-method select_single - (of-object "EomThumbView") - (c-name "eom_thumb_view_select_single") - (return-type "none") - (parameters - '("EomThumbViewSelectionChange" "change") - ) -) - -(define-method set_current_image - (of-object "EomThumbView") - (c-name "eom_thumb_view_set_current_image") - (return-type "none") - (parameters - '("EomImage*" "image") - '("gboolean" "deselect_other") - ) -) - -(define-method set_thumbnail_popup - (of-object "EomThumbView") - (c-name "eom_thumb_view_set_thumbnail_popup") - (return-type "none") - (parameters - '("GtkMenu*" "menu") - ) -) - - - -;; From eom-window.h - -(define-function eom_window_get_type - (c-name "eom_window_get_type") - (return-type "GType") -) - -(define-function eom_window_new - (c-name "eom_window_new") - (is-constructor-of "EomWindow") - (return-type "GtkWidget*") - (parameters - '("EomStartupFlags" "flags") - ) -) - -(define-method get_mode - (of-object "EomWindow") - (c-name "eom_window_get_mode") - (return-type "EomWindowMode") -) - -(define-method set_mode - (of-object "EomWindow") - (c-name "eom_window_set_mode") - (return-type "none") - (parameters - '("EomWindowMode" "mode") - ) -) - -(define-method get_ui_manager - (of-object "EomWindow") - (c-name "eom_window_get_ui_manager") - (return-type "GtkUIManager*") -) - -(define-method get_store - (of-object "EomWindow") - (c-name "eom_window_get_store") - (return-type "EomListStore*") -) - -(define-method get_view - (of-object "EomWindow") - (c-name "eom_window_get_view") - (return-type "GtkWidget*") -) - -(define-method get_sidebar - (of-object "EomWindow") - (c-name "eom_window_get_sidebar") - (return-type "GtkWidget*") -) - -(define-method get_thumb_view - (of-object "EomWindow") - (c-name "eom_window_get_thumb_view") - (return-type "GtkWidget*") -) - -(define-method get_thumb_nav - (of-object "EomWindow") - (c-name "eom_window_get_thumb_nav") - (return-type "GtkWidget*") -) - -(define-method get_statusbar - (of-object "EomWindow") - (c-name "eom_window_get_statusbar") - (return-type "GtkWidget*") -) - -(define-method get_image - (of-object "EomWindow") - (c-name "eom_window_get_image") - (return-type "EomImage*") -) - -(define-method open_uri_list - (of-object "EomWindow") - (c-name "eom_window_open_uri_list") - (return-type "none") - (parameters - '("GSList*" "uri_list") - ) -) - -(define-method is_empty - (of-object "EomWindow") - (c-name "eom_window_is_empty") - (return-type "gboolean") -) - - diff --git a/bindings/python/eom.override b/bindings/python/eom.override deleted file mode 100644 index d95cf36..0000000 --- a/bindings/python/eom.override +++ /dev/null @@ -1,126 +0,0 @@ -%% -headers -#define NO_IMPORT -#include "pygobject.h" -#include <pygtk/pygtk.h> - -#include "eom-enum-types.h" -#include "eom-application.h" -#include "eom-window.h" -#include "eom-dialog.h" -#include "eom-properties-dialog.h" -#include "eom-statusbar.h" -#include "eom-sidebar.h" -#include "eom-thumb-nav.h" -#include "eom-image.h" -#include "eom-scroll-view.h" -#include "eom-thumb-view.h" -#include "eom-list-store.h" -#include "eom-job-queue.h" -#include "eom-jobs.h" -#include "eom-plugin.h" - -void pyeom_register_classes (PyObject *d); -void pyeom_add_constants (PyObject *module, const gchar *strip_prefix); - -static PyObject * -_helper_wrap_gobject_glist (const GList *list) -{ - PyObject *py_list; - const GList *tmp; - - if ((py_list = PyList_New(0)) == NULL) { - return NULL; - } - for (tmp = list; tmp != NULL; tmp = tmp->next) { - PyObject *py_obj = pygobject_new(G_OBJECT(tmp->data)); - - if (py_obj == NULL) { - Py_DECREF(py_list); - return NULL; - } - PyList_Append(py_list, py_obj); - Py_DECREF(py_obj); - } - return py_list; -} -%% -modulename eom -%% -import gtk.Widget as PyGtkWidget_Type -import gobject.GObject as PyGObject_Type -import gtk.Window as PyGtkWindow_Type -import gtk.Action as PyGtkAction_Type -import gtk.Statusbar as PyGtkStatusbar_Type -import gtk.Menu as PyGtkMenu_Type -import gtk.gdk.Pixbuf as PyGdkPixbuf_Type -import gtk.FileChooserDialog as PyGtkFileChooserDialog_Type -import gtk.ListStore as PyGtkListStore_Type -import gtk.HBox as PyGtkHBox_Type -import gtk.VBox as PyGtkVBox_Type -import gtk.Table as PyGtkTable_Type -import gtk.IconView as PyGtkIconView_Type -import gio.File as PyGFile_Type -%% -ignore-glob - *_get_type -%% -override eom_application_get_windows -static PyObject * -_wrap_eom_application_get_windows(PyGObject *self) -{ - const GList *list; - PyObject *py_list; - - list = eom_application_get_windows (EOM_APPLICATION (self->obj)); - - py_list = _helper_wrap_gobject_glist (list); - - return py_list; -} -%% -override eom_application_open_uri_list kwargs -static PyObject * -_wrap_eom_application_open_uri_list (PyGObject *self, - PyObject *args, - PyObject *kwargs) -{ - static char *kwlist[] = { "uri_list", NULL }; - PyObject *list, *item; - GSList *glist = NULL; - int len, i; - - if (!PyArg_ParseTupleAndKeywords (args, kwargs, - "O:EomApplication.open_uri_list", kwlist, - &list)) - return NULL; - - if (!PySequence_Check (list)) { - PyErr_SetString (PyExc_TypeError, - "first argument must be a sequence"); - return NULL; - } - - len = PySequence_Length (list); - - for (i = 0; i < len; i++) - { - item = PySequence_GetItem (list, i); - Py_DECREF(item); - - if (!PyString_Check (item)) { - PyErr_SetString (PyExc_TypeError, - "sequence item not a string"); - g_slist_free (glist); - return NULL; - } - - glist = g_slist_append (glist, g_strdup (PyString_AsString (item))); - } - - eom_application_open_uri_list (EOM_APPLICATION (self->obj), glist, GDK_CURRENT_TIME, 0, NULL); - - g_slist_free (glist); - Py_INCREF (Py_None); - return Py_None; -} diff --git a/configure.ac b/configure.ac index b2cc7fa..6bf5540 100644 --- a/configure.ac +++ b/configure.ac @@ -373,117 +373,6 @@ fi GLIB_GSETTINGS -# ************** -# Python Support -# ************** - -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=autodetect have_python=yes]) - -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 - PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'` - PY_EXEC_PREFIX=`$PYTHON -c 'import sys ; print sys.exec_prefix'` - PYTHON_LIBS="-lpython$PYTHON_VERSION -lutil" - PYTHON_LIB_LOC="-L$PY_EXEC_PREFIX/lib/python$PYTHON_VERSION/config" - PYTHON_CFLAGS="-I$PY_PREFIX/include/python$PYTHON_VERSION" - PYTHON_MAKEFILE="$libdir/python$PYTHON_VERSION/config/Makefile" - PYTHON_BASEMODLIBS=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE` - PYTHON_OTHER_LIBS=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE` - PYTHON_EXTRA_LIBS="$PYTHON_BASEMODLIBS $PYTHON_OTHER_LIBS" - AC_SUBST([PYTHON_LIBS]) - AC_SUBST([PYTHON_LIB_LOC]) - AC_SUBST([PYTHON_CFLAGS]) - AC_SUBST([PYTHON_EXTRA_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 -fi - -if test "x$have_python" != "xno"; then - PYGOBJECT_REQUIRED=2.15.1 - PYGTK_REQUIRED=2.13.0 - - PKG_CHECK_MODULES([PYGTK], [ - pygobject-2.0 >= $PYGOBJECT_REQUIRED - pygtk-2.0 >= $PYGTK_REQUIRED], - [], - [ - have_python=no - if test "x$enable_python" = "xyes"; then - AC_MSG_ERROR([$PYGTK_PKG_ERRORS]) - elif test "x$enable_python" = "xautodetect"; then - enable_python=no - AC_MSG_WARN([$PYGTK_PKG_ERRORS]) - AC_MSG_WARN([Disabling python support]) - fi - ]) - - AC_SUBST([PYGTK_CFLAGS]) - AC_SUBST([PYGTK_LIBS]) -fi - -if test "x$have_python" != "xno"; then - AC_MSG_CHECKING([for pygobject defs]) - PYGOBJECT_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygobject-2.0` - AC_MSG_RESULT([$PYGOBJECT_DEFSDIR]) - - AC_MSG_CHECKING([for pygtk defs]) - PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0` - AC_MSG_RESULT([$PYGTK_DEFSDIR]) - - AC_MSG_CHECKING([for pygobject codegen]) - PYGOBJECT_CODEGEN="$PYTHON `$PKG_CONFIG --variable=codegendir pygobject-2.0`/codegen.py" - AC_MSG_RESULT([$PYGOBJECT_CODEGEN]) - - AC_MSG_CHECKING([for pygobject h2def]) - PYGOBJECT_H2DEF="$PYTHON `$PKG_CONFIG --variable=codegendir pygobject-2.0`/h2def.py" - AC_MSG_RESULT([$PYGOBJECT_H2DEF]) - - AC_SUBST([PYGOBJECT_DEFSDIR]) - AC_SUBST([PYGTK_DEFSDIR]) - AC_SUBST([PYGOBJECT_CODEGEN]) - AC_SUBST([PYGOBJECT_H2DEF]) - - dnl Check for -fno-strict-aliasing - FLAGS="-fno-strict-aliasing" - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $FLAGS" - AC_MSG_CHECKING([whether [$]CC understands $FLAGS]) - AC_TRY_COMPILE([], [], [compiler_has_option=yes], [compiler_has_option=no]) - CFLAGS="$save_CFLAGS" - AC_MSG_RESULT($compiler_has_option) - if test $compiler_has_option = yes; then - NO_STRICT_ALIASING_CFLAGS="$FLAGS" - fi - AC_SUBST([NO_STRICT_ALIASING_CFLAGS]) -fi - -if test "x$have_python" != "xno" -a "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_SEARCH_LIBS([floor],[m]) AC_CONFIG_FILES([ @@ -513,8 +402,6 @@ doc/reference/Makefile doc/reference/version.xml doc/reference/eom-docs.sgml plugins/Makefile -bindings/Makefile -bindings/python/Makefile ]) AC_OUTPUT @@ -527,7 +414,6 @@ Configure summary: Extra Compiler Warnings ....: ${WARN_CFLAGS} GTK version ................: ${GTK_API_VERSION} - Python support .............: ${have_python} EXIF support ...............: ${have_exif} XMP support ................: ${have_exempi} JPEG support ...............: ${have_jpeg} diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am index ec25e60..9e560d2 100644 --- a/doc/reference/Makefile.am +++ b/doc/reference/Makefile.am @@ -48,14 +48,12 @@ CFILE_GLOB=$(top_srcdir)/src/*.c # Header files to ignore when scanning. # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h IGNORE_HFILES= \ - eom-python-plugin.h \ eom-image-private.h \ eom-image-jpeg.h \ eom-marshal.h \ eom-application-service.h \ eom-enum-types.h \ - eom-module.h \ - eom-python-module.h + eom-module.h if !HAVE_EXIF if !HAVE_EXEMPI diff --git a/doc/reference/eom-sections.txt b/doc/reference/eom-sections.txt index c6cc9a3..b1cc0c3 100644 --- a/doc/reference/eom-sections.txt +++ b/doc/reference/eom-sections.txt @@ -680,7 +680,6 @@ zoom_fit_scale EomPluginInfo eom_plugin_engine_init eom_plugin_engine_shutdown -eom_plugin_engine_garbage_collect eom_plugin_engine_get_plugins_list eom_plugin_engine_activate_plugin eom_plugin_engine_deactivate_plugin diff --git a/src/Makefile.am b/src/Makefile.am index 56b3f3a..884b955 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -39,12 +39,6 @@ NOINST_H_FILES = \ eom-close-confirmation-dialog.h \ zoom.h -if ENABLE_PYTHON -NOINST_H_FILES += \ - eom-python-module.h \ - eom-python-plugin.h -endif - INST_H_FILES = \ eom-application.h \ eom-debug.h \ @@ -125,14 +119,6 @@ libeom_c_files += \ eom-exif-details.c endif -if ENABLE_PYTHON -libeom_la_SOURCES += \ - eom-python-module.c \ - eom-python-module.h \ - eom-python-plugin.c \ - eom-python-plugin.h -endif - if HAVE_EXEMPI # We need to make sure eom-exif-details.h # is only listed once in INST_H_FILES @@ -169,17 +155,6 @@ libeom_la_LIBADD += \ $(X11_LIBS) endif -if ENABLE_PYTHON -libeom_la_CFLAGS += \ - $(NO_STRICT_ALIASING_CFLAGS) \ - $(PYGTK_CFLAGS) \ - $(PYTHON_CFLAGS) \ - $(AM_CFLAGS) - -libeom_la_LIBADD += \ - $(top_builddir)/bindings/python/eom.la -endif - eom_SOURCES = main.c eom_CFLAGS = \ diff --git a/src/eom-plugin-engine.c b/src/eom-plugin-engine.c index 5207d95..b55b0d0 100644 --- a/src/eom-plugin-engine.c +++ b/src/eom-plugin-engine.c @@ -40,17 +40,12 @@ #include <glib.h> #include <gio/gio.h> -#ifdef ENABLE_PYTHON -#include "eom-python-module.h" -#endif - #define USER_EOM_PLUGINS_LOCATION "plugins/" #define PLUGIN_EXT ".eom-plugin" typedef enum { EOM_PLUGIN_LOADER_C, - EOM_PLUGIN_LOADER_PY, } EomPluginLoader; struct _EomPluginInfo @@ -73,8 +68,7 @@ struct _EomPluginInfo gint active : 1; /* A plugin is unavailable if it is not possible to activate it - due to an error loading the plugin module (e.g. for Python plugins - when the interpreter has not been correctly initializated) */ + due to an error loading the plugin module */ gint available : 1; }; @@ -172,19 +166,7 @@ eom_plugin_engine_load (const gchar *file) "Loader", NULL); - if (str && strcmp(str, "python") == 0) { - info->loader = EOM_PLUGIN_LOADER_PY; - -#ifndef ENABLE_PYTHON - g_warning ("Cannot load Python plugin '%s' since eom was not " - "compiled with Python support.", file); - - goto error; -#endif - - } else { - info->loader = EOM_PLUGIN_LOADER_C; - } + info->loader = EOM_PLUGIN_LOADER_C; g_free (str); @@ -410,30 +392,12 @@ eom_plugin_engine_init (void) } void -eom_plugin_engine_garbage_collect (void) -{ -#ifdef ENABLE_PYTHON - eom_python_garbage_collect (); -#endif -} - -void eom_plugin_engine_shutdown (void) { GList *pl; eom_debug (DEBUG_PLUGINS); -#ifdef ENABLE_PYTHON - /* Note: that this may cause finalization of objects (typically - * the EomWindow) by running the garbage collector. Since some - * of the plugin may have installed callbacks upon object - * finalization (typically they need to free the WindowData) - * it must run before we get rid of the plugins. - */ - eom_python_shutdown (); -#endif - g_return_if_fail (eom_plugin_engine_settings != NULL); for (pl = eom_plugins_list; pl; pl = pl->next) { @@ -493,36 +457,6 @@ load_plugin_module (EomPluginInfo *info) break; -#ifdef ENABLE_PYTHON - case EOM_PLUGIN_LOADER_PY: - { - gchar *dir; - - if (!eom_python_init ()) { - /* Mark plugin as unavailable and fails */ - info->available = FALSE; - - g_warning ("Cannot load Python plugin '%s' since eom " - "was not able to initialize the Python interpreter.", - info->name); - - return FALSE; - } - - g_return_val_if_fail ((info->location != NULL) && - (info->location[0] != '\0'), - FALSE); - - dir = g_path_get_dirname (info->file); - - info->module = G_TYPE_MODULE ( - eom_python_module_new (dir, info->location)); - - g_free (dir); - - break; - } -#endif default: g_return_val_if_reached (FALSE); } @@ -535,12 +469,6 @@ load_plugin_module (EomPluginInfo *info) eom_module_get_path (EOM_MODULE (info->module))); break; - case EOM_PLUGIN_LOADER_PY: - g_warning ("Cannot load Python plugin '%s' since file '%s' cannot be read.", - info->name, - info->location); - break; - default: g_return_val_if_reached (FALSE); } @@ -561,13 +489,6 @@ load_plugin_module (EomPluginInfo *info) EOM_PLUGIN (eom_module_new_object (EOM_MODULE (info->module))); break; -#ifdef ENABLE_PYTHON - case EOM_PLUGIN_LOADER_PY: - info->plugin = - EOM_PLUGIN (eom_python_module_new_object (EOM_PYTHON_MODULE (info->module))); - break; -#endif - default: g_return_val_if_reached (FALSE); } diff --git a/src/eom-plugin-engine.h b/src/eom-plugin-engine.h index 1213854..67088b3 100644 --- a/src/eom-plugin-engine.h +++ b/src/eom-plugin-engine.h @@ -38,9 +38,6 @@ G_GNUC_INTERNAL void eom_plugin_engine_shutdown (void); G_GNUC_INTERNAL -void eom_plugin_engine_garbage_collect (void); - -G_GNUC_INTERNAL const GList *eom_plugin_engine_get_plugins_list (void); G_GNUC_INTERNAL diff --git a/src/eom-python-module.c b/src/eom-python-module.c deleted file mode 100644 index 9f1bfbc..0000000 --- a/src/eom-python-module.c +++ /dev/null @@ -1,527 +0,0 @@ -/* - * eom-python-module.c - * This file is part of eom - * - * Copyright (C) 2005 Raphael Slinckx - * - * 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 of the License, 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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -/* This needs to be included before any standard header - * see http://docs.python.org/c-api/intro.html#include-files */ -#include <Python.h> - -#include <pygobject.h> -#include <pygtk/pygtk.h> - -#include <signal.h> - -#include <gmodule.h> - -#include "eom-python-module.h" -#include "eom-python-plugin.h" -#include "eom-debug.h" - -#if PY_VERSION_HEX < 0x02050000 -typedef int Py_ssize_t; -#define PY_SSIZE_T_MAX INT_MAX -#define PY_SSIZE_T_MIN INT_MIN -#endif - -#define EOM_PYTHON_MODULE_GET_PRIVATE(object) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_PYTHON_MODULE, EomPythonModulePrivate)) - -struct _EomPythonModulePrivate { - gchar *module; - gchar *path; - GType type; -}; - -enum { - PROP_0, - PROP_PATH, - PROP_MODULE -}; - -void pyeom_register_classes (PyObject *d); -void pyeom_add_constants (PyObject *module, const gchar *strip_prefix); -extern PyMethodDef pyeom_functions[]; - -static PyTypeObject *PyEomPlugin_Type; - -G_DEFINE_TYPE (EomPythonModule, eom_python_module, G_TYPE_TYPE_MODULE) - -static gboolean -eom_python_module_load (GTypeModule *gmodule) -{ - EomPythonModulePrivate *priv = EOM_PYTHON_MODULE_GET_PRIVATE (gmodule); - PyObject *main_module, *main_locals, *locals, *key, *value; - PyObject *module, *fromlist; - Py_ssize_t pos = 0; - - g_return_val_if_fail (Py_IsInitialized (), FALSE); - - main_module = PyImport_AddModule ("__main__"); - - if (main_module == NULL) { - g_warning ("Could not get __main__."); - return FALSE; - } - - /* If we have a special path, we register it */ - if (priv->path != NULL) { - PyObject *sys_path = PySys_GetObject ("path"); - PyObject *path = PyString_FromString (priv->path); - - if (PySequence_Contains(sys_path, path) == 0) - PyList_Insert (sys_path, 0, path); - - Py_DECREF(path); - } - - main_locals = PyModule_GetDict (main_module); - - /* We need a fromlist to be able to import modules with - * a '.' in the name. */ - fromlist = PyTuple_New(0); - - module = PyImport_ImportModuleEx (priv->module, main_locals, main_locals, fromlist); - - Py_DECREF(fromlist); - - if (!module) { - PyErr_Print (); - return FALSE; - } - - locals = PyModule_GetDict (module); - - while (PyDict_Next (locals, &pos, &key, &value)) { - if (!PyType_Check(value)) - continue; - - if (PyObject_IsSubclass (value, (PyObject*) PyEomPlugin_Type)) { - priv->type = eom_python_plugin_get_type (gmodule, value); - return TRUE; - } - } - - return FALSE; -} - -static void -eom_python_module_unload (GTypeModule *module) -{ - EomPythonModulePrivate *priv = EOM_PYTHON_MODULE_GET_PRIVATE (module); - - eom_debug_message (DEBUG_PLUGINS, "Unloading Python module"); - - priv->type = 0; -} - -GObject * -eom_python_module_new_object (EomPythonModule *module) -{ - EomPythonModulePrivate *priv = EOM_PYTHON_MODULE_GET_PRIVATE (module); - - eom_debug_message (DEBUG_PLUGINS, "Creating object of type %s", g_type_name (priv->type)); - - if (priv->type == 0) - return NULL; - - return g_object_new (priv->type, NULL); -} - -static void -eom_python_module_init (EomPythonModule *module) -{ - eom_debug_message (DEBUG_PLUGINS, "Init of Python module"); -} - -static void -eom_python_module_finalize (GObject *object) -{ - EomPythonModulePrivate *priv = EOM_PYTHON_MODULE_GET_PRIVATE (object); - - eom_debug_message (DEBUG_PLUGINS, "Finalizing Python module %s", g_type_name (priv->type)); - - g_free (priv->module); - g_free (priv->path); - - G_OBJECT_CLASS (eom_python_module_parent_class)->finalize (object); -} - -static void -eom_python_module_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - g_return_if_reached (); -} - -static void -eom_python_module_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EomPythonModule *mod = EOM_PYTHON_MODULE (object); - - switch (prop_id) { - case PROP_MODULE: - EOM_PYTHON_MODULE_GET_PRIVATE (mod)->module = g_value_dup_string (value); - break; - - case PROP_PATH: - EOM_PYTHON_MODULE_GET_PRIVATE (mod)->path = g_value_dup_string (value); - break; - - default: - g_return_if_reached (); - } -} - -static void -eom_python_module_class_init (EomPythonModuleClass *class) -{ - GObjectClass *object_class = G_OBJECT_CLASS (class); - GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (class); - - object_class->finalize = eom_python_module_finalize; - object_class->get_property = eom_python_module_get_property; - object_class->set_property = eom_python_module_set_property; - - g_object_class_install_property - (object_class, - PROP_MODULE, - g_param_spec_string ("module", - "Module Name", - "The Python module to load for this plugin", - NULL, - G_PARAM_WRITABLE | G_PARAM_READABLE | G_PARAM_CONSTRUCT_ONLY)); - - g_object_class_install_property - (object_class, - PROP_PATH, - g_param_spec_string ("path", - "Path", - "The Python path to use when loading this module", - NULL, - G_PARAM_WRITABLE | G_PARAM_READABLE | G_PARAM_CONSTRUCT_ONLY)); - - g_type_class_add_private (object_class, sizeof (EomPythonModulePrivate)); - - module_class->load = eom_python_module_load; - module_class->unload = eom_python_module_unload; -} - -EomPythonModule * -eom_python_module_new (const gchar *path, - const gchar *module) -{ - EomPythonModule *result; - - if (module == NULL || module[0] == '\0') - return NULL; - - result = g_object_new (EOM_TYPE_PYTHON_MODULE, - "module", module, - "path", path, - NULL); - - g_type_module_set_name (G_TYPE_MODULE (result), module); - - return result; -} - - -static gint idle_garbage_collect_id = 0; - -/* C equivalent of - * import pygtk - * pygtk.require ("2.0") - */ -static gboolean -check_pygtk2 (void) -{ - PyObject *pygtk, *mdict, *require; - - /* pygtk.require("2.0") */ - pygtk = PyImport_ImportModule ("pygtk"); - - if (pygtk == NULL) { - g_warning ("Error initializing Python interpreter: could not import pygtk."); - return FALSE; - } - - mdict = PyModule_GetDict (pygtk); - - require = PyDict_GetItemString (mdict, "require"); - - PyObject_CallObject (require, - Py_BuildValue ("(S)", PyString_FromString ("2.0"))); - - if (PyErr_Occurred()) { - g_warning ("Error initializing Python interpreter: pygtk 2 is required."); - return FALSE; - } - - return TRUE; -} - -/* Note: the following two functions are needed because - * init_pyobject and init_pygtk which are *macros* which in case - * case of error set the PyErr and then make the calling - * function return behind our back. - * It's up to the caller to check the result with PyErr_Occurred() - */ -static void -eom_init_pygobject (void) -{ - init_pygobject_check (2, 11, 5); /* FIXME: get from config */ -} - -static void -eom_init_pygtk (void) -{ - PyObject *gtk, *mdict, *version, *required_version; - - init_pygtk (); - - /* There isn't init_pygtk_check(), do the version - * check ourselves */ - gtk = PyImport_ImportModule("gtk"); - - mdict = PyModule_GetDict(gtk); - - version = PyDict_GetItemString (mdict, "pygtk_version"); - - if (!version) { - PyErr_SetString (PyExc_ImportError, - "PyGObject version too old"); - return; - } - - required_version = Py_BuildValue ("(iii)", 2, 4, 0); /* FIXME */ - - if (PyObject_Compare (version, required_version) == -1) { - PyErr_SetString (PyExc_ImportError, - "PyGObject version too old"); - - Py_DECREF (required_version); - return; - } - - Py_DECREF (required_version); -} - -gboolean -eom_python_init (void) -{ - PyObject *mdict, *path, *tuple; - PyObject *sys_path, *eom; - PyObject *gettext, *install, *gettext_args; - struct sigaction old_sigint; - gint res; - /* Workaround for python bug. See #569228. */ - char *argv[] = { "/dev/null/python/is/buggy/eom", NULL }; - - static gboolean init_failed = FALSE; - - if (init_failed) { - /* We already failed to initialized Python, don't need to - * retry again */ - return FALSE; - } - - if (Py_IsInitialized ()) { - /* Python has already been successfully initialized */ - return TRUE; - } - - /* We are trying to initialize Python for the first time, - set init_failed to FALSE only if the entire initialization process - ends with success */ - init_failed = TRUE; - - /* Hack to make python not overwrite SIGINT: this is needed to avoid - * the crash reported on bug #326191 */ - - /* CHECK: can't we use Py_InitializeEx instead of Py_Initialize in order - to avoid to manage signal handlers ? - Paolo (Dec. 31, 2006) */ - - /* Save old handler */ - res = sigaction (SIGINT, NULL, &old_sigint); - - if (res != 0) { - g_warning ("Error initializing Python interpreter: cannot get " - "handler to SIGINT signal (%s)", strerror (errno)); - - return FALSE; - } - - /* Python initialization */ - Py_Initialize (); - - /* Restore old handler */ - res = sigaction (SIGINT, &old_sigint, NULL); - - if (res != 0) { - g_warning ("Error initializing Python interpreter: cannot restore " - "handler to SIGINT signal (%s).", strerror (errno)); - - goto python_init_error; - } - - PySys_SetArgv (1, argv); - - /* Sanitize sys.path */ - PyRun_SimpleString("import sys; sys.path = filter(None, sys.path)"); - - if (!check_pygtk2 ()) { - /* Warning message already printed in check_pygtk2 */ - goto python_init_error; - } - - /* import gobject */ - eom_init_pygobject (); - - if (PyErr_Occurred ()) { - g_warning ("Error initializing Python interpreter: could not import pygobject."); - - goto python_init_error; - } - - /* import gtk */ - eom_init_pygtk (); - - if (PyErr_Occurred ()) { - g_warning ("Error initializing Python interpreter: could not import pygtk."); - - goto python_init_error; - } - - /* sys.path.insert(0, ...) for system-wide plugins */ - sys_path = PySys_GetObject ("path"); - path = PyString_FromString (EOM_PLUGIN_DIR "/"); - PyList_Insert (sys_path, 0, path); - Py_DECREF(path); - - /* import eom */ - eom = Py_InitModule ("eom", pyeom_functions); - mdict = PyModule_GetDict (eom); - - pyeom_register_classes (mdict); - pyeom_add_constants (eom, "EOM_"); - - /* eom version */ - tuple = Py_BuildValue("(iii)", - EOM_MAJOR_VERSION, - EOM_MINOR_VERSION, - EOM_MICRO_VERSION); - PyDict_SetItemString(mdict, "version", tuple); - Py_DECREF(tuple); - - /* Retrieve the Python type for eom.Plugin */ - PyEomPlugin_Type = (PyTypeObject *) PyDict_GetItemString (mdict, "Plugin"); - - if (PyEomPlugin_Type == NULL) { - PyErr_Print (); - - goto python_init_error; - } - - /* i18n support */ - gettext = PyImport_ImportModule ("gettext"); - - if (gettext == NULL) { - g_warning ("Error initializing Python interpreter: could not import gettext."); - - goto python_init_error; - } - - mdict = PyModule_GetDict (gettext); - install = PyDict_GetItemString (mdict, "install"); - gettext_args = Py_BuildValue ("ss", GETTEXT_PACKAGE, EOM_LOCALE_DIR); - PyObject_CallObject (install, gettext_args); - Py_DECREF (gettext_args); - - /* Python has been successfully initialized */ - init_failed = FALSE; - - return TRUE; - -python_init_error: - - g_warning ("Please check the installation of all the Python related packages required " - "by eom and try again."); - - PyErr_Clear (); - - eom_python_shutdown (); - - return FALSE; -} - -void -eom_python_shutdown (void) -{ - if (Py_IsInitialized ()) { - if (idle_garbage_collect_id != 0) { - g_source_remove (idle_garbage_collect_id); - idle_garbage_collect_id = 0; - } - - while (PyGC_Collect ()) - ; - - Py_Finalize (); - } -} - -static gboolean -run_gc (gpointer data) -{ - while (PyGC_Collect ()) - ; - - idle_garbage_collect_id = 0; - - return FALSE; -} - -void -eom_python_garbage_collect (void) -{ - if (Py_IsInitialized()) { - /* - * We both run the GC right now and we schedule - * a further collection in the main loop. - */ - - while (PyGC_Collect ()) - ; - - if (idle_garbage_collect_id == 0) - idle_garbage_collect_id = g_idle_add (run_gc, NULL); - } -} - diff --git a/src/eom-python-module.h b/src/eom-python-module.h deleted file mode 100644 index bfee463..0000000 --- a/src/eom-python-module.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Eye Of Mate - Python Module - * - * Copyright (C) 2007 The Free Software Foundation - * - * Author: Lucas Rocha <[email protected]> - * - * Based on gedit code (gedit/gedit-python-module.h) by: - * - Raphael Slinckx <[email protected]> - * - * 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 of the License, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __EOM_PYTHON_MODULE_H__ -#define __EOM_PYTHON_MODULE_H__ - -#include <glib-object.h> - -G_BEGIN_DECLS - -#define EOM_TYPE_PYTHON_MODULE (eom_python_module_get_type ()) -#define EOM_PYTHON_MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EOM_TYPE_PYTHON_MODULE, EomPythonModule)) -#define EOM_PYTHON_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EOM_TYPE_PYTHON_MODULE, EomPythonModuleClass)) -#define EOM_IS_PYTHON_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EOM_TYPE_PYTHON_MODULE)) -#define EOM_IS_PYTHON_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EOM_TYPE_PYTHON_MODULE)) -#define EOM_PYTHON_MODULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EOM_TYPE_PYTHON_MODULE, EomPythonModuleClass)) - -typedef struct _EomPythonModule EomPythonModule; -typedef struct _EomPythonModuleClass EomPythonModuleClass; -typedef struct _EomPythonModulePrivate EomPythonModulePrivate; - -struct _EomPythonModuleClass { - GTypeModuleClass parent_class; -}; - -struct _EomPythonModule { - GTypeModule parent_instance; -}; - -G_GNUC_INTERNAL -GType eom_python_module_get_type (void) G_GNUC_CONST; - -G_GNUC_INTERNAL -EomPythonModule *eom_python_module_new (const gchar* path, - const gchar *module); - -G_GNUC_INTERNAL -GObject *eom_python_module_new_object (EomPythonModule *module); - -G_GNUC_INTERNAL -gboolean eom_python_init (void); - -G_GNUC_INTERNAL -void eom_python_shutdown (void); - -G_GNUC_INTERNAL -void eom_python_garbage_collect (void); - -G_END_DECLS - -#endif /* __EOM_PYTHON_MODULE_H__ */ diff --git a/src/eom-python-plugin.c b/src/eom-python-plugin.c deleted file mode 100644 index ea0a11d..0000000 --- a/src/eom-python-plugin.c +++ /dev/null @@ -1,282 +0,0 @@ -/* Eye Of Mate - Python Plugin - * - * Copyright (C) 2007 The Free Software Foundation - * - * Author: Lucas Rocha <[email protected]> - * - * Based on gedit code (gedit/gedit-python-module.h) by: - * - Raphael Slinckx <[email protected]> - * - * 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 of the License, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include <config.h> - -#include "eom-python-plugin.h" -#include "eom-plugin.h" -#include "eom-debug.h" - -#define NO_IMPORT_PYGOBJECT -#include <pygobject.h> -#include <string.h> - -static GObjectClass *parent_class; - -static PyObject * -call_python_method (EomPythonPlugin *plugin, - EomWindow *window, - gchar *method) -{ - PyObject *py_ret = NULL; - - g_return_val_if_fail (PyObject_HasAttrString (plugin->instance, method), NULL); - - if (window == NULL) { - py_ret = PyObject_CallMethod (plugin->instance, - method, - NULL); - } else { - py_ret = PyObject_CallMethod (plugin->instance, - method, - "(N)", - pygobject_new (G_OBJECT (window))); - } - - if (!py_ret) - PyErr_Print (); - - return py_ret; -} - -static gboolean -check_py_object_is_gtk_widget (PyObject *py_obj) -{ - static PyTypeObject *_PyGtkWidget_Type = NULL; - - if (_PyGtkWidget_Type == NULL) { - PyObject *module; - - if ((module = PyImport_ImportModule ("gtk"))) { - PyObject *moddict = PyModule_GetDict (module); - _PyGtkWidget_Type = (PyTypeObject *) PyDict_GetItemString (moddict, "Widget"); - } - - if (_PyGtkWidget_Type == NULL) { - PyErr_SetString(PyExc_TypeError, "could not find Python gtk widget type"); - PyErr_Print(); - - return FALSE; - } - } - - return PyObject_TypeCheck (py_obj, _PyGtkWidget_Type) ? TRUE : FALSE; -} - -static void -impl_update_ui (EomPlugin *plugin, - EomWindow *window) -{ - PyGILState_STATE state = pyg_gil_state_ensure (); - - EomPythonPlugin *pyplugin = (EomPythonPlugin *) plugin; - - if (PyObject_HasAttrString (pyplugin->instance, "update_ui")) { - PyObject *py_ret = call_python_method (pyplugin, window, "update_ui"); - - if (py_ret) - { - Py_XDECREF (py_ret); - } - } else { - EOM_PLUGIN_CLASS (parent_class)->update_ui (plugin, window); - } - - pyg_gil_state_release (state); -} - -static void -impl_deactivate (EomPlugin *plugin, - EomWindow *window) -{ - PyGILState_STATE state = pyg_gil_state_ensure (); - - EomPythonPlugin *pyplugin = (EomPythonPlugin *) plugin; - - if (PyObject_HasAttrString (pyplugin->instance, "deactivate")) { - PyObject *py_ret = call_python_method (pyplugin, window, "deactivate"); - - if (py_ret) { - Py_XDECREF (py_ret); - } - } else { - EOM_PLUGIN_CLASS (parent_class)->deactivate (plugin, window); - } - - pyg_gil_state_release (state); -} - -static void -impl_activate (EomPlugin *plugin, - EomWindow *window) -{ - PyGILState_STATE state = pyg_gil_state_ensure (); - - EomPythonPlugin *pyplugin = (EomPythonPlugin *) plugin; - - if (PyObject_HasAttrString (pyplugin->instance, "activate")) { - PyObject *py_ret = call_python_method (pyplugin, window, "activate"); - - if (py_ret) { - Py_XDECREF (py_ret); - } - } else { - EOM_PLUGIN_CLASS (parent_class)->activate (plugin, window); - } - - pyg_gil_state_release (state); -} - -static GtkWidget * -impl_create_configure_dialog (EomPlugin *plugin) -{ - PyGILState_STATE state = pyg_gil_state_ensure (); - EomPythonPlugin *pyplugin = (EomPythonPlugin *) plugin; - GtkWidget *ret = NULL; - - if (PyObject_HasAttrString (pyplugin->instance, "create_configure_dialog")) { - PyObject *py_ret = call_python_method (pyplugin, NULL, "create_configure_dialog"); - - if (py_ret) { - if (check_py_object_is_gtk_widget (py_ret)) { - ret = GTK_WIDGET (pygobject_get (py_ret)); - g_object_ref (ret); - } else { - PyErr_SetString(PyExc_TypeError, "Return value for create_configure_dialog is not a GtkWidget"); - PyErr_Print(); - } - - Py_DECREF (py_ret); - } - } else { - ret = EOM_PLUGIN_CLASS (parent_class)->create_configure_dialog (plugin); - } - - pyg_gil_state_release (state); - - return ret; -} - -static gboolean -impl_is_configurable (EomPlugin *plugin) -{ - PyGILState_STATE state = pyg_gil_state_ensure (); - - EomPythonPlugin *pyplugin = (EomPythonPlugin *) plugin; - - PyObject *dict = pyplugin->instance->ob_type->tp_dict; - - gboolean result; - - if (dict == NULL) - result = FALSE; - else if (!PyDict_Check(dict)) - result = FALSE; - else - result = PyDict_GetItemString(dict, "create_configure_dialog") != NULL; - - pyg_gil_state_release (state); - - return result; -} - -static void -eom_python_plugin_init (EomPythonPlugin *plugin) -{ - EomPythonPluginClass *class; - - eom_debug_message (DEBUG_PLUGINS, "Creating Python plugin instance"); - - class = (EomPythonPluginClass*) (((GTypeInstance*) plugin)->g_class); - - plugin->instance = PyObject_CallObject (class->type, NULL); - - if (plugin->instance == NULL) - PyErr_Print(); -} - -static void -eom_python_plugin_finalize (GObject *plugin) -{ - eom_debug_message (DEBUG_PLUGINS, "Finalizing Python plugin instance"); - - Py_DECREF (((EomPythonPlugin *) plugin)->instance); - - G_OBJECT_CLASS (parent_class)->finalize (plugin); -} - -static void -eom_python_plugin_class_init (EomPythonPluginClass *klass, - gpointer class_data) -{ - EomPluginClass *plugin_class = EOM_PLUGIN_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - klass->type = (PyObject*) class_data; - - G_OBJECT_CLASS (klass)->finalize = eom_python_plugin_finalize; - - plugin_class->activate = impl_activate; - plugin_class->deactivate = impl_deactivate; - plugin_class->update_ui = impl_update_ui; - plugin_class->create_configure_dialog = impl_create_configure_dialog; - plugin_class->is_configurable = impl_is_configurable; -} - -GType -eom_python_plugin_get_type (GTypeModule *module, - PyObject *type) -{ - GType gtype; - gchar *type_name; - - GTypeInfo info = { - sizeof (EomPythonPluginClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) eom_python_plugin_class_init, - NULL, /* class_finalize */ - type, /* class_data */ - sizeof (EomPythonPlugin), - 0, /* n_preallocs */ - (GInstanceInitFunc) eom_python_plugin_init, - }; - - Py_INCREF (type); - - type_name = g_strdup_printf ("%s+EomPythonPlugin", - PyString_AsString (PyObject_GetAttrString (type, "__name__"))); - - eom_debug_message (DEBUG_PLUGINS, "Registering Python plugin instance: %s", type_name); - - gtype = g_type_module_register_type (module, - EOM_TYPE_PLUGIN, - type_name, - &info, 0); - - g_free (type_name); - - return gtype; -} diff --git a/src/eom-python-plugin.h b/src/eom-python-plugin.h deleted file mode 100644 index 41b2984..0000000 --- a/src/eom-python-plugin.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Eye Of Mate - Python Plugin - * - * Copyright (C) 2007 The Free Software Foundation - * - * Author: Lucas Rocha <[email protected]> - * - * Based on gedit code (gedit/gedit-python-module.h) by: - * - Raphael Slinckx <[email protected]> - * - * 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 of the License, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __EOM_PYTHON_PLUGIN_H__ -#define __EOM_PYTHON_PLUGIN_H__ - -#include <Python.h> -#include <glib-object.h> - -#include "eom-plugin.h" - -G_BEGIN_DECLS - -typedef struct _EomPythonPlugin EomPythonPlugin; -typedef struct _EomPythonPluginClass EomPythonPluginClass; - -struct _EomPythonPlugin { - EomPlugin plugin; - - PyObject *instance; -}; - -struct _EomPythonPluginClass { - EomPluginClass parent_class; - - PyObject *type; -}; - -G_GNUC_INTERNAL -GType eom_python_plugin_get_type (GTypeModule *module, PyObject *type); - -G_END_DECLS - -#endif diff --git a/src/eom-window.c b/src/eom-window.c index 1e0d28a..6b3ffb4 100644 --- a/src/eom-window.c +++ b/src/eom-window.c @@ -4636,8 +4636,6 @@ eom_window_dispose (GObject *object) g_clear_object (&priv->thumbview); } - eom_plugin_engine_garbage_collect (); - if (priv->store != NULL) { g_signal_handlers_disconnect_by_func (priv->store, eom_window_list_store_image_added, @@ -4739,8 +4737,6 @@ eom_window_dispose (GObject *object) priv->last_save_as_folder = NULL; } - eom_plugin_engine_garbage_collect (); - G_OBJECT_CLASS (eom_window_parent_class)->dispose (object); } |