Commit Graph

1121 Commits

Author SHA1 Message Date
Matthias Clasen
0ee14211b1 cups: Annotate a call whose return value we don't care about
We're closing this fd, but we're not going to do anything else
if that fails. Annotate to let coverity see this.
2015-07-17 16:11:17 -04:00
Emmanuele Bassi
e259b2f30d Avoid O(n²) walking of string arrays
"Yo, we heard you like traversing NULL-terminated arrays to operate on
them, so we called g_strv_length() as the for condition, so you can
iterate the array while iterating the array."

Instead of making famed rapper and television producer Xzibit proud, we
should avoid calling g_strv_length() on an array while looping on the
array, to avoid quadratic complexity.

We do this in various places that deal with arrays of strings that we
cannot really guess are short enough not to matter — e.g. the list of
CSS selectors in the inspector, or the required authentication
information for printing.
2015-07-16 16:19:55 +01:00
Marek Kasik
4e4a2fe17e printing: Get output bin via IPP
Request "output-bin-supported" and "output-bin-default" attributes through
IPP if there is no PPD for selected printer.
Pass "output-bin" option with other options in printer_get_options().
Translate standard IPP values of "output-bin" option.

https://bugzilla.gnome.org/show_bug.cgi?id=725441
2015-06-23 13:36:57 +02:00
Matthias Clasen
23032587db printing: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:14 -04:00
Marek Kasik
b4f06ca49f printing: Check connection to remote CUPS server on correct port
Add parameter for specification of port to gtk_cups_connection_cups_new().
Use default port returned by ippPort() if the given port is lower than 0.

https://bugzilla.gnome.org/show_bug.cgi?id=693738
2015-05-13 12:28:49 +02:00
Andre Heinecke
e99e282b5a Prevent empty password request popup for kerberos
If auth_info_required is only set to "negotiate" the
    request password dialog is shown anyway for each print
    job without any input fields. As the request_password
    dialog only handles username, password and domain.

    https://bugzilla.gnome.org/show_bug.cgi?id=669008
2015-03-09 14:19:57 +01:00
Marek Kasik
c2aff4ab6e printing: Set printer state correctly
Consider NULL printer state message as empty too.
Printer state IPP_PRINTER_STOPPED can be considered as paused state.

https://bugzilla.gnome.org/show_bug.cgi?id=743323
2015-03-02 10:51:07 +01:00
Marek Kasik
f74067dda2 printing: Always get details of Avahi printers via IPP
Request details of Avahi browsed printers even when
we've got their PPDs already. Some options are not
present in PPD.

https://bugzilla.gnome.org/show_bug.cgi?id=743323
2015-02-25 15:58:23 +01:00
Marek Kasik
979a4c1b08 printing: Get covers for each printer individually
Since we combine Avahi browsed printers and
printers of local CUPS in one backend we need to
get covers for each printer separately.

https://bugzilla.gnome.org/show_bug.cgi?id=743323
2015-02-25 15:58:19 +01:00
Matthias Clasen
b0b38c106d Make gtk-im-context-none work
This was added a few years ago, as a way to have _no_ im context
at all. But it didn't actually work. Make it work, and streamline
the handling of none by moving it all to gtkimmodule.c.

As part of this, add context to the translated names of all
im modules we ship.
2015-02-23 22:06:02 -05:00
Marek Kasik
00f9f1cc6b printing: Use correct units for margins taken via IPP
cups_printer_get_hard_margins() returned margins in millimeters
for margins taken via IPP request instead of Units used before.
2015-02-20 12:27:12 +01:00
Maks Naumov
87d36885ac Properly check result of g_utf8_get_char_validated()
g_utf8_get_char_validated() may return -1 or -2
return type is gunichar(guint32)

Therefore such checks like 'gunichar < 0' or 'gunichar > 0'
are always 'false' or 'true'(except when gunichar == 0).

Signed-off-by: Maks Naumov <maksqwe1@ukr.net>

https://bugzilla.gnome.org/show_bug.cgi?id=742774
2015-01-11 15:46:06 -05:00
John Ralls
4bd787f2af Prevent double-free after 8b5d30d43. 2014-12-24 12:50:57 -08:00
Marek Kasik
059fc5d3d9 printing: Fix build with CUPS older than 1.6
Define missing functions ippFirstAttribute(), ippNextAttribute()
and macro ippGetCollection(). These were added in CUPS 1.6.

https://bugzilla.gnome.org/show_bug.cgi?id=740358
2014-11-27 17:07:33 +01:00
Andre Heinecke
d9786d74db Remove overzealous validity check for secrets
We directly get the length of the secret from the g_variant
   and use it in a following g_strndup which ensures that the
   resulting string is terminated.

   This fixes reading secrets which were stored by system-config-printer.

https://bugzilla.gnome.org/show_bug.cgi?id=740612
2014-11-25 22:51:45 -05:00
Marek Kasik
a4a38dff0d Get media-col-default attribute correctly
Fix a typo which caused that "number-up-supported" and "media-col-default"
IPP attributes were not requested correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=725441
2014-10-16 15:02:59 +02:00
Marek Kasik
493aa4e9b3 Get duplex option via IPP
Request "sides-supported" and "sides-default" attributes through
IPP if there is no PPD for selected printer.
Pass "sides" option with other options in printer_get_options().
Add function setup_ipp_option() for creating of IPP option
of given name with passed choices and default value.
Mark such an option as "is-ipp-option" so we can distinguish it
later.

https://bugzilla.gnome.org/show_bug.cgi?id=725441
2014-10-13 11:58:18 +02:00
Marek Kasik
e78c3e2c8c Get paper sizes from IPP query
Query printer via IPP for paper sizes if there is no
or empty PPD file.
Parse "media-supported" and "media-size-supported" attributes for list
of paper sizes. Parse "media-default" and "media-col-default" attributes
for default settings.

https://bugzilla.gnome.org/show_bug.cgi?id=725441
2014-10-10 13:40:27 +02:00
Marek Kasik
a73c858f4b Remove dead code from CUPS backend
https://bugzilla.gnome.org/show_bug.cgi?id=725441
2014-10-10 13:40:24 +02:00
Benjamin Otte
c750cea4e5 imcontextxim: Remove broken custom drawing code
Just use regular GtkWindow styling instead.
2014-10-03 15:51:45 +02:00
Marek Kasik
8b5d30d439 Remove redundant checks for NULL
Remove checks for NULL before g_free() and g_clear_object().
Merge check for NULL, freeing of pointer and its setting
to NULL by g_clear_pointer().

https://bugzilla.gnome.org/show_bug.cgi?id=733157
2014-10-02 19:06:03 +02:00
Matthias Clasen
7182ae4f45 printing: Better typography
Use U+201C/U+201D for quoting.

https://bugzilla.gnome.org/show_bug.cgi?id=735192
2014-09-29 23:05:22 -04:00
Matthias Clasen
60f0445233 Printing: Better typography
Use U+007D MULTPLICATION SIGN for dimensions.

https://bugzilla.gnome.org/show_bug.cgi?id=735192
2014-09-29 23:05:20 -04:00
Руслан Ижбулатов
45ab4ae09b build: Set no_undefined in Makefile.decl
This simplifies the code and - more importantly - fixes the cases like
in testsuite/reftests where the no_undefined definition was missing.

https://bugzilla.gnome.org/show_bug.cgi?id=736382
2014-09-15 16:35:40 +02:00
Andre Heinecke
382d68ff8e Use secrets service for cups auth_info
When a printer requires auth_info (e.g. a printer connected
    over the samba protocol) it is now possible to save the
    credentials necessary for printing if a secrets service
    is available over dbus.
    The auth_info is then stored / loaded from the default
    collection of that secrets service.
    If no such service is available the user is not shown
    the option to remember the password and the behavior
    remains the same as before.

    https://bugzilla.gnome.org/show_bug.cgi?id=674264
2014-09-01 22:39:51 +02:00
Simon McVittie
d329544e70 Use AC_USE_SYSTEM_EXTENSIONS to get _GNU_SOURCE, _XOPEN_SOURCE etc.
Similar to Bug #684123 in GLib.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=641638
Bug-Debian: https://bugs.debian.org/756476
Reviewed-by: Matthias Clasen
2014-08-21 09:54:12 +01:00
Руслан Ижбулатов
694c8d32d5 Fix various warnings about unused things
https://bugzilla.gnome.org/show_bug.cgi?id=734735
2014-08-13 23:38:47 +00:00
John Ralls
e3b8c4efeb Bug 729924 - Crash trying to print in OSX
We should only use the PageSize option from the ppd if it
actually exists.
2014-08-03 11:50:50 +02:00
Javier Jardón
c5b0ae5574 docs: Change documentation to consistenly use "Returns:"
Instead "Return value:" or "Return:"
2014-07-10 16:54:34 +01:00
Matthias Clasen
59c9d24bbf inspector: stop being a module
Moving the inspector into libgtk lets use reuse internals without
having to add public API for everything or inventing awkward private
call conventions.

