Commit Graph

141 Commits

Author SHA1 Message Date
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Carlos Garcia Campos
c836be0508 printing: Do not truncate job names in GtkPrintOperation
We are currently truncating job names to 255 bytes, because that's the
maximum allowed length of job-name attribute in CUPS. This is a CUPS
limitation that GtkPrintOperation shouldn't need to know, and it
shouldn't affect other backends, that might have other limitations or
even no limitation at all. This has another side effect, that what you
set as GtkPrintOperation:job-name could be different to what you get if
the property is truncated, this is not documented in
gtk_print_operation_set_job_name(). So, I think the job name should be
truncated by the CUPS backend, right before setting the job-name
attribute.

https://bugzilla.gnome.org/show_bug.cgi?id=774097
2016-11-10 16:57:30 +01:00
Debarshi Ray
2407f157c7 print-operation: Be more robust in the error path
This isn't an issue at the moment. Only exporting to a file can fail
by setting by setting an error and it happens to correctly return
GTK_PRINT_OPERATION_RESULT_ERROR regardless of this code.

Still, let's make this block of code more correct to prevent future
changes from introducing broken behaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=763731
2016-03-21 16:09:30 +01:00
Felipe Borges
70f577251f gtkprintoperation: job names must not exceed 255 chars
According to http://datatracker.ietf.org/doc/rfc2911/, The 'name'
attribute syntax is essentially the same as 'text', including the
REQUIRED support of UTF-8 except that the sequence of characters
is limited so that its encoded form MUST NOT exceed 255 (MAX) octets.

CUPS will not print jobs with names exceeding 255 characters.

https://bugzilla.gnome.org/show_bug.cgi?id=755988
2015-10-09 10:51:26 +02:00
Paolo Borelli
9f9c5ca49a print operation: let subclasses use a custom paginate
GtkPrintOperation was emitting paginate only if a signal was
connected, this meant that subclassing and overriding the
paginate vfunc lead to the unexpected result that paginate did
not run.
Instead we always emit the signal and use a custom accumulator:
if there is a signal we just run that and avoid the default
handler, otherwise we run the default handler which can be the
one by the subclass or the default handler that just skips
pagination.

Patch by Yevgen Muntyan, fixes #345345
2015-08-18 15:14:42 +02:00
Matthias Clasen
a111f6ee23 print operation: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen
fb573e58f1 Remove a pointless comparison
Comparing an unsigned value against < 0 is not going to succeed.
Pointed out by clang.
2015-03-22 15:16:14 -04:00
Leo Wolf
c85c3510e7 printing: Fix origin for scaled, rotated pages
The calls to cairo_translate in
_gtk_print_context_rotate_according_to_orientation,
_gtk_print_context_reverse_according_to_orientation and
_gtk_print_context_translate_into_margin assume an unscaled context.
These functions should therefore be called before scaling the context,
otherwise the origin does not always end up in the top left corner.

https://bugzilla.gnome.org/show_bug.cgi?id=740742
2014-11-27 12:21:27 +01:00
Руслан Ижбулатов
e934ddd498 Ensure that print operation is alive until we're done
https://bugzilla.gnome.org/show_bug.cgi?id=733767
2014-08-01 04:44:46 +00:00
Matthias Clasen
e1d1ed863e GtkPrintOperation: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:31:07 -04:00
Matthias Clasen
872fbfacd3 Split GtkWindowGroup into its own file
gtkwindow.c is too big and too messy. This is a small step
towards making it better.
2014-06-04 06:24:05 -04:00
Bastien Nocera
f71f7215ab all: Name more idles and timeouts
Following up from 438cd857c4,
name more timeouts and idles.

The original grep was missing checking for gdk_threads_add_*()
functions (at least for some of the files).

https://bugzilla.gnome.org/show_bug.cgi?id=726870
2014-03-26 20:09:30 -04:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
William Jon McCann
e34bd4137d docs: use apostrophes in *n't 2014-02-07 13:32:47 -05:00
William Jon McCann
2a45418b67 docs: use proper quotes 2014-02-05 15:08:42 -05:00
William Jon McCann
3b3d8ca456 docs: Use "#" for refsect2 instead of ## 2014-02-04 21:00:58 -05:00
William Jon McCann
63e887e165 docs: replace all <examples> with markdown headings 2014-02-04 16:58:54 -05:00
William Jon McCann
4c8bd8e7cf docs: Identify examples that are C code
https://bugzilla.gnome.org/show_bug.cgi?id=723119
2014-01-29 12:45:49 -05:00
William Jon McCann
768bc44081 docs: use |[ ]| instead of <programlisting></programlisting>
https://bugzilla.gnome.org/show_bug.cgi?id=723119
2014-01-29 12:45:49 -05:00
William Jon McCann
2d003553e8 docs: don't use <emphasis>
It is a little heavy handed. The text can speak for itself.
2014-01-28 02:02:05 -05:00
Bastien Nocera
438cd857c4 all: Add names to timeouts
Add names to every timeout we setup, so it's easier to track their
usage, and debug possible misbehaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=710651
2013-10-23 13:31:18 +02:00
Emmanuele Bassi
0899ef7cc9 gtk: Use new macros for defining private data
https://bugzilla.gnome.org/show_bug.cgi?id=702996
2013-07-09 09:30:02 +01:00
Adrian Johnson
dd7e8e9414 Don't rotate pdf landscape output 2012-09-12 15:38:37 +02:00
Matthias Clasen
8d0e88bac7 gtk: Don't use GDK_THREADS_ENTER/LEAVE macros internally
These are just wrappers for the functions, and we want to
deprecate them. Stopping to use them internally is a good
first step.
2012-07-30 18:01:47 +02:00
Cosimo Cecchi
f70fc49ebc docs: fix a number of typos and obsolete references 2012-07-02 10:41:11 -04:00
Ryan Lortie
88c63903a5 printing: Rename GTK_UNIT_PIXEL to GTK_UNIT_NONE
...and document that many functions don't accept "none" as a unit.

https://bugzilla.gnome.org/show_bug.cgi?id=460908
2012-05-03 18:30:48 -07:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Murray Cumming
a0b4ab109d Documentation: Correct references to properties.
These should use :, not ::, though signals would use ::.
See
http://developer.gnome.org/gtk-doc-manual/unstable/documenting_syntax.html.en
and
http://developer.gnome.org/gtk-doc-manual/unstable/documenting_symbols.html.en
2012-02-15 11:43:33 +01:00
Morten Welinder
d80953666e Print preview: make cancel work
This makes cancels of a print preview work in the same way it
works for non-previews, i.e., the operation stops at the next
page boundary.

https://bugzilla.gnome.org/show_bug.cgi?id=662160
2011-11-07 13:10:24 -05:00
Michael Natterer
5c4f2ef0c1 gtk: move _gtk_modules_has_mixed_deps() to gtkmodlesprivate.h
and remove gtkmainprivate.h completely.
2011-10-23 13:57:07 +02:00
Javier Jardón
bf0d8402f5 gtk: Use const instead G_CONST_RETURN 2011-06-10 13:07:54 +01:00
Matthias Clasen
837c504a11 Move GtkPrintOperation docs inline 2011-01-30 02:34:59 -05:00
Pavel Holejsovsky
2f0d40335b [GI] Add missing (transfer) annotations 2011-01-20 13:57:18 +01:00
Pavel Holejsovsky
6d5cdad56e [GI] Annotate strings holding file paths as (type filename) 2011-01-18 17:29:40 +01:00
Matthias Clasen
b123bc41fd Move docs for gtkmain inline
At the same time, introduce a gtkmainprivate.h header
and various other cleanups.

Based on a patch by Tadej Borovšak.
https://bugzilla.gnome.org/show_bug.cgi?id=617471
2011-01-04 17:32:12 -05:00
Matthias Clasen
98440ad031 Remove gtktypeutils altogether
Based on patches by Javier Jardón.

https://bugzilla.gnome.org/show_bug.cgi?id=629955
2011-01-04 14:51:19 -05:00
Matthias Clasen
e0aa12eb0a Tons of transfer annotations 2010-09-21 00:18:11 -04:00
Javier Jardón
c05f344c0a Use gtk_window_has_group() to know if the window has an explicit window group.
gtk_window_get_group() never returns NULL; if the window isn't in a group,
a default window group is returned instead. Use gtk_window_has_group() instead.
This fixes some previous commits to use accessors to access GtkWindow.

Reported by Philip Withnall in bug
https://bugzilla.gnome.org/show_bug.cgi?id=627828
2010-08-24 16:16:42 +02:00
Javier Jardón
fb4661be6d gtk/gtkprintoperation.c: Use accessor functions to access GtkWindow 2010-08-23 20:19:18 +02:00
Javier Jardón
9db9c5f247 GtkPrintOperation: unseal private pointer 2010-07-14 02:07:04 +02:00
Javier Jardón
0a07e9733b gtk/: fully remove gtkalias hacks
https://bugzilla.gnome.org/show_bug.cgi?id=623845
2010-07-10 02:51:26 +02:00
Marek Kasik
ca6aacc32d Return error instead of showing an error dialog when printing
Remove message dialogs showing an error when printing. Return
GTK_PRINT_OPERATION_RESULT_ERROR and set error in such a case.
Also return GTK_PRINT_OPERATION_RESULT_CANCEL when cancelled.
Do it for synchronous and asynchronous cases (#549127).
2010-06-07 14:52:38 +02:00
Javier Jardón
7b2024c1bd Fix typo in gtkprintoperation
Reported by Andika Triwidada in
https://bugzilla.gnome.org/show_bug.cgi?id=618093
2010-05-08 16:36:38 +02:00
Johan Dahlin
fe85272112 [annotations] Add allow-none
This commit was created using a script that searched for all docstrings
containing a parameter and the string 'or %NULL'.
Gdk backends and demos excluded as they are not part of a public API

https://bugzilla.gnome.org/show_bug.cgi?id=610474
2010-02-19 17:57:51 -02:00
Colin Walters
6529c07614 [introspection] Merge in Gtk-custom.c annotations
The Gtk-custom.c file in gir-repository contained a number of
introspection annotations.  Merge those into the GTK source files.

Some documentation was moved from the tmpl/ files to accomodate
the addition of annotations.
2009-12-16 17:22:01 -02:00
Marek Kasik
33ec0ecf05 Don't assign a GtkPageOrientation to a boolean value
GtkPrintOperationPrivate->orientation is a boolean value.
2009-10-27 17:35:37 +01:00
Marek Kasik
6b5912a213 Show correct print preview
Modify print preview according to settings from print dialog.
Similar approach as during real print is applied to the preview
process (#592582).
2009-10-26 17:47:37 +01:00
Javier Jardón
670e141b3a Fix some compilation warning
Added some default cases and assert if reached
2009-10-21 02:08:18 +02:00
Shixin Zeng
02457e3a93 Return value from non-void function 2009-08-20 23:56:52 +03:00
Marek Kasik
d878dc8e1a Increment page sequence before print of the page, not after
When printing, increment page sequence before rendering of the page,
not after (#590084).
In opposite case it runs "end_page" function with wrong parameters when
drawing a page in another thread.
2009-08-10 11:37:32 +02:00