pidgin/pidginapplication.c

changeset 41169
4103b3869912
parent 41134
138d55c90767
child 41209
909561f42b1f
equal deleted inserted replaced
41168:ef6d6a257756 41169:4103b3869912
93 }; 93 };
94 94
95 G_DEFINE_TYPE(PidginApplication, pidgin_application, GTK_TYPE_APPLICATION) 95 G_DEFINE_TYPE(PidginApplication, pidgin_application, GTK_TYPE_APPLICATION)
96 96
97 /****************************************************************************** 97 /******************************************************************************
98 * Helpers
99 *****************************************************************************/
100 static void
101 pidgin_application_init_plugins(void) {
102 GPluginManager *manager = gplugin_manager_get_default();
103
104 gplugin_manager_append_paths_from_environment(manager,
105 "PIDGIN_PLUGIN_PATH");
106
107 if(g_getenv("PURPLE_PLUGINS_SKIP")) {
108 g_message("PURPLE_PLUGINS_SKIP environment variable set, skipping "
109 "normal Pidgin plugin paths");
110 } else {
111 gchar *path = g_build_filename(purple_data_dir(), "plugins", NULL);
112
113 if(!g_file_test(path, G_FILE_TEST_IS_DIR)) {
114 g_mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR);
115 }
116
117 gplugin_manager_append_path(manager, path);
118 g_free(path);
119
120 gplugin_manager_append_path(manager, PIDGIN_LIBDIR);
121 }
122
123 purple_plugins_refresh();
124 }
125
126 /******************************************************************************
98 * Actions 127 * Actions
99 *****************************************************************************/ 128 *****************************************************************************/
100 /**< private > 129 /**< private >
101 * pidgin_application_online_actions: 130 * pidgin_application_online_actions:
102 * 131 *
475 pidgin_application_startup(GApplication *application) { 504 pidgin_application_startup(GApplication *application) {
476 GtkCssProvider *provider = NULL; 505 GtkCssProvider *provider = NULL;
477 GError *error = NULL; 506 GError *error = NULL;
478 GList *active_accounts = NULL; 507 GList *active_accounts = NULL;
479 gchar *search_path = NULL; 508 gchar *search_path = NULL;
480 const gchar *plugin_path = NULL;
481 gpointer handle = NULL; 509 gpointer handle = NULL;
482 510
483 G_APPLICATION_CLASS(pidgin_application_parent_class)->startup(application); 511 G_APPLICATION_CLASS(pidgin_application_parent_class)->startup(application);
484 hdy_init(); 512 hdy_init();
485 513
532 _("Initialization of the libpurple core failed. Aborting!\n" 560 _("Initialization of the libpurple core failed. Aborting!\n"
533 "Please report this!\n")); 561 "Please report this!\n"));
534 g_abort(); 562 g_abort();
535 } 563 }
536 564
537 plugin_path = g_getenv("PIDGIN_PLUGIN_PATH"); 565 pidgin_application_init_plugins();
538 if (plugin_path) {
539 gchar **paths;
540 gint i;
541
542 paths = g_strsplit(plugin_path, G_SEARCHPATH_SEPARATOR_S, 0);
543 for (i = 0; paths[i]; ++i) {
544 purple_plugins_add_search_path(paths[i]);
545 }
546
547 g_strfreev(paths);
548 }
549
550 if(g_getenv("PURPLE_PLUGINS_SKIP")) {
551 purple_debug_info("gtk",
552 "PURPLE_PLUGINS_SKIP environment variable "
553 "set, skipping normal Pidgin plugin paths");
554 } else {
555 search_path = g_build_filename(purple_data_dir(), "plugins", NULL);
556
557 if(!g_file_test(search_path, G_FILE_TEST_IS_DIR)) {
558 g_mkdir(search_path, S_IRUSR | S_IWUSR | S_IXUSR);
559 }
560
561 purple_plugins_add_search_path(search_path);
562 g_free(search_path);
563
564 purple_plugins_add_search_path(PIDGIN_LIBDIR);
565 }
566
567 purple_plugins_refresh();
568 566
569 /* load plugins we had when we quit */ 567 /* load plugins we had when we quit */
570 purple_plugins_load_saved(PIDGIN_PREFS_ROOT "/plugins/loaded"); 568 purple_plugins_load_saved(PIDGIN_PREFS_ROOT "/plugins/loaded");
571 569
572 /* gk 20201008: this needs to be moved to the buddy list initialization. */ 570 /* gk 20201008: this needs to be moved to the buddy list initialization. */

mercurial