Esempio n. 1
0
gint _check_for_distribution_license(gchar *mod_name)
{
	gchar *distributionlicense;
	gchar *conf_file;

	conf_file = g_strdup_printf("%s/" DOTSWORD "/mods.d/%s.conf",
				    settings.homedir,
				    g_utf8_strdown(mod_name, -1));

	if (g_file_test(conf_file, G_FILE_TEST_EXISTS))
		distributionlicense = get_conf_file_item(conf_file,
							 mod_name,
							 "DistributionLicense");
	else
		distributionlicense = main_get_mod_config_entry(mod_name,
								"DistributionLicense");
	g_free(conf_file);
	XI_message(("DistributionLicense: %s", distributionlicense));

	if (!distributionlicense || (distributionlicense &&
				     g_strstr_len(distributionlicense,
						  strlen(distributionlicense),
						  "Copyright"))) {
		if (main_get_one_option(mod_name, OP_NAME) == 0) {
			gui_generic_warning(_("Please check copyright before exporting!"));
			main_save_module_options(mod_name, OP_NAME, 1);
		}

		return 1;
	}

	return 0;
}
Esempio n. 2
0
static void kbd_toggle_option(gboolean cond, gchar *option)
{
	gchar *msg;

	if (cond) {
		int opt = !main_get_one_option(sM, option); // negate.
		main_save_module_options(sM, option, opt);
		gchar *url = g_strdup_printf("sword://%s/%s", sM, sV);
		main_url_handler(url, TRUE);
		g_free(url);
		msg =
		    g_strdup_printf("%s %s", option, (opt ? "on" : "off"));
		gui_set_statusbar(msg);
		g_free(msg);
	} else {
		msg = g_strdup_printf(_("Module has no support for %s."),
				      option);
		gui_generic_warning(msg);
		g_free(msg);
	}
}
Esempio n. 3
0
static void _global_option_main_pane(GtkMenuItem *menuitem, const gchar *option)
{
	gchar *key = _get_key(menu_mod_name);
	gchar *mod =
	    (gchar *)(is_dialog ? dialog->mod_name : menu_mod_name);
	XI_message(("module option = %s", option));
	if (key) {
		gchar *url = g_strdup_printf("sword://%s/%s",
					     mod,
					     key);
		main_save_module_options(mod, (gchar *)option,
					 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem)));
		if (is_dialog) {
			/* show the change */
			main_dialogs_url_handler(dialog, url, TRUE);
		} else {
			/* show the change */
			main_url_handler(url, TRUE);
		}

		g_free(url);
		g_free(key);
	}
}