[glom] Related records portal: Hide the row button when navigation is none.
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Subject: [glom] Related records portal: Hide the row button when navigation is none.
- Date: Thu, 4 Jun 2009 16:50:49 -0400 (EDT)
commit c62987dc3c443bd3ec2803fbafc563acb617c27b
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Jun 4 17:34:54 2009 +0200
Related records portal: Hide the row button when navigation is none.
* glom/libglom/data_structure/layout/layoutitem_portal.h:
Add documentation for get/set_navigation_relationship_specific(),
get/set_navigation_type() and the enum.
* glom/mode_data/box_data_list_related.cc: enable_buttons():
Disable editing of details when the portal has NAVIGATION_NONE.
* glom/utility_widgets/db_adddel/db_adddel.cc:
construct_specified_columns(): Set the button column visibility
according to the member variable set in set_allow_view_details(),
because the button column often does not exist when that is actually
called.
This completes bug #574360.
---
ChangeLog | 17 ++++++++
.../data_structure/layout/layoutitem_portal.h | 42 +++++++++++++++----
glom/mode_data/box_data_list_related.cc | 5 ++-
glom/utility_widgets/db_adddel/db_adddel.cc | 10 ++--
4 files changed, 59 insertions(+), 15 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0d43eea..ea817d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2009-06-04 Murray Cumming <murrayc murrayc-x61>
+ Related records portal: Hide the row button when navigation is none.
+
+ * glom/libglom/data_structure/layout/layoutitem_portal.h:
+ Add documentation for get/set_navigation_relationship_specific(),
+ get/set_navigation_type() and the enum.
+
+ * glom/mode_data/box_data_list_related.cc: enable_buttons():
+ Disable editing of details when the portal has NAVIGATION_NONE.
+ * glom/utility_widgets/db_adddel/db_adddel.cc:
+ construct_specified_columns(): Set the button column visibility
+ according to the member variable set in set_allow_view_details(),
+ because the button column often does not exist when that is actually
+ called.
+ This completes bug #574360.
+
+2009-06-04 Murray Cumming <murrayc murrayc-x61>
+
Update the DTD for portal navigation and save space in XML.
* glom/glom_document.dtd: Update for the portal navigation changes,
diff --git a/glom/libglom/data_structure/layout/layoutitem_portal.h b/glom/libglom/data_structure/layout/layoutitem_portal.h
index 7fd6593..1a706be 100644
--- a/glom/libglom/data_structure/layout/layoutitem_portal.h
+++ b/glom/libglom/data_structure/layout/layoutitem_portal.h
@@ -51,27 +51,51 @@ public:
//virtual void debug(guint level = 0) const;
+ /** Gets the relationship to use for navigation if get_navigation_type() is
+ * NAVIGATION_NONE.
+ */
sharedptr<UsesRelationship> get_navigation_relationship_specific();
+
+ /** Get the @a relationship to use for navigation if get_navigation_type() is
+ * NAVIGATION_NONE.
+ */
sharedptr<const UsesRelationship> get_navigation_relationship_specific() const;
- void set_navigation_relationship_specific(const sharedptr<UsesRelationship>& relationship);
- void reset_navigation_relationship();
- /// This is used only for the print layouts.
- double get_print_layout_row_height() const;
+ /** Set the @a relationship to use for navigation if get_navigation_type() is
+ * NAVIGATION_NONE.
+ */
+ void set_navigation_relationship_specific(const sharedptr<UsesRelationship>& relationship);
- /// This is used only for the print layouts.
- void set_print_layout_row_height(double row_height);
+ void reset_navigation_relationship();
+ /** The navigation (if any) that should be used when the user
+ * activates a related record row.
+ */
enum navigation_type
{
- NAVIGATION_NONE,
- NAVIGATION_AUTOMATIC,
- NAVIGATION_SPECIFIC
+ NAVIGATION_NONE, /**< No navigation will be offered. */
+ NAVIGATION_AUTOMATIC, /**< The destination related table will be chosen automatically based on the relationship and the visible fields. */
+ NAVIGATION_SPECIFIC /**< The destination related table will be determined by a specified relationship. */
};
+ /** Discover what @a type (if any) navigation should be used when the user
+ * activates a related record row.
+ */
navigation_type get_navigation_type() const;
+
+ /** Set what @a type (if any) navigation should be used when the user
+ * activates a related record row.
+ */
void set_navigation_type(navigation_type type);
+
+ /// This is used only for the print layouts.
+ double get_print_layout_row_height() const;
+
+ /// This is used only for the print layouts.
+ void set_print_layout_row_height(double row_height);
+
+
private:
sharedptr<UsesRelationship> m_navigation_relationship_specific;
diff --git a/glom/mode_data/box_data_list_related.cc b/glom/mode_data/box_data_list_related.cc
index b3991bc..e578fb1 100644
--- a/glom/mode_data/box_data_list_related.cc
+++ b/glom/mode_data/box_data_list_related.cc
@@ -57,7 +57,10 @@ Box_Data_List_Related::Box_Data_List_Related()
void Box_Data_List_Related::enable_buttons()
{
- const bool view_details_possible = get_has_suitable_record_to_view_details();
+ const bool view_details_possible =
+ get_has_suitable_record_to_view_details() &&
+ (m_portal->get_navigation_type() != LayoutItem_Portal::NAVIGATION_NONE);
+
m_AddDel.set_allow_view_details(view_details_possible); //Don't allow the user to go to a record in a hidden table.
}
diff --git a/glom/utility_widgets/db_adddel/db_adddel.cc b/glom/utility_widgets/db_adddel/db_adddel.cc
index 324809b..7bd6635 100644
--- a/glom/utility_widgets/db_adddel/db_adddel.cc
+++ b/glom/utility_widgets/db_adddel/db_adddel.cc
@@ -931,14 +931,13 @@ void DbAddDel::construct_specified_columns()
m_treeviewcolumn_button = Gtk::manage(new Gtk::TreeViewColumn());
m_treeviewcolumn_button->pack_start(*pCellButton);
-
int x_offset = 0;
int y_offset = 0;
int width = 0;
int height = 0;
pCellButton->get_size(m_TreeView, x_offset, y_offset, width, height);
- m_treeviewcolumn_button->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED); //Need by fixed-height mode.
+ m_treeviewcolumn_button->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED); //Needed by fixed-height mode.
// TODO: I am not sure whether this is always correct. Perhaps, we also
// have to take into account the xpad property of the cell renderer and
@@ -947,7 +946,7 @@ void DbAddDel::construct_specified_columns()
m_TreeView.get_style_property("horizontal-separator", horizontal_separator);
m_treeviewcolumn_button->set_fixed_width(width + horizontal_separator*2);
- m_treeviewcolumn_button->set_property("visible", true);
+ m_treeviewcolumn_button->set_visible(m_allow_view_details);
m_TreeView.append_column(*m_treeviewcolumn_button);
@@ -2054,9 +2053,10 @@ void DbAddDel::set_allow_view_details(bool val)
{
m_allow_view_details = val;
- //Hide it if it was visible:
+ //Hide it if it was visible, if it exists,
+ //otherwise do that later after creating it:
if(m_treeviewcolumn_button)
- g_object_set(m_treeviewcolumn_button->gobj(), "visible", get_allow_view_details() ? TRUE : FALSE, (gpointer)NULL);
+ m_treeviewcolumn_button->set_visible(val);
}
bool DbAddDel::get_allow_view_details() const
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]