[glom] Users/Groups UI: Avoid warning about an empty group name.



commit fc522d4dafb2523a2303e53670568535664788dc
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Dec 9 13:21:42 2011 +0100

    Users/Groups UI: Avoid warning about an empty group name.
    
    * glom/mode_design/users/dialog_groups_list.cc:
    on_treeview_groups_selection_changed(): Do not respond if there is
    no selection, which can happen when clearing the model, just before
    filling it. When there are items, there is always a selection.

 ChangeLog                                    |    9 +++++++++
 glom/mode_design/users/dialog_groups_list.cc |    9 ++++++++-
 2 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 98a8a20..b112df8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2011-12-09  Murray Cumming  <murrayc murrayc com>
 
+	Users/Groups UI: Avoid warning about an empty group name.
+
+	* glom/mode_design/users/dialog_groups_list.cc:
+	on_treeview_groups_selection_changed(): Do not respond if there is 
+	no selection, which can happen when clearing the model, just before 
+	filling it. When there are items, there is always a selection.
+
+2011-12-09  Murray Cumming  <murrayc murrayc com>
+
 	Combo_TextGlade: Work around GtkComboBoxText bug #612396.
 
 	* glom/utility_widgets/combo_textglade.cc: Without setting 
diff --git a/glom/mode_design/users/dialog_groups_list.cc b/glom/mode_design/users/dialog_groups_list.cc
index cc29599..2666866 100644
--- a/glom/mode_design/users/dialog_groups_list.cc
+++ b/glom/mode_design/users/dialog_groups_list.cc
@@ -348,7 +348,9 @@ Glib::ustring Dialog_GroupsList::get_selected_group() const
 void Dialog_GroupsList::on_treeview_groups_selection_changed()
 {
   //Update the tables list for the currently-selected group:
-  fill_table_list( get_selected_group() );
+  const Glib::ustring group_name = get_selected_group();
+  if(!group_name.empty()) //This can happen when clearing the list, just before filling it, so something real can be selected.
+    fill_table_list(group_name);
 
   enable_buttons();
 }
@@ -387,6 +389,11 @@ void Dialog_GroupsList::fill_group_list()
 
 void Dialog_GroupsList::fill_table_list(const Glib::ustring& group_name)
 {
+  if(group_name.empty())
+  {
+    std::cerr << G_STRFUNC << ": group_name is empty." << std::endl;
+  }
+
   //Fill the model rows:
   m_model_tables->clear();
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]