From e63a085bb01b783057e0cba91725f3af884d3292 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Sun, 30 Dec 2007 00:24:40 +0000 Subject: Port ephy-window.c to the new API, remove old API. Closes bug #506005 svn path=/trunk/; revision=7836 --- src/ephy-window.c | 22 ++++++++++----------- src/epiphany.defs | 33 ------------------------------- src/epiphany.override | 54 --------------------------------------------------- 3 files changed, 11 insertions(+), 98 deletions(-) (limited to 'src') diff --git a/src/ephy-window.c b/src/ephy-window.c index b7d4d4be7..ef8935bea 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1590,10 +1590,9 @@ sync_tab_navigation (EphyEmbed *embed, EphyWindow *window) { EphyEmbedNavigationFlags flags; + EphyHistoryItem *item; gboolean up = FALSE, back = FALSE, forward = FALSE; - char *back_url = NULL, *forward_url = NULL; char *back_title = NULL, *forward_title = NULL; - gint position; if (window->priv->closing) return; @@ -1615,18 +1614,21 @@ sync_tab_navigation (EphyEmbed *embed, ephy_toolbar_set_navigation_actions (window->priv->toolbar, back, forward, up); - position = ephy_embed_shistory_get_pos (embed); + item = ephy_embed_get_previous_history_item (embed); - if (position > 0) + if (item) { - ephy_embed_shistory_get_nth (embed, -1, TRUE, - &back_url, &back_title); + back_title = ephy_history_item_get_title (item); + g_object_unref (item); } - if (position < ephy_embed_shistory_n_items (embed) - 1) + + item = ephy_embed_get_next_history_item (embed); + + if (item) { - ephy_embed_shistory_get_nth (embed, 1, TRUE, - &forward_url, &forward_title); + forward_title = ephy_history_item_get_title (item); + g_object_unref (item); } ephy_toolbar_set_navigation_tooltips (window->priv->toolbar, @@ -1634,9 +1636,7 @@ sync_tab_navigation (EphyEmbed *embed, forward_title); g_free (back_title); - g_free (back_url); g_free (forward_title); - g_free (forward_url); } static void diff --git a/src/epiphany.defs b/src/epiphany.defs index 0317bf28b..d7a7747e1 100644 --- a/src/epiphany.defs +++ b/src/epiphany.defs @@ -1196,39 +1196,6 @@ (return-type "none") ) -(define-method shistory_n_items - (of-object "EphyEmbed") - (c-name "ephy_embed_shistory_n_items") - (return-type "int") -) - -(define-method shistory_get_nth - (of-object "EphyEmbed") - (c-name "ephy_embed_shistory_get_nth") - (return-type "none") - (parameters - '("int" "nth") - '("gboolean" "is_relative") - '("char**" "url") - '("char**" "title") - ) -) - -(define-method shistory_get_pos - (of-object "EphyEmbed") - (c-name "ephy_embed_shistory_get_pos") - (return-type "int") -) - -(define-method shistory_go_nth - (of-object "EphyEmbed") - (c-name "ephy_embed_shistory_go_nth") - (return-type "none") - (parameters - '("int" "nth") - ) -) - (define-method shistory_copy (of-object "EphyEmbed") (c-name "ephy_embed_shistory_copy") diff --git a/src/epiphany.override b/src/epiphany.override index f669da9c4..44b60d66d 100644 --- a/src/epiphany.override +++ b/src/epiphany.override @@ -270,60 +270,6 @@ _wrap_ephy_window_get_tabs(PyGObject *self) return py_list; } %% -override ephy_embed_shistory_get_nth kwargs -static PyObject* -_wrap_ephy_embed_shistory_get_nth (PyGObject *self, - PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = {"nth", "is_relative", NULL}; - int nth, is_relative; - char *url, *title; - PyObject *py_url, *py_title; - PyObject *py_list; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "ii:EphyEmbed.shistory_get_nth", kwlist, - &nth, &is_relative)) { - return NULL; - } - - ephy_embed_shistory_get_nth (EPHY_EMBED (self->obj), nth, is_relative, - &url, &title); - - if (!url || !title) { - return Py_None; - } - - if ((py_list = PyList_New(0)) == NULL) { - g_free (url); - g_free (title); - return NULL; - } - - py_url = PyString_FromString (url); - g_free (url); - if (!py_url) { - g_free (title); - Py_DECREF(py_list); - return NULL; - } - - PyList_Append(py_list, py_url); - Py_DECREF(py_url); - - py_title = PyString_FromString (title); - g_free (title); - - if (!py_title) { - Py_DECREF(py_list); - return NULL; - } - - PyList_Append(py_list, py_title); - Py_DECREF(py_title); - return py_list; -} -%% override ephy_embed_get_go_up_list noargs static PyObject* _wrap_ephy_embed_get_go_up_list (PyGObject *self) -- cgit v1.2.3