diff options
author | Gary Kramlich <grim@reaperworld.com> | 2021-11-11 23:19:07 -0600 |
---|---|---|
committer | Gary Kramlich <grim@reaperworld.com> | 2021-11-11 23:19:07 -0600 |
commit | 1d6b0e68e8a1c9ea26604b28c417f023d0e06424 (patch) | |
tree | 48a92a4884113a9aabc56b6a65b60a095ba80946 | |
parent | 201be594cc2a160ec8dc69297d16060cdc12de09 (diff) | |
download | pidgin-1d6b0e68e8a1c9ea26604b28c417f023d0e06424.tar.gz |
Upgrade to gplugin 0.37.0
Testing Done:
Ran pidgin3 from the `devenv` and verified the plugins were all still available.
Reviewed at https://reviews.imfreedom.org/r/1136/
-rw-r--r-- | finch/libfinch.c | 46 | ||||
-rw-r--r-- | libpurple/plugins.c | 15 | ||||
-rw-r--r-- | meson.build | 4 | ||||
-rw-r--r-- | pidgin/pidginapplication.c | 62 | ||||
-rw-r--r-- | subprojects/gplugin.wrap | 2 |
5 files changed, 58 insertions, 71 deletions
diff --git a/finch/libfinch.c b/finch/libfinch.c index 3e8a997a5b..92177eb6d0 100644 --- a/finch/libfinch.c +++ b/finch/libfinch.c @@ -72,17 +72,37 @@ start_with_debugwin(gpointer null) return FALSE; } +static void +finch_plugins_init(void) { + GPluginManager *manager = NULL; + gchar *path = NULL; + + manager = gplugin_manager_get_default(); + + gplugin_manager_append_paths_from_environment(manager, + "FINCH_PLUGIN_PATH"); + + path = g_build_filename(purple_data_dir(), "plugins", NULL); + if(g_mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR) != 0 && errno != EEXIST) { + fprintf(stderr, "Couldn't create plugins dir\n"); + } + gplugin_manager_append_path(manager, path); + g_free(path); + + gplugin_manager_append_path(manager, FINCH_LIBDIR); + + purple_plugins_refresh(); +} + static int init_libpurple(int argc, char **argv) { - char *path; gboolean opt_nologin = FALSE; gboolean opt_version = FALSE; gboolean opt_debug = FALSE; char *opt_config_dir_arg = NULL; GOptionContext *context; gchar **args; - const gchar *plugin_path = NULL; GError *error = NULL; GOptionEntry option_entries[] = { @@ -177,27 +197,7 @@ init_libpurple(int argc, char **argv) abort(); } - plugin_path = g_getenv("FINCH_PLUGIN_PATH"); - if (plugin_path) { - gchar **paths; - gint i; - - paths = g_strsplit(plugin_path, G_SEARCHPATH_SEPARATOR_S, 0); - for (i = 0; paths[i]; ++i) { - purple_plugins_add_search_path(paths[i]); - } - - g_strfreev(paths); - } - - path = g_build_filename(purple_data_dir(), "plugins", NULL); - if (g_mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR) != 0 && errno != EEXIST) - fprintf(stderr, "Couldn't create plugins dir\n"); - purple_plugins_add_search_path(path); - g_free(path); - - purple_plugins_add_search_path(FINCH_LIBDIR); - purple_plugins_refresh(); + finch_plugins_init(); /* TODO: should this be moved into finch_prefs_init() ? */ finch_prefs_update_old(); diff --git a/libpurple/plugins.c b/libpurple/plugins.c index f0324698c4..19f1be4401 100644 --- a/libpurple/plugins.c +++ b/libpurple/plugins.c @@ -486,24 +486,13 @@ void purple_plugins_init(void) { GPluginManager *manager = NULL; - const gchar *search_path; gplugin_init(GPLUGIN_CORE_FLAGS_NONE); manager = gplugin_manager_get_default(); - search_path = g_getenv("PURPLE_PLUGIN_PATH"); - if (search_path) { - gchar **paths; - gint i; - - paths = g_strsplit(search_path, G_SEARCHPATH_SEPARATOR_S, 0); - for (i = 0; paths[i]; ++i) { - gplugin_manager_append_path(manager, paths[i]); - } - - g_strfreev(paths); - } + gplugin_manager_append_paths_from_environment(manager, + "PURPLE_PLUGIN_PATH"); gplugin_manager_add_default_paths(manager); diff --git a/meson.build b/meson.build index 9de72a74f9..f1bfcf8013 100644 --- a/meson.build +++ b/meson.build @@ -560,12 +560,12 @@ endif # Check for GPlugin ####################################################################### gplugin_dep = dependency('gplugin', - version : ['>=0.36.0', '<0.37.0'], + version : ['>=0.37.0', '<0.38.0'], fallback : ['gplugin', 'gplugin_dep']) if get_option('gtkui') gplugin_gtk_dep = dependency('gplugin-gtk3', - version : ['>=0.36.0', '<0.37.0'], + version : ['>=0.37.0', '<0.38.0'], fallback : ['gplugin-gtk', 'gplugin_gtk3_dep']) endif diff --git a/pidgin/pidginapplication.c b/pidgin/pidginapplication.c index 79b7dd8b88..93be984b26 100644 --- a/pidgin/pidginapplication.c +++ b/pidgin/pidginapplication.c @@ -95,6 +95,35 @@ static GOptionEntry option_entries[] = { G_DEFINE_TYPE(PidginApplication, pidgin_application, GTK_TYPE_APPLICATION) /****************************************************************************** + * Helpers + *****************************************************************************/ +static void +pidgin_application_init_plugins(void) { + GPluginManager *manager = gplugin_manager_get_default(); + + gplugin_manager_append_paths_from_environment(manager, + "PIDGIN_PLUGIN_PATH"); + + if(g_getenv("PURPLE_PLUGINS_SKIP")) { + g_message("PURPLE_PLUGINS_SKIP environment variable set, skipping " + "normal Pidgin plugin paths"); + } else { + gchar *path = g_build_filename(purple_data_dir(), "plugins", NULL); + + if(!g_file_test(path, G_FILE_TEST_IS_DIR)) { + g_mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR); + } + + gplugin_manager_append_path(manager, path); + g_free(path); + + gplugin_manager_append_path(manager, PIDGIN_LIBDIR); + } + + purple_plugins_refresh(); +} + +/****************************************************************************** * Actions *****************************************************************************/ /**< private > @@ -477,7 +506,6 @@ pidgin_application_startup(GApplication *application) { GError *error = NULL; GList *active_accounts = NULL; gchar *search_path = NULL; - const gchar *plugin_path = NULL; gpointer handle = NULL; G_APPLICATION_CLASS(pidgin_application_parent_class)->startup(application); @@ -534,37 +562,7 @@ pidgin_application_startup(GApplication *application) { g_abort(); } - plugin_path = g_getenv("PIDGIN_PLUGIN_PATH"); - if (plugin_path) { - gchar **paths; - gint i; - - paths = g_strsplit(plugin_path, G_SEARCHPATH_SEPARATOR_S, 0); - for (i = 0; paths[i]; ++i) { - purple_plugins_add_search_path(paths[i]); - } - - g_strfreev(paths); - } - - if(g_getenv("PURPLE_PLUGINS_SKIP")) { - purple_debug_info("gtk", - "PURPLE_PLUGINS_SKIP environment variable " - "set, skipping normal Pidgin plugin paths"); - } else { - search_path = g_build_filename(purple_data_dir(), "plugins", NULL); - - if(!g_file_test(search_path, G_FILE_TEST_IS_DIR)) { - g_mkdir(search_path, S_IRUSR | S_IWUSR | S_IXUSR); - } - - purple_plugins_add_search_path(search_path); - g_free(search_path); - - purple_plugins_add_search_path(PIDGIN_LIBDIR); - } - - purple_plugins_refresh(); + pidgin_application_init_plugins(); /* load plugins we had when we quit */ purple_plugins_load_saved(PIDGIN_PREFS_ROOT "/plugins/loaded"); diff --git a/subprojects/gplugin.wrap b/subprojects/gplugin.wrap index 941051f123..74a654db5b 100644 --- a/subprojects/gplugin.wrap +++ b/subprojects/gplugin.wrap @@ -1,4 +1,4 @@ [wrap-hg] directory = gplugin url = https://keep.imfreedom.org/gplugin/gplugin -revision = v0.36.0 +revision = v0.37.0 |