aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGustavo Noronha Silva <gns@gnome.org>2009-08-21 01:59:07 +0800
committerGustavo Noronha Silva <gns@gnome.org>2009-09-15 10:06:09 +0800
commitdef58964b0e7fa099b524a6e8bc34bed893118f7 (patch)
tree2180af55b166e386fe7b07df5e7610d9ab3baa3d /src
parentbd03e748e07dd300015fdfee111420162f346e5f (diff)
downloadgsoc2013-epiphany-def58964b0e7fa099b524a6e8bc34bed893118f7.tar
gsoc2013-epiphany-def58964b0e7fa099b524a6e8bc34bed893118f7.tar.gz
gsoc2013-epiphany-def58964b0e7fa099b524a6e8bc34bed893118f7.tar.bz2
gsoc2013-epiphany-def58964b0e7fa099b524a6e8bc34bed893118f7.tar.lz
gsoc2013-epiphany-def58964b0e7fa099b524a6e8bc34bed893118f7.tar.xz
gsoc2013-epiphany-def58964b0e7fa099b524a6e8bc34bed893118f7.tar.zst
gsoc2013-epiphany-def58964b0e7fa099b524a6e8bc34bed893118f7.zip
Implement saving the page using the DataSource API
Bug #562611
Diffstat (limited to 'src')
-rw-r--r--src/window-commands.c49
1 files changed, 35 insertions, 14 deletions
diff --git a/src/window-commands.c b/src/window-commands.c
index e6790c754..b3d437354 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -276,6 +276,32 @@ open_response_cb (GtkDialog *dialog, int response, EphyWindow *window)
gtk_widget_destroy (GTK_WIDGET (dialog));
}
+static void
+save_response_cb (GtkDialog *dialog, int response, EphyEmbed *embed)
+{
+ if (response == GTK_RESPONSE_ACCEPT)
+ {
+ char *uri, *converted;
+
+ uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
+ if (uri != NULL)
+ {
+ converted = g_filename_to_utf8 (uri, -1, NULL, NULL, NULL);
+
+ if (converted != NULL)
+ {
+ EphyWebView *web_view = ephy_embed_get_web_view (embed);
+ ephy_web_view_save (web_view, converted);
+ }
+
+ g_free (converted);
+ g_free (uri);
+ }
+ }
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
void
window_cmd_file_open (GtkAction *action,
EphyWindow *window)
@@ -299,26 +325,21 @@ window_cmd_file_save_as (GtkAction *action,
EphyWindow *window)
{
EphyEmbed *embed;
- EphyEmbedPersist *persist;
+ EphyFileChooser *dialog;
embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
g_return_if_fail (embed != NULL);
- persist = EPHY_EMBED_PERSIST
- (g_object_new (EPHY_TYPE_EMBED_PERSIST, NULL));
-
- ephy_embed_persist_set_embed (persist, embed);
- ephy_embed_persist_set_fc_title (persist, _("Save As"));
- ephy_embed_persist_set_fc_parent (persist,GTK_WINDOW (window));
-
- ephy_embed_persist_set_flags
- (persist, EPHY_EMBED_PERSIST_MAINDOC | EPHY_EMBED_PERSIST_ASK_DESTINATION);
- ephy_embed_persist_set_persist_key
- (persist, CONF_STATE_SAVE_DIR);
+ dialog = ephy_file_chooser_new (_("Save"),
+ GTK_WIDGET (window),
+ GTK_FILE_CHOOSER_ACTION_SAVE,
+ CONF_STATE_SAVE_DIR,
+ EPHY_FILE_FILTER_ALL_SUPPORTED);
- ephy_embed_persist_save (persist);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (save_response_cb), embed);
- g_object_unref (G_OBJECT(persist));
+ gtk_widget_show (GTK_WIDGET (dialog));
}
void