Esempio n. 1
0
void
math_variables_delete(MathVariables *variables, const char *name)
{
    g_return_if_fail(variables != NULL);
    g_return_if_fail(name != NULL);
    g_hash_table_remove(variables->priv->registers, name);
    registers_save(variables);
}
Esempio n. 2
0
void
math_variables_set(MathVariables *variables, const char *name, const MPNumber *value)
{
    MPNumber *t;

    g_return_if_fail(variables != NULL);
    g_return_if_fail(name != NULL);
    g_return_if_fail(value != NULL);

    t = g_malloc(sizeof(MPNumber));
    mp_set_from_mp(value, t);
    g_hash_table_insert(variables->priv->registers, g_strdup(name), t);
    registers_save(variables);
}
Esempio n. 3
0
static void save_program_settings(void)
{
	const gchar *program_name = *program_executable ? program_executable :
		program_load_script;

	if (*program_name)
	{
		GtkTreeIter iter;
		gint id;
		GKeyFile *config = g_key_file_new();
		char *configfile;

		if (program_find(&iter, program_name))
		{
			scp_tree_store_get(recent_programs, &iter, PROGRAM_ID, &id, -1);
			scp_tree_store_move(recent_programs, &iter, 0);
		}
		else
		{
			if (scp_tree_store_iter_nth_child(recent_programs, &iter, NULL,
				RECENT_COUNT - 1))
			{
				scp_tree_store_get(recent_programs, &iter, PROGRAM_ID, &id, -1);
				scp_tree_store_remove(recent_programs, &iter);
			}
			else
			{
				for (id = 1; id < RECENT_COUNT; id++)
					if ((recent_bitmap & (1 << id)) == 0)
						break;

				recent_bitmap |= 1 << id;
			}

			scp_tree_store_prepend_with_values(recent_programs, &iter, NULL,
				PROGRAM_NAME, program_name, PROGRAM_ID, id, -1);
		}

		configfile = recent_file_name(id);
		stash_foreach((GFunc) stash_group_save_to_key_file, config);
		breaks_save(config);
		watches_save(config);
		inspects_save(config);
		registers_save(config);
		parse_save(config);
		utils_key_file_write_to_file(config, configfile);
		g_free(configfile);
		g_key_file_free(config);
	}
}