Copy F12 changes

This commit is contained in:
Matthias Clasen 2009-11-11 02:40:40 +00:00
parent 530224a762
commit 20e82775d5
6 changed files with 732 additions and 1 deletions

134
filesystemref.patch Normal file
View File

@ -0,0 +1,134 @@
diff -u -r pristine/gtk/gtkfilechooserbutton.c gtk+-2.18.3/gtk/gtkfilechooserbutton.c
--- pristine/gtk/gtkfilechooserbutton.c 2009-10-09 01:00:43.000000000 -0400
+++ gtk+-2.18.3/gtk/gtkfilechooserbutton.c 2009-11-10 19:25:55.257874597 -0500
@@ -1776,10 +1776,16 @@
GFile *base_file;
base_file = _gtk_file_system_volume_get_root (volume);
- if (base_file != NULL && !g_file_is_native (base_file))
+ if (base_file != NULL)
{
- _gtk_file_system_volume_free (volume);
- continue;
+ if (!g_file_is_native (base_file))
+ {
+ g_object_unref (base_file);
+ _gtk_file_system_volume_free (volume);
+ continue;
+ }
+ else
+ g_object_unref (base_file);
}
}
}
diff -u -r pristine/gtk/gtkfilechooserdefault.c gtk+-2.18.3/gtk/gtkfilechooserdefault.c
--- pristine/gtk/gtkfilechooserdefault.c 2009-10-16 10:35:45.000000000 -0400
+++ gtk+-2.18.3/gtk/gtkfilechooserdefault.c 2009-11-10 19:25:49.165873229 -0500
@@ -828,7 +828,7 @@
if (cancellable)
g_cancellable_cancel (cancellable);
- if (!(shortcut_type == SHORTCUT_TYPE_FILE ||
+ if (!(shortcut_type == SHORTCUT_TYPE_FILE ||
shortcut_type == SHORTCUT_TYPE_VOLUME) ||
!col_data)
return;
@@ -840,12 +840,10 @@
volume = col_data;
_gtk_file_system_volume_free (volume);
}
- else
+ if (shortcut_type == SHORTCUT_TYPE_FILE)
{
GFile *file;
- g_assert (shortcut_type == SHORTCUT_TYPE_FILE);
-
file = col_data;
g_object_unref (file);
}
@@ -2094,7 +2092,10 @@
}
if (!base_is_native)
- continue;
+ {
+ _gtk_file_system_volume_free (volume);
+ continue;
+ }
}
}
@@ -3587,9 +3588,7 @@
if (shortcut_type == SHORTCUT_TYPE_SEPARATOR)
return FALSE;
else if (shortcut_type == SHORTCUT_TYPE_VOLUME)
- {
- return FALSE;
- }
+ return FALSE;
else if (shortcut_type == SHORTCUT_TYPE_FILE)
{
GFile *file;
@@ -10794,6 +10793,9 @@
"standard::type",
shortcuts_activate_get_info_cb, data);
}
+
+ if (volume)
+ _gtk_file_system_volume_free (volume);
}
else if (shortcut_type == SHORTCUT_TYPE_SEARCH)
{
diff -u -r pristine/gtk/gtkfilesystem.c gtk+-2.18.3/gtk/gtkfilesystem.c
--- pristine/gtk/gtkfilesystem.c 2009-06-04 15:18:04.000000000 -0400
+++ gtk+-2.18.3/gtk/gtkfilesystem.c 2009-11-10 19:20:13.192873941 -0500
@@ -468,6 +468,8 @@
priv->volumes = g_slist_prepend (priv->volumes, g_object_ref (drive));
}
+
+ g_object_unref (drive);
}
g_list_free (drives);
@@ -499,6 +501,8 @@
/* see comment above in why we add an icon for a volume */
priv->volumes = g_slist_prepend (priv->volumes, g_object_ref (volume));
}
+
+ g_object_unref (volume);
}
/* add mounts that has no volume (/etc/mtab mounts, ftp, sftp,...) */
@@ -520,11 +524,13 @@
*/
if (mount_referenced_by_volume_activation_root (volumes, mount))
{
+ g_object_unref (mount);
continue;
}
/* show this mount */
priv->volumes = g_slist_prepend (priv->volumes, g_object_ref (mount));
+ g_object_unref (mount);
}
g_list_free (volumes);
@@ -604,6 +610,7 @@
get_volumes_list (GTK_FILE_SYSTEM (file_system));
list = g_slist_copy (priv->volumes);
+ g_slist_foreach (list, (GFunc)g_object_ref, NULL);
#ifndef G_OS_WIN32
/* Prepend root volume */
@@ -1025,6 +1032,8 @@
if (error)
g_error_free (error);
+
+ _gtk_file_system_volume_free (volume);
}
GCancellable *

