[glom] Don't use static members for simple constants.



commit 25b6bb3a54d14f54ee51656274a85726e8a03e14
Author: Murray Cumming <murrayc murrayc com>
Date:   Sun Nov 6 20:43:02 2016 +0100

    Don't use static members for simple constants.

 glom/mode_data/notebook_data.cc |   18 +++++++++---------
 glom/mode_data/notebook_data.h  |    1 -
 glom/mode_find/notebook_find.cc |   14 +++++++-------
 glom/mode_find/notebook_find.h  |    2 --
 4 files changed, 16 insertions(+), 19 deletions(-)
---
diff --git a/glom/mode_data/notebook_data.cc b/glom/mode_data/notebook_data.cc
index 825c058..bb7ae31 100644
--- a/glom/mode_data/notebook_data.cc
+++ b/glom/mode_data/notebook_data.cc
@@ -30,17 +30,17 @@
 namespace Glom
 {
 
-const Glib::ustring Notebook_Data::m_pagename_details = "details";
-const Glib::ustring Notebook_Data::m_pagename_list = "list";
+constexpr auto PAGENAME_DETAILS= "details";
+constexpr auto PAGENAME_LIST = "list";
 
 Notebook_Data::Notebook_Data()
 {
   //Add Pages:
   //Translators: This is a noun. It is a notebook tab title.
-  append_page(m_Box_List, m_pagename_list, _("List"));
+  append_page(m_Box_List, PAGENAME_LIST, _("List"));
 
   //Translators: This is a noun. It is a notebook tab title.
-  append_page(m_Box_Details, m_pagename_details, _("Details"));
+  append_page(m_Box_Details, PAGENAME_DETAILS, _("Details"));
 
   // Set accessible name for the notebook, to be able to access it via LDTP
 #ifdef GTKMM_ATKMM_ENABLED
@@ -271,20 +271,20 @@ FoundSet Notebook_Data::get_found_set_selected() const
 void Notebook_Data::set_current_view(dataview view)
 {
   if(view == dataview::LIST)
-    set_visible_child(m_pagename_list);
+    set_visible_child(PAGENAME_LIST);
   else
-    set_visible_child(m_pagename_details);
+    set_visible_child(PAGENAME_DETAILS);
 }
 
 void Notebook_Data::select_page_for_find_results()
 {
   if(m_Box_List.get_showing_multiple_records())
   {
-    set_visible_child(m_pagename_list);
+    set_visible_child(PAGENAME_LIST);
   }
   else
   {
-    set_visible_child(m_pagename_details);
+    set_visible_child(PAGENAME_DETAILS);
   }
 }
 
@@ -330,7 +330,7 @@ Notebook_Data::dataview Notebook_Data::get_current_view() const
   const auto current_page = get_visible_child_name();
 
   dataview result = dataview::DETAILS;
-  if(current_page == m_pagename_list)
+  if(current_page == PAGENAME_LIST)
     result = dataview::LIST;
 
   return result;
diff --git a/glom/mode_data/notebook_data.h b/glom/mode_data/notebook_data.h
index 2feb618..46a96d5 100644
--- a/glom/mode_data/notebook_data.h
+++ b/glom/mode_data/notebook_data.h
@@ -101,7 +101,6 @@ protected:
   Box_Data_List m_Box_List;
   Box_Data_Details m_Box_Details;
 
-  static const Glib::ustring m_pagename_details, m_pagename_list;
   Glib::ustring m_table_name;
 
   type_signal_record_details_requested m_signal_record_details_requested;
diff --git a/glom/mode_find/notebook_find.cc b/glom/mode_find/notebook_find.cc
index 6a6ea69..dcb6eeb 100644
--- a/glom/mode_find/notebook_find.cc
+++ b/glom/mode_find/notebook_find.cc
@@ -25,19 +25,19 @@
 namespace Glom
 {
 
-const Glib::ustring Notebook_Find::m_pagename_details = "details";
-const Glib::ustring Notebook_Find::m_pagename_list = "list";
+constexpr auto PAGENAME_DETAILS = "details";
+constexpr auto PAGENAME_LIST = "list";
 
 Notebook_Find::Notebook_Find()
 {
-  append_page(m_Box_List, m_pagename_list, _("List"));
+  append_page(m_Box_List, PAGENAME_LIST, _("List"));
 
   //Fill composite view:
   add_view(&m_Box_List);
 
-  append_page(m_Box_Details, m_pagename_details, _("Details"));
+  append_page(m_Box_Details, PAGENAME_DETAILS, _("Details"));
 
-  set_visible_child(m_pagename_details); //Show the details page by default. It's more obvious for a Find.
+  set_visible_child(PAGENAME_DETAILS); //Show the details page by default. It's more obvious for a Find.
   //TODO: Show the same layout that is being edited at the time that the mode was changed.
 
   //Connect Signals:
@@ -71,9 +71,9 @@ bool Notebook_Find::init_db_details(const Glib::ustring& table_name, const Glib:
 void Notebook_Find::set_current_view(Notebook_Data::dataview view)
 {
   if(view == Notebook_Data::dataview::LIST)
-    set_visible_child(m_pagename_list);
+    set_visible_child(PAGENAME_LIST);
   else
-    set_visible_child(m_pagename_details);
+    set_visible_child(PAGENAME_DETAILS);
 }
 
 } //namespace Glom
diff --git a/glom/mode_find/notebook_find.h b/glom/mode_find/notebook_find.h
index a021aef..c750dec 100644
--- a/glom/mode_find/notebook_find.h
+++ b/glom/mode_find/notebook_find.h
@@ -46,8 +46,6 @@ public:
 
 private:
 
-  static const Glib::ustring m_pagename_details, m_pagename_list;
-
   //Member widgets:
   Box_Data_List_Find m_Box_List;
 


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