aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-02-28 10:46:31 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-02-28 10:46:31 +0800
commit9f7e8afa6de9c9a643d727f791160ce11cff7044 (patch)
treec09146bfb54db198e0823cfeb6297b1f6828ff84 /lib
parentea7657cbc7b0a294305716fa0ed3660ccdb15f43 (diff)
downloadgsoc2013-epiphany-9f7e8afa6de9c9a643d727f791160ce11cff7044.tar
gsoc2013-epiphany-9f7e8afa6de9c9a643d727f791160ce11cff7044.tar.gz
gsoc2013-epiphany-9f7e8afa6de9c9a643d727f791160ce11cff7044.tar.bz2
gsoc2013-epiphany-9f7e8afa6de9c9a643d727f791160ce11cff7044.tar.lz
gsoc2013-epiphany-9f7e8afa6de9c9a643d727f791160ce11cff7044.tar.xz
gsoc2013-epiphany-9f7e8afa6de9c9a643d727f791160ce11cff7044.tar.zst
gsoc2013-epiphany-9f7e8afa6de9c9a643d727f791160ce11cff7044.zip
cleaner xml dump code.
2003-02-28 Marco Pesenti Gritti <marco@it.gnome.org> * lib/ephy-start-here.c: (ephy_start_here_get_page): cleaner xml dump code. * lib/widgets/ephy-autocompletion-window.c: (ephy_autocompletion_window_key_press_hack): * lib/widgets/ephy-location-entry.c: (ephy_location_entry_init), (ephy_location_entry_finalize_impl), (ephy_location_entry_autocompletion_show_alternatives_to), (ephy_location_entry_key_press_event_cb), (ephy_location_entry_autocompletion_window_url_selected_cb): Do not overwrite search text when going on an action, make Esc get back the location content before the completion.
Diffstat (limited to 'lib')
-rw-r--r--lib/ephy-start-here.c17
-rw-r--r--lib/widgets/ephy-autocompletion-window.c2
-rw-r--r--lib/widgets/ephy-location-entry.c14
3 files changed, 18 insertions, 15 deletions
diff --git a/lib/ephy-start-here.c b/lib/ephy-start-here.c
index 3de8dffa3..834d890da 100644
--- a/lib/ephy-start-here.c
+++ b/lib/ephy-start-here.c
@@ -378,12 +378,11 @@ build_content (EphyStartHere *sh, xmlNodePtr node)
char *
ephy_start_here_get_page (EphyStartHere *sh, const char *id)
{
- xmlNodePtr child;
- xmlNodePtr root;
- xmlBufferPtr buf;
+ xmlNodePtr root;
const char *xml_filepath;
char *xml_filename;
- char *content;
+ xmlChar *content;
+ int size;
xml_filename = g_strconcat ("starthere/", id, ".xml", NULL);
xml_filepath = ephy_file (xml_filename);
@@ -392,20 +391,12 @@ ephy_start_here_get_page (EphyStartHere *sh, const char *id)
sh->priv->doc = xmlParseFile (xml_filepath);
root = xmlDocGetRootElement (sh->priv->doc);
- buf = xmlBufferCreate ();
select_language (sh, root);
build_content (sh, root);
- child = sh->priv->doc->children;
- while (child)
- {
- xmlNodeDump (buf, sh->priv->doc, child, 1, 1);
- child = child->next;
- }
+ xmlDocDumpMemory (sh->priv->doc, &content, &size);
- content = g_strdup (xmlBufferContent (buf));
- xmlBufferFree (buf);
xmlFreeDoc (sh->priv->doc);
return content;
diff --git a/lib/widgets/ephy-autocompletion-window.c b/lib/widgets/ephy-autocompletion-window.c
index 8921c93f1..e57735438 100644
--- a/lib/widgets/ephy-autocompletion-window.c
+++ b/lib/widgets/ephy-autocompletion-window.c
@@ -731,6 +731,8 @@ ephy_autocompletion_window_key_press_hack (EphyAutocompletionWindow *aw,
break;
}
+ action = (p->active_tree_view == p->action_tree_view);
+
switch (keyval)
{
case GDK_Up:
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index e6fde2889..57fb89485 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -140,6 +140,7 @@ ephy_location_entry_init (EphyLocationEntry *w)
w->priv = p;
p->last_action_target = NULL;
p->editing = FALSE;
+ p->before_completion = NULL;
ephy_location_entry_build (w);
@@ -169,6 +170,8 @@ ephy_location_entry_finalize_impl (GObject *o)
LOG ("EphyLocationEntry finalized")
+ g_free (p->before_completion);
+
g_free (p);
G_OBJECT_CLASS (gtk_hbox_class)->finalize (o);
}
@@ -245,6 +248,9 @@ ephy_location_entry_autocompletion_show_alternatives_to (EphyLocationEntry *w)
{
EphyLocationEntryPrivate *p = w->priv;
+ g_free (p->before_completion),
+ p->before_completion = gtk_editable_get_chars (GTK_EDITABLE(p->entry), 0, -1);
+
if (ephy_location_ignore_prefix (w)) return FALSE;
if (p->autocompletion)
@@ -378,11 +384,15 @@ ephy_location_entry_key_press_event_cb (GtkWidget *entry, GdkEventKey *event, Ep
case GDK_Right:
case GDK_Up:
case GDK_Down:
- case GDK_Escape:
case GDK_Page_Up:
case GDK_Page_Down:
ephy_location_entry_autocompletion_hide_alternatives (w);
return FALSE;
+ case GDK_Escape:
+ real_entry_set_location (w, p->before_completion);
+ gtk_editable_set_position (GTK_EDITABLE (p->entry), -1);
+ ephy_location_entry_autocompletion_hide_alternatives (w);
+ return FALSE;
default:
w->priv->editing = TRUE;
ephy_location_entry_autocompletion_unselect_alternatives (w);
@@ -468,7 +478,7 @@ ephy_location_entry_autocompletion_window_url_selected_cb (EphyAutocompletionWin
int action,
EphyLocationEntry *w)
{
- real_entry_set_location (w, target);
+ real_entry_set_location (w, action ? w->priv->before_completion : target);
}
void