Warning: |
GNOME Goal: Print To File
Guidelines
The goal is to make sure that every application that offers to print something set a suitable filename for print-to-file when showing a print dialog. The GTK+-provided fallback, '~/Documents/output.pdf', is not something we want to default to. GTK+ 3.5.4 added improved support for setting a default filename when printing to a file.
To fix this, one needs to set a suitable value for GTK_PRINT_SETTINGS_OUTPUT_BASENAME (or alternatively GTK_PRINT_SETTINGS_OUTPUT_URI) on the GtkPrintSettings object before passing it to the GtkPrintOperation. The printing demo in gtk-demo has code to demonstrate this, see http://git.gnome.org/cgit/gtk+/tree/demos/gtk-demo/printing.c (around line 184). If a full URI is used, then the path of the URI as well as the basename is set as default in the print dialog. If only the BASENAME is set, then the G_USER_DIRECTORY_DOCUMENTS folder in the users home will be used as the default folder and the basename is appended to this.
Note: The use of GTK_PRINT_SETTINGS_OUTPUT_URI should be avoided. Instead a combination of GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, GTK_PRINT_SETTINGS_OUTPUT_BASENAME and GTK_PRINT_SETTINGS_OUTPUT_DIR should be used. This avoids extra application code like having to process what file format should be attached to the URI.
The applications will only need a few additional lines of code. Something like this should probably work:
/* code to setup the printing operation ... */ GtkPrintSettings *settings; settings = gtk_print_settings_new (); gtk_print_settings_set(settings, GTK_PRINT_SETTINGS_OUTPUT_BASENAME, "Document Title"); //which will default to "~/Documents/Document Title.pdf" gtk_print_operation_set_print_settings (operation, settings); /* code to run the print operation */
alternatively you can prepare a whole uri and set the uri with:
gtk_print_settings_set (settings, GTK_PRINT_SETTINGS_OUTPUT_URI, uri); //which will use the uri's basename AND path for the filename
but you should only do this if you have particular reasons to not use the default Documents directory, for example if you want to save the file to G_USER_DIRECTORY_PICTURES or any of the other special user directories.
Instructions on how to recognize a module affected by this goal. |
This affects any module which ships an application that can print something, using the GTK+ print dialog.
Comments before approval
Add your comments to this goal proposal here |
A patch has already been accepted in gtkprintbackendfile.c which reduces the code involved in each application. See: 657322.
TODO: GTK_PRINT_SETTINGS_OUTPUT_BASENAME and GTK_PRINT_SETTINGS_OUTPUT_DIR should have comments added to their definitions in the GTK code base so that documentation is auto generated and can be easily discovered by developers.
Status of this goal
Tip: If you choose to work on a module, create the bug report on the GNOME bugzilla for the relevant module, and make it block bug 686927. This way people will know someone already works on it, and won't duplicate the work you're doing. |
State |
Markup |
todo |
<: #ff8080> todo |
patch |
<: #ffc849> [[GnomeBug:xxxxx|patch]] |
done |
<: #80ff80> [[GnomeBug:xxxxx|done]] |
not needed |
<: #80ff80> not needed |
Above are the states and corresponding markup to update the modules state table below.
Tarball |
Status |
core |
|
at-spi2-core |
not needed |
at-spi2-atk |
not needed |
dconf |
not needed |
evolution-data-server |
not needed |
glib-networking |
not needed |
gnome-bluetooth |
not needed |
gnome-online-accounts |
not needed |
gnome-control-center |
not needed |
gnome-desktop |
not needed |
gnome-icon-theme |
not needed |
gnome-icon-theme-extras |
not needed |
gnome-icon-theme-symbolic |
not needed |
gnome-keyring |
not needed |
gnome-menus |
not needed |
gnome-packagekit |
not needed |
gnome-power-manager |
not needed |
gnome-screensaver |
not needed |
gnome-session |
not needed |
gnome-settings-daemon |
not needed |
gnome-shell |
not needed |
gnome-themes-standard |
not needed |
gsettings-desktop-schemas |
not needed |
gvfs |
not needed |
mousetweaks |
not needed |
mutter |
not needed |
network-manager-applet |
not needed |
pulseaudio |
not needed |
telepathy-mission-control |
not needed |
core-utilities |
|
baobab |
to do |
brasero |
to do |
empathy |
to do |
eog |
|
epiphany |
|
evince |
|
gcalctool |
not needed |
gnome-contacts |
to do |
gnome-dictionary |
to do |
gnome-disk-utility |
to do |
gnome-font-viewer |
not needed |
gnome-screenshot |
to do |
gnome-search-tool |
to do |
gnome-system-log |
to do |
gnome-system-monitor |
to do |
gnome-terminal |
not needed |
gucharmap |
to do |
nautilus |
to do |
sushi |
to do |
yelp |
to do |
core-extras |
|
gnome-backgrounds |
not needed |
gnome-user-share |
not needed |
vino |
not needed |
gnome-user-docs |
not needed |
core-fallback |
|
GConf |
not needed |
gnome-panel |
to do |
metacity |
to do |
notification-daemon |
not needed |
core-os-services |
|
accountservice |
not needed |
avahi |
not needed |
not needed |
|
dbus |
not needed |
gdm |
not needed |
not needed |
|
not needed |
|
polkit |
not needed |
upower |
not needed |
core-deps |
|
atk |
not needed |
atkmm |
not needed |
cairo |
not needed |
cairomm |
not needed |
cantarell-fonts |
not needed |
caribou |
not needed |
clutter |
not needed |
clutter-gtk |
not needed |
clutter-gst |
not needed |
cogl |
not needed |
dbus-glib |
not needed |
dbus-python |
not needed |
desktop-file-utils |
not needed |
enchant |
not needed |
expat |
not needed |
farsight2 |
not needed |
folks |
not needed |
fontconfig |
not needed |
gamin |
not needed |
gnome-js-common |
not needed |
gtksourceview |
not needed |
gdk-pixbuf |
not needed |
gjs |
not needed |
glib |
not needed |
glibmm |
not needed |
gmime |
not needed |
gnome-doc-utils |
not needed |
gnome-video-effects |
not needed |
gnutls |
not needed |
gobject-introspection |
not needed |
gst-plugins-base |
not needed |
gst-plugins-good |
not needed |
gst-plugins-farsight |
not needed |
gstreamer |
not needed |
gtk+ |
to do |
gtk-doc |
not needed |
gtkmm |
not needed |
gudev |
not needed |
hicolor-icon-theme |
not needed |
icon-naming-utils |
not needed |
iso-codes |
not needed |
itstool |
not needed |
intltool |
not needed |
java-gnome |
to do |
js185 |
not needed |
json-glib |
not needed |
libatasmart |
not needed |
libcanberra |
not needed |
libchamplain |
to do |
libcroco |
not needed |
libdaemon |
not needed |
libdiscid |
not needed |
libgpg-error |
not needed |
libgcrypt |
not needed |
libgee |
not needed |
libgdata |
not needed |
libgnome-keyring |
not needed |
libgnomekbd |
to do |
libgsf |
not needed |
libgtop |
not needed |
libgweather |
not needed |
libical |
not needed |
libmusicbrainz |
not needed |
libnice |
not needed |
libnotify |
not needed |
liboauth |
not needed |
libpeas |
not needed |
libproxy |
not needed |
librest |
not needed |
librsvg |
not needed |
libsigc++2 |
not needed |
libsndfile |
not needed |
libsoup |
not needed |
libtasn1 |
not needed |
libwnck |
not needed |
libxklavier |
not needed |
libxml2 |
not needed |
libxslt |
not needed |
mm-common |
not needed |
nspr |
not needed |
nss |
not needed |
p11-kit |
not needed |
pango |
not needed |
pangomm |
not needed |
pixman |
not needed |
polkit-gnome |
not needed |
poppler |
not needed |
py2cairo |
not needed |
pygobject |
not needed |
rarian |
not needed |
seed |
not needed |
shared-mime-info |
not needed |
sound-theme-freedesktop |
not needed |
speex |
not needed |
sqlite3 |
not needed |
startup-notification |
not needed |
telepathy-glib |
not needed |
telepathy-logger |
not needed |
telepathy-farsight |
not needed |
totem-pl-parser |
not needed |
tracker |
not needed |
vala |
not needed |
vte |
not needed |
webkit |
to do |
yelp-tools |
not needed |
yelp-xsl |
not needed |
zenity |
to do |
libnl |
not needed |
lcms2 |
not needed |
colord |
not needed |
apps |
|
accerciser |
to do |
aislerot |
to do |
anjuta |
to do |
cheese |
not needed |
devhelp |
to do |
evolution |
to do |
file-roller |
not needed |
gedit |
|
ghex |
to do |
glade |
to do |
gnome-color-manager |
to do |
gnome-devel-docs |
to do |
gnome-documents |
to do |
gnome-games |
to do |
gnome-nettool |
to do |
nautilus-sendto |
to do |
nemiver |
to do |
orca |
to do |
rygel |
to do |
seahorse |
not needed |
totem |
not needed |
vinagre |
not needed |
Other |
|
abiword |
to do |
atomix |
to do |
banshee |
not needed |
to do |
|
to do |
|
contact-lookup-applet |
to do |
to do |
|
eggcups |
to do |
f-spot |
to do |
ghex |
to do |
gimp |
to do |
glom |
to do |
gnome-blog |
to do |
to do |
|
gnome-cups-manager |
to do |
gnome-disk-utility |
to do |
gnome-main-menu |
to do |
to do |
|
goocanvas |
to do |
goocanvasmm |
to do |
GParted |
not needed |
GNOME Phone Manager |
to do |
to do |
|
to do |
|
gtetrinet |
to do |
gthumb |
to do |
to do |
|
krb5-auth-dialog |
to do |
libbtctl |
to do |
to do |
|
libgda |
to do |
libgnomekbd |
to do |
libgoffice |
to do |
libgsf |
to do |
nautilus-sendto |
to do |
nautilus-vcs |
to do |
to do |
|
planner |
to do |
not needed |
|
not needed |