aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.me.uk>2018-04-15 20:49:27 +0200
committerThomas White <taw@bitwiz.me.uk>2018-04-15 20:49:27 +0200
commitc7ed5d6987429b249d318f830393a2a530388925 (patch)
treefcbc223484d10a51431a11b1407814246f82c06c
parente1b15231f87c06623730c1fdd7357480a9381971 (diff)
Tidy up nw_entries_p
-rw-r--r--src/narrative_window.c17
-rw-r--r--src/print.c5
-rw-r--r--src/print.h2
3 files changed, 12 insertions, 12 deletions
diff --git a/src/narrative_window.c b/src/narrative_window.c
index d09942a..33609eb 100644
--- a/src/narrative_window.c
+++ b/src/narrative_window.c
@@ -475,10 +475,17 @@ static gint export_pdf_response_sig(GtkWidget *d, gint response,
}
+static void print_sig(GSimpleAction *action, GVariant *parameter, gpointer vp)
+{
+ NarrativeWindow *nw = vp;
+ run_printing(nw->p, nw->window);
+}
+
+
static void exportpdf_sig(GSimpleAction *action, GVariant *parameter,
gpointer vp)
{
- struct presentation *p = vp;
+ NarrativeWindow *nw = vp;
GtkWidget *d;
d = gtk_file_chooser_dialog_new(_("Export PDF"),
@@ -491,7 +498,7 @@ static void exportpdf_sig(GSimpleAction *action, GVariant *parameter,
TRUE);
g_signal_connect(G_OBJECT(d), "response",
- G_CALLBACK(export_pdf_response_sig), p);
+ G_CALLBACK(export_pdf_response_sig), nw->p);
gtk_widget_show_all(d);
}
@@ -743,10 +750,6 @@ GActionEntry nw_entries[] = {
{ "prev", prev_para_sig, NULL, NULL, NULL },
{ "next", next_para_sig, NULL, NULL, NULL },
{ "last", last_para_sig, NULL, NULL, NULL },
-};
-
-
-GActionEntry nw_entries_p[] = {
{ "print", print_sig, NULL, NULL, NULL },
{ "exportpdf", exportpdf_sig, NULL, NULL, NULL },
};
@@ -798,8 +801,6 @@ NarrativeWindow *narrative_window_new(struct presentation *p, GApplication *papp
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), p);
nw_update_titlebar(nw);
diff --git a/src/print.c b/src/print.c
index b0e3a84..ce52ba8 100644
--- a/src/print.c
+++ b/src/print.c
@@ -291,9 +291,8 @@ static void print_draw(GtkPrintOperation *op, GtkPrintContext *ctx, gint page,
}
-void print_sig(GSimpleAction *action, GVariant *parameter, gpointer vp)
+void run_printing(struct presentation *p, GtkWidget *parent)
{
- struct presentation *p = vp;
GtkPrintOperation *print;
GtkPrintOperationResult res;
struct print_stuff *ps;
@@ -317,7 +316,7 @@ void print_sig(GSimpleAction *action, GVariant *parameter, gpointer vp)
res = gtk_print_operation_run(print,
GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
- GTK_WINDOW(NULL), NULL);
+ GTK_WINDOW(parent), NULL);
if ( res == GTK_PRINT_OPERATION_RESULT_APPLY ) {
if ( print_settings != NULL ) {
diff --git a/src/print.h b/src/print.h
index dffc7e8..265b7c1 100644
--- a/src/print.h
+++ b/src/print.h
@@ -27,6 +27,6 @@
#include <config.h>
#endif
-extern void print_sig(GSimpleAction *action, GVariant *parameter, gpointer vp);
+extern void run_printing(struct presentation *p, GtkWidget *parent);
#endif /* PRINT_H */