[glom] Use property_whatever() instead of set_property("whatever").



commit 01d7af3973c2b4596383dd2880a547427890878b
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Sep 9 20:06:05 2015 +0200

    Use property_whatever() instead of set_property("whatever").
    
    The code was probably like this to handle alternative versions of
    the gtkmm API, long since forgotten.

 glom/dialog_existing_or_new.cc                     |   10 +++++-----
 glom/import_csv/dialog_import_csv.cc               |   10 +++++-----
 glom/mode_data/datawidget/cellcreation.cc          |    8 ++++----
 .../datawidget/cellrenderer_buttonimage.cc         |    2 +-
 .../datawidget/cellrenderer_buttontext.cc          |    2 +-
 glom/mode_data/datawidget/datawidget.cc            |    2 +-
 glom/mode_data/db_adddel/db_adddel.cc              |    4 ++--
 glom/mode_data/db_adddel/db_adddel_withbuttons.cc  |    6 +++---
 glom/mode_design/layout/combobox_fields.cc         |    4 ++--
 glom/mode_design/layout/combobox_relationship.cc   |   14 +++++++-------
 glom/utility_widgets/cellrendererlist.cc           |    8 ++++----
 11 files changed, 35 insertions(+), 35 deletions(-)
---
diff --git a/glom/dialog_existing_or_new.cc b/glom/dialog_existing_or_new.cc
index cf9614e..995879e 100644
--- a/glom/dialog_existing_or_new.cc
+++ b/glom/dialog_existing_or_new.cc
@@ -460,9 +460,9 @@ void Dialog_ExistingOrNew::existing_icon_data_func(Gtk::CellRenderer* renderer,
   if(iter == m_iter_existing_recent)
     pixbuf_renderer->property_icon_name() = "folder";
 
-  pixbuf_renderer->set_property("stock-size", Gtk::ICON_SIZE_BUTTON);
+  pixbuf_renderer->property_stock_size() = Gtk::ICON_SIZE_BUTTON;
   pixbuf_renderer->property_icon_name() = std::string();
-  pixbuf_renderer->set_property("pixbuf", Glib::RefPtr<Gdk::Pixbuf>());
+  pixbuf_renderer->property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>();
 
   if(iter == m_iter_existing_recent)
     pixbuf_renderer->property_icon_name() = "folder";
@@ -484,13 +484,13 @@ void Dialog_ExistingOrNew::existing_icon_data_func(Gtk::CellRenderer* renderer,
     {
       //Glib::RefPtr<Gtk::RecentInfo> info = (*iter)[m_existing_columns.m_col_recent_info];
       //pixbuf_renderer->property_pixbuf() = (*info)->get_icon(Gtk::ICON_SIZE_BUTTON);
-      pixbuf_renderer->set_property("icon-name", Glib::ustring("glom"));
+      pixbuf_renderer->property_icon_name() = Glib::ustring("glom");
     }
 #ifndef G_OS_WIN32
     else if(m_existing_model->is_ancestor(m_iter_existing_network, iter))
     {
       //pixbuf_renderer->property_icon_name() = Gtk::Stock::CONNECT.id;
-      pixbuf_renderer->set_property("icon-name", Glib::ustring("glom"));
+      pixbuf_renderer->property_icon_name() = Glib::ustring("glom");
     }
 #endif
     else
@@ -544,7 +544,7 @@ void Dialog_ExistingOrNew::new_icon_data_func(Gtk::CellRenderer* renderer, const
   {
     if(m_new_model->is_ancestor(m_iter_new_template, iter))
     {
-      pixbuf_renderer->set_property("icon-name", Glib::ustring("glom"));
+      pixbuf_renderer->property_icon_name() = Glib::ustring("glom");
     }
     else
     {
diff --git a/glom/import_csv/dialog_import_csv.cc b/glom/import_csv/dialog_import_csv.cc
index cd1f6a3..93abe16 100644
--- a/glom/import_csv/dialog_import_csv.cc
+++ b/glom/import_csv/dialog_import_csv.cc
@@ -279,7 +279,7 @@ void Dialog_Import_CSV::encoding_data_func(const Gtk::TreeModel::iterator& iter,
   const auto name = (*iter)[m_encoding_columns.m_col_name];
   const auto charset = (*iter)[m_encoding_columns.m_col_charset];
 
-  renderer.set_property("text", encoding_display(name, charset));
+  renderer.property_text() = encoding_display(name, charset);
 }
 
 bool Dialog_Import_CSV::row_separator_func(const Glib::RefPtr<Gtk::TreeModel>& /* model */, const 
Gtk::TreeModel::iterator& iter) const
@@ -553,9 +553,9 @@ void Dialog_Import_CSV::line_data_func(Gtk::CellRenderer* renderer, const Gtk::T
     throw std::logic_error("CellRenderer is not a CellRendererText in line_data_func");
 
   if(row == -1)
-    renderer_text->set_property("text", Glib::ustring(_("Target Field")));
+    renderer_text->property_text() = Glib::ustring(_("Target Field"));
   else
-    renderer_text->set_property("text", Glib::ustring::compose("%1", row + 1));
+    renderer_text->property_text() = Glib::ustring::compose("%1", row + 1);
 }
 
 void Dialog_Import_CSV::field_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter, 
guint column_number)
@@ -628,8 +628,8 @@ void Dialog_Import_CSV::field_data_func(Gtk::CellRenderer* renderer, const Gtk::
     }
   }
 
-  renderer_combo->set_property("text", text);
-  renderer_combo->set_property("editable", editable);
+  renderer_combo->property_text() = text;
+  renderer_combo->property_editable() = editable;
 }
 
 
diff --git a/glom/mode_data/datawidget/cellcreation.cc b/glom/mode_data/datawidget/cellcreation.cc
index 47d7cc3..f0bf17c 100644
--- a/glom/mode_data/datawidget/cellcreation.cc
+++ b/glom/mode_data/datawidget/cellcreation.cc
@@ -133,9 +133,9 @@ Gtk::CellRenderer* create_cell(const std::shared_ptr<const LayoutItem>& layout_i
     {
       Gtk::CellRendererPixbuf* pixbuf_renderer = Gtk::manage( new Gtk::CellRendererPixbuf() );
 
-      const Glib::RefPtr<const Gdk::Pixbuf> pixbuf = UiUtils::get_pixbuf_for_gda_value(item_image->m_image);
+      const Glib::RefPtr<Gdk::Pixbuf> pixbuf = UiUtils::get_pixbuf_for_gda_value(item_image->m_image);
       if(pixbuf)
-        pixbuf_renderer->set_property("pixbuf", pixbuf);
+        pixbuf_renderer->property_pixbuf() = pixbuf;
       else
         pixbuf_renderer->property_icon_name() = "image-missing";
 
@@ -147,7 +147,7 @@ Gtk::CellRenderer* create_cell(const std::shared_ptr<const LayoutItem>& layout_i
       if(item_text)
       {
         Gtk::CellRendererText* pCellText = Gtk::manage( new Gtk::CellRendererText() );
-        pCellText->set_property("text", item_get_title(item_text));
+        pCellText->property_text() = item_get_title(item_text);
 
         cell = pCellText;
       }
@@ -157,7 +157,7 @@ Gtk::CellRenderer* create_cell(const std::shared_ptr<const LayoutItem>& layout_i
         if(item_button)
         {
           GlomCellRenderer_ButtonText* pCellButton = Gtk::manage( new GlomCellRenderer_ButtonText() );
-          pCellButton->set_property("text", item_get_title_or_name(item_button));
+          pCellButton->property_text() = item_get_title_or_name(item_button);
           //pCellButton->set_fixed_width(50); //Otherwise it doesn't show up. TODO: Discover the width of 
the contents.
 
           cell = pCellButton;
diff --git a/glom/mode_data/datawidget/cellrenderer_buttonimage.cc 
b/glom/mode_data/datawidget/cellrenderer_buttonimage.cc
index 0b21a18..e454847 100644
--- a/glom/mode_data/datawidget/cellrenderer_buttonimage.cc
+++ b/glom/mode_data/datawidget/cellrenderer_buttonimage.cc
@@ -29,7 +29,7 @@ GlomCellRenderer_ButtonImage::GlomCellRenderer_ButtonImage():
   property_icon_name() = "document-open"; //A default.
 
   //So that it calls activate_vfunc():
-  set_property("mode", Gtk::CELL_RENDERER_MODE_ACTIVATABLE);
+  property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE;
 }
 
 GlomCellRenderer_ButtonImage::~GlomCellRenderer_ButtonImage()
diff --git a/glom/mode_data/datawidget/cellrenderer_buttontext.cc 
b/glom/mode_data/datawidget/cellrenderer_buttontext.cc
index 3d9c4f4..1812aa1 100644
--- a/glom/mode_data/datawidget/cellrenderer_buttontext.cc
+++ b/glom/mode_data/datawidget/cellrenderer_buttontext.cc
@@ -29,7 +29,7 @@ GlomCellRenderer_ButtonText::GlomCellRenderer_ButtonText():
   //const Gtk::StockID stock_id = _("_Open"); //A default.
   //property_stock_id() = stock_id.get_string();
 
-  set_property("mode", Gtk::CELL_RENDERER_MODE_ACTIVATABLE); //So that it calls activate_vfunc().
+  property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; //So that it calls activate_vfunc().
 }
 
 GlomCellRenderer_ButtonText::~GlomCellRenderer_ButtonText()
diff --git a/glom/mode_data/datawidget/datawidget.cc b/glom/mode_data/datawidget/datawidget.cc
index ea17c4e..dd7ba89 100644
--- a/glom/mode_data/datawidget/datawidget.cc
+++ b/glom/mode_data/datawidget/datawidget.cc
@@ -380,7 +380,7 @@ void DataWidget::set_viewable(bool viewable)
   {
     Gtk::CheckButton* checkbutton = dynamic_cast<Gtk::CheckButton*>(child);
     if(checkbutton)
-      checkbutton->set_property("inconsistent", !viewable);
+      checkbutton->property_inconsistent() = !viewable;
   }
 }
 
diff --git a/glom/mode_data/db_adddel/db_adddel.cc b/glom/mode_data/db_adddel/db_adddel.cc
index d93b3d7..05b1a8f 100644
--- a/glom/mode_data/db_adddel/db_adddel.cc
+++ b/glom/mode_data/db_adddel/db_adddel.cc
@@ -578,7 +578,7 @@ Gtk::CellRenderer* DbAddDel::construct_specified_columns_cellrenderer(const std:
       pCellRendererText->signal_editing_started().connect(sigc::mem_fun(*this, 
&DbAddDel::on_treeview_cell_editing_started));
 
       //Make it editable:
-      pCellRendererText->set_property("editable", true);
+      pCellRendererText->property_editable() = true;
 
       //Connect to its signal:
       pCellRendererText->signal_edited().connect(
@@ -590,7 +590,7 @@ Gtk::CellRenderer* DbAddDel::construct_specified_columns_cellrenderer(const std:
     Gtk::CellRendererToggle* pCellRendererToggle = dynamic_cast<Gtk::CellRendererToggle*>(pCellRenderer);
     if(pCellRendererToggle)
     {
-      pCellRendererToggle->set_property("activatable", true);
+      pCellRendererToggle->property_activatable() = true;
 
       if(item_field) //Only fields can be edited:
       {
diff --git a/glom/mode_data/db_adddel/db_adddel_withbuttons.cc 
b/glom/mode_data/db_adddel/db_adddel_withbuttons.cc
index 970a45d..6b66cf3 100644
--- a/glom/mode_data/db_adddel/db_adddel_withbuttons.cc
+++ b/glom/mode_data/db_adddel/db_adddel_withbuttons.cc
@@ -102,16 +102,16 @@ void DbAddDel_WithButtons::setup_buttons()
   const auto allow_add = get_allow_user_actions() && m_allow_add;
 
   m_Button_Add.show();
-  m_Button_Add.set_property("visible", allow_add);
+  m_Button_Add.property_visible() = allow_add;
 
   m_Button_Edit.show();
-  m_Button_Edit.set_property("visible", allow_edit);
+  m_Button_Edit.property_visible() = allow_edit;
 
   if(!m_open_button_title.empty())
     m_Button_Edit.set_label(m_open_button_title);
 
   m_Button_Del.show();
-  m_Button_Del.set_property("visible", allow_del);
+  m_Button_Del.property_visible() = allow_del;
 
   m_ButtonBox.show();
 }
diff --git a/glom/mode_design/layout/combobox_fields.cc b/glom/mode_design/layout/combobox_fields.cc
index 5ea9875..912828b 100644
--- a/glom/mode_design/layout/combobox_fields.cc
+++ b/glom/mode_design/layout/combobox_fields.cc
@@ -196,7 +196,7 @@ void ComboBox_Fields::on_cell_data_title(const Gtk::TreeModel::const_iterator& i
   std::shared_ptr<Field> field = row[m_model_columns.m_field];
   if(field)
   {
-    m_renderer_title->set_property("text", item_get_title_or_name(field));
+    m_renderer_title->property_text() = item_get_title_or_name(field);
   }
   else
   {
@@ -207,7 +207,7 @@ void ComboBox_Fields::on_cell_data_title(const Gtk::TreeModel::const_iterator& i
     //otherwise we get this warning:
     //" unable to set property `text' of type `gchararray' from value of type `glibmm__CustomPointer_Pc' "
     //TODO: Add a template specialization to Glib::ObjectBase::set_property() to allow this?
-    m_renderer_title->set_property("text", Glib::ustring(_("(None)")));
+    m_renderer_title->property_text() = Glib::ustring(_("(None)"));
   }
 }
 
diff --git a/glom/mode_design/layout/combobox_relationship.cc 
b/glom/mode_design/layout/combobox_relationship.cc
index 34a0db4..b7894c9 100644
--- a/glom/mode_design/layout/combobox_relationship.cc
+++ b/glom/mode_design/layout/combobox_relationship.cc
@@ -47,7 +47,7 @@ ComboBox_Relationship::ComboBox_Relationship(BaseObjectType* cobject, const Glib
   //Add from field (as hint) column:
   m_renderer_fromfield = Gtk::manage(new Gtk::CellRendererText());
   pack_start(*m_renderer_fromfield);
-  m_renderer_fromfield->set_property("xalign", 0.0f);
+  m_renderer_fromfield->property_xalign() = 0.0f;
   set_cell_data_func(*m_renderer_fromfield, sigc::mem_fun(*this, 
&ComboBox_Relationship::on_cell_data_fromfield));
 
   set_row_separator_func(sigc::mem_fun(*this, &ComboBox_Relationship::on_row_separator));
@@ -225,14 +225,14 @@ void ComboBox_Relationship::on_cell_data_title(const Gtk::TreeModel::const_itera
       //related relationship:
       std::shared_ptr<Relationship> parent_relationship = (*iterParent)[m_model_columns.m_relationship];
       if(parent_relationship)
-        m_renderer_title->set_property("text", item_get_title_or_name(parent_relationship) + "::" + 
item_get_title_or_name(relationship));
+        m_renderer_title->property_text() = item_get_title_or_name(parent_relationship) + "::" + 
item_get_title_or_name(relationship);
     }
     else
-      m_renderer_title->set_property("text", item_get_title_or_name(relationship));
+      m_renderer_title->property_text() = item_get_title_or_name(relationship);
   }
   else if(get_has_parent_table())
   {
-    m_renderer_title->set_property("text", (m_extra_table_title.empty() ? m_extra_table_name : 
m_extra_table_title));
+    m_renderer_title->property_text() = (m_extra_table_title.empty() ? m_extra_table_name : 
m_extra_table_title);
   }
   else
   {
@@ -258,15 +258,15 @@ void ComboBox_Relationship::on_cell_data_fromfield(const Gtk::TreeModel::const_i
     {
       std::shared_ptr<Relationship> parent_relationship = (*iterParent)[m_model_columns.m_relationship];
       if(parent_relationship)
-        m_renderer_fromfield->set_property("text", Glib::ustring::compose(_(" Via: %1::%2"), 
item_get_title(parent_relationship), relationship->get_from_field()));
+        m_renderer_fromfield->property_text() = Glib::ustring::compose(_(" Via: %1::%2"), 
item_get_title(parent_relationship), relationship->get_from_field());
     }
     else
     {
-      m_renderer_fromfield->set_property("text", Glib::ustring::compose(_(" Via: %1"), 
relationship->get_to_field()));
+      m_renderer_fromfield->property_text() = Glib::ustring::compose(_(" Via: %1"), 
relationship->get_to_field());
     }
   }
   else
-    m_renderer_fromfield->set_property("text", Glib::ustring());
+    m_renderer_fromfield->property_text() = Glib::ustring();
 }
 
 void ComboBox_Relationship::set_display_parent_table(const Glib::ustring& table_name, const Glib::ustring& 
table_title)
diff --git a/glom/utility_widgets/cellrendererlist.cc b/glom/utility_widgets/cellrendererlist.cc
index 24750a4..46db350 100644
--- a/glom/utility_widgets/cellrendererlist.cc
+++ b/glom/utility_widgets/cellrendererlist.cc
@@ -29,9 +29,9 @@ CellRendererList::CellRendererList()
    //TODO: This should not be necessary - our gtkmm callbacks are somehow preventing the popup from 
appearing.
 {
   m_refModel = Gtk::ListStore::create(m_model_columns);
-  set_property("model", m_refModel);
-  set_property("text-column", 0); //This must be a text column, in m_refModel.
-  set_property("editable", true); //It would be useless if we couldn't edit it.
+  property_model() = m_refModel;
+  property_text_column() = 0; //This must be a text column, in m_refModel.
+  property_editable() = true; //It would be useless if we couldn't edit it.
 }
 
 CellRendererList::~CellRendererList()
@@ -52,7 +52,7 @@ void CellRendererList::append_list_item(const Glib::ustring& text)
 
 void CellRendererList::set_restrict_values_to_list(bool val)
 {
-  set_property("has-entry", static_cast<gboolean>(!val));
+  property_has_entry() = static_cast<gboolean>(!val);
 }
 
 


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