diff options
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | TODO | 12 | ||||
-rw-r--r-- | data/glade/prefs-dialog.glade | 518 | ||||
-rw-r--r-- | embed/ephy-history.c | 59 | ||||
-rw-r--r-- | lib/ephy-autocompletion.c | 5 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks.c | 6 |
6 files changed, 79 insertions, 541 deletions
@@ -1,3 +1,23 @@ +2002-12-31 Marco Pesenti Gritti <marco@it.gnome.org> + + * data/glade/prefs-dialog.glade: + + Remove hidden filtering page. + + * embed/ephy-history.c: + (ephy_history_autocompletion_source_foreach), (ephy_history_init), + (ephy_history_add_host), (ephy_history_visited), + (ephy_history_get_page_visits): + * lib/ephy-autocompletion.c: (ephy_autocompletion_refine_matches), + (ephy_autocompletion_update_matches_full_item): + * src/bookmarks/ephy-bookmarks.c: + (ephy_bookmarks_autocompletion_source_foreach): + + Fix memory corruption in bookmarks refine. + Implement history autocompletion score. + Smarter host matching code. + Add some sanity checks. + 2002-12-31 Christian Rose <menthos@menthos.com> * configure.in: Added "sv" to ALL_LINGUAS. @@ -1,10 +1,7 @@ To do: -- favicons doesnt work anymore -- ephy-dnd.c we still need it ? -- implement phoenix like popup blocking -- urls like www.gnome.org and gnome.org should use same folder in history -- history scoring for autocompletion +- implement phoenix like popup blocking / make popups less annoying +- drop items from history when they are not visited since some time Done: @@ -15,3 +12,8 @@ Done: * simplify/clean autocompletion entry code * favicons should not be fetched on load end * open bookmarks, close galeon -> crash +* favicons doesnt work anymore +* ephy-dnd.c we still need it ? +* autocompletion refine borked for bookmarks +* history scoring for autocompletion +* urls like www.gnome.org and gnome.org should use same folder in history diff --git a/data/glade/prefs-dialog.glade b/data/glade/prefs-dialog.glade index 4042ddbcc..d99edb7da 100644 --- a/data/glade/prefs-dialog.glade +++ b/data/glade/prefs-dialog.glade @@ -2404,524 +2404,6 @@ </child> </widget> -<widget class="GtkWindow" id="filtering_page_dialog"> - <property name="visible">True</property> - <property name="title" translatable="yes">window2</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - - <child> - <widget class="GtkVBox" id="filtering_page_box"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">18</property> - - <child> - <widget class="GtkVBox" id="vbox165"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label1261"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Cookies</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox150"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label1264"> - <property name="visible">True</property> - <property name="label" translatable="yes"> </property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox168"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkRadioButton" id="cookies_radiobutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Always accept</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="radiobutton51"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Accept _from current server only</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">cookies_radiobutton</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="radiobutton52"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Never accept</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">cookies_radiobutton</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="warn_cookie_checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Warn before accepting a cookie</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="session_cookie_checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Coo_kies expire at the end of the session</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox164"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label1260"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Images</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox149"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label1263"> - <property name="visible">True</property> - <property name="label" translatable="yes"> </property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox167"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkRadioButton" id="images_radiobutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Always load</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="radiobutton48"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Load from current server only</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">images_radiobutton</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="radiobutton49"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Never load</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">images_radiobutton</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox166"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label1262"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Others</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox151"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label1265"> - <property name="visible">True</property> - <property name="label" translatable="yes"> </property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table90"> - <property name="visible">True</property> - <property name="n_rows">3</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkCheckButton" id="allow_java_checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Allow _Java (requires plugin)</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="allow_js_checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Allow Java_Script</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="allow_popups_checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Allow _popups</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="allow_statusbar_checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Allow statusbar _messages</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="remember_passwords_checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Remember passwords</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> -</widget> - <widget class="GtkDialog" id="languages_dialog"> <property name="border_width">6</property> <property name="height_request">300</property> diff --git a/embed/ephy-history.c b/embed/ephy-history.c index c106b274a..0511cfe67 100644 --- a/embed/ephy-history.c +++ b/embed/ephy-history.c @@ -112,29 +112,41 @@ ephy_history_autocompletion_source_set_basic_key (EphyAutocompletionSource *sour static void ephy_history_autocompletion_source_foreach (EphyAutocompletionSource *source, - const gchar *current_text, - EphyAutocompletionSourceForeachFunc func, - gpointer data) + const gchar *current_text, + EphyAutocompletionSourceForeachFunc func, + gpointer data) { GPtrArray *children; int i; EphyHistory *eb = EPHY_HISTORY (source); + GTime now; + + now = time (NULL); children = ephy_node_get_children (eb->priv->pages); for (i = 0; i < children->len; i++) { EphyNode *kid; const char *url, *title; + int last_visit, visits; + guint32 score; kid = g_ptr_array_index (children, i); + g_assert (EPHY_IS_NODE (kid)); + url = ephy_node_get_property_string (kid, EPHY_NODE_PAGE_PROP_LOCATION); title = ephy_node_get_property_string (kid, EPHY_NODE_PAGE_PROP_TITLE); + last_visit = ephy_node_get_property_int + (kid, EPHY_NODE_PAGE_PROP_LAST_VISIT); + visits = ephy_node_get_property_int + (kid, EPHY_NODE_PAGE_PROP_VISITS); + score = MAX (visits - ((now - last_visit) >> 15), 1); func (source, url, url, url, FALSE, - FALSE, 0, data); + FALSE, score, data); } ephy_node_thaw (eb->priv->pages); } @@ -308,8 +320,6 @@ ephy_history_init (EphyHistory *eb) "ephy-history.xml", NULL); - ephy_node_system_init (); - eb->priv->pages_hash = g_hash_table_new (g_str_hash, g_str_equal); eb->priv->pages_hash_lock = g_new0 (GStaticRWLock, 1); @@ -425,7 +435,27 @@ ephy_history_add_host (EphyHistory *eh, const char *url) } g_static_rw_lock_reader_lock (eh->priv->hosts_hash_lock); + host = g_hash_table_lookup (eh->priv->hosts_hash, host_name); + + if (!host) + { + char *tmp; + + if (g_str_has_prefix (host_name, "www.")) + { + tmp = g_strdup (g_utf8_offset_to_pointer (host_name, 4)); + } + else + { + tmp = g_strconcat ("www.", host_name, NULL); + } + + host = g_hash_table_lookup (eh->priv->hosts_hash, tmp); + + g_free (tmp); + } + g_static_rw_lock_reader_unlock (eh->priv->hosts_hash_lock); if (!host) @@ -452,6 +482,8 @@ ephy_history_add_host (EphyHistory *eh, const char *url) ephy_node_add_child (eh->priv->hosts, host); } + g_assert (EPHY_IS_NODE (host)); + visits = ephy_node_get_property_int (host, EPHY_NODE_PAGE_PROP_VISITS); if (visits < 0) visits = 0; @@ -489,6 +521,8 @@ ephy_history_visited (EphyHistory *eh, EphyNode *node) now = time (NULL); + g_assert (EPHY_IS_NODE (node)); + url = ephy_node_get_property_string (node, EPHY_NODE_PAGE_PROP_LOCATION); @@ -525,14 +559,15 @@ ephy_history_get_page_visits (EphyHistory *gh, const char *url) { EphyNode *node; - int visits; + int visits = 0; node = ephy_history_get_page (gh, url); - - visits = ephy_node_get_property_int - (node, EPHY_NODE_PAGE_PROP_VISITS); - if (visits < 0) visits = 0; - visits++; + if (node) + { + visits = ephy_node_get_property_int + (node, EPHY_NODE_PAGE_PROP_VISITS); + if (visits < 0) visits = 0; + } return visits; } diff --git a/lib/ephy-autocompletion.c b/lib/ephy-autocompletion.c index a3f3348c1..265590003 100644 --- a/lib/ephy-autocompletion.c +++ b/lib/ephy-autocompletion.c @@ -369,8 +369,10 @@ ephy_autocompletion_refine_matches (EphyAutocompletion *ac) for (i = 0; i < oldmatches.num_matches; i++) { EphyAutocompletionMatch *mi = &oldmatches.array[i]; + if (mi->is_action || (mi->substring && g_strrstr (mi->match, p->keys[0])) || + (mi->substring && g_strrstr (mi->title, p->keys[0])) || !strncmp (key0, mi->title + mi->offset, key0l)) { acma_append (&newmatches, mi, mi->is_action); @@ -425,7 +427,8 @@ ephy_autocompletion_update_matches_full_item (EphyAutocompletionSource *source, EphyAutocompletionPrivate *p) { if (is_action || - (substring && g_strrstr (item, p->keys[0]))) + (substring && g_strrstr (item, p->keys[0])) || + (substring && g_strrstr (title, p->keys[0]))) { EphyAutocompletionMatch m; m.match = item; diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c index e27a30496..2353ea7da 100644 --- a/src/bookmarks/ephy-bookmarks.c +++ b/src/bookmarks/ephy-bookmarks.c @@ -119,7 +119,6 @@ ephy_bookmarks_autocompletion_source_foreach (EphyAutocompletionSource *source, { EphyNode *kid; const char *url, *smart_url, *title, *keywords; - char *item; kid = g_ptr_array_index (children, i); url = ephy_node_get_property_string @@ -130,7 +129,6 @@ ephy_bookmarks_autocompletion_source_foreach (EphyAutocompletionSource *source, (kid, EPHY_NODE_BMK_PROP_TITLE); keywords = ephy_node_get_property_string (kid, EPHY_NODE_BMK_PROP_KEYWORDS); - item = g_strconcat (title, keywords, NULL); if (smart_url == NULL || g_utf8_strlen (smart_url, -1) == 0) @@ -139,13 +137,11 @@ ephy_bookmarks_autocompletion_source_foreach (EphyAutocompletionSource *source, } func (source, - smart_url ? NULL : item, + smart_url ? NULL : keywords, title, smart_url ? smart_url : url, (smart_url != NULL), TRUE, 0, data); - - g_free (item); } ephy_node_thaw (eb->priv->bookmarks); } |