[glom/glom-1-20] Print Layout: Print Preview: Avoid warnings when there are no records yet.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/glom-1-20] Print Layout: Print Preview: Avoid warnings when there are no records yet.
- Date: Tue, 14 Feb 2012 08:03:16 +0000 (UTC)
commit 768237ca682fa04ff36f743afdcd1821474c3286
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Feb 9 09:28:34 2012 +0100
Print Layout: Print Preview: Avoid warnings when there are no records yet.
* glom/print_layout/canvas_print_layout.cc: fill_with_data(): Do nothing,
and hint on stdout, if there are no records yet. This avoids several
real warnings later.
ChangeLog | 8 ++++++++
glom/frame_glom.cc | 5 ++++-
glom/print_layout/canvas_print_layout.cc | 8 ++++++++
3 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e673628..b91ab19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-02-09 Murray Cumming <murrayc murrayc com>
+
+ Print Layout: Print Preview: Avoid warnings when there are no records yet.
+
+ * glom/print_layout/canvas_print_layout.cc: fill_with_data(): Do nothing,
+ and hint on stdout, if there are no records yet. This avoids several
+ real warnings later.
+
2012-02-08 Murray Cumming <murrayc murrayc com>
Print Layout: Avoid sometimes over-scaled images.
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index cc0ed0c..1b40475 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -2330,9 +2330,12 @@ void Frame_Glom::do_print_layout(const Glib::ustring& print_layout_name, bool pr
return;
}
- //TODO: When expandingt items, avoid the page gaps that the print layout's designed
+ //TODO: When expanding items, avoid the page gaps that the print layout's design
//has added.
const FoundSet found_set = m_Notebook_Data.get_found_set_details();
+ //Note that found_set.m_where_clause could be empty if there are no records yet,
+ //and that is acceptable if this is for a print preview while designing the print layout.
+
PrintLayoutUtils::do_print_layout(print_layout, found_set,
preview, document, false /* do not avoid print margins */, transient_for);
}
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index 8bd52b1..0e1e3c7 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -717,6 +717,14 @@ guint Canvas_PrintLayout::get_page_count() const
void Canvas_PrintLayout::fill_with_data(const FoundSet& found_set, bool avoid_page_margins)
{
+ if(found_set.m_where_clause.empty())
+ {
+ //This might help a developer/debugger:
+ //This is not an error.
+ std::cout << G_STRFUNC << ": Not attempting to show real data because the where_clause is empty, maybe because there are no records in the database yet." << std::endl;
+ return;
+ }
+
fill_with_data(m_items_group, found_set, avoid_page_margins);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]