diff options
author | Alexander van der Meij <[email protected]> | 2016-03-07 21:21:44 +0100 |
---|---|---|
committer | monsta <[email protected]> | 2016-03-29 11:52:31 +0300 |
commit | 2ca207ea1a91178d28583e2bdab5c3d6aac06d87 (patch) | |
tree | 5cccaf8bb06e757f896faec7a5db2c8f8f8b2abb | |
parent | ce7cc9580809d4017c74b0128f7e82f94eb173d9 (diff) | |
download | caja-2ca207ea1a91178d28583e2bdab5c3d6aac06d87.tar.bz2 caja-2ca207ea1a91178d28583e2bdab5c3d6aac06d87.tar.xz |
use exposed python filenames to list python extensions separately
-rw-r--r-- | libcaja-extension/caja-extension-types.h | 1 | ||||
-rw-r--r-- | libcaja-private/caja-module.c | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/libcaja-extension/caja-extension-types.h b/libcaja-extension/caja-extension-types.h index a72dd41e..ddfbd233 100644 --- a/libcaja-extension/caja-extension-types.h +++ b/libcaja-extension/caja-extension-types.h @@ -64,6 +64,7 @@ extern "C" { void caja_module_shutdown (void); void caja_module_list_types (const GType **types, int *num_types); + void caja_module_list_pyfiles (GList **pyfiles); #ifdef __cplusplus } diff --git a/libcaja-private/caja-module.c b/libcaja-private/caja-module.c index 8c08741c..023c22ea 100644 --- a/libcaja-private/caja-module.c +++ b/libcaja-private/caja-module.c @@ -51,6 +51,7 @@ struct _CajaModule void (*list_types) (const GType **types, int *num_types); + void (*list_pyfiles) (GList **pyfiles); }; @@ -98,6 +99,10 @@ caja_module_load (GTypeModule *gmodule) return FALSE; } + g_module_symbol (module->library, + "caja_module_list_pyfiles", + (gpointer *)&module->list_pyfiles); + module->initialize (gmodule); return TRUE; @@ -154,6 +159,7 @@ static void add_module_objects (CajaModule *module) { GObject *object = NULL; + GList *pyfiles = NULL; gchar *filename = NULL; const GType *types = NULL; int num_types = 0; @@ -162,12 +168,24 @@ add_module_objects (CajaModule *module) module->list_types (&types, &num_types); filename = g_path_get_basename (module->path); + /* fetch extensions details loaded through python-caja module */ + if (module->list_pyfiles) + { + module->list_pyfiles(&pyfiles); + } + for (i = 0; i < num_types; i++) { if (types[i] == 0) /* Work around broken extensions */ { break; } + + if (module->list_pyfiles) + { + filename = g_strconcat(g_list_nth_data(pyfiles, i), ".py", NULL); + } + object = caja_module_add_type (types[i]); caja_extension_register (filename, object); } |