コード例 #1
0
ファイル: math-variables.c プロジェクト: ingeniumed/gcalctool
static void
math_variables_init(MathVariables *variables)
{
    variables->priv = G_TYPE_INSTANCE_GET_PRIVATE (variables, math_variables_get_type(), MathVariablesPrivate);
    variables->priv->registers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
    variables->priv->file_name = g_build_filename(g_get_user_data_dir(), "gcalctool", "registers", NULL);
    variables->priv->serializer = mp_serializer_new(MP_DISPLAY_FORMAT_SCIENTIFIC, 10, 50);
    mp_serializer_set_radix(variables->priv->serializer, '.');
    registers_load(variables);
}
コード例 #2
0
ファイル: program.c プロジェクト: Manasmitha/geany-plugins
static void on_recent_menu_item_activate(G_GNUC_UNUSED GtkMenuItem *menuitem, const gchar *name)
{
	GtkTreeIter iter;

	if (utils_filenamecmp(name, *program_executable ? program_executable :
		program_load_script) && program_find(&iter, name))
	{
		gint id;
		char *configfile;
		GKeyFile *config = g_key_file_new();
		GError *gerror = NULL;
		gchar *message;

		scp_tree_store_get(recent_programs, &iter, PROGRAM_ID, &id, -1);
		configfile = recent_file_name(id);

		if (g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, &gerror))
		{
			scp_tree_store_move(recent_programs, &iter, 0);
			save_program_settings();
			stash_foreach((GFunc) stash_group_load_from_key_file, config);
			if ((unsigned) option_inspect_expand > EXPAND_MAX)
				option_inspect_expand = 100;
			breaks_load(config);
			watches_load(config);
			inspects_load(config);
			registers_load(config);
			parse_load(config);
			message = g_strdup_printf(_("Loaded debug settings for %s."), name);
			program_find(&iter, name);
			scp_tree_store_move(recent_programs, &iter, 0);
			recent_menu_create();
			program_configure();
		}
		else
		{
			message = g_strdup_printf(_("Could not load debug settings file %s: %s."),
				configfile, gerror->message);
			g_error_free(gerror);
		}

		if (menuitem)
			ui_set_statusbar(TRUE, "%s", message);
		else
			msgwin_status_add("%s", message);

		g_free(message);
		g_key_file_free(config);
		g_free(configfile);
	}
}