View File

@ -0,0 +1,186 @@
--- gtk+-2.18.3/gtk/gtkprintcontext.c 2009-10-09 07:00:44.000000000 +0200
+++ gtk+-2.18.3/gtk/gtkprintcontext.c 2009-11-05 11:57:31.000000000 +0100
@@ -155,7 +155,6 @@ gtk_print_context_set_cairo_context (Gtk
context->pixels_per_unit_y);
}
-
void
_gtk_print_context_rotate_according_to_orientation (GtkPrintContext *context)
{
@@ -204,6 +203,36 @@ _gtk_print_context_rotate_according_to_o
}
void
+_gtk_print_context_reverse_according_to_orientation (GtkPrintContext *context)
+{
+ cairo_t *cr = context->cr;
+ cairo_matrix_t matrix;
+ gdouble width, height;
+
+ width = gtk_page_setup_get_paper_width (context->page_setup, GTK_UNIT_INCH);
+ width = width * context->surface_dpi_x / context->pixels_per_unit_x;
+ height = gtk_page_setup_get_paper_height (context->page_setup, GTK_UNIT_INCH);
+ height = height * context->surface_dpi_y / context->pixels_per_unit_y;
+
+ switch (gtk_page_setup_get_orientation (context->page_setup))
+ {
+ default:
+ case GTK_PAGE_ORIENTATION_PORTRAIT:
+ case GTK_PAGE_ORIENTATION_LANDSCAPE:
+ break;
+ case GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT:
+ case GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE:
+ cairo_translate (cr, width, height);
+ cairo_matrix_init (&matrix,
+ -1, 0,
+ 0, -1,
+ 0, 0);
+ cairo_transform (cr, &matrix);
+ break;
+ }
+}
+
+void
_gtk_print_context_translate_into_margin (GtkPrintContext *context)
{
GtkPrintOperationPrivate *priv;
--- gtk+-2.18.3/gtk/gtkprintoperation.c 2009-11-05 12:02:52.000000000 +0100
+++ gtk+-2.18.3/gtk/gtkprintoperation.c 2009-11-05 12:01:40.000000000 +0100
@@ -1960,14 +1960,11 @@ pdf_start_page (GtkPrintOperation *op,
GtkPrintContext *print_context,
GtkPageSetup *page_setup)
{
- GtkPaperSize *paper_size;
cairo_surface_t *surface = op->priv->platform_data;
gdouble w, h;
- paper_size = gtk_page_setup_get_paper_size (page_setup);
-
- w = gtk_paper_size_get_width (paper_size, GTK_UNIT_POINTS);
- h = gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS);
+ w = gtk_page_setup_get_paper_width (page_setup, GTK_UNIT_POINTS);
+ h = gtk_page_setup_get_paper_height (page_setup, GTK_UNIT_POINTS);
cairo_pdf_surface_set_size (surface, w, h);
}
@@ -2056,7 +2053,7 @@ run_pdf (GtkPrintOperation *op,
priv->manual_reverse = FALSE;
priv->manual_page_set = GTK_PAGE_SET_ALL;
priv->manual_scale = 1.0;
- priv->manual_orientation = TRUE;
+ priv->manual_orientation = FALSE;
priv->manual_number_up = 1;
priv->manual_number_up_layout = GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM;
@@ -2400,6 +2397,8 @@ common_render_page (GtkPrintOperation *o
if (priv->manual_orientation)
_gtk_print_context_rotate_according_to_orientation (print_context);
+ else
+ _gtk_print_context_reverse_according_to_orientation (print_context);
if (priv->manual_number_up > 1)
{
@@ -2934,7 +2933,7 @@ print_pages (GtkPrintOperation *op
priv->manual_reverse = gtk_print_settings_get_reverse (priv->print_settings);
priv->manual_page_set = gtk_print_settings_get_page_set (priv->print_settings);
priv->manual_scale = gtk_print_settings_get_scale (priv->print_settings) / 100.0;
- priv->manual_orientation = TRUE;
+ priv->manual_orientation = FALSE;
priv->manual_number_up = gtk_print_settings_get_number_up (priv->print_settings);
priv->manual_number_up_layout = gtk_print_settings_get_number_up_layout (priv->print_settings);
}
--- gtk+-2.18.3/gtk/gtkprintoperation-private.h 2009-10-09 07:00:44.000000000 +0200
+++ gtk+-2.18.3/gtk/gtkprintoperation-private.h 2009-11-05 11:58:07.000000000 +0100
@@ -135,11 +135,12 @@ void _gtk_print_operation_set_status (Gt
/* GtkPrintContext private functions: */
-GtkPrintContext *_gtk_print_context_new (GtkPrintOperation *op);
-void _gtk_print_context_set_page_setup (GtkPrintContext *context,
- GtkPageSetup *page_setup);
-void _gtk_print_context_translate_into_margin (GtkPrintContext *context);
-void _gtk_print_context_rotate_according_to_orientation (GtkPrintContext *context);
+GtkPrintContext *_gtk_print_context_new (GtkPrintOperation *op);
+void _gtk_print_context_set_page_setup (GtkPrintContext *context,
+ GtkPageSetup *page_setup);
+void _gtk_print_context_translate_into_margin (GtkPrintContext *context);
+void _gtk_print_context_rotate_according_to_orientation (GtkPrintContext *context);
+void _gtk_print_context_reverse_according_to_orientation (GtkPrintContext *context);
G_END_DECLS
--- gtk+-2.18.3/gtk/gtkprintoperation-unix.c 2009-11-05 12:02:52.000000000 +0100
+++ gtk+-2.18.3/gtk/gtkprintoperation-unix.c 2009-11-05 12:00:08.000000000 +0100
@@ -109,6 +109,8 @@ unix_start_page (GtkPrintOperation *op,
}
else if (type == CAIRO_SURFACE_TYPE_PDF)
{
+ w = gtk_page_setup_get_paper_width (page_setup, GTK_UNIT_POINTS);
+ h = gtk_page_setup_get_paper_height (page_setup, GTK_UNIT_POINTS);
cairo_pdf_surface_set_size (op_unix->surface, w, h);
}
}
@@ -771,7 +773,6 @@ _gtk_print_operation_platform_backend_cr
{
gchar *filename;
gint fd;
- GtkPaperSize *paper_size;
gdouble w, h;
cairo_surface_t *surface;
static cairo_user_data_key_t key;
@@ -787,9 +788,8 @@ _gtk_print_operation_platform_backend_cr
*target = filename;
- paper_size = gtk_page_setup_get_paper_size (page_setup);
- w = gtk_paper_size_get_width (paper_size, GTK_UNIT_POINTS);
- h = gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS);
+ w = gtk_page_setup_get_paper_width (page_setup, GTK_UNIT_POINTS);
+ h = gtk_page_setup_get_paper_height (page_setup, GTK_UNIT_POINTS);
*dpi_x = *dpi_y = 72;
surface = cairo_pdf_surface_create_for_stream (write_preview, GINT_TO_POINTER (fd), w, h);
@@ -822,9 +822,8 @@ _gtk_print_operation_platform_backend_re
GtkPaperSize *paper_size;
gdouble w, h;
- paper_size = gtk_page_setup_get_paper_size (page_setup);
- w = gtk_paper_size_get_width (paper_size, GTK_UNIT_POINTS);
- h = gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS);
+ w = gtk_page_setup_get_paper_width (page_setup, GTK_UNIT_POINTS);
+ h = gtk_page_setup_get_paper_height (page_setup, GTK_UNIT_POINTS);
cairo_pdf_surface_set_size (surface, w, h);
}
--- gtk+-2.18.3/modules/printbackends/file/gtkprintbackendfile.c 2009-10-09 07:00:45.000000000 +0200
+++ gtk+-2.18.3/modules/printbackends/file/gtkprintbackendfile.c 2009-11-05 12:02:32.000000000 +0100
@@ -698,6 +698,7 @@ file_printer_prepare_for_print (GtkPrint
GtkPageSetup *page_setup)
{
gdouble scale;
+ OutputFormat format;
print_job->print_pages = gtk_print_settings_get_print_pages (settings);
print_job->page_ranges = NULL;
@@ -719,7 +720,18 @@ file_printer_prepare_for_print (GtkPrint
print_job->scale = scale/100.0;
print_job->page_set = gtk_print_settings_get_page_set (settings);
- print_job->rotate_to_orientation = TRUE;
+
+ format = format_from_settings (settings);
+ switch (format)
+ {
+ case FORMAT_PDF:
+ print_job->rotate_to_orientation = FALSE;
+ break;
+ case FORMAT_PS:
+ case FORMAT_SVG:
+ print_job->rotate_to_orientation = TRUE;
+ break;
+ }
}
static GList *

337
gtk2-preview.patch Normal file
View File

@ -0,0 +1,337 @@
--- gtk+-2.18.3/gtk/gtkprintoperation.c 2009-10-09 07:00:44.000000000 +0200
+++ gtk+-2.18.3/gtk/gtkprintoperation.c 2009-11-02 12:05:55.000000000 +0100
@@ -78,11 +78,15 @@ enum
static guint signals[LAST_SIGNAL] = { 0 };
static int job_nr = 0;
+typedef struct _PrintPagesData PrintPagesData;
-static void preview_iface_init (GtkPrintOperationPreviewIface *iface);
-static GtkPageSetup *create_page_setup (GtkPrintOperation *op);
-static void common_render_page (GtkPrintOperation *op,
- gint page_nr);
+static void preview_iface_init (GtkPrintOperationPreviewIface *iface);
+static GtkPageSetup *create_page_setup (GtkPrintOperation *op);
+static void common_render_page (GtkPrintOperation *op,
+ gint page_nr);
+static void increment_page_sequence (PrintPagesData *data);
+static void prepare_data (PrintPagesData *data);
+static void clamp_page_ranges (PrintPagesData *data);
G_DEFINE_TYPE_WITH_CODE (GtkPrintOperation, gtk_print_operation, G_TYPE_OBJECT,
@@ -260,13 +264,23 @@ preview_start_page (GtkPrintOperation *o
GtkPrintContext *print_context,
GtkPageSetup *page_setup)
{
- g_signal_emit_by_name (op, "got-page-size", print_context, page_setup);
+ if ((op->priv->manual_number_up < 2) ||
+ (op->priv->page_position % op->priv->manual_number_up == 0))
+ g_signal_emit_by_name (op, "got-page-size", print_context, page_setup);
}
static void
preview_end_page (GtkPrintOperation *op,
GtkPrintContext *print_context)
{
+ cairo_t *cr;
+
+ cr = gtk_print_context_get_cairo_context (print_context);
+
+ if ((op->priv->manual_number_up < 2) ||
+ ((op->priv->page_position + 1) % op->priv->manual_number_up == 0) ||
+ (op->priv->page_position == op->priv->nr_of_pages_to_print - 1))
+ cairo_show_page (cr);
}
static void
@@ -411,6 +425,31 @@ gtk_print_operation_get_property (GObjec
}
}
+struct _PrintPagesData
+{
+ GtkPrintOperation *op;
+ gint uncollated_copies;
+ gint collated_copies;
+ gint uncollated, collated, total;
+
+ gint range, num_ranges;
+ GtkPageRange *ranges;
+ GtkPageRange one_range;
+
+ gint page;
+ gint sheet;
+ gint first_position, last_position;
+ gint first_sheet;
+ gint num_of_sheets;
+ gint *pages;
+
+ GtkWidget *progress;
+
+ gboolean initialized;
+ gboolean is_preview;
+ gboolean done;
+};
+
typedef struct
{
GtkPrintOperationPreview *preview;
@@ -418,8 +457,8 @@ typedef struct
GtkWindow *parent;
cairo_surface_t *surface;
gchar *filename;
- guint page_nr;
gboolean wait;
+ PrintPagesData *pages_data;
} PreviewOp;
static void
@@ -441,6 +480,10 @@ preview_print_idle_done (gpointer data)
gtk_print_operation_preview_end_preview (pop->preview);
+ g_object_unref (pop->pages_data->op);
+ g_free (pop->pages_data->pages);
+ g_free (pop->pages_data);
+
g_object_unref (op);
g_free (pop);
}
@@ -450,9 +493,8 @@ preview_print_idle (gpointer data)
{
PreviewOp *pop;
GtkPrintOperation *op;
- gboolean retval = TRUE;
- cairo_t *cr;
GtkPrintOperationPrivate *priv;
+ gboolean done = FALSE;
pop = (PreviewOp *) data;
op = GTK_PRINT_OPERATION (pop->preview);
@@ -461,24 +503,23 @@ preview_print_idle (gpointer data)
if (priv->page_drawing_state == GTK_PAGE_DRAWING_STATE_READY)
{
- /* TODO: print out sheets not pages and follow ranges */
- if (pop->page_nr >= op->priv->nr_of_pages)
- retval = FALSE;
-
- if (pop->page_nr > 0)
+ if (!pop->pages_data->initialized)
{
- cr = gtk_print_context_get_cairo_context (pop->print_context);
- _gtk_print_operation_platform_backend_preview_end_page (op, pop->surface, cr);
+ pop->pages_data->initialized = TRUE;
+ prepare_data (pop->pages_data);
}
-
- if (retval)
+ else
{
- gtk_print_operation_preview_render_page (pop->preview, pop->page_nr);
- pop->page_nr++;
+ increment_page_sequence (pop->pages_data);
+
+ if (!pop->pages_data->done)
+ gtk_print_operation_preview_render_page (pop->preview, pop->pages_data->page);
+ else
+ done = priv->page_drawing_state == GTK_PAGE_DRAWING_STATE_READY;
}
}
- return retval;
+ return !done;
}
static void
@@ -502,7 +543,6 @@ preview_ready (GtkPrintOperationPreview
GtkPrintContext *context,
PreviewOp *pop)
{
- pop->page_nr = 0;
pop->print_context = context;
g_object_ref (preview);
@@ -529,6 +569,9 @@ gtk_print_operation_preview_handler (Gtk
pop->filename = NULL;
pop->preview = preview;
pop->parent = parent;
+ pop->pages_data = g_new0 (PrintPagesData, 1);
+ pop->pages_data->op = g_object_ref (GTK_PRINT_OPERATION (preview));
+ pop->pages_data->is_preview = TRUE;
page_setup = gtk_print_context_get_page_setup (context);
@@ -2026,30 +2069,6 @@ run_pdf (GtkPrintOperation *op,
return GTK_PRINT_OPERATION_RESULT_APPLY;
}
-typedef struct
-{
- GtkPrintOperation *op;
- gint uncollated_copies;
- gint collated_copies;
- gint uncollated, collated, total;
-
- gint range, num_ranges;
- GtkPageRange *ranges;
- GtkPageRange one_range;
-
- gint page;
- gint sheet;
- gint first_position, last_position;
- gint first_sheet;
- gint num_of_sheets;
- gint *pages;
-
- GtkWidget *progress;
-
- gboolean initialized;
- gboolean is_preview;
- gboolean done;
-} PrintPagesData;
static void
clamp_page_ranges (PrintPagesData *data)
@@ -2127,7 +2146,8 @@ increment_page_sequence (PrintPagesData
inc = 1;
/* changing sheet */
- if ((priv->page_position + 1) % priv->manual_number_up == 0 ||
+ if (priv->manual_number_up < 2 ||
+ (priv->page_position + 1) % priv->manual_number_up == 0 ||
priv->page_position == data->last_position ||
priv->page_position == priv->nr_of_pages_to_print - 1)
{
@@ -2579,27 +2599,27 @@ prepare_data (PrintPagesData *data)
priv = data->op->priv;
+ if (priv->manual_collation)
+ {
+ data->uncollated_copies = priv->manual_num_copies;
+ data->collated_copies = 1;
+ }
+ else
+ {
+ data->uncollated_copies = 1;
+ data->collated_copies = priv->manual_num_copies;
+ }
+
if (!data->initialized)
{
data->initialized = TRUE;
page_setup = create_page_setup (data->op);
- _gtk_print_context_set_page_setup (priv->print_context,
- page_setup);
+ _gtk_print_context_set_page_setup (priv->print_context,
+ page_setup);
g_object_unref (page_setup);
g_signal_emit (data->op, signals[BEGIN_PRINT], 0, priv->print_context);
- if (priv->manual_collation)
- {
- data->uncollated_copies = priv->manual_num_copies;
- data->collated_copies = 1;
- }
- else
- {
- data->uncollated_copies = 1;
- data->collated_copies = priv->manual_num_copies;
- }
-
return;
}
@@ -2670,10 +2690,15 @@ prepare_data (PrintPagesData *data)
data->collated = 0;
data->uncollated = 0;
- if (priv->nr_of_pages_to_print % priv->manual_number_up == 0)
- data->num_of_sheets = priv->nr_of_pages_to_print / priv->manual_number_up;
+ if (priv->manual_number_up > 1)
+ {
+ if (priv->nr_of_pages_to_print % priv->manual_number_up == 0)
+ data->num_of_sheets = priv->nr_of_pages_to_print / priv->manual_number_up;
+ else
+ data->num_of_sheets = priv->nr_of_pages_to_print / priv->manual_number_up + 1;
+ }
else
- data->num_of_sheets = priv->nr_of_pages_to_print / priv->manual_number_up + 1;
+ data->num_of_sheets = priv->nr_of_pages_to_print;
if (priv->manual_reverse)
{
@@ -2906,12 +2931,12 @@ print_pages (GtkPrintOperation *op
&priv->num_page_ranges);
priv->manual_num_copies = 1;
priv->manual_collation = FALSE;
- priv->manual_reverse = FALSE;
- priv->manual_page_set = GTK_PAGE_SET_ALL;
- priv->manual_scale = 1.0;
+ priv->manual_reverse = gtk_print_settings_get_reverse (priv->print_settings);
+ priv->manual_page_set = gtk_print_settings_get_page_set (priv->print_settings);
+ priv->manual_scale = gtk_print_settings_get_scale (priv->print_settings) / 100.0;
priv->manual_orientation = TRUE;
- priv->manual_number_up = 1;
- priv->manual_number_up_layout = GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM;
+ priv->manual_number_up = gtk_print_settings_get_number_up (priv->print_settings);
+ priv->manual_number_up_layout = gtk_print_settings_get_number_up_layout (priv->print_settings);
}
priv->print_pages_idle_id = gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE + 10,
--- gtk+-2.18.3/gtk/gtkprintoperation-unix.c 2009-10-09 07:00:44.000000000 +0200
+++ gtk+-2.18.3/gtk/gtkprintoperation-unix.c 2009-11-02 12:05:52.000000000 +0100
@@ -207,7 +207,7 @@ _gtk_print_operation_platform_backend_la
gchar *cmd;
gchar *preview_cmd;
GtkSettings *settings;
- GtkPrintSettings *print_settings;
+ GtkPrintSettings *print_settings = NULL;
GtkPageSetup *page_setup;
GKeyFile *key_file = NULL;
gchar *data = NULL;
@@ -235,8 +235,28 @@ _gtk_print_operation_platform_backend_la
key_file = g_key_file_new ();
- print_settings = gtk_print_operation_get_print_settings (op);
- gtk_print_settings_to_key_file (print_settings, key_file, NULL);
+ print_settings = gtk_print_settings_copy (gtk_print_operation_get_print_settings (op));
+
+ if (print_settings != NULL)
+ {
+ gtk_print_settings_set_reverse (print_settings, FALSE);
+ gtk_print_settings_set_page_set (print_settings, GTK_PAGE_SET_ALL);
+ gtk_print_settings_set_scale (print_settings, 1.0);
+ gtk_print_settings_set_number_up (print_settings, 1);
+ gtk_print_settings_set_number_up_layout (print_settings, GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM);
+
+ /* These removals are neccessary because cups-* settings have higher priority
+ * than normal settings.
+ */
+ gtk_print_settings_unset (print_settings, "cups-reverse");
+ gtk_print_settings_unset (print_settings, "cups-page-set");
+ gtk_print_settings_unset (print_settings, "cups-scale");
+ gtk_print_settings_unset (print_settings, "cups-number-up");
+ gtk_print_settings_unset (print_settings, "cups-number-up-layout");
+
+ gtk_print_settings_to_key_file (print_settings, key_file, NULL);
+ g_object_unref (print_settings);
+ }
page_setup = gtk_print_context_get_page_setup (op->priv->print_context);
gtk_page_setup_to_key_file (page_setup, key_file, NULL);
--- gtk+-2.18.3/gtk/gtkprintsettings.c 2009-10-09 07:00:44.000000000 +0200
+++ gtk+-2.18.3/gtk/gtkprintsettings.c 2009-11-02 12:05:52.000000000 +0100
@@ -1152,7 +1152,7 @@ gtk_print_settings_set_n_copies (GtkPrin
gint
gtk_print_settings_get_number_up (GtkPrintSettings *settings)
{
- return gtk_print_settings_get_int (settings, GTK_PRINT_SETTINGS_NUMBER_UP);
+ return gtk_print_settings_get_int_with_default (settings, GTK_PRINT_SETTINGS_NUMBER_UP, 1);
}
/**

View File

@ -0,0 +1,18 @@
--- gtk+-2.18.3/modules/printbackends/cups/gtkprintbackendcups.c 2009-10-09 07:00:45.000000000 +0200
+++ gtk+-2.18.3/modules/printbackends/cups/gtkprintbackendcups.c 2009-11-02 11:45:39.000000000 +0100
@@ -1628,7 +1628,6 @@ cups_request_printer_list_cb (GtkPrintBa
"media-low",
"media-empty",
"offline",
- "connecting-to-device",
"other"
};
static const char * reasons_descs[] =
@@ -1648,7 +1647,6 @@ cups_request_printer_list_cb (GtkPrintBa
N_("Printer '%s' is low on paper."),
N_("Printer '%s' is out of paper."),
N_("Printer '%s' is currently off-line."),
- N_("Printer '%s' may not be connected."),
N_("There is a problem on printer '%s'.")
};
gboolean is_paused = FALSE;

25
gtk2-rotate-layout.patch Normal file
View File

@ -0,0 +1,25 @@
--- gtk+-2.18.3/modules/printbackends/cups/gtkprintbackendcups.c 2009-11-02 12:10:58.000000000 +0100
+++ gtk+-2.18.3/modules/printbackends/cups/gtkprintbackendcups.c 2009-11-02 12:11:18.000000000 +0100
@@ -4317,18 +4317,18 @@ cups_printer_prepare_for_print (GtkPrint
break;
case GTK_PAGE_ORIENTATION_LANDSCAPE:
if (layout < 4)
- layout = layout + 5 - 2 * (layout % 2);
+ layout = layout + 2 + 4 * (1 - layout / 2);
else
- layout = layout - 6 + 4 * (1 - (layout - 4) / 2);
+ layout = layout - 3 - 2 * (layout % 2);
break;
case GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT:
layout = (layout + 3 - 2 * (layout % 2)) % 4 + 4 * (layout / 4);
break;
case GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE:
if (layout < 4)
- layout = layout + 2 + 4 * (1 - layout / 2);
+ layout = layout + 5 - 2 * (layout % 2);
else
- layout = layout - 3 - 2 * (layout % 2);
+ layout = layout - 6 + 4 * (1 - (layout - 4) / 2);
break;
}

View File

@ -17,7 +17,7 @@
Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X
Name: gtk2
Version: %{base_version}
Release: 16%{?dist}
Release: 21%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
Source: http://download.gnome.org/sources/gtk+/2.18/gtk+-%{version}.tar.bz2
@ -46,6 +46,14 @@ Patch8: tooltip-positioning.patch
Patch9: iconview-hang.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=599446
Patch10: toolbutton-assert.patch
# http://bugzilla.redhat.com/show_bug.cgi?id=529364
Patch11: gtk2-remove-connecting-reason.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=592582
Patch12: gtk2-preview.patch
Patch13: gtk2-rotate-layout.patch
Patch14: gtk2-landscape-pdf-print.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=600992
Patch15: filesystemref.patch
BuildRequires: atk-devel >= %{atk_version}
BuildRequires: pango-devel >= %{pango_version}
@ -167,6 +175,11 @@ This package contains developer documentation for the GTK+ widget toolkit.
%patch8 -p1 -b .tooltip-positioning
%patch9 -p1 -b .iconview-hang
%patch10 -p1 -b .toolbutton-assert
%patch11 -p1 -b .remove-connecting-reason
%patch12 -p1 -b .preview
%patch13 -p1 -b .rotate-layout
%patch14 -p1 -b .landscape-pdf-print
%patch15 -p1 -b .filesystemref
%build
libtoolize --force --copy
@ -180,6 +193,7 @@ if ! pkg-config --exists pangoxft ; then
fi
%configure --with-xinput=xfree \
--enable-debug \
--disable-gtk-doc \
--disable-rebuilds \
--with-libjasper \
@ -403,6 +417,23 @@ fi
%changelog
* Tue Nov 10 2009 Matthias Clasen <mclasen@redhat.com> - 2.18.3-21
- Fix refcounting issues in the filechooser that lead
to crashes with device hotplug (gnome #600992)
* Thu Nov 5 2009 Marek Kasik <mkasik@redhat.com> - 2.18.3-20
- Do not rotate page when printing to landscape PDF, just
- set correct width and height
* Mon Nov 2 2009 Marek Kasik <mkasik@redhat.com> - 2.18.3-19
- Correct rotation of number-up layout when printing landscape
* Mon Nov 2 2009 Marek Kasik <mkasik@redhat.com> - 2.18.3-18
- Show correct print preview (gnome bug #592582)
* Mon Nov 2 2009 Marek Kasik <mkasik@redhat.com> - 2.18.3-17
- Remove handling of "connecting-to-device" reason (#529364)
* Sat Oct 31 2009 Matthias Clasen <mclasen@redhta.com> - 2.18.3-16
- Handle screen changes for tooltips (#531568)