Print better error message if no plugins are available (fixes #284)

This commit is contained in:
Sebastian Ramacher 2022-05-08 16:44:37 +02:00
parent fbfbefe18b
commit 395ecfab68
3 changed files with 8 additions and 4 deletions

View file

@ -195,15 +195,16 @@ load_dir(void* data, void* userdata)
}
}
void
bool
zathura_plugin_manager_load(zathura_plugin_manager_t* plugin_manager)
{
if (plugin_manager == NULL || plugin_manager->path == NULL) {
return;
return false;
}
/* read all files in the plugin directory */
girara_list_foreach(plugin_manager->path, load_dir, plugin_manager);
return girara_list_size(plugin_manager->plugins) > 0;
}
zathura_plugin_t*

View file

@ -37,8 +37,9 @@ void zathura_plugin_manager_add_dir(zathura_plugin_manager_t* plugin_manager, co
* Loads all plugins available in the previously given directories
*
* @param plugin_manager The plugin manager
* @return Success if some plugins have been loaded, false otherwise
*/
void zathura_plugin_manager_load(zathura_plugin_manager_t* plugin_manager);
bool zathura_plugin_manager_load(zathura_plugin_manager_t* plugin_manager);
/**
* Returns the (if available) associated plugin

View file

@ -430,7 +430,9 @@ zathura_init(zathura_t* zathura)
g_set_prgname("org.pwmt.zathura");
/* load plugins */
zathura_plugin_manager_load(zathura->plugins.manager);
if (zathura_plugin_manager_load(zathura->plugins.manager) == false) {
girara_error("Found no plugins. Please install at least one plugin.");
}
/* configuration */
config_load_default(zathura);