https://bugzilla.gnome.org/show_bug.cgi?id=730095
2014-05-14 21:23:44 -04:00
Matthias Clasen
0ee35aa27b inspector: Show text view subobjects in the tree 2014-05-13 15:20:37 -04:00
Rico Tzschichholz
22eaffba59 Inspector: Fix make dist 2014-05-13 12:27:02 +02:00
Matthias Clasen
f3227688b4 inspector: Fix button path placement 2014-05-10 22:04:37 -04:00
Matthias Clasen
8475540103 inspector: Add a visual tab
Move the show updates and flip text direction controls here,
and add controls for baseline and pixel cache debugging.
2014-05-10 22:04:37 -04:00
Matthias Clasen
a145dd7097 Add data-list.ui to list of templates 2014-05-10 22:04:36 -04:00
Matthias Clasen
975677872f inspector: Add minimal signal tracing
Add rudimentary signal tracing. The signals tab can now count signal
emissions for all signals of the current object.
2014-05-10 22:04:35 -04:00
Matthias Clasen
a0cae6957e inspector: clean up better when objects go away
Instead of manually doing it everywhere, just call set_object (NULL)
from the selection_changed handler. Fix all the set_object() functions
to deal with NULL.
2014-05-10 22:04:35 -04:00
Matthias Clasen
cb85a1fa3a inspector: Improve the Inspect tooltip 2014-05-10 22:04:34 -04:00
Matthias Clasen
be532bc196 inspector: Add a button for rtl flipping
Nice to have a quick way of testing this everywhere.

