aboutsummaryrefslogtreecommitdiff
path: root/src/narrative_window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/narrative_window.c')
-rw-r--r--src/narrative_window.c55
1 files changed, 48 insertions, 7 deletions
diff --git a/src/narrative_window.c b/src/narrative_window.c
index 6d6baf3..f7cadc6 100644
--- a/src/narrative_window.c
+++ b/src/narrative_window.c
@@ -37,6 +37,7 @@
#include "render.h"
#include "testcard.h"
#include "pr_clock.h"
+#include "print.h"
struct _narrative_window
@@ -133,12 +134,6 @@ static void save_sig(GSimpleAction *action, GVariant *parameter, gpointer vp)
}
-static void exportpdf_sig(GSimpleAction *action, GVariant *parameter,
- gpointer vp)
-{
-}
-
-
static void open_slidesorter_sig(GSimpleAction *action, GVariant *parameter,
gpointer vp)
{
@@ -307,11 +302,49 @@ static void testcard_sig(GSimpleAction *action, GVariant *parameter,
}
+static gint export_pdf_response_sig(GtkWidget *d, gint response,
+ struct presentation *p)
+{
+ if ( response == GTK_RESPONSE_ACCEPT ) {
+ char *filename;
+ filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(d));
+ export_pdf(p, filename);
+ g_free(filename);
+ }
+
+ gtk_widget_destroy(d);
+
+ return 0;
+}
+
+
+static void exportpdf_sig(GSimpleAction *action, GVariant *parameter,
+ gpointer vp)
+{
+ struct presentation *p = vp;
+ GtkWidget *d;
+
+ d = gtk_file_chooser_dialog_new("Export PDF",
+ NULL,
+ GTK_FILE_CHOOSER_ACTION_SAVE,
+ "_Cancel", GTK_RESPONSE_CANCEL,
+ "_Export", GTK_RESPONSE_ACCEPT,
+ NULL);
+ gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(d),
+ TRUE);
+
+ g_signal_connect(G_OBJECT(d), "response",
+ G_CALLBACK(export_pdf_response_sig), p);
+
+ gtk_widget_show_all(d);
+}
+
+
+
GActionEntry nw_entries[] = {
{ "save", save_sig, NULL, NULL, NULL },
{ "saveas", saveas_sig, NULL, NULL, NULL },
- { "exportpdf", exportpdf_sig, NULL, NULL, NULL },
{ "sorter", open_slidesorter_sig, NULL, NULL, NULL },
{ "deleteframe", delete_frame_sig, NULL, NULL, NULL },
{ "slide", add_slide_sig, NULL, NULL, NULL },
@@ -326,6 +359,12 @@ GActionEntry nw_entries[] = {
};
+GActionEntry nw_entries_p[] = {
+ { "print", print_sig, NULL, NULL, NULL },
+ { "exportpdf", exportpdf_sig, NULL, NULL, NULL },
+};
+
+
static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event,
NarrativeWindow *nw)
{
@@ -484,6 +523,8 @@ NarrativeWindow *narrative_window_new(struct presentation *p, GApplication *app)
g_action_map_add_action_entries(G_ACTION_MAP(nw->window), nw_entries,
G_N_ELEMENTS(nw_entries), nw);
+ g_action_map_add_action_entries(G_ACTION_MAP(nw->window), nw_entries_p,
+ G_N_ELEMENTS(nw_entries), p);
nw_update_titlebar(nw);