[glom] Choices Layout: Fields List: Slight improvement.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Choices Layout: Fields List: Slight improvement.
- Date: Tue, 5 Oct 2010 11:21:55 +0000 (UTC)
commit ad4ce2faa6936db4978d44e3c67d42292423417c
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Oct 4 20:15:23 2010 +0200
Choices Layout: Fields List: Slight improvement.
* glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.[h|cc]:
Append new fields to the end instead of the start.
ChangeLog | 7 ++++++
.../layout_item_dialogs/dialog_fieldslist.cc | 23 +++++++++++++++++++-
.../layout/layout_item_dialogs/dialog_fieldslist.h | 18 ++++++++-------
3 files changed, 39 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 37470c8..4038c73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-10-04 Murray Cumming <murrayc murrayc com>
+
+ Choices Layout: Fields List: Slight improvement.
+
+ * glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.[h|cc]:
+ Append new fields to the end instead of the start.
+
2010-10-04 Jon Nordby <jonn openismus com>
Set programming language explicitly around --enable-warnings macros
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
index ee4d42f..88ce1e0 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
@@ -221,6 +221,27 @@ void Dialog_FieldsList::on_treeview_fields_selection_changed()
enable_buttons();
}
+Gtk::TreeModel::iterator Dialog_FieldsList::append_appropriate_row()
+{
+ Gtk::TreeModel::iterator result;
+
+ Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_treeview_fields->get_selection();
+ Gtk::TreeModel::iterator selected = refTreeSelection->get_selected();
+
+ //Add the field details to the layout treeview:
+ if(selected)
+ {
+ //TODO: This doesn't work because it's the sequence ID that really affects the order.
+ result = m_model_fields->insert_after(selected);
+ }
+ else
+ {
+ result = m_model_fields->append();
+ }
+
+ return result;
+}
+
void Dialog_FieldsList::on_button_add_field()
{
//Get the chosen fields:
@@ -232,7 +253,7 @@ void Dialog_FieldsList::on_button_add_field()
continue;
//Add the field details to the layout treeview:
- Gtk::TreeModel::iterator iter = m_model_fields->append();
+ Gtk::TreeModel::iterator iter = append_appropriate_row();
if(iter)
{
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.h b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.h
index 7c7d275..c927017 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.h
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.h
@@ -48,14 +48,16 @@ private:
virtual void enable_buttons();
//signal handlers:
- virtual void on_button_field_up();
- virtual void on_button_field_down();
- virtual void on_button_add_field();
- virtual void on_button_delete();
- virtual void on_button_edit_field();
- virtual void on_button_formatting();
- virtual void on_treeview_fields_selection_changed();
- virtual void on_cell_data_name(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter);
+ void on_button_field_up();
+ void on_button_field_down();
+ void on_button_add_field();
+ void on_button_delete();
+ void on_button_edit_field();
+ void on_button_formatting();
+ void on_treeview_fields_selection_changed();
+ void on_cell_data_name(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter);
+
+ Gtk::TreeModel::iterator append_appropriate_row();
//Tree model columns:
class ModelColumns_Fields : public Gtk::TreeModel::ColumnRecord
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]