Look for MidoriView resource files dynamically
This commit is contained in:
parent
4774e35932
commit
aef84bfa02
1 changed files with 34 additions and 11 deletions
|
@ -993,25 +993,32 @@ webkit_web_frame_load_done_cb (WebKitWebFrame* web_frame,
|
||||||
{
|
{
|
||||||
gchar* title;
|
gchar* title;
|
||||||
gchar* data;
|
gchar* data;
|
||||||
|
gchar* logo_path;
|
||||||
|
gchar* logo_uri;
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
/* i18n: The title of the 404 - Not found error page */
|
/* i18n: The title of the 404 - Not found error page */
|
||||||
title = g_strdup_printf (_("Not found - %s"), view->uri);
|
title = g_strdup_printf (_("Not found - %s"), view->uri);
|
||||||
katze_assign (view->title, title);
|
katze_assign (view->title, title);
|
||||||
|
logo_path = sokoke_find_data_filename ("midori/logo-shade.png");
|
||||||
|
logo_uri = g_filename_to_uri (logo_path);
|
||||||
|
g_free (logo_path);
|
||||||
data = g_strdup_printf (
|
data = g_strdup_printf (
|
||||||
"<html><head><title>%s</title></head>"
|
"<html><head><title>%s</title></head>"
|
||||||
"<body><h1>%s</h1>"
|
"<body><h1>%s</h1>"
|
||||||
"<img src=\"file://" MDATADIR "/midori/logo-shade.png\" "
|
"<img src=\"%s\" "
|
||||||
"style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">"
|
"style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">"
|
||||||
"<p />The page you were opening doesn't exist."
|
"<p />The page you were opening doesn't exist."
|
||||||
"<p />Try to <a href=\"%s\">load the page again</a>, "
|
"<p />Try to <a href=\"%s\">load the page again</a>, "
|
||||||
"or move on to another page."
|
"or move on to another page."
|
||||||
"</body></html>",
|
"</body></html>",
|
||||||
title, title, view->uri);
|
title, title, logo_uri, view->uri);
|
||||||
webkit_web_view_load_html_string (
|
webkit_web_view_load_html_string (
|
||||||
WEBKIT_WEB_VIEW (view->web_view), data, view->uri);
|
WEBKIT_WEB_VIEW (view->web_view), data, view->uri);
|
||||||
|
g_free (title);
|
||||||
g_free (data);
|
g_free (data);
|
||||||
|
g_free (logo_uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
midori_view_update_load_status (view, MIDORI_LOAD_FINISHED);
|
midori_view_update_load_status (view, MIDORI_LOAD_FINISHED);
|
||||||
|
@ -3125,11 +3132,13 @@ midori_view_set_uri (MidoriView* view,
|
||||||
gchar* speed_dial_body;
|
gchar* speed_dial_body;
|
||||||
gchar* body_fname;
|
gchar* body_fname;
|
||||||
gchar* stock_root;
|
gchar* stock_root;
|
||||||
|
gchar* filepath;
|
||||||
|
|
||||||
katze_assign (view->uri, g_strdup (""));
|
katze_assign (view->uri, g_strdup (""));
|
||||||
|
|
||||||
g_file_get_contents (MDATADIR "/midori/res/speeddial-head.html",
|
filepath = sokoke_find_data_filename ("midori/res/speeddial-head.html");
|
||||||
&speed_dial_head, NULL, NULL);
|
g_file_get_contents (filepath, &speed_dial_head, NULL, NULL);
|
||||||
|
g_free (filepath);
|
||||||
if (G_UNLIKELY (!speed_dial_head))
|
if (G_UNLIKELY (!speed_dial_head))
|
||||||
speed_dial_head = g_strdup ("");
|
speed_dial_head = g_strdup ("");
|
||||||
|
|
||||||
|
@ -3147,11 +3156,13 @@ midori_view_set_uri (MidoriView* view,
|
||||||
|
|
||||||
if (g_access (body_fname, F_OK) != 0)
|
if (g_access (body_fname, F_OK) != 0)
|
||||||
{
|
{
|
||||||
if (g_file_get_contents (MDATADIR "/midori/res/speeddial.json",
|
filepath = sokoke_find_data_filename ("midori/res/speeddial.json");
|
||||||
|
if (g_file_get_contents (filepath,
|
||||||
&speed_dial_body, NULL, NULL))
|
&speed_dial_body, NULL, NULL))
|
||||||
g_file_set_contents (body_fname, speed_dial_body, -1, NULL);
|
g_file_set_contents (body_fname, speed_dial_body, -1, NULL);
|
||||||
else
|
else
|
||||||
speed_dial_body = g_strdup ("");
|
speed_dial_body = g_strdup ("");
|
||||||
|
g_free (filepath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
g_file_get_contents (body_fname, &speed_dial_body, NULL, NULL);
|
g_file_get_contents (body_fname, &speed_dial_body, NULL, NULL);
|
||||||
|
@ -3196,38 +3207,50 @@ midori_view_set_uri (MidoriView* view,
|
||||||
if (!strncmp (uri, "error:nodisplay ", 16))
|
if (!strncmp (uri, "error:nodisplay ", 16))
|
||||||
{
|
{
|
||||||
gchar* title;
|
gchar* title;
|
||||||
|
gchar* logo_path;
|
||||||
|
gchar* logo_uri;
|
||||||
|
|
||||||
katze_assign (view->uri, g_strdup (&uri[16]));
|
katze_assign (view->uri, g_strdup (&uri[16]));
|
||||||
title = g_strdup_printf (_("Document cannot be displayed"));
|
title = g_strdup_printf (_("Document cannot be displayed"));
|
||||||
|
logo_path = sokoke_find_data_filename ("midori/logo-shade.png");
|
||||||
|
logo_uri = g_filename_to_uri (logo_path, NULL, NULL);
|
||||||
|
g_free (logo_path);
|
||||||
data = g_strdup_printf (
|
data = g_strdup_printf (
|
||||||
"<html><head><title>%s</title></head>"
|
"<html><head><title>%s</title></head>"
|
||||||
"<body><h1>%s</h1>"
|
"<body><h1>%s</h1>"
|
||||||
"<img src=\"file://" MDATADIR "/midori/logo-shade.png\" "
|
"<img src=\"%s\" "
|
||||||
"style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">"
|
"style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">"
|
||||||
"<p />The document %s of type '%s' cannot be displayed."
|
"<p />The document %s of type '%s' cannot be displayed."
|
||||||
"</body></html>",
|
"</body></html>",
|
||||||
title, title, view->uri, view->mime_type);
|
title, title, logo_uri, view->uri, view->mime_type);
|
||||||
g_free (title);
|
g_free (title);
|
||||||
|
g_free (logo_uri);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!strncmp (uri, "error:nodocs ", 13))
|
if (!strncmp (uri, "error:nodocs ", 13))
|
||||||
{
|
{
|
||||||
gchar* title;
|
gchar* title;
|
||||||
|
gchar* logo_path;
|
||||||
|
gchar* logo_uri;
|
||||||
|
|
||||||
katze_assign (view->uri, g_strdup (&uri[13]));
|
katze_assign (view->uri, g_strdup (&uri[13]));
|
||||||
title = g_strdup_printf (_("No documentation installed"));
|
title = g_strdup_printf (_("No documentation installed"));
|
||||||
|
logo_path = sokoke_find_data_filename ("midori/logo-shade.png");
|
||||||
|
logo_uri = g_filename_to_uri (logo_path, NULL, NULL);
|
||||||
|
g_free (logo_path);
|
||||||
data = g_strdup_printf (
|
data = g_strdup_printf (
|
||||||
"<html><head><title>%s</title></head>"
|
"<html><head><title>%s</title></head>"
|
||||||
"<body><h1>%s</h1>"
|
"<body><h1>%s</h1>"
|
||||||
"<img src=\"file://" MDATADIR "/midori/logo-shade.png\" "
|
"<img src=\"%s\" "
|
||||||
"style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">"
|
"style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">"
|
||||||
"<p />There is no documentation installed at %s."
|
"<p />There is no documentation installed at %s."
|
||||||
"You may want to ask your distribution or "
|
"You may want to ask your distribution or "
|
||||||
"package maintainer for it or if this a custom build "
|
"package maintainer for it or if this a custom build "
|
||||||
"verify that the build is setup properly."
|
"verify that the build is setup properly."
|
||||||
"</body></html>",
|
"</body></html>",
|
||||||
title, title, view->uri);
|
title, title, logo_uri, view->uri);
|
||||||
g_free (title);
|
g_free (title);
|
||||||
|
g_free (logo_uri);
|
||||||
}
|
}
|
||||||
else if (!strcmp (uri, "about:version"))
|
else if (!strcmp (uri, "about:version"))
|
||||||
{
|
{
|
||||||
|
@ -4696,9 +4719,9 @@ midori_view_speed_dial_inject_thumb (MidoriView* view,
|
||||||
/* We use an empty label. It's not invisible but at least hard to spot. */
|
/* We use an empty label. It's not invisible but at least hard to spot. */
|
||||||
label = gtk_event_box_new ();
|
label = gtk_event_box_new ();
|
||||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), view->thumb_view, label);
|
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), view->thumb_view, label);
|
||||||
g_object_unref (notebook);
|
|
||||||
gtk_widget_show (view->thumb_view);
|
gtk_widget_show (view->thumb_view);
|
||||||
}
|
}
|
||||||
|
g_object_unref (notebook);
|
||||||
thumb_view = view->thumb_view;
|
thumb_view = view->thumb_view;
|
||||||
settings = g_object_new (MIDORI_TYPE_WEB_SETTINGS, "enable-scripts", FALSE,
|
settings = g_object_new (MIDORI_TYPE_WEB_SETTINGS, "enable-scripts", FALSE,
|
||||||
"enable-plugins", FALSE, "auto-load-images", TRUE, NULL);
|
"enable-plugins", FALSE, "auto-load-images", TRUE, NULL);
|
||||||
|
@ -4711,7 +4734,7 @@ midori_view_speed_dial_inject_thumb (MidoriView* view,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* midori_view_speed_dial_save
|
* midori_view_speed_dial_get_thumb
|
||||||
* @web_view: a #WebkitView
|
* @web_view: a #WebkitView
|
||||||
* @message: Console log data
|
* @message: Console log data
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue