Improve print to file

This commit is contained in:
Matthias Clasen 2009-06-26 14:29:00 +00:00
parent 64fefacbd5
commit 1c499d2043
2 changed files with 48 additions and 1 deletions

View File

@ -18,7 +18,7 @@
Summary: Text editor for the GNOME desktop
Name: gedit
Version: 2.27.1
Release: 1%{?dist}
Release: 2%{?dist}
Epoch: 1
License: GPLv2+ and GFDL
Group: Applications/Editors
@ -45,6 +45,9 @@ Patch1: gedit-2.13.90-libdir.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=569214
Patch2: gedit-2.25.5-fix-python-path.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=587053
Patch3: print-to-file.patch
BuildRequires: gnome-common
BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: pango-devel >= %{pango_version}
@ -110,6 +113,7 @@ Install gedit-devel if you want to write plugins for gedit.
%endif
%patch2 -p1 -b .fix-python-path
%patch3 -p1 -b .print-to-file
%build
autoreconf -f -i
@ -225,6 +229,9 @@ fi
%changelog
* Fri Jun 26 2009 Matthias Clasen <mclasen@redhat.com> - 1:2.27.1-2
- Improve print-to-file
* Sun May 31 2009 Matthias Clasen <mclasen@redhat.com> - 1:2.27.1-1
- Update to 2.27.1

40
print-to-file.patch Normal file
View File

@ -0,0 +1,40 @@
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index 7b81732..2352487 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -2262,6 +2262,8 @@ get_print_settings (GeditTab *tab)
{
gpointer data;
GeditDocument *doc;
+ GtkPrintSettings *settings;
+ gchar *uri, *name;
doc = gedit_tab_get_document (tab);
@@ -2270,12 +2272,24 @@ get_print_settings (GeditTab *tab)
if (data == NULL)
{
- return _gedit_app_get_default_print_settings (gedit_app_get_default());
+ settings = _gedit_app_get_default_print_settings (gedit_app_get_default());
}
else
{
- return gtk_print_settings_copy (GTK_PRINT_SETTINGS (data));
+ settings = gtk_print_settings_copy (GTK_PRINT_SETTINGS (data));
}
+
+ name = gedit_document_get_short_name_for_display (doc);
+ uri = g_strconcat ("file://",
+ g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS),
+ "/", name, ".pdf", NULL);
+
+ gtk_print_settings_set (settings, GTK_PRINT_SETTINGS_OUTPUT_URI, uri);
+
+ g_free (uri);
+ g_free (name);
+
+ return settings;
}
/* FIXME: show the message area only if the operation will be "long" */