Exemplo n.º 1
0
static void
menu_callback (GtkWidget *menu,
               gpointer   data)
{
  gint steps = GPOINTER_TO_INT (data);

  webkit_web_view_go_back_or_forward (WEBKIT_WEB_VIEW (view), steps);
}
Exemplo n.º 2
0
static gint
luaH_webview_go_forward(lua_State *L)
{
    webview_data_t *d = luaH_checkwvdata(L, 1);
    gint steps = (gint) luaL_checknumber(L, 2);
    webkit_web_view_go_back_or_forward(d->view, steps);
    return 0;
}
Exemplo n.º 3
0
static void
webview_set_history(lua_State *L, WebKitWebView *view, gint idx)
{
    gint pos, bflen;
    WebKitWebBackForwardList *bflist;
    WebKitWebHistoryItem *item = NULL;
    gchar *uri = NULL;

    if(!lua_istable(L, idx))
        luaL_error(L, "invalid history table");

    /* get history items table */
    lua_pushliteral(L, "items");
    lua_rawget(L, idx);
    bflen = lua_objlen(L, -1);

    /* create new back-forward history list */
    bflist = webkit_web_back_forward_list_new_with_web_view(view);
    webkit_web_back_forward_list_clear(bflist);

    /* get position of current history item */
    lua_pushliteral(L, "index");
    lua_rawget(L, idx);
    pos = (gint)lua_tonumber(L, -1);
    /* load last item if out of range */
    pos = (pos < 1 || pos > bflen) ? 0 : pos - bflen;
    lua_pop(L, 1);

    /* now we actually set the history to the content of the list */
    for (gint i = 1; i <= bflen; i++) {
        lua_rawgeti(L, -1, i);
        lua_pushliteral(L, "title");
        lua_rawget(L, -2);
        lua_pushliteral(L, "uri");
        lua_rawget(L, -3);
        if (pos || i < bflen) {
            item = webkit_web_history_item_new_with_data(lua_tostring(L, -1), NONULL(lua_tostring(L, -2)));
            webkit_web_back_forward_list_add_item(bflist, item);
        } else
            uri = g_strdup(lua_tostring(L, -1));
        lua_pop(L, 3);
    }

    /* load last item */
    if (uri) {
        webkit_web_view_load_uri(view, uri);
        g_free(uri);

    /* load item in history */
    } else if (bflen && webkit_web_view_can_go_back_or_forward(view, pos)) {
        webkit_web_view_go_back_or_forward(view, pos);

    /* load "about:blank" on empty history list */
    } else
        webkit_web_view_load_uri(view, "about:blank");

    lua_pop(L, 1);
}
Exemplo n.º 4
0
static gint
luaH_webview_go_forward(lua_State *L)
{
    widget_t *w = luaH_checkudata(L, 1, &widget_class);
    gint steps = (gint) luaL_checknumber(L, 2);
    GtkWidget *view = GTK_WIDGET(g_object_get_data(G_OBJECT(w->widget), "webview"));
    webkit_web_view_go_back_or_forward(WEBKIT_WEB_VIEW(view), steps);
    return 0;
}
Exemplo n.º 5
0
static int gtkWebBrowserSetBackForwardAttrib(Ihandle* ih, const char* value)
{
  int val;
  if (iupStrToInt(value, &val))
  {
    /* Negative values represent steps backward while positive values represent steps forward. */
    webkit_web_view_go_back_or_forward((WebKitWebView*)ih->handle, val);
  }
  return 0; /* do not store value in hash table */
}
Exemplo n.º 6
0
/* session_load_webview(WebKitWebView *, char *, int *){{{*/
static void
session_load_webview(GList *gl, char *uri, int last, int lock_status) \
{
    if (last > 0) 
        webkit_web_view_go_back_or_forward(WEBVIEW(gl), -last);
    else 
    {
        WebKitWebBackForwardList *bf_list = webkit_web_view_get_back_forward_list(WEBVIEW(gl));
        webkit_web_view_go_to_back_forward_item(WEBVIEW(gl), webkit_web_back_forward_list_get_nth_item(bf_list, 0));
    }
    if (lock_status > 0) 
    {
        SessionTab *tab = dwb_malloc(sizeof(SessionTab));
        tab->gl = gl;
        tab->lock = lock_status;
        g_signal_connect(WEBVIEW(gl), "notify::load-status", G_CALLBACK(session_load_status_callback), tab);
    }
}/*}}}*/
Exemplo n.º 7
0
void
navigate(Client *c, const Arg *arg) {
	gint steps = *(gint *)arg;
	webkit_web_view_go_back_or_forward(c->view, steps);
}
Exemplo n.º 8
0
Arquivo: commands.c Projeto: 41px/uzbl
void
view_go_forward(WebKitWebView *page, GArray *argv, GString *result) {
    (void)result;
    int n = argv_idx(argv, 0) ? atoi(argv_idx(argv, 0)) : 1;
    webkit_web_view_go_back_or_forward(page, n);
}