aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-12-13 06:55:21 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-12-13 06:55:21 +0000
commitc38f75ca2d327c93bba14ff72f14bfe7856609a1 (patch)
tree22cd7e386bd04a37635d60b52eae69f99e899e95 /src
parentaae887a3faf1afb0c8b4760e16fa3480d920e086 (diff)
implemented page setup.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1420 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.c17
-rw-r--r--src/messageview.c16
-rw-r--r--src/printing.c21
-rw-r--r--src/printing.h2
4 files changed, 55 insertions, 1 deletions
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 3c37184a..3d630928 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -83,6 +83,7 @@
#include "statusbar.h"
#include "inputdialog.h"
#include "trayicon.h"
+#include "printing.h"
#include "utils.h"
#include "gtkutils.h"
#include "codeconv.h"
@@ -235,6 +236,11 @@ static void empty_trash_cb (MainWindow *mainwin,
static void save_as_cb (MainWindow *mainwin,
guint action,
GtkWidget *widget);
+#if GTK_CHECK_VERSION(2, 10, 0)
+static void page_setup_cb (MainWindow *mainwin,
+ guint action,
+ GtkWidget *widget);
+#endif
static void print_cb (MainWindow *mainwin,
guint action,
GtkWidget *widget);
@@ -511,6 +517,10 @@ static GtkItemFactoryEntry mainwin_entries[] =
{N_("/_File/Empty all _trash"), NULL, empty_trash_cb, 0, NULL},
{N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_File/_Save as..."), "<control>S", save_as_cb, 0, NULL},
+ {N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
+#if GTK_CHECK_VERSION(2, 10, 0)
+ {N_("/_File/Page set_up..."), NULL, page_setup_cb, 0, NULL},
+#endif
{N_("/_File/_Print..."), NULL, print_cb, 0, NULL},
{N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_File/_Work offline"), NULL, toggle_offline_cb, 0, "<ToggleItem>"},
@@ -2915,6 +2925,13 @@ static void save_as_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
summary_save_as(mainwin->summaryview);
}
+#if GTK_CHECK_VERSION(2, 10, 0)
+static void page_setup_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
+{
+ printing_page_setup_gtk();
+}
+#endif
+
static void print_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
{
summary_print(mainwin->summaryview);
diff --git a/src/messageview.c b/src/messageview.c
index 3e707005..dda0a00c 100644
--- a/src/messageview.c
+++ b/src/messageview.c
@@ -89,6 +89,11 @@ static gboolean key_pressed (GtkWidget *widget,
static void save_as_cb (gpointer data,
guint action,
GtkWidget *widget);
+#if GTK_CHECK_VERSION(2, 10, 0)
+static void page_setup_cb (gpointer data,
+ guint action,
+ GtkWidget *widget);
+#endif
static void print_cb (gpointer data,
guint action,
GtkWidget *widget);
@@ -143,6 +148,10 @@ static GtkItemFactoryEntry msgview_entries[] =
{
{N_("/_File"), NULL, NULL, 0, "<Branch>"},
{N_("/_File/_Save as..."), NULL, save_as_cb, 0, NULL},
+ {N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
+#if GTK_CHECK_VERSION(2, 10, 0)
+ {N_("/_File/Page set_up..."), NULL, page_setup_cb, 0, NULL},
+#endif
{N_("/_File/_Print..."), NULL, print_cb, 0, NULL},
{N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_File/_Close"), NULL, close_cb, 0, NULL},
@@ -791,6 +800,13 @@ static void save_as_cb(gpointer data, guint action, GtkWidget *widget)
messageview_save_as(messageview);
}
+#if GTK_CHECK_VERSION(2, 10, 0)
+static void page_setup_cb(gpointer data, guint action, GtkWidget *widget)
+{
+ printing_page_setup_gtk();
+}
+#endif
+
static void print_cb(gpointer data, guint action, GtkWidget *widget)
{
MessageView *messageview = (MessageView *)data;
diff --git a/src/printing.c b/src/printing.c
index 0aa0c01d..595d8244 100644
--- a/src/printing.c
+++ b/src/printing.c
@@ -74,6 +74,8 @@ typedef struct
gboolean all_headers;
} PrintData;
+static GtkPrintSettings *settings = NULL;
+static GtkPageSetup *page_setup = NULL;
static gint get_header_data(MsgPrintInfo *mpinfo, PrintData *print_data)
{
@@ -418,7 +420,6 @@ static void draw_page(GtkPrintOperation *operation, GtkPrintContext *context,
gint printing_print_messages_gtk(GSList *mlist, MimeInfo *partinfo,
gboolean all_headers)
{
- static GtkPrintSettings *settings = NULL;
GtkPrintOperation *op;
GtkPrintOperationResult res;
PrintData *print_data;
@@ -452,6 +453,8 @@ gint printing_print_messages_gtk(GSList *mlist, MimeInfo *partinfo,
if (settings)
gtk_print_operation_set_print_settings(op, settings);
+ if (page_setup)
+ gtk_print_operation_set_default_page_setup(op, page_setup);
res = gtk_print_operation_run
(op, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
@@ -484,6 +487,22 @@ gint printing_print_messages_gtk(GSList *mlist, MimeInfo *partinfo,
return 0;
}
+void printing_page_setup_gtk(void)
+{
+ GtkPageSetup *new_page_setup;
+
+ if (settings == NULL)
+ settings = gtk_print_settings_new();
+
+ new_page_setup = gtk_print_run_page_setup_dialog
+ (GTK_WINDOW(main_window_get()->window), page_setup, settings);
+
+ if (page_setup)
+ g_object_unref(page_setup);
+
+ page_setup = new_page_setup;
+}
+
#endif /* GTK_CHECK_VERSION(2, 10, 0) */
static gint check_command_line(const gchar *cmdline)
diff --git a/src/printing.h b/src/printing.h
index 6f6bebc0..c5f1168e 100644
--- a/src/printing.h
+++ b/src/printing.h
@@ -31,6 +31,8 @@
gint printing_print_messages_gtk (GSList *mlist,
MimeInfo *partinfo,
gboolean all_headers);
+
+void printing_page_setup_gtk (void);
#endif
gint printing_print_messages_with_command (GSList *mlist,