Implemented on_file_open()
This commit is contained in:
parent
57e003d38b
commit
7a4c4bbae7
@ -15,8 +15,6 @@ static char const _license[] =
|
||||
"You should have received a copy of the GNU General Public License along\n"
|
||||
"with Surfer; if not, write to the Free Software Foundation, Inc., 59 Temple\n"
|
||||
"Place, Suite 330, Boston, MA 02111-1307 USA\n";
|
||||
/* TODO:
|
||||
* - implement on_file_open() :) */
|
||||
|
||||
|
||||
|
||||
@ -78,7 +76,9 @@ void on_file_new_window(GtkWidget * widget, gpointer data)
|
||||
/* on_file_open */
|
||||
void on_file_open(GtkWidget * widget, gpointer data)
|
||||
{
|
||||
/* FIXME implement */
|
||||
Surfer * surfer = data;
|
||||
|
||||
surfer_open_dialog(surfer);
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
* - update the URL of the main window
|
||||
* - implement selection
|
||||
* - more meaningful status updates
|
||||
* - implement cookies
|
||||
* - implement referer
|
||||
* - need to take care of CSRF? eg remotely load local files */
|
||||
|
||||
|
||||
@ -563,6 +565,8 @@ static gboolean _stream_load_watch_file(GIOChannel * source,
|
||||
}
|
||||
if(len == 0) /* no more data */
|
||||
{
|
||||
surfer_set_progress(conn->ghtml->surfer, 1.0);
|
||||
surfer_set_status(conn->ghtml->surfer, "Ready");
|
||||
_ghtmlconn_delete(conn);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $Id$ */
|
||||
/* Copyright (c) 2008 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2009 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Surfer */
|
||||
/* Surfer is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU General Public License version 2 as published by the Free
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $Id$ */
|
||||
/* Copyright (c) 2008 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2009 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Surfer */
|
||||
/* Surfer is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU General Public License version 2 as published by the Free
|
||||
@ -24,11 +24,7 @@
|
||||
|
||||
/* GHTML */
|
||||
/* functions */
|
||||
#if 0 /* FIXME pass the callback data another way */
|
||||
GtkWidget * ghtml_new(void);
|
||||
#else
|
||||
GtkWidget * ghtml_new(Surfer * surfer);
|
||||
#endif
|
||||
|
||||
/* accessors */
|
||||
gboolean ghtml_can_go_back(GtkWidget * ghtml);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $Id$ */
|
||||
/* Copyright (c) 2008 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2009 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Surfer */
|
||||
/* Surfer is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU General Public License version 2 as published by the Free
|
||||
|
30
src/surfer.c
30
src/surfer.c
@ -357,6 +357,36 @@ int surfer_error(Surfer * surfer, char const * message, int ret)
|
||||
}
|
||||
|
||||
|
||||
/* surfer_open_dialog */
|
||||
void surfer_open(Surfer * surfer, char const * url)
|
||||
{
|
||||
ghtml_stop(surfer->view);
|
||||
ghtml_load_url(surfer->view, url);
|
||||
}
|
||||
|
||||
|
||||
/* surfer_open_dialog */
|
||||
void surfer_open_dialog(Surfer * surfer)
|
||||
{
|
||||
GtkWidget * dialog;
|
||||
char * filename = NULL;
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new("Open file...",
|
||||
GTK_WINDOW(surfer->window),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
|
||||
if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
|
||||
filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(
|
||||
dialog));
|
||||
gtk_widget_destroy(dialog);
|
||||
if(filename == NULL)
|
||||
return;
|
||||
surfer_open(surfer, filename);
|
||||
g_free(filename);
|
||||
}
|
||||
|
||||
|
||||
/* surfer_refresh */
|
||||
void surfer_refresh(Surfer * surfer)
|
||||
{
|
||||
|
@ -75,6 +75,9 @@ void surfer_set_title(Surfer * surfer, char const * title);
|
||||
/* useful */
|
||||
int surfer_error(Surfer * surfer, char const * message, int ret);
|
||||
|
||||
void surfer_open(Surfer * surfer, char const * url);
|
||||
void surfer_open_dialog(Surfer * surfer);
|
||||
|
||||
void surfer_refresh(Surfer * surfer);
|
||||
void surfer_reload(Surfer * surfer);
|
||||
void surfer_stop(Surfer * surfer);
|
||||
|
Loading…
Reference in New Issue
Block a user