[gedit/wip/improve-printing] PrintJob: code clean-up of custom_widget_apply_cb()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/improve-printing] PrintJob: code clean-up of custom_widget_apply_cb()
- Date: Fri, 20 Feb 2015 15:17:10 +0000 (UTC)
commit cb2133242ac1043adebd0cb0d493dadd3966081b
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri Feb 20 16:15:43 2015 +0100
PrintJob: code clean-up of custom_widget_apply_cb()
gedit/gedit-print-job.c | 57 ++++++++++++++++++++++++++++++----------------
1 files changed, 37 insertions(+), 20 deletions(-)
---
diff --git a/gedit/gedit-print-job.c b/gedit/gedit-print-job.c
index 001258c..10b5a09 100644
--- a/gedit/gedit-print-job.c
+++ b/gedit/gedit-print-job.c
@@ -358,44 +358,57 @@ custom_widget_apply_cb (GtkPrintOperation *operation,
GtkWidget *widget,
GeditPrintJob *job)
{
- gboolean syntax, page_header;
- const gchar *body, *header, *numbers;
+ gboolean syntax;
+ gboolean page_header;
+ const gchar *body_font;
+ const gchar *header_font;
+ const gchar *numbers_font;
GtkWrapMode wrap_mode;
syntax = gtk_toggle_button_get_active (job->priv->syntax_checkbutton);
page_header = gtk_toggle_button_get_active (job->priv->page_header_checkbutton);
- body = gtk_font_button_get_font_name (job->priv->body_fontbutton);
- header = gtk_font_button_get_font_name (job->priv->headers_fontbutton);
- numbers = gtk_font_button_get_font_name (job->priv->numbers_fontbutton);
+ body_font = gtk_font_button_get_font_name (job->priv->body_fontbutton);
+ header_font = gtk_font_button_get_font_name (job->priv->headers_fontbutton);
+ numbers_font = gtk_font_button_get_font_name (job->priv->numbers_fontbutton);
g_settings_set_boolean (job->priv->print_settings,
- GEDIT_SETTINGS_PRINT_SYNTAX_HIGHLIGHTING, syntax);
- g_settings_set_boolean (job->priv->print_settings, GEDIT_SETTINGS_PRINT_HEADER,
+ GEDIT_SETTINGS_PRINT_SYNTAX_HIGHLIGHTING,
+ syntax);
+
+ g_settings_set_boolean (job->priv->print_settings,
+ GEDIT_SETTINGS_PRINT_HEADER,
page_header);
- g_settings_set_string (job->priv->print_settings, GEDIT_SETTINGS_PRINT_FONT_BODY_PANGO,
- body);
- g_settings_set_string (job->priv->print_settings, GEDIT_SETTINGS_PRINT_FONT_HEADER_PANGO,
- header);
- g_settings_set_string (job->priv->print_settings, GEDIT_SETTINGS_PRINT_FONT_NUMBERS_PANGO,
- numbers);
+
+ g_settings_set_string (job->priv->print_settings,
+ GEDIT_SETTINGS_PRINT_FONT_BODY_PANGO,
+ body_font);
+
+ g_settings_set_string (job->priv->print_settings,
+ GEDIT_SETTINGS_PRINT_FONT_HEADER_PANGO,
+ header_font);
+
+ g_settings_set_string (job->priv->print_settings,
+ GEDIT_SETTINGS_PRINT_FONT_NUMBERS_PANGO,
+ numbers_font);
if (gtk_toggle_button_get_active (job->priv->line_numbers_checkbutton))
{
+ gint num;
+
+ num = gtk_spin_button_get_value_as_int (job->priv->line_numbers_spinbutton);
+
g_settings_set (job->priv->print_settings,
GEDIT_SETTINGS_PRINT_LINE_NUMBERS,
- "u", MAX (1, gtk_spin_button_get_value_as_int (job->priv->line_numbers_spinbutton)));
+ "u", MAX (1, num));
}
else
{
g_settings_set (job->priv->print_settings,
- GEDIT_SETTINGS_PRINT_LINE_NUMBERS, "u", 0);
+ GEDIT_SETTINGS_PRINT_LINE_NUMBERS,
+ "u", 0);
}
- if (!gtk_toggle_button_get_active (job->priv->text_wrapping_checkbutton))
- {
- wrap_mode = GTK_WRAP_NONE;
- }
- else
+ if (gtk_toggle_button_get_active (job->priv->text_wrapping_checkbutton))
{
if (gtk_toggle_button_get_active (job->priv->do_not_split_checkbutton))
{
@@ -406,6 +419,10 @@ custom_widget_apply_cb (GtkPrintOperation *operation,
wrap_mode = GTK_WRAP_CHAR;
}
}
+ else
+ {
+ wrap_mode = GTK_WRAP_NONE;
+ }
g_settings_set_enum (job->priv->print_settings,
GEDIT_SETTINGS_PRINT_WRAP_MODE,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]