The implementation is not quite perfect: due to the way text
direction works in GTK+, widgets that appear in the inspector
window while we are flipped will inherit the flipped direction
instead of the fixed direction of the inspector window.
2014-05-10 22:04:34 -04:00
Matthias Clasen
a089ccf5f0 inspector: Add a minimal Data tab
This will eventually show useful information about the content
of tree models.
2014-05-10 22:04:33 -04:00
Matthias Clasen
9655337407 inspector: Hide tabs instead of making them insensitive 2014-05-10 22:04:33 -04:00
Matthias Clasen
6303e62440 inspector: Make button path non-homogeneous 2014-05-10 22:04:32 -04:00
Matthias Clasen
e7d3323ba7 inspector: Avoid size changes of button path 2014-05-10 22:04:32 -04:00
Matthias Clasen
46b6a32ef0 inspector: Reorder tabs 2014-05-10 22:04:31 -04:00
Matthias Clasen
bf46950a09 inspector: Move scrolledwindow into prop list template 2014-05-10 22:04:31 -04:00
Matthias Clasen
c744699201 inspector: Avoid a double scrolled window 2014-05-10 22:04:30 -04:00
Matthias Clasen
d4522f54e7 inspector: Make notebook scrollable 2014-05-10 22:04:30 -04:00
Matthias Clasen
6824527cc4 inspector: Add models to the tree
It makes sense to add the models of tree views, icon views
and combo boxes to the tree.
2014-05-10 22:04:29 -04:00
Matthias Clasen
d64a9615bc inspector: Make value ellipsized
The values can get long, so ellipsize them.
2014-05-10 22:04:29 -04:00
Matthias Clasen
2af94dff1c inspector: Add cell areas into the tree 2014-05-10 22:04:28 -04:00
Matthias Clasen
9467c56b94 inspector: Rename Widget Tree to Objects 2014-05-10 22:04:28 -04:00
Matthias Clasen
700657ad19 inspector: Deal with dying objects
The widget-tree was not safe against object just going away.
Fix this by using row references instead of iters where
necessary, and by using weak refs to clean up when objects
die.
2014-05-10 22:04:28 -04:00
Matthias Clasen
0dbfef5696 Trivial: shorten some variable names 2014-05-10 22:04:27 -04:00
Matthias Clasen
e9cc859051 inspector: Add a Label column
Move the UI strings over to that column, and use the buildable
ID for the name column, where available.
2014-05-10 22:04:27 -04:00
Matthias Clasen
8a6421ac30 inspector: Show the default GApplication in the tree
This is a handy object to have quickly available.
2014-05-10 22:04:26 -04:00
Matthias Clasen
83503cbf20 inspector: Don't flash the window initially
This is flickery, and not really necessary.
2014-05-10 22:04:26 -04:00
Matthias Clasen
768a437c02 Work around a GtkBuilder deficiency
It turns out that an <object> with just a <signal> in it does
not work right in GtkBuilder. Work around by adding a property.
2014-05-10 22:04:25 -04:00
Matthias Clasen
cda706b522 inspector: Don't show mapped/realized/visible in the tree
It does not really add much over the sensitive/insensitive rendering
that is already indicating which widget is mapped. At the same time,
set up signal handlers so we can update that when the widget changes.
2014-05-10 22:04:25 -04:00
Matthias Clasen
e249c6d6ee inspector: Don't leak signal handlers
Not only was the property list connecting to notify::bla for
each property individually, it was also leaking the signal
handlers when the selected object changed. Fix both.
2014-05-10 22:04:25 -04:00
Matthias Clasen
86adead803 inspector: Minimal support for attributes
Show mapping information for cell renderer properties; no editing
yet.
2014-05-10 22:04:24 -04:00
Matthias Clasen
e87addd9ae inspector: Show interfaces in the object hierarchy
This gives a more complete picture.
2014-05-10 22:04:24 -04:00
Matthias Clasen
bf9d22f10f inspector: Add columns and cell renderers to the tree
These are interesting objects that are worth displaying in the tree.
2014-05-10 22:04:23 -04:00
Matthias Clasen
4a68eb6250 inspector: Improve handling of object-valued properties
When showing the objects in the tree, use the property name
as the name thats shown in the list. This makes it easier
to differentiate e.g. hadjustment and vadjustment in a
GtkScrolledWindow.
2014-05-10 22:04:23 -04:00
Matthias Clasen
9b65955961 inspector: Fix object-valued properties
The code for dealing with object-valued properties had several
bugs that lead to crashes. This change makes it work.
2014-05-10 22:04:23 -04:00
Matthias Clasen
08f2456d5f inspector: Change label of widget tree
The tree contains other objects besides widgets, so label it
'Objects'.
2014-05-10 22:04:22 -04:00
Matthias Clasen
c9dba4b8e0 inspector: Show signals
Add a tab that shows available signals for each object. For now,
we only show if each signal has handlers connected or now. More
functionality will be added later.
2014-05-10 22:04:22 -04:00
Matthias Clasen
5fa71c69d8 inspector: Select a window initially
The list of toplevels also includes hidden combobox popups
and the like, so we have to be a little careful. To ensure
the right choice, we now pick the first visible window
that is not a GtkInspectorWindow.
2014-05-10 22:04:21 -04:00
Matthias Clasen
a3713b51ff inspector: Drop an unused function 2014-05-10 22:04:21 -04:00
Matthias Clasen
e586af3cf4 inspector: Make translatable
Mark strings in the source and in the templates as translatable.
We use the same extract-strings utility as for libgtk itself.
2014-05-10 22:04:20 -04:00
Matthias Clasen
643b6f147b Move modules/other/parasite to modules/inspector
No need for the extra subdirectory, and the name should
match the module name.
2014-05-10 22:04:20 -04:00
Matthias Clasen
ccff3e952d Rename parasite to gtkinspector
This avoids namespace collisions with the original
gtkparasite project, and adds the gtk prefix to
all symbols and type names.
2014-05-10 22:04:20 -04:00
Matthias Clasen
87e3484aa7 parasite: Don't open a window upon load
Instead, we want to let GTK+ open a window whose life-cycle
it can control. We just ensure that all our types are registered
when the module is loaded, so GTK+ can find them.
2014-05-10 22:04:18 -04:00
Matthias Clasen
38bbde200e parasite: Two fixes for the property cell renderer 2014-05-10 22:04:18 -04:00
Matthias Clasen
d7c5b55846 parasite: Some formatting cleanup 2014-05-10 22:04:18 -04:00
Matthias Clasen
36494dc8f4 parasite: Include file cleanup 2014-05-10 22:04:17 -04:00
Matthias Clasen
5b249be1f9 parasite: Use a template for window 2014-05-10 22:04:17 -04:00
Matthias Clasen
33ccb00221 parasite: some formatting tweaks 2014-05-10 22:04:17 -04:00
Matthias Clasen
33d2044406 parasite: Use a template for themes 2014-05-10 22:04:16 -04:00
Matthias Clasen
ee7cc6d189 parasite: Use a template for prop list 2014-05-10 22:04:16 -04:00
Matthias Clasen
ead05d0954 parasite: Use template for widget tree 2014-05-10 22:04:15 -04:00
Matthias Clasen
6f1a786413 parasite: Use template for classes list 2014-05-10 22:04:15 -04:00
Matthias Clasen
0eb330613b parasite: Use template for css editor 2014-05-10 22:04:15 -04:00
Matthias Clasen
3c22fc4ef6 parasite: Use template for object hierarchy 2014-05-10 22:04:14 -04:00
Matthias Clasen
3f5d21abec parasite: Use template for button path 2014-05-10 22:04:14 -04:00
Matthias Clasen
e43aeb9a1f parasite: Allow panes to shrink
The notebook is too wide.
2014-05-10 22:04:14 -04:00
Matthias Clasen
5fcd6ba21b parasite: Use the right icon name for inspect 2014-05-10 22:04:14 -04:00
Matthias Clasen
828acee981 parasite: Don't show hicolor as an icon theme
It really isn't.
2014-05-10 22:04:13 -04:00
Matthias Clasen
9bc7cfa6ba parasite: Don't show key themes
But show the builtin theme, even if it doesn't show up in the
filesystem.
2014-05-10 22:04:13 -04:00
Matthias Clasen
9fbb704418 parasite: Turn the inspect button back into an image button 2014-05-10 22:04:12 -04:00
Matthias Clasen
8f96238194 parasite: Make flashing work better
The positioning of the highlight window was not reliable; instead
just use a after-handler for the draw signal, in the same way that
drag highlights are drawn by GTK+ itself.

