Use the correct config folder to store speed dial

This is important when using the -c or --config switch
This commit is contained in:
Christian Dywan 2009-05-10 14:48:12 +02:00
parent 56c1231d7a
commit 64b60d7f94
2 changed files with 8 additions and 7 deletions

View file

@ -879,8 +879,8 @@ midori_browser_speed_dial_get_next_free_slot (void)
gchar* slot_id = NULL; gchar* slot_id = NULL;
gchar* p = NULL; gchar* p = NULL;
body_fname = g_strdup_printf ("%s%s", g_get_user_config_dir (), body_fname = g_build_filename (sokoke_set_config_dir (NULL),
"/midori/speeddial-body.html"); "speeddial-body.html", NULL);
if (!g_file_test (body_fname, G_FILE_TEST_EXISTS)) if (!g_file_test (body_fname, G_FILE_TEST_EXISTS))
{ {
g_file_get_contents (DATADIR "/midori/res/speeddial-body.html", g_file_get_contents (DATADIR "/midori/res/speeddial-body.html",
@ -953,8 +953,8 @@ midori_browser_add_speed_dial (MidoriBrowser* browser)
gchar* body_fname; gchar* body_fname;
gsize sz; gsize sz;
body_fname = g_strdup_printf ("%s%s", g_get_user_config_dir (), body_fname = g_build_filename (sokoke_set_config_dir (NULL),
"/midori/speeddial-body.html"); "speeddial-body.html", NULL);
g_file_get_contents (body_fname, &speed_dial_body, NULL, NULL); g_file_get_contents (body_fname, &speed_dial_body, NULL, NULL);

View file

@ -1972,8 +1972,8 @@ midori_view_set_uri (MidoriView* view,
res_server = sokoke_get_res_server (); res_server = sokoke_get_res_server ();
port = soup_server_get_port (res_server); port = soup_server_get_port (res_server);
res_root = g_strdup_printf ("http://localhost:%d/res", port); res_root = g_strdup_printf ("http://localhost:%d/res", port);
body_fname = g_strconcat (g_get_user_config_dir (), body_fname = g_build_filename (sokoke_set_config_dir (NULL),
"/midori/speeddial-body.html", NULL); "speeddial-body.html", NULL);
if (!g_file_test (body_fname, G_FILE_TEST_EXISTS)) if (!g_file_test (body_fname, G_FILE_TEST_EXISTS))
{ {
@ -2998,7 +2998,8 @@ midori_view_speed_dial_save (GtkWidget* web_view)
JSContextRef js_context = webkit_web_frame_get_global_context ( JSContextRef js_context = webkit_web_frame_get_global_context (
webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view))); webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view)));
gchar* newdom = sokoke_js_script_eval (js_context,"getSpeeddialContent()", NULL); gchar* newdom = sokoke_js_script_eval (js_context,"getSpeeddialContent()", NULL);
gchar* fname = g_strconcat (g_get_user_config_dir (), "/midori/speeddial-body.html", NULL); gchar* fname = g_build_filename (sokoke_set_config_dir (NULL),
"speeddial-body.html", NULL);
g_file_set_contents (fname, newdom, -1, NULL); g_file_set_contents (fname, newdom, -1, NULL);
g_free (fname); g_free (fname);
g_free (newdom); g_free (newdom);