2009-10-06 18:35:56 +00:00
|
|
|
/*
|
2012-01-07 05:31:37 +00:00
|
|
|
Copyright (C) 2009-2012 Alexander Butenko <a.butenka@gmail.com>
|
|
|
|
Copyright (C) 2009-2012 Christian Dywan <christian@twotoasts.de>
|
2009-10-06 18:35:56 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
2009-11-12 20:54:25 +00:00
|
|
|
#define MAXCHARS 60
|
2009-10-07 20:30:16 +00:00
|
|
|
#define MINCHARS 2
|
2012-01-07 05:31:37 +00:00
|
|
|
#include "formhistory-frontend.h"
|
2011-08-09 13:01:34 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
formhistory_toggle_state_cb (GtkAction* action,
|
|
|
|
MidoriBrowser* browser);
|
|
|
|
|
2009-10-07 20:30:16 +00:00
|
|
|
static void
|
2009-11-01 22:49:58 +00:00
|
|
|
formhistory_update_database (gpointer db,
|
|
|
|
const gchar* key,
|
|
|
|
const gchar* value)
|
|
|
|
{
|
2009-11-05 22:50:49 +00:00
|
|
|
gchar* sqlcmd;
|
|
|
|
gchar* errmsg;
|
|
|
|
gint success;
|
2012-01-07 05:31:37 +00:00
|
|
|
guint length;
|
|
|
|
|
|
|
|
if (!(value && *value))
|
|
|
|
return;
|
|
|
|
length = strlen (value);
|
|
|
|
if (length > MAXCHARS || length < MINCHARS)
|
|
|
|
return;
|
2009-11-05 22:50:49 +00:00
|
|
|
|
|
|
|
sqlcmd = sqlite3_mprintf ("INSERT INTO forms VALUES"
|
|
|
|
"('%q', '%q', '%q')",
|
|
|
|
NULL, key, value);
|
|
|
|
success = sqlite3_exec (db, sqlcmd, NULL, NULL, &errmsg);
|
|
|
|
sqlite3_free (sqlcmd);
|
|
|
|
if (success != SQLITE_OK)
|
|
|
|
{
|
|
|
|
g_printerr (_("Failed to add form value: %s\n"), errmsg);
|
|
|
|
g_free (errmsg);
|
|
|
|
return;
|
|
|
|
}
|
2009-11-01 22:49:58 +00:00
|
|
|
}
|
|
|
|
|
2009-11-12 20:54:25 +00:00
|
|
|
static gboolean
|
|
|
|
formhistory_navigation_decision_cb (WebKitWebView* web_view,
|
|
|
|
WebKitWebFrame* web_frame,
|
|
|
|
WebKitNetworkRequest* request,
|
|
|
|
WebKitWebNavigationAction* action,
|
|
|
|
WebKitWebPolicyDecision* decision,
|
|
|
|
MidoriExtension* extension)
|
2009-10-06 18:35:56 +00:00
|
|
|
{
|
2012-01-07 23:58:52 +00:00
|
|
|
FormHistoryPriv* priv;
|
|
|
|
JSContextRef js_context;
|
|
|
|
gchar* value;
|
|
|
|
|
2009-11-12 20:54:25 +00:00
|
|
|
/* The script returns form data in the form "field_name|,|value|,|field_type".
|
|
|
|
We are handling only input fields with 'text' or 'password' type.
|
|
|
|
The field separator is "|||" */
|
|
|
|
const gchar* script = "function dumpForm (inputs) {"
|
|
|
|
" var out = '';"
|
|
|
|
" for (i=0;i<inputs.length;i++) {"
|
2010-06-30 15:41:19 +00:00
|
|
|
" if (inputs[i].getAttribute('autocomplete') == 'off')"
|
|
|
|
" continue;"
|
2009-11-12 20:54:25 +00:00
|
|
|
" if (inputs[i].value && (inputs[i].type == 'text' || inputs[i].type == 'password')) {"
|
|
|
|
" var ename = inputs[i].getAttribute('name');"
|
|
|
|
" var eid = inputs[i].getAttribute('id');"
|
|
|
|
" if (!ename && eid)"
|
|
|
|
" ename=eid;"
|
2012-01-07 05:31:37 +00:00
|
|
|
" out += ename+'|,|'+inputs[i].value +'|,|'+inputs[i].type +'|||';"
|
2009-11-12 20:54:25 +00:00
|
|
|
" }"
|
|
|
|
" }"
|
|
|
|
" return out;"
|
|
|
|
"}"
|
|
|
|
"dumpForm (document.getElementsByTagName('input'))";
|
|
|
|
|
2012-01-07 05:31:37 +00:00
|
|
|
if (webkit_web_navigation_action_get_reason (action) != WEBKIT_WEB_NAVIGATION_REASON_FORM_SUBMITTED)
|
|
|
|
return FALSE;
|
|
|
|
|
2012-01-07 23:58:52 +00:00
|
|
|
priv = g_object_get_data (G_OBJECT (extension), "priv");
|
|
|
|
js_context = webkit_web_frame_get_global_context (web_frame);
|
|
|
|
value = sokoke_js_script_eval (js_context, script, NULL);
|
2012-01-07 05:31:37 +00:00
|
|
|
|
|
|
|
formhistory_suggestions_hide_cb (NULL, NULL, priv);
|
|
|
|
if (value && *value)
|
2009-10-06 18:35:56 +00:00
|
|
|
{
|
2012-01-07 05:31:37 +00:00
|
|
|
gchar** inputs = g_strsplit (value, "|||", 0);
|
|
|
|
guint i = 0;
|
|
|
|
while (inputs[i] != NULL)
|
2009-10-12 16:16:52 +00:00
|
|
|
{
|
2012-01-07 05:31:37 +00:00
|
|
|
gchar** parts = g_strsplit (inputs[i], "|,|", 3);
|
|
|
|
if (parts && parts[0] && parts[1] && parts[2])
|
2009-11-12 20:54:25 +00:00
|
|
|
{
|
2012-01-07 05:31:37 +00:00
|
|
|
/* FIXME: We need to handle passwords */
|
|
|
|
if (strcmp (parts[2], "password"))
|
|
|
|
formhistory_update_database (priv->db, parts[0], parts[1]);
|
2009-11-12 20:54:25 +00:00
|
|
|
}
|
2012-01-07 05:31:37 +00:00
|
|
|
g_strfreev (parts);
|
|
|
|
i++;
|
2009-10-12 16:16:52 +00:00
|
|
|
}
|
2012-01-07 05:31:37 +00:00
|
|
|
g_strfreev (inputs);
|
|
|
|
g_free (value);
|
2009-10-06 18:35:56 +00:00
|
|
|
}
|
2009-11-12 20:54:25 +00:00
|
|
|
return FALSE;
|
2009-10-06 18:35:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-01-07 05:31:37 +00:00
|
|
|
formhistory_window_object_cleared_cb (WebKitWebView* web_view,
|
|
|
|
WebKitWebFrame* web_frame,
|
|
|
|
JSContextRef js_context,
|
|
|
|
JSObjectRef js_window,
|
|
|
|
MidoriExtension* extension)
|
2009-10-06 18:35:56 +00:00
|
|
|
{
|
2011-12-02 23:53:30 +00:00
|
|
|
const gchar* page_uri;
|
|
|
|
|
|
|
|
page_uri = webkit_web_frame_get_uri (web_frame);
|
2012-01-07 05:31:37 +00:00
|
|
|
if (!page_uri)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!midori_uri_is_http (page_uri) && !g_str_has_prefix (page_uri, "file"))
|
2011-12-02 23:53:30 +00:00
|
|
|
return;
|
|
|
|
|
2012-01-07 05:31:37 +00:00
|
|
|
formhistory_setup_suggestions (web_view, js_context, extension);
|
2009-10-06 18:35:56 +00:00
|
|
|
}
|
|
|
|
|
2012-01-07 05:31:37 +00:00
|
|
|
static void
|
|
|
|
formhistory_deactivate_cb (MidoriExtension* extension,
|
|
|
|
MidoriBrowser* browser);
|
|
|
|
|
2009-10-06 18:35:56 +00:00
|
|
|
static void
|
2009-11-01 22:49:58 +00:00
|
|
|
formhistory_add_tab_cb (MidoriBrowser* browser,
|
|
|
|
MidoriView* view,
|
|
|
|
MidoriExtension* extension)
|
2009-10-06 18:35:56 +00:00
|
|
|
{
|
2010-03-30 20:44:04 +00:00
|
|
|
GtkWidget* web_view = midori_view_get_web_view (view);
|
2012-01-07 05:31:37 +00:00
|
|
|
|
2009-10-06 18:35:56 +00:00
|
|
|
g_signal_connect (web_view, "window-object-cleared",
|
2012-01-07 05:31:37 +00:00
|
|
|
G_CALLBACK (formhistory_window_object_cleared_cb), extension);
|
2009-11-12 20:54:25 +00:00
|
|
|
g_signal_connect (web_view, "navigation-policy-decision-requested",
|
|
|
|
G_CALLBACK (formhistory_navigation_decision_cb), extension);
|
2009-10-06 18:35:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-01-07 05:31:37 +00:00
|
|
|
formhistory_add_tab_foreach_cb (MidoriView* view,
|
2009-11-01 22:49:58 +00:00
|
|
|
MidoriExtension* extension)
|
2009-10-06 18:35:56 +00:00
|
|
|
{
|
2012-01-07 05:31:37 +00:00
|
|
|
formhistory_add_tab_cb (NULL, view, extension);
|
2009-10-06 18:35:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
formhistory_app_add_browser_cb (MidoriApp* app,
|
|
|
|
MidoriBrowser* browser,
|
|
|
|
MidoriExtension* extension)
|
|
|
|
{
|
2012-01-07 05:31:37 +00:00
|
|
|
|
2011-08-09 13:01:34 +00:00
|
|
|
GtkAccelGroup* acg = gtk_accel_group_new ();
|
|
|
|
GtkActionGroup* action_group = midori_browser_get_action_group (browser);
|
|
|
|
GtkAction* action = gtk_action_new ("FormHistoryToggleState",
|
|
|
|
_("Toggle form history state"),
|
|
|
|
_("Activate or deactivate form history for the current tab."), NULL);
|
|
|
|
gtk_window_add_accel_group (GTK_WINDOW (browser), acg);
|
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (browser), "FormHistoryExtension", extension);
|
|
|
|
|
|
|
|
g_signal_connect (action, "activate",
|
|
|
|
G_CALLBACK (formhistory_toggle_state_cb), browser);
|
|
|
|
|
|
|
|
gtk_action_group_add_action_with_accel (action_group, action, "<Ctrl><Shift>F");
|
|
|
|
gtk_action_set_accel_group (action, acg);
|
|
|
|
gtk_action_connect_accelerator (action);
|
|
|
|
|
|
|
|
if (midori_extension_get_boolean (extension, "always-load"))
|
|
|
|
{
|
|
|
|
midori_browser_foreach (browser,
|
|
|
|
(GtkCallback)formhistory_add_tab_foreach_cb, extension);
|
|
|
|
g_signal_connect (browser, "add-tab",
|
|
|
|
G_CALLBACK (formhistory_add_tab_cb), extension);
|
|
|
|
}
|
2009-10-06 18:35:56 +00:00
|
|
|
g_signal_connect (extension, "deactivate",
|
|
|
|
G_CALLBACK (formhistory_deactivate_cb), browser);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-01-07 05:31:37 +00:00
|
|
|
formhistory_deactivate_tab (MidoriView* view,
|
|
|
|
MidoriExtension* extension)
|
2009-10-06 18:35:56 +00:00
|
|
|
{
|
2010-03-30 20:44:04 +00:00
|
|
|
GtkWidget* web_view = midori_view_get_web_view (view);
|
2012-01-07 05:31:37 +00:00
|
|
|
|
2009-10-06 18:35:56 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (
|
2012-01-07 05:31:37 +00:00
|
|
|
web_view, formhistory_window_object_cleared_cb, extension);
|
2009-10-07 20:30:16 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (
|
2009-11-12 20:54:25 +00:00
|
|
|
web_view, formhistory_navigation_decision_cb, extension);
|
2009-10-06 18:35:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
formhistory_deactivate_cb (MidoriExtension* extension,
|
2011-08-09 13:01:34 +00:00
|
|
|
MidoriBrowser* browser)
|
2009-10-06 18:35:56 +00:00
|
|
|
{
|
|
|
|
MidoriApp* app = midori_extension_get_app (extension);
|
2012-01-07 05:31:37 +00:00
|
|
|
FormHistoryPriv* priv = g_object_get_data (G_OBJECT (extension), "priv");
|
2009-10-06 18:35:56 +00:00
|
|
|
|
2011-08-09 13:01:34 +00:00
|
|
|
GtkActionGroup* action_group = midori_browser_get_action_group (browser);
|
|
|
|
GtkAction* action;
|
|
|
|
|
2010-02-02 20:31:15 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (
|
|
|
|
browser, formhistory_add_tab_cb, extension);
|
2009-10-06 18:35:56 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (
|
|
|
|
extension, formhistory_deactivate_cb, browser);
|
|
|
|
g_signal_handlers_disconnect_by_func (
|
|
|
|
app, formhistory_app_add_browser_cb, extension);
|
2009-11-01 22:49:58 +00:00
|
|
|
midori_browser_foreach (browser,
|
2012-01-07 05:31:37 +00:00
|
|
|
(GtkCallback)formhistory_deactivate_tab, extension);
|
2009-10-07 20:30:16 +00:00
|
|
|
|
2011-08-09 13:01:34 +00:00
|
|
|
g_object_set_data (G_OBJECT (browser), "FormHistoryExtension", NULL);
|
|
|
|
action = gtk_action_group_get_action ( action_group, "FormHistoryToggleState");
|
|
|
|
if (action != NULL)
|
|
|
|
{
|
|
|
|
gtk_action_group_remove_action (action_group, action);
|
|
|
|
g_object_unref (action);
|
|
|
|
}
|
|
|
|
|
2012-01-07 05:31:37 +00:00
|
|
|
formhistory_private_destroy (priv);
|
2009-11-05 22:50:49 +00:00
|
|
|
}
|
|
|
|
|
2009-10-06 18:35:56 +00:00
|
|
|
static void
|
|
|
|
formhistory_activate_cb (MidoriExtension* extension,
|
|
|
|
MidoriApp* app)
|
|
|
|
{
|
2009-11-01 22:49:58 +00:00
|
|
|
const gchar* config_dir;
|
|
|
|
gchar* filename;
|
|
|
|
sqlite3* db;
|
2009-11-05 22:50:49 +00:00
|
|
|
char* errmsg = NULL, *errmsg2 = NULL;
|
2009-10-06 18:35:56 +00:00
|
|
|
KatzeArray* browsers;
|
|
|
|
MidoriBrowser* browser;
|
2012-01-07 05:31:37 +00:00
|
|
|
FormHistoryPriv* priv;
|
|
|
|
|
|
|
|
priv = formhistory_private_new ();
|
|
|
|
formhistory_construct_popup_gui (priv);
|
2009-10-06 18:35:56 +00:00
|
|
|
|
2009-11-01 22:49:58 +00:00
|
|
|
config_dir = midori_extension_get_config_dir (extension);
|
|
|
|
katze_mkdir_with_parents (config_dir, 0700);
|
|
|
|
filename = g_build_filename (config_dir, "forms.db", NULL);
|
2010-10-17 21:11:50 +00:00
|
|
|
if (sqlite3_open (filename, &db) != SQLITE_OK)
|
2009-11-01 22:49:58 +00:00
|
|
|
{
|
2011-11-17 23:52:35 +00:00
|
|
|
/* If the folder is /, this is a test run, thus no error */
|
|
|
|
if (!g_str_equal (midori_extension_get_config_dir (extension), "/"))
|
|
|
|
g_warning (_("Failed to open database: %s\n"), sqlite3_errmsg (db));
|
2009-11-01 22:49:58 +00:00
|
|
|
sqlite3_close (db);
|
|
|
|
}
|
|
|
|
g_free (filename);
|
2009-11-05 22:50:49 +00:00
|
|
|
if ((sqlite3_exec (db, "CREATE TABLE IF NOT EXISTS "
|
|
|
|
"forms (domain text, field text, value text)",
|
2012-01-07 05:31:37 +00:00
|
|
|
NULL, NULL, &errmsg) == SQLITE_OK))
|
|
|
|
{
|
|
|
|
priv->db = db;
|
|
|
|
}
|
2009-11-05 22:50:49 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (errmsg)
|
|
|
|
{
|
|
|
|
g_critical (_("Failed to execute database statement: %s\n"), errmsg);
|
|
|
|
sqlite3_free (errmsg);
|
|
|
|
if (errmsg2)
|
|
|
|
{
|
|
|
|
g_critical (_("Failed to execute database statement: %s\n"), errmsg2);
|
|
|
|
sqlite3_free (errmsg2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sqlite3_close (db);
|
|
|
|
}
|
2009-11-01 22:49:58 +00:00
|
|
|
|
2012-01-07 05:31:37 +00:00
|
|
|
g_object_set_data (G_OBJECT (extension), "priv", priv);
|
2009-10-06 18:35:56 +00:00
|
|
|
browsers = katze_object_get_object (app, "browsers");
|
2010-09-11 21:39:51 +00:00
|
|
|
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
2009-10-06 18:35:56 +00:00
|
|
|
formhistory_app_add_browser_cb (app, browser, extension);
|
|
|
|
g_signal_connect (app, "add-browser",
|
|
|
|
G_CALLBACK (formhistory_app_add_browser_cb), extension);
|
|
|
|
|
|
|
|
g_object_unref (browsers);
|
|
|
|
}
|
|
|
|
|
2011-08-09 13:01:34 +00:00
|
|
|
static void
|
|
|
|
formhistory_preferences_response_cb (GtkWidget* dialog,
|
|
|
|
gint response_id,
|
|
|
|
MidoriExtension* extension)
|
|
|
|
{
|
|
|
|
GtkWidget* checkbox;
|
|
|
|
gboolean old_state;
|
|
|
|
gboolean new_state;
|
|
|
|
MidoriApp* app;
|
|
|
|
KatzeArray* browsers;
|
|
|
|
MidoriBrowser* browser;
|
|
|
|
|
|
|
|
if (response_id == GTK_RESPONSE_APPLY)
|
|
|
|
{
|
|
|
|
checkbox = g_object_get_data (G_OBJECT (dialog), "always-load-checkbox");
|
|
|
|
new_state = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
|
|
|
|
old_state = midori_extension_get_boolean (extension, "always-load");
|
|
|
|
|
|
|
|
if (old_state != new_state)
|
|
|
|
{
|
|
|
|
midori_extension_set_boolean (extension, "always-load", new_state);
|
|
|
|
|
|
|
|
app = midori_extension_get_app (extension);
|
|
|
|
browsers = katze_object_get_object (app, "browsers");
|
|
|
|
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
|
|
|
{
|
|
|
|
midori_browser_foreach (browser,
|
2012-01-07 05:31:37 +00:00
|
|
|
(GtkCallback)formhistory_deactivate_tab, extension);
|
2011-08-09 13:01:34 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (
|
|
|
|
browser, formhistory_add_tab_cb, extension);
|
|
|
|
|
|
|
|
if (new_state)
|
|
|
|
{
|
|
|
|
midori_browser_foreach (browser,
|
|
|
|
(GtkCallback)formhistory_add_tab_foreach_cb, extension);
|
|
|
|
g_signal_connect (browser, "add-tab",
|
|
|
|
G_CALLBACK (formhistory_add_tab_cb), extension);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gtk_widget_destroy (dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
formhistory_preferences_cb (MidoriExtension* extension)
|
|
|
|
{
|
|
|
|
GtkWidget* dialog;
|
|
|
|
GtkWidget* content_area;
|
|
|
|
GtkWidget* checkbox;
|
|
|
|
|
|
|
|
dialog = gtk_dialog_new ();
|
|
|
|
|
|
|
|
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
|
|
|
|
|
|
|
gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
|
|
|
|
gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_APPLY, GTK_RESPONSE_APPLY);
|
|
|
|
|
|
|
|
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
|
|
|
checkbox = gtk_check_button_new_with_label (_("only activate form history via hotkey (Ctrl+Shift+F) per tab"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox),
|
|
|
|
!midori_extension_get_boolean (extension, "always-load"));
|
|
|
|
g_object_set_data (G_OBJECT (dialog), "always-load-checkbox", checkbox);
|
|
|
|
gtk_container_add (GTK_CONTAINER (content_area), checkbox);
|
|
|
|
|
|
|
|
g_signal_connect (dialog,
|
|
|
|
"response",
|
|
|
|
G_CALLBACK (formhistory_preferences_response_cb),
|
|
|
|
extension);
|
|
|
|
gtk_widget_show_all (dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
formhistory_toggle_state_cb (GtkAction* action,
|
|
|
|
MidoriBrowser* browser)
|
|
|
|
{
|
|
|
|
MidoriView* view = MIDORI_VIEW (midori_browser_get_current_tab (browser));
|
|
|
|
MidoriExtension* extension = g_object_get_data (G_OBJECT (browser), "FormHistoryExtension");
|
|
|
|
GtkWidget* web_view = midori_view_get_web_view (view);
|
|
|
|
|
|
|
|
if (g_signal_handler_find (web_view, G_SIGNAL_MATCH_FUNC,
|
|
|
|
g_signal_lookup ("window-object-cleared", MIDORI_TYPE_VIEW), 0, NULL,
|
|
|
|
formhistory_window_object_cleared_cb, extension))
|
|
|
|
{
|
2012-01-07 05:31:37 +00:00
|
|
|
formhistory_deactivate_tab (view, extension);
|
2011-08-09 13:01:34 +00:00
|
|
|
} else {
|
|
|
|
formhistory_add_tab_cb (browser, view, extension);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-07 20:30:16 +00:00
|
|
|
#if G_ENABLE_DEBUG
|
|
|
|
/*
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>autosuggest testcase</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<form method=post>
|
|
|
|
<p><input type="text" id="txt1" /></p>
|
|
|
|
<p><input type="text" name="txt2" /></p>
|
|
|
|
<input type=submit>
|
|
|
|
</form>
|
|
|
|
</body>
|
|
|
|
</html> */
|
|
|
|
#endif
|
|
|
|
|
2009-10-06 18:35:56 +00:00
|
|
|
MidoriExtension*
|
|
|
|
extension_init (void)
|
|
|
|
{
|
2009-11-01 22:49:58 +00:00
|
|
|
const gchar* ver;
|
2009-10-07 20:30:16 +00:00
|
|
|
gchar* desc;
|
2009-11-01 22:49:58 +00:00
|
|
|
MidoriExtension* extension;
|
|
|
|
|
2012-01-07 05:31:37 +00:00
|
|
|
ver = "2.0" MIDORI_VERSION_SUFFIX;
|
|
|
|
desc = g_strdup (_("Stores history of entered form data"));
|
2009-11-01 22:49:58 +00:00
|
|
|
|
|
|
|
extension = g_object_new (MIDORI_TYPE_EXTENSION,
|
2009-10-06 18:35:56 +00:00
|
|
|
"name", _("Form history filler"),
|
2009-10-07 20:30:16 +00:00
|
|
|
"description", desc,
|
|
|
|
"version", ver,
|
2009-10-06 18:35:56 +00:00
|
|
|
"authors", "Alexander V. Butenko <a.butenka@gmail.com>",
|
|
|
|
NULL);
|
2011-08-09 13:01:34 +00:00
|
|
|
|
2009-10-07 20:30:16 +00:00
|
|
|
g_free (desc);
|
|
|
|
|
2012-01-07 05:31:37 +00:00
|
|
|
midori_extension_install_boolean (extension, "always-load", TRUE);
|
|
|
|
g_signal_connect (extension, "activate",
|
|
|
|
G_CALLBACK (formhistory_activate_cb), NULL);
|
|
|
|
g_signal_connect (extension, "open-preferences",
|
|
|
|
G_CALLBACK (formhistory_preferences_cb), NULL);
|
2009-10-06 18:35:56 +00:00
|
|
|
|
|
|
|
return extension;
|
|
|
|
}
|