diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tab-page.c | 85 | ||||
-rw-r--r-- | src/tab-page.h | 6 |
2 files changed, 0 insertions, 91 deletions
diff --git a/src/tab-page.c b/src/tab-page.c index 9d32c31..1a7b37a 100644 --- a/src/tab-page.c +++ b/src/tab-page.c @@ -271,91 +271,6 @@ mq_tab_page_get_title(MqTabPage *tab_page) return tab_page->title; } -static void -open_response_cb(GtkWidget *dialog, gint response_id, MqTabPage *tab_page) -{ - gchar *filename; - gchar *uri; - - if (response_id == GTK_RESPONSE_ACCEPT) { - filename = gtk_file_chooser_get_filename( - GTK_FILE_CHOOSER(dialog)); - uri = g_strconcat("file://", filename, NULL); - g_free(filename); - mq_web_view_load_uri(MQ_WEB_VIEW(tab_page->web_view), uri); - g_free(uri); - } - - gtk_widget_destroy(dialog); -} - -void -mq_tab_page_open(MqTabPage *tab_page) -{ - GtkWidget *dialog; - - dialog = gtk_file_chooser_dialog_new("Open File", - GTK_WINDOW(tab_page->window), - GTK_FILE_CHOOSER_ACTION_OPEN, - "_Cancel", GTK_RESPONSE_CANCEL, - "_Open", GTK_RESPONSE_ACCEPT, - NULL); - g_signal_connect(dialog, "response", - G_CALLBACK(open_response_cb), tab_page); - gtk_widget_show_all(dialog); -} - -static void -save_async_cb(WebKitWebView *web_view, GAsyncResult *result) -{ - webkit_web_view_save_to_file_finish(web_view, result, NULL); -} - -static void -save_response_cb(GtkWidget *dialog, gint response_id, MqTabPage *tab_page) -{ - gchar *filename; - GFile *file; - - if (response_id == GTK_RESPONSE_ACCEPT) { - filename = gtk_file_chooser_get_filename( - GTK_FILE_CHOOSER(dialog)); - file = g_file_new_for_path(filename); - g_free(filename); - /* TODO: HTML-only file format? */ - webkit_web_view_save_to_file(tab_page->web_view, file, - WEBKIT_SAVE_MODE_MHTML, NULL, - (GAsyncReadyCallback) save_async_cb, NULL); - } - - gtk_widget_destroy(dialog); -} - -void -mq_tab_page_save(MqTabPage *tab_page) -{ - GtkWidget *dialog; - GtkFileChooser *chooser; - gchar *filename; - - dialog = gtk_file_chooser_dialog_new("Save File", - GTK_WINDOW(tab_page->window), - GTK_FILE_CHOOSER_ACTION_SAVE, - "_Cancel", GTK_RESPONSE_CANCEL, - "_Save", GTK_RESPONSE_ACCEPT, - NULL); - chooser = GTK_FILE_CHOOSER(dialog); - gtk_file_chooser_set_do_overwrite_confirmation(chooser, TRUE); - /* TODO: gtk_file_chooser_set_current_folder() */ - /* TODO: Clean up title for file name. */ - filename = g_strconcat(tab_page->title, ".mhtml", NULL); - gtk_file_chooser_set_current_name(chooser, filename); - g_free(filename); - g_signal_connect(dialog, "response", - G_CALLBACK(save_response_cb), tab_page); - gtk_widget_show_all(dialog); -} - void mq_tab_page_scroll_tab_labels(MqTabPage *node) { diff --git a/src/tab-page.h b/src/tab-page.h index e840ae1..c0c5612 100644 --- a/src/tab-page.h +++ b/src/tab-page.h @@ -80,12 +80,6 @@ const gchar * mq_tab_page_get_title(MqTabPage *tab_page); void -mq_tab_page_open(MqTabPage *tab_page); - -void -mq_tab_page_save(MqTabPage *tab_page); - -void mq_tab_page_scroll_tab_labels(MqTabPage *node); void |