And copy the code for grabbing a widget via pointer from testgtk;
that code is known to work.
2014-05-10 22:04:12 -04:00
Matthias Clasen
01cb166819 parasite: Drop an unused field 2014-05-10 22:04:11 -04:00
Matthias Clasen
f78d91e5fc parasite: Make child properties insensitive when empty
When the selected object is not a widget, make the child property
list insensitive.
2014-05-10 22:04:11 -04:00
Matthias Clasen
413faa55a0 parasite: Display child properties too 2014-05-10 22:04:10 -04:00
Matthias Clasen
2166a9b163 parasite: Use a window group
By putting the parasite window in a separate group, we can interact
with it even when there is a modal dialog blocking the application
window
2014-05-10 22:04:10 -04:00
Matthias Clasen
81af602dda Initial import
This is a copy of https://github.com/chipx86/gtkparasite.git
with minimal edits to make it build.
2014-05-10 22:04:09 -04:00
Cosimo Cecchi
67981b1831 modules: remove the pixbuf engine directory
This is not used anywhere, and is commented out of the build because it
doesn't compile. Time for some spring cleaning...
2014-05-01 11:22:11 +02:00
Antoine Jacoutot
8ede929ef7 prevent redefinition of typedef GtkPrinterCloudprint
https://bugzilla.gnome.org/show_bug.cgi?id=727009
2014-03-25 12:24:41 +01:00
Marek Kasik
b95ce71b89 printing: Fail nicely when /tmp is not writable
Don't crash when /tmp is not writable when printing to file.
Show that getting of printer details failed for CUPS printers.

https://bugzilla.gnome.org/show_bug.cgi?id=693200
2014-03-17 14:37:34 -04:00
Rico Tzschichholz
239903d2f1 printbackends: Fix make dist 2014-03-03 07:33:53 +01:00
Tim Waugh
aaae0ca8ba New cloudprint GTK+ print module for Google Cloud Print.
This is a web service provided by Google that allows people to
share their printers (https://www.google.com/cloudprint/learn/).

In addition to being able to print to printers shared on Google Cloud
Print, there is an equivalent of "Print to file" in the form of "Save to
Google Drive".

The cloudprint module uses gnome-online-accounts to obtain the OAuth 2.0
access token for the Google account.

Currently it can discover available printers, get simple details about
them such as display name and status, and submit jobs without any
special options.

https://bugzilla.gnome.org/show_bug.cgi?id=723368
2014-02-28 11:45:03 +01:00