[gnote] Use a sane default location when printing to file. (Closes #587245)
- From: Hubert Figuière <hub src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnote] Use a sane default location when printing to file. (Closes #587245)
- Date: Fri, 3 Jul 2009 01:21:40 +0000 (UTC)
commit 47c269c96dadc79d901d777a42a0d5fd7bbe70b7
Author: Hubert Figuiere <hub figuiere net>
Date: Wed Jul 1 18:47:36 2009 -0400
Use a sane default location when printing to file. (Closes #587245)
src/addins/printnotes/printnotesnoteaddin.cpp | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/src/addins/printnotes/printnotesnoteaddin.cpp b/src/addins/printnotes/printnotesnoteaddin.cpp
index 3291e6d..bf905ab 100644
--- a/src/addins/printnotes/printnotesnoteaddin.cpp
+++ b/src/addins/printnotes/printnotesnoteaddin.cpp
@@ -60,7 +60,7 @@ namespace printnotes {
}
const char * PrintNotesModule::version() const
{
- return "0.2";
+ return "0.3";
}
void PrintNotesNoteAddin::initialize()
@@ -94,6 +94,25 @@ namespace printnotes {
m_print_op = Gtk::PrintOperation::create();
m_print_op->set_job_name(get_note()->get_title());
+ Glib::RefPtr<Gtk::PrintSettings> settings = Gtk::PrintSettings::create();
+
+ Glib::ustring dir = Glib::get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
+ if (dir.empty()) {
+ dir = Glib::get_home_dir();
+ }
+ Glib::ustring ext;
+ if (settings->get(Gtk::PrintSettings::Keys::OUTPUT_FILE_FORMAT) == "ps") {
+ ext = ".ps";
+ }
+ else {
+ ext = ".pdf";
+ }
+
+ Glib::ustring uri = "file://";
+ uri += dir + "/gnotes" + ext;
+ settings->set (Gtk::PrintSettings::Keys::OUTPUT_URI, uri);
+ m_print_op->set_print_settings (settings);
+
m_print_op->signal_begin_print().connect(
sigc::mem_fun(*this, &PrintNotesNoteAddin::on_begin_print));
m_print_op->signal_draw_page().connect(
@@ -335,7 +354,6 @@ namespace printnotes {
bool done = position.compare (end_iter) >= 0;
while (!done) {
int line_number = position.get_line();
- DBG_OUT("line_number = %d", line_number);
Gtk::TextIter line_end = position;
if (!line_end.ends_line ()) {
@@ -354,7 +372,6 @@ namespace printnotes {
if ((page_height + logical_rect.get_height()) > height) {
m_page_breaks.push_back (line_number);
page_height = 0;
- DBG_OUT("new page at line %d", line_number);
}
page_height += logical_rect.get_height();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]