Merge branch 'upstream-unstable'
This commit is contained in:
commit
436f1b1b23
59 changed files with 13586 additions and 12012 deletions
19
ChangeLog
19
ChangeLog
|
@ -1,5 +1,24 @@
|
|||
This file is licensed under the terms of the expat license, see the file EXPAT.
|
||||
|
||||
v0.2.9
|
||||
+ Add 'Identify As' to Statusbar Features
|
||||
+ Don't restrict length of HTTP login passwords
|
||||
+ Implement Find Links by number with '.'
|
||||
+ Reflect security in icon tooltip
|
||||
+ Use GIO to determine special URI schemes
|
||||
+ Upgrade waf (addresses threading issues)
|
||||
+ Allow clearing HTML5 databases and form history
|
||||
+ Add --help-execute command line switch
|
||||
+ Improve private mode, with search and hotkeys
|
||||
+ Support no-desktop-files and internal Open With
|
||||
+ Support x-scheme-handler spec
|
||||
+ Infobar for location and HTML5 database
|
||||
+ Optimise cookie storing, reduce wakeups
|
||||
+ Avoid deprecated GTK+ interfaces
|
||||
+ Remove console in favour of Inspector
|
||||
+ Simplify and explain cookie preferences
|
||||
+ Fix Google Reader incompatibility
|
||||
|
||||
v0.2.8
|
||||
+ Re-implement Bookmarks menu and toolbar button
|
||||
+ Show transferbar even if statusbar is hidden
|
||||
|
|
2
INSTALL
2
INSTALL
|
@ -39,6 +39,8 @@ Make sure you have installed 'gdb', the GNU Debugger.
|
|||
|
||||
Run Midori as 'gdb _build_/default/midori/midori'.
|
||||
|
||||
Inside gdb, type 'run'.
|
||||
|
||||
Try to reproduce a crash that you experienced earlier,
|
||||
this time Midori will freeze at the point of the crash.
|
||||
Switch to your terminal, type bt ('backtrace') and hit Return.
|
||||
|
|
|
@ -5,7 +5,7 @@ _Name=Midori
|
|||
_GenericName=Web Browser
|
||||
_Comment=Lightweight web browser
|
||||
Categories=GTK;Network;WebBrowser;
|
||||
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;
|
||||
MimeType=text/html;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;
|
||||
Exec=midori %u
|
||||
Icon=midori
|
||||
Terminal=false
|
||||
|
|
|
@ -291,22 +291,23 @@ midori_addons_open_in_editor_clicked_cb (GtkWidget* toolitem,
|
|||
MidoriWebSettings* settings;
|
||||
MidoriBrowser* browser;
|
||||
gchar* text_editor;
|
||||
gchar* element_uri;
|
||||
|
||||
browser = midori_browser_get_for_widget (GTK_WIDGET (addons->treeview));
|
||||
settings = katze_object_get_object (browser, "settings");
|
||||
|
||||
gtk_tree_model_get (model, &iter, 0, &element, -1);
|
||||
element_uri = g_filename_to_uri (element->fullpath, NULL, NULL);
|
||||
|
||||
g_object_get (settings, "text-editor", &text_editor, NULL);
|
||||
if (text_editor && *text_editor)
|
||||
sokoke_spawn_program (text_editor, element_uri, TRUE);
|
||||
sokoke_spawn_program (text_editor, element->fullpath);
|
||||
else
|
||||
{
|
||||
gchar* element_uri = g_filename_to_uri (element->fullpath, NULL, NULL);
|
||||
sokoke_show_uri (NULL, element_uri,
|
||||
gtk_get_current_event_time (), NULL);
|
||||
|
||||
g_free (element_uri);
|
||||
}
|
||||
|
||||
g_free (text_editor);
|
||||
}
|
||||
}
|
||||
|
@ -516,7 +517,6 @@ static void
|
|||
addons_free_elements (GSList* elements)
|
||||
{
|
||||
struct AddonElement* element;
|
||||
GSList* start = elements;
|
||||
|
||||
while (elements)
|
||||
{
|
||||
|
@ -527,11 +527,10 @@ addons_free_elements (GSList* elements)
|
|||
g_free (element->script_content);
|
||||
g_slist_free (element->includes);
|
||||
g_slist_free (element->excludes);
|
||||
g_slice_free (struct AddonElement, element);
|
||||
|
||||
elements = g_slist_next (elements);
|
||||
}
|
||||
|
||||
g_slist_free (start);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -707,6 +706,7 @@ addons_get_files (AddonsKind kind)
|
|||
}
|
||||
|
||||
g_free (file_extension);
|
||||
g_slist_free (directories);
|
||||
|
||||
return files;
|
||||
}
|
||||
|
@ -951,7 +951,6 @@ addons_update_elements (MidoriExtension* extension,
|
|||
AddonsKind kind)
|
||||
{
|
||||
GSList* addon_files;
|
||||
GSList* files_list;
|
||||
gchar* name;
|
||||
gchar* fullpath;
|
||||
struct AddonElement* element;
|
||||
|
@ -992,7 +991,6 @@ addons_update_elements (MidoriExtension* extension,
|
|||
g_key_file_load_from_file (keyfile, config_file, G_KEY_FILE_NONE, NULL);
|
||||
|
||||
addon_files = addons_get_files (kind);
|
||||
files_list = addon_files;
|
||||
|
||||
elements = NULL;
|
||||
while (addon_files)
|
||||
|
@ -1001,7 +999,7 @@ addons_update_elements (MidoriExtension* extension,
|
|||
gchar* tooltip;
|
||||
|
||||
fullpath = addon_files->data;
|
||||
element = g_new (struct AddonElement, 1);
|
||||
element = g_slice_new (struct AddonElement);
|
||||
element->displayname = g_filename_display_basename (fullpath);
|
||||
element->fullpath = fullpath;
|
||||
element->enabled = TRUE;
|
||||
|
@ -1065,13 +1063,11 @@ addons_update_elements (MidoriExtension* extension,
|
|||
addon_files = g_slist_next (addon_files);
|
||||
elements = g_slist_prepend (elements, element);
|
||||
}
|
||||
g_slist_free (files_list);
|
||||
g_free (config_file);
|
||||
g_key_file_free (keyfile);
|
||||
|
||||
if (addons_list)
|
||||
g_free (addons_list);
|
||||
addons_list = g_new (struct AddonsList, 1);
|
||||
g_slice_free (struct AddonsList, addons_list);
|
||||
addons_list = g_slice_new (struct AddonsList);
|
||||
addons_list->elements = elements;
|
||||
addons_list->liststore = liststore;
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ static const gchar *cookie_manager_page_get_label(MidoriViewable *viewable)
|
|||
|
||||
static const gchar *cookie_manager_page_get_stock_id(MidoriViewable *viewable)
|
||||
{
|
||||
return STOCK_COOKIE_MANAGER;
|
||||
return GTK_STOCK_DIALOG_AUTHENTICATION;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,28 +31,7 @@ static void cm_activate_cb(MidoriExtension *extension, MidoriApp *app, gpointer
|
|||
|
||||
MidoriExtension *extension_init(void)
|
||||
{
|
||||
MidoriExtension *extension;
|
||||
GtkIconFactory *factory;
|
||||
GtkIconSource *icon_source;
|
||||
GtkIconSet *icon_set;
|
||||
static GtkStockItem items[] =
|
||||
{
|
||||
{ STOCK_COOKIE_MANAGER, N_("_Cookie Manager"), 0, 0, NULL }
|
||||
};
|
||||
|
||||
factory = gtk_icon_factory_new();
|
||||
gtk_stock_add(items, G_N_ELEMENTS(items));
|
||||
icon_set = gtk_icon_set_new();
|
||||
icon_source = gtk_icon_source_new();
|
||||
gtk_icon_source_set_icon_name(icon_source, GTK_STOCK_DIALOG_AUTHENTICATION);
|
||||
gtk_icon_set_add_source(icon_set, icon_source);
|
||||
gtk_icon_source_free(icon_source);
|
||||
gtk_icon_factory_add(factory, STOCK_COOKIE_MANAGER, icon_set);
|
||||
gtk_icon_set_unref(icon_set);
|
||||
gtk_icon_factory_add_default(factory);
|
||||
g_object_unref(factory);
|
||||
|
||||
extension = g_object_new(MIDORI_TYPE_EXTENSION,
|
||||
MidoriExtension *extension = g_object_new(MIDORI_TYPE_EXTENSION,
|
||||
"name", _("Cookie Manager"),
|
||||
"description", _("List, view and delete cookies"),
|
||||
"version", "0.2",
|
||||
|
|
|
@ -1,105 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2010 Christian Dywan <christian@twotoasts.de>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
See the file COPYING for the full license text.
|
||||
*/
|
||||
|
||||
using Gtk;
|
||||
using WebKit;
|
||||
using Midori;
|
||||
|
||||
public class ExternalApplications : Midori.Extension {
|
||||
Dialog? dialog;
|
||||
bool launch (string command, string uri) {
|
||||
try {
|
||||
var info = GLib.AppInfo.create_from_commandline (command, "", 0);
|
||||
var uris = new List<string>();
|
||||
uris.prepend (uri);
|
||||
info.launch_uris (uris, new GLib.AppLaunchContext ());
|
||||
return true;
|
||||
}
|
||||
catch (GLib.Error error) {
|
||||
var error_dialog = new Gtk.MessageDialog (null, 0,
|
||||
Gtk.MessageType.ERROR, Gtk.ButtonsType.OK,
|
||||
"Failed to launch external application.");
|
||||
error_dialog.format_secondary_text (error.message);
|
||||
error_dialog.response.connect ((dialog, response)
|
||||
=> { dialog.destroy (); });
|
||||
error_dialog.show ();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool navigating (WebFrame web_frame, NetworkRequest request,
|
||||
WebNavigationAction action, WebPolicyDecision decision) {
|
||||
string uri = request.get_uri ();
|
||||
if (uri.has_prefix ("ftp://")) {
|
||||
if (launch ("gftp", uri)) {
|
||||
decision.ignore ();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void tab_added (View tab) {
|
||||
var web_view = tab.get_web_view ();
|
||||
web_view.navigation_policy_decision_requested.connect (navigating);
|
||||
}
|
||||
void configure_external_applications () {
|
||||
if (dialog == null) {
|
||||
dialog = new Dialog.with_buttons ("Configure External Applications",
|
||||
get_app ().browser,
|
||||
DialogFlags.DESTROY_WITH_PARENT | DialogFlags.NO_SEPARATOR,
|
||||
STOCK_CLOSE, ResponseType.CLOSE);
|
||||
dialog.icon_name = STOCK_PROPERTIES;
|
||||
dialog.destroy.connect ((dialog) => { dialog = null; });
|
||||
dialog.response.connect ((dialog, response) => { dialog.destroy (); });
|
||||
dialog.show ();
|
||||
}
|
||||
else
|
||||
dialog.present ();
|
||||
}
|
||||
void tool_menu_populated (Menu menu) {
|
||||
var menuitem = new MenuItem.with_mnemonic ("Configure _External Applications...");
|
||||
menuitem.activate.connect (configure_external_applications);
|
||||
menuitem.show ();
|
||||
menu.append (menuitem);
|
||||
}
|
||||
void browser_added (Browser browser) {
|
||||
foreach (var tab in browser.get_tabs ())
|
||||
tab_added (tab);
|
||||
browser.add_tab.connect (tab_added);
|
||||
browser.populate_tool_menu.connect (tool_menu_populated);
|
||||
}
|
||||
void activated (Midori.App app) {
|
||||
foreach (var browser in app.get_browsers ())
|
||||
browser_added (browser);
|
||||
app.add_browser.connect (browser_added);
|
||||
}
|
||||
void deactivated () {
|
||||
var app = get_app ();
|
||||
app.add_browser.disconnect (browser_added);
|
||||
foreach (var browser in app.get_browsers ()) {
|
||||
foreach (var tab in browser.get_tabs ())
|
||||
/* */;
|
||||
browser.populate_tool_menu.disconnect (tool_menu_populated);
|
||||
}
|
||||
}
|
||||
internal ExternalApplications () {
|
||||
GLib.Object (name: _("External Applications"),
|
||||
description: _("Associate URL schemes with external commands"),
|
||||
version: "0.1",
|
||||
authors: "Christian Dywan <christian@twotoasts.de>");
|
||||
activate.connect (activated);
|
||||
deactivate.connect (deactivated);
|
||||
}
|
||||
}
|
||||
|
||||
public Midori.Extension extension_init () {
|
||||
return new ExternalApplications ();
|
||||
}
|
||||
|
|
@ -21,7 +21,11 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <sqlite3.h>
|
||||
#ifdef G_OS_WIN32
|
||||
#define LIBPREFIX ""
|
||||
#else
|
||||
#define LIBPREFIX "lib"
|
||||
#endif
|
||||
|
||||
static GHashTable* global_keys;
|
||||
static gchar* jsforms;
|
||||
|
@ -434,7 +438,7 @@ formhistory_activate_cb (MidoriExtension* extension,
|
|||
config_dir = midori_extension_get_config_dir (extension);
|
||||
katze_mkdir_with_parents (config_dir, 0700);
|
||||
filename = g_build_filename (config_dir, "forms.db", NULL);
|
||||
if (sqlite3_open (filename, &db))
|
||||
if (sqlite3_open (filename, &db) != SQLITE_OK)
|
||||
{
|
||||
g_warning (_("Failed to open database: %s\n"), sqlite3_errmsg (db));
|
||||
sqlite3_close (db);
|
||||
|
@ -487,6 +491,21 @@ formhistory_activate_cb (MidoriExtension* extension,
|
|||
</html> */
|
||||
#endif
|
||||
|
||||
static void
|
||||
formhistory_clear_database_cb (void)
|
||||
{
|
||||
gchar* filename = g_build_filename (sokoke_set_config_dir (NULL),
|
||||
"extensions", LIBPREFIX "formhistory." G_MODULE_SUFFIX, "forms.db", NULL);
|
||||
sqlite3* db;
|
||||
if (sqlite3_open (filename, &db) == SQLITE_OK)
|
||||
{
|
||||
sqlite3_exec (db, "DELETE FROM forms", NULL, NULL, NULL);
|
||||
sqlite3_close (db);
|
||||
}
|
||||
g_free (filename);
|
||||
|
||||
}
|
||||
|
||||
MidoriExtension*
|
||||
extension_init (void)
|
||||
{
|
||||
|
@ -520,5 +539,9 @@ extension_init (void)
|
|||
g_signal_connect (extension, "activate",
|
||||
G_CALLBACK (formhistory_activate_cb), NULL);
|
||||
|
||||
/* i18n: Data entered into web forms by the user */
|
||||
sokoke_register_privacy_item ("formhistory", _("_Form History"),
|
||||
G_CALLBACK (formhistory_clear_database_cb));
|
||||
|
||||
return extension;
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ private class HistoryList : Midori.Extension {
|
|||
}
|
||||
internal HistoryList () {
|
||||
GLib.Object (name: _("History List"),
|
||||
description: _("Allows to switch tabs by choosing from a list sorted by last usage"),
|
||||
description: _("Switch tabs with Ctrl+Tab sorted by last usage"),
|
||||
version: "0.2",
|
||||
authors: "André Stösel <Midori-Plugin@PyIT.de>");
|
||||
activate.connect (activated);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2008-2009 Christian Dywan <christian@twotoasts.de>
|
||||
Copyright (C) 2008-2010 Christian Dywan <christian@twotoasts.de>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -10,6 +10,7 @@
|
|||
*/
|
||||
|
||||
#include <midori/midori.h>
|
||||
#include <midori/sokoke.h>
|
||||
|
||||
static void
|
||||
statusbar_features_app_add_browser_cb (MidoriApp* app,
|
||||
|
@ -84,39 +85,32 @@ statusbar_features_app_add_browser_cb (MidoriApp* app,
|
|||
g_object_set_data (G_OBJECT (button), "feature-label", _("Images"));
|
||||
image = gtk_image_new_from_stock (STOCK_IMAGE, GTK_ICON_SIZE_MENU);
|
||||
gtk_button_set_image (GTK_BUTTON (button), image);
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
gtk_widget_set_tooltip_text (button, _("Load images automatically"));
|
||||
#endif
|
||||
statusbar_features_toolbar_notify_toolbar_style_cb (toolbar, NULL, button);
|
||||
g_signal_connect (toolbar, "notify::toolbar-style",
|
||||
G_CALLBACK (statusbar_features_toolbar_notify_toolbar_style_cb), button);
|
||||
gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 2);
|
||||
gtk_widget_show (button);
|
||||
button = katze_property_proxy (settings, "enable-scripts", "toggle");
|
||||
g_object_set_data (G_OBJECT (button), "feature-label", _("Scripts"));
|
||||
image = gtk_image_new_from_stock (STOCK_SCRIPTS, GTK_ICON_SIZE_MENU);
|
||||
gtk_button_set_image (GTK_BUTTON (button), image);
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
gtk_widget_set_tooltip_text (button, _("Enable scripts"));
|
||||
#endif
|
||||
statusbar_features_toolbar_notify_toolbar_style_cb (toolbar, NULL, button);
|
||||
g_signal_connect (toolbar, "notify::toolbar-style",
|
||||
G_CALLBACK (statusbar_features_toolbar_notify_toolbar_style_cb), button);
|
||||
gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 2);
|
||||
gtk_widget_show (button);
|
||||
button = katze_property_proxy (settings, "enable-plugins", "toggle");
|
||||
g_object_set_data (G_OBJECT (button), "feature-label", _("Netscape plugins"));
|
||||
image = gtk_image_new_from_stock (STOCK_PLUGINS, GTK_ICON_SIZE_MENU);
|
||||
gtk_button_set_image (GTK_BUTTON (button), image);
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
gtk_widget_set_tooltip_text (button, _("Enable Netscape plugins"));
|
||||
#endif
|
||||
statusbar_features_toolbar_notify_toolbar_style_cb (toolbar, NULL, button);
|
||||
g_signal_connect (toolbar, "notify::toolbar-style",
|
||||
G_CALLBACK (statusbar_features_toolbar_notify_toolbar_style_cb), button);
|
||||
gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 2);
|
||||
gtk_widget_show (button);
|
||||
gtk_widget_show (bbox);
|
||||
button = katze_property_proxy (settings, "identify-as", NULL);
|
||||
gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 2);
|
||||
gtk_widget_show_all (bbox);
|
||||
gtk_box_pack_start (GTK_BOX (statusbar), bbox, FALSE, FALSE, 3);
|
||||
g_object_unref (settings);
|
||||
g_object_unref (statusbar);
|
||||
|
|
|
@ -462,7 +462,7 @@ tab_panel_browser_remove_tab_cb (MidoriBrowser* browser,
|
|||
{
|
||||
gboolean minimized = katze_object_get_boolean (view, "minimized");
|
||||
|
||||
if (!(GTK_OBJECT_FLAGS (browser) & GTK_IN_DESTRUCTION))
|
||||
if (!g_object_get_data (G_OBJECT (browser), "midori-browser-destroyed"))
|
||||
tab_panel_remove_view (browser, view, minimized);
|
||||
}
|
||||
|
||||
|
@ -475,7 +475,7 @@ tab_panel_browser_notify_tab_cb (MidoriBrowser* browser,
|
|||
GtkTreeIter iter;
|
||||
GtkWidget* view;
|
||||
|
||||
if (GTK_OBJECT_FLAGS (browser) & GTK_IN_DESTRUCTION)
|
||||
if (g_object_get_data (G_OBJECT (browser), "midori-browser-destroyed"))
|
||||
return;
|
||||
|
||||
view = midori_browser_get_current_tab (browser);
|
||||
|
|
|
@ -23,11 +23,20 @@
|
|||
|
||||
#define MAXLENGTH 1024 * 1024
|
||||
|
||||
static gchar*
|
||||
web_cache_get_cache_dir (void)
|
||||
{
|
||||
static gchar* cache_dir = NULL;
|
||||
if (!cache_dir)
|
||||
cache_dir = g_build_filename (g_get_user_cache_dir (),
|
||||
PACKAGE_NAME, "web", NULL);
|
||||
return cache_dir;
|
||||
}
|
||||
|
||||
static gchar*
|
||||
web_cache_get_cached_path (MidoriExtension* extension,
|
||||
const gchar* uri)
|
||||
{
|
||||
static const gchar* cache_path = NULL;
|
||||
gchar* checksum;
|
||||
gchar* folder;
|
||||
gchar* sub_path;
|
||||
|
@ -36,12 +45,10 @@ web_cache_get_cached_path (MidoriExtension* extension,
|
|||
gchar* cached_filename;
|
||||
gchar* cached_path;
|
||||
|
||||
if (!cache_path)
|
||||
cache_path = midori_extension_get_string (extension, "path");
|
||||
checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, uri, -1);
|
||||
folder = g_strdup_printf ("%c%c", checksum[0], checksum[1]);
|
||||
sub_path = g_build_path (G_DIR_SEPARATOR_S, cache_path, folder, NULL);
|
||||
/* FIXME: Wrong place? */
|
||||
sub_path = g_build_path (G_DIR_SEPARATOR_S,
|
||||
web_cache_get_cache_dir (), folder, NULL);
|
||||
katze_mkdir_with_parents (sub_path, 0700);
|
||||
g_free (folder);
|
||||
|
||||
|
@ -82,7 +89,7 @@ web_cache_save_headers (SoupMessage* msg,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
GHashTable*
|
||||
static GHashTable*
|
||||
web_cache_get_headers (gchar* filename)
|
||||
{
|
||||
GHashTable* headers;
|
||||
|
@ -435,12 +442,11 @@ static void
|
|||
web_cache_activate_cb (MidoriExtension* extension,
|
||||
MidoriApp* app)
|
||||
{
|
||||
const gchar* cache_path = midori_extension_get_string (extension, "path");
|
||||
KatzeArray* browsers;
|
||||
MidoriBrowser* browser;
|
||||
SoupSession* session = webkit_get_default_session ();
|
||||
|
||||
katze_mkdir_with_parents (cache_path, 0700);
|
||||
katze_mkdir_with_parents (web_cache_get_cache_dir (), 0700);
|
||||
g_signal_connect (session, "request-queued",
|
||||
G_CALLBACK (web_cache_session_request_queued_cb), extension);
|
||||
|
||||
|
@ -453,24 +459,27 @@ web_cache_activate_cb (MidoriExtension* extension,
|
|||
g_object_unref (browsers);
|
||||
}
|
||||
|
||||
static void
|
||||
web_cache_clear_cache_cb (void)
|
||||
{
|
||||
sokoke_remove_path (web_cache_get_cache_dir (), TRUE);
|
||||
}
|
||||
|
||||
MidoriExtension*
|
||||
extension_init (void)
|
||||
{
|
||||
gchar* cache_path = g_build_filename (g_get_user_cache_dir (),
|
||||
PACKAGE_NAME, "web", NULL);
|
||||
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
|
||||
"name", _("Web Cache"),
|
||||
"description", _("Cache HTTP communication on disk"),
|
||||
"version", "0.1",
|
||||
"authors", "Christian Dywan <christian@twotoasts.de>",
|
||||
NULL);
|
||||
midori_extension_install_string (extension, "path", cache_path);
|
||||
midori_extension_install_integer (extension, "size", 50);
|
||||
|
||||
g_free (cache_path);
|
||||
|
||||
g_signal_connect (extension, "activate",
|
||||
G_CALLBACK (web_cache_activate_cb), NULL);
|
||||
|
||||
sokoke_register_privacy_item ("web-cache", _("Web Cache"),
|
||||
G_CALLBACK (web_cache_clear_cache_cb));
|
||||
|
||||
return extension;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,8 @@ enum {
|
|||
|
||||
static guint signals[LAST_SIGNAL];
|
||||
|
||||
GList* kalistglobal;
|
||||
|
||||
static void
|
||||
katze_array_finalize (GObject* object);
|
||||
|
||||
|
@ -482,6 +484,8 @@ katze_array_get_items (KatzeArray* array)
|
|||
GList*
|
||||
katze_array_peek_items (KatzeArray* array)
|
||||
{
|
||||
g_return_val_if_fail (KATZE_IS_ARRAY (array), NULL);
|
||||
|
||||
return array->items;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ katze_array_get_items (KatzeArray* array);
|
|||
GList*
|
||||
katze_array_peek_items (KatzeArray* array);
|
||||
|
||||
GList* kalistglobal;
|
||||
extern GList* kalistglobal;
|
||||
#define KATZE_ARRAY_FOREACH_ITEM(kaitem, kaarray) \
|
||||
for (kalistglobal = katze_array_peek_items (kaarray), \
|
||||
kaitem = kalistglobal ? kalistglobal->data : NULL; \
|
||||
|
|
|
@ -103,8 +103,7 @@ authentication_message_got_headers_cb (SoupMessage* msg,
|
|||
|
||||
if (!g_hash_table_lookup (save->http_auth->logins, opaque_info))
|
||||
{
|
||||
KatzeHttpAuthLogin* login;
|
||||
login = g_new (KatzeHttpAuthLogin, 1);
|
||||
KatzeHttpAuthLogin* login = g_slice_new (KatzeHttpAuthLogin);
|
||||
login->username = save->username;
|
||||
login->password = save->password;
|
||||
g_hash_table_insert (save->http_auth->logins, opaque_info, login);
|
||||
|
@ -130,7 +129,7 @@ authentication_message_got_headers_cb (SoupMessage* msg,
|
|||
}
|
||||
|
||||
/* FIXME g_object_unref (save->auth); */
|
||||
/* FIXME g_free (save); */
|
||||
/* FIXME g_slice_free (KatzeHttpAuthSave, save); */
|
||||
g_signal_handlers_disconnect_by_func (msg,
|
||||
authentication_message_got_headers_cb, save);
|
||||
}
|
||||
|
@ -164,7 +163,7 @@ authentication_dialog_response_cb (GtkWidget* dialog,
|
|||
else
|
||||
{
|
||||
g_object_unref (save->auth);
|
||||
g_free (save);
|
||||
g_slice_free (KatzeHttpAuthSave, save);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -260,7 +259,6 @@ katze_http_auth_session_authenticate_cb (SoupSession* session,
|
|||
gtk_size_group_add_widget (sizegroup, align);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), align, TRUE, TRUE, 0);
|
||||
entry = gtk_entry_new ();
|
||||
gtk_entry_set_max_length (GTK_ENTRY (entry), 32);
|
||||
if (login)
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), login->password);
|
||||
gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE);
|
||||
|
@ -280,7 +278,7 @@ katze_http_auth_session_authenticate_cb (SoupSession* session,
|
|||
g_object_set_data (G_OBJECT (dialog), "session", session);
|
||||
g_object_set_data (G_OBJECT (dialog), "msg", msg);
|
||||
|
||||
save = g_new (KatzeHttpAuthSave, 1);
|
||||
save = g_slice_new0 (KatzeHttpAuthSave);
|
||||
save->http_auth = http_auth;
|
||||
save->auth = g_object_ref (auth);
|
||||
g_signal_connect (dialog, "response",
|
||||
|
@ -366,7 +364,7 @@ katze_http_auth_login_free (KatzeHttpAuthLogin* login)
|
|||
{
|
||||
g_free (login->username);
|
||||
g_free (login->password);
|
||||
g_free (login);
|
||||
g_slice_free (KatzeHttpAuthLogin, login);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -389,12 +387,9 @@ katze_http_auth_set_filename (KatzeHttpAuth* http_auth,
|
|||
gchar** parts = g_strsplit (line, "\t", 3);
|
||||
if (parts && parts[0] && parts[1] && parts[2])
|
||||
{
|
||||
KatzeHttpAuthLogin* login;
|
||||
gint length;
|
||||
|
||||
login = g_new (KatzeHttpAuthLogin, 1);
|
||||
gint length = strlen (parts[2]);
|
||||
KatzeHttpAuthLogin* login = g_slice_new (KatzeHttpAuthLogin);
|
||||
login->username = parts[1];
|
||||
length = strlen (parts[2]);
|
||||
if (parts[2][length - 1] == '\n')
|
||||
length--;
|
||||
login->password = g_strndup (parts[2], length);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2008-2009 Christian Dywan <christian@twotoasts.de>
|
||||
Copyright (C) 2008-2010 Christian Dywan <christian@twotoasts.de>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -16,13 +16,21 @@
|
|||
#include "katze-http-cookies.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <glib/gi18n.h>
|
||||
#include <libsoup/soup.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
struct _KatzeHttpCookies
|
||||
{
|
||||
GObject parent_instance;
|
||||
gchar* filename;
|
||||
SoupCookieJar* jar;
|
||||
guint timeout;
|
||||
guint counter;
|
||||
};
|
||||
|
||||
struct _KatzeHttpCookiesClass
|
||||
|
@ -120,11 +128,12 @@ cookie_jar_load (SoupCookieJar* jar,
|
|||
gchar* line;
|
||||
gchar* p;
|
||||
gsize length = 0;
|
||||
time_t now = time (NULL);
|
||||
time_t now;
|
||||
|
||||
if (!g_file_get_contents (filename, &contents, &length, NULL))
|
||||
return;
|
||||
|
||||
now = time (NULL);
|
||||
line = contents;
|
||||
for (p = contents; *p; p++)
|
||||
{
|
||||
|
@ -145,12 +154,10 @@ cookie_jar_load (SoupCookieJar* jar,
|
|||
Copyright (C) 2008 Xan Lopez <xan@gnome.org>
|
||||
Copyright (C) 2008 Dan Winship <danw@gnome.org>
|
||||
Copied from libSoup 2.24, coding style preserved */
|
||||
static void
|
||||
static gboolean
|
||||
write_cookie (FILE *out, SoupCookie *cookie)
|
||||
{
|
||||
fseek (out, 0, SEEK_END);
|
||||
|
||||
fprintf (out, "%s%s\t%s\t%s\t%s\t%lu\t%s\t%s\n",
|
||||
if (fprintf (out, "%s%s\t%s\t%s\t%s\t%lu\t%s\t%s\n",
|
||||
cookie->http_only ? "#HttpOnly_" : "",
|
||||
cookie->domain,
|
||||
*cookie->domain == '.' ? "TRUE" : "FALSE",
|
||||
|
@ -158,117 +165,132 @@ write_cookie (FILE *out, SoupCookie *cookie)
|
|||
cookie->secure ? "TRUE" : "FALSE",
|
||||
(gulong)soup_date_to_time_t (cookie->expires),
|
||||
cookie->name,
|
||||
cookie->value);
|
||||
cookie->value) < 0)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Cookie jar saving to Mozilla format
|
||||
Copyright (C) 2008 Xan Lopez <xan@gnome.org>
|
||||
Copyright (C) 2008 Dan Winship <danw@gnome.org>
|
||||
Copied from libSoup 2.24, coding style preserved */
|
||||
static void
|
||||
delete_cookie (const char *filename, SoupCookie *cookie)
|
||||
static gboolean
|
||||
katze_http_cookies_update_jar (KatzeHttpCookies* http_cookies)
|
||||
{
|
||||
char *contents = NULL, *line, *p;
|
||||
gsize length = 0;
|
||||
FILE *f;
|
||||
SoupCookie *c;
|
||||
time_t now = time (NULL);
|
||||
gint fn = 0;
|
||||
FILE* f = NULL;
|
||||
gchar* temporary_filename = NULL;
|
||||
GSList* cookies;
|
||||
|
||||
if (!g_file_get_contents (filename, &contents, &length, NULL))
|
||||
return;
|
||||
http_cookies->timeout = 0;
|
||||
|
||||
f = fopen (filename, "w");
|
||||
if (!f) {
|
||||
g_free (contents);
|
||||
return;
|
||||
}
|
||||
temporary_filename = g_strconcat (http_cookies->filename, ".XXXXXX", NULL);
|
||||
if ((fn = g_mkstemp (temporary_filename)) == -1)
|
||||
goto failed;
|
||||
if (!((f = fdopen (fn, "wb"))))
|
||||
goto failed;
|
||||
|
||||
line = contents;
|
||||
for (p = contents; *p; p++) {
|
||||
/* \r\n comes out as an extra empty line and gets ignored */
|
||||
if (*p == '\r' || *p == '\n') {
|
||||
*p = '\0';
|
||||
c = parse_cookie (line, now);
|
||||
if (!c)
|
||||
continue;
|
||||
if (!soup_cookie_equal (cookie, c))
|
||||
write_cookie (f, c);
|
||||
line = p + 1;
|
||||
soup_cookie_free (c);
|
||||
}
|
||||
}
|
||||
c = parse_cookie (line, now);
|
||||
if (c) {
|
||||
if (!soup_cookie_equal (cookie, c))
|
||||
write_cookie (f, c);
|
||||
soup_cookie_free (c);
|
||||
cookies = soup_cookie_jar_all_cookies (http_cookies->jar);
|
||||
for (; cookies != NULL; cookies = g_slist_next (cookies))
|
||||
{
|
||||
SoupCookie* cookie = cookies->data;
|
||||
if (cookie->expires && !soup_date_is_past (cookie->expires))
|
||||
write_cookie (f, cookie);
|
||||
soup_cookie_free (cookie);
|
||||
}
|
||||
g_slist_free (cookies);
|
||||
|
||||
g_free (contents);
|
||||
if (fclose (f) != 0)
|
||||
{
|
||||
f = NULL;
|
||||
goto failed;
|
||||
}
|
||||
f = NULL;
|
||||
|
||||
if (g_rename (temporary_filename, http_cookies->filename) == -1)
|
||||
goto failed;
|
||||
g_free (temporary_filename);
|
||||
|
||||
if (g_getenv ("MIDORI_COOKIES_DEBUG") != NULL)
|
||||
{
|
||||
g_print ("KatzeHttpCookies: %d cookies changed\n", http_cookies->counter);
|
||||
http_cookies->counter = 0;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
failed:
|
||||
if (f)
|
||||
fclose (f);
|
||||
g_unlink (temporary_filename);
|
||||
g_free (temporary_filename);
|
||||
if (g_getenv ("MIDORI_COOKIES_DEBUG") != NULL)
|
||||
g_print ("KatzeHttpCookies: Failed to write '%s'\n",
|
||||
http_cookies->filename);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Cookie jar saving to Mozilla format
|
||||
Copyright (C) 2008 Xan Lopez <xan@gnome.org>
|
||||
Copyright (C) 2008 Dan Winship <danw@gnome.org>
|
||||
Mostly copied from libSoup 2.24, coding style adjusted */
|
||||
static void
|
||||
cookie_jar_changed_cb (SoupCookieJar* jar,
|
||||
katze_http_cookies_jar_changed_cb (SoupCookieJar* jar,
|
||||
SoupCookie* old_cookie,
|
||||
SoupCookie* new_cookie,
|
||||
gchar* filename)
|
||||
KatzeHttpCookies* http_cookies)
|
||||
{
|
||||
GObject* settings;
|
||||
guint accept_cookies;
|
||||
|
||||
if (old_cookie)
|
||||
delete_cookie (filename, old_cookie);
|
||||
soup_cookie_set_max_age (old_cookie, 0);
|
||||
|
||||
if (new_cookie)
|
||||
{
|
||||
FILE *out;
|
||||
|
||||
settings = g_object_get_data (G_OBJECT (jar), "midori-settings");
|
||||
accept_cookies = katze_object_get_enum (settings, "accept-cookies");
|
||||
if (accept_cookies == 2 /* MIDORI_ACCEPT_COOKIES_NONE */)
|
||||
{
|
||||
soup_cookie_jar_delete_cookie (jar, new_cookie);
|
||||
soup_cookie_set_max_age (new_cookie, 0);
|
||||
}
|
||||
else if (accept_cookies == 1 /* MIDORI_ACCEPT_COOKIES_SESSION */
|
||||
&& new_cookie->expires)
|
||||
{
|
||||
soup_cookie_jar_delete_cookie (jar, new_cookie);
|
||||
soup_cookie_set_max_age (new_cookie, -1);
|
||||
}
|
||||
else if (new_cookie->expires)
|
||||
{
|
||||
gint age = katze_object_get_int (settings, "maximum-cookie-age");
|
||||
soup_cookie_set_max_age (new_cookie,
|
||||
if (age > 0)
|
||||
{
|
||||
SoupDate* max_date = soup_date_new_from_now (
|
||||
age * SOUP_COOKIE_MAX_AGE_ONE_DAY);
|
||||
if (soup_date_to_time_t (new_cookie->expires)
|
||||
> soup_date_to_time_t (max_date))
|
||||
soup_cookie_set_expires (new_cookie, max_date);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* An age of 0 to SoupCookie means already-expired
|
||||
A user choosing 0 days probably expects 1 hour. */
|
||||
soup_cookie_set_max_age (new_cookie, SOUP_COOKIE_MAX_AGE_ONE_HOUR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(out = fopen (filename, "a")))
|
||||
return;
|
||||
write_cookie (out, new_cookie);
|
||||
if (fclose (out) != 0)
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (g_getenv ("MIDORI_COOKIES_DEBUG") != NULL)
|
||||
http_cookies->counter++;
|
||||
|
||||
if (!http_cookies->timeout && (old_cookie || new_cookie->expires))
|
||||
http_cookies->timeout = g_timeout_add_seconds (5,
|
||||
(GSourceFunc)katze_http_cookies_update_jar, http_cookies);
|
||||
}
|
||||
|
||||
static void
|
||||
katze_http_cookies_attach (SoupSessionFeature* feature,
|
||||
SoupSession* session)
|
||||
{
|
||||
SoupSessionFeature* cookie_jar;
|
||||
gchar* filename;
|
||||
|
||||
cookie_jar = soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR);
|
||||
g_return_if_fail (cookie_jar != NULL);
|
||||
filename = g_object_get_data (G_OBJECT (feature), "filename");
|
||||
g_return_if_fail (filename != NULL);
|
||||
cookie_jar_load (SOUP_COOKIE_JAR (cookie_jar), filename);
|
||||
g_signal_connect_data (cookie_jar, "changed",
|
||||
G_CALLBACK (cookie_jar_changed_cb), g_strdup (filename),
|
||||
(GClosureNotify)g_free, 0);
|
||||
KatzeHttpCookies* http_cookies = (KatzeHttpCookies*)feature;
|
||||
SoupSessionFeature* jar = soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR);
|
||||
g_return_if_fail (jar != NULL);
|
||||
http_cookies->filename = g_object_get_data (G_OBJECT (feature), "filename");
|
||||
g_return_if_fail (http_cookies->filename != NULL);
|
||||
http_cookies->jar = g_object_ref (jar);
|
||||
cookie_jar_load (http_cookies->jar, http_cookies->filename);
|
||||
g_signal_connect (jar, "changed",
|
||||
G_CALLBACK (katze_http_cookies_jar_changed_cb), feature);
|
||||
|
||||
}
|
||||
|
||||
|
@ -276,7 +298,11 @@ static void
|
|||
katze_http_cookies_detach (SoupSessionFeature* feature,
|
||||
SoupSession* session)
|
||||
{
|
||||
/* Nothing to do. */
|
||||
KatzeHttpCookies* http_cookies = (KatzeHttpCookies*)feature;
|
||||
if (http_cookies->timeout)
|
||||
katze_http_cookies_update_jar (http_cookies);
|
||||
katze_assign (http_cookies->filename, NULL);
|
||||
katze_object_assign (http_cookies->jar, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -287,14 +313,24 @@ katze_http_cookies_session_feature_iface_init (SoupSessionFeatureInterface *ifac
|
|||
iface->detach = katze_http_cookies_detach;
|
||||
}
|
||||
|
||||
static void
|
||||
katze_http_cookies_finalize (GObject* object)
|
||||
{
|
||||
katze_http_cookies_detach ((SoupSessionFeature*)object, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
katze_http_cookies_class_init (KatzeHttpCookiesClass* class)
|
||||
{
|
||||
/* Nothing to do. */
|
||||
GObjectClass* gobject_class = (GObjectClass*)class;
|
||||
gobject_class->finalize = katze_http_cookies_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
katze_http_cookies_init (KatzeHttpCookies* http_cookies)
|
||||
{
|
||||
/* Nothing to do. */
|
||||
http_cookies->filename = NULL;
|
||||
http_cookies->jar = NULL;
|
||||
http_cookies->timeout = 0;
|
||||
http_cookies->counter = 0;
|
||||
}
|
||||
|
|
|
@ -29,8 +29,6 @@ struct _KatzeNet
|
|||
|
||||
gchar* cache_path;
|
||||
guint cache_size;
|
||||
|
||||
SoupSession* session;
|
||||
};
|
||||
|
||||
struct _KatzeNetClass
|
||||
|
@ -57,8 +55,6 @@ katze_net_init (KatzeNet* net)
|
|||
{
|
||||
net->cache_path = g_build_filename (g_get_user_cache_dir (),
|
||||
PACKAGE_NAME, NULL);
|
||||
|
||||
net->session = webkit_get_default_session ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -90,7 +86,6 @@ katze_net_new (void)
|
|||
|
||||
typedef struct
|
||||
{
|
||||
KatzeNet* net;
|
||||
KatzeNetStatusCb status_cb;
|
||||
KatzeNetTransferCb transfer_cb;
|
||||
gpointer user_data;
|
||||
|
@ -100,16 +95,12 @@ typedef struct
|
|||
static void
|
||||
katze_net_priv_free (KatzeNetPriv* priv)
|
||||
{
|
||||
KatzeNetRequest* request;
|
||||
|
||||
request = priv->request;
|
||||
|
||||
KatzeNetRequest* request = priv->request;
|
||||
g_free (request->uri);
|
||||
g_free (request->mime_type);
|
||||
g_free (request->data);
|
||||
|
||||
g_free (request);
|
||||
g_free (priv);
|
||||
g_slice_free (KatzeNetRequest, request);
|
||||
g_slice_free (KatzeNetPriv, priv);
|
||||
}
|
||||
|
||||
gchar*
|
||||
|
@ -151,9 +142,7 @@ static void
|
|||
katze_net_got_headers_cb (SoupMessage* msg,
|
||||
KatzeNetPriv* priv)
|
||||
{
|
||||
KatzeNetRequest* request;
|
||||
|
||||
request = priv->request;
|
||||
KatzeNetRequest* request = priv->request;
|
||||
|
||||
switch (msg->status_code)
|
||||
{
|
||||
|
@ -171,7 +160,7 @@ katze_net_got_headers_cb (SoupMessage* msg,
|
|||
{
|
||||
g_signal_handlers_disconnect_by_func (msg, katze_net_got_headers_cb, priv);
|
||||
g_signal_handlers_disconnect_by_func (msg, katze_net_got_body_cb, priv);
|
||||
soup_session_cancel_message (priv->net->session, msg, 1);
|
||||
soup_session_cancel_message (webkit_get_default_session (), msg, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,9 +168,7 @@ static void
|
|||
katze_net_got_body_cb (SoupMessage* msg,
|
||||
KatzeNetPriv* priv)
|
||||
{
|
||||
KatzeNetRequest* request;
|
||||
|
||||
request = priv->request;
|
||||
KatzeNetRequest* request = priv->request;
|
||||
|
||||
if (msg->response_body->length > 0)
|
||||
{
|
||||
|
@ -203,48 +190,35 @@ katze_net_finished_cb (SoupMessage* msg,
|
|||
static gboolean
|
||||
katze_net_local_cb (KatzeNetPriv* priv)
|
||||
{
|
||||
KatzeNetRequest* request;
|
||||
gchar* filename;
|
||||
gchar* contents;
|
||||
gsize length;
|
||||
|
||||
request = priv->request;
|
||||
filename = g_filename_from_uri (request->uri, NULL, NULL);
|
||||
KatzeNetRequest* request = priv->request;
|
||||
gchar* filename = g_filename_from_uri (request->uri, NULL, NULL);
|
||||
|
||||
if (!filename || g_access (filename, F_OK) != 0)
|
||||
{
|
||||
request->status = KATZE_NET_NOT_FOUND;
|
||||
if (priv->status_cb)
|
||||
priv->status_cb (request, priv->user_data);
|
||||
katze_net_priv_free (priv);
|
||||
return FALSE;
|
||||
}
|
||||
else if (!(priv->status_cb && !priv->status_cb (request, priv->user_data))
|
||||
&& priv->transfer_cb)
|
||||
{
|
||||
gchar* contents = NULL;
|
||||
gsize length;
|
||||
|
||||
request->status = KATZE_NET_VERIFIED;
|
||||
if (priv->status_cb && !priv->status_cb (request, priv->user_data))
|
||||
{
|
||||
katze_net_priv_free (priv);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!priv->transfer_cb)
|
||||
{
|
||||
katze_net_priv_free (priv);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
contents = NULL;
|
||||
if (!g_file_get_contents (filename, &contents, &length, NULL))
|
||||
{
|
||||
request->status = KATZE_NET_FAILED;
|
||||
priv->transfer_cb (request, priv->user_data);
|
||||
katze_net_priv_free (priv);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
request->status = KATZE_NET_DONE;
|
||||
request->data = contents;
|
||||
request->length = length;
|
||||
}
|
||||
priv->transfer_cb (request, priv->user_data);
|
||||
}
|
||||
g_free (filename);
|
||||
katze_net_priv_free (priv);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -298,15 +272,12 @@ katze_net_load_uri (KatzeNet* net,
|
|||
if (!status_cb && !transfer_cb)
|
||||
return;
|
||||
|
||||
net = katze_net_new ();
|
||||
|
||||
request = g_new0 (KatzeNetRequest, 1);
|
||||
request = g_slice_new (KatzeNetRequest);
|
||||
request->uri = g_strdup (uri);
|
||||
request->mime_type = NULL;
|
||||
request->data = NULL;
|
||||
|
||||
priv = g_new0 (KatzeNetPriv, 1);
|
||||
priv->net = net;
|
||||
priv = g_slice_new (KatzeNetPriv);
|
||||
priv->status_cb = status_cb;
|
||||
priv->transfer_cb = transfer_cb;
|
||||
priv->user_data = user_data;
|
||||
|
@ -323,16 +294,13 @@ katze_net_load_uri (KatzeNet* net,
|
|||
G_CALLBACK (katze_net_got_body_cb), priv);
|
||||
g_signal_connect (msg, "finished",
|
||||
G_CALLBACK (katze_net_finished_cb), priv);
|
||||
soup_session_queue_message (net->session, msg, NULL, NULL);
|
||||
soup_session_queue_message (webkit_get_default_session (), msg, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_str_has_prefix (uri, "file://"))
|
||||
{
|
||||
g_idle_add ((GSourceFunc)katze_net_local_cb, priv);
|
||||
return;
|
||||
}
|
||||
|
||||
else
|
||||
g_idle_add ((GSourceFunc)katze_net_default_cb, priv);
|
||||
}
|
||||
|
||||
|
|
|
@ -137,15 +137,6 @@ struct _KatzeScrolledPrivate
|
|||
gdouble vertical_speed;
|
||||
gdouble horizontal_deceleration;
|
||||
gdouble vertical_deceleration;
|
||||
|
||||
/* Internal scrollbars */
|
||||
GdkWindow* vertical_scrollbar_window;
|
||||
GdkWindow* horizontal_scrollbar_window;
|
||||
gint vertical_scrollbar_size;
|
||||
gint horizontal_scrollbar_size;
|
||||
guint hide_scrollbars_timeout_id;
|
||||
GdkGC* hilight_gc;
|
||||
GdkGC* shadow_gc;
|
||||
};
|
||||
|
||||
typedef struct _KatzeScrolledState KatzeScrolledState;
|
||||
|
@ -212,7 +203,7 @@ katze_scrolled_event_handler_func (GdkEvent* event,
|
|||
EventHandlerData* data;
|
||||
gboolean stop_propagating;
|
||||
|
||||
state = g_new0 (KatzeScrolledState, 1);
|
||||
state = g_slice_new (KatzeScrolledState);
|
||||
state->current_event_handler = g_list_first (event_handlers);
|
||||
if (state->current_event_handler)
|
||||
{
|
||||
|
@ -225,7 +216,7 @@ katze_scrolled_event_handler_func (GdkEvent* event,
|
|||
else
|
||||
gtk_main_do_event (event);
|
||||
|
||||
g_free (state);
|
||||
g_slice_free (KatzeScrolledState, state);
|
||||
}
|
||||
|
||||
static GdkWindow* current_gdk_window;
|
||||
|
@ -277,132 +268,6 @@ enable_hadjustment (KatzeScrolled* scrolled)
|
|||
g_signal_handlers_unblock_matched (priv->hadjustment, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, priv->viewport);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
on_expose_event (GtkWidget* widget,
|
||||
GdkEventExpose* event,
|
||||
KatzeScrolled* scrolled)
|
||||
{
|
||||
KatzeScrolledPrivate* priv = scrolled->priv;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
if (gtk_widget_is_drawable (widget))
|
||||
{
|
||||
if (event->window == priv->horizontal_scrollbar_window)
|
||||
{
|
||||
if (priv->horizontal_scrollbar_size)
|
||||
{
|
||||
gdk_draw_line (event->window, priv->hilight_gc, 0, 0, priv->horizontal_scrollbar_size - 1, 0);
|
||||
gdk_draw_line (event->window, priv->hilight_gc, 0, 1, 0, 9);
|
||||
gdk_draw_line (event->window, priv->shadow_gc, priv->horizontal_scrollbar_size - 1, 1, priv->horizontal_scrollbar_size - 1, 9);
|
||||
gdk_draw_line (event->window, priv->shadow_gc, 0, 9, priv->horizontal_scrollbar_size - 1, 9);
|
||||
}
|
||||
|
||||
ret = TRUE;
|
||||
}
|
||||
else if (event->window == priv->vertical_scrollbar_window)
|
||||
{
|
||||
if (priv->vertical_scrollbar_size)
|
||||
{
|
||||
gdk_draw_line (event->window, priv->hilight_gc, 0, 0, 9, 0);
|
||||
gdk_draw_line (event->window, priv->hilight_gc, 0, 1, 0, priv->vertical_scrollbar_size - 1);
|
||||
gdk_draw_line (event->window, priv->shadow_gc, 9, 1, 9, priv->vertical_scrollbar_size - 1);
|
||||
gdk_draw_line (event->window, priv->shadow_gc, 0, priv->vertical_scrollbar_size - 1, 9, priv->vertical_scrollbar_size - 1);
|
||||
}
|
||||
|
||||
ret = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
adjust_scrollbar (KatzeScrolled* scrolled,
|
||||
GdkWindow* scrollbar_window,
|
||||
GtkAdjustment* adjustment,
|
||||
gint* previous_size,
|
||||
gboolean horizontal)
|
||||
{
|
||||
KatzeScrolledPrivate* priv = scrolled->priv;
|
||||
GtkWidget* widget = GTK_WIDGET (scrolled);
|
||||
gdouble page_size, upper, lower, value;
|
||||
gint x, y;
|
||||
gint size;
|
||||
double position;
|
||||
GtkAllocation allocation;
|
||||
GtkWidget* window;
|
||||
|
||||
page_size = gtk_adjustment_get_page_size (adjustment);
|
||||
upper = gtk_adjustment_get_upper (adjustment);
|
||||
lower = gtk_adjustment_get_lower (adjustment);
|
||||
value = gtk_adjustment_get_value (adjustment);
|
||||
|
||||
if (page_size >= upper - lower)
|
||||
{
|
||||
*previous_size = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
size = page_size / (upper - lower)
|
||||
* (horizontal ? allocation.height : allocation.width);
|
||||
if (size != *previous_size)
|
||||
{
|
||||
*previous_size = size;
|
||||
if (horizontal)
|
||||
{
|
||||
gdk_window_resize (scrollbar_window, 10, size);
|
||||
gdk_window_clear (scrollbar_window);
|
||||
gdk_draw_line (scrollbar_window, priv->hilight_gc, 0, 0, 9, 0);
|
||||
gdk_draw_line (scrollbar_window, priv->hilight_gc, 0, 1, 0, size - 1);
|
||||
gdk_draw_line (scrollbar_window, priv->shadow_gc, 9, 1, 9, size - 1);
|
||||
gdk_draw_line (scrollbar_window, priv->shadow_gc, 0, size - 1, 9, size - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_window_resize (scrollbar_window, size, 10);
|
||||
gdk_window_clear (scrollbar_window);
|
||||
gdk_draw_line (scrollbar_window, priv->hilight_gc, 0, 0, size - 1, 0);
|
||||
gdk_draw_line (scrollbar_window, priv->hilight_gc, 0, 1, 0, 9);
|
||||
gdk_draw_line (scrollbar_window, priv->shadow_gc, size - 1, 1, size - 1, 9);
|
||||
gdk_draw_line (scrollbar_window, priv->shadow_gc, 0, 9, size - 1, 9);
|
||||
}
|
||||
}
|
||||
|
||||
position = (value - lower) / (upper - lower);
|
||||
window = gtk_widget_get_toplevel (widget);
|
||||
if (horizontal)
|
||||
{
|
||||
gtk_widget_translate_coordinates (widget, window,
|
||||
allocation.width - 20, position * allocation.height, &x, &y);
|
||||
gdk_window_move (scrollbar_window, x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_translate_coordinates (widget, window,
|
||||
position * allocation.width, allocation.height - 20, &x, &y);
|
||||
gdk_window_move (scrollbar_window, x, y);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
hide_scrollbars_timeout (gpointer data)
|
||||
{
|
||||
KatzeScrolled* scrolled = KATZE_SCROLLED (data);
|
||||
KatzeScrolledPrivate* priv = scrolled->priv;
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_window_hide (priv->vertical_scrollbar_window);
|
||||
gdk_window_hide (priv->horizontal_scrollbar_window);
|
||||
|
||||
priv->hide_scrollbars_timeout_id = 0;
|
||||
gdk_threads_leave ();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gdouble
|
||||
calculate_timeout_scroll_values (gdouble old_value,
|
||||
gdouble upper_limit,
|
||||
|
@ -485,13 +350,6 @@ do_timeout_scroll (KatzeScrolled* scrolled)
|
|||
}
|
||||
else if (new_hvalue != hvalue)
|
||||
gtk_adjustment_set_value (hadjustment, new_hvalue);
|
||||
|
||||
adjust_scrollbar (scrolled, priv->horizontal_scrollbar_window,
|
||||
gtk_scrolled_window_get_hadjustment (gtk_scrolled),
|
||||
&priv->horizontal_scrollbar_size, FALSE);
|
||||
adjust_scrollbar (scrolled, priv->vertical_scrollbar_window,
|
||||
gtk_scrolled_window_get_vadjustment (gtk_scrolled),
|
||||
&priv->vertical_scrollbar_size, TRUE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -510,10 +368,6 @@ timeout_scroll (gpointer data)
|
|||
priv->horizontal_speed > -priv->deceleration)
|
||||
{
|
||||
priv->scrolling_timeout_id = 0;
|
||||
if (!priv->hide_scrollbars_timeout_id)
|
||||
priv->hide_scrollbars_timeout_id = g_timeout_add (500,
|
||||
hide_scrollbars_timeout, scrolled);
|
||||
|
||||
ret = FALSE;
|
||||
}
|
||||
gdk_threads_leave ();
|
||||
|
@ -622,13 +476,6 @@ do_motion_scroll (KatzeScrolled* scrolled,
|
|||
priv->previous_y = y;
|
||||
priv->previous_x = x;
|
||||
priv->previous_time = timestamp;
|
||||
|
||||
adjust_scrollbar (scrolled, priv->horizontal_scrollbar_window,
|
||||
gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (scrolled)),
|
||||
&priv->horizontal_scrollbar_size, FALSE);
|
||||
adjust_scrollbar (scrolled, priv->vertical_scrollbar_window,
|
||||
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled)),
|
||||
&priv->vertical_scrollbar_size, TRUE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -681,32 +528,6 @@ button_press_event (GtkWidget* widget,
|
|||
priv->start_time = event->time;
|
||||
}
|
||||
|
||||
if (priv->scrolling_hints
|
||||
&& !gtk_widget_get_visible (gtk_scrolled_window_get_hscrollbar (
|
||||
GTK_SCROLLED_WINDOW (scrolled)))
|
||||
&& adjust_scrollbar (scrolled, priv->horizontal_scrollbar_window,
|
||||
gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (scrolled)),
|
||||
&priv->horizontal_scrollbar_size, FALSE))
|
||||
{
|
||||
gdk_window_raise (priv->horizontal_scrollbar_window);
|
||||
gdk_window_show (priv->horizontal_scrollbar_window);
|
||||
}
|
||||
if (priv->scrolling_hints
|
||||
&& !gtk_widget_get_visible (gtk_scrolled_window_get_vscrollbar (
|
||||
GTK_SCROLLED_WINDOW (scrolled)))
|
||||
&& adjust_scrollbar (scrolled, priv->vertical_scrollbar_window,
|
||||
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled)),
|
||||
&priv->vertical_scrollbar_size, TRUE))
|
||||
{
|
||||
gdk_window_raise (priv->vertical_scrollbar_window);
|
||||
gdk_window_show (priv->vertical_scrollbar_window);
|
||||
}
|
||||
if (priv->hide_scrollbars_timeout_id)
|
||||
{
|
||||
g_source_remove (priv->hide_scrollbars_timeout_id);
|
||||
priv->hide_scrollbars_timeout_id = 0;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -742,9 +563,6 @@ button_release_event (GtkWidget* widget,
|
|||
|
||||
do_timeout_scroll (scrolled);
|
||||
}
|
||||
else if (!priv->hide_scrollbars_timeout_id) {
|
||||
priv->hide_scrollbars_timeout_id = g_timeout_add (500, hide_scrollbars_timeout, scrolled);
|
||||
}
|
||||
priv->previous_x = x;
|
||||
priv->previous_y = y;
|
||||
priv->previous_time = event->time;
|
||||
|
@ -874,12 +692,10 @@ static void
|
|||
katze_scrolled_realize (GtkWidget* widget)
|
||||
{
|
||||
KatzeScrolled* scrolled = KATZE_SCROLLED (widget);
|
||||
KatzeScrolledPrivate* priv = scrolled->priv;
|
||||
gboolean drag_scrolling;
|
||||
GtkPolicyType policy;
|
||||
GdkWindow* window;
|
||||
GdkWindowAttr attr;
|
||||
GdkColor color;
|
||||
|
||||
(*GTK_WIDGET_CLASS (katze_scrolled_parent_class)->realize) (widget);
|
||||
|
||||
|
@ -896,25 +712,6 @@ katze_scrolled_realize (GtkWidget* widget)
|
|||
attr.wclass = GDK_INPUT_OUTPUT;
|
||||
attr.window_type = GDK_WINDOW_CHILD;
|
||||
attr.override_redirect = TRUE;
|
||||
priv->vertical_scrollbar_window = gdk_window_new (window, &attr, 0);
|
||||
priv->horizontal_scrollbar_window = gdk_window_new (window, &attr, 0);
|
||||
|
||||
gdk_window_set_user_data (priv->vertical_scrollbar_window, widget);
|
||||
gdk_window_set_user_data (priv->horizontal_scrollbar_window, widget);
|
||||
g_signal_connect (widget, "expose-event",
|
||||
G_CALLBACK (on_expose_event), scrolled);
|
||||
|
||||
color.red = color.green = color.blue = 0x9999;
|
||||
gdk_rgb_find_color (gtk_widget_get_colormap (widget), &color);
|
||||
gdk_window_set_background (priv->vertical_scrollbar_window, &color);
|
||||
gdk_window_set_background (priv->horizontal_scrollbar_window, &color);
|
||||
|
||||
priv->hilight_gc = gdk_gc_new (window);
|
||||
color.red = color.green = color.blue = 0xcccc;
|
||||
gdk_gc_set_rgb_fg_color (priv->hilight_gc, &color);
|
||||
priv->shadow_gc = gdk_gc_new (window);
|
||||
color.red = color.green = color.blue = 0x6666;
|
||||
gdk_gc_set_rgb_fg_color (priv->shadow_gc, &color);
|
||||
|
||||
gtk_widget_set_realized (widget, TRUE);
|
||||
}
|
||||
|
@ -930,11 +727,6 @@ katze_scrolled_dispose (GObject* object)
|
|||
g_source_remove (priv->scrolling_timeout_id);
|
||||
priv->scrolling_timeout_id = 0;
|
||||
}
|
||||
if (priv->hide_scrollbars_timeout_id)
|
||||
{
|
||||
g_source_remove (priv->hide_scrollbars_timeout_id);
|
||||
priv->hide_scrollbars_timeout_id = 0;
|
||||
}
|
||||
|
||||
(*G_OBJECT_CLASS (katze_scrolled_parent_class)->dispose) (object);
|
||||
}
|
||||
|
@ -1135,14 +927,6 @@ katze_scrolled_set_drag_scrolling (KatzeScrolled* scrolled,
|
|||
priv->previous_time = 0;
|
||||
}
|
||||
|
||||
gdk_window_hide (priv->vertical_scrollbar_window);
|
||||
gdk_window_hide (priv->horizontal_scrollbar_window);
|
||||
if (priv->hide_scrollbars_timeout_id)
|
||||
{
|
||||
g_source_remove (priv->hide_scrollbars_timeout_id);
|
||||
priv->hide_scrollbars_timeout_id = 0;
|
||||
}
|
||||
|
||||
priv->press_received = FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -855,14 +855,8 @@ static gboolean
|
|||
katze_throbber_expose_event (GtkWidget* widget,
|
||||
GdkEventExpose* event)
|
||||
{
|
||||
gint ax, ay;
|
||||
KatzeThrobber* throbber = KATZE_THROBBER (widget);
|
||||
|
||||
#if HAVE_SPINNER
|
||||
if (throbber->animated)
|
||||
return GTK_WIDGET_CLASS (katze_throbber_parent_class)->expose_event (widget, event);
|
||||
#endif
|
||||
|
||||
if (G_UNLIKELY (!throbber->width || !throbber->height))
|
||||
return TRUE;
|
||||
|
||||
|
@ -873,6 +867,9 @@ katze_throbber_expose_event (GtkWidget* widget,
|
|||
if (!throbber->animated && (throbber->static_pixbuf
|
||||
|| throbber->static_icon_name || throbber->static_stock_id))
|
||||
{
|
||||
gint ax, ay;
|
||||
cairo_t* cr;
|
||||
|
||||
if (G_UNLIKELY (!throbber->static_pixbuf && throbber->static_icon_name))
|
||||
{
|
||||
icon_theme_changed (KATZE_THROBBER (widget));
|
||||
|
@ -902,13 +899,17 @@ katze_throbber_expose_event (GtkWidget* widget,
|
|||
|
||||
katze_throbber_aligned_coords (widget, &ax, &ay);
|
||||
|
||||
gdk_draw_pixbuf (event->window, NULL, throbber->static_pixbuf,
|
||||
0, 0, ax, ay,
|
||||
throbber->width, throbber->height,
|
||||
GDK_RGB_DITHER_NONE, 0, 0);
|
||||
cr = gdk_cairo_create (gtk_widget_get_window (widget));
|
||||
gdk_cairo_set_source_pixbuf (cr, throbber->static_pixbuf, ax, ay);
|
||||
cairo_paint (cr);
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if HAVE_SPINNER
|
||||
if (throbber->animated)
|
||||
return GTK_WIDGET_CLASS (katze_throbber_parent_class)->expose_event (widget, event);
|
||||
#else
|
||||
gint cols, rows;
|
||||
|
||||
if (G_UNLIKELY (throbber->icon_name && !throbber->pixbuf))
|
||||
|
@ -969,6 +970,7 @@ katze_throbber_expose_event (GtkWidget* widget,
|
|||
g_object_notify (G_OBJECT (throbber), "pixbuf");
|
||||
g_object_thaw_notify (G_OBJECT (throbber));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
#define gtk_widget_get_allocation(wdgt, alloc) *alloc = wdgt->allocation
|
||||
#endif
|
||||
|
||||
#define I_ g_intern_static_string
|
||||
|
||||
static void
|
||||
proxy_toggle_button_toggled_cb (GtkToggleButton* button,
|
||||
GObject* object)
|
||||
|
@ -104,6 +106,8 @@ katze_app_info_get_commandline (GAppInfo* info)
|
|||
#endif
|
||||
if (!exe)
|
||||
exe = g_app_info_get_executable (info);
|
||||
if (!exe)
|
||||
exe = g_app_info_get_name (info);
|
||||
return exe;
|
||||
}
|
||||
|
||||
|
@ -470,6 +474,9 @@ g_icon_to_string (GIcon *icon)
|
|||
* "custom-PROPERTY": the last value of an enumeration will be the "custom"
|
||||
* value, where the user may enter text freely, which then updates
|
||||
* the property PROPERTY instead. This applies only to enumerations.
|
||||
* Since 0.2.9 the following hints are also supported:
|
||||
* "languages": the widget will be particularly suitable for choosing
|
||||
* multiple language codes, ie. "de,en_GB".
|
||||
*
|
||||
* Any other values for @hint are silently ignored.
|
||||
*
|
||||
|
@ -508,7 +515,7 @@ katze_property_proxy (gpointer object,
|
|||
type = G_PARAM_SPEC_TYPE (pspec);
|
||||
nick = g_param_spec_get_nick (pspec);
|
||||
_hint = g_intern_string (hint);
|
||||
if (_hint == g_intern_string ("blurb"))
|
||||
if (_hint == I_("blurb"))
|
||||
nick = g_param_spec_get_blurb (pspec);
|
||||
string = NULL;
|
||||
if (type == G_TYPE_PARAM_BOOLEAN)
|
||||
|
@ -517,7 +524,7 @@ katze_property_proxy (gpointer object,
|
|||
gboolean toggled = katze_object_get_boolean (object, property);
|
||||
|
||||
#ifdef HAVE_HILDON_2_2
|
||||
if (_hint != g_intern_string ("toggle"))
|
||||
if (_hint != I_("toggle"))
|
||||
{
|
||||
widget = hildon_check_button_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);
|
||||
gtk_button_set_label (GTK_BUTTON (widget), gettext (nick));
|
||||
|
@ -527,7 +534,7 @@ katze_property_proxy (gpointer object,
|
|||
#endif
|
||||
{
|
||||
widget = gtk_check_button_new ();
|
||||
if (_hint == g_intern_string ("toggle"))
|
||||
if (_hint == I_("toggle"))
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (widget), FALSE);
|
||||
else
|
||||
gtk_button_set_label (GTK_BUTTON (widget), gettext (nick));
|
||||
|
@ -542,7 +549,7 @@ katze_property_proxy (gpointer object,
|
|||
G_CALLBACK (proxy_widget_boolean_destroy_cb), object);
|
||||
g_free (notify_property);
|
||||
}
|
||||
else if (type == G_TYPE_PARAM_STRING && _hint == g_intern_string ("file"))
|
||||
else if (type == G_TYPE_PARAM_STRING && _hint == I_("file"))
|
||||
{
|
||||
string = katze_object_get_string (object, property);
|
||||
|
||||
|
@ -557,7 +564,7 @@ katze_property_proxy (gpointer object,
|
|||
g_signal_connect (widget, "selection-changed",
|
||||
G_CALLBACK (proxy_file_file_set_cb), object);
|
||||
}
|
||||
else if (type == G_TYPE_PARAM_STRING && _hint == g_intern_string ("folder"))
|
||||
else if (type == G_TYPE_PARAM_STRING && _hint == I_("folder"))
|
||||
{
|
||||
string = katze_object_get_string (object, property);
|
||||
|
||||
|
@ -571,7 +578,7 @@ katze_property_proxy (gpointer object,
|
|||
g_signal_connect (widget, "selection-changed",
|
||||
G_CALLBACK (proxy_folder_file_set_cb), object);
|
||||
}
|
||||
else if (type == G_TYPE_PARAM_STRING && _hint == g_intern_string ("uri"))
|
||||
else if (type == G_TYPE_PARAM_STRING && _hint == I_("uri"))
|
||||
{
|
||||
string = katze_object_get_string (object, property);
|
||||
|
||||
|
@ -590,14 +597,14 @@ katze_property_proxy (gpointer object,
|
|||
G_CALLBACK (proxy_uri_file_set_cb), object);
|
||||
#endif
|
||||
}
|
||||
else if (type == G_TYPE_PARAM_STRING && (_hint == g_intern_string ("font")
|
||||
|| _hint == g_intern_string ("font-monospace")))
|
||||
else if (type == G_TYPE_PARAM_STRING && (_hint == I_("font")
|
||||
|| _hint == I_("font-monospace")))
|
||||
{
|
||||
GtkComboBox* combo;
|
||||
gint n_families, i;
|
||||
PangoContext* context;
|
||||
PangoFontFamily** families;
|
||||
gboolean monospace = _hint == g_intern_string ("font-monospace");
|
||||
gboolean monospace = _hint == I_("font-monospace");
|
||||
string = katze_object_get_string (object, property);
|
||||
|
||||
widget = gtk_combo_box_new_text ();
|
||||
|
@ -638,6 +645,8 @@ katze_property_proxy (gpointer object,
|
|||
const gchar* app_type = &hint[12];
|
||||
GtkSettings* settings;
|
||||
gint icon_width = 16;
|
||||
GtkTreeIter iter_none;
|
||||
GAppInfo* info;
|
||||
|
||||
settings = gtk_settings_get_for_screen (gdk_screen_get_default ());
|
||||
gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU,
|
||||
|
@ -662,15 +671,13 @@ katze_property_proxy (gpointer object,
|
|||
if (!g_strcmp0 (string, ""))
|
||||
katze_assign (string, NULL);
|
||||
|
||||
if (apps)
|
||||
{
|
||||
GtkTreeIter iter_none;
|
||||
gint i = 0;
|
||||
GAppInfo* info;
|
||||
|
||||
gtk_list_store_insert_with_values (model, &iter_none, 0,
|
||||
0, NULL, 1, NULL, 2, _("None"), 3, icon_width, -1);
|
||||
|
||||
if (apps != NULL)
|
||||
{
|
||||
gint i = 0;
|
||||
|
||||
while ((info = g_list_nth_data (apps, i++)))
|
||||
{
|
||||
const gchar* name = g_app_info_get_name (info);
|
||||
|
@ -689,7 +696,10 @@ katze_property_proxy (gpointer object,
|
|||
|
||||
g_free (icon_name);
|
||||
}
|
||||
g_list_free (apps);
|
||||
}
|
||||
|
||||
{
|
||||
info = g_app_info_create_from_commandline ("",
|
||||
"", G_APP_INFO_CREATE_NONE, NULL);
|
||||
gtk_list_store_insert_with_values (model, NULL, G_MAXINT,
|
||||
|
@ -724,7 +734,6 @@ katze_property_proxy (gpointer object,
|
|||
gtk_combo_box_set_active_iter (combo, &iter_none);
|
||||
}
|
||||
}
|
||||
g_list_free (apps);
|
||||
g_signal_connect (widget, "changed",
|
||||
G_CALLBACK (proxy_combo_box_apps_changed_cb), object);
|
||||
}
|
||||
|
@ -736,6 +745,17 @@ katze_property_proxy (gpointer object,
|
|||
g_object_get (object, property, &string, NULL);
|
||||
if (!string)
|
||||
string = g_strdup (G_PARAM_SPEC_STRING (pspec)->default_value);
|
||||
if (!(string && *string) && _hint == I_("languages"))
|
||||
{
|
||||
gchar* lang = g_strjoinv (",", (gchar**)g_get_language_names ());
|
||||
if (g_str_has_suffix (lang, ",C"))
|
||||
{
|
||||
string = g_strndup (lang, strlen (lang) - 2);
|
||||
g_free (lang);
|
||||
}
|
||||
else
|
||||
string = lang;
|
||||
}
|
||||
gtk_entry_set_text (GTK_ENTRY (widget), string ? string : "");
|
||||
g_signal_connect (widget, "activate",
|
||||
G_CALLBACK (proxy_entry_activate_cb), object);
|
||||
|
|
|
@ -45,6 +45,7 @@ G_BEGIN_DECLS
|
|||
gtk_icon_entry_set_icon_from_pixbuf (GtkEntry* entry,
|
||||
GtkEntryIconPosition position,
|
||||
GdkPixbuf* pixbuf);
|
||||
#define gtk_icon_entry_set_tooltip gtk_entry_set_icon_tooltip_text
|
||||
#define gtk_icon_entry_set_icon_highlight gtk_entry_set_icon_activatable
|
||||
#define gtk_icon_entry_set_progress_fraction gtk_entry_set_progress_fraction
|
||||
#else
|
||||
|
|
392
midori/main.c
392
midori/main.c
|
@ -17,7 +17,6 @@
|
|||
#include "midori.h"
|
||||
#include "midori-array.h"
|
||||
#include "midori-bookmarks.h"
|
||||
#include "midori-console.h"
|
||||
#include "midori-extensions.h"
|
||||
#include "midori-history.h"
|
||||
#include "midori-transfers.h"
|
||||
|
@ -60,19 +59,15 @@
|
|||
static gchar*
|
||||
build_config_filename (const gchar* filename)
|
||||
{
|
||||
const gchar* path;
|
||||
|
||||
if (g_path_is_absolute (filename))
|
||||
return g_strdup (filename);
|
||||
path = sokoke_set_config_dir (NULL);
|
||||
return g_build_filename (path, filename, NULL);
|
||||
return g_build_filename (sokoke_set_config_dir (NULL), filename, NULL);
|
||||
}
|
||||
|
||||
static MidoriWebSettings*
|
||||
settings_new_from_file (const gchar* filename,
|
||||
settings_and_accels_new (const gchar* config,
|
||||
gchar*** extensions)
|
||||
{
|
||||
MidoriWebSettings* settings = midori_web_settings_new ();
|
||||
gchar* config_file = g_build_filename (config, "config", NULL);
|
||||
GKeyFile* key_file = g_key_file_new ();
|
||||
GError* error = NULL;
|
||||
GObjectClass* class;
|
||||
|
@ -86,12 +81,12 @@ settings_new_from_file (const gchar* filename,
|
|||
gfloat number;
|
||||
gboolean boolean;
|
||||
|
||||
if (!g_key_file_load_from_file (key_file, filename,
|
||||
if (!g_key_file_load_from_file (key_file, config_file,
|
||||
G_KEY_FILE_KEEP_COMMENTS, &error))
|
||||
{
|
||||
if (error->code == G_FILE_ERROR_NOENT)
|
||||
{
|
||||
gchar* 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_KEEP_COMMENTS, NULL);
|
||||
}
|
||||
|
@ -160,6 +155,13 @@ settings_new_from_file (const gchar* filename,
|
|||
|
||||
g_key_file_free (key_file);
|
||||
|
||||
/* Load accelerators */
|
||||
katze_assign (config_file, g_build_filename (config, "accels", NULL));
|
||||
if (g_access (config_file, F_OK) != 0)
|
||||
katze_assign (config_file, sokoke_find_config_filename (NULL, "accels"));
|
||||
gtk_accel_map_load (config_file);
|
||||
g_free (config_file);
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
|
@ -308,6 +310,49 @@ search_engines_new_from_file (const gchar* filename,
|
|||
return search_engines;
|
||||
}
|
||||
|
||||
static KatzeArray*
|
||||
search_engines_new_from_folder (const gchar* config,
|
||||
GString* error_messages)
|
||||
{
|
||||
gchar* config_file = g_build_filename (config, "search", NULL);
|
||||
GError* error = NULL;
|
||||
KatzeArray* search_engines;
|
||||
|
||||
search_engines = search_engines_new_from_file (config_file, &error);
|
||||
/* We ignore for instance empty files */
|
||||
if (error && (error->code == G_KEY_FILE_ERROR_PARSE
|
||||
|| error->code == G_FILE_ERROR_NOENT))
|
||||
{
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
}
|
||||
if (!error && katze_array_is_empty (search_engines))
|
||||
{
|
||||
g_object_unref (search_engines);
|
||||
#ifdef G_OS_WIN32
|
||||
gchar* dir = g_win32_get_package_installation_directory_of_module (NULL);
|
||||
katze_assign (config_file,
|
||||
g_build_filename (dir, "etc", "xdg", PACKAGE_NAME, "search", NULL));
|
||||
g_free (dir);
|
||||
search_engines = search_engines_new_from_file (config_file, NULL);
|
||||
#else
|
||||
katze_assign (config_file,
|
||||
sokoke_find_config_filename (NULL, "search"));
|
||||
search_engines = search_engines_new_from_file (config_file, NULL);
|
||||
#endif
|
||||
}
|
||||
else if (error)
|
||||
{
|
||||
if (error->code != G_FILE_ERROR_NOENT && error_messages)
|
||||
g_string_append_printf (error_messages,
|
||||
_("The search engines couldn't be loaded. %s\n"),
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_free (config_file);
|
||||
return search_engines;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
search_engines_save_to_file (KatzeArray* search_engines,
|
||||
const gchar* filename,
|
||||
|
@ -369,6 +414,12 @@ midori_history_initialize (KatzeArray* array,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
sqlite3_exec (db, "PRAGMA journal_mode = TRUNCATE;", NULL, NULL, errmsg);
|
||||
if (*errmsg)
|
||||
{
|
||||
g_warning ("Failed to set journal mode: %s", *errmsg);
|
||||
sqlite3_free (*errmsg);
|
||||
}
|
||||
if (sqlite3_exec (db,
|
||||
"CREATE TABLE IF NOT EXISTS "
|
||||
"history (uri text, title text, date integer, day integer);"
|
||||
|
@ -515,11 +566,8 @@ settings_notify_cb (MidoriWebSettings* settings,
|
|||
GParamSpec* pspec,
|
||||
MidoriApp* app)
|
||||
{
|
||||
gchar* config_file;
|
||||
GError* error;
|
||||
|
||||
config_file = build_config_filename ("config");
|
||||
error = NULL;
|
||||
gchar* config_file = build_config_filename ("config");
|
||||
GError* error = NULL;
|
||||
if (!settings_save_to_file (settings, app, config_file, &error))
|
||||
{
|
||||
g_warning (_("The configuration couldn't be saved. %s"), error->message);
|
||||
|
@ -553,11 +601,8 @@ midori_search_engines_modify_cb (KatzeArray* array,
|
|||
gpointer item,
|
||||
KatzeArray* search_engines)
|
||||
{
|
||||
gchar* config_file;
|
||||
GError* error;
|
||||
|
||||
config_file = build_config_filename ("search");
|
||||
error = NULL;
|
||||
gchar* config_file = build_config_filename ("search");
|
||||
GError* error = NULL;
|
||||
if (!search_engines_save_to_file (search_engines, config_file, &error))
|
||||
{
|
||||
g_warning (_("The search engines couldn't be saved. %s"),
|
||||
|
@ -571,12 +616,9 @@ static void
|
|||
midori_trash_add_item_cb (KatzeArray* trash,
|
||||
GObject* item)
|
||||
{
|
||||
gchar* config_file;
|
||||
GError* error;
|
||||
gchar* config_file = build_config_filename ("tabtrash.xbel");
|
||||
GError* error = NULL;
|
||||
GObject* obsolete_item;
|
||||
|
||||
config_file = build_config_filename ("tabtrash.xbel");
|
||||
error = NULL;
|
||||
if (!midori_array_to_file (trash, config_file, "xbel", &error))
|
||||
{
|
||||
/* i18n: Trash, or wastebin, containing closed tabs */
|
||||
|
@ -596,11 +638,8 @@ static void
|
|||
midori_trash_remove_item_cb (KatzeArray* trash,
|
||||
GObject* item)
|
||||
{
|
||||
gchar* config_file;
|
||||
GError* error;
|
||||
|
||||
config_file = build_config_filename ("tabtrash.xbel");
|
||||
error = NULL;
|
||||
gchar* config_file = build_config_filename ("tabtrash.xbel");
|
||||
GError* error = NULL;
|
||||
if (!midori_array_to_file (trash, config_file, "xbel", &error))
|
||||
{
|
||||
g_warning (_("The trash couldn't be saved. %s"), error->message);
|
||||
|
@ -636,11 +675,6 @@ midori_app_add_browser_cb (MidoriApp* app,
|
|||
midori_panel_append_page (MIDORI_PANEL (panel), MIDORI_VIEWABLE (addon));
|
||||
#endif
|
||||
|
||||
/* Console */
|
||||
addon = g_object_new (MIDORI_TYPE_CONSOLE, "app", app, NULL);
|
||||
gtk_widget_show (addon);
|
||||
midori_panel_append_page (MIDORI_PANEL (panel), MIDORI_VIEWABLE (addon));
|
||||
|
||||
/* Extensions */
|
||||
addon = g_object_new (MIDORI_TYPE_EXTENSIONS, NULL);
|
||||
gtk_widget_show (addon);
|
||||
|
@ -655,11 +689,8 @@ static guint save_timeout = 0;
|
|||
static gboolean
|
||||
midori_session_save_timeout_cb (KatzeArray* session)
|
||||
{
|
||||
gchar* config_file;
|
||||
GError* error;
|
||||
|
||||
config_file = build_config_filename ("session.xbel");
|
||||
error = NULL;
|
||||
gchar* config_file = build_config_filename ("session.xbel");
|
||||
GError* error = NULL;
|
||||
if (!midori_array_to_file (session, config_file, "xbel", &error))
|
||||
{
|
||||
g_warning (_("The session couldn't be saved. %s"), error->message);
|
||||
|
@ -681,8 +712,8 @@ midori_browser_session_cb (MidoriBrowser* browser,
|
|||
if (!save_timeout)
|
||||
{
|
||||
g_object_ref (session);
|
||||
save_timeout = g_timeout_add_full (G_PRIORITY_LOW, 5000,
|
||||
(GSourceFunc)midori_session_save_timeout_cb, session, NULL);
|
||||
save_timeout = g_timeout_add_seconds (5,
|
||||
(GSourceFunc)midori_session_save_timeout_cb, session);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -895,11 +926,8 @@ static void
|
|||
button_reset_session_clicked_cb (GtkWidget* button,
|
||||
KatzeArray* session)
|
||||
{
|
||||
gchar* config_file;
|
||||
GError* error;
|
||||
|
||||
config_file = build_config_filename ("session.old.xbel");
|
||||
error = NULL;
|
||||
gchar* config_file = build_config_filename ("session.old.xbel");
|
||||
GError* error = NULL;
|
||||
if (!midori_array_to_file (session, config_file, "xbel", &error))
|
||||
{
|
||||
g_warning (_("The session couldn't be saved. %s"), error->message);
|
||||
|
@ -923,6 +951,7 @@ midori_create_diagnostic_dialog (MidoriWebSettings* settings,
|
|||
KatzeArray* _session)
|
||||
{
|
||||
GtkWidget* dialog;
|
||||
GtkWidget* content_area;
|
||||
GdkScreen* screen;
|
||||
GtkIconTheme* icon_theme;
|
||||
GtkWidget* box;
|
||||
|
@ -941,6 +970,7 @@ midori_create_diagnostic_dialog (MidoriWebSettings* settings,
|
|||
"to solve the problem."));
|
||||
gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), FALSE);
|
||||
gtk_window_set_title (GTK_WINDOW (dialog), g_get_application_name ());
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
||||
screen = gtk_widget_get_screen (dialog);
|
||||
if (screen)
|
||||
{
|
||||
|
@ -968,7 +998,7 @@ midori_create_diagnostic_dialog (MidoriWebSettings* settings,
|
|||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 4);
|
||||
gtk_widget_show_all (box);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), box);
|
||||
gtk_container_add (GTK_CONTAINER (content_area), box);
|
||||
#ifdef HAVE_HILDON_2_2
|
||||
box = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), box, TRUE, FALSE, 4);
|
||||
|
@ -984,14 +1014,12 @@ midori_create_diagnostic_dialog (MidoriWebSettings* settings,
|
|||
{
|
||||
/* GtkLabel can't wrap the text properly. Until some day
|
||||
this works, we implement this hack to do it ourselves. */
|
||||
GtkWidget* content_area;
|
||||
GtkWidget* hbox;
|
||||
GtkWidget* vbox;
|
||||
GtkWidget* label;
|
||||
GList* ch;
|
||||
GtkRequisition req;
|
||||
|
||||
content_area = GTK_DIALOG (dialog)->vbox;
|
||||
ch = gtk_container_get_children (GTK_CONTAINER (content_area));
|
||||
hbox = (GtkWidget*)g_list_nth_data (ch, 0);
|
||||
g_list_free (ch);
|
||||
|
@ -1010,14 +1038,10 @@ midori_create_diagnostic_dialog (MidoriWebSettings* settings,
|
|||
static gboolean
|
||||
midori_load_cookie_jar (gpointer data)
|
||||
{
|
||||
MidoriWebSettings* settings = MIDORI_WEB_SETTINGS (data);
|
||||
SoupSession* webkit_session;
|
||||
SoupCookieJar* jar;
|
||||
|
||||
webkit_session = webkit_get_default_session ();
|
||||
jar = soup_cookie_jar_new ();
|
||||
g_object_set_data (G_OBJECT (jar), "midori-settings", settings);
|
||||
midori_soup_session_prepare (webkit_session, jar, settings);
|
||||
SoupSession* session = webkit_get_default_session ();
|
||||
SoupCookieJar* jar = soup_cookie_jar_new ();
|
||||
g_object_set_data (G_OBJECT (jar), "midori-settings", data);
|
||||
midori_soup_session_prepare (session, jar, MIDORI_WEB_SETTINGS (data));
|
||||
g_object_unref (jar);
|
||||
|
||||
return FALSE;
|
||||
|
@ -1489,12 +1513,22 @@ midori_inactivity_timeout (gpointer data)
|
|||
{
|
||||
guint i = 0;
|
||||
GtkWidget* view;
|
||||
KatzeArray* history = katze_object_get_object (mit->browser, "history");
|
||||
sqlite3* db;
|
||||
KatzeArray* trash = katze_object_get_object (mit->browser, "trash");
|
||||
GList* data_items = sokoke_register_privacy_item (NULL, NULL, NULL);
|
||||
|
||||
while ((view = midori_browser_get_nth_tab (mit->browser, i++)))
|
||||
gtk_widget_destroy (view);
|
||||
midori_browser_set_current_uri (mit->browser, mit->uri);
|
||||
/* TODO: Re-run initial commands */
|
||||
|
||||
/* Clear all private data */
|
||||
if (history && (db = g_object_get_data (G_OBJECT (history), "db")))
|
||||
sqlite3_exec (db, "DELETE FROM history; DELETE FROM search",
|
||||
NULL, NULL, NULL);
|
||||
if (trash != NULL)
|
||||
katze_array_clear (trash);
|
||||
for (; data_items != NULL; data_items = g_list_next (data_items))
|
||||
((SokokePrivacyItem*)(data_items->data))->clear ();
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@ -1520,6 +1554,59 @@ midori_setup_inactivity_reset (MidoriBrowser* browser,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
midori_clear_page_icons_cb (void)
|
||||
{
|
||||
gchar* cache = g_build_filename (g_get_user_cache_dir (),
|
||||
PACKAGE_NAME, "icons", NULL);
|
||||
sokoke_remove_path (cache, TRUE);
|
||||
g_free (cache);
|
||||
cache = g_build_filename (g_get_user_data_dir (),
|
||||
"webkit", "icondatabase", NULL);
|
||||
sokoke_remove_path (cache, TRUE);
|
||||
g_free (cache);
|
||||
}
|
||||
|
||||
static void
|
||||
midori_clear_web_cookies_cb (void)
|
||||
{
|
||||
SoupSession* session = webkit_get_default_session ();
|
||||
SoupSessionFeature* jar = soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR);
|
||||
GSList* cookies = soup_cookie_jar_all_cookies (SOUP_COOKIE_JAR (jar));
|
||||
for (; cookies != NULL; cookies = g_slist_next (cookies))
|
||||
{
|
||||
SoupCookie* cookie = cookies->data;
|
||||
soup_cookie_set_max_age (cookie, 0);
|
||||
soup_cookie_free (cookie);
|
||||
}
|
||||
g_slist_free (cookies);
|
||||
/* Removing KatzeHttpCookies makes it save outstanding changes */
|
||||
if (soup_session_get_feature (session, KATZE_TYPE_HTTP_COOKIES))
|
||||
{
|
||||
soup_session_remove_feature_by_type (session, KATZE_TYPE_HTTP_COOKIES);
|
||||
soup_session_add_feature_by_type (session, KATZE_TYPE_HTTP_COOKIES);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
static void
|
||||
midori_clear_flash_cookies_cb (void)
|
||||
{
|
||||
gchar* cache = g_build_filename (g_get_home_dir (), ".macromedia",
|
||||
"Flash_Player", NULL);
|
||||
sokoke_remove_path (cache, TRUE);
|
||||
g_free (cache);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 14)
|
||||
static void
|
||||
midori_clear_html5_databases_cb (void)
|
||||
{
|
||||
webkit_remove_all_web_databases ();
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char** argv)
|
||||
|
@ -1531,6 +1618,7 @@ main (int argc,
|
|||
gboolean run;
|
||||
gchar* snapshot;
|
||||
gboolean execute;
|
||||
gboolean help_execute;
|
||||
gboolean version;
|
||||
gchar** uris;
|
||||
gchar* block_uris;
|
||||
|
@ -1556,6 +1644,8 @@ main (int argc,
|
|||
#endif
|
||||
{ "execute", 'e', 0, G_OPTION_ARG_NONE, &execute,
|
||||
N_("Execute the specified command"), NULL },
|
||||
{ "help-execute", 0, 0, G_OPTION_ARG_NONE, &help_execute,
|
||||
N_("List available commands to execute with -e/ --execute"), NULL },
|
||||
{ "version", 'V', 0, G_OPTION_ARG_NONE, &version,
|
||||
N_("Display program version"), NULL },
|
||||
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &uris,
|
||||
|
@ -1640,6 +1730,7 @@ main (int argc,
|
|||
run = FALSE;
|
||||
snapshot = NULL;
|
||||
execute = FALSE;
|
||||
help_execute = FALSE;
|
||||
version = FALSE;
|
||||
uris = NULL;
|
||||
block_uris = NULL;
|
||||
|
@ -1680,6 +1771,29 @@ main (int argc,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (help_execute)
|
||||
{
|
||||
MidoriBrowser* browser = midori_browser_new ();
|
||||
GtkActionGroup* action_group = midori_browser_get_action_group (browser);
|
||||
GList* actions = gtk_action_group_list_actions (action_group);
|
||||
for (; actions; actions = g_list_next (actions))
|
||||
{
|
||||
GtkAction* action = actions->data;
|
||||
const gchar* name = gtk_action_get_name (action);
|
||||
const gchar* space = " ";
|
||||
gchar* padding = g_strndup (space, strlen (space) - strlen (name));
|
||||
gchar* label = katze_strip_mnemonics (gtk_action_get_label (action));
|
||||
const gchar* tooltip = gtk_action_get_tooltip (action);
|
||||
g_print ("%s%s%s%s%s\n", name, padding, label,
|
||||
tooltip ? ": " : "", tooltip ? tooltip : "");
|
||||
g_free (padding);
|
||||
g_free (label);
|
||||
}
|
||||
g_list_free (actions);
|
||||
gtk_widget_destroy (GTK_WIDGET (browser));
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 6)
|
||||
if (snapshot)
|
||||
{
|
||||
|
@ -1713,42 +1827,51 @@ main (int argc,
|
|||
}
|
||||
#endif
|
||||
|
||||
sokoke_register_privacy_item ("page-icons", _("Website icons"),
|
||||
G_CALLBACK (midori_clear_page_icons_cb));
|
||||
sokoke_register_privacy_item ("web-cookies", _("Cookies"),
|
||||
G_CALLBACK (midori_clear_web_cookies_cb));
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
sokoke_register_privacy_item ("flash-cookies", _("'Flash' Cookies"),
|
||||
G_CALLBACK (midori_clear_flash_cookies_cb));
|
||||
#endif
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 14)
|
||||
sokoke_register_privacy_item ("html5-databases", _("HTML5 _Databases"),
|
||||
G_CALLBACK (midori_clear_html5_databases_cb));
|
||||
#endif
|
||||
|
||||
/* Web Application support */
|
||||
if (webapp)
|
||||
{
|
||||
SoupSession* session = webkit_get_default_session ();
|
||||
MidoriBrowser* browser = midori_browser_new ();
|
||||
gchar* tmp_uri = midori_prepare_uri (webapp);
|
||||
katze_assign (webapp, tmp_uri);
|
||||
midori_startup_timer ("Browser: \t%f");
|
||||
if (config)
|
||||
{
|
||||
SoupSession* session;
|
||||
SoupCookieJar* jar;
|
||||
|
||||
config_file = g_build_filename (config, "config", NULL);
|
||||
settings = settings_new_from_file (config_file, &extensions);
|
||||
g_free (config_file);
|
||||
settings = settings_and_accels_new (config, &extensions);
|
||||
g_strfreev (extensions);
|
||||
|
||||
session = webkit_get_default_session ();
|
||||
config_file = g_build_filename (config, "cookies.txt", NULL);
|
||||
jar = soup_cookie_jar_text_new (config_file, TRUE);
|
||||
g_free (config_file);
|
||||
soup_session_add_feature (session, SOUP_SESSION_FEATURE (jar));
|
||||
g_object_unref (jar);
|
||||
|
||||
search_engines = search_engines_new_from_folder (config, NULL);
|
||||
g_object_set (browser, "search-engines", search_engines, NULL);
|
||||
g_object_unref (search_engines);
|
||||
}
|
||||
else
|
||||
{
|
||||
settings = katze_object_get_object (browser, "settings");
|
||||
g_object_set (settings,
|
||||
"show-menubar", FALSE,
|
||||
"show-navigationbar", TRUE,
|
||||
"show-panel", FALSE,
|
||||
"toolbar-items", "Back,Forward,ReloadStop,Location",
|
||||
"homepage", NULL,
|
||||
"show-navigationbar", FALSE,
|
||||
"toolbar-items", "Back,Forward,ReloadStop,Location,Homepage",
|
||||
"homepage", webapp,
|
||||
"show-statusbar", FALSE,
|
||||
"enable-developer-extras", FALSE,
|
||||
NULL);
|
||||
midori_browser_set_action_visible (browser, "Menubar", FALSE);
|
||||
}
|
||||
g_object_set (settings, "show-panel", FALSE, NULL);
|
||||
midori_browser_set_action_visible (browser, "Tools", FALSE);
|
||||
midori_browser_set_action_visible (browser, "Panel", FALSE);
|
||||
g_object_set (browser, "settings", settings, NULL);
|
||||
midori_startup_timer ("Setup config: \t%f");
|
||||
g_object_unref (settings);
|
||||
|
@ -1756,7 +1879,6 @@ main (int argc,
|
|||
g_signal_connect (browser, "notify::load-status",
|
||||
G_CALLBACK (midori_web_app_browser_notify_load_status_cb), NULL);
|
||||
midori_browser_add_uri (browser, webapp);
|
||||
g_object_set_data (G_OBJECT (browser), "locked", (void*)1);
|
||||
g_signal_connect (browser, "quit",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
g_signal_connect (browser, "destroy",
|
||||
|
@ -1765,15 +1887,11 @@ main (int argc,
|
|||
midori_browser_activate_action (browser, "Location");
|
||||
if (execute)
|
||||
{
|
||||
i = 0;
|
||||
while (uris[i] != NULL)
|
||||
{
|
||||
for (i = 0; uris[i] != NULL; i++)
|
||||
midori_browser_activate_action (browser, uris[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (block_uris)
|
||||
g_signal_connect (webkit_get_default_session (), "request-queued",
|
||||
g_signal_connect (session, "request-queued",
|
||||
G_CALLBACK (midori_soup_session_block_uris_cb),
|
||||
g_strdup (block_uris));
|
||||
midori_setup_inactivity_reset (browser, inactivity_reset, webapp);
|
||||
|
@ -1808,7 +1926,7 @@ main (int argc,
|
|||
}
|
||||
else
|
||||
app = midori_app_new ();
|
||||
g_free (config);
|
||||
katze_assign (config, (gchar*)sokoke_set_config_dir (NULL));
|
||||
midori_startup_timer ("App created: \t%f");
|
||||
|
||||
/* FIXME: The app might be 'running' but actually showing a dialog
|
||||
|
@ -1847,58 +1965,19 @@ main (int argc,
|
|||
return 1;
|
||||
}
|
||||
|
||||
katze_mkdir_with_parents (sokoke_set_config_dir (NULL), 0700);
|
||||
|
||||
katze_mkdir_with_parents (config, 0700);
|
||||
/* Load configuration file */
|
||||
error_messages = g_string_new (NULL);
|
||||
config_file = build_config_filename ("config");
|
||||
error = NULL;
|
||||
settings = settings_new_from_file (config_file, &extensions);
|
||||
settings = settings_and_accels_new (config, &extensions);
|
||||
g_object_set (settings, "enable-developer-extras", TRUE, NULL);
|
||||
midori_startup_timer ("Config read: \t%f");
|
||||
|
||||
/* Load accelerators */
|
||||
katze_assign (config_file, build_config_filename ("accels"));
|
||||
if (g_access (config_file, F_OK) != 0)
|
||||
katze_assign (config_file, sokoke_find_config_filename (NULL, "accels"));
|
||||
gtk_accel_map_load (config_file);
|
||||
midori_startup_timer ("Accels read: \t%f");
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 14)
|
||||
g_object_set (settings, "enable-html5-database", TRUE, NULL);
|
||||
#endif
|
||||
midori_startup_timer ("Config and accels read: \t%f");
|
||||
|
||||
/* Load search engines */
|
||||
katze_assign (config_file, build_config_filename ("search"));
|
||||
error = NULL;
|
||||
search_engines = search_engines_new_from_file (config_file, &error);
|
||||
/* We ignore for instance empty files */
|
||||
if (error && (error->code == G_KEY_FILE_ERROR_PARSE
|
||||
|| error->code == G_FILE_ERROR_NOENT))
|
||||
{
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
}
|
||||
if (!error && katze_array_is_empty (search_engines))
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
gchar* dir;
|
||||
|
||||
dir = g_win32_get_package_installation_directory_of_module (NULL);
|
||||
katze_assign (config_file,
|
||||
g_build_filename (dir, "etc", "xdg", PACKAGE_NAME, "search", NULL));
|
||||
g_free (dir);
|
||||
search_engines = search_engines_new_from_file (config_file, NULL);
|
||||
#else
|
||||
katze_assign (config_file,
|
||||
sokoke_find_config_filename (NULL, "search"));
|
||||
search_engines = search_engines_new_from_file (config_file, NULL);
|
||||
#endif
|
||||
}
|
||||
else if (error)
|
||||
{
|
||||
if (error->code != G_FILE_ERROR_NOENT)
|
||||
g_string_append_printf (error_messages,
|
||||
_("The search engines couldn't be loaded. %s\n"),
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
search_engines = search_engines_new_from_folder (config, error_messages);
|
||||
/* Pick first search engine as default if not set */
|
||||
g_object_get (settings, "location-entry-search", &uri, NULL);
|
||||
if (!(uri && *uri) && !katze_array_is_empty (search_engines))
|
||||
|
@ -1911,7 +1990,7 @@ main (int argc,
|
|||
midori_startup_timer ("Search read: \t%f");
|
||||
|
||||
bookmarks = katze_array_new (KATZE_TYPE_ARRAY);
|
||||
bookmarks_file = build_config_filename ("bookmarks.db");
|
||||
bookmarks_file = g_build_filename (config, "bookmarks.db", NULL);
|
||||
errmsg = NULL;
|
||||
if ((db = midori_bookmarks_initialize (bookmarks, bookmarks_file, &errmsg)) == NULL)
|
||||
{
|
||||
|
@ -1921,7 +2000,11 @@ main (int argc,
|
|||
}
|
||||
else
|
||||
{
|
||||
gchar* old_bookmarks = build_config_filename (BOOKMARK_FILE);
|
||||
gchar* old_bookmarks;
|
||||
if (g_path_is_absolute (BOOKMARK_FILE))
|
||||
old_bookmarks = g_strdup (BOOKMARK_FILE);
|
||||
else
|
||||
old_bookmarks = g_build_filename (config, BOOKMARK_FILE, NULL);
|
||||
if (g_access (old_bookmarks, F_OK) == 0)
|
||||
{
|
||||
midori_bookmarks_import (old_bookmarks, db);
|
||||
|
@ -1932,6 +2015,7 @@ main (int argc,
|
|||
}
|
||||
midori_startup_timer ("Bookmarks read: \t%f");
|
||||
|
||||
config_file = NULL;
|
||||
_session = katze_array_new (KATZE_TYPE_ITEM);
|
||||
#if HAVE_LIBXML
|
||||
g_object_get (settings, "load-on-startup", &load_on_startup, NULL);
|
||||
|
@ -1952,7 +2036,7 @@ main (int argc,
|
|||
|
||||
trash = katze_array_new (KATZE_TYPE_ITEM);
|
||||
#if HAVE_LIBXML
|
||||
katze_assign (config_file, build_config_filename ("tabtrash.xbel"));
|
||||
katze_assign (config_file, g_build_filename (config, "tabtrash.xbel", NULL));
|
||||
error = NULL;
|
||||
if (!midori_array_from_file (trash, config_file, "xbel", &error))
|
||||
{
|
||||
|
@ -1965,7 +2049,7 @@ main (int argc,
|
|||
|
||||
midori_startup_timer ("Trash read: \t%f");
|
||||
history = katze_array_new (KATZE_TYPE_ARRAY);
|
||||
katze_assign (config_file, build_config_filename ("history.db"));
|
||||
katze_assign (config_file, g_build_filename (config, "history.db", NULL));
|
||||
|
||||
errmsg = NULL;
|
||||
if ((db = midori_history_initialize (history, config_file, bookmarks_file ,&errmsg)) == NULL)
|
||||
|
@ -2064,7 +2148,7 @@ main (int argc,
|
|||
g_object_set_data (G_OBJECT (app), "extensions", extensions);
|
||||
/* We test for the presence of a dummy file which is created once
|
||||
and deleted during normal runtime, but persists in case of a crash. */
|
||||
katze_assign (config_file, build_config_filename ("running"));
|
||||
katze_assign (config_file, g_build_filename (config, "running", NULL));
|
||||
if (g_access (config_file, F_OK) == 0)
|
||||
back_from_crash = TRUE;
|
||||
else
|
||||
|
@ -2120,41 +2204,33 @@ main (int argc,
|
|||
settings = katze_object_get_object (app, "settings");
|
||||
g_object_get (settings, "maximum-history-age", &max_history_age, NULL);
|
||||
midori_history_terminate (db, max_history_age);
|
||||
/* Removing KatzeHttpCookies makes it save outstanding changes */
|
||||
soup_session_remove_feature_by_type (webkit_get_default_session (),
|
||||
KATZE_TYPE_HTTP_COOKIES);
|
||||
|
||||
/* Clear data on quit, according to the Clear private data dialog */
|
||||
g_object_get (settings, "clear-private-data", &clear_prefs, NULL);
|
||||
if (clear_prefs & MIDORI_CLEAR_ON_QUIT)
|
||||
{
|
||||
GList* data_items = sokoke_register_privacy_item (NULL, NULL, NULL);
|
||||
gchar* clear_data = katze_object_get_string (settings, "clear-data");
|
||||
|
||||
midori_remove_config_file (clear_prefs, MIDORI_CLEAR_HISTORY, "history.db");
|
||||
midori_remove_config_file (clear_prefs, MIDORI_CLEAR_COOKIES, "cookies.txt");
|
||||
if ((clear_prefs & MIDORI_CLEAR_FLASH_COOKIES) == MIDORI_CLEAR_FLASH_COOKIES)
|
||||
{
|
||||
gchar* cache = g_build_filename (g_get_home_dir (), ".macromedia",
|
||||
"Flash_Player", NULL);
|
||||
sokoke_remove_path (cache, TRUE);
|
||||
g_free (cache);
|
||||
}
|
||||
if ((clear_prefs & MIDORI_CLEAR_WEBSITE_ICONS) == MIDORI_CLEAR_WEBSITE_ICONS)
|
||||
{
|
||||
gchar* cache = g_build_filename (g_get_user_cache_dir (),
|
||||
PACKAGE_NAME, "icons", NULL);
|
||||
sokoke_remove_path (cache, TRUE);
|
||||
g_free (cache);
|
||||
}
|
||||
midori_remove_config_file (clear_prefs, MIDORI_CLEAR_TRASH, "tabtrash.xbel");
|
||||
if ((clear_prefs & MIDORI_CLEAR_WEB_CACHE) == MIDORI_CLEAR_WEB_CACHE)
|
||||
|
||||
for (; data_items != NULL; data_items = g_list_next (data_items))
|
||||
{
|
||||
gchar* cache = g_build_filename (g_get_user_cache_dir (),
|
||||
PACKAGE_NAME, "web", NULL);
|
||||
sokoke_remove_path (cache, TRUE);
|
||||
g_free (cache);
|
||||
SokokePrivacyItem* privacy = data_items->data;
|
||||
if (clear_data && strstr (clear_data, privacy->name))
|
||||
privacy->clear ();
|
||||
}
|
||||
g_free (clear_data);
|
||||
}
|
||||
|
||||
if (katze_object_get_int (settings, "load-on-startup")
|
||||
< MIDORI_STARTUP_LAST_OPEN_PAGES)
|
||||
{
|
||||
katze_assign (config_file, build_config_filename ("session.xbel"));
|
||||
katze_assign (config_file, g_build_filename (config, "session.xbel", NULL));
|
||||
g_unlink (config_file);
|
||||
}
|
||||
|
||||
|
|
|
@ -535,7 +535,7 @@ midori_app_osso_rpc_handler_cb (const gchar* interface,
|
|||
#elif HAVE_UNIQUE
|
||||
static UniqueResponse
|
||||
midori_browser_message_received_cb (UniqueApp* instance,
|
||||
UniqueCommand command,
|
||||
gint command,
|
||||
UniqueMessageData* message,
|
||||
guint timestamp,
|
||||
MidoriApp* app)
|
||||
|
@ -1199,21 +1199,18 @@ midori_app_send_notification (MidoriApp* app,
|
|||
#if HAVE_HILDON
|
||||
hildon_banner_show_information_with_markup (GTK_WIDGET (app->browser),
|
||||
"midori", message);
|
||||
#else
|
||||
gboolean sent = FALSE;
|
||||
|
||||
#if HAVE_LIBNOTIFY
|
||||
#elif HAVE_LIBNOTIFY
|
||||
if (notify_is_initted ())
|
||||
{
|
||||
NotifyNotification* note;
|
||||
|
||||
note = notify_notification_new (title, message, "midori", NULL);
|
||||
sent = notify_notification_show (note, NULL);
|
||||
notify_notification_show (note, NULL);
|
||||
g_object_unref (note);
|
||||
}
|
||||
#else
|
||||
/* Fall back to the command line program "notify-send" */
|
||||
if (!sent && app->program_notify_send)
|
||||
if (app->program_notify_send)
|
||||
{
|
||||
gchar* msgq = g_shell_quote (message);
|
||||
gchar* titleq = g_shell_quote (title);
|
||||
|
@ -1227,5 +1224,4 @@ midori_app_send_notification (MidoriApp* app,
|
|||
g_free (command);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -945,7 +945,8 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
|
|||
}
|
||||
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_toolbar)))
|
||||
if (!gtk_widget_get_visible (browser->bookmarkbar))
|
||||
if (!gtk_widget_get_visible (browser->bookmarkbar)
|
||||
&& browser->bookmarks != NULL)
|
||||
_action_set_active (browser, "Bookmarkbar", TRUE);
|
||||
g_free (selected);
|
||||
return_status = TRUE;
|
||||
|
@ -971,22 +972,42 @@ midori_browser_prepare_download (MidoriBrowser* browser,
|
|||
G_FILE_ATTRIBUTE_FILESYSTEM_FREE, NULL, &error);
|
||||
guint64 free_space = g_file_info_get_attribute_uint64 (info,
|
||||
G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
|
||||
gchar* path = g_file_get_path (folder);
|
||||
gboolean can_write = g_access (path, W_OK) == 0;
|
||||
g_free (path);
|
||||
g_object_unref (file);
|
||||
g_object_unref (folder);
|
||||
if (free_space < total_size)
|
||||
if (free_space < total_size || !can_write)
|
||||
{
|
||||
gchar* message;
|
||||
gchar* detailed_message;
|
||||
|
||||
if (!can_write)
|
||||
{
|
||||
message = g_strdup_printf (
|
||||
_("The file \"%s\" can't be saved in this folder."), &uri[7]);
|
||||
detailed_message = g_strdup_printf (
|
||||
_("You don't have permission to write in this location."));
|
||||
}
|
||||
else if (free_space < total_size)
|
||||
{
|
||||
gchar* message = g_strdup_printf (
|
||||
_("There is not enough free space to download \"%s\"."), &uri[7]);
|
||||
gchar* total_size_string = g_format_size_for_display (total_size);
|
||||
gchar* free_space_string = g_format_size_for_display (free_space);
|
||||
gchar* detailed_message = g_strdup_printf (
|
||||
message = g_strdup_printf (
|
||||
_("There is not enough free space to download \"%s\"."),
|
||||
&uri[7]);
|
||||
detailed_message = g_strdup_printf (
|
||||
_("The file needs %s but only %s are left."),
|
||||
total_size_string, free_space_string);
|
||||
g_free (total_size_string);
|
||||
g_free (free_space_string);
|
||||
}
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
|
||||
sokoke_message_dialog (GTK_MESSAGE_ERROR, message, detailed_message);
|
||||
g_free (message);
|
||||
g_free (detailed_message);
|
||||
g_free (total_size_string);
|
||||
g_free (free_space_string);
|
||||
g_object_unref (download);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1277,6 +1298,8 @@ midori_browser_add_speed_dial (MidoriBrowser* browser)
|
|||
}
|
||||
g_free (body_fname);
|
||||
}
|
||||
g_free (uri);
|
||||
g_free (slot_id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1375,7 +1398,10 @@ midori_view_new_window_cb (GtkWidget* view,
|
|||
{
|
||||
MidoriBrowser* new_browser;
|
||||
g_signal_emit (browser, signals[NEW_WINDOW], 0, NULL, &new_browser);
|
||||
if (new_browser)
|
||||
midori_browser_add_uri (new_browser, uri);
|
||||
else /* No MidoriApp, so this is app or private mode */
|
||||
sokoke_spawn_app (uri, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1566,10 +1592,8 @@ _midori_browser_add_tab (MidoriBrowser* browser,
|
|||
KatzeItem* item;
|
||||
guint n;
|
||||
|
||||
GTK_WIDGET_SET_FLAGS (view, GTK_CAN_FOCUS);
|
||||
|
||||
gtk_widget_set_can_focus (view, TRUE);
|
||||
tab_label = midori_view_get_proxy_tab_label (MIDORI_VIEW (view));
|
||||
|
||||
item = midori_view_get_proxy_item (MIDORI_VIEW (view));
|
||||
g_object_ref (item);
|
||||
katze_array_add_item (browser->proxy_array, item);
|
||||
|
@ -2115,27 +2139,12 @@ _action_tab_new_activate (GtkAction* action,
|
|||
midori_browser_set_current_page (browser, n);
|
||||
}
|
||||
|
||||
static void
|
||||
midori_browser_spawn_app (const gchar* uri)
|
||||
{
|
||||
const gchar* executable = sokoke_get_argv (NULL)[0];
|
||||
gchar* command = g_strconcat (executable, " -a", NULL);
|
||||
sokoke_spawn_program (command, uri, FALSE);
|
||||
g_free (command);
|
||||
}
|
||||
|
||||
static void
|
||||
_action_private_browsing_activate (GtkAction* action,
|
||||
MidoriBrowser* browser)
|
||||
{
|
||||
const gchar* uri = midori_browser_get_current_uri (browser);
|
||||
if (uri != NULL)
|
||||
{
|
||||
if (*uri != '\0')
|
||||
midori_browser_spawn_app (uri);
|
||||
else
|
||||
midori_browser_spawn_app ("about:blank");
|
||||
}
|
||||
sokoke_spawn_app (uri && *uri ? uri : "about:blank", TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2225,7 +2234,7 @@ midori_browser_subscribe_to_news_feed (MidoriBrowser* browser,
|
|||
const gchar* uri)
|
||||
{
|
||||
if (browser->news_aggregator && *browser->news_aggregator)
|
||||
sokoke_spawn_program (browser->news_aggregator, uri, FALSE);
|
||||
sokoke_spawn_program (browser->news_aggregator, uri);
|
||||
else
|
||||
{
|
||||
gchar* description = g_strdup_printf ("%s\n\n%s", uri,
|
||||
|
@ -2596,10 +2605,6 @@ midori_browser_toolbar_popup_context_menu_cb (GtkWidget* widget,
|
|||
GtkWidget* menu;
|
||||
GtkWidget* menuitem;
|
||||
|
||||
/* Unsupported trick used for web app mode */
|
||||
if (g_object_get_data (G_OBJECT (browser), "locked"))
|
||||
return FALSE;
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
menuitem = sokoke_action_create_popup_menu_item (
|
||||
_action_by_name (browser, "Menubar"));
|
||||
|
@ -2738,7 +2743,7 @@ midori_browser_open_bookmark (MidoriBrowser* browser,
|
|||
uri_fixed = g_strdup (uri);
|
||||
|
||||
if (katze_item_get_meta_boolean (item, "app"))
|
||||
midori_browser_spawn_app (uri_fixed);
|
||||
sokoke_spawn_app (uri_fixed, FALSE);
|
||||
else
|
||||
{
|
||||
midori_browser_set_current_uri (browser, uri_fixed);
|
||||
|
@ -3191,16 +3196,14 @@ _action_view_encoding_activate (GtkAction* action,
|
|||
static gchar*
|
||||
midori_browser_get_uri_extension (const gchar* uri)
|
||||
{
|
||||
gchar* extension;
|
||||
gchar* slash;
|
||||
gchar* period;
|
||||
gchar* ext_end;
|
||||
gchar* tmp = g_strdup (uri);
|
||||
|
||||
/* Find the last slash in the URI and search for the last period
|
||||
*after* the last slash. This is not completely accurate
|
||||
but should cover most (simple) URIs */
|
||||
slash = strrchr (tmp, '/');
|
||||
slash = strrchr (uri, '/');
|
||||
/* Huh, URI without slashes? */
|
||||
if (!slash)
|
||||
return g_strdup ("");
|
||||
|
@ -3220,11 +3223,7 @@ midori_browser_get_uri_extension (const gchar* uri)
|
|||
ext_end++;
|
||||
|
||||
*ext_end = 0;
|
||||
extension = g_strdup (period);
|
||||
|
||||
g_free (tmp);
|
||||
|
||||
return extension;
|
||||
return g_strdup (period);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3259,7 +3258,7 @@ midori_browser_source_transfer_cb (KatzeNetRequest* request,
|
|||
g_object_get (browser->settings,
|
||||
"text-editor", &text_editor, NULL);
|
||||
if (text_editor && *text_editor)
|
||||
sokoke_spawn_program (text_editor, unique_filename, TRUE);
|
||||
sokoke_spawn_program (text_editor, unique_filename);
|
||||
else
|
||||
sokoke_show_uri (NULL, unique_filename,
|
||||
gtk_get_current_event_time (), NULL);
|
||||
|
@ -3323,7 +3322,7 @@ _action_source_view_activate (GtkAction* action,
|
|||
if (g_str_has_prefix (uri, "file://"))
|
||||
{
|
||||
gchar* filename = g_filename_from_uri (uri, NULL, NULL);
|
||||
sokoke_spawn_program (text_editor, filename, TRUE);
|
||||
sokoke_spawn_program (text_editor, filename);
|
||||
g_free (filename);
|
||||
return;
|
||||
}
|
||||
|
@ -3338,10 +3337,10 @@ _action_fullscreen_activate (GtkAction* action,
|
|||
{
|
||||
GdkWindowState state;
|
||||
|
||||
if (!GTK_WIDGET (browser)->window)
|
||||
if (!gtk_widget_get_window (GTK_WIDGET (browser)))
|
||||
return;
|
||||
|
||||
state = gdk_window_get_state (GTK_WIDGET (browser)->window);
|
||||
state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (browser)));
|
||||
if (state & GDK_WINDOW_STATE_FULLSCREEN)
|
||||
gtk_window_unfullscreen (GTK_WINDOW (browser));
|
||||
else
|
||||
|
@ -3595,7 +3594,19 @@ _action_location_secondary_icon_released (GtkAction* action,
|
|||
{
|
||||
const gchar* uri = midori_view_get_display_uri (MIDORI_VIEW (view));
|
||||
const gchar* feed;
|
||||
if (gtk_window_get_focus (GTK_WINDOW (browser)) == widget)
|
||||
/* Clicking icon on blank is equal to Paste and Proceed */
|
||||
if (midori_view_is_blank (MIDORI_VIEW (view)))
|
||||
{
|
||||
GtkClipboard* clipboard = gtk_clipboard_get_for_display (
|
||||
gtk_widget_get_display (view), GDK_SELECTION_CLIPBOARD);
|
||||
gchar* text = gtk_clipboard_wait_for_text (clipboard);
|
||||
if (text != NULL)
|
||||
{
|
||||
_action_location_submit_uri (action, text, FALSE, browser);
|
||||
g_free (text);
|
||||
}
|
||||
}
|
||||
else if (gtk_window_get_focus (GTK_WINDOW (browser)) == widget)
|
||||
_action_location_submit_uri (action, uri, FALSE, browser);
|
||||
else if ((feed = g_object_get_data (G_OBJECT (view), "news-feeds")))
|
||||
{
|
||||
|
@ -3898,12 +3909,13 @@ midori_browser_menu_button_press_event_cb (GtkWidget* toolitem,
|
|||
GdkEventButton* event,
|
||||
MidoriBrowser* browser)
|
||||
{
|
||||
if (event->button != 3)
|
||||
return FALSE;
|
||||
|
||||
/* GtkMenuBar catches button events on children with submenus,
|
||||
so we need to see if the actual widget is the menubar, and if
|
||||
it is an item, we forward it to the actual widget. */
|
||||
toolitem = gtk_get_event_widget ((GdkEvent*)event);
|
||||
|
||||
if (GTK_IS_MENU_BAR (toolitem) && event->button == 3)
|
||||
if ((GTK_IS_BOX (toolitem) || GTK_IS_MENU_BAR (toolitem)))
|
||||
{
|
||||
midori_browser_toolbar_popup_context_menu_cb (
|
||||
GTK_IS_BIN (toolitem) && gtk_bin_get_child (GTK_BIN (toolitem)) ?
|
||||
|
@ -3911,7 +3923,7 @@ midori_browser_menu_button_press_event_cb (GtkWidget* toolitem,
|
|||
event->x, event->y, event->button, browser);
|
||||
return TRUE;
|
||||
}
|
||||
else if (GTK_IS_MENU_ITEM (toolitem) && event->button == 3)
|
||||
else if (GTK_IS_MENU_ITEM (toolitem))
|
||||
{
|
||||
gboolean handled;
|
||||
g_signal_emit_by_name (toolitem, "button-press-event", event, &handled);
|
||||
|
@ -4026,7 +4038,7 @@ _action_bookmarks_import_activate (GtkAction* action,
|
|||
g_free (path);
|
||||
}
|
||||
gtk_list_store_insert_with_values (model, NULL, G_MAXINT,
|
||||
0, _("Custom..."), 1, NULL, 2, NULL, 3, icon_width, -1);
|
||||
0, _("Import from a file"), 1, NULL, 2, NULL, 3, icon_width, -1);
|
||||
gtk_combo_box_set_active (combobox, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (content_area), hbox);
|
||||
|
@ -4075,7 +4087,7 @@ _action_bookmarks_import_activate (GtkAction* action,
|
|||
{
|
||||
GtkWidget* file_dialog;
|
||||
|
||||
file_dialog = sokoke_file_chooser_dialog_new (_("Save file as"),
|
||||
file_dialog = sokoke_file_chooser_dialog_new (_("Import from a file"),
|
||||
GTK_WINDOW (browser), GTK_FILE_CHOOSER_ACTION_OPEN);
|
||||
if (gtk_dialog_run (GTK_DIALOG (file_dialog)) == GTK_RESPONSE_OK)
|
||||
path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_dialog));
|
||||
|
@ -4165,19 +4177,17 @@ midori_browser_clear_private_data_response_cb (GtkWidget* dialog,
|
|||
GtkToggleButton* button;
|
||||
gint clear_prefs = MIDORI_CLEAR_NONE;
|
||||
gint saved_prefs = MIDORI_CLEAR_NONE;
|
||||
|
||||
GList* data_items = sokoke_register_privacy_item (NULL, NULL, NULL);
|
||||
GString* clear_data = g_string_new (NULL);
|
||||
g_object_get (browser->settings, "clear-private-data", &saved_prefs, NULL);
|
||||
|
||||
button = g_object_get_data (G_OBJECT (dialog), "history");
|
||||
if (gtk_toggle_button_get_active (button))
|
||||
{
|
||||
const gchar* sqlcmd;
|
||||
sqlite3* db;
|
||||
const gchar* sqlcmd = "DELETE FROM history";
|
||||
sqlite3* db = g_object_get_data (G_OBJECT (browser->history), "db");
|
||||
char* errmsg = NULL;
|
||||
|
||||
db = g_object_get_data (G_OBJECT (browser->history), "db");
|
||||
sqlcmd = "DELETE FROM history";
|
||||
|
||||
if (sqlite3_exec (db, sqlcmd, NULL, NULL, &errmsg) != SQLITE_OK)
|
||||
{
|
||||
g_printerr (_("Failed to clear history: %s\n"), errmsg);
|
||||
|
@ -4194,66 +4204,32 @@ midori_browser_clear_private_data_response_cb (GtkWidget* dialog,
|
|||
}
|
||||
clear_prefs |= MIDORI_CLEAR_HISTORY;
|
||||
}
|
||||
button = g_object_get_data (G_OBJECT (dialog), "cookies");
|
||||
if (gtk_toggle_button_get_active (button))
|
||||
{
|
||||
SoupSession* session = webkit_get_default_session ();
|
||||
SoupSessionFeature* jar = soup_session_get_feature (session,
|
||||
SOUP_TYPE_COOKIE_JAR);
|
||||
GSList* cookies = soup_cookie_jar_all_cookies (SOUP_COOKIE_JAR (jar));
|
||||
SoupCookie* cookie;
|
||||
gsize i = 0;
|
||||
while ((cookie = g_slist_nth_data (cookies, i++)))
|
||||
{
|
||||
soup_cookie_jar_delete_cookie (SOUP_COOKIE_JAR (jar), cookie);
|
||||
soup_cookie_free (cookie);
|
||||
}
|
||||
g_slist_free (cookies);
|
||||
clear_prefs |= MIDORI_CLEAR_COOKIES;
|
||||
}
|
||||
button = g_object_get_data (G_OBJECT (dialog), "flash-cookies");
|
||||
if (gtk_toggle_button_get_active (button))
|
||||
{
|
||||
gchar* cache = g_build_filename (g_get_home_dir (), ".macromedia",
|
||||
"Flash_Player", NULL);
|
||||
sokoke_remove_path (cache, TRUE);
|
||||
g_free (cache);
|
||||
clear_prefs |= MIDORI_CLEAR_FLASH_COOKIES;
|
||||
}
|
||||
button = g_object_get_data (G_OBJECT (dialog), "website-icons");
|
||||
if (gtk_toggle_button_get_active (button))
|
||||
{
|
||||
gchar* cache = g_build_filename (g_get_user_cache_dir (),
|
||||
PACKAGE_NAME, "icons", NULL);
|
||||
sokoke_remove_path (cache, TRUE);
|
||||
g_free (cache);
|
||||
clear_prefs |= MIDORI_CLEAR_WEBSITE_ICONS;
|
||||
}
|
||||
button = g_object_get_data (G_OBJECT (dialog), "trash");
|
||||
if (gtk_toggle_button_get_active (button))
|
||||
{
|
||||
if (browser->trash)
|
||||
if (gtk_toggle_button_get_active (button) && browser->trash)
|
||||
{
|
||||
katze_array_clear (browser->trash);
|
||||
_midori_browser_update_actions (browser);
|
||||
}
|
||||
clear_prefs |= MIDORI_CLEAR_TRASH;
|
||||
}
|
||||
button = g_object_get_data (G_OBJECT (dialog), "web-cache");
|
||||
if (gtk_toggle_button_get_active (button))
|
||||
{
|
||||
gchar* cache = g_build_filename (g_get_user_cache_dir (),
|
||||
PACKAGE_NAME, "web", NULL);
|
||||
sokoke_remove_path (cache, TRUE);
|
||||
g_free (cache);
|
||||
clear_prefs |= MIDORI_CLEAR_WEB_CACHE;
|
||||
}
|
||||
|
||||
if (clear_prefs != saved_prefs)
|
||||
{
|
||||
clear_prefs |= (saved_prefs & MIDORI_CLEAR_ON_QUIT);
|
||||
g_object_set (browser->settings, "clear-private-data", clear_prefs, NULL);
|
||||
}
|
||||
for (; data_items != NULL; data_items = g_list_next (data_items))
|
||||
{
|
||||
SokokePrivacyItem* privacy = data_items->data;
|
||||
button = g_object_get_data (G_OBJECT (dialog), privacy->name);
|
||||
g_return_if_fail (button != NULL && GTK_IS_TOGGLE_BUTTON (button));
|
||||
if (gtk_toggle_button_get_active (button))
|
||||
{
|
||||
privacy->clear ();
|
||||
g_string_append (clear_data, privacy->name);
|
||||
g_string_append_c (clear_data, ',');
|
||||
}
|
||||
}
|
||||
g_object_set (browser->settings, "clear-data", clear_data->str, NULL);
|
||||
g_string_free (clear_data, TRUE);
|
||||
}
|
||||
if (response_id != GTK_RESPONSE_DELETE_EVENT)
|
||||
gtk_widget_destroy (dialog);
|
||||
|
@ -4290,6 +4266,8 @@ _action_clear_private_data_activate (GtkAction* action,
|
|||
GtkWidget* icon;
|
||||
GtkWidget* label;
|
||||
GtkWidget* button;
|
||||
GList* data_items;
|
||||
gchar* clear_data = katze_object_get_string (browser->settings, "clear-data");
|
||||
|
||||
gint clear_prefs = MIDORI_CLEAR_NONE;
|
||||
g_object_get (browser->settings, "clear-private-data", &clear_prefs, NULL);
|
||||
|
@ -4323,36 +4301,29 @@ _action_clear_private_data_activate (GtkAction* action,
|
|||
vbox = gtk_vbox_new (TRUE, 4);
|
||||
alignment = gtk_alignment_new (0, 0, 1, 1);
|
||||
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 6, 12, 0);
|
||||
button = gtk_check_button_new_with_mnemonic (_("History"));
|
||||
/* i18n: Browsing history, visited web pages */
|
||||
button = gtk_check_button_new_with_mnemonic (_("_History"));
|
||||
if ((clear_prefs & MIDORI_CLEAR_HISTORY) == MIDORI_CLEAR_HISTORY)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
g_object_set_data (G_OBJECT (dialog), "history", button);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
button = gtk_check_button_new_with_mnemonic (_("Cookies"));
|
||||
if ((clear_prefs & MIDORI_CLEAR_COOKIES) == MIDORI_CLEAR_COOKIES)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
g_object_set_data (G_OBJECT (dialog), "cookies", button);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
button = gtk_check_button_new_with_mnemonic (_("'Flash' Cookies"));
|
||||
if ((clear_prefs & MIDORI_CLEAR_FLASH_COOKIES) == MIDORI_CLEAR_FLASH_COOKIES)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
g_object_set_data (G_OBJECT (dialog), "flash-cookies", button);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
button = gtk_check_button_new_with_mnemonic (_("Website icons"));
|
||||
if ((clear_prefs & MIDORI_CLEAR_WEBSITE_ICONS) == MIDORI_CLEAR_WEBSITE_ICONS)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
g_object_set_data (G_OBJECT (dialog), "website-icons", button);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
button = gtk_check_button_new_with_mnemonic (_("_Closed Tabs"));
|
||||
if ((clear_prefs & MIDORI_CLEAR_TRASH) == MIDORI_CLEAR_TRASH)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
g_object_set_data (G_OBJECT (dialog), "trash", button);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
button = gtk_check_button_new_with_mnemonic (_("Web Cache"));
|
||||
if ((clear_prefs & MIDORI_CLEAR_WEB_CACHE) == MIDORI_CLEAR_WEB_CACHE)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
g_object_set_data (G_OBJECT (dialog), "web-cache", button);
|
||||
|
||||
data_items = sokoke_register_privacy_item (NULL, NULL, NULL);
|
||||
for (; data_items != NULL; data_items = g_list_next (data_items))
|
||||
{
|
||||
SokokePrivacyItem* privacy = data_items->data;
|
||||
button = gtk_check_button_new_with_mnemonic (privacy->label);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
g_object_set_data (G_OBJECT (dialog), privacy->name, button);
|
||||
if (clear_data && strstr (clear_data, privacy->name))
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
}
|
||||
g_free (clear_data);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), vbox);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), alignment, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), hbox, FALSE, FALSE, 0);
|
||||
|
@ -4372,6 +4343,7 @@ _action_clear_private_data_activate (GtkAction* action,
|
|||
g_signal_connect (dialog, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &dialog);
|
||||
gtk_widget_show (dialog);
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
}
|
||||
else
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
|
@ -4652,7 +4624,11 @@ midori_panel_notify_right_aligned_cb (MidoriPanel* panel,
|
|||
GtkWidget* hpaned = gtk_widget_get_parent (browser->panel);
|
||||
GtkWidget* vpaned = gtk_widget_get_parent (browser->notebook);
|
||||
gint paned_position = gtk_paned_get_position (GTK_PANED (hpaned));
|
||||
gint paned_size = hpaned->allocation.width;
|
||||
GtkAllocation allocation;
|
||||
gint paned_size;
|
||||
|
||||
gtk_widget_get_allocation (hpaned, &allocation);
|
||||
paned_size = allocation.width;
|
||||
|
||||
g_object_set (browser->settings, "right-align-sidepanel", right_aligned, NULL);
|
||||
|
||||
|
@ -4685,7 +4661,7 @@ midori_panel_close_cb (MidoriPanel* panel,
|
|||
|
||||
static void
|
||||
gtk_notebook_switch_page_cb (GtkWidget* notebook,
|
||||
GtkNotebookPage* page,
|
||||
gpointer page,
|
||||
guint page_num,
|
||||
MidoriBrowser* browser)
|
||||
{
|
||||
|
@ -4704,7 +4680,7 @@ gtk_notebook_switch_page_cb (GtkWidget* notebook,
|
|||
|
||||
static void
|
||||
gtk_notebook_switch_page_after_cb (GtkWidget* notebook,
|
||||
GtkNotebookPage* page,
|
||||
gpointer page,
|
||||
guint page_num,
|
||||
MidoriBrowser* browser)
|
||||
{
|
||||
|
@ -5006,8 +4982,8 @@ static const GtkActionEntry entries[] =
|
|||
N_("Focus _Current Tab"), "<Ctrl>Home",
|
||||
N_("Focus the current tab"), G_CALLBACK (_action_tab_current_activate) },
|
||||
{ "TabMinimize", NULL,
|
||||
N_("Minimize _Current Tab"), "",
|
||||
N_("Minimize the current tab"), G_CALLBACK (_action_tab_minimize_activate) },
|
||||
N_("Only show the Icon of the _Current Tab"), "",
|
||||
N_("Only show the icon of the current tab"), G_CALLBACK (_action_tab_minimize_activate) },
|
||||
{ "TabDuplicate", NULL,
|
||||
N_("_Duplicate Current Tab"), "",
|
||||
N_("Duplicate the current tab"), G_CALLBACK (_action_tab_duplicate_activate) },
|
||||
|
@ -5125,22 +5101,24 @@ static gboolean
|
|||
midori_browser_alloc_timeout (MidoriBrowser* browser)
|
||||
{
|
||||
GtkWidget* widget = GTK_WIDGET (browser);
|
||||
GdkWindowState state = gdk_window_get_state (widget->window);
|
||||
GdkWindowState state = gdk_window_get_state (gtk_widget_get_window (widget));
|
||||
|
||||
if (!(state &
|
||||
(GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN)))
|
||||
{
|
||||
if (widget->allocation.width != browser->last_window_width)
|
||||
GtkAllocation allocation;
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
if (allocation.width != browser->last_window_width)
|
||||
{
|
||||
browser->last_window_width = widget->allocation.width;
|
||||
browser->last_window_width = allocation.width;
|
||||
g_object_set (browser->settings,
|
||||
"last-window-width", browser->last_window_width, NULL);
|
||||
}
|
||||
if (widget->allocation.height != browser->last_window_height)
|
||||
if (allocation.height != browser->last_window_height)
|
||||
{
|
||||
browser->last_window_height = widget->allocation.height;
|
||||
browser->last_window_height = allocation.height;
|
||||
g_object_set (browser->settings,
|
||||
"last-window-height", widget->allocation.height, NULL);
|
||||
"last-window-height", allocation.height, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5173,6 +5151,8 @@ midori_browser_size_allocate_cb (MidoriBrowser* browser,
|
|||
static void
|
||||
midori_browser_destroy_cb (MidoriBrowser* browser)
|
||||
{
|
||||
g_object_set_data (G_OBJECT (browser), "midori-browser-destroyed", (void*)1);
|
||||
|
||||
if (G_UNLIKELY (browser->panel_timeout))
|
||||
g_source_remove (browser->panel_timeout);
|
||||
if (G_UNLIKELY (browser->alloc_timeout))
|
||||
|
@ -5300,6 +5280,7 @@ static const gchar* ui_markup =
|
|||
"<menuitem action='UndoTabClose'/>"
|
||||
"<menuitem action='TrashEmpty'/>"
|
||||
"<menuitem action='Preferences'/>"
|
||||
"<menuitem action='InspectPage'/>"
|
||||
"</menu>"
|
||||
"</menubar>"
|
||||
"<toolbar name='toolbar_navigation'>"
|
||||
|
@ -5315,7 +5296,7 @@ midori_browser_realize_cb (GtkStyle* style,
|
|||
#ifdef HAVE_HILDON_2_2
|
||||
/* hildon_gtk_window_enable_zoom_keys */
|
||||
guint32 set = 1;
|
||||
gdk_property_change (GTK_WIDGET (browser)->window,
|
||||
gdk_property_change (gtk_widget_get_window (GTK_WIDGET (browser)),
|
||||
gdk_atom_intern ("_HILDON_ZOOM_KEY_ATOM", FALSE),
|
||||
gdk_x11_xatom_to_atom (XA_INTEGER),
|
||||
32, GDK_PROP_MODE_REPLACE,
|
||||
|
@ -5537,7 +5518,6 @@ midori_browser_init (MidoriBrowser* browser)
|
|||
GtkWidget* hpaned;
|
||||
GtkWidget* vpaned;
|
||||
GtkRcStyle* rcstyle;
|
||||
GtkWidget* label;
|
||||
GtkWidget* scrolled;
|
||||
|
||||
browser->settings = midori_web_settings_new ();
|
||||
|
@ -5799,6 +5779,14 @@ midori_browser_init (MidoriBrowser* browser)
|
|||
/* FIXME: Show once implemented */
|
||||
_action_set_visible (browser, "AddDesktopShortcut", FALSE);
|
||||
|
||||
_action_set_visible (browser, "Bookmarks", browser->bookmarks != NULL);
|
||||
_action_set_visible (browser, "BookmarkAdd", browser->bookmarks != NULL);
|
||||
_action_set_visible (browser, "BookmarksImport", browser->bookmarks != NULL);
|
||||
_action_set_visible (browser, "BookmarksExport", browser->bookmarks != NULL);
|
||||
_action_set_visible (browser, "Bookmarkbar", browser->bookmarks != NULL);
|
||||
_action_set_visible (browser, "Trash", browser->trash != NULL);
|
||||
_action_set_visible (browser, "UndoTabClose", browser->trash != NULL);
|
||||
|
||||
/* Create the navigationbar */
|
||||
browser->navigationbar = gtk_ui_manager_get_widget (
|
||||
ui_manager, "/toolbar_navigation");
|
||||
|
@ -5903,7 +5891,7 @@ midori_browser_init (MidoriBrowser* browser)
|
|||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
GTK_WIDGET_SET_FLAGS (scrolled, GTK_CAN_FOCUS);
|
||||
gtk_widget_set_can_focus (scrolled, TRUE);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
|
||||
GTK_SHADOW_ETCHED_IN);
|
||||
gtk_box_pack_start (GTK_BOX (browser->inspector), scrolled, TRUE, TRUE, 0);
|
||||
|
@ -5921,24 +5909,29 @@ midori_browser_init (MidoriBrowser* browser)
|
|||
|
||||
/* Statusbar */
|
||||
browser->statusbar = gtk_statusbar_new ();
|
||||
#if GTK_CHECK_VERSION (2, 20, 0)
|
||||
browser->statusbar_contents =
|
||||
gtk_statusbar_get_message_area (GTK_STATUSBAR (browser->statusbar));
|
||||
#else
|
||||
/* Rearrange the statusbar packing. This is necessariy to keep
|
||||
themes happy while there is no support from GtkStatusbar. */
|
||||
label = GTK_STATUSBAR (browser->statusbar)->label;
|
||||
if (GTK_IS_BOX (gtk_widget_get_parent (label)))
|
||||
browser->statusbar_contents = gtk_widget_get_parent (label);
|
||||
forward = GTK_STATUSBAR (browser->statusbar)->label;
|
||||
if (GTK_IS_BOX (gtk_widget_get_parent (forward)))
|
||||
browser->statusbar_contents = gtk_widget_get_parent (forward);
|
||||
else
|
||||
{
|
||||
browser->statusbar_contents = gtk_hbox_new (FALSE, 4);
|
||||
gtk_widget_show (browser->statusbar_contents);
|
||||
g_object_ref (GTK_STATUSBAR (browser->statusbar)->label);
|
||||
gtk_container_remove (
|
||||
GTK_CONTAINER (GTK_STATUSBAR (browser->statusbar)->frame), label);
|
||||
GTK_CONTAINER (GTK_STATUSBAR (browser->statusbar)->frame), forward);
|
||||
gtk_box_pack_start (GTK_BOX (browser->statusbar_contents),
|
||||
label, TRUE, TRUE, 0);
|
||||
g_object_unref (label);
|
||||
forward, TRUE, TRUE, 0);
|
||||
g_object_unref (forward);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_STATUSBAR (browser->statusbar)->frame),
|
||||
browser->statusbar_contents);
|
||||
}
|
||||
#endif
|
||||
gtk_box_pack_start (GTK_BOX (vbox), browser->statusbar, FALSE, FALSE, 0);
|
||||
|
||||
browser->progressbar = gtk_progress_bar_new ();
|
||||
|
@ -6208,7 +6201,8 @@ _midori_browser_update_settings (MidoriBrowser* browser)
|
|||
|
||||
_action_set_active (browser, "Menubar", show_menubar);
|
||||
_action_set_active (browser, "Navigationbar", browser->show_navigationbar);
|
||||
_action_set_active (browser, "Bookmarkbar", show_bookmarkbar);
|
||||
_action_set_active (browser, "Bookmarkbar", show_bookmarkbar
|
||||
&& browser->bookmarks != NULL);
|
||||
_action_set_active (browser, "Panel", show_panel);
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 3)
|
||||
_action_set_active (browser, "Transferbar", show_transferbar);
|
||||
|
@ -6443,6 +6437,20 @@ midori_browser_set_bookmarks (MidoriBrowser* browser,
|
|||
midori_browser_show_bookmarkbar_notify_value_cb, browser);
|
||||
katze_object_assign (browser->bookmarks, bookmarks);
|
||||
|
||||
_action_set_visible (browser, "Bookmarks", bookmarks != NULL);
|
||||
if (bookmarks != NULL)
|
||||
{
|
||||
/* FIXME: Proxies aren't shown propely. Why? */
|
||||
GSList* proxies = gtk_action_get_proxies (
|
||||
_action_by_name (browser, "Bookmarks"));
|
||||
for (; proxies; proxies = g_slist_next (proxies))
|
||||
gtk_widget_show (proxies->data);
|
||||
}
|
||||
_action_set_visible (browser, "BookmarkAdd", bookmarks != NULL);
|
||||
_action_set_visible (browser, "BookmarksImport", bookmarks != NULL);
|
||||
_action_set_visible (browser, "BookmarksExport", bookmarks != NULL);
|
||||
_action_set_visible (browser, "Bookmarkbar", bookmarks != NULL);
|
||||
|
||||
if (!bookmarks)
|
||||
return;
|
||||
|
||||
|
@ -6498,6 +6506,8 @@ midori_browser_set_property (GObject* object,
|
|||
g_object_set (_action_by_name (browser, "Trash"),
|
||||
"array", browser->trash, "reversed", TRUE,
|
||||
NULL);
|
||||
_action_set_visible (browser, "Trash", browser->trash != NULL);
|
||||
_action_set_visible (browser, "UndoTabClose", browser->trash != NULL);
|
||||
/* FIXME: Connect to updates */
|
||||
_midori_browser_update_actions (browser);
|
||||
break;
|
||||
|
@ -6771,6 +6781,17 @@ midori_browser_activate_action (MidoriBrowser* browser,
|
|||
g_signal_emit (browser, signals[ACTIVATE_ACTION], 0, name);
|
||||
}
|
||||
|
||||
void
|
||||
midori_browser_set_action_visible (MidoriBrowser* browser,
|
||||
const gchar* name,
|
||||
gboolean visible)
|
||||
{
|
||||
g_return_if_fail (MIDORI_IS_BROWSER (browser));
|
||||
g_return_if_fail (name != NULL);
|
||||
|
||||
_action_set_visible (browser, name, visible);
|
||||
}
|
||||
|
||||
/**
|
||||
* midori_browser_get_action_group:
|
||||
* @browser: a #MidoriBrowser
|
||||
|
|
|
@ -106,6 +106,11 @@ void
|
|||
midori_browser_activate_action (MidoriBrowser* browser,
|
||||
const gchar* name);
|
||||
|
||||
void
|
||||
midori_browser_set_action_visible (MidoriBrowser* browser,
|
||||
const gchar* name,
|
||||
gboolean visible);
|
||||
|
||||
GtkActionGroup*
|
||||
midori_browser_get_action_group (MidoriBrowser* browser);
|
||||
|
||||
|
|
|
@ -276,19 +276,21 @@ static void
|
|||
midori_location_action_popup_position (GtkWidget* popup,
|
||||
GtkWidget* widget)
|
||||
{
|
||||
GdkWindow* window = gtk_widget_get_window (widget);
|
||||
gint wx, wy;
|
||||
GtkRequisition menu_req;
|
||||
GtkRequisition widget_req;
|
||||
GdkScreen* screen;
|
||||
gint monitor_num;
|
||||
GdkRectangle monitor;
|
||||
GtkAllocation allocation;
|
||||
|
||||
gdk_window_get_origin (widget->window, &wx, &wy);
|
||||
gdk_window_get_origin (window, &wx, &wy);
|
||||
gtk_widget_size_request (popup, &menu_req);
|
||||
gtk_widget_size_request (widget, &widget_req);
|
||||
|
||||
screen = gtk_widget_get_screen (widget);
|
||||
monitor_num = gdk_screen_get_monitor_at_window (screen, widget->window);
|
||||
monitor_num = gdk_screen_get_monitor_at_window (screen, window);
|
||||
gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
|
||||
|
||||
if (wy + widget_req.height + menu_req.height <= monitor.y + monitor.height
|
||||
|
@ -297,7 +299,8 @@ midori_location_action_popup_position (GtkWidget* popup,
|
|||
else
|
||||
wy -= menu_req.height;
|
||||
gtk_window_move (GTK_WINDOW (popup), wx, wy);
|
||||
gtk_window_resize (GTK_WINDOW (popup), widget->allocation.width, 1);
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
gtk_window_resize (GTK_WINDOW (popup), allocation.width, 1);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -614,23 +617,25 @@ midori_location_action_finalize (GObject* object)
|
|||
static void
|
||||
midori_location_action_toggle_arrow_cb (GtkWidget* widget,
|
||||
MidoriLocationAction* location_action)
|
||||
{ gboolean show = FALSE;
|
||||
|
||||
sqlite3* db;
|
||||
const gchar* sqlcmd;
|
||||
sqlite3_stmt* statement;
|
||||
{
|
||||
gboolean show = FALSE;
|
||||
gint result;
|
||||
|
||||
if (!GTK_IS_BUTTON (widget))
|
||||
return;
|
||||
|
||||
db = g_object_get_data (G_OBJECT (location_action->history), "db");
|
||||
sqlcmd = "SELECT uri FROM history LIMIT 1";
|
||||
if (location_action->history != NULL)
|
||||
{
|
||||
sqlite3* db = g_object_get_data (G_OBJECT (location_action->history), "db");
|
||||
const char* sqlcmd = "SELECT uri FROM history LIMIT 1";
|
||||
sqlite3_stmt* statement;
|
||||
sqlite3_prepare_v2 (db, sqlcmd, -1, &statement, NULL);
|
||||
result = sqlite3_step (statement);
|
||||
if (result == SQLITE_ROW)
|
||||
show = TRUE;
|
||||
sqlite3_finalize (statement);
|
||||
}
|
||||
|
||||
sokoke_widget_set_visible (widget, show);
|
||||
gtk_widget_set_size_request (widget, show ? -1 : 1, show ? -1 : 1);
|
||||
}
|
||||
|
@ -640,9 +645,6 @@ midori_location_action_toggle_arrow (MidoriLocationAction* location_action)
|
|||
{
|
||||
GSList* proxies;
|
||||
|
||||
if (!location_action->history)
|
||||
return;
|
||||
|
||||
proxies = gtk_action_get_proxies (GTK_ACTION (location_action));
|
||||
for (; proxies != NULL; proxies = g_slist_next (proxies))
|
||||
if (GTK_IS_TOOL_ITEM (proxies->data))
|
||||
|
@ -981,7 +983,8 @@ midori_location_action_key_press_event_cb (GtkEntry* entry,
|
|||
}
|
||||
|
||||
parent = gtk_widget_get_parent (widget);
|
||||
if (!katze_object_get_boolean (parent, "popup-shown"))
|
||||
if (location_action->history != NULL
|
||||
&& !katze_object_get_boolean (parent, "popup-shown"))
|
||||
gtk_combo_box_popup (GTK_COMBO_BOX (parent));
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1283,7 +1286,7 @@ midori_location_action_entry_popup_cb (GtkComboBox* combo_box,
|
|||
GtkListStore* store;
|
||||
gint result;
|
||||
const gchar* sqlcmd;
|
||||
static sqlite3_stmt* stmt;
|
||||
static sqlite3_stmt* stmt = NULL;
|
||||
gint matches;
|
||||
|
||||
store = GTK_LIST_STORE (gtk_combo_box_get_model (combo_box));
|
||||
|
@ -1292,7 +1295,10 @@ midori_location_action_entry_popup_cb (GtkComboBox* combo_box,
|
|||
if (!stmt)
|
||||
{
|
||||
sqlite3* db;
|
||||
|
||||
g_return_if_fail (location_action->history != NULL);
|
||||
db = g_object_get_data (G_OBJECT (location_action->history), "db");
|
||||
g_return_if_fail (db != NULL);
|
||||
sqlcmd = "SELECT uri, title FROM history"
|
||||
" GROUP BY uri ORDER BY count() DESC LIMIT ?";
|
||||
sqlite3_prepare_v2 (db, sqlcmd, -1, &stmt, NULL);
|
||||
|
@ -1409,7 +1415,6 @@ midori_location_action_connect_proxy (GtkAction* action,
|
|||
renderer, midori_location_entry_render_text_cb, action, NULL);
|
||||
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (entry), -1);
|
||||
if (location_action->history)
|
||||
gtk_container_forall (GTK_CONTAINER (entry),
|
||||
(GtkCallback)midori_location_action_toggle_arrow_cb, action);
|
||||
g_signal_connect (entry, "changed",
|
||||
|
@ -1810,6 +1815,8 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action,
|
|||
#if !HAVE_HILDON
|
||||
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child),
|
||||
GTK_ICON_ENTRY_SECONDARY, GTK_STOCK_INFO);
|
||||
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (child),
|
||||
GTK_ICON_ENTRY_SECONDARY, _("Not verified"));
|
||||
#endif
|
||||
}
|
||||
else if (hint == MIDORI_SECURITY_TRUSTED)
|
||||
|
@ -1819,6 +1826,8 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action,
|
|||
#if !HAVE_HILDON
|
||||
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child),
|
||||
GTK_ICON_ENTRY_SECONDARY, GTK_STOCK_DIALOG_AUTHENTICATION);
|
||||
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (child),
|
||||
GTK_ICON_ENTRY_SECONDARY, _("Verified and encrypted connection"));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -733,7 +733,7 @@ midori_panel_append_page (MidoriPanel* panel,
|
|||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
GTK_WIDGET_SET_FLAGS (scrolled, GTK_CAN_FOCUS);
|
||||
gtk_widget_set_can_focus (scrolled, TRUE);
|
||||
gtk_widget_show (scrolled);
|
||||
gobject_class = G_OBJECT_GET_CLASS (viewable);
|
||||
if (GTK_WIDGET_CLASS (gobject_class)->set_scroll_adjustments_signal)
|
||||
|
|
|
@ -196,6 +196,34 @@ midori_preferences_notify_proxy_type_cb (MidoriWebSettings* settings,
|
|||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
midori_preferences_delete_cookies_toggled_cb (GtkToggleButton* button,
|
||||
MidoriWebSettings* settings)
|
||||
{
|
||||
gboolean toggled = gtk_toggle_button_get_active (button);
|
||||
g_object_set (settings, "accept-cookies",
|
||||
toggled ? MIDORI_ACCEPT_COOKIES_SESSION : MIDORI_ACCEPT_COOKIES_ALL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
midori_preferences_delete_cookies_changed_cb (GtkComboBox* combo,
|
||||
MidoriWebSettings* settings)
|
||||
{
|
||||
gint active = gtk_combo_box_get_active (combo);
|
||||
gint max_age;
|
||||
switch (active)
|
||||
{
|
||||
case 0: max_age = 0; break;
|
||||
case 1: max_age = 1; break;
|
||||
case 2: max_age = 7; break;
|
||||
case 3: max_age = 30; break;
|
||||
case 4: max_age = 365; break;
|
||||
default:
|
||||
max_age = 30;
|
||||
}
|
||||
g_object_set (settings, "maximum-cookie-age", max_age, NULL);
|
||||
}
|
||||
|
||||
#if HAVE_OSX
|
||||
static void
|
||||
midori_preferences_toolbutton_clicked_cb (GtkWidget* toolbutton,
|
||||
|
@ -281,8 +309,8 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
|
|||
if ((header = sokoke_xfce_header_new (icon_name,
|
||||
gtk_window_get_title (GTK_WINDOW (preferences)))))
|
||||
{
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (preferences)->vbox),
|
||||
header, FALSE, FALSE, 0);
|
||||
GtkWidget* vbox = gtk_dialog_get_content_area (GTK_DIALOG (preferences));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), header, FALSE, FALSE, 0);
|
||||
gtk_widget_show_all (header);
|
||||
}
|
||||
_preferences = KATZE_PREFERENCES (preferences);
|
||||
|
@ -403,13 +431,9 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
|
|||
#if !HAVE_HILDON
|
||||
button = katze_property_proxy (settings, "enable-scripts", NULL);
|
||||
INDENTED_ADD (button);
|
||||
button = katze_property_proxy (settings, "open-panels-in-windows", NULL);
|
||||
SPANNED_ADD (button);
|
||||
button = katze_property_proxy (settings, "enable-plugins", NULL);
|
||||
INDENTED_ADD (button);
|
||||
#endif
|
||||
button = katze_property_proxy (settings, "find-while-typing", NULL);
|
||||
SPANNED_ADD (button);
|
||||
#endif
|
||||
button = katze_property_proxy (settings, "zoom-text-and-images", NULL);
|
||||
INDENTED_ADD (button);
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 11)
|
||||
|
@ -424,9 +448,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
|
|||
gtk_button_set_label (GTK_BUTTON (button), _("Enable Spell Checking"));
|
||||
gtk_widget_set_tooltip_text (button, _("Enable spell checking while typing"));
|
||||
INDENTED_ADD (button);
|
||||
button = gtk_label_new (_("Spelling dictionaries:"));
|
||||
INDENTED_ADD (button);
|
||||
entry = katze_property_proxy (settings, "spell-checking-languages", NULL);
|
||||
entry = katze_property_proxy (settings, "spell-checking-languages", "languages");
|
||||
/* i18n: The example should be adjusted to contain a good local default */
|
||||
gtk_widget_set_tooltip_text (entry, _("A comma separated list of "
|
||||
"languages to be used for spell checking, for example \"en_GB,de_DE\""));
|
||||
|
@ -450,10 +472,6 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
|
|||
INDENTED_ADD (label);
|
||||
button = katze_property_proxy (settings, "open-new-pages-in", NULL);
|
||||
SPANNED_ADD (button);
|
||||
label = katze_property_label (settings, "open-external-pages-in");
|
||||
INDENTED_ADD (label);
|
||||
button = katze_property_proxy (settings, "open-external-pages-in", NULL);
|
||||
SPANNED_ADD (button);
|
||||
#if !HAVE_HILDON
|
||||
button = katze_property_proxy (settings, "always-show-tabbar", NULL);
|
||||
INDENTED_ADD (button);
|
||||
|
@ -505,30 +523,60 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
|
|||
SPANNED_ADD (button);
|
||||
label = katze_property_label (settings, "preferred-languages");
|
||||
INDENTED_ADD (label);
|
||||
entry = katze_property_proxy (settings, "preferred-languages", NULL);
|
||||
entry = katze_property_proxy (settings, "preferred-languages", "languages");
|
||||
SPANNED_ADD (entry);
|
||||
|
||||
|
||||
/* Page "Privacy" */
|
||||
PAGE_NEW (GTK_STOCK_INDEX, _("Privacy"));
|
||||
FRAME_NEW (_("Web Cookies"));
|
||||
label = katze_property_label (settings, "accept-cookies");
|
||||
INDENTED_ADD (label);
|
||||
button = katze_property_proxy (settings, "accept-cookies", NULL);
|
||||
button = gtk_check_button_new_with_mnemonic (_("Delete cookies when quitting Midori"));
|
||||
INDENTED_ADD (button);
|
||||
if (katze_object_get_enum (settings, "accept-cookies") == MIDORI_ACCEPT_COOKIES_SESSION)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
g_signal_connect (button, "toggled",
|
||||
G_CALLBACK (midori_preferences_delete_cookies_toggled_cb), settings);
|
||||
button = gtk_combo_box_new_text ();
|
||||
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 hour"));
|
||||
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 day"));
|
||||
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 week"));
|
||||
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 month"));
|
||||
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 year"));
|
||||
{
|
||||
gint max_age = katze_object_get_int (settings, "maximum-cookie-age");
|
||||
guint active;
|
||||
switch (max_age)
|
||||
{
|
||||
case 0: active = 0; break;
|
||||
case 1: active = 1; break;
|
||||
case 7: active = 2; break;
|
||||
case 30: active = 3; break;
|
||||
case 365: active = 4; break;
|
||||
default:
|
||||
active = 3;
|
||||
}
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (button), active);
|
||||
}
|
||||
g_signal_connect (button, "changed",
|
||||
G_CALLBACK (midori_preferences_delete_cookies_changed_cb), settings);
|
||||
SPANNED_ADD (button);
|
||||
label = katze_property_label (settings, "maximum-cookie-age");
|
||||
INDENTED_ADD (label);
|
||||
entry = katze_property_proxy (settings, "maximum-cookie-age", NULL);
|
||||
SPANNED_ADD (entry);
|
||||
label = gtk_label_new (_("days"));
|
||||
SPANNED_ADD (label);
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 8)
|
||||
INDENTED_ADD (katze_property_proxy (settings, "enable-html5-database", NULL));
|
||||
SPANNED_ADD (katze_property_proxy (settings, "enable-html5-local-storage", NULL));
|
||||
#endif
|
||||
{
|
||||
gchar* markup = g_strdup_printf ("<span size=\"smaller\">%s</span>",
|
||||
_("Cookies store login data, saved games, "
|
||||
"or user profiles for advertisement purposes."));
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label), markup);
|
||||
g_free (markup);
|
||||
}
|
||||
FILLED_ADD (label);
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 13)
|
||||
INDENTED_ADD (katze_property_proxy (settings, "enable-offline-web-application-cache", NULL));
|
||||
#endif
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 8)
|
||||
SPANNED_ADD (katze_property_proxy (settings, "enable-html5-local-storage", NULL));
|
||||
#if !WEBKIT_CHECK_VERSION (1, 1, 14)
|
||||
INDENTED_ADD (katze_property_proxy (settings, "enable-html5-database", NULL));
|
||||
#endif
|
||||
#endif
|
||||
FRAME_NEW (_("History"));
|
||||
button = katze_property_label (settings, "maximum-history-age");
|
||||
INDENTED_ADD (button);
|
||||
|
@ -536,6 +584,4 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
|
|||
SPANNED_ADD (button);
|
||||
label = gtk_label_new (_("days"));
|
||||
SPANNED_ADD (label);
|
||||
button = katze_property_proxy (settings, "remember-last-downloaded-files", NULL);
|
||||
INDENTED_ADD (button);
|
||||
}
|
||||
|
|
|
@ -896,6 +896,7 @@ midori_search_action_get_editor (MidoriSearchAction* search_action,
|
|||
{
|
||||
GtkWidget* toplevel;
|
||||
GtkWidget* dialog;
|
||||
GtkWidget* content_area;
|
||||
GtkSizeGroup* sizegroup;
|
||||
KatzeItem* item;
|
||||
GtkWidget* hbox;
|
||||
|
@ -919,8 +920,9 @@ midori_search_action_get_editor (MidoriSearchAction* search_action,
|
|||
NULL);
|
||||
gtk_window_set_icon_name (GTK_WINDOW (dialog),
|
||||
new_engine ? GTK_STOCK_ADD : GTK_STOCK_REMOVE);
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (content_area), 5);
|
||||
sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
|
||||
if (new_engine)
|
||||
|
@ -950,7 +952,7 @@ midori_search_action_get_editor (MidoriSearchAction* search_action,
|
|||
gtk_entry_set_text (GTK_ENTRY (entry_name),
|
||||
STR_NON_NULL (katze_item_get_name (item)));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), entry_name, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
|
||||
gtk_container_add (GTK_CONTAINER (content_area), hbox);
|
||||
gtk_widget_show_all (hbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
|
@ -964,7 +966,7 @@ midori_search_action_get_editor (MidoriSearchAction* search_action,
|
|||
gtk_entry_set_text (GTK_ENTRY (entry_description)
|
||||
, STR_NON_NULL (katze_item_get_text (item)));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), entry_description, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
|
||||
gtk_container_add (GTK_CONTAINER (content_area), hbox);
|
||||
gtk_widget_show_all (hbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
|
@ -978,7 +980,7 @@ midori_search_action_get_editor (MidoriSearchAction* search_action,
|
|||
gtk_entry_set_text (GTK_ENTRY (entry_uri)
|
||||
, STR_NON_NULL (katze_item_get_uri (item)));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), entry_uri, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
|
||||
gtk_container_add (GTK_CONTAINER (content_area), hbox);
|
||||
gtk_widget_show_all (hbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
|
@ -992,7 +994,7 @@ midori_search_action_get_editor (MidoriSearchAction* search_action,
|
|||
gtk_entry_set_text (GTK_ENTRY (entry_icon)
|
||||
, STR_NON_NULL (katze_item_get_icon (item)));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), entry_icon, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
|
||||
gtk_container_add (GTK_CONTAINER (content_area), hbox);
|
||||
gtk_widget_show_all (hbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
|
@ -1006,7 +1008,7 @@ midori_search_action_get_editor (MidoriSearchAction* search_action,
|
|||
gtk_entry_set_text (GTK_ENTRY (entry_token)
|
||||
, STR_NON_NULL (katze_item_get_token (item)));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), entry_token, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
|
||||
gtk_container_add (GTK_CONTAINER (content_area), hbox);
|
||||
gtk_widget_show_all (hbox);
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
|
@ -1207,6 +1209,7 @@ midori_search_action_get_dialog (MidoriSearchAction* search_action)
|
|||
const gchar* dialog_title;
|
||||
GtkWidget* toplevel;
|
||||
GtkWidget* dialog;
|
||||
GtkWidget* content_area;
|
||||
gint width, height;
|
||||
GtkWidget* xfce_heading;
|
||||
GtkWidget* hbox;
|
||||
|
@ -1244,6 +1247,7 @@ midori_search_action_get_dialog (MidoriSearchAction* search_action)
|
|||
g_signal_connect (dialog, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &search_action->dialog);
|
||||
gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_PROPERTIES);
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
||||
/* TODO: Implement some kind of help function */
|
||||
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
|
||||
GTK_RESPONSE_HELP, FALSE);
|
||||
|
@ -1255,11 +1259,9 @@ midori_search_action_get_dialog (MidoriSearchAction* search_action)
|
|||
We need mnemonics */
|
||||
if ((xfce_heading = sokoke_xfce_header_new (
|
||||
gtk_window_get_icon_name (GTK_WINDOW (dialog)), dialog_title)))
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
|
||||
xfce_heading, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), xfce_heading, FALSE, FALSE, 0);
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox,
|
||||
TRUE, TRUE, 12);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 12);
|
||||
liststore = gtk_list_store_new (1, KATZE_TYPE_ITEM);
|
||||
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (liststore));
|
||||
search_action->treeview = treeview;
|
||||
|
@ -1357,12 +1359,10 @@ midori_search_action_get_dialog (MidoriSearchAction* search_action)
|
|||
gtk_widget_set_sensitive (button, FALSE);
|
||||
/* g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (midori_search_action_dialog_help_clicked_cb), dialog); */
|
||||
gtk_box_pack_end (GTK_BOX (hbox),
|
||||
button, FALSE, FALSE, 4);
|
||||
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox),
|
||||
hbox, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 4);
|
||||
gtk_box_pack_end (GTK_BOX (content_area), hbox, FALSE, FALSE, 0);
|
||||
#endif
|
||||
gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
|
||||
gtk_widget_show_all (content_area);
|
||||
|
||||
if (search_action->search_engines)
|
||||
g_object_connect (search_action->search_engines,
|
||||
|
|
|
@ -94,6 +94,7 @@ struct _MidoriView
|
|||
gboolean close_buttons_on_tabs;
|
||||
MidoriNewPage open_new_pages_in;
|
||||
gboolean find_while_typing;
|
||||
gint find_links;
|
||||
|
||||
GtkWidget* menu_item;
|
||||
GtkWidget* tab_label;
|
||||
|
@ -103,10 +104,7 @@ struct _MidoriView
|
|||
KatzeItem* item;
|
||||
gint scrollh, scrollv;
|
||||
gboolean back_forward_set;
|
||||
|
||||
KatzeNet* net;
|
||||
GHashTable* memory;
|
||||
|
||||
GtkWidget* scrolled_window;
|
||||
};
|
||||
|
||||
|
@ -186,8 +184,7 @@ enum
|
|||
PROP_ZOOM_LEVEL,
|
||||
PROP_NEWS_FEEDS,
|
||||
PROP_STATUSBAR_TEXT,
|
||||
PROP_SETTINGS,
|
||||
PROP_NET
|
||||
PROP_SETTINGS
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -600,15 +597,6 @@ midori_view_class_init (MidoriViewClass* class)
|
|||
"The associated settings",
|
||||
MIDORI_TYPE_WEB_SETTINGS,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_NET,
|
||||
g_param_spec_object (
|
||||
"net",
|
||||
"Net",
|
||||
"The associated net",
|
||||
KATZE_TYPE_NET,
|
||||
flags));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -772,15 +760,15 @@ typedef struct
|
|||
MidoriView* view;
|
||||
} KatzeNetIconPriv;
|
||||
|
||||
void
|
||||
static void
|
||||
katze_net_icon_priv_free (KatzeNetIconPriv* priv)
|
||||
{
|
||||
g_free (priv->icon_file);
|
||||
g_free (priv->icon_uri);
|
||||
g_free (priv);
|
||||
g_slice_free (KatzeNetIconPriv, priv);
|
||||
}
|
||||
|
||||
gboolean
|
||||
static gboolean
|
||||
katze_net_icon_status_cb (KatzeNetRequest* request,
|
||||
KatzeNetIconPriv* priv)
|
||||
{
|
||||
|
@ -803,7 +791,7 @@ katze_net_icon_status_cb (KatzeNetRequest* request,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
katze_net_icon_transfer_cb (KatzeNetRequest* request,
|
||||
KatzeNetIconPriv* priv)
|
||||
{
|
||||
|
@ -859,7 +847,6 @@ katze_net_icon_transfer_cb (KatzeNetRequest* request,
|
|||
katze_net_icon_priv_free (priv);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_midori_web_view_load_icon (MidoriView* view)
|
||||
{
|
||||
|
@ -884,9 +871,9 @@ _midori_web_view_load_icon (MidoriView* view)
|
|||
i++;
|
||||
if (view->uri[i] == '/')
|
||||
{
|
||||
icon_uri = g_strdup (view->uri);
|
||||
icon_uri[i] = '\0';
|
||||
icon_uri = g_strdup_printf ("%s/favicon.ico", icon_uri);
|
||||
gchar* path = g_strndup (view->uri, i);
|
||||
icon_uri = g_strdup_printf ("%s/favicon.ico", path);
|
||||
g_free (path);
|
||||
}
|
||||
else
|
||||
icon_uri = g_strdup_printf ("%s/favicon.ico", view->uri);
|
||||
|
@ -910,7 +897,7 @@ _midori_web_view_load_icon (MidoriView* view)
|
|||
}
|
||||
else
|
||||
{
|
||||
priv = g_new0 (KatzeNetIconPriv, 1);
|
||||
priv = g_slice_new (KatzeNetIconPriv);
|
||||
priv->icon_file = icon_file;
|
||||
priv->icon_uri = icon_uri;
|
||||
priv->view = view;
|
||||
|
@ -962,7 +949,7 @@ midori_view_web_view_navigation_decision_cb (WebKitWebView* web_view
|
|||
MidoriView* view)
|
||||
{
|
||||
const gchar* uri = webkit_network_request_get_uri (request);
|
||||
if (g_str_has_prefix (uri, "mailto:") || g_str_has_prefix (uri, "tel:"))
|
||||
if (g_str_has_prefix (uri, "mailto:") || sokoke_external_uri (uri))
|
||||
{
|
||||
if (sokoke_show_uri (gtk_widget_get_screen (GTK_WIDGET (web_view)),
|
||||
uri, GDK_CURRENT_TIME, NULL))
|
||||
|
@ -995,6 +982,7 @@ webkit_web_view_load_committed_cb (WebKitWebView* web_view,
|
|||
MidoriView* view)
|
||||
{
|
||||
const gchar* uri;
|
||||
GList* children;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (view));
|
||||
|
||||
|
@ -1002,6 +990,11 @@ webkit_web_view_load_committed_cb (WebKitWebView* web_view,
|
|||
g_return_if_fail (uri != NULL);
|
||||
katze_assign (view->icon_uri, NULL);
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (view));
|
||||
for (; children; children = g_list_next (children))
|
||||
if (g_object_get_data (G_OBJECT (children->data), "midori-infobar-cb"))
|
||||
gtk_widget_destroy (children->data);
|
||||
|
||||
if (g_strcmp0 (uri, katze_item_get_uri (view->item)))
|
||||
{
|
||||
katze_assign (view->uri, sokoke_format_uri_for_display (uri));
|
||||
|
@ -1018,7 +1011,7 @@ webkit_web_view_load_committed_cb (WebKitWebView* web_view,
|
|||
|
||||
if (!strncmp (uri, "https", 5))
|
||||
{
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 14) && defined (HAVE_LIBSOUP_2_29_91)
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 14) && defined (HAVE_LIBSOUP_2_29_91)
|
||||
WebKitWebDataSource *source;
|
||||
WebKitNetworkRequest *request;
|
||||
SoupMessage *message;
|
||||
|
@ -1031,13 +1024,14 @@ webkit_web_view_load_committed_cb (WebKitWebView* web_view,
|
|||
&& soup_message_get_flags (message) & SOUP_MESSAGE_CERTIFICATE_TRUSTED)
|
||||
view->security = MIDORI_SECURITY_TRUSTED;
|
||||
else
|
||||
#endif
|
||||
#endif
|
||||
view->security = MIDORI_SECURITY_UNKNOWN;
|
||||
}
|
||||
else
|
||||
view->security = MIDORI_SECURITY_NONE;
|
||||
g_object_notify (G_OBJECT (view), "security");
|
||||
|
||||
view->find_links = -1;
|
||||
midori_view_update_load_status (view, MIDORI_LOAD_COMMITTED);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (view));
|
||||
|
@ -1134,6 +1128,180 @@ midori_view_web_view_resource_request_cb (WebKitWebView* web_view,
|
|||
}
|
||||
#endif
|
||||
|
||||
#define HAVE_GTK_INFO_BAR GTK_CHECK_VERSION (2, 18, 0)
|
||||
|
||||
#if HAVE_GTK_INFO_BAR
|
||||
static void
|
||||
midori_view_infobar_response_cb (GtkWidget* infobar,
|
||||
gint response,
|
||||
gpointer data_object)
|
||||
{
|
||||
void (*response_cb) (GtkWidget*, gint, gpointer);
|
||||
response_cb = g_object_get_data (G_OBJECT (infobar), "midori-infobar-cb");
|
||||
response_cb (infobar, response, data_object);
|
||||
gtk_widget_destroy (infobar);
|
||||
}
|
||||
#else
|
||||
static void
|
||||
midori_view_info_bar_button_cb (GtkWidget* button,
|
||||
gpointer data_object)
|
||||
{
|
||||
GtkWidget* infobar = gtk_widget_get_parent (gtk_widget_get_parent (button));
|
||||
gint response = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "midori-infobar-response"));
|
||||
void (*response_cb) (GtkWidget*, gint, gpointer);
|
||||
response_cb = g_object_get_data (G_OBJECT (infobar), "midori-infobar-cb");
|
||||
response_cb (infobar, response, data_object);
|
||||
gtk_widget_destroy (infobar);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* midori_view_add_info_bar
|
||||
* @view: a #MidoriView
|
||||
* @message_type: a #GtkMessageType
|
||||
* @message: a message string
|
||||
* @response_cb: a response callback
|
||||
* @user_data: user data passed to the callback
|
||||
* @first_button_text: button text or stock ID
|
||||
* @...: first response ID, then more text - response ID pairs
|
||||
*
|
||||
* Adds an infobar (or equivalent) to the view. Activation of a
|
||||
* button invokes the specified callback. The infobar is
|
||||
* automatically destroyed if the location changes or reloads.
|
||||
*
|
||||
* Return value: an infobar widget
|
||||
*
|
||||
* Since: 0.2.9
|
||||
**/
|
||||
GtkWidget*
|
||||
midori_view_add_info_bar (MidoriView* view,
|
||||
GtkMessageType message_type,
|
||||
const gchar* message,
|
||||
GCallback response_cb,
|
||||
gpointer data_object,
|
||||
const gchar* first_button_text,
|
||||
...)
|
||||
{
|
||||
GtkWidget* infobar;
|
||||
GtkWidget* action_area;
|
||||
GtkWidget* content_area;
|
||||
va_list args;
|
||||
const gchar* button_text;
|
||||
va_start (args, first_button_text);
|
||||
|
||||
#if HAVE_GTK_INFO_BAR
|
||||
infobar = gtk_info_bar_new ();
|
||||
for (button_text = first_button_text; button_text;
|
||||
button_text = va_arg (args, const gchar*))
|
||||
{
|
||||
gint response_id = va_arg (args, gint);
|
||||
gtk_info_bar_add_button (GTK_INFO_BAR (infobar),
|
||||
button_text, response_id);
|
||||
}
|
||||
gtk_info_bar_set_message_type (GTK_INFO_BAR (infobar), message_type);
|
||||
content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (infobar));
|
||||
action_area = gtk_info_bar_get_action_area (GTK_INFO_BAR (infobar));
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (action_area),
|
||||
GTK_ORIENTATION_HORIZONTAL);
|
||||
g_signal_connect (infobar, "response",
|
||||
G_CALLBACK (midori_view_infobar_response_cb), data_object);
|
||||
#else
|
||||
infobar = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (infobar), 4);
|
||||
|
||||
content_area = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (infobar), content_area, TRUE, TRUE, 0);
|
||||
action_area = gtk_hbutton_box_new ();
|
||||
for (button_text = first_button_text; button_text;
|
||||
button_text = va_arg (args, const gchar*))
|
||||
{
|
||||
gint response_id = va_arg (args, gint);
|
||||
GtkWidget* button = gtk_button_new_with_mnemonic (button_text);
|
||||
g_object_set_data (G_OBJECT (button), "midori-infobar-response",
|
||||
GINT_TO_POINTER (response_id));
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (midori_view_info_bar_button_cb), data_object);
|
||||
gtk_box_pack_start (GTK_BOX (action_area), button, FALSE, FALSE, 0);
|
||||
if (response_id == GTK_RESPONSE_HELP)
|
||||
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (action_area),
|
||||
button, TRUE);
|
||||
}
|
||||
gtk_box_pack_start (GTK_BOX (infobar), action_area, FALSE, FALSE, 0);
|
||||
#endif
|
||||
|
||||
va_end (args);
|
||||
gtk_container_add (GTK_CONTAINER (content_area), gtk_label_new (message));
|
||||
gtk_widget_show_all (infobar);
|
||||
gtk_box_pack_start (GTK_BOX (view), infobar, FALSE, FALSE, 0);
|
||||
gtk_box_reorder_child (GTK_BOX (view), infobar, 0);
|
||||
g_object_set_data (G_OBJECT (infobar), "midori-infobar-cb", response_cb);
|
||||
return infobar;
|
||||
}
|
||||
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 14)
|
||||
static void
|
||||
midori_view_database_response_cb (GtkWidget* infobar,
|
||||
gint response,
|
||||
WebKitWebDatabase* database)
|
||||
{
|
||||
if (response != GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
WebKitSecurityOrigin* origin = webkit_web_database_get_security_origin (database);
|
||||
webkit_security_origin_set_web_database_quota (origin, 0);
|
||||
webkit_web_database_remove (database);
|
||||
}
|
||||
/* TODO: Remember the decision */
|
||||
}
|
||||
|
||||
static void
|
||||
midori_view_web_view_database_quota_exceeded_cb (WebKitWebView* web_view,
|
||||
WebKitWebFrame* web_frame,
|
||||
WebKitWebDatabase* database,
|
||||
MidoriView* view)
|
||||
{
|
||||
const gchar* uri = webkit_web_frame_get_uri (web_frame);
|
||||
const gchar* hostname = sokoke_hostname_from_uri (uri, NULL);
|
||||
gchar* message = g_strdup_printf (_("%s wants to save an HTML5 database."),
|
||||
hostname && *hostname ? hostname : uri);
|
||||
midori_view_add_info_bar (view, GTK_MESSAGE_QUESTION, message,
|
||||
G_CALLBACK (midori_view_database_response_cb), database,
|
||||
_("_Deny"), GTK_RESPONSE_REJECT, _("_Allow"), GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
g_free (message);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 23)
|
||||
static void
|
||||
midori_view_location_response_cb (GtkWidget* infobar,
|
||||
gint response,
|
||||
WebKitGeolocationPolicyDecision* decision)
|
||||
{
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
webkit_geolocation_policy_allow (decision);
|
||||
else
|
||||
webkit_geolocation_policy_deny (decision);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
midori_view_web_view_geolocation_decision_cb (WebKitWebView* web_view,
|
||||
WebKitWebFrame* web_frame,
|
||||
WebKitGeolocationPolicyDecision* decision,
|
||||
MidoriView* view)
|
||||
{
|
||||
const gchar* uri = webkit_web_frame_get_uri (web_frame);
|
||||
const gchar* hostname = sokoke_hostname_from_uri (uri, NULL);
|
||||
gchar* message = g_strdup_printf (_("%s wants to know your location."),
|
||||
hostname && *hostname ? hostname : uri);
|
||||
midori_view_add_info_bar (view, GTK_MESSAGE_QUESTION,
|
||||
message, G_CALLBACK (midori_view_location_response_cb), decision,
|
||||
_("_Deny"), GTK_RESPONSE_REJECT, _("_Allow"), GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
g_free (message);
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
midori_view_load_alternate_string (MidoriView* view,
|
||||
const gchar* data,
|
||||
|
@ -1438,6 +1606,35 @@ webkit_web_view_hovering_over_link_cb (WebKitWebView* web_view,
|
|||
g_object_set (view, "statusbar-text", link_uri, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
midori_view_ensure_link_uri (MidoriView* view,
|
||||
gint *x,
|
||||
gint *y)
|
||||
{
|
||||
g_return_if_fail (MIDORI_IS_VIEW (view));
|
||||
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 15)
|
||||
if (view->web_view && gtk_widget_get_window (view->web_view))
|
||||
{
|
||||
gint ex, ey;
|
||||
GdkEventButton event;
|
||||
|
||||
gdk_window_get_pointer (gtk_widget_get_window (view->web_view), &ex, &ey, NULL);
|
||||
if (x != NULL)
|
||||
*x = ex;
|
||||
if (y != NULL)
|
||||
*y = ey;
|
||||
|
||||
event.x = ex;
|
||||
event.y = ey;
|
||||
katze_object_assign (view->hit_test, webkit_web_view_get_hit_test_result (
|
||||
WEBKIT_WEB_VIEW (view->web_view), &event));
|
||||
katze_assign (view->link_uri,
|
||||
katze_object_get_string (view->hit_test, "link-uri"));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#define MIDORI_KEYS_MODIFIER_MASK (GDK_SHIFT_MASK | GDK_CONTROL_MASK \
|
||||
| GDK_MOD1_MASK | GDK_META_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK )
|
||||
|
||||
|
@ -1453,6 +1650,7 @@ gtk_widget_button_press_event_cb (WebKitWebView* web_view,
|
|||
gboolean background;
|
||||
|
||||
event->state = event->state & MIDORI_KEYS_MODIFIER_MASK;
|
||||
midori_view_ensure_link_uri (view, NULL, NULL);
|
||||
link_uri = midori_view_get_link_uri (view);
|
||||
|
||||
switch (event->button)
|
||||
|
@ -1599,8 +1797,92 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
|
|||
MidoriView* view)
|
||||
{
|
||||
guint character;
|
||||
gint digit = g_ascii_digit_value (event->keyval);
|
||||
|
||||
if (event->keyval == '.' || event->keyval == '/' || event->keyval == GDK_KP_Divide)
|
||||
event->state = event->state & MIDORI_KEYS_MODIFIER_MASK;
|
||||
|
||||
/* Find links by number: . to show links, type number, Return to go */
|
||||
if (event->keyval == '.'
|
||||
|| (view->find_links > -1 && (digit != -1 || event->keyval == GDK_Return)))
|
||||
{
|
||||
WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (web_view);
|
||||
JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
|
||||
gchar* result;
|
||||
|
||||
if (view->find_links == -1)
|
||||
{
|
||||
result = sokoke_js_script_eval (js_context,
|
||||
"(function (selector, rule) { "
|
||||
" var style = document.createElement ('style');"
|
||||
" style.setAttribute ('type', 'text/css');"
|
||||
" var heads = document.getElementsByTagName ('head');"
|
||||
" heads[0].appendChild (style);"
|
||||
" document.styleSheets[0].insertRule (selector + ' ' + rule);"
|
||||
" } )"
|
||||
" ('.midoriHKD87346', '{ "
|
||||
" font-size:small !important; font-weight:bold !important;"
|
||||
" z-index:500; border-radius:0.3em; line-height:1 !important;"
|
||||
" background: white !important; color: black !important;"
|
||||
" border:1px solid gray; padding:0 0.1em !important;"
|
||||
" position:absolute; display:inline !important; }');"
|
||||
"var links = document.getElementsByTagName ('a');"
|
||||
"for (i in links) {"
|
||||
" var child = document.createElement ('span');"
|
||||
" child.setAttribute ('class', 'midoriHKD87346');"
|
||||
" child.appendChild (document.createTextNode (i));"
|
||||
" if (links[i].insertBefore)"
|
||||
" links[i].insertBefore (child); }",
|
||||
NULL);
|
||||
view->find_links = 0;
|
||||
}
|
||||
else if (digit != -1 || event->keyval == GDK_Return)
|
||||
{
|
||||
gchar* script;
|
||||
if (event->keyval != GDK_Return)
|
||||
{
|
||||
if (view->find_links > -1)
|
||||
view->find_links *= 10;
|
||||
view->find_links += digit;
|
||||
}
|
||||
script = g_strdup_printf (
|
||||
"var links = document.getElementsByClassName ('midoriHKD87346');"
|
||||
"var i = %d; var return_key = %d;"
|
||||
"if (return_key || typeof links[i * 10] == 'undefined') {"
|
||||
" for (var j = 0; j < links.length; j++)"
|
||||
" links[j].style.display = 'none !important';"
|
||||
" links[i].parentNode.href; }",
|
||||
view->find_links, event->keyval == GDK_Return);
|
||||
result = sokoke_js_script_eval (js_context, script, NULL);
|
||||
if (strcmp (result, "undefined"))
|
||||
{
|
||||
view->find_links = -1;
|
||||
if (MIDORI_MOD_NEW_TAB (event->state))
|
||||
{
|
||||
gboolean background = view->open_tabs_in_the_background;
|
||||
if (MIDORI_MOD_BACKGROUND (event->state))
|
||||
background = !background;
|
||||
g_signal_emit (view, signals[NEW_TAB], 0, result, background);
|
||||
}
|
||||
else
|
||||
midori_view_set_uri (view, result);
|
||||
}
|
||||
g_free (script);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = sokoke_js_script_eval (js_context,
|
||||
"var links = document.getElementsByClassName ('midoriHKD87346');"
|
||||
"for (var i = 0; i < links.length; i++)"
|
||||
" links[i].style.display = 'none !important';",
|
||||
NULL);
|
||||
view->find_links = -1;
|
||||
}
|
||||
g_free (result);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Find inline */
|
||||
if (event->keyval == ',' || event->keyval == '/' || event->keyval == GDK_KP_Divide)
|
||||
character = '\0';
|
||||
else if (view->find_while_typing)
|
||||
character = gdk_unicode_to_keyval (event->keyval);
|
||||
|
@ -1669,7 +1951,7 @@ static void
|
|||
midori_web_view_menu_web_app_activate_cb (GtkWidget* widget,
|
||||
MidoriView* view)
|
||||
{
|
||||
sokoke_spawn_program ("midori -a", view->link_uri, FALSE);
|
||||
sokoke_spawn_app (view->link_uri, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1761,7 +2043,7 @@ midori_web_view_menu_video_download_activate_cb (GtkWidget* widget,
|
|||
MidoriView* view)
|
||||
{
|
||||
gchar* uri = katze_object_get_string (view->hit_test, "media-uri");
|
||||
sokoke_spawn_program (view->download_manager, uri, FALSE);
|
||||
sokoke_spawn_program (view->download_manager, uri);
|
||||
g_free (uri);
|
||||
}
|
||||
#endif
|
||||
|
@ -1848,7 +2130,7 @@ static void
|
|||
midori_web_view_menu_download_activate_cb (GtkWidget* widget,
|
||||
MidoriView* view)
|
||||
{
|
||||
sokoke_spawn_program (view->download_manager, view->link_uri, FALSE);
|
||||
sokoke_spawn_program (view->download_manager, view->link_uri);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1950,20 +2232,12 @@ midori_view_populate_popup (MidoriView* view,
|
|||
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 15)
|
||||
gint x, y;
|
||||
GdkEventButton event;
|
||||
WebKitHitTestResultContext context;
|
||||
gboolean is_image;
|
||||
gboolean is_media;
|
||||
|
||||
gdk_window_get_pointer (view->web_view->window, &x, &y, NULL);
|
||||
event.x = x;
|
||||
event.y = y;
|
||||
katze_object_assign (view->hit_test,
|
||||
webkit_web_view_get_hit_test_result (web_view, &event));
|
||||
midori_view_ensure_link_uri (view, &x, &y);
|
||||
context = katze_object_get_int (view->hit_test, "context");
|
||||
/* Ensure view->link_uri is correct. */
|
||||
katze_assign (view->link_uri,
|
||||
katze_object_get_string (view->hit_test, "link-uri"));
|
||||
has_selection = context & WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION;
|
||||
/* Ensure view->selected_text */
|
||||
midori_view_has_selection (view);
|
||||
|
@ -2211,12 +2485,15 @@ midori_view_populate_popup (MidoriView* view,
|
|||
if (!view->link_uri && has_selection)
|
||||
{
|
||||
GtkWidget* window;
|
||||
KatzeArray* search_engines = NULL;
|
||||
|
||||
window = gtk_widget_get_toplevel (GTK_WIDGET (web_view));
|
||||
i = 0;
|
||||
if (katze_object_has_property (window, "search-engines"))
|
||||
search_engines = katze_object_get_object (window, "search-engines");
|
||||
|
||||
if (search_engines != NULL)
|
||||
{
|
||||
KatzeArray* search_engines;
|
||||
KatzeItem* item;
|
||||
GtkWidget* sub_menu = gtk_menu_new ();
|
||||
|
||||
|
@ -2224,7 +2501,6 @@ midori_view_populate_popup (MidoriView* view,
|
|||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), sub_menu);
|
||||
gtk_menu_shell_insert (menu_shell, menuitem, 1);
|
||||
|
||||
search_engines = katze_object_get_object (window, "search-engines");
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, search_engines)
|
||||
{
|
||||
GdkPixbuf* pixbuf;
|
||||
|
@ -2413,7 +2689,8 @@ midori_view_populate_popup (MidoriView* view,
|
|||
gtk_action_group_get_action (actions, "BookmarkAdd"));
|
||||
gtk_menu_shell_append (menu_shell, menuitem);
|
||||
|
||||
if (view->speed_dial_in_new_tabs && !midori_view_is_blank (view))
|
||||
if (view->speed_dial_in_new_tabs && !midori_view_is_blank (view)
|
||||
&& strcmp ("/", sokoke_set_config_dir (NULL)))
|
||||
{
|
||||
menuitem = sokoke_action_create_popup_menu_item (
|
||||
gtk_action_group_get_action (actions, "AddSpeedDial"));
|
||||
|
@ -2422,7 +2699,6 @@ midori_view_populate_popup (MidoriView* view,
|
|||
menuitem = sokoke_action_create_popup_menu_item (
|
||||
gtk_action_group_get_action (actions, "AddDesktopShortcut"));
|
||||
gtk_menu_shell_append (menu_shell, menuitem);
|
||||
gtk_widget_set_no_show_all (menuitem, TRUE);
|
||||
#endif
|
||||
|
||||
menuitem = sokoke_action_create_popup_menu_item (
|
||||
|
@ -2472,15 +2748,14 @@ midori_view_web_view_tap_and_hold_cb (GtkWidget* web_view,
|
|||
|
||||
/* Emulate a pointer motion above the tap position
|
||||
and a right click at the according position. */
|
||||
gdk_window_get_pointer (web_view->window, &x, &y, NULL);
|
||||
event.any.window = gtk_widget_get_window (web_view);
|
||||
gdk_window_get_pointer (event.any.window, &x, &y, NULL);
|
||||
event.any.type = GDK_MOTION_NOTIFY;
|
||||
event.any.window = web_view->window;
|
||||
event.motion.x = x;
|
||||
event.motion.y = y;
|
||||
g_signal_emit_by_name (web_view, "motion-notify-event", &event, &result);
|
||||
|
||||
event.any.type = GDK_BUTTON_PRESS;
|
||||
event.any.window = web_view->window;
|
||||
event.button.axes = NULL;
|
||||
event.button.x = x;
|
||||
event.button.y = y;
|
||||
|
@ -2766,7 +3041,7 @@ midori_view_notify_vadjustment_cb (MidoriView* view,
|
|||
g_object_unref (vadjustment);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
katze_net_object_maybe_unref (gpointer object)
|
||||
{
|
||||
if (object)
|
||||
|
@ -2794,6 +3069,7 @@ midori_view_init (MidoriView* view)
|
|||
view->link_uri = NULL;
|
||||
view->selected_text = NULL;
|
||||
view->news_feeds = katze_array_new (KATZE_TYPE_ITEM);
|
||||
view->find_links = -1;
|
||||
|
||||
view->item = katze_item_new ();
|
||||
|
||||
|
@ -2849,8 +3125,6 @@ midori_view_finalize (GObject* object)
|
|||
katze_assign (view->download_manager, NULL);
|
||||
katze_assign (view->news_aggregator, NULL);
|
||||
|
||||
katze_object_assign (view->net, NULL);
|
||||
|
||||
G_OBJECT_CLASS (midori_view_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -2890,9 +3164,6 @@ midori_view_set_property (GObject* object,
|
|||
case PROP_SETTINGS:
|
||||
midori_view_set_settings (view, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_NET:
|
||||
katze_object_assign (view->net, g_value_dup_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -2945,9 +3216,6 @@ midori_view_get_property (GObject* object,
|
|||
case PROP_SETTINGS:
|
||||
g_value_set_object (value, view->settings);
|
||||
break;
|
||||
case PROP_NET:
|
||||
g_value_set_object (value, view->net);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -2989,6 +3257,9 @@ _midori_view_update_settings (MidoriView* view)
|
|||
{
|
||||
gboolean zoom_text_and_images, kinetic_scrolling;
|
||||
|
||||
g_free (view->download_manager);
|
||||
g_free (view->news_aggregator);
|
||||
|
||||
g_object_get (view->settings,
|
||||
"speed-dial-in-new-tabs", &view->speed_dial_in_new_tabs,
|
||||
"download-manager", &view->download_manager,
|
||||
|
@ -3057,17 +3328,11 @@ midori_view_settings_notify_cb (MidoriWebSettings* settings,
|
|||
g_object_get_property (G_OBJECT (view->settings), name, &value);
|
||||
|
||||
if (name == g_intern_string ("speed-dial-in-new-tabs"))
|
||||
{
|
||||
view->speed_dial_in_new_tabs = g_value_get_boolean (&value);
|
||||
}
|
||||
else if (name == g_intern_string ("download-manager"))
|
||||
{
|
||||
katze_assign (view->download_manager, g_value_dup_string (&value));
|
||||
}
|
||||
else if (name == g_intern_string ("news-aggregator"))
|
||||
{
|
||||
katze_assign (view->news_aggregator, g_value_dup_string (&value));
|
||||
}
|
||||
else if (name == g_intern_string ("zoom-text-and-images"))
|
||||
{
|
||||
if (view->web_view)
|
||||
|
@ -3086,25 +3351,15 @@ midori_view_settings_notify_cb (MidoriWebSettings* settings,
|
|||
view->close_buttons_on_tabs);
|
||||
}
|
||||
else if (name == g_intern_string ("open-new-pages-in"))
|
||||
{
|
||||
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"))
|
||||
{
|
||||
view->middle_click_opens_selection = g_value_get_boolean (&value);
|
||||
}
|
||||
else if (name == g_intern_string ("open-tabs-in-the-background"))
|
||||
{
|
||||
view->open_tabs_in_the_background = g_value_get_boolean (&value);
|
||||
}
|
||||
else if (name == g_intern_string ("find-while-typing"))
|
||||
{
|
||||
view->find_while_typing = g_value_get_boolean (&value);
|
||||
}
|
||||
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
@ -3249,11 +3504,10 @@ static gboolean
|
|||
midori_view_web_inspector_show_window_cb (gpointer inspector,
|
||||
MidoriView* view)
|
||||
{
|
||||
GtkWidget* inspector_view;
|
||||
GtkWidget* window;
|
||||
GtkWidget* inspector_view = katze_object_get_object (inspector, "web-view");
|
||||
GtkWidget* window = gtk_widget_get_toplevel (inspector_view);
|
||||
g_object_unref (inspector_view);
|
||||
|
||||
g_object_get (inspector, "web-view", &inspector_view, NULL);
|
||||
window = gtk_widget_get_toplevel (inspector_view);
|
||||
if (!window)
|
||||
return FALSE;
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
|
@ -3276,13 +3530,13 @@ midori_view_web_inspector_detach_window_cb (gpointer inspector,
|
|||
{
|
||||
GtkWidget* inspector_view = katze_object_get_object (inspector, "web-view");
|
||||
GtkWidget* parent = gtk_widget_get_parent (inspector_view);
|
||||
g_object_unref (inspector_view);
|
||||
if (GTK_IS_WINDOW (parent))
|
||||
return FALSE;
|
||||
gtk_widget_hide (parent);
|
||||
gtk_container_remove (GTK_CONTAINER (parent), inspector_view);
|
||||
midori_view_web_inspector_construct_window (inspector,
|
||||
WEBKIT_WEB_VIEW (view->web_view), inspector_view, view);
|
||||
g_object_unref (inspector_view);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -3313,6 +3567,14 @@ midori_view_construct_web_view (MidoriView* view)
|
|||
"signal::resource-request-starting",
|
||||
midori_view_web_view_resource_request_cb, view,
|
||||
#endif
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 14)
|
||||
"signal::database-quota-exceeded",
|
||||
midori_view_web_view_database_quota_exceeded_cb, view,
|
||||
#endif
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 23)
|
||||
"signal::geolocation-policy-decision-requested",
|
||||
midori_view_web_view_geolocation_decision_cb, view,
|
||||
#endif
|
||||
"signal::load-started",
|
||||
webkit_web_view_load_started_cb, view,
|
||||
"signal::load-committed",
|
||||
|
@ -3485,7 +3747,6 @@ midori_view_set_uri (MidoriView* view,
|
|||
"{set_thumb_normal}", _("Medium"),
|
||||
"{set_thumb_big}", _("Big"), NULL);
|
||||
|
||||
|
||||
midori_view_load_alternate_string (view,
|
||||
data, res_root, "about:blank", NULL);
|
||||
|
||||
|
@ -3672,9 +3933,7 @@ midori_view_set_uri (MidoriView* view,
|
|||
g_free (exception);
|
||||
}
|
||||
}
|
||||
else if (g_str_has_prefix (uri, "mailto:")
|
||||
|| g_str_has_prefix (uri, "tel:")
|
||||
|| g_str_has_prefix (uri, "callto:"))
|
||||
else if (g_str_has_prefix (uri, "mailto:") || sokoke_external_uri (uri))
|
||||
{
|
||||
sokoke_show_uri (NULL, uri, GDK_CURRENT_TIME, NULL);
|
||||
}
|
||||
|
@ -3747,7 +4006,6 @@ midori_view_get_icon_uri (MidoriView* view)
|
|||
return view->icon_uri;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* midori_view_get_display_uri:
|
||||
* @view: a #MidoriView
|
||||
|
@ -3964,7 +4222,6 @@ midori_view_tab_label_menu_open_cb (GtkWidget* menuitem,
|
|||
midori_browser_set_current_tab (browser, view);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
midori_view_tab_label_menu_duplicate_tab_cb (GtkWidget* menuitem,
|
||||
MidoriView* view)
|
||||
|
@ -4468,17 +4725,17 @@ midori_view_reload (MidoriView* view,
|
|||
|
||||
g_return_if_fail (MIDORI_IS_VIEW (view));
|
||||
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 14)
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 14)
|
||||
title = NULL;
|
||||
#elif WEBKIT_CHECK_VERSION (1, 1, 6)
|
||||
#elif WEBKIT_CHECK_VERSION (1, 1, 6)
|
||||
/* WebKit 1.1.6 doesn't handle "alternate content" flawlessly,
|
||||
so reloading via Javascript works but not via API calls. */
|
||||
title = g_strdup_printf (_("Error - %s"), view->uri);
|
||||
#else
|
||||
#else
|
||||
/* Error pages are special, we want to try loading the destination
|
||||
again, not the error page which isn't even a proper page */
|
||||
title = g_strdup_printf (_("Error - %s"), view->uri);
|
||||
#endif
|
||||
#endif
|
||||
if (view->title && title && strstr (title, view->title))
|
||||
webkit_web_view_open (WEBKIT_WEB_VIEW (view->web_view), view->uri);
|
||||
else if (!(view->uri && *view->uri && strncmp (view->uri, "about:", 6)))
|
||||
|
@ -4597,42 +4854,12 @@ midori_view_get_previous_page (MidoriView* view)
|
|||
web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view));
|
||||
js_context = webkit_web_frame_get_global_context (web_frame);
|
||||
katze_assign (uri, sokoke_js_script_eval (js_context,
|
||||
"(function (g) {"
|
||||
"var ind = ['prev','←','«','<'];"
|
||||
"var nind = ['next','→','»','>'];"
|
||||
"for (h in g) {"
|
||||
"l = g[h];"
|
||||
"for (i in l)"
|
||||
"if (l[i].rel && (l[i].rel == ind[0]))"
|
||||
"return l[i].href;"
|
||||
"for (j in ind)"
|
||||
"for (i in l)"
|
||||
"if (l[i].innerHTML"
|
||||
"&& (l[i].innerHTML.toLowerCase ().indexOf (ind[j]) != -1)"
|
||||
"&& (l[i].innerHTML.toLowerCase ().indexOf (nind[j]) == -1))"
|
||||
"return l[i].href;"
|
||||
"var wa = window.location.href.split (/\\d+/);"
|
||||
"var wn = window.location.href.split (/[^\\d]+/);"
|
||||
"wn = wn.slice (1,wn.length - 1);"
|
||||
"var cand = [];"
|
||||
"for (i in wn)"
|
||||
"{"
|
||||
"cand[i] = '';"
|
||||
"for (j = 0; j <= i; j++)"
|
||||
"{"
|
||||
"cand[i] += wa[j];"
|
||||
"if (wn[j])"
|
||||
"cand[i] += parseInt (wn[j]) - ((i == j) ? 1 : 0);"
|
||||
"}"
|
||||
"}"
|
||||
"for (j in cand)"
|
||||
"for (i in l)"
|
||||
"if (cand[j].length && l[i].href && (l[i].href.indexOf (cand[j]) == 0))"
|
||||
"return l[i].href;"
|
||||
"}"
|
||||
"return 0;"
|
||||
"}) ([document.getElementsByTagName ('link'),"
|
||||
"document.getElementsByTagName ('a')]);", NULL));
|
||||
"(function (l) { for (i in l) "
|
||||
"if ((l[i].rel && l[i].rel == 'prev') "
|
||||
" || (l[i].innerHTML"
|
||||
" && l[i].innerHTML.toLowerCase ().indexOf ('prev') != -1)) "
|
||||
"{ return l[i].href; } return 0; })("
|
||||
"document.getElementsByTagName ('a'));", NULL));
|
||||
return uri && uri[0] != '0' ? uri : NULL;
|
||||
}
|
||||
|
||||
|
@ -4661,44 +4888,15 @@ midori_view_get_next_page (MidoriView* view)
|
|||
web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view));
|
||||
js_context = webkit_web_frame_get_global_context (web_frame);
|
||||
katze_assign (uri, sokoke_js_script_eval (js_context,
|
||||
"(function (g) {"
|
||||
"var ind = ['next','→','»','>'];"
|
||||
"var nind = ['prev','←','«','<'];"
|
||||
"for (h in g) {"
|
||||
"l = g[h];"
|
||||
"for (i in l)"
|
||||
"if (l[i].rel && (l[i].rel == ind[0]))"
|
||||
"return l[i].href;"
|
||||
"for (j in ind)"
|
||||
"for (i in l)"
|
||||
"if (l[i].innerHTML"
|
||||
"&& (l[i].innerHTML.toLowerCase ().indexOf (ind[j]) != -1)"
|
||||
"&& (l[i].innerHTML.toLowerCase ().indexOf (nind[j]) == -1))"
|
||||
"return l[i].href;"
|
||||
"var wa = window.location.href.split (/\\d+/);"
|
||||
"var wn = window.location.href.split (/[^\\d]+/);"
|
||||
"wn = wn.slice (1,wn.length - 1);"
|
||||
"var cand = [];"
|
||||
"for (i in wn)"
|
||||
"{"
|
||||
"cand[i] = '';"
|
||||
"for (j = 0; j <= i; j++)"
|
||||
"{"
|
||||
"cand[i] += wa[j];"
|
||||
"if (wn[j])"
|
||||
"cand[i] += parseInt (wn[j]) + ((i == j) ? 1 : 0);"
|
||||
"}"
|
||||
"}"
|
||||
"for (j in cand)"
|
||||
"for (i in l)"
|
||||
"if (cand[j].length && l[i].href && (l[i].href.indexOf (cand[j]) == 0))"
|
||||
"return l[i].href;"
|
||||
"}"
|
||||
"return 0;"
|
||||
"}) ([document.getElementsByTagName ('link'),"
|
||||
"document.getElementsByTagName ('a')]);", NULL));
|
||||
"(function (l) { for (i in l) "
|
||||
"if ((l[i].rel && l[i].rel == 'next') "
|
||||
" || (l[i].innerHTML"
|
||||
" && l[i].innerHTML.toLowerCase ().indexOf ('next') != -1)) "
|
||||
"{ return l[i].href; } return 0; })("
|
||||
"document.getElementsByTagName ('a'));", NULL));
|
||||
return uri && uri[0] != '0' ? uri : NULL;
|
||||
}
|
||||
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 5)
|
||||
static GtkWidget*
|
||||
midori_view_print_create_custom_widget_cb (GtkPrintOperation* operation,
|
||||
|
@ -4765,9 +4963,9 @@ midori_view_print (MidoriView* view)
|
|||
#if WEBKIT_CHECK_VERSION (1, 1, 5)
|
||||
operation = gtk_print_operation_new ();
|
||||
gtk_print_operation_set_custom_tab_label (operation, _("Features"));
|
||||
#if GTK_CHECK_VERSION (2, 18, 0)
|
||||
#if GTK_CHECK_VERSION (2, 18, 0)
|
||||
gtk_print_operation_set_embed_page_setup (operation, TRUE);
|
||||
#endif
|
||||
#endif
|
||||
g_signal_connect (operation, "create-custom-widget",
|
||||
G_CALLBACK (midori_view_print_create_custom_widget_cb), view);
|
||||
g_signal_connect (operation, "custom-widget-apply",
|
||||
|
@ -4927,6 +5125,8 @@ midori_view_get_snapshot (MidoriView* view,
|
|||
gint height)
|
||||
{
|
||||
GtkWidget* web_view;
|
||||
GdkWindow* window;
|
||||
GtkAllocation allocation;
|
||||
gboolean fast;
|
||||
gint x, y, w, h;
|
||||
GdkRectangle rect;
|
||||
|
@ -4938,12 +5138,14 @@ midori_view_get_snapshot (MidoriView* view,
|
|||
|
||||
g_return_val_if_fail (MIDORI_IS_VIEW (view), NULL);
|
||||
web_view = view->web_view;
|
||||
g_return_val_if_fail (web_view->window, NULL);
|
||||
window = gtk_widget_get_window (web_view);
|
||||
g_return_val_if_fail (window != NULL, NULL);
|
||||
|
||||
x = web_view->allocation.x;
|
||||
y = web_view->allocation.y;
|
||||
w = web_view->allocation.width;
|
||||
h = web_view->allocation.height;
|
||||
gtk_widget_get_allocation (web_view, &allocation);
|
||||
x = allocation.x;
|
||||
y = allocation.y;
|
||||
w = allocation.width;
|
||||
h = allocation.height;
|
||||
|
||||
/* If width and height are both negative, we try to render faster at
|
||||
the cost of correctness or beauty. Only a part of the page is
|
||||
|
@ -4963,15 +5165,14 @@ midori_view_get_snapshot (MidoriView* view,
|
|||
rect.width = w;
|
||||
rect.height = h;
|
||||
|
||||
pixmap = gdk_pixmap_new (web_view->window, w, h,
|
||||
gdk_drawable_get_depth (web_view->window));
|
||||
pixmap = gdk_pixmap_new (window, w, h, gdk_drawable_get_depth (window));
|
||||
event.expose.type = GDK_EXPOSE;
|
||||
event.expose.window = pixmap;
|
||||
event.expose.send_event = FALSE;
|
||||
event.expose.count = 0;
|
||||
event.expose.area.x = 0;
|
||||
event.expose.area.y = 0;
|
||||
gdk_drawable_get_size (GDK_DRAWABLE (web_view->window),
|
||||
gdk_drawable_get_size (GDK_DRAWABLE (window),
|
||||
&event.expose.area.width, &event.expose.area.height);
|
||||
event.expose.region = gdk_region_rectangle (&event.expose.area);
|
||||
|
||||
|
@ -5056,7 +5257,7 @@ thumb_view_load_status_cb (MidoriView* thumb_view,
|
|||
js = g_strdup_printf ("setThumbnail('%s','%s','%s');",
|
||||
dom_id, encoded, thumb_view->uri);
|
||||
webkit_web_view_execute_script (WEBKIT_WEB_VIEW (view->web_view), js);
|
||||
free (js);
|
||||
g_free (js);
|
||||
g_object_unref (img);
|
||||
|
||||
g_free (dom_id);
|
||||
|
@ -5106,7 +5307,7 @@ midori_view_speed_dial_inject_thumb (MidoriView* view,
|
|||
|
||||
if (!view->thumb_view)
|
||||
{
|
||||
view->thumb_view = midori_view_new (view->net);
|
||||
view->thumb_view = midori_view_new_with_uri (NULL, NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (notebook), view->thumb_view);
|
||||
/* We use an empty label. It's not invisible but at least hard to spot. */
|
||||
label = gtk_event_box_new ();
|
||||
|
|
|
@ -239,6 +239,14 @@ midori_view_populate_popup (MidoriView* view,
|
|||
GtkWidget* menu,
|
||||
gboolean manual);
|
||||
|
||||
GtkWidget*
|
||||
midori_view_add_info_bar (MidoriView* view,
|
||||
GtkMessageType message_type,
|
||||
const gchar* message,
|
||||
GCallback response_cb,
|
||||
gpointer user_data,
|
||||
const gchar* first_button_text,
|
||||
...);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ struct _MidoriWebSettings
|
|||
gchar* ident_string;
|
||||
|
||||
gint clear_private_data;
|
||||
gchar* clear_data;
|
||||
};
|
||||
|
||||
struct _MidoriWebSettingsClass
|
||||
|
@ -169,7 +170,8 @@ enum
|
|||
PROP_USER_AGENT,
|
||||
PROP_PREFERRED_LANGUAGES,
|
||||
|
||||
PROP_CLEAR_PRIVATE_DATA
|
||||
PROP_CLEAR_PRIVATE_DATA,
|
||||
PROP_CLEAR_DATA
|
||||
};
|
||||
|
||||
GType
|
||||
|
@ -988,6 +990,13 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
|
|||
0, G_MAXINT, 30,
|
||||
flags));
|
||||
|
||||
/**
|
||||
* MidoriWebSettings:remember-last-downloaded-files:
|
||||
*
|
||||
* Whether the last downloaded files are saved.
|
||||
*
|
||||
* Deprecated: 0.2.9
|
||||
**/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_REMEMBER_LAST_DOWNLOADED_FILES,
|
||||
g_param_spec_boolean (
|
||||
|
@ -1078,7 +1087,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
|
|||
/**
|
||||
* MidoriWebSettings:clear-private-data:
|
||||
*
|
||||
* The private data selected for deletion.
|
||||
* The core data selected for deletion.
|
||||
*
|
||||
* Since: 0.1.7
|
||||
*/
|
||||
|
@ -1091,6 +1100,22 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
|
|||
0, G_MAXINT, 0,
|
||||
flags));
|
||||
|
||||
/**
|
||||
* MidoriWebSettings:clear-data:
|
||||
*
|
||||
* The data selected for deletion, including extensions.
|
||||
*
|
||||
* Since: 0.2.9
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_CLEAR_DATA,
|
||||
g_param_spec_string (
|
||||
"clear-data",
|
||||
_("Clear data"),
|
||||
_("The data selected for deletion"),
|
||||
NULL,
|
||||
flags));
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1498,6 +1523,9 @@ midori_web_settings_set_property (GObject* object,
|
|||
case PROP_CLEAR_PRIVATE_DATA:
|
||||
web_settings->clear_private_data = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_CLEAR_DATA:
|
||||
katze_assign (web_settings->clear_data, g_value_dup_string (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -1726,6 +1754,9 @@ midori_web_settings_get_property (GObject* object,
|
|||
case PROP_CLEAR_PRIVATE_DATA:
|
||||
g_value_set_int (value, web_settings->clear_private_data);
|
||||
break;
|
||||
case PROP_CLEAR_DATA:
|
||||
g_value_set_string (value, web_settings->clear_data);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
|
|
@ -38,12 +38,12 @@ enum
|
|||
{
|
||||
MIDORI_CLEAR_NONE = 0,
|
||||
MIDORI_CLEAR_HISTORY = 1,
|
||||
MIDORI_CLEAR_COOKIES = 2,
|
||||
MIDORI_CLEAR_FLASH_COOKIES = 4,
|
||||
MIDORI_CLEAR_WEBSITE_ICONS = 8,
|
||||
MIDORI_CLEAR_COOKIES = 2, /* deprecated */
|
||||
MIDORI_CLEAR_FLASH_COOKIES = 4, /* deprecated */
|
||||
MIDORI_CLEAR_WEBSITE_ICONS = 8, /* deprecated */
|
||||
MIDORI_CLEAR_TRASH = 16,
|
||||
MIDORI_CLEAR_ON_QUIT = 32,
|
||||
MIDORI_CLEAR_WEB_CACHE = 64,
|
||||
MIDORI_CLEAR_WEB_CACHE = 64, /* deprecated */
|
||||
};
|
||||
|
||||
typedef enum
|
||||
|
|
157
midori/sokoke.c
157
midori/sokoke.c
|
@ -247,6 +247,20 @@ sokoke_show_uri_with_mime_type (GdkScreen* screen,
|
|||
return success;
|
||||
}
|
||||
|
||||
static void
|
||||
sokoke_open_with_response_cb (GtkWidget* dialog,
|
||||
gint response,
|
||||
GtkEntry* entry)
|
||||
{
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
const gchar* command = gtk_entry_get_text (entry);
|
||||
const gchar* uri = g_object_get_data (G_OBJECT (dialog), "uri");
|
||||
sokoke_spawn_program (command, uri);
|
||||
}
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
/**
|
||||
* sokoke_show_uri:
|
||||
* @screen: a #GdkScreen, or %NULL
|
||||
|
@ -268,7 +282,6 @@ sokoke_show_uri (GdkScreen* screen,
|
|||
guint32 timestamp,
|
||||
GError** error)
|
||||
{
|
||||
|
||||
#if HAVE_HILDON
|
||||
HildonURIAction* action = hildon_uri_get_default_action_by_uri (uri, NULL);
|
||||
return hildon_uri_open (uri, action, error);
|
||||
|
@ -281,9 +294,9 @@ sokoke_show_uri (GdkScreen* screen,
|
|||
GFile *file;
|
||||
gchar *free_uri;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen) || !screen, FALSE);
|
||||
g_return_val_if_fail (uri != NULL, FALSE);
|
||||
g_return_val_if_fail (!error || !*error, FALSE);
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen) || !screen, FALSE);
|
||||
|
||||
file = g_file_new_for_uri (uri);
|
||||
app_info = g_file_query_default_handler (file, NULL, error);
|
||||
|
@ -343,6 +356,11 @@ sokoke_show_uri (GdkScreen* screen,
|
|||
|
||||
const gchar* fallbacks [] = { "xdg-open", "exo-open", "gnome-open" };
|
||||
gsize i;
|
||||
GtkWidget* dialog;
|
||||
GtkWidget* box;
|
||||
gchar* filename;
|
||||
gchar* ms;
|
||||
GtkWidget* entry;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen) || !screen, FALSE);
|
||||
g_return_val_if_fail (uri != NULL, FALSE);
|
||||
|
@ -369,21 +387,40 @@ sokoke_show_uri (GdkScreen* screen,
|
|||
*error = NULL;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
dialog = gtk_dialog_new_with_buttons (_("Open with"), NULL, 0,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
|
||||
box = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
||||
filename = g_filename_from_uri (uri, NULL, NULL);
|
||||
ms = g_strdup_printf (_("Choose an application or command to open \"%s\":"),
|
||||
filename);
|
||||
gtk_box_pack_start (GTK_BOX (box), gtk_label_new (ms), TRUE, FALSE, 4);
|
||||
g_free (ms);
|
||||
entry = gtk_entry_new ();
|
||||
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (box), entry, TRUE, FALSE, 4);
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (sokoke_open_with_response_cb), entry);
|
||||
g_object_set_data_full (G_OBJECT (dialog), "uri",
|
||||
filename, (GDestroyNotify)g_free);
|
||||
gtk_widget_show_all (dialog);
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
gtk_widget_grab_focus (entry);
|
||||
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
gboolean
|
||||
sokoke_spawn_program (const gchar* command,
|
||||
const gchar* argument,
|
||||
gboolean filename)
|
||||
const gchar* argument)
|
||||
{
|
||||
GError* error;
|
||||
|
||||
g_return_val_if_fail (command != NULL, FALSE);
|
||||
g_return_val_if_fail (argument != NULL, FALSE);
|
||||
|
||||
if (filename)
|
||||
if (!g_strstr_len (argument, 8, "://"))
|
||||
{
|
||||
gboolean success;
|
||||
|
||||
|
@ -444,16 +481,19 @@ sokoke_spawn_program (const gchar* command,
|
|||
{
|
||||
/* FIXME: Implement Hildon specific version */
|
||||
gchar* uri_format;
|
||||
gchar* argument_quoted;
|
||||
gchar* command_ready;
|
||||
gchar** argv;
|
||||
|
||||
if ((uri_format = strstr (command, "%u")))
|
||||
uri_format[1] = 's';
|
||||
|
||||
argument_quoted = g_shell_quote (argument);
|
||||
if (strstr (command, "%s"))
|
||||
command_ready = g_strdup_printf (command, argument);
|
||||
command_ready = g_strdup_printf (command, argument_quoted);
|
||||
else
|
||||
command_ready = g_strconcat (command, " ", argument, NULL);
|
||||
command_ready = g_strconcat (command, " ", argument_quoted, NULL);
|
||||
g_free (argument_quoted);
|
||||
|
||||
error = NULL;
|
||||
if (!g_shell_parse_argv (command_ready, NULL, &argv, &error))
|
||||
|
@ -484,10 +524,30 @@ sokoke_spawn_program (const gchar* command,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
sokoke_spawn_app (const gchar* uri,
|
||||
gboolean inherit_config)
|
||||
{
|
||||
const gchar* executable = sokoke_get_argv (NULL)[0];
|
||||
/* "midori"
|
||||
"/usr/bin/midori"
|
||||
"c:/Program Files/Midori/bin/midori.exe" */
|
||||
gchar* quoted = g_shell_quote (executable);
|
||||
gchar* command;
|
||||
if (inherit_config)
|
||||
command = g_strconcat (quoted, " -c ", sokoke_set_config_dir (NULL),
|
||||
" -a", NULL);
|
||||
else
|
||||
command = g_strconcat (quoted, " -a", NULL);
|
||||
g_free (quoted);
|
||||
sokoke_spawn_program (command, uri);
|
||||
g_free (command);
|
||||
}
|
||||
|
||||
/**
|
||||
* sokoke_hostname_from_uri:
|
||||
* @uri: an URI string
|
||||
* @path: location of a string pointer
|
||||
* @path: location of a string, or %NULL
|
||||
*
|
||||
* Returns the hostname of the specified URI.
|
||||
*
|
||||
|
@ -503,10 +563,15 @@ sokoke_hostname_from_uri (const gchar* uri,
|
|||
|
||||
if ((hostname = strchr (uri, '/')))
|
||||
{
|
||||
gchar* pathname;
|
||||
if (hostname[1] == '/')
|
||||
hostname += 2;
|
||||
if ((*path = strchr (hostname, '/')))
|
||||
return g_strndup (hostname, *path - hostname);
|
||||
if ((pathname = strchr (hostname, '/')))
|
||||
{
|
||||
if (path != NULL)
|
||||
*path = pathname;
|
||||
return g_strndup (hostname, pathname - hostname);
|
||||
}
|
||||
else
|
||||
return g_strdup (hostname);
|
||||
}
|
||||
|
@ -674,6 +739,28 @@ sokoke_resolve_hostname (const gchar* hostname)
|
|||
return host_resolved == 1 ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
sokoke_external_uri (const gchar* uri)
|
||||
{
|
||||
gchar* scheme;
|
||||
GAppInfo* info;
|
||||
|
||||
if (!uri || !strncmp (uri, "http", 4)
|
||||
|| !strncmp (uri, "file", 4)
|
||||
|| !strncmp (uri, "about:", 6))
|
||||
return FALSE;
|
||||
|
||||
scheme = g_uri_parse_scheme (uri);
|
||||
if (!scheme)
|
||||
return FALSE;
|
||||
|
||||
info = g_app_info_get_default_for_uri_scheme (scheme);
|
||||
g_free (scheme);
|
||||
if (info)
|
||||
g_object_unref (info);
|
||||
return info != NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* sokoke_magic_uri:
|
||||
* @uri: a string typed by a user
|
||||
|
@ -696,8 +783,7 @@ sokoke_magic_uri (const gchar* uri)
|
|||
/* Just return if it's a javascript: or mailto: uri */
|
||||
if (!strncmp (uri, "javascript:", 11)
|
||||
|| !strncmp (uri, "mailto:", 7)
|
||||
|| !strncmp (uri, "tel:", 4)
|
||||
|| !strncmp (uri, "callto:", 7)
|
||||
|| sokoke_external_uri (uri)
|
||||
|| !strncmp (uri, "data:", 5)
|
||||
|| !strncmp (uri, "about:", 6))
|
||||
return g_strdup (uri);
|
||||
|
@ -917,6 +1003,7 @@ sokoke_xfce_header_new (const gchar* icon,
|
|||
if (sokoke_get_desktop () == SOKOKE_DESKTOP_XFCE)
|
||||
{
|
||||
GtkWidget* entry;
|
||||
GtkStyle* style;
|
||||
gchar* markup;
|
||||
GtkWidget* xfce_heading;
|
||||
GtkWidget* hbox;
|
||||
|
@ -927,8 +1014,9 @@ sokoke_xfce_header_new (const gchar* icon,
|
|||
|
||||
xfce_heading = gtk_event_box_new ();
|
||||
entry = gtk_entry_new ();
|
||||
style = gtk_widget_get_style (entry);
|
||||
gtk_widget_modify_bg (xfce_heading, GTK_STATE_NORMAL,
|
||||
&entry->style->base[GTK_STATE_NORMAL]);
|
||||
&style->base[GTK_STATE_NORMAL]);
|
||||
hbox = gtk_hbox_new (FALSE, 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
|
||||
if (icon)
|
||||
|
@ -939,7 +1027,7 @@ sokoke_xfce_header_new (const gchar* icon,
|
|||
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_widget_modify_fg (label, GTK_STATE_NORMAL
|
||||
, &entry->style->text[GTK_STATE_NORMAL]);
|
||||
, &style->text[GTK_STATE_NORMAL]);
|
||||
markup = g_strdup_printf ("<span size='large' weight='bold'>%s</span>",
|
||||
title);
|
||||
gtk_label_set_markup (GTK_LABEL (label), markup);
|
||||
|
@ -1208,6 +1296,7 @@ sokoke_action_create_popup_menu_item (GtkAction* action)
|
|||
}
|
||||
gtk_widget_set_sensitive (menuitem, sensitive);
|
||||
sokoke_widget_set_visible (menuitem, visible);
|
||||
gtk_widget_set_no_show_all (menuitem, TRUE);
|
||||
g_signal_connect_swapped (menuitem, "activate",
|
||||
G_CALLBACK (gtk_action_activate), action);
|
||||
|
||||
|
@ -1333,7 +1422,7 @@ sokoke_register_stock_items (void)
|
|||
gtk_icon_factory_add (factory, items[i].stock_id, icon_set);
|
||||
gtk_icon_set_unref (icon_set);
|
||||
}
|
||||
gtk_stock_add ((GtkStockItem*)items, G_N_ELEMENTS (items));
|
||||
gtk_stock_add_static ((GtkStockItem*)items, G_N_ELEMENTS (items));
|
||||
gtk_icon_factory_add_default (factory);
|
||||
g_object_unref (factory);
|
||||
|
||||
|
@ -1393,6 +1482,8 @@ sokoke_register_stock_items (void)
|
|||
*
|
||||
* Retrieves and/ or sets the base configuration folder.
|
||||
*
|
||||
* "/" means no configuration is saved.
|
||||
*
|
||||
* Return value: the configuration folder, or %NULL
|
||||
**/
|
||||
const gchar*
|
||||
|
@ -1957,3 +2048,37 @@ sokoke_accept_languages (const gchar* const * lang_names)
|
|||
|
||||
return langs_str;
|
||||
}
|
||||
|
||||
/**
|
||||
* sokoke_register_privacy_item:
|
||||
* @name: the name of the privacy item
|
||||
* @label: a user visible, localized label
|
||||
* @clear: a callback clearing data
|
||||
*
|
||||
* Registers an item to clear data, either via the
|
||||
* Clear Private Data dialogue or when Midori quits.
|
||||
*
|
||||
* Return value: a #GList if all arguments are %NULL
|
||||
**/
|
||||
GList*
|
||||
sokoke_register_privacy_item (const gchar* name,
|
||||
const gchar* label,
|
||||
GCallback clear)
|
||||
{
|
||||
static GList* items = NULL;
|
||||
SokokePrivacyItem* item;
|
||||
|
||||
if (name == NULL && label == NULL && clear == NULL)
|
||||
return items;
|
||||
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
g_return_val_if_fail (label != NULL, NULL);
|
||||
g_return_val_if_fail (clear != NULL, NULL);
|
||||
|
||||
item = g_new (SokokePrivacyItem, 1);
|
||||
item->name = g_strdup (name);
|
||||
item->label = g_strdup (label);
|
||||
item->clear = clear;
|
||||
items = g_list_append (items, item);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
|
||||
#if !GTK_CHECK_VERSION (2, 14, 0)
|
||||
#define gtk_dialog_get_content_area(dlg) dlg->vbox
|
||||
#define gtk_dialog_get_action_area(dlg) dlg->action_area
|
||||
#define gtk_widget_get_window(wdgt) wdgt->window
|
||||
#endif
|
||||
|
||||
#if !GTK_CHECK_VERSION (2, 16, 0)
|
||||
|
@ -50,6 +52,9 @@
|
|||
#define gtk_widget_has_focus(widget) GTK_WIDGET_HAS_FOCUS (widget)
|
||||
#define gtk_widget_get_visible(widget) GTK_WIDGET_VISIBLE (widget)
|
||||
#define gtk_widget_get_sensitive(widget) GTK_WIDGET_IS_SENSITIVE (widget)
|
||||
#define gtk_widget_set_can_focus(widget,flag) \
|
||||
GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS)
|
||||
#define gtk_widget_get_allocation(wdgt, alloc) *alloc = wdgt->allocation
|
||||
#endif
|
||||
|
||||
#if !GTK_CHECK_VERSION (2, 20, 0)
|
||||
|
@ -97,8 +102,11 @@ sokoke_show_uri (GdkScreen* screen,
|
|||
|
||||
gboolean
|
||||
sokoke_spawn_program (const gchar* command,
|
||||
const gchar* argument,
|
||||
gboolean quote);
|
||||
const gchar* argument);
|
||||
|
||||
void
|
||||
sokoke_spawn_app (const gchar* uri,
|
||||
gboolean inherit_config);
|
||||
|
||||
gchar* sokoke_search_uri (const gchar* uri,
|
||||
const gchar* keywords);
|
||||
|
@ -110,6 +118,9 @@ sokoke_hostname_from_uri (const gchar* uri,
|
|||
gchar*
|
||||
sokoke_uri_to_ascii (const gchar* uri);
|
||||
|
||||
gboolean
|
||||
sokoke_external_uri (const gchar* uri);
|
||||
|
||||
gchar*
|
||||
sokoke_magic_uri (const gchar* uri);
|
||||
|
||||
|
@ -256,4 +267,16 @@ gboolean
|
|||
sokoke_recursive_fork_protection (const gchar* uri,
|
||||
gboolean set_uri);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gchar* name;
|
||||
gchar* label;
|
||||
GCallback clear;
|
||||
} SokokePrivacyItem;
|
||||
|
||||
GList*
|
||||
sokoke_register_privacy_item (const gchar* name,
|
||||
const gchar* label,
|
||||
GCallback clear);
|
||||
|
||||
#endif /* !__SOKOKE_H__ */
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# WAF build script for midori
|
||||
# This file is licensed under the terms of the expat license, see the file EXPAT.
|
||||
|
||||
import Options
|
||||
import platform
|
||||
|
||||
progressive = True
|
||||
|
@ -30,8 +31,8 @@ if progressive:
|
|||
else:
|
||||
obj = bld.new_task_gen ('cc', 'program')
|
||||
obj.target = 'midori'
|
||||
obj.includes = '.. ../katze . ../panels'
|
||||
obj.find_sources_in_dirs ('../katze . ../panels')
|
||||
obj.includes = '.. ../katze . ../panels ../toolbars'
|
||||
obj.find_sources_in_dirs ('../katze . ../panels ../toolbars')
|
||||
obj.add_marshal_file ('marshal.list', 'midori_cclosure_marshal')
|
||||
obj.uselib = libs
|
||||
if bld.env['WINRC']:
|
||||
|
|
|
@ -1,402 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2008-2010 Christian Dywan <christian@twotoasts.de>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
See the file COPYING for the full license text.
|
||||
*/
|
||||
|
||||
#include "midori-console.h"
|
||||
|
||||
#include "midori-app.h"
|
||||
#include "midori-browser.h"
|
||||
#include "midori-stock.h"
|
||||
#include "midori-view.h"
|
||||
|
||||
#include "sokoke.h"
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
struct _MidoriConsole
|
||||
{
|
||||
GtkVBox parent_instance;
|
||||
|
||||
GtkWidget* toolbar;
|
||||
GtkWidget* treeview;
|
||||
MidoriApp* app;
|
||||
};
|
||||
|
||||
struct _MidoriConsoleClass
|
||||
{
|
||||
GtkVBoxClass parent_class;
|
||||
};
|
||||
|
||||
static void
|
||||
midori_console_viewable_iface_init (MidoriViewableIface* iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (MidoriConsole, midori_console, GTK_TYPE_VBOX,
|
||||
G_IMPLEMENT_INTERFACE (MIDORI_TYPE_VIEWABLE,
|
||||
midori_console_viewable_iface_init));
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_APP
|
||||
};
|
||||
|
||||
static void
|
||||
midori_console_set_property (GObject* object,
|
||||
guint prop_id,
|
||||
const GValue* value,
|
||||
GParamSpec* pspec);
|
||||
|
||||
static void
|
||||
midori_console_get_property (GObject* object,
|
||||
guint prop_id,
|
||||
GValue* value,
|
||||
GParamSpec* pspec);
|
||||
|
||||
static GtkWidget*
|
||||
midori_console_get_toolbar (MidoriViewable* console);
|
||||
|
||||
static void
|
||||
midori_console_class_init (MidoriConsoleClass* class)
|
||||
{
|
||||
GObjectClass* gobject_class;
|
||||
GParamFlags flags;
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (class);
|
||||
gobject_class->set_property = midori_console_set_property;
|
||||
gobject_class->get_property = midori_console_get_property;
|
||||
|
||||
flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_APP,
|
||||
g_param_spec_object (
|
||||
"app",
|
||||
"App",
|
||||
"The app",
|
||||
MIDORI_TYPE_APP,
|
||||
flags));
|
||||
}
|
||||
|
||||
static const gchar*
|
||||
midori_console_get_label (MidoriViewable* viewable)
|
||||
{
|
||||
return _("Console");
|
||||
}
|
||||
|
||||
static const gchar*
|
||||
midori_console_get_stock_id (MidoriViewable* viewable)
|
||||
{
|
||||
return STOCK_CONSOLE;
|
||||
}
|
||||
|
||||
static void
|
||||
midori_console_viewable_iface_init (MidoriViewableIface* iface)
|
||||
{
|
||||
iface->get_stock_id = midori_console_get_stock_id;
|
||||
iface->get_label = midori_console_get_label;
|
||||
iface->get_toolbar = midori_console_get_toolbar;
|
||||
}
|
||||
|
||||
static void
|
||||
midori_view_console_message_cb (GtkWidget* view,
|
||||
const gchar* message,
|
||||
gint line,
|
||||
const gchar* source_id,
|
||||
MidoriConsole* console)
|
||||
{
|
||||
midori_console_add (console, message, line, source_id);
|
||||
}
|
||||
|
||||
static void
|
||||
midori_console_browser_add_tab_cb (MidoriBrowser* browser,
|
||||
MidoriView* view,
|
||||
MidoriConsole* console)
|
||||
{
|
||||
g_signal_connect (view, "console-message",
|
||||
G_CALLBACK (midori_view_console_message_cb), console);
|
||||
}
|
||||
|
||||
static void
|
||||
midori_console_set_property (GObject* object,
|
||||
guint prop_id,
|
||||
const GValue* value,
|
||||
GParamSpec* pspec)
|
||||
{
|
||||
MidoriConsole* console = MIDORI_CONSOLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_APP:
|
||||
console->app = g_value_get_object (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
midori_console_get_property (GObject* object,
|
||||
guint prop_id,
|
||||
GValue* value,
|
||||
GParamSpec* pspec)
|
||||
{
|
||||
MidoriConsole* console = MIDORI_CONSOLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_APP:
|
||||
g_value_set_object (value, console->app);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
midori_console_button_copy_clicked_cb (GtkToolItem* toolitem,
|
||||
MidoriConsole* console)
|
||||
{
|
||||
GtkTreeModel* model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (console->treeview),
|
||||
&model, &iter))
|
||||
{
|
||||
GdkDisplay* display;
|
||||
GtkClipboard* clipboard;
|
||||
gchar* text;
|
||||
gchar* message;
|
||||
gint line;
|
||||
gchar* source_id;
|
||||
|
||||
display = gtk_widget_get_display (GTK_WIDGET (console));
|
||||
clipboard = gtk_clipboard_get_for_display (display, GDK_SELECTION_CLIPBOARD);
|
||||
gtk_tree_model_get (model, &iter, 0, &message, 1, &line, 2, &source_id, -1);
|
||||
text = g_strdup_printf ("%d @ %s: %s", line, source_id, message);
|
||||
g_free (source_id);
|
||||
g_free (message);
|
||||
gtk_clipboard_set_text (clipboard, text, -1);
|
||||
g_free (text);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
midori_console_button_copy_all_clicked_cb (GtkToolItem* toolitem,
|
||||
MidoriConsole* console)
|
||||
{
|
||||
GtkTreeModel* model;
|
||||
GtkTreeIter iter;
|
||||
gint count;
|
||||
GString* all_text;
|
||||
GdkDisplay* display;
|
||||
GtkClipboard* clipboard;
|
||||
|
||||
model = gtk_tree_view_get_model (GTK_TREE_VIEW (console->treeview));
|
||||
if (!gtk_tree_model_get_iter_first (model, &iter))
|
||||
return;
|
||||
|
||||
count = gtk_tree_model_iter_n_children (model, NULL);
|
||||
all_text = g_string_sized_new (count * 96);
|
||||
|
||||
do
|
||||
{
|
||||
gchar* text;
|
||||
gchar* message;
|
||||
gint line;
|
||||
gchar* source_id;
|
||||
|
||||
gtk_tree_model_get (model, &iter, 0, &message, 1, &line, 2, &source_id, -1);
|
||||
|
||||
text = g_strdup_printf ("%d @ %s: %s\n", line, source_id, message);
|
||||
g_free (source_id);
|
||||
g_free (message);
|
||||
g_string_append (all_text, text);
|
||||
g_free (text);
|
||||
}
|
||||
while (gtk_tree_model_iter_next (model, &iter));
|
||||
|
||||
display = gtk_widget_get_display (GTK_WIDGET (console));
|
||||
clipboard = gtk_clipboard_get_for_display (display, GDK_SELECTION_CLIPBOARD);
|
||||
gtk_clipboard_set_text (clipboard, all_text->str, -1);
|
||||
g_string_free (all_text, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
midori_console_button_clear_clicked_cb (GtkToolItem* toolitem,
|
||||
MidoriConsole* console)
|
||||
{
|
||||
GtkTreeModel* model = gtk_tree_view_get_model (
|
||||
GTK_TREE_VIEW (console->treeview));
|
||||
gtk_tree_store_clear (GTK_TREE_STORE (model));
|
||||
}
|
||||
|
||||
static void
|
||||
midori_console_treeview_render_icon_cb (GtkTreeViewColumn* column,
|
||||
GtkCellRenderer* renderer,
|
||||
GtkTreeModel* model,
|
||||
GtkTreeIter* iter,
|
||||
GtkWidget* treeview)
|
||||
{
|
||||
g_object_set (renderer, "stock-id", GTK_STOCK_DIALOG_WARNING, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
midori_console_treeview_render_text_cb (GtkTreeViewColumn* column,
|
||||
GtkCellRenderer* renderer,
|
||||
GtkTreeModel* model,
|
||||
GtkTreeIter* iter,
|
||||
GtkWidget* treeview)
|
||||
{
|
||||
gchar* message;
|
||||
gint line;
|
||||
gchar* source_id;
|
||||
gchar* text;
|
||||
|
||||
gtk_tree_model_get (model, iter, 0, &message, 1, &line, 2, &source_id, -1);
|
||||
|
||||
g_strchomp (message);
|
||||
text = g_strdup_printf ("%d @ %s\n%s", line, source_id, message);
|
||||
g_object_set (renderer, "text", text, NULL);
|
||||
g_free (text);
|
||||
|
||||
g_free (message);
|
||||
g_free (source_id);
|
||||
}
|
||||
|
||||
static void
|
||||
midori_console_hierarchy_changed_cb (MidoriConsole* console,
|
||||
GtkWidget* old_parent)
|
||||
{
|
||||
MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (console));
|
||||
if (MIDORI_IS_BROWSER (browser))
|
||||
g_signal_connect (browser, "add-tab",
|
||||
G_CALLBACK (midori_console_browser_add_tab_cb), console);
|
||||
}
|
||||
|
||||
static void
|
||||
midori_console_init (MidoriConsole* console)
|
||||
{
|
||||
/* Create the treeview */
|
||||
GtkTreeViewColumn* column;
|
||||
GtkCellRenderer* renderer_text;
|
||||
GtkCellRenderer* renderer_pixbuf;
|
||||
GtkTreeStore* treestore = gtk_tree_store_new (3, G_TYPE_STRING,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_STRING);
|
||||
console->treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (treestore));
|
||||
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (console->treeview), FALSE);
|
||||
column = gtk_tree_view_column_new ();
|
||||
renderer_pixbuf = gtk_cell_renderer_pixbuf_new ();
|
||||
gtk_tree_view_column_pack_start (column, renderer_pixbuf, FALSE);
|
||||
gtk_tree_view_column_set_cell_data_func (column, renderer_pixbuf,
|
||||
(GtkTreeCellDataFunc)midori_console_treeview_render_icon_cb,
|
||||
console->treeview, NULL);
|
||||
renderer_text = gtk_cell_renderer_text_new ();
|
||||
gtk_tree_view_column_pack_start (column, renderer_text, FALSE);
|
||||
gtk_tree_view_column_set_cell_data_func (column, renderer_text,
|
||||
(GtkTreeCellDataFunc)midori_console_treeview_render_text_cb,
|
||||
console->treeview, NULL);
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (console->treeview), column);
|
||||
g_object_unref (treestore);
|
||||
gtk_widget_show (console->treeview);
|
||||
gtk_box_pack_start (GTK_BOX (console), console->treeview, TRUE, TRUE, 0);
|
||||
|
||||
g_signal_connect (console, "hierarchy-changed",
|
||||
G_CALLBACK (midori_console_hierarchy_changed_cb), NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* midori_console_new:
|
||||
*
|
||||
* Creates a new empty console.
|
||||
*
|
||||
* Return value: a new #MidoriConsole
|
||||
**/
|
||||
GtkWidget*
|
||||
midori_console_new (void)
|
||||
{
|
||||
MidoriConsole* console = g_object_new (MIDORI_TYPE_CONSOLE,
|
||||
NULL);
|
||||
|
||||
return GTK_WIDGET (console);
|
||||
}
|
||||
|
||||
static GtkWidget*
|
||||
midori_console_get_toolbar (MidoriViewable* console)
|
||||
{
|
||||
if (!MIDORI_CONSOLE (console)->toolbar)
|
||||
{
|
||||
GtkWidget* toolbar;
|
||||
GtkToolItem* toolitem;
|
||||
|
||||
toolbar = gtk_toolbar_new ();
|
||||
gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_BUTTON);
|
||||
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_COPY);
|
||||
gtk_tool_item_set_is_important (toolitem, TRUE);
|
||||
g_signal_connect (toolitem, "clicked",
|
||||
G_CALLBACK (midori_console_button_copy_clicked_cb), console);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
||||
gtk_widget_show (GTK_WIDGET (toolitem));
|
||||
|
||||
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_DND_MULTIPLE);
|
||||
gtk_tool_button_set_label (GTK_TOOL_BUTTON (toolitem), _("Copy _All"));
|
||||
gtk_tool_item_set_tooltip_text (toolitem, _("Copy All"));
|
||||
g_signal_connect (toolitem, "clicked",
|
||||
G_CALLBACK (midori_console_button_copy_all_clicked_cb), console);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
||||
gtk_widget_show (GTK_WIDGET (toolitem));
|
||||
|
||||
/* TODO: What about a find entry here that filters e.g. by url? */
|
||||
toolitem = gtk_separator_tool_item_new ();
|
||||
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (toolitem),
|
||||
FALSE);
|
||||
gtk_tool_item_set_expand (toolitem, TRUE);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
||||
gtk_widget_show (GTK_WIDGET (toolitem));
|
||||
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_CLEAR);
|
||||
gtk_tool_item_set_is_important (toolitem, TRUE);
|
||||
g_signal_connect (toolitem, "clicked",
|
||||
G_CALLBACK (midori_console_button_clear_clicked_cb), console);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
||||
gtk_widget_show (GTK_WIDGET (toolitem));
|
||||
MIDORI_CONSOLE (console)->toolbar = toolbar;
|
||||
}
|
||||
|
||||
return MIDORI_CONSOLE (console)->toolbar;
|
||||
}
|
||||
|
||||
/**
|
||||
* midori_console_add:
|
||||
* @console: a #MidoriConsole
|
||||
* @message: a descriptive message
|
||||
* @line: the line in the source file
|
||||
* @source_id: the source
|
||||
*
|
||||
* Adds a new message to the console.
|
||||
**/
|
||||
void
|
||||
midori_console_add (MidoriConsole* console,
|
||||
const gchar* message,
|
||||
gint line,
|
||||
const gchar* source_id)
|
||||
{
|
||||
GtkTreeView* treeview;
|
||||
GtkTreeModel* model;
|
||||
|
||||
g_return_if_fail (MIDORI_IS_CONSOLE (console));
|
||||
|
||||
treeview = GTK_TREE_VIEW (console->treeview);
|
||||
model = gtk_tree_view_get_model (treeview);
|
||||
gtk_tree_store_insert_with_values (GTK_TREE_STORE (model),
|
||||
NULL, NULL, G_MAXINT,
|
||||
0, message, 1, line, 2, source_id, -1);
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2008 Christian Dywan <christian@twotoasts.de>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
See the file COPYING for the full license text.
|
||||
*/
|
||||
|
||||
#ifndef __MIDORI_CONSOLE_H__
|
||||
#define __MIDORI_CONSOLE_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <katze/katze.h>
|
||||
|
||||
#include "midori-viewable.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define MIDORI_TYPE_CONSOLE \
|
||||
(midori_console_get_type ())
|
||||
#define MIDORI_CONSOLE(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), MIDORI_TYPE_CONSOLE, MidoriConsole))
|
||||
#define MIDORI_CONSOLE_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), MIDORI_TYPE_CONSOLE, MidoriConsoleClass))
|
||||
#define MIDORI_IS_CONSOLE(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIDORI_TYPE_CONSOLE))
|
||||
#define MIDORI_IS_CONSOLE_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), MIDORI_TYPE_CONSOLE))
|
||||
#define MIDORI_CONSOLE_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), MIDORI_TYPE_CONSOLE, MidoriConsoleClass))
|
||||
|
||||
typedef struct _MidoriConsole MidoriConsole;
|
||||
typedef struct _MidoriConsoleClass MidoriConsoleClass;
|
||||
|
||||
GType
|
||||
midori_console_get_type (void);
|
||||
|
||||
GtkWidget*
|
||||
midori_console_new (void);
|
||||
|
||||
void
|
||||
midori_console_add (MidoriConsole* console,
|
||||
const gchar* message,
|
||||
gint line,
|
||||
const gchar* source_id);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __MIDORI_CONSOLE_H__ */
|
|
@ -5,6 +5,7 @@ midori/main.c
|
|||
midori/midori-app.c
|
||||
midori/midori-array.c
|
||||
midori/midori-browser.c
|
||||
midori/midori-extension.c
|
||||
midori/midori-locationaction.c
|
||||
midori/midori-panel.c
|
||||
midori/midori-websettings.c
|
||||
|
@ -15,7 +16,6 @@ midori/sokoke.c
|
|||
toolbars/midori-findbar.c
|
||||
toolbars/midori-transferbar.c
|
||||
panels/midori-bookmarks.c
|
||||
panels/midori-console.c
|
||||
panels/midori-extensions.c
|
||||
panels/midori-history.c
|
||||
panels/midori-transfers.c
|
||||
|
@ -33,7 +33,6 @@ extensions/cookie-manager/cookie-manager.c
|
|||
extensions/cookie-manager/cookie-manager-page.c
|
||||
extensions/cookie-manager/main.c
|
||||
extensions/copy-tabs.c
|
||||
extensions/external-applications.vala
|
||||
extensions/feed-panel/feed-atom.c
|
||||
extensions/feed-panel/feed-panel.c
|
||||
extensions/feed-panel/feed-parse.c
|
||||
|
|
1364
po/pt_BR.po
1364
po/pt_BR.po
File diff suppressed because it is too large
Load diff
256
po/sv.po
256
po/sv.po
|
@ -64,7 +64,7 @@ msgstr ""
|
|||
#: ../midori/main.c:436
|
||||
#, c-format
|
||||
msgid "Failed to remove history item: %s\n"
|
||||
msgstr ""
|
||||
msgstr "Borttagning av historikpost misslyckades: %s\n"
|
||||
|
||||
#: ../midori/main.c:460
|
||||
#, c-format
|
||||
|
@ -82,7 +82,7 @@ msgstr ""
|
|||
#: ../midori/main.c:712
|
||||
#, c-format
|
||||
msgid "Failed to remove old history items: %s\n"
|
||||
msgstr ""
|
||||
msgstr "Borttagning av gamla historikobjekt misslyckades: %s\n"
|
||||
|
||||
#: ../midori/main.c:741
|
||||
#, c-format
|
||||
|
@ -92,7 +92,7 @@ msgstr "Konfigurationsfilen kunde inte sparas. %s"
|
|||
#: ../midori/main.c:779
|
||||
#, c-format
|
||||
msgid "The search engines couldn't be saved. %s"
|
||||
msgstr "Sökmotorer kunde inte sparad. %s"
|
||||
msgstr "Sökmotorer kunde inte sparas. %s"
|
||||
|
||||
#: ../midori/main.c:798
|
||||
#: ../midori/main.c:826
|
||||
|
@ -111,7 +111,7 @@ msgstr "Papperskorgen kunde inte sparas. %s"
|
|||
#: ../midori/main.c:974
|
||||
#, c-format
|
||||
msgid "The session couldn't be saved. %s"
|
||||
msgstr "Sessionen kunde inte sparad. %s"
|
||||
msgstr "Sessionen kunde inte sparas. %s"
|
||||
|
||||
#: ../midori/main.c:1101
|
||||
msgid "Midori seems to have crashed the last time it was opened. If this happened repeatedly, try one of the following options to solve the problem."
|
||||
|
@ -122,9 +122,8 @@ msgid "Modify _preferences"
|
|||
msgstr "Redigera _inställningar"
|
||||
|
||||
#: ../midori/main.c:1120
|
||||
#, fuzzy
|
||||
msgid "Reset the last _session"
|
||||
msgstr "Gör om senaste ändringen"
|
||||
msgstr "Återställ senaste _sessionen"
|
||||
|
||||
#: ../midori/main.c:1125
|
||||
msgid "Disable all _extensions"
|
||||
|
@ -132,7 +131,7 @@ msgstr "Inaktivera alla _tillägg"
|
|||
|
||||
#: ../midori/main.c:1343
|
||||
msgid "No filename specified"
|
||||
msgstr ""
|
||||
msgstr "Inget filnamn valt"
|
||||
|
||||
#: ../midori/main.c:1366
|
||||
msgid "An unknown error occured."
|
||||
|
@ -145,7 +144,7 @@ msgstr ""
|
|||
|
||||
#: ../midori/main.c:1447
|
||||
msgid "Run ADDRESS as a web application"
|
||||
msgstr ""
|
||||
msgstr "Kör ADRESS som en webapp"
|
||||
|
||||
#: ../midori/main.c:1447
|
||||
msgid "ADDRESS"
|
||||
|
@ -153,7 +152,7 @@ msgstr "ADRESS"
|
|||
|
||||
#: ../midori/main.c:1449
|
||||
msgid "Use FOLDER as configuration folder"
|
||||
msgstr ""
|
||||
msgstr "Använd MAPP som konfigurationsmapp"
|
||||
|
||||
#: ../midori/main.c:1449
|
||||
msgid "FOLDER"
|
||||
|
@ -161,7 +160,7 @@ msgstr "MAPP"
|
|||
|
||||
#: ../midori/main.c:1451
|
||||
msgid "Run the specified filename as javascript"
|
||||
msgstr ""
|
||||
msgstr "Kör det valda filnamnet som javaskript"
|
||||
|
||||
#: ../midori/main.c:1454
|
||||
msgid "Take a snapshot of the specified URI"
|
||||
|
@ -192,18 +191,16 @@ msgid "Check for new versions at:"
|
|||
msgstr "Leta efter nya verioner på:"
|
||||
|
||||
#: ../midori/main.c:1619
|
||||
#, fuzzy
|
||||
msgid "The specified configuration folder is invalid."
|
||||
msgstr "Den valda konfigurationsmappen är ogiltig."
|
||||
|
||||
#: ../midori/main.c:1655
|
||||
msgid "An instance of Midori is already running but not responding.\n"
|
||||
msgstr ""
|
||||
msgstr "En instans av Midori körs redan, men svarar inte.\n"
|
||||
|
||||
#: ../midori/main.c:1715
|
||||
#, fuzzy, c-format
|
||||
msgid "The search engines couldn't be loaded. %s\n"
|
||||
msgstr "Sökmotorer kunde inte läsas in. %s"
|
||||
msgstr "Sökmotorerna kunde inte läsas in. %s\n"
|
||||
|
||||
#: ../midori/main.c:1727
|
||||
#, c-format
|
||||
|
@ -316,7 +313,7 @@ msgstr "Spara fil som"
|
|||
#: ../midori/midori-browser.c:1172
|
||||
#, c-format
|
||||
msgid "The file '<b>%s</b>' has been downloaded."
|
||||
msgstr "Filen '<b>%s</b>' har laddats ner."
|
||||
msgstr "Filen '<b>%s</b>' har hämtats."
|
||||
|
||||
#: ../midori/midori-browser.c:1176
|
||||
msgid "Transfer completed"
|
||||
|
@ -373,9 +370,8 @@ msgid "Cookies"
|
|||
msgstr "Kakor"
|
||||
|
||||
#: ../midori/midori-browser.c:3787
|
||||
#, fuzzy
|
||||
msgid "'Flash' Cookies"
|
||||
msgstr "Alla kakor"
|
||||
msgstr "Flashkakor"
|
||||
|
||||
#: ../midori/midori-browser.c:3792
|
||||
msgid "Website icons"
|
||||
|
@ -392,12 +388,14 @@ msgstr "Rensa privat data när Midori _avslutas"
|
|||
|
||||
#: ../midori/midori-browser.c:3889
|
||||
msgid "A lightweight web browser."
|
||||
msgstr "En liten webbläsare."
|
||||
msgstr "En resurssnål webbläsare."
|
||||
|
||||
#: ../midori/midori-browser.c:3897
|
||||
msgid "translator-credits"
|
||||
msgstr "Mikael Magnusson <mikachu@comhem.se>, Daniel Nylander <po@danielnylander.se>, Oscar Rentzhog <oscar.rentzhog@gmail.com>"
|
||||
## Needs formatting
|
||||
msgstr ""
|
||||
"Mikael Magnusson <mikachu@comhem.se>\n"
|
||||
"Daniel Nylander <po@danielnylander.se>\n"
|
||||
"Oscar Rentzhog <oscar.rentzhog@gmail.com>"
|
||||
|
||||
#: ../midori/midori-browser.c:4163
|
||||
msgid "_File"
|
||||
|
@ -430,7 +428,7 @@ msgstr ""
|
|||
|
||||
#: ../midori/midori-browser.c:4178
|
||||
msgid "Add shortcut to speed dial"
|
||||
msgstr ""
|
||||
msgstr "Lägg till genväg i Webbgenvägar"
|
||||
|
||||
#: ../midori/midori-browser.c:4180
|
||||
msgid "_Close Tab"
|
||||
|
@ -605,7 +603,7 @@ msgstr "Lägg till, ändra och ta bort sökmotorer..."
|
|||
|
||||
#: ../midori/midori-browser.c:4285
|
||||
msgid "_Clear Private Data"
|
||||
msgstr "_Rensa Privat Data"
|
||||
msgstr "_Rensa privat data"
|
||||
|
||||
#: ../midori/midori-browser.c:4286
|
||||
msgid "Clear private data..."
|
||||
|
@ -641,7 +639,7 @@ msgstr "Visa dokumentation"
|
|||
|
||||
#: ../midori/midori-browser.c:4301
|
||||
msgid "_Frequent Questions"
|
||||
msgstr "Vanliga Frågor"
|
||||
msgstr "_Vanliga Frågor"
|
||||
|
||||
#: ../midori/midori-browser.c:4302
|
||||
msgid "Show the Frequently Asked Questions"
|
||||
|
@ -653,7 +651,7 @@ msgstr "_Rapportera ett fel"
|
|||
|
||||
#: ../midori/midori-browser.c:4305
|
||||
msgid "Open Midori's bug tracker"
|
||||
msgstr ""
|
||||
msgstr "Öppna Midoris bugghanterare"
|
||||
|
||||
#: ../midori/midori-browser.c:4308
|
||||
msgid "Show information about the program"
|
||||
|
@ -669,7 +667,7 @@ msgstr "Spara inte webbläsardata när jag surfar"
|
|||
|
||||
#: ../midori/midori-browser.c:4321
|
||||
msgid "_Menubar"
|
||||
msgstr "Menyrad"
|
||||
msgstr "_Menyrad"
|
||||
|
||||
#: ../midori/midori-browser.c:4322
|
||||
msgid "Show menubar"
|
||||
|
@ -751,7 +749,6 @@ msgid "Custom..."
|
|||
msgstr "Anpassad..."
|
||||
|
||||
#: ../midori/midori-browser.c:4806
|
||||
#, fuzzy
|
||||
msgid "_Separator"
|
||||
msgstr "_Avskiljare"
|
||||
|
||||
|
@ -789,9 +786,8 @@ msgid "_Bookmarks"
|
|||
msgstr "_Bokmärken"
|
||||
|
||||
#: ../midori/midori-browser.c:4896
|
||||
#, fuzzy
|
||||
msgid "Show the saved bookmarks"
|
||||
msgstr "Kopiera markerad bokmärke"
|
||||
msgstr "Visa sparade bokmärken"
|
||||
|
||||
#: ../midori/midori-browser.c:4911
|
||||
msgid "_Tools"
|
||||
|
@ -815,9 +811,8 @@ msgstr "Meny"
|
|||
|
||||
#. i18n: A panel at the bottom, to search text in pages
|
||||
#: ../midori/midori-browser.c:5127
|
||||
#, fuzzy
|
||||
msgid "_Inline Find:"
|
||||
msgstr "_Snabbsökning:"
|
||||
msgstr "_Sök på sidan:"
|
||||
|
||||
#: ../midori/midori-browser.c:5152
|
||||
msgid "Previous"
|
||||
|
@ -877,9 +872,8 @@ msgid "Align sidepanel to the left"
|
|||
msgstr ""
|
||||
|
||||
#: ../midori/midori-panel.c:704
|
||||
#, fuzzy
|
||||
msgid "Show panel _titles"
|
||||
msgstr "Visa Sidopanel"
|
||||
msgstr "Visa panel_titlar"
|
||||
|
||||
#: ../midori/midori-panel.c:712
|
||||
msgid "Show operating _controls"
|
||||
|
@ -989,11 +983,11 @@ msgstr "Senast sparade fönsterhöjd"
|
|||
|
||||
#: ../midori/midori-websettings.c:387
|
||||
msgid "Last panel position"
|
||||
msgstr ""
|
||||
msgstr "Senaste panelpositionen"
|
||||
|
||||
#: ../midori/midori-websettings.c:388
|
||||
msgid "The last saved panel position"
|
||||
msgstr ""
|
||||
msgstr "Senast sparade panelposition"
|
||||
|
||||
#. i18n: The internal index of the last opened panel
|
||||
#: ../midori/midori-websettings.c:397
|
||||
|
@ -1045,12 +1039,10 @@ msgid "Whether to show the panel"
|
|||
msgstr "Ifall sidopanelen ska visas"
|
||||
|
||||
#: ../midori/midori-websettings.c:459
|
||||
#, fuzzy
|
||||
msgid "Show Transferbar"
|
||||
msgstr "Visa överföringsrad"
|
||||
|
||||
#: ../midori/midori-websettings.c:460
|
||||
#, fuzzy
|
||||
msgid "Whether to show the transferbar"
|
||||
msgstr "Ifall överföringsraden ska visas"
|
||||
|
||||
|
@ -1063,13 +1055,12 @@ msgid "Whether to show the statusbar"
|
|||
msgstr "Ifall statusraden ska visas"
|
||||
|
||||
#: ../midori/midori-websettings.c:478
|
||||
#, fuzzy
|
||||
msgid "Toolbar Style:"
|
||||
msgstr "Stil för verktygsfält"
|
||||
msgstr "Stil för verktygsfält:"
|
||||
|
||||
#: ../midori/midori-websettings.c:479
|
||||
msgid "The style of the toolbar"
|
||||
msgstr ""
|
||||
msgstr "Stil för verktygsfält"
|
||||
|
||||
#: ../midori/midori-websettings.c:495
|
||||
msgid "Show progress in location entry"
|
||||
|
@ -1088,9 +1079,8 @@ msgid "Whether to show search engines in the location completion"
|
|||
msgstr ""
|
||||
|
||||
#: ../midori/midori-websettings.c:520
|
||||
#, fuzzy
|
||||
msgid "Toolbar Items"
|
||||
msgstr "Föremål i Verktygsrad"
|
||||
msgstr "Föremål i verktygsfält"
|
||||
|
||||
#: ../midori/midori-websettings.c:521
|
||||
msgid "The items to show on the toolbar"
|
||||
|
@ -1101,9 +1091,8 @@ msgid "Compact Sidepanel"
|
|||
msgstr "Kompakt sidopanel"
|
||||
|
||||
#: ../midori/midori-websettings.c:530
|
||||
#, fuzzy
|
||||
msgid "Whether to make the sidepanel compact"
|
||||
msgstr "Ifall aktivitetssymbolen ska animeras"
|
||||
msgstr "Ifall sidopaneles ska göras kompakt"
|
||||
|
||||
#: ../midori/midori-websettings.c:545
|
||||
msgid "Show operating controls of the panel"
|
||||
|
@ -1118,9 +1107,8 @@ msgid "Align sidepanel on the right"
|
|||
msgstr ""
|
||||
|
||||
#: ../midori/midori-websettings.c:562
|
||||
#, fuzzy
|
||||
msgid "Whether to align the sidepanel on the right"
|
||||
msgstr "Ifall aktivitetssymbolen ska animeras"
|
||||
msgstr "Ifall sidopanelen ska justeras till höger"
|
||||
|
||||
#: ../midori/midori-websettings.c:571
|
||||
msgid "When Midori starts:"
|
||||
|
@ -1131,16 +1119,14 @@ msgid "What to do when Midori starts"
|
|||
msgstr "Vad som ska göras när Midori startar"
|
||||
|
||||
#: ../midori/midori-websettings.c:581
|
||||
#, fuzzy
|
||||
msgid "Homepage:"
|
||||
msgstr "Hemsida"
|
||||
msgstr "Startsida:"
|
||||
|
||||
#: ../midori/midori-websettings.c:582
|
||||
msgid "The homepage"
|
||||
msgstr "Hemsidan"
|
||||
msgstr "Startsidan"
|
||||
|
||||
#: ../midori/midori-websettings.c:597
|
||||
#, fuzzy
|
||||
msgid "Show crash dialog"
|
||||
msgstr "Visa krashdialogen"
|
||||
|
||||
|
@ -1151,11 +1137,11 @@ msgstr "Visa en dialog efter att Midori har krashat"
|
|||
#. i18n: Speed dial, webpage shortcuts, named for the phone function
|
||||
#: ../midori/midori-websettings.c:614
|
||||
msgid "Show speed dial in new tabs"
|
||||
msgstr ""
|
||||
msgstr "Visa Webbgenvägar i nya flikar"
|
||||
|
||||
#: ../midori/midori-websettings.c:615
|
||||
msgid "Show speed dial in newly opened tabs"
|
||||
msgstr ""
|
||||
msgstr "Visa Webbgenvägar i nyligen öppnade flikar"
|
||||
|
||||
#: ../midori/midori-websettings.c:623
|
||||
msgid "Save downloaded files to:"
|
||||
|
@ -1167,7 +1153,7 @@ msgstr "Mappen som filer ska hämtas till"
|
|||
|
||||
#: ../midori/midori-websettings.c:643
|
||||
msgid "Ask for the destination folder"
|
||||
msgstr "Fråga vart filer ska hämtas till"
|
||||
msgstr "Fråga vart filer ska sparas"
|
||||
|
||||
#: ../midori/midori-websettings.c:644
|
||||
msgid "Whether to ask for the destination folder when downloading a file"
|
||||
|
@ -1175,11 +1161,11 @@ msgstr "Ifall Midori ska fråga vilken mapp filer ska hämtas till"
|
|||
|
||||
#: ../midori/midori-websettings.c:663
|
||||
msgid "Notify when a transfer has been completed"
|
||||
msgstr "Säg till när en överföring är klar"
|
||||
msgstr "Underrätta när en överföring är klar"
|
||||
|
||||
#: ../midori/midori-websettings.c:664
|
||||
msgid "Whether to show a notification when a transfer has been completed"
|
||||
msgstr ""
|
||||
msgstr "Ifall en underrättelse ska visas när en överföring är klar"
|
||||
|
||||
#: ../midori/midori-websettings.c:676
|
||||
msgid "Download Manager"
|
||||
|
@ -1223,7 +1209,7 @@ msgstr "Den föredragna teckenkodningen"
|
|||
|
||||
#: ../midori/midori-websettings.c:730
|
||||
msgid "Always Show Tabbar"
|
||||
msgstr "Visa Alltid Flikrad"
|
||||
msgstr "Visa alltid flikrad"
|
||||
|
||||
#: ../midori/midori-websettings.c:731
|
||||
msgid "Always show the tabbar"
|
||||
|
@ -1235,7 +1221,7 @@ msgstr "Stängknappar på flikar"
|
|||
|
||||
#: ../midori/midori-websettings.c:740
|
||||
msgid "Whether tabs have close buttons"
|
||||
msgstr "Huruvida flikar har stängknappar"
|
||||
msgstr "Om flikar har stängknappar"
|
||||
|
||||
#: ../midori/midori-websettings.c:748
|
||||
msgid "Open new pages in:"
|
||||
|
@ -1243,7 +1229,7 @@ msgstr "Öppna nya sidor i:"
|
|||
|
||||
#: ../midori/midori-websettings.c:749
|
||||
msgid "Where to open new pages"
|
||||
msgstr ""
|
||||
msgstr "Hur nya sidor ska öppnas"
|
||||
|
||||
#: ../midori/midori-websettings.c:758
|
||||
msgid "Open external pages in:"
|
||||
|
@ -1251,7 +1237,7 @@ msgstr "Öppna externa sidor i:"
|
|||
|
||||
#: ../midori/midori-websettings.c:759
|
||||
msgid "Where to open externally opened pages"
|
||||
msgstr ""
|
||||
msgstr "Hur externt öppnade sidor ska öppnas"
|
||||
|
||||
#: ../midori/midori-websettings.c:768
|
||||
msgid "Middle click opens Selection"
|
||||
|
@ -1267,7 +1253,7 @@ msgstr "Öppna flikar i bakgrunden"
|
|||
|
||||
#: ../midori/midori-websettings.c:778
|
||||
msgid "Whether to open new tabs in the background"
|
||||
msgstr ""
|
||||
msgstr "Ifall nya flikar ska öppnas i bakgrunden"
|
||||
|
||||
#: ../midori/midori-websettings.c:786
|
||||
msgid "Open Tabs next to Current"
|
||||
|
@ -1275,7 +1261,7 @@ msgstr "Öppna Flikar bredvid Nuvarande"
|
|||
|
||||
#: ../midori/midori-websettings.c:787
|
||||
msgid "Whether to open new tabs next to the current tab or after the last one"
|
||||
msgstr ""
|
||||
msgstr "Ifall nya flikar ska öppnas efter den nuvarande eller den sista"
|
||||
|
||||
#: ../midori/midori-websettings.c:795
|
||||
msgid "Open popups in tabs"
|
||||
|
@ -1283,24 +1269,23 @@ msgstr "Öppna popupfönster i flikar"
|
|||
|
||||
#: ../midori/midori-websettings.c:796
|
||||
msgid "Whether to open popup windows in tabs"
|
||||
msgstr ""
|
||||
msgstr "Ifall popup-rutor ska öppnas i flikar"
|
||||
|
||||
#: ../midori/midori-websettings.c:812
|
||||
msgid "Zoom Text and Images"
|
||||
msgstr "Zooma Text och Bilder"
|
||||
msgstr "Zooma text och bilder"
|
||||
|
||||
#: ../midori/midori-websettings.c:813
|
||||
#, fuzzy
|
||||
msgid "Whether to zoom text and images"
|
||||
msgstr "Ifall aktivitetssymbolen ska animeras"
|
||||
msgstr "Iffall text och bilder ska zoomas"
|
||||
|
||||
#: ../midori/midori-websettings.c:828
|
||||
msgid "Find inline while typing"
|
||||
msgstr "Sök på sidan"
|
||||
msgstr "Sök automatiskt på sidan"
|
||||
|
||||
#: ../midori/midori-websettings.c:829
|
||||
msgid "Whether to automatically find inline while typing"
|
||||
msgstr ""
|
||||
msgstr "Om en sökning på sidan automatiskt ska ske när du skriver"
|
||||
|
||||
#: ../midori/midori-websettings.c:837
|
||||
msgid "Accept cookies"
|
||||
|
@ -1324,7 +1309,7 @@ msgstr "Maximal kakålder"
|
|||
|
||||
#: ../midori/midori-websettings.c:857
|
||||
msgid "The maximum number of days to save cookies for"
|
||||
msgstr "Maximalt antal dagar att spara kakor"
|
||||
msgstr "Maximalt antal dagar kakor sparas"
|
||||
|
||||
#: ../midori/midori-websettings.c:867
|
||||
msgid "Remember last visited pages"
|
||||
|
@ -1332,7 +1317,7 @@ msgstr "Kom ihåg senast besökta sidor"
|
|||
|
||||
#: ../midori/midori-websettings.c:868
|
||||
msgid "Whether the last visited pages are saved"
|
||||
msgstr ""
|
||||
msgstr "Ifall de senast besökta sidorna ska sparas"
|
||||
|
||||
#: ../midori/midori-websettings.c:876
|
||||
msgid "Maximum history age"
|
||||
|
@ -1364,15 +1349,15 @@ msgstr "Proxyserver"
|
|||
|
||||
#: ../midori/midori-websettings.c:906
|
||||
msgid "The proxy server used for HTTP connections"
|
||||
msgstr ""
|
||||
msgstr "Proxyserver för HTTP-anslutningar"
|
||||
|
||||
#: ../midori/midori-websettings.c:921
|
||||
msgid "Detect proxy server automatically"
|
||||
msgstr ""
|
||||
msgstr "Upptäck proxiserver automatiskt"
|
||||
|
||||
#: ../midori/midori-websettings.c:922
|
||||
msgid "Whether to detect the proxy server automatically from the environment"
|
||||
msgstr ""
|
||||
msgstr "Ifall en global proxyserver ska upptäckas automatiskt"
|
||||
|
||||
#. i18n: This refers to an application, not the 'user agent' string
|
||||
#: ../midori/midori-websettings.c:938
|
||||
|
@ -1381,11 +1366,11 @@ msgstr "Identifiera som"
|
|||
|
||||
#: ../midori/midori-websettings.c:939
|
||||
msgid "What to identify as to web pages"
|
||||
msgstr ""
|
||||
msgstr "Vad Midori ska identifiera sig som"
|
||||
|
||||
#: ../midori/midori-websettings.c:955
|
||||
msgid "Identification string"
|
||||
msgstr ""
|
||||
msgstr "Identifikationssträng"
|
||||
|
||||
#: ../midori/midori-websettings.c:956
|
||||
msgid "The application identification string"
|
||||
|
@ -1405,7 +1390,7 @@ msgstr "Rensa privat data"
|
|||
|
||||
#: ../midori/midori-websettings.c:981
|
||||
msgid "The private data selected for deletion"
|
||||
msgstr ""
|
||||
msgstr "Privat data vald för borttagning"
|
||||
|
||||
#: ../midori/midori-view.c:781
|
||||
#, c-format
|
||||
|
@ -1470,9 +1455,8 @@ msgid "Open Address in New _Tab"
|
|||
msgstr "Öppna adress i ny fli_k"
|
||||
|
||||
#: ../midori/midori-view.c:1494
|
||||
#, fuzzy
|
||||
msgid "Open or download file"
|
||||
msgstr "Öppna en fil"
|
||||
msgstr "Öppna eller hämta fil"
|
||||
|
||||
#: ../midori/midori-view.c:1511
|
||||
#, c-format
|
||||
|
@ -1497,7 +1481,7 @@ msgstr "Inspektera sida - %s"
|
|||
|
||||
#: ../midori/midori-view.c:2147
|
||||
msgid "Speed dial"
|
||||
msgstr ""
|
||||
msgstr "Webbgenvägar"
|
||||
|
||||
#: ../midori/midori-view.c:2148
|
||||
msgid "Click to add a shortcut"
|
||||
|
@ -1580,19 +1564,19 @@ msgstr "Typsnittsinställningar"
|
|||
|
||||
#: ../midori/midori-preferences.c:443
|
||||
msgid "Default Font Family"
|
||||
msgstr ""
|
||||
msgstr "Standardtypsnittsfamilj"
|
||||
|
||||
#: ../midori/midori-preferences.c:447
|
||||
msgid "The default font family used to display text"
|
||||
msgstr ""
|
||||
msgstr "Typsnittsfamilj som används för att visa text"
|
||||
|
||||
#: ../midori/midori-preferences.c:450
|
||||
msgid "The default font size used to display text"
|
||||
msgstr ""
|
||||
msgstr "Standardstorlek för typsnitt som används för att visa text"
|
||||
|
||||
#: ../midori/midori-preferences.c:453
|
||||
msgid "Fixed-width Font Family"
|
||||
msgstr ""
|
||||
msgstr "Typsnittsfamilj med fast bredd"
|
||||
|
||||
#: ../midori/midori-preferences.c:457
|
||||
msgid "The font family used to display fixed-width text"
|
||||
|
@ -1608,7 +1592,7 @@ msgstr "Minsta typsnittsstorlek"
|
|||
|
||||
#: ../midori/midori-preferences.c:466
|
||||
msgid "The minimum font size used to display text"
|
||||
msgstr ""
|
||||
msgstr "Den minimala typsnittsstorleken för text"
|
||||
|
||||
#: ../midori/midori-preferences.c:473
|
||||
msgid "Encoding"
|
||||
|
@ -1616,7 +1600,7 @@ msgstr "Kodning"
|
|||
|
||||
#: ../midori/midori-preferences.c:476
|
||||
msgid "The character encoding to use by default"
|
||||
msgstr ""
|
||||
msgstr "Teckenkodning som ska användas som standard"
|
||||
|
||||
#. Page "Behavior"
|
||||
#: ../midori/midori-preferences.c:483
|
||||
|
@ -1833,12 +1817,12 @@ msgstr "_Överföringar"
|
|||
|
||||
#: ../midori/sokoke.c:867
|
||||
msgid "Netscape p_lugins"
|
||||
msgstr "Netscape-_Tillägg"
|
||||
msgstr "Netscape-_tillägg"
|
||||
|
||||
#: ../panels/midori-addons.c:95
|
||||
#: ../panels/midori-addons.c:141
|
||||
msgid "Userscripts"
|
||||
msgstr ""
|
||||
msgstr "Användarskript"
|
||||
|
||||
#: ../panels/midori-addons.c:96
|
||||
#: ../panels/midori-addons.c:143
|
||||
|
@ -1851,11 +1835,11 @@ msgstr "Bokmärken"
|
|||
|
||||
#: ../panels/midori-bookmarks.c:239
|
||||
msgid "Edit the selected bookmark"
|
||||
msgstr "Redigera valda bokmärke"
|
||||
msgstr "Redigera det valda bokmärket"
|
||||
|
||||
#: ../panels/midori-bookmarks.c:247
|
||||
msgid "Delete the selected bookmark"
|
||||
msgstr "Ta bort markerat bokmärke"
|
||||
msgstr "Ta bort det markerade bokmärket"
|
||||
|
||||
#: ../panels/midori-bookmarks.c:260
|
||||
msgid "Add a new folder"
|
||||
|
@ -1878,12 +1862,10 @@ msgid "Are you sure you want to remove all history items?"
|
|||
msgstr "Är du säker på att du vill radera hela historiken?"
|
||||
|
||||
#: ../panels/midori-history.c:217
|
||||
#, fuzzy
|
||||
msgid "Bookmark the selected history item"
|
||||
msgstr "Lägg till bokmärke för den valda historikposten"
|
||||
|
||||
#: ../panels/midori-history.c:226
|
||||
#, fuzzy
|
||||
msgid "Delete the selected history item"
|
||||
msgstr "Ta bort den valda historikposten"
|
||||
|
||||
|
@ -1913,7 +1895,7 @@ msgstr "Igår"
|
|||
#: ../panels/midori-plugins.c:87
|
||||
#: ../extensions/statusbar-features.c:108
|
||||
msgid "Netscape plugins"
|
||||
msgstr ""
|
||||
msgstr "Netscapetillägg"
|
||||
|
||||
#: ../panels/midori-transfers.c:271
|
||||
#, c-format
|
||||
|
@ -1921,24 +1903,23 @@ msgid "%s of %s"
|
|||
msgstr "%s av %s"
|
||||
|
||||
#: ../panels/midori-transfers.c:479
|
||||
#, fuzzy
|
||||
msgid "Open Destination _Folder"
|
||||
msgstr "Visa i sid_hållare..."
|
||||
msgstr "Öppna mål_mapp"
|
||||
|
||||
#: ../panels/midori-transfers.c:482
|
||||
msgid "Copy Link Loc_ation"
|
||||
msgstr "Kopiera länkplats"
|
||||
msgstr "Kopiera länk_plats"
|
||||
|
||||
#: ../katze/katze-http-auth.c:97
|
||||
msgid "Authentication Required"
|
||||
msgstr ""
|
||||
msgstr "Autentisering krävs"
|
||||
|
||||
#: ../katze/katze-http-auth.c:113
|
||||
msgid ""
|
||||
"A username and a password are required\n"
|
||||
"to open this location:"
|
||||
msgstr "Användarnamn och lösenord behövs\n"
|
||||
"för att öppna den här platsen"
|
||||
"för att öppna den här platsen:"
|
||||
|
||||
#: ../katze/katze-http-auth.c:127
|
||||
msgid "Username"
|
||||
|
@ -1960,7 +1941,7 @@ msgstr ""
|
|||
|
||||
#: ../katze/katze-throbber.c:907
|
||||
msgid "Animation frames are broken"
|
||||
msgstr ""
|
||||
msgstr "Animeringsramar är trasiga"
|
||||
|
||||
#: ../katze/katze-utils.c:200
|
||||
#: ../katze/katze-utils.c:407
|
||||
|
@ -1979,11 +1960,11 @@ msgstr "Välj mapp"
|
|||
|
||||
#: ../extensions/adblock.c:167
|
||||
msgid "Configure Advertisement filters"
|
||||
msgstr "Redigera Reklamblockeringsfilter"
|
||||
msgstr "Redigera reklamblockeringsfilter"
|
||||
|
||||
#: ../extensions/adblock.c:304
|
||||
msgid "Configure _Advertisement filters..."
|
||||
msgstr "Redigera _Reklamblockeringsfilter"
|
||||
msgstr "Redigera _reklamblockeringsfilter..."
|
||||
|
||||
#: ../extensions/adblock.c:562
|
||||
msgid "Advertisement blocker"
|
||||
|
@ -2008,19 +1989,19 @@ msgstr ""
|
|||
#: ../extensions/cookie-manager/cookie-manager-page.c:79
|
||||
#: ../extensions/cookie-manager/main.c:56
|
||||
msgid "Cookie Manager"
|
||||
msgstr ""
|
||||
msgstr "Kakhanterare"
|
||||
|
||||
#: ../extensions/cookie-manager/cookie-manager-page.c:111
|
||||
msgid "Deletes all shown cookies. If a filter is set, only those cookies are deleted which match the filter."
|
||||
msgstr ""
|
||||
msgstr "Tar bort alla visade kakor. Om ett filter är konfigurerat kommer bara matchande kakor att tas bort."
|
||||
|
||||
#: ../extensions/cookie-manager/cookie-manager-page.c:126
|
||||
msgid "Expand All"
|
||||
msgstr "Expandera Alla"
|
||||
msgstr "Expandera alla"
|
||||
|
||||
#: ../extensions/cookie-manager/cookie-manager-page.c:133
|
||||
msgid "Collapse All"
|
||||
msgstr "Kollapsa Alla"
|
||||
msgstr "Fäll ihop alla"
|
||||
|
||||
#: ../extensions/cookie-manager/cookie-manager-page.c:460
|
||||
msgid "Do you really want to delete all cookies?"
|
||||
|
@ -2032,11 +2013,11 @@ msgstr "Fråga"
|
|||
|
||||
#: ../extensions/cookie-manager/cookie-manager-page.c:471
|
||||
msgid "Only cookies which match the filter will be deleted."
|
||||
msgstr ""
|
||||
msgstr "Endast kakor som matchar filtret kommer att tas bort."
|
||||
|
||||
#: ../extensions/cookie-manager/cookie-manager-page.c:539
|
||||
msgid "At the end of the session"
|
||||
msgstr ""
|
||||
msgstr "Vid slutet av en session."
|
||||
|
||||
#: ../extensions/cookie-manager/cookie-manager-page.c:542
|
||||
#, c-format
|
||||
|
@ -2048,6 +2029,12 @@ msgid ""
|
|||
"<b>Secure</b>: %s\n"
|
||||
"<b>Expires</b>: %s"
|
||||
msgstr ""
|
||||
"<b>Värd/b>: %s\n"
|
||||
"<b>Namn</b>: %s\n"
|
||||
"<b>Värde</b>: %s\n"
|
||||
"<b>Sökväg</b>: %s\n"
|
||||
"<b>Säker</b>: %s\n"
|
||||
"<b>Förfaller</b>: %s"
|
||||
|
||||
#: ../extensions/cookie-manager/cookie-manager-page.c:548
|
||||
msgid "Yes"
|
||||
|
@ -2063,16 +2050,15 @@ msgstr "Namn"
|
|||
|
||||
#: ../extensions/cookie-manager/cookie-manager-page.c:862
|
||||
msgid "_Expand All"
|
||||
msgstr ""
|
||||
msgstr "_Expandera alla"
|
||||
|
||||
#: ../extensions/cookie-manager/cookie-manager-page.c:870
|
||||
msgid "_Collapse All"
|
||||
msgstr ""
|
||||
msgstr "_Fäll ihop alla"
|
||||
|
||||
#: ../extensions/cookie-manager/cookie-manager-page.c:923
|
||||
#, fuzzy
|
||||
msgid "Filter:"
|
||||
msgstr "_Mapp:"
|
||||
msgstr "Filter:"
|
||||
|
||||
#: ../extensions/cookie-manager/cookie-manager-page.c:928
|
||||
msgid "Enter a filter string to show only cookies whose name or domain field match the entered filter"
|
||||
|
@ -2080,7 +2066,7 @@ msgstr ""
|
|||
|
||||
#: ../extensions/cookie-manager/main.c:40
|
||||
msgid "_Cookie Manager"
|
||||
msgstr ""
|
||||
msgstr "_Kakhanterare"
|
||||
|
||||
#: ../extensions/cookie-manager/main.c:57
|
||||
msgid "List, view and delete cookies"
|
||||
|
@ -2099,10 +2085,9 @@ msgstr ""
|
|||
#, c-format
|
||||
msgctxt "Feed"
|
||||
msgid "Last updated: %s."
|
||||
msgstr ""
|
||||
msgstr "Senast uppdaterad: %s."
|
||||
|
||||
#: ../extensions/feed-panel/feed-panel.c:664
|
||||
#, fuzzy
|
||||
msgid "Feeds"
|
||||
msgstr "Flöden"
|
||||
|
||||
|
@ -2126,7 +2111,7 @@ msgstr ""
|
|||
#: ../extensions/feed-panel/feed-parse.c:225
|
||||
#, c-format
|
||||
msgid "Unsupported feed format."
|
||||
msgstr ""
|
||||
msgstr "Formatet för flödet stöds inte."
|
||||
|
||||
#: ../extensions/feed-panel/feed-parse.c:255
|
||||
#, c-format
|
||||
|
@ -2152,7 +2137,7 @@ msgstr ""
|
|||
#: ../extensions/feed-panel/main.c:114
|
||||
#, c-format
|
||||
msgid "Feed '%s' already exists"
|
||||
msgstr ""
|
||||
msgstr "Flödet '%s' finns redan"
|
||||
|
||||
#: ../extensions/feed-panel/main.c:191
|
||||
#, c-format
|
||||
|
@ -2164,9 +2149,8 @@ msgid "New feed"
|
|||
msgstr "Nytt flöde"
|
||||
|
||||
#: ../extensions/feed-panel/main.c:489
|
||||
#, fuzzy
|
||||
msgid "Feed Panel"
|
||||
msgstr "Visa Sidopanel"
|
||||
msgstr "Flödespanel"
|
||||
|
||||
#: ../extensions/feed-panel/main.c:490
|
||||
msgid "Read Atom/ RSS feeds"
|
||||
|
@ -2196,7 +2180,7 @@ msgstr "Ställ in tangentbordsgenvägar"
|
|||
|
||||
#: ../extensions/shortcuts.c:264
|
||||
msgid "Customize Sh_ortcuts..."
|
||||
msgstr "Ställ in Gen_vägar..."
|
||||
msgstr "Ställ in gen_vägar..."
|
||||
|
||||
#: ../extensions/shortcuts.c:303
|
||||
msgid "Shortcuts"
|
||||
|
@ -2215,9 +2199,8 @@ msgid "Scripts"
|
|||
msgstr "Skript"
|
||||
|
||||
#: ../extensions/statusbar-features.c:149
|
||||
#, fuzzy
|
||||
msgid "Statusbar Features"
|
||||
msgstr "Statusrad"
|
||||
msgstr "Statusradsfunktioner"
|
||||
|
||||
#: ../extensions/statusbar-features.c:150
|
||||
msgid "Easily toggle features on web pages on and off"
|
||||
|
@ -2225,23 +2208,20 @@ msgstr ""
|
|||
|
||||
#: ../extensions/tab-panel.c:383
|
||||
#: ../extensions/tab-panel.c:443
|
||||
#, fuzzy
|
||||
msgid "Tab Panel"
|
||||
msgstr "Visa Sidopanel"
|
||||
msgstr "Flikrad"
|
||||
|
||||
#: ../extensions/tab-panel.c:427
|
||||
#, fuzzy
|
||||
msgid "T_ab Panel"
|
||||
msgstr "Visa Sidopanel"
|
||||
msgstr "Visa f_likraden"
|
||||
|
||||
#: ../extensions/tab-panel.c:444
|
||||
#, fuzzy
|
||||
msgid "Show tabs in a vertical panel"
|
||||
msgstr "Visa sido_panel"
|
||||
msgstr "Visa flikar i en vertikal panel"
|
||||
|
||||
#: ../extensions/toolbar-editor.c:391
|
||||
msgid "Customize Toolbar"
|
||||
msgstr "Redigera Verktygsrad"
|
||||
msgstr "Redigera verktygsrad"
|
||||
|
||||
#: ../extensions/toolbar-editor.c:407
|
||||
msgid "Select items to be displayed on the toolbar. Items can be reodered by drag and drop."
|
||||
|
@ -2257,21 +2237,19 @@ msgstr "Visade föremål"
|
|||
|
||||
#: ../extensions/toolbar-editor.c:579
|
||||
msgid "Customize _Toolbar..."
|
||||
msgstr "Redigera _Verktygsrad..."
|
||||
msgstr "Redigera _verktygsrad..."
|
||||
|
||||
#: ../extensions/toolbar-editor.c:611
|
||||
#, fuzzy
|
||||
msgid "Toolbar Editor"
|
||||
msgstr "Stil för verktygsrad"
|
||||
msgstr "Verktygsradseditor"
|
||||
|
||||
#: ../extensions/toolbar-editor.c:612
|
||||
msgid "Easily edit the toolbar layout"
|
||||
msgstr ""
|
||||
msgstr "Redigera verktygsradens layout enkelt"
|
||||
|
||||
#~ msgid "_Closed Tabs and Windows"
|
||||
#~ msgstr "_Stängda tabbar och fönster"
|
||||
msgid "_Closed Tabs and Windows"
|
||||
msgstr "_Stängda tabbar och fönster"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "[URIs]"
|
||||
#~ msgstr "[URL]"
|
||||
#~ msgid "_URL:"
|
||||
|
@ -2287,7 +2265,7 @@ msgstr ""
|
|||
#~ msgid "Load on Startup"
|
||||
#~ msgstr "Ladda vid uppstart"
|
||||
#~ msgid "Open URL in New _Tab"
|
||||
#~ msgstr "Öppna URL i ny _tabb"
|
||||
#~ msgstr "Öppna URL i ny _flik"
|
||||
#~ msgid "Source"
|
||||
#~ msgstr "Källkod"
|
||||
#~ msgid "_Icon (name or file):"
|
||||
|
@ -2297,7 +2275,6 @@ msgstr ""
|
|||
#~ msgid "Warning: You are using a superuser account!"
|
||||
#~ msgstr "Varning: Du använder ett administratörskonto!"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "_Disable"
|
||||
#~ msgstr "_Inaktivera"
|
||||
#~ msgid "_Fullscreen"
|
||||
|
@ -2311,7 +2288,7 @@ msgstr ""
|
|||
#~ msgid "Trash"
|
||||
#~ msgstr "Papperskorgen"
|
||||
#~ msgid "The trash, collecting recently closed tabs and windows"
|
||||
#~ msgstr "Soptunnan, samlar senast stängda tabbar och fönster"
|
||||
#~ msgstr "Papperkorgen, samlar senast stängda tabbar och fönster"
|
||||
#~ msgid "Browser"
|
||||
#~ msgstr "Webbläsare"
|
||||
#~ msgid "The text that is displayed in the statusbar"
|
||||
|
@ -2325,7 +2302,7 @@ msgstr ""
|
|||
#~ msgid "Add, edit and remove bookmarks..."
|
||||
#~ msgstr "Lägg till, ändra och ta bort bokmärken..."
|
||||
#~ msgid "Tab _Overview"
|
||||
#~ msgstr "Tabbö_versikt"
|
||||
#~ msgstr "Flikö_versikt"
|
||||
#~ msgid "_Work Offline"
|
||||
#~ msgstr "_Arbeta offline"
|
||||
#~ msgid "Appearance of the shadow around each panel"
|
||||
|
@ -2335,13 +2312,13 @@ msgstr ""
|
|||
#~ msgid "The index of the current page"
|
||||
#~ msgstr "Indexet för nuvarande sida"
|
||||
#~ msgid "Show New Tab"
|
||||
#~ msgstr "Visa Ny tabb"
|
||||
#~ msgstr "Visa Ny flik"
|
||||
#~ msgid "Show Web search"
|
||||
#~ msgstr "Visa Webbsökning"
|
||||
#~ msgid "Tab Label Size"
|
||||
#~ msgstr "Tabbstorlek"
|
||||
#~ msgstr "Flikstorlek"
|
||||
#~ msgid "The desired tab label size"
|
||||
#~ msgstr "Önskad storlek på tabbetikett"
|
||||
#~ msgstr "Önskad storlek på fliketikett"
|
||||
#~ msgid "The URI of the currently loaded page"
|
||||
#~ msgstr "URIn för den laddade sidan"
|
||||
#~ msgid "The title of the currently loaded page"
|
||||
|
@ -2358,4 +2335,3 @@ msgstr ""
|
|||
#~ msgstr "En GdkPixbuf att använda som statisk bild"
|
||||
#~ msgid "The stock ID of an icon to be used as the static image"
|
||||
#~ msgstr "Katalog-ID för en ikon att använda som statisk bild"
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ midori_transferbar_info_free (gpointer data)
|
|||
transferbar->infos = g_list_remove (transferbar->infos, info);
|
||||
g_object_unref (info->download);
|
||||
gtk_widget_destroy (info->toolitem);
|
||||
g_free (info);
|
||||
g_slice_free (TransferInfo, info);
|
||||
|
||||
if (!transferbar->infos || !g_list_nth_data (transferbar->infos, 0))
|
||||
gtk_widget_hide (GTK_WIDGET (transferbar->clear));
|
||||
|
@ -210,7 +210,7 @@ midori_transferbar_add_download_item (MidoriTransferbar* transferbar,
|
|||
gtk_toolbar_insert (GTK_TOOLBAR (transferbar), toolitem, 0);
|
||||
gtk_widget_show (GTK_WIDGET (transferbar->clear));
|
||||
|
||||
info = g_new (TransferInfo, 1);
|
||||
info = g_slice_new (TransferInfo);
|
||||
info->download = g_object_ref (download);
|
||||
info->button = button;
|
||||
info->toolitem = GTK_WIDGET (toolitem);
|
||||
|
|
|
@ -47,6 +47,8 @@ violations = [
|
|||
['asctime|ctime|getgrgid|getprgnam|getlogin \
|
||||
|getpwnam|getpwuid|gmtime|localtime \
|
||||
|rand|readdir|strtok|ttyname', 'Not thread-safe posix, use _r variant'],
|
||||
['while.*g_list_nth', 'Use g_list_next() instead of g_list_nth'],
|
||||
['[^a-z]g_new.*1[^0-9]', 'Use g_slice_new() instead of g_new()'],
|
||||
]
|
||||
# No validation for strings, comments, includes
|
||||
omissions = [
|
||||
|
|
BIN
waf
vendored
BIN
waf
vendored
Binary file not shown.
25
wscript
25
wscript
|
@ -10,7 +10,7 @@ try:
|
|||
except:
|
||||
WAFVERSION='1.0.0'
|
||||
if WAFVERSION[:3] != '1.5':
|
||||
print 'Incompatible Waf, use 1.5'
|
||||
print ('Incompatible Waf, use 1.5')
|
||||
sys.exit (1)
|
||||
|
||||
import Build
|
||||
|
@ -29,7 +29,7 @@ from Configure import find_program_impl
|
|||
|
||||
major = 0
|
||||
minor = 2
|
||||
micro = 8
|
||||
micro = 9
|
||||
|
||||
APPNAME = 'midori'
|
||||
VERSION = str (major) + '.' + str (minor) + '.' + str (micro)
|
||||
|
@ -159,6 +159,8 @@ def configure (conf):
|
|||
'MDATADIR')
|
||||
conf.undefine ('DATADIR')
|
||||
dirname_default ('DOCDIR', os.path.join (conf.env['MDATADIR'], 'doc'))
|
||||
if not APPNAME in conf.env['DOCDIR']:
|
||||
conf.env['DOCDIR'] += '/' + APPNAME
|
||||
|
||||
if option_enabled ('apidocs'):
|
||||
conf.find_program ('gtkdoc-scan', var='GTKDOC_SCAN')
|
||||
|
@ -308,7 +310,7 @@ def configure (conf):
|
|||
'-Wno-missing-field-initializers '
|
||||
'-Wredundant-decls -Wmissing-noreturn '
|
||||
'-Wshadow -Wpointer-arith -Wcast-align '
|
||||
'-Winline -Wformat-security '
|
||||
'-Winline -Wformat-security -fno-common '
|
||||
'-Winit-self -Wundef -Wdeclaration-after-statement '
|
||||
'-Wmissing-format-attribute -Wnested-externs '
|
||||
# -DGSEAL_ENABLE
|
||||
|
@ -320,7 +322,7 @@ def configure (conf):
|
|||
conf.env.append_value ('VALAFLAGS', '--enable-checking'.split ())
|
||||
elif debug_level == 'none':
|
||||
conf.env.append_value ('VALAFLAGS', '--disable-assert')
|
||||
print '''
|
||||
print ('''
|
||||
Localization: %(nls)s (intltool)
|
||||
Icon optimizations: %(icons)s (rsvg-convert)
|
||||
Notifications: %(libnotify)s (libnotify)
|
||||
|
@ -328,7 +330,7 @@ def configure (conf):
|
|||
IDN support: %(idn)s (libidn or libsoup 2.27.90)
|
||||
User documentation: %(user_docs)s (docutils)
|
||||
API documentation: %(api_docs)s (gtk-doc)
|
||||
''' % locals ()
|
||||
''' % locals ())
|
||||
if unique == 'yes' and conf.check_cfg (modversion='unique-1.0') == '1.0.4':
|
||||
Utils.pprint ('RED', 'unique 1.0.4 found, this version is erroneous.')
|
||||
Utils.pprint ('RED', 'Please use an older or newer version.')
|
||||
|
@ -415,7 +417,7 @@ def build (bld):
|
|||
bld.add_group ()
|
||||
|
||||
if bld.env['docs']:
|
||||
bld.install_files ('${DOCDIR}/' + APPNAME + '/', \
|
||||
bld.install_files ('${DOCDIR}/' + '/', \
|
||||
'AUTHORS COPYING ChangeLog EXPAT README')
|
||||
|
||||
# Install default configuration
|
||||
|
@ -432,7 +434,7 @@ def build (bld):
|
|||
'../../../docs/user/midori.txt ' + 'midori.html'
|
||||
Utils.exec_command (command)
|
||||
os.chdir ('../../..')
|
||||
bld.install_files ('${DOCDIR}/midori/user/', blddir + '/docs/user/midori.html')
|
||||
bld.install_files ('${DOCDIR}/user/', blddir + '/docs/user/midori.html')
|
||||
|
||||
if bld.env['INTLTOOL']:
|
||||
obj = bld.new_task_gen ('intltool_po')
|
||||
|
@ -441,7 +443,7 @@ def build (bld):
|
|||
|
||||
if bld.env['GTKDOC_SCAN'] and Options.commands['build']:
|
||||
bld.add_subdirs ('docs/api')
|
||||
bld.install_files ('${DOCDIR}/midori/api/', blddir + '/docs/api/*')
|
||||
bld.install_files ('${DOCDIR}/api/', blddir + '/docs/api/*')
|
||||
|
||||
if not is_mingw (bld.env) and Options.platform != 'win32':
|
||||
if bld.env['HAVE_HILDON']:
|
||||
|
@ -566,7 +568,7 @@ def shutdown ():
|
|||
size_old = 0
|
||||
subprocess.call (['intltool-update', '-p', '-g', APPNAME])
|
||||
size_new = os.stat (APPNAME + '.pot').st_size
|
||||
if size_new <> size_old:
|
||||
if size_new != size_old:
|
||||
Utils.pprint ('YELLOW', "Updated po template.")
|
||||
try:
|
||||
command = 'intltool-update -r -g %s' % APPNAME
|
||||
|
@ -611,7 +613,8 @@ def shutdown ():
|
|||
command += ' wine cmd /k "PATH=%PATH%;' + Build.bld.env['PREFIX'] + os.sep + 'bin' + ' && ' + APPNAME + '.exe"'
|
||||
else:
|
||||
command += ' ' + relfolder + os.sep + APPNAME + os.sep + APPNAME
|
||||
print command
|
||||
print (command)
|
||||
Utils.exec_command (command)
|
||||
except Exception, msg:
|
||||
except Exception:
|
||||
msg = sys.exc_info()[1] # Python 2/3 compatibility
|
||||
Utils.pprint ('RED', "Failed to run application: " + str (msg))
|
||||
|
|
Loading…
Reference in a new issue