void gkrellm_plugins_load(void) { GkrellmMonitor *m; gchar *path; if (_GK.command_line_plugin) { if ( *_GK.command_line_plugin != '.' && !strchr(_GK.command_line_plugin, G_DIR_SEPARATOR) ) path = g_strconcat(".", G_DIR_SEPARATOR_S, _GK.command_line_plugin, NULL); else path = g_strdup(_GK.command_line_plugin); plugin_log(_("*** Command line plugin:\n"), NULL); if ((m = install_plugin(path)) == NULL) g_free(path); else { m->privat->from_command_line = TRUE; plugins_list = g_list_append(plugins_list, m); } plugin_log("\n", NULL); } load_plugins_enable_file(); load_plugins_placement_file(); path = g_strconcat(gkrellm_homedir(), G_DIR_SEPARATOR_S, GKRELLM_PLUGINS_DIR, NULL); scan_for_plugins(path); g_free(path); #if defined(WIN32) path = NULL; #if GLIB_CHECK_VERSION(2,16,0) gchar *install_path; install_path = g_win32_get_package_installation_directory_of_module(NULL); if (install_path != NULL) { path = g_build_filename(install_path, "lib", "gkrellm2", "plugins", NULL); g_free(install_path); } #else // deprecated since glib 2.16.0 path = g_win32_get_package_installation_subdirectory(NULL, NULL, "lib/gkrellm2/plugins"); #endif if (path) { scan_for_plugins(path); g_free(path); } #endif #if defined(LOCAL_PLUGINS_DIR) scan_for_plugins(LOCAL_PLUGINS_DIR); #endif #if defined(SYSTEM_PLUGINS_DIR) scan_for_plugins(SYSTEM_PLUGINS_DIR); #endif }
int LoadPlugins(void) { #ifdef HAVE_PLUGINS gchar *path; gchar **list; int f; if(!g_module_supported()) return EINVAL; if(plugin_list) { // Load only defined plugins list = g_strsplit(plugin_list,",",0); if(list) { for(f=0;list[f];f++) { if(g_file_test(list[f],G_FILE_TEST_EXISTS)) { load_plugin(list[f]); } else { GtkWidget *dialog; dialog = gtk_message_dialog_new( GTK_WINDOW(topwindow), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, _( "Can't load \"%s\"" ), list[f]); gtk_window_set_title(GTK_WINDOW(dialog), _( "Can't load plugin" ) ); gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), _( "The required plugin file wasn't found" )); gtk_dialog_run(GTK_DIALOG (dialog)); gtk_widget_destroy(dialog); } } g_strfreev(list); } } else { // Scan for all available plugins if(plugin_path) { scan_for_plugins(plugin_path); } else { #if defined( DEBUG ) path = g_build_filename(".","plugins",NULL); scan_for_plugins(path); g_free(path); #elif defined(_WIN32) path = g_build_filename(program_data,"plugins",NULL); scan_for_plugins(path); g_free(path); #elif defined( LIBDIR ) path = g_build_filename(LIBDIR,PACKAGE_NAME,"plugins",NULL); scan_for_plugins(path); g_free(path); #else path = g_build_filename(program_data,"plugins",NULL); scan_for_plugins(path); g_free(path); #endif } } #endif return 0; }