Merge branch 'upstream-unstable'

This commit is contained in:
Yves-Alexis Perez 2011-02-19 23:39:59 +01:00
commit 99655c6cc4
29 changed files with 10906 additions and 9320 deletions

View file

@ -1,5 +1,20 @@
This file is licensed under the terms of the expat license, see the file EXPAT. This file is licensed under the terms of the expat license, see the file EXPAT.
v0.3.1
+ Fix automigration of existing bookmarks
+ Fix crash on opening autocompletion
+ Fix adblock handling of frames
+ Reflect tab order in the saved session
+ Don't show multiple user addon infobars
+ Provide distribution setting for close on left
+ Export to Netscape HTML format
+ Avoid config update on state changes
+ Always show progress and search engines in location
+ Default to app menu and no menubar
+ Fix GTK+ 2.14 build problems
+ Show 'Private Browsing' in window title
+ Uncached reload with Ctrl+Shift+R
v0.3.0 v0.3.0
+ Support libnotify 0.7 + Support libnotify 0.7
+ Copy-friendly URIs with %20 + Copy-friendly URIs with %20

View file

@ -654,16 +654,17 @@ adblock_is_matched_by_key (const gchar* opts,
{ {
if (g_regex_match_full (regex, req_uri, -1, 0, 0, NULL, NULL)) if (g_regex_match_full (regex, req_uri, -1, 0, 0, NULL, NULL))
{ {
g_free (uri);
g_free (sig); g_free (sig);
if (opts && adblock_check_filter_options (regex, opts, req_uri, page_uri)) if (opts && adblock_check_filter_options (regex, opts, req_uri, page_uri))
{ {
g_free (uri);
g_list_free (regex_bl); g_list_free (regex_bl);
return FALSE; return FALSE;
} }
else else
{ {
adblock_debug ("blocked by regexp=%s -- %s", g_regex_get_pattern (regex), uri); adblock_debug ("blocked by regexp=%s -- %s", g_regex_get_pattern (regex), uri);
g_free (uri);
g_list_free (regex_bl); g_list_free (regex_bl);
return TRUE; return TRUE;
} }
@ -753,7 +754,8 @@ adblock_resource_request_starting_cb (WebKitWebView* web_view,
const char *page_uri; const char *page_uri;
/* Never filter the main page itself */ /* Never filter the main page itself */
if (web_frame == webkit_web_view_get_main_frame (web_view)) if (web_frame == webkit_web_view_get_main_frame (web_view)
&& webkit_web_frame_get_load_status (web_frame) == WEBKIT_LOAD_PROVISIONAL)
return; return;
req_uri = webkit_network_request_get_uri (request); req_uri = webkit_network_request_get_uri (request);

View file

@ -108,7 +108,7 @@ addons_install_response (GtkWidget* infobar,
if (uri && *uri) if (uri && *uri)
{ {
gchar** split_uri; gchar** split_uri;
gchar* path, *filename, *hostname, *dest_path, *temp_uri; gchar* path, *filename, *hostname, *dest_path, *temp_uri, *folder_path;
const gchar* folder; const gchar* folder;
WebKitNetworkRequest* request; WebKitNetworkRequest* request;
WebKitDownload* download; WebKitDownload* download;
@ -119,7 +119,11 @@ addons_install_response (GtkWidget* infobar,
filename = NULL; filename = NULL;
folder = NULL; folder = NULL;
if (!g_strcmp0 (hostname, "userscripts.org")) if (g_str_has_suffix (uri, ".user.js"))
folder = "scripts";
else if (g_str_has_suffix (uri, ".user.css"))
folder = "styles";
else if (!g_strcmp0 (hostname, "userscripts.org"))
{ {
gchar* script_id; gchar* script_id;
const gchar* js_script; const gchar* js_script;
@ -129,7 +133,7 @@ addons_install_response (GtkWidget* infobar,
web_view = WEBKIT_WEB_VIEW (midori_view_get_web_view (view)); web_view = WEBKIT_WEB_VIEW (midori_view_get_web_view (view));
web_frame = webkit_web_view_get_main_frame (web_view); web_frame = webkit_web_view_get_main_frame (web_view);
js_script = "document.getElementById('heading').childNodes[3].childNodes[1].innerHTML"; js_script = "document.getElementById('heading').childNodes[3].childNodes[1].textContent";
if (WEBKIT_IS_WEB_FRAME (web_frame)) if (WEBKIT_IS_WEB_FRAME (web_frame))
{ {
JSContextRef js_context = webkit_web_frame_get_global_context (web_frame); JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
@ -182,14 +186,14 @@ addons_install_response (GtkWidget* infobar,
} }
} }
if (g_str_has_suffix (uri, ".user.js"))
folder = "scripts";
else if (g_str_has_suffix (uri, ".user.css"))
folder = "styles";
if (!filename) if (!filename)
filename = g_path_get_basename (uri); filename = g_path_get_basename (uri);
path = g_build_path (G_DIR_SEPARATOR_S, g_get_user_data_dir (), folder_path = g_build_path (G_DIR_SEPARATOR_S, g_get_user_data_dir (),
PACKAGE_NAME, folder, filename, NULL); PACKAGE_NAME, folder, NULL);
if (!g_file_test (folder_path, G_FILE_TEST_EXISTS))
katze_mkdir_with_parents (folder_path, 0700);
path = g_build_path (G_DIR_SEPARATOR_S, folder_path, filename, NULL);
request = webkit_network_request_new (uri); request = webkit_network_request_new (uri);
download = webkit_download_new (request); download = webkit_download_new (request);
@ -203,6 +207,7 @@ addons_install_response (GtkWidget* infobar,
g_free (path); g_free (path);
g_free (temp_uri); g_free (temp_uri);
g_free (dest_path); g_free (dest_path);
g_free (folder_path);
g_strfreev (split_uri); g_strfreev (split_uri);
} }
} }
@ -210,8 +215,7 @@ addons_install_response (GtkWidget* infobar,
} }
static void static void
addons_uri_install (MidoriBrowser* browser, addons_uri_install (MidoriView* view,
MidoriView* view,
AddonsKind kind) AddonsKind kind)
{ {
const gchar* message; const gchar* message;
@ -239,31 +243,35 @@ addons_uri_install (MidoriBrowser* browser,
} }
static void static void
addons_notify_load_status_cb (MidoriBrowser* browser, addons_notify_load_status_cb (MidoriView* view,
GParamSpec* pspec, GParamSpec* pspec,
MidoriExtension* extension) MidoriExtension* extension)
{ {
const gchar* uri = midori_browser_get_current_uri (browser); const gchar* uri = midori_view_get_display_uri (view);
WebKitWebView* web_view = WEBKIT_WEB_VIEW (midori_view_get_web_view (view));
#if WEBKIT_CHECK_VERSION (1, 1, 14)
if (webkit_web_view_get_view_source_mode (web_view))
return;
#endif
if (uri && *uri) if (uri && *uri)
{ {
/* FIXME: addons_notify_load_status_cb should pass MidoriView* pointer */ if (midori_view_get_load_status (view) == MIDORI_LOAD_COMMITTED)
GtkWidget* view = midori_browser_get_current_tab (browser);
if (midori_view_get_load_status (MIDORI_VIEW (view)) == MIDORI_LOAD_FINISHED)
{ {
/* casual sites goes by uri suffix */ /* casual sites goes by uri suffix */
if (g_str_has_suffix (uri, ".user.js")) if (g_str_has_suffix (uri, ".user.js"))
addons_uri_install (browser, MIDORI_VIEW (view), ADDONS_USER_SCRIPTS); addons_uri_install (view, ADDONS_USER_SCRIPTS);
else if (g_str_has_suffix (uri, ".user.css")) else if (g_str_has_suffix (uri, ".user.css"))
addons_uri_install (browser, MIDORI_VIEW (view), ADDONS_USER_STYLES); addons_uri_install (view, ADDONS_USER_STYLES);
else if (g_str_has_prefix (uri, "http://userscripts.org/scripts/")) else if (g_str_has_prefix (uri, "http://userscripts.org/scripts/"))
{ {
gchar** split_uri = g_strsplit (uri, "/", -1); gchar** split_uri = g_strsplit (uri, "/", -1);
gchar* subpage = split_uri[4]; gchar* subpage = split_uri[4];
/* userscripts.org script main (with desc) and "source view" pages */ /* userscripts.org script main (with desc) and "source view" pages */
if (!g_strcmp0 (subpage, "show") /* || !g_strcmp0 (subpage, "review") */) if (!g_strcmp0 (subpage, "show") || !g_strcmp0 (subpage, "review"))
addons_uri_install (browser, MIDORI_VIEW (view), ADDONS_USER_SCRIPTS); addons_uri_install (view, ADDONS_USER_SCRIPTS);
g_strfreev (split_uri); g_strfreev (split_uri);
} }
@ -278,7 +286,7 @@ addons_notify_load_status_cb (MidoriBrowser* browser,
subpage = split_uri[5]; subpage = split_uri[5];
/* userstyles.org style main page with style description */ /* userstyles.org style main page with style description */
if (!subpage) if (!subpage)
addons_uri_install (browser, MIDORI_VIEW (view), ADDONS_USER_STYLES); addons_uri_install (view, ADDONS_USER_STYLES);
g_strfreev (split_uri); g_strfreev (split_uri);
} }
@ -415,6 +423,7 @@ midori_addons_button_delete_clicked_cb (GtkWidget* toolitem,
struct AddonElement* element; struct AddonElement* element;
gint delete_response; gint delete_response;
GtkWidget* dialog; GtkWidget* dialog;
gchar* markup;
gtk_tree_model_get (model, &iter, 0, &element, -1); gtk_tree_model_get (model, &iter, 0, &element, -1);
dialog = gtk_message_dialog_new ( dialog = gtk_message_dialog_new (
@ -431,10 +440,12 @@ midori_addons_button_delete_clicked_cb (GtkWidget* toolitem,
? _("Delete user script") ? _("Delete user script")
: _("Delete user style")); : _("Delete user style"));
gtk_message_dialog_format_secondary_markup ( markup = g_markup_printf_escaped (
GTK_MESSAGE_DIALOG (dialog),
_("The file <b>%s</b> will be permanently deleted."), _("The file <b>%s</b> will be permanently deleted."),
element->fullpath); element->fullpath);
gtk_message_dialog_format_secondary_markup (
GTK_MESSAGE_DIALOG (dialog), "%s", markup);
g_free (markup);
delete_response = gtk_dialog_run (GTK_DIALOG (dialog)); delete_response = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog)); gtk_widget_destroy (GTK_WIDGET (dialog));
@ -929,14 +940,15 @@ js_metadata_from_file (const gchar* filename,
while (g_io_channel_read_line (channel, &line, NULL, NULL, NULL) while (g_io_channel_read_line (channel, &line, NULL, NULL, NULL)
== G_IO_STATUS_NORMAL) == G_IO_STATUS_NORMAL)
{ {
g_strstrip (line);
if (g_str_has_prefix (line, "// ==UserScript==")) if (g_str_has_prefix (line, "// ==UserScript=="))
found_meta = TRUE; found_meta = TRUE;
else if (found_meta) else if (found_meta)
{ {
if (g_str_has_prefix (line, "// ==/UserScript==")) if (g_str_has_prefix (line, "// ==/UserScript=="))
found_meta = FALSE; found_meta = FALSE;
else if (g_str_has_prefix (line, "// @require ") || else if (g_str_has_prefix (line, "// @require")
g_str_has_prefix (line, "// @resource ")) || g_str_has_prefix (line, "// @resource"))
{ {
/* We don't support these, so abort here */ /* We don't support these, so abort here */
g_free (line); g_free (line);
@ -961,6 +973,8 @@ js_metadata_from_file (const gchar* filename,
} }
else if (name && g_str_has_prefix (line, "// @name")) else if (name && g_str_has_prefix (line, "// @name"))
{ {
if (!strncmp (line, "// @namespace", 13))
continue;
rest_of_line = g_strdup (line + strlen ("// @name")); rest_of_line = g_strdup (line + strlen ("// @name"));
rest_of_line = g_strstrip (rest_of_line); rest_of_line = g_strstrip (rest_of_line);
*name = rest_of_line; *name = rest_of_line;
@ -1001,6 +1015,7 @@ css_metadata_from_file (const gchar* filename,
while (g_io_channel_read_line (channel, &line, NULL, NULL, NULL) while (g_io_channel_read_line (channel, &line, NULL, NULL, NULL)
== G_IO_STATUS_NORMAL) == G_IO_STATUS_NORMAL)
{ {
g_strstrip (line);
if (g_str_has_prefix (line, "@-moz-document") || line_has_meta) if (g_str_has_prefix (line, "@-moz-document") || line_has_meta)
{ /* FIXME: We merely look for includes. We should honor blocks. */ { /* FIXME: We merely look for includes. We should honor blocks. */
if (includes) if (includes)
@ -1265,13 +1280,11 @@ addons_update_elements (MidoriExtension* extension,
filename = g_path_get_basename (element->fullpath); filename = g_path_get_basename (element->fullpath);
if (element->description) if (element->description)
{ tooltip = g_markup_printf_escaped ("%s\n\n%s",
tooltip = g_strdup_printf ("%s\n\n%s",
filename, element->description); filename, element->description);
g_free (filename);
}
else else
tooltip = filename; tooltip = g_markup_escape_text (filename, -1);
g_free (filename);
gtk_list_store_append (liststore, &iter); gtk_list_store_append (liststore, &iter);
gtk_list_store_set (liststore, &iter, gtk_list_store_set (liststore, &iter,
@ -1504,6 +1517,8 @@ addons_add_tab_cb (MidoriBrowser* browser,
GtkWidget* web_view = midori_view_get_web_view (view); GtkWidget* web_view = midori_view_get_web_view (view);
g_signal_connect (web_view, "window-object-cleared", g_signal_connect (web_view, "window-object-cleared",
G_CALLBACK (addons_context_ready_cb), extension); G_CALLBACK (addons_context_ready_cb), extension);
g_signal_connect (view, "notify::load-status",
G_CALLBACK (addons_notify_load_status_cb), extension);
} }
static void static void
@ -1575,8 +1590,6 @@ addons_app_add_browser_cb (MidoriApp* app,
(GtkCallback)addons_add_tab_foreach_cb, extension); (GtkCallback)addons_add_tab_foreach_cb, extension);
g_signal_connect (browser, "add-tab", g_signal_connect (browser, "add-tab",
G_CALLBACK (addons_add_tab_cb), extension); G_CALLBACK (addons_add_tab_cb), extension);
g_signal_connect (browser, "notify::load-status",
G_CALLBACK (addons_notify_load_status_cb), extension);
panel = katze_object_get_object (browser, "panel"); panel = katze_object_get_object (browser, "panel");
scripts = addons_new (ADDONS_USER_SCRIPTS, extension); scripts = addons_new (ADDONS_USER_SCRIPTS, extension);

View file

@ -86,9 +86,16 @@ settings_and_accels_new (const gchar* config,
{ {
if (error->code == G_FILE_ERROR_NOENT) if (error->code == G_FILE_ERROR_NOENT)
{ {
GError* inner_error = NULL;
katze_assign (config_file, sokoke_find_config_filename (NULL, "config")); katze_assign (config_file, sokoke_find_config_filename (NULL, "config"));
g_key_file_load_from_file (key_file, config_file, g_key_file_load_from_file (key_file, config_file,
G_KEY_FILE_KEEP_COMMENTS, NULL); G_KEY_FILE_KEEP_COMMENTS, &inner_error);
if (inner_error != NULL)
{
printf (_("The configuration couldn't be loaded: %s\n"),
inner_error->message);
g_error_free (inner_error);
}
} }
else else
printf (_("The configuration couldn't be loaded: %s\n"), printf (_("The configuration couldn't be loaded: %s\n"),
@ -589,8 +596,15 @@ settings_notify_cb (MidoriWebSettings* settings,
GParamSpec* pspec, GParamSpec* pspec,
MidoriApp* app) MidoriApp* app)
{ {
gchar* config_file = build_config_filename ("config");
GError* error = NULL; GError* error = NULL;
gchar* config_file;
/* Skip state related properties to avoid disk IO */
if ((pspec && g_str_has_prefix (pspec->name, "last-window-"))
|| (pspec && g_str_has_prefix (pspec->name, "last-panel-")))
return;
config_file = build_config_filename ("config");
if (!settings_save_to_file (settings, app, config_file, &error)) if (!settings_save_to_file (settings, app, config_file, &error))
{ {
g_warning (_("The configuration couldn't be saved. %s"), error->message); g_warning (_("The configuration couldn't be saved. %s"), error->message);
@ -886,6 +900,7 @@ midori_soup_session_prepare (SoupSession* session,
{ {
"/etc/pki/tls/certs/ca-bundle.crt", "/etc/pki/tls/certs/ca-bundle.crt",
"/etc/ssl/certs/ca-certificates.crt", "/etc/ssl/certs/ca-certificates.crt",
"/etc/ssl/certs/ca-bundle.crt",
"/usr/local/share/certs/ca-root-nss.crt", "/usr/local/share/certs/ca-root-nss.crt",
NULL NULL
}; };
@ -1639,6 +1654,7 @@ main (int argc,
MidoriWebSettings* settings; MidoriWebSettings* settings;
gchar* config_file; gchar* config_file;
gchar* bookmarks_file; gchar* bookmarks_file;
gboolean bookmarks_exist;
MidoriStartup load_on_startup; MidoriStartup load_on_startup;
KatzeArray* search_engines; KatzeArray* search_engines;
KatzeArray* bookmarks; KatzeArray* bookmarks;
@ -1722,6 +1738,9 @@ main (int argc,
/* libSoup uses threads, so we need to initialize threads. */ /* libSoup uses threads, so we need to initialize threads. */
if (!g_thread_supported ()) g_thread_init (NULL); if (!g_thread_supported ()) g_thread_init (NULL);
sokoke_register_stock_items (); sokoke_register_stock_items ();
if (webapp && config)
g_set_application_name (_("Midori (Private Browsing)"));
else
g_set_application_name (_("Midori")); g_set_application_name (_("Midori"));
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
@ -1733,7 +1752,7 @@ main (int argc,
{ {
g_print ( g_print (
"%s %s\n\n" "%s %s\n\n"
"Copyright (c) 2007-2010 Christian Dywan\n\n" "Copyright (c) 2007-2011 Christian Dywan\n\n"
"%s\n" "%s\n"
"\t%s\n\n" "\t%s\n\n"
"%s\n" "%s\n"
@ -1757,12 +1776,15 @@ main (int argc,
const gchar* name = gtk_action_get_name (action); const gchar* name = gtk_action_get_name (action);
const gchar* space = " "; const gchar* space = " ";
gchar* padding = g_strndup (space, strlen (space) - strlen (name)); gchar* padding = g_strndup (space, strlen (space) - strlen (name));
gchar* label = katze_strip_mnemonics (gtk_action_get_label (action)); gchar* label = katze_object_get_string (action, "label");
const gchar* tooltip = gtk_action_get_tooltip (action); gchar* stripped = katze_strip_mnemonics (label);
g_print ("%s%s%s%s%s\n", name, padding, label, gchar* tooltip = katze_object_get_string (action, "tooltip");
g_print ("%s%s%s%s%s\n", name, padding, stripped,
tooltip ? ": " : "", tooltip ? tooltip : ""); tooltip ? ": " : "", tooltip ? tooltip : "");
g_free (tooltip);
g_free (padding); g_free (padding);
g_free (label); g_free (label);
g_free (stripped);
} }
g_list_free (actions); g_list_free (actions);
gtk_widget_destroy (GTK_WIDGET (browser)); gtk_widget_destroy (GTK_WIDGET (browser));
@ -1966,6 +1988,7 @@ main (int argc,
bookmarks = katze_array_new (KATZE_TYPE_ARRAY); bookmarks = katze_array_new (KATZE_TYPE_ARRAY);
bookmarks_file = g_build_filename (config, "bookmarks.db", NULL); bookmarks_file = g_build_filename (config, "bookmarks.db", NULL);
bookmarks_exist = g_access (bookmarks_file, F_OK) == 0;
errmsg = NULL; errmsg = NULL;
if ((db = midori_bookmarks_initialize (bookmarks, bookmarks_file, &errmsg)) == NULL) if ((db = midori_bookmarks_initialize (bookmarks, bookmarks_file, &errmsg)) == NULL)
{ {
@ -1973,8 +1996,9 @@ main (int argc,
_("Bookmarks couldn't be loaded: %s\n"), errmsg); _("Bookmarks couldn't be loaded: %s\n"), errmsg);
g_free (errmsg); g_free (errmsg);
} }
else else if (!bookmarks_exist)
{ {
/* Initial creation, import old bookmarks */
gchar* old_bookmarks; gchar* old_bookmarks;
if (g_path_is_absolute (BOOKMARK_FILE)) if (g_path_is_absolute (BOOKMARK_FILE))
old_bookmarks = g_strdup (BOOKMARK_FILE); old_bookmarks = g_strdup (BOOKMARK_FILE);
@ -1986,8 +2010,8 @@ main (int argc,
/* Leave old bookmarks around */ /* Leave old bookmarks around */
} }
g_free (old_bookmarks); g_free (old_bookmarks);
g_object_set_data (G_OBJECT (bookmarks), "db", db);
} }
g_object_set_data (G_OBJECT (bookmarks), "db", db);
midori_startup_timer ("Bookmarks read: \t%f"); midori_startup_timer ("Bookmarks read: \t%f");
config_file = NULL; config_file = NULL;

View file

@ -293,6 +293,45 @@ katze_array_from_xmlDocPtr (KatzeArray* array,
return TRUE; return TRUE;
} }
static gchar*
katze_unescape_html (const gchar* text)
{
gchar* amp = g_strstr_len (text, -1, "&");
if (amp && *amp)
{
if (!strncmp (amp, "&quot;", 6) || !strncmp (amp, "&amp;", 5)
|| !strncmp (amp, "&lt;", 4) || !strncmp (amp, "&gt;", 4)
|| !strncmp (amp, "&apos;", 6))
{
guint i = 0;
gchar** parts = g_strsplit_set (text, "&;", -1);
GString *unescaped = g_string_new (NULL);
while (parts[i])
{
if (katze_str_equal ("quot", parts[i]))
g_string_append (unescaped, "\"");
else if (katze_str_equal ("amp", parts[i]))
g_string_append (unescaped, "&");
else if (katze_str_equal ("lt", parts[i]))
g_string_append (unescaped, "<");
else if (katze_str_equal ("gt", parts[i]))
g_string_append (unescaped, ">");
else if (katze_str_equal ("apos", parts[i]))
g_string_append (unescaped, "'");
else
g_string_append (unescaped, parts[i]);
i++;
}
g_strfreev (parts);
return g_string_free (unescaped, FALSE);
}
}
return g_strdup (text);
}
static gboolean static gboolean
katze_array_from_netscape_file (KatzeArray* array, katze_array_from_netscape_file (KatzeArray* array,
const gchar* filename) const gchar* filename)
@ -322,8 +361,8 @@ katze_array_from_netscape_file (KatzeArray* array,
gchar** parts = g_strsplit (line, "\"", -1); gchar** parts = g_strsplit (line, "\"", -1);
item = katze_item_new (); item = katze_item_new ();
katze_array_add_item (folder, item); katze_array_add_item (folder, item);
item->name = g_strdup (element[4]); item->name = katze_unescape_html (element[4]);
item->uri = g_strdup (parts[1]); item->uri = katze_unescape_html (parts[1]);
g_strfreev (parts); g_strfreev (parts);
} }
/* item is folder */ /* item is folder */
@ -332,14 +371,14 @@ katze_array_from_netscape_file (KatzeArray* array,
item = (KatzeItem*)katze_array_new (KATZE_TYPE_ARRAY); item = (KatzeItem*)katze_array_new (KATZE_TYPE_ARRAY);
katze_array_add_item (folder, item); katze_array_add_item (folder, item);
folder = (KatzeArray*)item; folder = (KatzeArray*)item;
item->name = g_strdup (element[4]); item->name = katze_unescape_html (element[4]);
} }
} }
/* item description */ /* item description */
if (item && katze_str_equal (element[1], "DD")) if (item && katze_str_equal (element[1], "DD"))
{ {
if (element[2]) if (element[2])
item->text = g_strdup (element[2]); item->text = katze_unescape_html (element[2]);
item = NULL; item = NULL;
} }
/* end of current folder, level-up */ /* end of current folder, level-up */
@ -702,6 +741,48 @@ string_append_item (GString* string,
g_free (metadata); g_free (metadata);
} }
static void
string_append_netscape_item (GString* string,
KatzeItem* item)
{
g_return_if_fail (KATZE_IS_ITEM (item));
if (KATZE_IS_ARRAY (item))
{
KatzeItem* _item;
KatzeArray* array = KATZE_ARRAY (item);
GList* list;
g_string_append (string, "\t<DT><H3 FOLDED ADD_DATE=\"\">");
string_append_escaped (string, katze_item_get_name (item));
g_string_append (string, "</H3>\n");
g_string_append (string, "\t<DL><P>\n");
KATZE_ARRAY_FOREACH_ITEM_L (_item, array, list)
{
g_string_append (string, "\t");
string_append_netscape_item (string, _item);
}
g_string_append (string, "\t</DL><P>\n");
g_list_free (list);
}
else if (katze_item_get_uri (item))
{
g_string_append (string, "\t<DT><A HREF=\"");
string_append_escaped (string, katze_item_get_uri (item));
g_string_append (string, "\" ADD_DATE=\"\" LAST_VISIT=\"\" LAST_MODIFIED=\"\">");
string_append_escaped (string, katze_item_get_name (item));
g_string_append (string, "</A>\n");
if (item->text && g_strcmp0 (item->text, ""))
{
g_string_append (string, "\t<DD>");
string_append_escaped (string, katze_item_get_text (item));
g_string_append (string, "\n");
}
}
}
static gchar* static gchar*
katze_item_metadata_to_xbel (KatzeItem* item) katze_item_metadata_to_xbel (KatzeItem* item)
{ {
@ -788,15 +869,48 @@ katze_array_to_xbel (KatzeArray* array,
return g_string_free (markup, FALSE); return g_string_free (markup, FALSE);
} }
static gchar*
katze_array_to_netscape_html (KatzeArray* array,
GError** error)
{
KatzeItem* item;
GList* list;
/* The header, including the text, is the same as used in other browsers,
see http://msdn.microsoft.com/en-us/library/aa753582(v=vs.85).aspx */
GString* markup = g_string_new (
"<!DOCTYPE NETSCAPE-Bookmark-file-1>\n"
"<!--This is an automatically generated file.\n"
"It will be read and overwritten.\n"
"Do Not Edit! -->\n"
"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\">\n"
"<Title>Bookmarks</Title>\n"
"<H1>Bookmarks</H1>\n"
"\n");
g_string_append (markup, "<DL><P>\n");
KATZE_ARRAY_FOREACH_ITEM_L (item, array, list)
string_append_netscape_item (markup, item);
g_string_append (markup, "</DL><P>\n");
g_list_free (list);
return g_string_free (markup, FALSE);
}
static gboolean static gboolean
midori_array_to_file_xbel (KatzeArray* array, midori_array_to_file_format (KatzeArray* array,
const gchar* filename, const gchar* filename,
const gchar* format,
GError** error) GError** error)
{ {
gchar* data; gchar* data;
FILE* fp; FILE* fp;
if (!(data = katze_array_to_xbel (array, error))) if (!g_strcmp0 (format, "xbel"))
data = katze_array_to_xbel (array, error);
if (!g_strcmp0 (format, "netscape"))
data = katze_array_to_netscape_html (array, error);
if (!data)
return FALSE; return FALSE;
if (!(fp = fopen (filename, "w"))) if (!(fp = fopen (filename, "w")))
{ {
@ -833,8 +947,10 @@ midori_array_to_file (KatzeArray* array,
g_return_val_if_fail (filename, FALSE); g_return_val_if_fail (filename, FALSE);
g_return_val_if_fail (!error || !*error, FALSE); g_return_val_if_fail (!error || !*error, FALSE);
if (!g_strcmp0 (format, "xbel")) if (!g_strcmp0 (format, "xbel")
return midori_array_to_file_xbel (array, filename, error); || !g_strcmp0 (format, "netscape"))
return midori_array_to_file_format (array, filename, format, error);
g_critical ("Cannot write KatzeArray to unknown format '%s'.", format); g_critical ("Cannot write KatzeArray to unknown format '%s'.", format);
return FALSE; return FALSE;
} }

View file

@ -80,7 +80,6 @@ struct _MidoriBrowser
GtkWidget* statusbar; GtkWidget* statusbar;
GtkWidget* statusbar_contents; GtkWidget* statusbar_contents;
GtkWidget* transferbar; GtkWidget* transferbar;
GtkWidget* progressbar;
gchar* statusbar_text; gchar* statusbar_text;
gint last_window_width, last_window_height; gint last_window_width, last_window_height;
@ -100,7 +99,6 @@ struct _MidoriBrowser
gboolean show_navigationbar; gboolean show_navigationbar;
gboolean show_statusbar; gboolean show_statusbar;
gboolean speed_dial_in_new_tabs; gboolean speed_dial_in_new_tabs;
gboolean progress_in_location;
guint maximum_history_age; guint maximum_history_age;
gchar* location_entry_search; gchar* location_entry_search;
gchar* news_aggregator; gchar* news_aggregator;
@ -330,8 +328,7 @@ _midori_browser_update_interface (MidoriBrowser* browser)
"stock-id", GTK_STOCK_REFRESH, "stock-id", GTK_STOCK_REFRESH,
"tooltip", _("Reload the current page"), "tooltip", _("Reload the current page"),
"sensitive", can_reload, NULL); "sensitive", can_reload, NULL);
gtk_widget_hide (browser->progressbar); if (!browser->show_navigationbar)
if (!browser->show_navigationbar && !browser->show_statusbar)
gtk_widget_hide (browser->navigationbar); gtk_widget_hide (browser->navigationbar);
} }
else else
@ -339,11 +336,7 @@ _midori_browser_update_interface (MidoriBrowser* browser)
g_object_set (action, g_object_set (action,
"stock-id", GTK_STOCK_STOP, "stock-id", GTK_STOCK_STOP,
"tooltip", _("Stop loading the current page"), NULL); "tooltip", _("Stop loading the current page"), NULL);
if (!browser->progress_in_location || !gtk_widget_get_visible (browser->navigationbar)) if (!gtk_widget_get_visible (browser->navigationbar))
gtk_widget_show (browser->progressbar);
if (!gtk_widget_get_visible (browser->statusbar) &&
!gtk_widget_get_visible (browser->navigationbar) &&
browser->progress_in_location)
gtk_widget_show (browser->navigationbar); gtk_widget_show (browser->navigationbar);
} }
@ -434,30 +427,12 @@ _midori_browser_update_progress (MidoriBrowser* browser,
{ {
MidoriLocationAction* action; MidoriLocationAction* action;
gdouble progress; gdouble progress;
gchar* message;
action = MIDORI_LOCATION_ACTION (_action_by_name (browser, "Location")); action = MIDORI_LOCATION_ACTION (_action_by_name (browser, "Location"));
progress = midori_view_get_progress (view); progress = midori_view_get_progress (view);
/* When we are finished, we don't want to *see* progress anymore */ /* When we are finished, we don't want to *see* progress anymore */
if (midori_view_get_load_status (view) == MIDORI_LOAD_FINISHED) if (midori_view_get_load_status (view) == MIDORI_LOAD_FINISHED)
progress = 0.0; progress = 0.0;
if (progress > 0.0)
{
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (browser->progressbar),
progress);
message = g_strdup_printf (_("%d%% loaded"), (gint)(progress * 100));
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (browser->progressbar),
message);
g_free (message);
if (!browser->progress_in_location)
progress = 0.0;
}
else
{
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (browser->progressbar));
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (browser->progressbar),
NULL);
}
midori_location_action_set_progress (action, progress); midori_location_action_set_progress (action, progress);
} }
@ -989,7 +964,7 @@ midori_browser_prepare_download (MidoriBrowser* browser,
else else
g_assert_not_reached (); g_assert_not_reached ();
sokoke_message_dialog (GTK_MESSAGE_ERROR, message, detailed_message); sokoke_message_dialog (GTK_MESSAGE_ERROR, message, detailed_message, FALSE);
g_free (message); g_free (message);
g_free (detailed_message); g_free (detailed_message);
g_object_unref (download); g_object_unref (download);
@ -997,11 +972,6 @@ midori_browser_prepare_download (MidoriBrowser* browser,
} }
webkit_download_set_destination_uri (download, uri); webkit_download_set_destination_uri (download, uri);
if (!browser->show_statusbar && gtk_widget_get_visible (browser->transferbar))
{
_midori_browser_set_statusbar_text (browser, NULL);
gtk_widget_show (browser->statusbar);
}
midori_transferbar_add_download_item (MIDORI_TRANSFERBAR (browser->transferbar), download); midori_transferbar_add_download_item (MIDORI_TRANSFERBAR (browser->transferbar), download);
return TRUE; return TRUE;
} }
@ -1581,6 +1551,8 @@ _midori_browser_add_tab (MidoriBrowser* browser,
item = midori_view_get_proxy_item (MIDORI_VIEW (view)); item = midori_view_get_proxy_item (MIDORI_VIEW (view));
g_object_ref (item); g_object_ref (item);
katze_array_add_item (browser->proxy_array, item); katze_array_add_item (browser->proxy_array, item);
katze_array_move_item (browser->proxy_array, item,
gtk_notebook_get_current_page (notebook) + 1);
g_object_connect (view, g_object_connect (view,
"signal::notify::icon", "signal::notify::icon",
@ -1626,11 +1598,16 @@ _midori_browser_add_tab (MidoriBrowser* browser,
if (!g_object_get_data (G_OBJECT (view), "midori-view-append") && if (!g_object_get_data (G_OBJECT (view), "midori-view-append") &&
katze_object_get_boolean (browser->settings, "open-tabs-next-to-current")) katze_object_get_boolean (browser->settings, "open-tabs-next-to-current"))
{ {
n = gtk_notebook_get_current_page (notebook); n = gtk_notebook_get_current_page (notebook) + 1;
gtk_notebook_insert_page (notebook, view, tab_label, n + 1); gtk_notebook_insert_page (notebook, view, tab_label, n);
katze_array_move_item (browser->proxy_array, item, n);
} }
else else
{
gtk_notebook_append_page (notebook, view, tab_label); gtk_notebook_append_page (notebook, view, tab_label);
katze_array_move_item (browser->proxy_array, item,
gtk_notebook_get_n_pages (notebook));
}
gtk_notebook_set_tab_reorderable (notebook, view, TRUE); gtk_notebook_set_tab_reorderable (notebook, view, TRUE);
gtk_notebook_set_tab_detachable (notebook, view, TRUE); gtk_notebook_set_tab_detachable (notebook, view, TRUE);
@ -2260,7 +2237,7 @@ midori_browser_subscribe_to_news_feed (MidoriBrowser* browser,
"Alternatively go to Preferences, Applications in Midori, " "Alternatively go to Preferences, Applications in Midori, "
"and select a News Aggregator. Next time you click the " "and select a News Aggregator. Next time you click the "
"news feed icon, it will be added automatically.")); "news feed icon, it will be added automatically."));
sokoke_message_dialog (GTK_MESSAGE_INFO, _("New feed"), description); sokoke_message_dialog (GTK_MESSAGE_INFO, _("New feed"), description, FALSE);
g_free (description); g_free (description);
} }
} }
@ -2631,9 +2608,6 @@ midori_browser_toolbar_popup_context_menu_cb (GtkWidget* widget,
menuitem = sokoke_action_create_popup_menu_item ( menuitem = sokoke_action_create_popup_menu_item (
_action_by_name (browser, "Bookmarkbar")); _action_by_name (browser, "Bookmarkbar"));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
menuitem = sokoke_action_create_popup_menu_item (
_action_by_name (browser, "Transferbar"));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
menuitem = sokoke_action_create_popup_menu_item ( menuitem = sokoke_action_create_popup_menu_item (
_action_by_name (browser, "Statusbar")); _action_by_name (browser, "Statusbar"));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
@ -2948,6 +2922,8 @@ _action_compact_menu_populate_popup (GtkAction* action,
{ "InspectPage" }, { "InspectPage" },
#endif #endif
{ "Fullscreen" }, { "Fullscreen" },
{ "BookmarksImport"},
{ "BookmarksExport"},
#endif #endif
{ "About" }, { "About" },
{ "Preferences" }, { "Preferences" },
@ -3106,15 +3082,6 @@ _action_bookmarkbar_activate (GtkToggleAction* action,
sokoke_widget_set_visible (browser->bookmarkbar, active); sokoke_widget_set_visible (browser->bookmarkbar, active);
} }
static void
_action_transferbar_activate (GtkToggleAction* action,
MidoriBrowser* browser)
{
gboolean active = gtk_toggle_action_get_active (action);
g_object_set (browser->settings, "show-transferbar", active, NULL);
sokoke_widget_set_visible (browser->transferbar, active);
}
static void static void
_action_statusbar_activate (GtkToggleAction* action, _action_statusbar_activate (GtkToggleAction* action,
MidoriBrowser* browser) MidoriBrowser* browser)
@ -3130,9 +3097,6 @@ _action_reload_stop_activate (GtkAction* action,
{ {
gchar* stock_id; gchar* stock_id;
GtkWidget* view; GtkWidget* view;
GdkModifierType state = (GdkModifierType)0;
gint x, y;
gboolean from_cache;
if (!(view = midori_browser_get_current_tab (browser))) if (!(view = midori_browser_get_current_tab (browser)))
return; return;
@ -3141,10 +3105,20 @@ _action_reload_stop_activate (GtkAction* action,
/* Refresh or stop, depending on the stock id */ /* Refresh or stop, depending on the stock id */
if (!strcmp (stock_id, GTK_STOCK_REFRESH)) if (!strcmp (stock_id, GTK_STOCK_REFRESH))
{
GdkModifierType state = (GdkModifierType)0;
gint x, y;
gboolean from_cache = TRUE;
if (!strcmp (gtk_action_get_name (action), "ReloadUncached"))
from_cache = FALSE;
else
{ {
gdk_window_get_pointer (NULL, &x, &y, &state); gdk_window_get_pointer (NULL, &x, &y, &state);
from_cache = state & GDK_SHIFT_MASK; if (state & GDK_SHIFT_MASK)
midori_view_reload (MIDORI_VIEW (view), !from_cache); from_cache = FALSE;
}
midori_view_reload (MIDORI_VIEW (view), from_cache);
} }
else else
midori_view_stop_loading (MIDORI_VIEW (view)); midori_view_stop_loading (MIDORI_VIEW (view));
@ -3325,7 +3299,8 @@ _action_source_view_activate (GtkAction* action,
if (!sokoke_show_uri_with_mime_type (gtk_widget_get_screen (view), if (!sokoke_show_uri_with_mime_type (gtk_widget_get_screen (view),
uri, "text/plain", gtk_get_current_event_time (), &error)) uri, "text/plain", gtk_get_current_event_time (), &error))
sokoke_message_dialog (GTK_MESSAGE_ERROR, sokoke_message_dialog (GTK_MESSAGE_ERROR,
_("Could not run external program."), error ? error->message : ""); _("Could not run external program."),
error ? error->message : "", FALSE);
if (error) if (error)
g_error_free (error); g_error_free (error);
g_free (text_editor); g_free (text_editor);
@ -4115,7 +4090,8 @@ _action_bookmarks_import_activate (GtkAction* action,
if (path && !midori_array_from_file (bookmarks, path, NULL, &error)) if (path && !midori_array_from_file (bookmarks, path, NULL, &error))
{ {
sokoke_message_dialog (GTK_MESSAGE_ERROR, sokoke_message_dialog (GTK_MESSAGE_ERROR,
_("Failed to import bookmarks"), error ? error->message : ""); _("Failed to import bookmarks"),
error ? error->message : "", FALSE);
if (error) if (error)
g_error_free (error); g_error_free (error);
} }
@ -4134,6 +4110,8 @@ _action_bookmarks_export_activate (GtkAction* action,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
GtkWidget* file_dialog; GtkWidget* file_dialog;
GtkFileFilter* filter;
const gchar* format;
gchar* path = NULL; gchar* path = NULL;
GError* error; GError* error;
sqlite3* db; sqlite3* db;
@ -4142,13 +4120,36 @@ _action_bookmarks_export_activate (GtkAction* action,
if (!browser->bookmarks || !gtk_widget_get_visible (GTK_WIDGET (browser))) if (!browser->bookmarks || !gtk_widget_get_visible (GTK_WIDGET (browser)))
return; return;
wrong_format:
file_dialog = sokoke_file_chooser_dialog_new (_("Save file as"), file_dialog = sokoke_file_chooser_dialog_new (_("Save file as"),
GTK_WINDOW (browser), GTK_FILE_CHOOSER_ACTION_SAVE); GTK_WINDOW (browser), GTK_FILE_CHOOSER_ACTION_SAVE);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (file_dialog), gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (file_dialog),
"bookmarks.xbel"); "bookmarks.xbel");
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("XBEL Bookmarks"));
gtk_file_filter_add_mime_type (filter, "application/xml");
gtk_file_filter_add_pattern (filter, "*.xbel");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (file_dialog), filter);
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("Netscape Bookmarks"));
gtk_file_filter_add_mime_type (filter, "text/html");
gtk_file_filter_add_pattern (filter, "*.html");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (file_dialog), filter);
if (gtk_dialog_run (GTK_DIALOG (file_dialog)) == GTK_RESPONSE_OK) if (gtk_dialog_run (GTK_DIALOG (file_dialog)) == GTK_RESPONSE_OK)
path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_dialog)); path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_dialog));
gtk_widget_destroy (file_dialog); gtk_widget_destroy (file_dialog);
if (g_str_has_suffix (path, ".xbel"))
format = "xbel";
else if (g_str_has_suffix (path, ".html"))
format = "netscape";
else if (path != NULL)
{
sokoke_message_dialog (GTK_MESSAGE_ERROR,
_("Midori can only export to XBEL (*.xbel) and Netscape (*.html)"),
"", TRUE);
katze_assign (path, NULL);
goto wrong_format;
}
if (path == NULL) if (path == NULL)
return; return;
@ -4157,10 +4158,10 @@ _action_bookmarks_export_activate (GtkAction* action,
db = g_object_get_data (G_OBJECT (browser->history), "db"); db = g_object_get_data (G_OBJECT (browser->history), "db");
bookmarks = katze_array_new (KATZE_TYPE_ARRAY); bookmarks = katze_array_new (KATZE_TYPE_ARRAY);
midori_bookmarks_export_array_db (db, bookmarks, ""); midori_bookmarks_export_array_db (db, bookmarks, "");
if (!midori_array_to_file (bookmarks, path, "xbel", &error)) if (!midori_array_to_file (bookmarks, path, format, &error))
{ {
sokoke_message_dialog (GTK_MESSAGE_ERROR, sokoke_message_dialog (GTK_MESSAGE_ERROR,
_("Failed to export bookmarks"), error ? error->message : ""); _("Failed to export bookmarks"), error ? error->message : "", FALSE);
if (error) if (error)
g_error_free (error); g_error_free (error);
} }
@ -4470,10 +4471,9 @@ static void
_action_about_activate (GtkAction* action, _action_about_activate (GtkAction* action,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
gchar* comments = g_strdup_printf ("GTK+ %d.%d.%d, WebKitGTK+ %d.%d.%d\n%s", gchar* comments = g_strdup_printf ("%s\n%s",
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION, _("A lightweight web browser."),
WEBKIT_MAJOR_VERSION, WEBKIT_MINOR_VERSION, WEBKIT_MICRO_VERSION, _("See about:version for version info."));
_("A lightweight web browser."));
const gchar* license = const gchar* license =
_("This library is free software; you can redistribute it and/or " _("This library is free software; you can redistribute it and/or "
"modify it under the terms of the GNU Lesser General Public " "modify it under the terms of the GNU Lesser General Public "
@ -4487,7 +4487,7 @@ _action_about_activate (GtkAction* action,
"name", PACKAGE_NAME, "name", PACKAGE_NAME,
"version", PACKAGE_VERSION, "version", PACKAGE_VERSION,
"comments", comments, "comments", comments,
"copyright", "Copyright © 2007-2010 Christian Dywan", "copyright", "Copyright © 2007-2011 Christian Dywan",
"website", "http://www.twotoasts.de", "website", "http://www.twotoasts.de",
"authors", credits_authors, "authors", credits_authors,
"documenters", credits_documenters, "documenters", credits_documenters,
@ -4819,8 +4819,13 @@ static const GtkActionEntry entries[] =
N_("Add to Speed _dial"), "<Ctrl>h", N_("Add to Speed _dial"), "<Ctrl>h",
N_("Add shortcut to speed dial"), G_CALLBACK (_action_add_speed_dial_activate) }, N_("Add shortcut to speed dial"), G_CALLBACK (_action_add_speed_dial_activate) },
{ "AddDesktopShortcut", NULL, { "AddDesktopShortcut", NULL,
#if HAVE_HILDON
N_("Add Shortcut to the _desktop"), "<Ctrl>j", N_("Add Shortcut to the _desktop"), "<Ctrl>j",
N_("Add shortcut to the desktop"), G_CALLBACK (_action_add_desktop_shortcut_activate) }, N_("Add shortcut to the desktop"), G_CALLBACK (_action_add_desktop_shortcut_activate) },
#else
N_("Create _Launcher"), "<Ctrl>j",
N_("Create a launcher"), G_CALLBACK (_action_add_desktop_shortcut_activate) },
#endif
{ "AddNewsFeed", NULL, { "AddNewsFeed", NULL,
N_("Subscribe to News _feed"), NULL, N_("Subscribe to News _feed"), NULL,
N_("Subscribe to this news feed"), G_CALLBACK (_action_add_news_feed_activate) }, N_("Subscribe to this news feed"), G_CALLBACK (_action_add_news_feed_activate) },
@ -4883,6 +4888,9 @@ static const GtkActionEntry entries[] =
{ "Reload", GTK_STOCK_REFRESH, { "Reload", GTK_STOCK_REFRESH,
NULL, "<Ctrl>r", NULL, "<Ctrl>r",
N_("Reload the current page"), G_CALLBACK (_action_reload_stop_activate) }, N_("Reload the current page"), G_CALLBACK (_action_reload_stop_activate) },
{ "ReloadUncached", GTK_STOCK_REFRESH,
NULL, "<Ctrl><Shift>r",
N_("Reload page without caching"), G_CALLBACK (_action_reload_stop_activate) },
{ "Stop", GTK_STOCK_STOP, { "Stop", GTK_STOCK_STOP,
NULL, "Escape", NULL, "Escape",
N_("Stop loading the current page"), G_CALLBACK (_action_reload_stop_activate) }, N_("Stop loading the current page"), G_CALLBACK (_action_reload_stop_activate) },
@ -5029,10 +5037,6 @@ static const GtkToggleActionEntry toggle_entries[] =
N_("_Bookmarkbar"), "", N_("_Bookmarkbar"), "",
N_("Show bookmarkbar"), G_CALLBACK (_action_bookmarkbar_activate), N_("Show bookmarkbar"), G_CALLBACK (_action_bookmarkbar_activate),
FALSE }, FALSE },
{ "Transferbar", NULL,
N_("_Transferbar"), "",
N_("Show transferbar"), G_CALLBACK (_action_transferbar_activate),
FALSE },
{ "Statusbar", NULL, { "Statusbar", NULL,
N_("_Statusbar"), "", N_("_Statusbar"), "",
N_("Show statusbar"), G_CALLBACK (_action_statusbar_activate), N_("Show statusbar"), G_CALLBACK (_action_statusbar_activate),
@ -5213,7 +5217,6 @@ static const gchar* ui_markup =
"<menuitem action='Menubar'/>" "<menuitem action='Menubar'/>"
"<menuitem action='Navigationbar'/>" "<menuitem action='Navigationbar'/>"
"<menuitem action='Bookmarkbar'/>" "<menuitem action='Bookmarkbar'/>"
"<menuitem action='Transferbar'/>"
"<menuitem action='Statusbar'/>" "<menuitem action='Statusbar'/>"
"</menu>" "</menu>"
"<menuitem action='Panel'/>" "<menuitem action='Panel'/>"
@ -5281,6 +5284,7 @@ static const gchar* ui_markup =
"<menuitem action='TrashEmpty'/>" "<menuitem action='TrashEmpty'/>"
"<menuitem action='Preferences'/>" "<menuitem action='Preferences'/>"
"<menuitem action='InspectPage'/>" "<menuitem action='InspectPage'/>"
"<menuitem action='ReloadUncached'/>"
"</menu>" "</menu>"
"</menubar>" "</menubar>"
"<toolbar name='toolbar_navigation'>" "<toolbar name='toolbar_navigation'>"
@ -5769,9 +5773,6 @@ midori_browser_init (MidoriBrowser* browser)
#if HAVE_HILDON #if HAVE_HILDON
_action_set_visible (browser, "Menubar", FALSE); _action_set_visible (browser, "Menubar", FALSE);
#endif #endif
#if !WEBKIT_CHECK_VERSION (1, 1, 3)
_action_set_visible (browser, "Transferbar", FALSE);
#endif
#if !WEBKIT_CHECK_VERSION (1, 1, 2) #if !WEBKIT_CHECK_VERSION (1, 1, 2)
_action_set_sensitive (browser, "Encoding", FALSE); _action_set_sensitive (browser, "Encoding", FALSE);
#endif #endif
@ -5936,10 +5937,6 @@ midori_browser_init (MidoriBrowser* browser)
#endif #endif
gtk_box_pack_start (GTK_BOX (vbox), browser->statusbar, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), browser->statusbar, FALSE, FALSE, 0);
browser->progressbar = gtk_progress_bar_new ();
gtk_box_pack_start (GTK_BOX (browser->statusbar_contents),
browser->progressbar, FALSE, FALSE, 3);
browser->transferbar = g_object_new (MIDORI_TYPE_TRANSFERBAR, NULL); browser->transferbar = g_object_new (MIDORI_TYPE_TRANSFERBAR, NULL);
gtk_box_pack_start (GTK_BOX (browser->statusbar_contents), browser->transferbar, FALSE, FALSE, 3); gtk_box_pack_start (GTK_BOX (browser->statusbar_contents), browser->transferbar, FALSE, FALSE, 3);
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (browser->transferbar), FALSE); gtk_toolbar_set_show_arrow (GTK_TOOLBAR (browser->transferbar), FALSE);
@ -6095,7 +6092,7 @@ _midori_browser_update_settings (MidoriBrowser* browser)
gboolean right_align_sidepanel, open_panels_in_windows; gboolean right_align_sidepanel, open_panels_in_windows;
gint last_panel_position, last_panel_page; gint last_panel_position, last_panel_page;
gboolean show_menubar, show_bookmarkbar; gboolean show_menubar, show_bookmarkbar;
gboolean show_panel, show_transferbar; gboolean show_panel;
MidoriToolbarStyle toolbar_style; MidoriToolbarStyle toolbar_style;
gchar* toolbar_items; gchar* toolbar_items;
gint last_web_search; gint last_web_search;
@ -6119,7 +6116,6 @@ _midori_browser_update_settings (MidoriBrowser* browser)
"show-navigationbar", &browser->show_navigationbar, "show-navigationbar", &browser->show_navigationbar,
"show-bookmarkbar", &show_bookmarkbar, "show-bookmarkbar", &show_bookmarkbar,
"show-panel", &show_panel, "show-panel", &show_panel,
"show-transferbar", &show_transferbar,
"show-statusbar", &browser->show_statusbar, "show-statusbar", &browser->show_statusbar,
"speed-dial-in-new-tabs", &browser->speed_dial_in_new_tabs, "speed-dial-in-new-tabs", &browser->speed_dial_in_new_tabs,
"toolbar-style", &toolbar_style, "toolbar-style", &toolbar_style,
@ -6127,7 +6123,6 @@ _midori_browser_update_settings (MidoriBrowser* browser)
"last-web-search", &last_web_search, "last-web-search", &last_web_search,
"location-entry-search", &browser->location_entry_search, "location-entry-search", &browser->location_entry_search,
"close-buttons-on-tabs", &close_buttons_on_tabs, "close-buttons-on-tabs", &close_buttons_on_tabs,
"progress-in-location", &browser->progress_in_location,
"maximum-history-age", &browser->maximum_history_age, "maximum-history-age", &browser->maximum_history_age,
"news-aggregator", &browser->news_aggregator, "news-aggregator", &browser->news_aggregator,
NULL); NULL);
@ -6206,9 +6201,6 @@ _midori_browser_update_settings (MidoriBrowser* browser)
_action_set_active (browser, "Bookmarkbar", show_bookmarkbar _action_set_active (browser, "Bookmarkbar", show_bookmarkbar
&& browser->bookmarks != NULL); && browser->bookmarks != NULL);
_action_set_active (browser, "Panel", show_panel); _action_set_active (browser, "Panel", show_panel);
#if WEBKIT_CHECK_VERSION (1, 1, 3)
_action_set_active (browser, "Transferbar", show_transferbar);
#endif
_action_set_active (browser, "Statusbar", browser->show_statusbar); _action_set_active (browser, "Statusbar", browser->show_statusbar);
g_free (toolbar_items); g_free (toolbar_items);
@ -6261,8 +6253,6 @@ midori_browser_settings_notify (MidoriWebSettings* web_settings,
browser->show_statusbar = g_value_get_boolean (&value); browser->show_statusbar = g_value_get_boolean (&value);
else if (name == g_intern_string ("speed-dial-in-new-tabs")) else if (name == g_intern_string ("speed-dial-in-new-tabs"))
browser->speed_dial_in_new_tabs = g_value_get_boolean (&value); browser->speed_dial_in_new_tabs = g_value_get_boolean (&value);
else if (name == g_intern_string ("progress-in-location"))
browser->progress_in_location = g_value_get_boolean (&value);
else if (name == g_intern_string ("search-engines-in-completion")) else if (name == g_intern_string ("search-engines-in-completion"))
{ {
if (g_value_get_boolean (&value)) if (g_value_get_boolean (&value))

View file

@ -505,6 +505,8 @@ midori_location_action_popup_timeout_cb (gpointer data)
g_free (uri); g_free (uri);
g_free (title); g_free (title);
i++; i++;
if (i > 4)
break;
} }
searches += i; searches += i;
} }
@ -1065,6 +1067,7 @@ midori_location_entry_render_text_cb (GtkCellLayout* layout,
{ {
MidoriLocationAction* action = data; MidoriLocationAction* action = data;
gchar* uri_escaped; gchar* uri_escaped;
gchar* uri_temp;
gchar* uri; gchar* uri;
gchar* title; gchar* title;
gboolean style; gboolean style;
@ -1107,8 +1110,10 @@ midori_location_entry_render_text_cb (GtkCellLayout* layout,
keys = g_strsplit_set (key, " %", -1); keys = g_strsplit_set (key, " %", -1);
g_free (key); g_free (key);
uri = sokoke_uri_unescape_string (uri_escaped); uri_temp = sokoke_uri_unescape_string (uri_escaped);
g_free (uri_escaped); g_free (uri_escaped);
uri = g_strescape (uri_temp, NULL);
g_free (uri_temp);
if (G_LIKELY (uri)) if (G_LIKELY (uri))
{ {

View file

@ -365,15 +365,6 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
INDENTED_ADD (label); INDENTED_ADD (label);
button = katze_property_proxy (settings, "download-folder", "folder"); button = katze_property_proxy (settings, "download-folder", "folder");
SPANNED_ADD (button); SPANNED_ADD (button);
label = katze_property_proxy (settings, "ask-for-destination-folder", NULL);
INDENTED_ADD (label);
#if HAVE_LIBNOTIFY
if (notify_is_initted () || g_find_program_in_path ("notify-send"))
{
button = katze_property_proxy (settings, "notify-transfer-completed", NULL);
SPANNED_ADD (button);
}
#endif
#endif #endif
/* Page "Appearance" */ /* Page "Appearance" */
@ -456,10 +447,6 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
INDENTED_ADD (katze_property_label (settings, "toolbar-style")); INDENTED_ADD (katze_property_label (settings, "toolbar-style"));
button = katze_property_proxy (settings, "toolbar-style", NULL); button = katze_property_proxy (settings, "toolbar-style", NULL);
SPANNED_ADD (button); SPANNED_ADD (button);
button = katze_property_proxy (settings, "progress-in-location", NULL);
INDENTED_ADD (button);
button = katze_property_proxy (settings, "search-engines-in-completion", NULL);
SPANNED_ADD (button);
#endif #endif
FRAME_NEW (_("Browsing")); FRAME_NEW (_("Browsing"));
label = katze_property_label (settings, "open-new-pages-in"); label = katze_property_label (settings, "open-new-pages-in");

View file

@ -92,7 +92,6 @@ struct _MidoriView
gboolean speed_dial_in_new_tabs; gboolean speed_dial_in_new_tabs;
gchar* download_manager; gchar* download_manager;
gchar* news_aggregator; gchar* news_aggregator;
gboolean ask_for_destination_folder;
gboolean middle_click_opens_selection; gboolean middle_click_opens_selection;
gboolean open_tabs_in_the_background; gboolean open_tabs_in_the_background;
gboolean close_buttons_on_tabs; gboolean close_buttons_on_tabs;
@ -1353,6 +1352,7 @@ midori_view_display_error (MidoriView* view,
#endif #endif
gchar* res_root; gchar* res_root;
gchar* stock_root; gchar* stock_root;
gchar* title_escaped;
gchar* result; gchar* result;
#if WEBKIT_CHECK_VERSION (1, 1, 14) #if WEBKIT_CHECK_VERSION (1, 1, 14)
@ -1365,14 +1365,16 @@ midori_view_display_error (MidoriView* view,
stock_root = g_strdup_printf ("http://localhost:%d/stock", port); stock_root = g_strdup_printf ("http://localhost:%d/stock", port);
#endif #endif
title_escaped = g_markup_escape_text (title, -1);
result = sokoke_replace_variables (template, result = sokoke_replace_variables (template,
"{title}", title, "{title}", title_escaped,
"{message}", message, "{message}", message,
"{description}", description, "{description}", description,
"{tryagain}", try_again, "{tryagain}", try_again,
"{res}", res_root, "{res}", res_root,
"{stock}", stock_root, "{stock}", stock_root,
NULL); NULL);
g_free (title_escaped);
g_free (template); g_free (template);
midori_view_load_alternate_string (view, midori_view_load_alternate_string (view,
@ -1990,11 +1992,8 @@ midori_web_view_menu_save_activate_cb (GtkWidget* widget,
WebKitDownload* download = webkit_download_new (request); WebKitDownload* download = webkit_download_new (request);
gboolean handled; gboolean handled;
g_object_unref (request); g_object_unref (request);
if (view->ask_for_destination_folder)
g_object_set_data (G_OBJECT (download), "save-as-download", (void*)0xdeadbeef); g_object_set_data (G_OBJECT (download), "save-as-download", (void*)0xdeadbeef);
g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled); g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled);
if (!view->ask_for_destination_folder)
webkit_download_start (download);
} }
static void static void
@ -2025,11 +2024,8 @@ midori_web_view_menu_image_save_activate_cb (GtkWidget* widget,
WebKitDownload* download = webkit_download_new (request); WebKitDownload* download = webkit_download_new (request);
gboolean handled; gboolean handled;
g_object_unref (request); g_object_unref (request);
if (view->ask_for_destination_folder)
g_object_set_data (G_OBJECT (download), "save-as-download", (void*)0xdeadbeef); g_object_set_data (G_OBJECT (download), "save-as-download", (void*)0xdeadbeef);
g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled); g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled);
if (!view->ask_for_destination_folder)
webkit_download_start (download);
g_free (uri); g_free (uri);
} }
@ -2051,11 +2047,8 @@ midori_web_view_menu_video_save_activate_cb (GtkWidget* widget,
WebKitDownload* download = webkit_download_new (request); WebKitDownload* download = webkit_download_new (request);
gboolean handled; gboolean handled;
g_object_unref (request); g_object_unref (request);
if (view->ask_for_destination_folder)
g_object_set_data (G_OBJECT (download), "save-as-download", (void*)0xdeadbeef); g_object_set_data (G_OBJECT (download), "save-as-download", (void*)0xdeadbeef);
g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled); g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled);
if (!view->ask_for_destination_folder)
webkit_download_start (download);
g_free (uri); g_free (uri);
} }
@ -2421,8 +2414,7 @@ midori_view_populate_popup (MidoriView* view,
_("Copy Link de_stination"), NULL, _("Copy Link de_stination"), NULL,
G_CALLBACK (midori_web_view_menu_link_copy_activate_cb), widget); G_CALLBACK (midori_web_view_menu_link_copy_activate_cb), widget);
midori_view_insert_menu_item (menu_shell, -1, midori_view_insert_menu_item (menu_shell, -1,
view->ask_for_destination_folder ? _("_Save Link destination") _("_Save Link destination"), NULL,
: _("_Download Link destination"), NULL,
G_CALLBACK (midori_web_view_menu_save_activate_cb), widget); G_CALLBACK (midori_web_view_menu_save_activate_cb), widget);
if (view->download_manager && *view->download_manager) if (view->download_manager && *view->download_manager)
midori_view_insert_menu_item (menu_shell, -1, midori_view_insert_menu_item (menu_shell, -1,
@ -2441,8 +2433,7 @@ midori_view_populate_popup (MidoriView* view,
_("Copy Image _Address"), NULL, _("Copy Image _Address"), NULL,
G_CALLBACK (midori_web_view_menu_image_copy_activate_cb), widget); G_CALLBACK (midori_web_view_menu_image_copy_activate_cb), widget);
midori_view_insert_menu_item (menu_shell, -1, midori_view_insert_menu_item (menu_shell, -1,
view->ask_for_destination_folder ? _("Save I_mage") _("Save I_mage"), GTK_STOCK_SAVE,
: _("Download I_mage"), GTK_STOCK_SAVE,
G_CALLBACK (midori_web_view_menu_image_save_activate_cb), widget); G_CALLBACK (midori_web_view_menu_image_save_activate_cb), widget);
} }
@ -2893,6 +2884,7 @@ webkit_web_view_mime_type_decision_cb (GtkWidget* web_view,
description = g_content_type_get_description (content_type); description = g_content_type_get_description (content_type);
#if GTK_CHECK_VERSION (2, 14, 0) #if GTK_CHECK_VERSION (2, 14, 0)
icon = g_content_type_get_icon (content_type); icon = g_content_type_get_icon (content_type);
g_themed_icon_append_name (G_THEMED_ICON (icon), "document-x-generic");
image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG); image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG);
g_object_unref (icon); g_object_unref (icon);
gtk_widget_show (image); gtk_widget_show (image);
@ -3319,7 +3311,6 @@ _midori_view_set_settings (MidoriView* view,
"kinetic-scrolling", &kinetic_scrolling, "kinetic-scrolling", &kinetic_scrolling,
"close-buttons-on-tabs", &view->close_buttons_on_tabs, "close-buttons-on-tabs", &view->close_buttons_on_tabs,
"open-new-pages-in", &view->open_new_pages_in, "open-new-pages-in", &view->open_new_pages_in,
"ask-for-destination-folder", &view->ask_for_destination_folder,
"middle-click-opens-selection", &view->middle_click_opens_selection, "middle-click-opens-selection", &view->middle_click_opens_selection,
"open-tabs-in-the-background", &view->open_tabs_in_the_background, "open-tabs-in-the-background", &view->open_tabs_in_the_background,
"find-while-typing", &view->find_while_typing, "find-while-typing", &view->find_while_typing,
@ -3396,8 +3387,6 @@ midori_view_settings_notify_cb (MidoriWebSettings* settings,
} }
else if (name == g_intern_string ("open-new-pages-in")) else if (name == g_intern_string ("open-new-pages-in"))
view->open_new_pages_in = g_value_get_enum (&value); view->open_new_pages_in = g_value_get_enum (&value);
else if (name == g_intern_string ("ask-for-destination-folder"))
view->ask_for_destination_folder = g_value_get_boolean (&value);
else if (name == g_intern_string ("middle-click-opens-selection")) else if (name == g_intern_string ("middle-click-opens-selection"))
view->middle_click_opens_selection = g_value_get_boolean (&value); view->middle_click_opens_selection = g_value_get_boolean (&value);
else if (name == g_intern_string ("open-tabs-in-the-background")) else if (name == g_intern_string ("open-tabs-in-the-background"))
@ -3469,6 +3458,7 @@ midori_view_web_inspector_construct_window (gpointer inspector,
MidoriView* view) MidoriView* view)
{ {
gchar* title; gchar* title;
gchar* label;
GtkWidget* window; GtkWidget* window;
GtkWidget* toplevel; GtkWidget* toplevel;
GdkScreen* screen; GdkScreen* screen;
@ -3477,10 +3467,12 @@ midori_view_web_inspector_construct_window (gpointer inspector,
GdkPixbuf* icon; GdkPixbuf* icon;
GdkPixbuf* gray_icon; GdkPixbuf* gray_icon;
title = g_strdup_printf (_("Inspect page - %s"), ""); label = g_strdup (midori_view_get_display_title (view));
title = g_strdup_printf (_("Inspect page - %s"), label);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), title); gtk_window_set_title (GTK_WINDOW (window), title);
g_free (title); g_free (title);
g_free (label);
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view)); toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view));
if (gtk_widget_is_toplevel (toplevel)) if (gtk_widget_is_toplevel (toplevel))
@ -3879,7 +3871,7 @@ midori_view_set_uri (MidoriView* view,
data = g_strdup_printf ( data = g_strdup_printf (
"<html><head><title>about:version</title></head>" "<html><head><title>about:version</title></head>"
"<body><h1>about:version</h1>" "<body><h1>about:version</h1>"
"<p>Version numbers in brackets show the version used at runtime.</p>" "<p>%s</p>"
"<img src=\"res://logo-shade.png\" " "<img src=\"res://logo-shade.png\" "
"style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">" "style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">"
"<table>" "<table>"
@ -3897,6 +3889,7 @@ midori_view_set_uri (MidoriView* view,
"<tr><td>Identification</td><td>%s</td></tr>" "<tr><td>Identification</td><td>%s</td></tr>"
"</table>" "</table>"
"</body></html>", "</body></html>",
_("Version numbers in brackets show the version used at runtime."),
command_line, command_line,
DEBUGGING, DEBUGGING,
WEBKIT_MAJOR_VERSION, WEBKIT_MAJOR_VERSION,
@ -3962,7 +3955,8 @@ midori_view_set_uri (MidoriView* view,
result = midori_view_execute_script (view, &uri[11], &exception); result = midori_view_execute_script (view, &uri[11], &exception);
if (!result) if (!result)
{ {
sokoke_message_dialog (GTK_MESSAGE_ERROR, "javascript:", exception); sokoke_message_dialog (GTK_MESSAGE_ERROR, "javascript:",
exception, FALSE);
g_free (exception); g_free (exception);
} }
} }
@ -4582,15 +4576,18 @@ midori_view_get_proxy_tab_label (MidoriView* view)
align = gtk_alignment_new (1.0, 0.0, 0.0, 0.0); align = gtk_alignment_new (1.0, 0.0, 0.0, 0.0);
gtk_container_add (GTK_CONTAINER (align), view->tab_close); gtk_container_add (GTK_CONTAINER (align), view->tab_close);
#if HAVE_OSX if (katze_object_get_boolean (view->settings, "close-buttons-left"))
{
gtk_box_pack_end (GTK_BOX (hbox), view->tab_icon, FALSE, FALSE, 0); gtk_box_pack_end (GTK_BOX (hbox), view->tab_icon, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (hbox), view->tab_title, FALSE, TRUE, 0); gtk_box_pack_end (GTK_BOX (hbox), view->tab_title, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), align, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), align, FALSE, FALSE, 0);
#else }
else
{
gtk_box_pack_start (GTK_BOX (hbox), view->tab_icon, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), view->tab_icon, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), view->tab_title, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), view->tab_title, FALSE, TRUE, 0);
gtk_box_pack_end (GTK_BOX (hbox), align, FALSE, FALSE, 0); gtk_box_pack_end (GTK_BOX (hbox), align, FALSE, FALSE, 0);
#endif }
gtk_widget_show_all (GTK_WIDGET (event_box)); gtk_widget_show_all (GTK_WIDGET (event_box));
if (view->minimized) if (view->minimized)

View file

@ -37,7 +37,6 @@ struct _MidoriWebSettings
gboolean show_transferbar : 1; gboolean show_transferbar : 1;
gboolean show_statusbar : 1; gboolean show_statusbar : 1;
MidoriToolbarStyle toolbar_style : 3; MidoriToolbarStyle toolbar_style : 3;
gboolean progress_in_location : 1;
gboolean search_engines_in_completion : 1; gboolean search_engines_in_completion : 1;
gboolean compact_sidepanel : 1; gboolean compact_sidepanel : 1;
gboolean show_panel_controls : 1; gboolean show_panel_controls : 1;
@ -46,11 +45,10 @@ struct _MidoriWebSettings
MidoriStartup load_on_startup : 2; MidoriStartup load_on_startup : 2;
gboolean show_crash_dialog : 1; gboolean show_crash_dialog : 1;
gboolean speed_dial_in_new_tabs : 1; gboolean speed_dial_in_new_tabs : 1;
gboolean ask_for_destination_folder : 1;
gboolean notify_transfer_completed : 1;
MidoriPreferredEncoding preferred_encoding : 3; MidoriPreferredEncoding preferred_encoding : 3;
gboolean always_show_tabbar : 1; gboolean always_show_tabbar : 1;
gboolean close_buttons_on_tabs : 1; gboolean close_buttons_on_tabs : 1;
gboolean close_buttons_left : 1;
MidoriNewPage open_new_pages_in : 2; MidoriNewPage open_new_pages_in : 2;
MidoriNewPage open_external_pages_in : 2; MidoriNewPage open_external_pages_in : 2;
gboolean middle_click_opens_selection : 1; gboolean middle_click_opens_selection : 1;
@ -117,7 +115,6 @@ enum
PROP_SHOW_STATUSBAR, PROP_SHOW_STATUSBAR,
PROP_TOOLBAR_STYLE, PROP_TOOLBAR_STYLE,
PROP_PROGRESS_IN_LOCATION,
PROP_SEARCH_ENGINES_IN_COMPLETION, PROP_SEARCH_ENGINES_IN_COMPLETION,
PROP_TOOLBAR_ITEMS, PROP_TOOLBAR_ITEMS,
PROP_COMPACT_SIDEPANEL, PROP_COMPACT_SIDEPANEL,
@ -130,8 +127,6 @@ enum
PROP_SHOW_CRASH_DIALOG, PROP_SHOW_CRASH_DIALOG,
PROP_SPEED_DIAL_IN_NEW_TABS, PROP_SPEED_DIAL_IN_NEW_TABS,
PROP_DOWNLOAD_FOLDER, PROP_DOWNLOAD_FOLDER,
PROP_ASK_FOR_DESTINATION_FOLDER,
PROP_NOTIFY_TRANSFER_COMPLETED,
PROP_DOWNLOAD_MANAGER, PROP_DOWNLOAD_MANAGER,
PROP_TEXT_EDITOR, PROP_TEXT_EDITOR,
PROP_NEWS_AGGREGATOR, PROP_NEWS_AGGREGATOR,
@ -140,6 +135,7 @@ enum
PROP_ALWAYS_SHOW_TABBAR, PROP_ALWAYS_SHOW_TABBAR,
PROP_CLOSE_BUTTONS_ON_TABS, PROP_CLOSE_BUTTONS_ON_TABS,
PROP_CLOSE_BUTTONS_LEFT,
PROP_OPEN_NEW_PAGES_IN, PROP_OPEN_NEW_PAGES_IN,
PROP_OPEN_EXTERNAL_PAGES_IN, PROP_OPEN_EXTERNAL_PAGES_IN,
PROP_MIDDLE_CLICK_OPENS_SELECTION, PROP_MIDDLE_CLICK_OPENS_SELECTION,
@ -444,7 +440,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
"show-menubar", "show-menubar",
_("Show Menubar"), _("Show Menubar"),
_("Whether to show the menubar"), _("Whether to show the menubar"),
TRUE, FALSE,
flags)); flags));
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
@ -480,6 +476,8 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
* Whether to show the transferbar. * Whether to show the transferbar.
* *
* Since: 0.1.5 * Since: 0.1.5
*
* Deprecated: 0.3.1
*/ */
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_SHOW_TRANSFERBAR, PROP_SHOW_TRANSFERBAR,
@ -510,28 +508,14 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
MIDORI_TOOLBAR_DEFAULT, MIDORI_TOOLBAR_DEFAULT,
flags)); flags));
/**
* MidoriWebSettings:progress-in-location:
*
* Whether to show loading progress in the location entry.
*
* Since: 0.1.3
*/
g_object_class_install_property (gobject_class,
PROP_PROGRESS_IN_LOCATION,
g_param_spec_boolean (
"progress-in-location",
_("Show progress in location entry"),
_("Whether to show loading progress in the location entry"),
TRUE,
flags));
/** /**
* MidoriWebSettings:search-engines-in-completion: * MidoriWebSettings:search-engines-in-completion:
* *
* Whether to show search engines in the location completion. * Whether to show search engines in the location completion.
* *
* Since: 0.1.6 * Since: 0.1.6
*
* Deprecated: 0.3.1
*/ */
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_SEARCH_ENGINES_IN_COMPLETION, PROP_SEARCH_ENGINES_IN_COMPLETION,
@ -548,7 +532,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
"toolbar-items", "toolbar-items",
_("Toolbar Items"), _("Toolbar Items"),
_("The items to show on the toolbar"), _("The items to show on the toolbar"),
"TabNew,Back,Forward,Next,ReloadStop,BookmarkAdd,Location,Search,Trash", "TabNew,Back,Forward,Next,ReloadStop,BookmarkAdd,Location,Search,Trash,CompactMenu",
flags)); flags));
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
@ -676,52 +660,6 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
#endif #endif
/**
* MidoriWebSettings:ask-for-destination-folder:
*
* Whether to ask for the destination folder when downloading a file.
*
* Note: Only since 0.2.0 is this value actually used.
*
* Since: 0.1.7
*
* Deprecated: 0.3.0
*/
g_object_class_install_property (gobject_class,
PROP_ASK_FOR_DESTINATION_FOLDER,
g_param_spec_boolean (
"ask-for-destination-folder",
_("Ask for the destination folder"),
_("Whether to ask for the destination folder when downloading a file"),
FALSE,
#if WEBKIT_CHECK_VERSION (1, 1, 15)
flags));
#else
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
#endif
/**
* MidoriWebSettings:notify-transfer-completed:
*
* Whether to show a notification when a transfer has been completed.
*
* Since: 0.1.7
*
* Deprecated: 0.3.0
*/
g_object_class_install_property (gobject_class,
PROP_NOTIFY_TRANSFER_COMPLETED,
g_param_spec_boolean (
"notify-transfer-completed",
_("Notify when a transfer has been completed"),
_("Whether to show a notification when a transfer has been completed"),
TRUE,
#if WEBKIT_CHECK_VERSION (1, 1, 3)
flags));
#else
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
#endif
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_DOWNLOAD_MANAGER, PROP_DOWNLOAD_MANAGER,
g_param_spec_string ( g_param_spec_string (
@ -794,6 +732,27 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
TRUE, TRUE,
flags)); flags));
/**
* MidoriWebSettings:close-buttons-left:
*
* Whether to show close buttons on the left side.
*
* Since: 0.3.1
*/
g_object_class_install_property (gobject_class,
PROP_CLOSE_BUTTONS_LEFT,
g_param_spec_boolean (
"close-buttons-left",
"Close buttons on the left",
"Whether to show close buttons on the left side",
#if HAVE_OSX
TRUE,
#else
FALSE,
#endif
flags));
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_OPEN_NEW_PAGES_IN, PROP_OPEN_NEW_PAGES_IN,
g_param_spec_enum ( g_param_spec_enum (
@ -1168,7 +1127,6 @@ notify_default_encoding_cb (GObject* object,
static void static void
midori_web_settings_init (MidoriWebSettings* web_settings) midori_web_settings_init (MidoriWebSettings* web_settings)
{ {
web_settings->notify_transfer_completed = TRUE;
web_settings->download_folder = g_strdup (midori_get_download_dir ()); web_settings->download_folder = g_strdup (midori_get_download_dir ());
web_settings->http_proxy = NULL; web_settings->http_proxy = NULL;
web_settings->show_panel_controls = TRUE; web_settings->show_panel_controls = TRUE;
@ -1339,9 +1297,6 @@ midori_web_settings_set_property (GObject* object,
case PROP_TOOLBAR_STYLE: case PROP_TOOLBAR_STYLE:
web_settings->toolbar_style = g_value_get_enum (value); web_settings->toolbar_style = g_value_get_enum (value);
break; break;
case PROP_PROGRESS_IN_LOCATION:
web_settings->progress_in_location = g_value_get_boolean (value);
break;
case PROP_SEARCH_ENGINES_IN_COMPLETION: case PROP_SEARCH_ENGINES_IN_COMPLETION:
web_settings->search_engines_in_completion = g_value_get_boolean (value); web_settings->search_engines_in_completion = g_value_get_boolean (value);
break; break;
@ -1376,12 +1331,6 @@ midori_web_settings_set_property (GObject* object,
case PROP_DOWNLOAD_FOLDER: case PROP_DOWNLOAD_FOLDER:
katze_assign (web_settings->download_folder, g_value_dup_string (value)); katze_assign (web_settings->download_folder, g_value_dup_string (value));
break; break;
case PROP_ASK_FOR_DESTINATION_FOLDER:
web_settings->ask_for_destination_folder = g_value_get_boolean (value);
break;
case PROP_NOTIFY_TRANSFER_COMPLETED:
web_settings->notify_transfer_completed = g_value_get_boolean (value);
break;
case PROP_DOWNLOAD_MANAGER: case PROP_DOWNLOAD_MANAGER:
katze_assign (web_settings->download_manager, g_value_dup_string (value)); katze_assign (web_settings->download_manager, g_value_dup_string (value));
break; break;
@ -1427,6 +1376,9 @@ midori_web_settings_set_property (GObject* object,
case PROP_CLOSE_BUTTONS_ON_TABS: case PROP_CLOSE_BUTTONS_ON_TABS:
web_settings->close_buttons_on_tabs = g_value_get_boolean (value); web_settings->close_buttons_on_tabs = g_value_get_boolean (value);
break; break;
case PROP_CLOSE_BUTTONS_LEFT:
web_settings->close_buttons_left = g_value_get_boolean (value);
break;
case PROP_OPEN_NEW_PAGES_IN: case PROP_OPEN_NEW_PAGES_IN:
web_settings->open_new_pages_in = g_value_get_enum (value); web_settings->open_new_pages_in = g_value_get_enum (value);
break; break;
@ -1617,9 +1569,6 @@ midori_web_settings_get_property (GObject* object,
case PROP_TOOLBAR_STYLE: case PROP_TOOLBAR_STYLE:
g_value_set_enum (value, web_settings->toolbar_style); g_value_set_enum (value, web_settings->toolbar_style);
break; break;
case PROP_PROGRESS_IN_LOCATION:
g_value_set_boolean (value, web_settings->progress_in_location);
break;
case PROP_SEARCH_ENGINES_IN_COMPLETION: case PROP_SEARCH_ENGINES_IN_COMPLETION:
g_value_set_boolean (value, web_settings->search_engines_in_completion); g_value_set_boolean (value, web_settings->search_engines_in_completion);
break; break;
@ -1654,12 +1603,6 @@ midori_web_settings_get_property (GObject* object,
case PROP_DOWNLOAD_FOLDER: case PROP_DOWNLOAD_FOLDER:
g_value_set_string (value, web_settings->download_folder); g_value_set_string (value, web_settings->download_folder);
break; break;
case PROP_ASK_FOR_DESTINATION_FOLDER:
g_value_set_boolean (value, web_settings->ask_for_destination_folder);
break;
case PROP_NOTIFY_TRANSFER_COMPLETED:
g_value_set_boolean (value, web_settings->notify_transfer_completed);
break;
case PROP_DOWNLOAD_MANAGER: case PROP_DOWNLOAD_MANAGER:
g_value_set_string (value, web_settings->download_manager); g_value_set_string (value, web_settings->download_manager);
break; break;
@ -1682,6 +1625,9 @@ midori_web_settings_get_property (GObject* object,
case PROP_CLOSE_BUTTONS_ON_TABS: case PROP_CLOSE_BUTTONS_ON_TABS:
g_value_set_boolean (value, web_settings->close_buttons_on_tabs); g_value_set_boolean (value, web_settings->close_buttons_on_tabs);
break; break;
case PROP_CLOSE_BUTTONS_LEFT:
g_value_set_boolean (value, web_settings->close_buttons_left);
break;
case PROP_OPEN_NEW_PAGES_IN: case PROP_OPEN_NEW_PAGES_IN:
g_value_set_enum (value, web_settings->open_new_pages_in); g_value_set_enum (value, web_settings->open_new_pages_in);
break; break;

View file

@ -153,7 +153,8 @@ sokoke_message_dialog_response_cb (GtkWidget* dialog,
void void
sokoke_message_dialog (GtkMessageType message_type, sokoke_message_dialog (GtkMessageType message_type,
const gchar* short_message, const gchar* short_message,
const gchar* detailed_message) const gchar* detailed_message,
gboolean modal)
{ {
GtkWidget* dialog = gtk_message_dialog_new ( GtkWidget* dialog = gtk_message_dialog_new (
NULL, 0, message_type, NULL, 0, message_type,
@ -165,11 +166,20 @@ sokoke_message_dialog (GtkMessageType message_type,
"%s", short_message); "%s", short_message);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s", detailed_message); "%s", detailed_message);
if (modal)
{
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
else
{
g_signal_connect (dialog, "response", g_signal_connect (dialog, "response",
G_CALLBACK (sokoke_message_dialog_response_cb), NULL); G_CALLBACK (sokoke_message_dialog_response_cb), NULL);
gtk_widget_show (dialog); gtk_widget_show (dialog);
} }
}
/** /**
* sokoke_show_uri_with_mime_type: * sokoke_show_uri_with_mime_type:
* @screen: a #GdkScreen, or %NULL * @screen: a #GdkScreen, or %NULL
@ -391,7 +401,10 @@ sokoke_show_uri (GdkScreen* screen,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
box = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); box = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
if (g_str_has_prefix (uri, "file:///"))
filename = g_filename_from_uri (uri, NULL, NULL); filename = g_filename_from_uri (uri, NULL, NULL);
else
filename = g_strdup (uri);
ms = g_strdup_printf (_("Choose an application or command to open \"%s\":"), ms = g_strdup_printf (_("Choose an application or command to open \"%s\":"),
filename); filename);
gtk_box_pack_start (GTK_BOX (box), gtk_label_new (ms), TRUE, FALSE, 4); gtk_box_pack_start (GTK_BOX (box), gtk_label_new (ms), TRUE, FALSE, 4);
@ -434,7 +447,7 @@ sokoke_spawn_program (const gchar* command,
{ {
sokoke_message_dialog (GTK_MESSAGE_ERROR, sokoke_message_dialog (GTK_MESSAGE_ERROR,
_("Could not run external program."), _("Could not run external program."),
"Failed to initialize libosso"); "Failed to initialize libosso", FALSE);
return FALSE; return FALSE;
} }
@ -444,7 +457,7 @@ sokoke_spawn_program (const gchar* command,
osso_deinitialize (osso); osso_deinitialize (osso);
sokoke_message_dialog (GTK_MESSAGE_ERROR, sokoke_message_dialog (GTK_MESSAGE_ERROR,
_("Could not run external program."), _("Could not run external program."),
"Failed to get dbus connection from osso context"); "Failed to get dbus connection from osso context", FALSE);
return FALSE; return FALSE;
} }
@ -472,7 +485,7 @@ sokoke_spawn_program (const gchar* command,
{ {
sokoke_message_dialog (GTK_MESSAGE_ERROR, sokoke_message_dialog (GTK_MESSAGE_ERROR,
_("Could not run external program."), _("Could not run external program."),
error ? error->message : ""); error ? error->message : "", FALSE);
if (error) if (error)
g_error_free (error); g_error_free (error);
return FALSE; return FALSE;
@ -501,7 +514,7 @@ sokoke_spawn_program (const gchar* command,
{ {
sokoke_message_dialog (GTK_MESSAGE_ERROR, sokoke_message_dialog (GTK_MESSAGE_ERROR,
_("Could not run external program."), _("Could not run external program."),
error->message); error->message, FALSE);
g_error_free (error); g_error_free (error);
g_free (command_ready); g_free (command_ready);
return FALSE; return FALSE;
@ -515,7 +528,7 @@ sokoke_spawn_program (const gchar* command,
{ {
sokoke_message_dialog (GTK_MESSAGE_ERROR, sokoke_message_dialog (GTK_MESSAGE_ERROR,
_("Could not run external program."), _("Could not run external program."),
error->message); error->message, FALSE);
g_error_free (error); g_error_free (error);
} }
@ -960,7 +973,16 @@ sokoke_get_desktop (void)
static SokokeDesktop desktop = SOKOKE_DESKTOP_UNTESTED; static SokokeDesktop desktop = SOKOKE_DESKTOP_UNTESTED;
if (G_UNLIKELY (desktop == SOKOKE_DESKTOP_UNTESTED)) if (G_UNLIKELY (desktop == SOKOKE_DESKTOP_UNTESTED))
{ {
/* Are we running in Xfce? */ desktop = SOKOKE_DESKTOP_UNKNOWN;
/* Are we running in Xfce >= 4.8? */
if (!g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "xfce"))
{
desktop = SOKOKE_DESKTOP_XFCE;
}
else
{
/* Are we running in Xfce <= 4.6? */
GdkDisplay* display = gdk_display_get_default (); GdkDisplay* display = gdk_display_get_default ();
Display* xdisplay = GDK_DISPLAY_XDISPLAY (display); Display* xdisplay = GDK_DISPLAY_XDISPLAY (display);
Window root_window = RootWindow (xdisplay, 0); Window root_window = RootWindow (xdisplay, 0);
@ -974,7 +996,6 @@ sokoke_get_desktop (void)
save_mode_atom, 0, (~0L), save_mode_atom, 0, (~0L),
False, AnyPropertyType, &actual_type, &actual_format, False, AnyPropertyType, &actual_type, &actual_format,
&n_items, &bytes, (unsigned char**)&value); &n_items, &bytes, (unsigned char**)&value);
desktop = SOKOKE_DESKTOP_UNKNOWN;
if (status == Success) if (status == Success)
{ {
if (n_items == 6 && !strncmp (value, "xfce4", 6)) if (n_items == 6 && !strncmp (value, "xfce4", 6))
@ -982,6 +1003,7 @@ sokoke_get_desktop (void)
XFree (value); XFree (value);
} }
} }
}
return desktop; return desktop;
#else #else

View file

@ -85,7 +85,8 @@ sokoke_js_script_eval (JSContextRef js_context,
void void
sokoke_message_dialog (GtkMessageType message_type, sokoke_message_dialog (GtkMessageType message_type,
const gchar* short_message, const gchar* short_message,
const gchar* detailed_message); const gchar* detailed_message,
gboolean modal);
gboolean gboolean
sokoke_show_uri_with_mime_type (GdkScreen* screen, sokoke_show_uri_with_mime_type (GdkScreen* screen,

View file

@ -243,6 +243,7 @@ midori_bookmarks_insert_item_db (sqlite3* db,
KatzeItem* old_parent; KatzeItem* old_parent;
gchar* parent; gchar* parent;
gchar* uri; gchar* uri;
gchar* desc;
/* Bookmarks must have a name, import may produce invalid items */ /* Bookmarks must have a name, import may produce invalid items */
g_return_if_fail (katze_item_get_name (item)); g_return_if_fail (katze_item_get_name (item));
@ -252,6 +253,11 @@ midori_bookmarks_insert_item_db (sqlite3* db,
else else
uri = g_strdup (""); uri = g_strdup ("");
if (katze_item_get_text (item))
desc = g_strdup (katze_item_get_text (item));
else
desc = g_strdup ("");
/* Use folder, otherwise fallback to parent folder */ /* Use folder, otherwise fallback to parent folder */
old_parent = katze_item_get_parent (item); old_parent = katze_item_get_parent (item);
if (folder && *folder) if (folder && *folder)
@ -266,7 +272,7 @@ midori_bookmarks_insert_item_db (sqlite3* db,
" ('%q', '%q', '%q', '%q', %d, %d)", " ('%q', '%q', '%q', '%q', %d, %d)",
uri, uri,
katze_item_get_name (item), katze_item_get_name (item),
katze_item_get_text (item), desc,
parent, parent,
katze_item_get_meta_boolean (item, "toolbar"), katze_item_get_meta_boolean (item, "toolbar"),
katze_item_get_meta_boolean (item, "app")); katze_item_get_meta_boolean (item, "app"));
@ -279,6 +285,7 @@ midori_bookmarks_insert_item_db (sqlite3* db,
g_free (uri); g_free (uri);
g_free (parent); g_free (parent);
g_free (desc);
sqlite3_free (sqlcmd); sqlite3_free (sqlcmd);
} }

1231
po/cs.po

File diff suppressed because it is too large Load diff

1396
po/de.po

File diff suppressed because it is too large Load diff

1760
po/es.po

File diff suppressed because it is too large Load diff

2895
po/he.po

File diff suppressed because it is too large Load diff

1150
po/it.po

File diff suppressed because it is too large Load diff

1199
po/ja.po

File diff suppressed because it is too large Load diff

1203
po/ko.po

File diff suppressed because it is too large Load diff

1452
po/pl.po

File diff suppressed because it is too large Load diff

1209
po/pt.po

File diff suppressed because it is too large Load diff

2404
po/ro.po

File diff suppressed because it is too large Load diff

1191
po/ru.po

File diff suppressed because it is too large Load diff

1165
po/uk.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -69,6 +69,12 @@ midori_findbar_find_key_press_event_cb (MidoriFindbar* findbar,
midori_findbar_done (findbar); midori_findbar_done (findbar);
return TRUE; return TRUE;
} }
else if (event->keyval == GDK_Return
&& (event->state & GDK_SHIFT_MASK))
{
midori_findbar_find (findbar, FALSE);
return TRUE;
}
return FALSE; return FALSE;
} }

View file

@ -107,14 +107,13 @@ midori_transferbar_download_notify_status_cb (WebKitDownload* download,
case WEBKIT_DOWNLOAD_STATUS_FINISHED: case WEBKIT_DOWNLOAD_STATUS_FINISHED:
{ {
MidoriBrowser* browser = midori_browser_get_for_widget (button); MidoriBrowser* browser = midori_browser_get_for_widget (button);
MidoriWebSettings* settings = midori_browser_get_settings (browser);
icon = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU); icon = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
gtk_button_set_image (GTK_BUTTON (button), icon); gtk_button_set_image (GTK_BUTTON (button), icon);
if (g_object_get_data (G_OBJECT (download), "open-download")) if (g_object_get_data (G_OBJECT (download), "open-download"))
gtk_button_clicked (GTK_BUTTON (button)); gtk_button_clicked (GTK_BUTTON (button));
if (katze_object_get_boolean (settings, "notify-transfer-completed")) if (1)
{ {
const gchar* uri = webkit_download_get_destination_uri (download); const gchar* uri = webkit_download_get_destination_uri (download);
gchar* path = soup_uri_decode (uri); gchar* path = soup_uri_decode (uri);

View file

@ -29,7 +29,7 @@ from Configure import find_program_impl
major = 0 major = 0
minor = 3 minor = 3
micro = 0 micro = 1
APPNAME = 'midori' APPNAME = 'midori'
VERSION = str (major) + '.' + str (minor) + '.' + str (micro) VERSION = str (major) + '.' + str (minor) + '.' + str (micro)