489
489
formhistory_new (const gchar* config_dir)
493
char* errmsg = NULL, *errmsg2 = NULL;
492
GError* error = NULL;
494
493
FormHistoryPriv* priv = formhistory_private_new ();
495
494
priv->master_password = NULL;
496
495
priv->master_password_canceled = 0;
497
496
formhistory_construct_popup_gui (priv);
499
498
filename = g_build_filename (config_dir, "forms.db", NULL);
500
if (sqlite3_open (filename, &db) != SQLITE_OK)
502
g_warning (_("Failed to open database: %s\n"), sqlite3_errmsg (db));
499
priv->database = midori_database_new (filename, &error);
505
500
g_free (filename);
506
if ((sqlite3_exec (db, "CREATE TABLE IF NOT EXISTS "
507
"forms (domain text, field text, value text)",
508
NULL, NULL, &errmsg) == SQLITE_OK))
511
/* "PRAGMA synchronous = OFF; PRAGMA temp_store = MEMORY" */
512
"PRAGMA count_changes = OFF; PRAGMA journal_mode = TRUNCATE;",
513
NULL, NULL, &errmsg);
520
g_critical (_("Failed to execute database statement: %s\n"), errmsg);
521
sqlite3_free (errmsg);
524
g_critical (_("Failed to execute database statement: %s\n"), errmsg2);
525
sqlite3_free (errmsg2);
503
g_critical ("%s", error->message);
504
g_error_free (error);
509
priv->db = midori_database_get_db (MIDORI_DATABASE (priv->database));
510
g_warn_if_fail (priv->db != NULL);