[glom] Port to gtkmm-3.0



commit fedb7ab9754605109886d7520769a19040f59e87
Author: Murray Cumming <murrayc murrayc com>
Date:   Sun Jun 13 12:20:31 2010 +0200

    Port to gtkmm-3.0
    
    * configure.ac: Use gtkmm-3.0 instead of gtkmm-2.4
    * glom/mode_design/print_layouts/window_print_layout_edit.cc:
    Use get_related_action() instead of get_action().
    * glom/utility_widgets/cellrendererlist/cellrendererlist.[h|cc]:
    Simplify the use of the editing_started signal now that the inheritance is
    fixed in gtkmm-3.0.
    * glom/utility_widgets/db_adddel/db_adddel.cc: Use get_first_cell() instead of
    get_first_cell_renderer().
    * glom/utility_widgets/db_adddel/glom_db_treemodel.[h|cc]: iter_is_valid():
    This is no longer virtual, and no longer exists in the base class, so don't
    call the base class implementation.

 ChangeLog                                          |   19 +++++++
 configure.ac                                       |    4 +-
 .../print_layouts/window_print_layout_edit.cc      |    2 +-
 .../cellrendererlist/cellrendererlist.cc           |   52 +------------------
 .../cellrendererlist/cellrendererlist.h            |    7 +--
 glom/utility_widgets/db_adddel/db_adddel.cc        |    2 +-
 .../utility_widgets/db_adddel/glom_db_treemodel.cc |    5 +--
 glom/utility_widgets/db_adddel/glom_db_treemodel.h |    2 +-
 8 files changed, 29 insertions(+), 64 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d425fb5..63e56e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2010-06-13  Murray Cumming  <murrayc murrayc com>
+
+	Port to gtkmm-3.0
+
+	* configure.ac: Use gtkmm-3.0 instead of gtkmm-2.4
+	* glom/mode_design/print_layouts/window_print_layout_edit.cc:
+	Use get_related_action() instead of get_action().
+	* glom/utility_widgets/cellrendererlist/cellrendererlist.[h|cc]: 
+	Simplify the use of the editing_started signal now that the inheritance is 
+	fixed in gtkmm-3.0.
+	* glom/utility_widgets/db_adddel/db_adddel.cc: Use get_first_cell() instead of 
+	get_first_cell_renderer().
+	* glom/utility_widgets/db_adddel/glom_db_treemodel.[h|cc]: iter_is_valid():
+	This is no longer virtual, and no longer exists in the base class, so don't 
+	call the base class implementation.
+	
+This is the master branch, for glom 2.0, using gtkmm-3.0.
+See also the glom-1-16 branch, which uses gtkmm-2.4.
+
 1.15.1:
 
 2010-05-25  Murray Cumming  <murrayc murrayc com>
diff --git a/configure.ac b/configure.ac
index 65c89cc..b732749 100644
--- a/configure.ac
+++ b/configure.ac
@@ -152,7 +152,7 @@ AS_IF([test "x$glom_host_win32" != xyes],
       [REQUIRED_LIBGLOM_LIBS="$REQUIRED_LIBGLOM_LIBS libepc-1.0 >= 0.3.1 avahi-ui"])
 
 # Libraries used by Glom:
-REQUIRED_GLOM_LIBS="$REQUIRED_LIBGLOM_LIBS gtkmm-2.4 >= 2.19.7 gthread-2.0 gconfmm-2.6 libxml++-2.6 libxslt >= 1.1.10 goocanvasmm-1.0 >= 0.14.0"
+REQUIRED_GLOM_LIBS="$REQUIRED_LIBGLOM_LIBS gtkmm-3.0 >= 2.19.7 gthread-2.0 gconfmm-2.6 libxml++-2.6 libxslt >= 1.1.10 goocanvasmm-2.0 >= 0.14.0"
 
 # Do not require iso-codes in client-only mode, or on Windows:
 # TODO: Package iso-codes for Windows?
@@ -161,7 +161,7 @@ AS_IF([test "x$glom_enable_client_only" != xyes && test "x$glom_host_win32" != x
 
 # Do not require gtksourceviewmm in client only mode
 AS_IF([test "x$glom_enable_client_only" != xyes],
-      [REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS gtksourceviewmm-2.0"])
+      [REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS gtksourceviewmm-3.0"])
 
 AS_IF([test "x$glom_enable_sqlite" = xyes],
       [REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS libgda-sqlite-4.0"])
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.cc b/glom/mode_design/print_layouts/window_print_layout_edit.cc
index 7027aa6..1554bdb 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -226,7 +226,7 @@ Glib::RefPtr<Gdk::Pixbuf> Window_PrintLayout_Edit::get_icon_for_toolbar_item(Gtk
   Glib::RefPtr<Gdk::Pixbuf> result;
 
   //Set the icon to show when dragging:
-  Glib::RefPtr<Gtk::Action> action = item.get_action();
+  Glib::RefPtr<Gtk::Action> action = item.get_related_action();
   if(!action)
     return result;
 
diff --git a/glom/utility_widgets/cellrendererlist/cellrendererlist.cc b/glom/utility_widgets/cellrendererlist/cellrendererlist.cc
index 4694ef7..bb4c738 100644
--- a/glom/utility_widgets/cellrendererlist/cellrendererlist.cc
+++ b/glom/utility_widgets/cellrendererlist/cellrendererlist.cc
@@ -26,45 +26,6 @@
 namespace Glom
 {
 
-void c_callback_CellRendererList_on_editing_started(GtkCellRenderer* /* self */, GtkCellEditable* cell_editable, const gchar* /* path */, void* data)
-{
-  CellRendererList* pCppSelf = (CellRendererList*)data;
- 
-  if(cell_editable)
-  {
-    //This is actually ComboBox, because GtkComboBox inherits from GtkCellEditable since GTK+ 2.6.
-    //But Gtk::ComboBox does not inherit from Gtk::CellEditable because we could not break ABI.
-    //So we will use the C API to get the Gtk::ComboBox:
-    GtkComboBox* pCComboBox = GTK_COMBO_BOX(cell_editable);
-    Gtk::ComboBox* pComboBox = Glib::wrap(pCComboBox);
-
-
-    //We don't use this convenience method, because we want more control over the renderer.
-    //and CellLayout gives no way to get the renderer back afterwards.
-    //(well, maybe set_cell_data_func(), but that's a bit awkward.)
-    //pComboBox->pack_start(pCppSelf->m_model_columns.m_col_extra);
-
-    Gtk::CellRenderer* cell_second = Gtk::manage(new Gtk::CellRendererText);
-    cell_second->set_property("xalign", 0.0);
-
-    //Use the renderer:
-    pComboBox->pack_start(*cell_second);
-
-    //Make the renderer render the column:
-#ifdef GLIBMM_PROPERTIES_ENABLED
-    pComboBox->add_attribute(cell_second->_property_renderable(), pCppSelf->m_model_columns.m_col_extra);
-#else
-    pComboBox->add_attribute(*cell_second, cell_second->_property_renderable(), pCppSelf->m_model_columns.m_col_extra);
-#endif // GLIBMM_PROPERTIES_ENABLED
-
-  }
-  else
-  {
-    g_warning("CellRendererList::on_editing_started() cell_editable is null");
-  }
-}
-
-
 CellRendererList::CellRendererList()
 :  Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
    //TODO: This should not be necessary - our gtkmm callbacks are somehow preventing the popup from appearing.
@@ -74,11 +35,6 @@ CellRendererList::CellRendererList()
   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.
-
-  //See the comment next to the implementation:
-  //signal_editing_started().connect(sigc::mem_fun(*this, &CellRendererList::on_editing_started));
-
-  g_signal_connect (gobj(), "editing_started", G_CALLBACK(&c_callback_CellRendererList_on_editing_started), this);
 }
 
 CellRendererList::~CellRendererList()
@@ -103,10 +59,7 @@ void CellRendererList::set_restrict_values_to_list(bool val)
   set_property("has-entry", static_cast<gboolean>(!val));
 }
 
-/* This is not used because the Gtk::CellRenderer::editing_started() signal currently sends a null cell_editable.
-   We use a C callback instead.
- 
-void CellRendererList::on_editing_started(Gtk::CellEditable* cell_editable, const Glib::ustring&  path)
+void CellRendererList::on_editing_started(Gtk::CellEditable* cell_editable, const Glib::ustring& path)
 {
   g_assert(cell_editable);
 
@@ -127,8 +80,9 @@ void CellRendererList::on_editing_started(Gtk::CellEditable* cell_editable, cons
       g_warning("CellRendererList::on_editing_started() cell_editable is null");
     }
   }
+  
+  Gtk::CellRenderer::on_editing_started(cell_editable, path);
 }
-*/
 
 void CellRendererList::set_use_second(bool use_second)
 {
diff --git a/glom/utility_widgets/cellrendererlist/cellrendererlist.h b/glom/utility_widgets/cellrendererlist/cellrendererlist.h
index 914d95a..b0375b8 100644
--- a/glom/utility_widgets/cellrendererlist/cellrendererlist.h
+++ b/glom/utility_widgets/cellrendererlist/cellrendererlist.h
@@ -28,8 +28,6 @@
 namespace Glom
 {
 
-void c_callback_CellRendererList_on_editing_started(GtkCellRenderer* /* self */, GtkCellEditable* cell_editable, const gchar* /* path */, void* data);
-
 class CellRendererList : public Gtk::CellRendererCombo
 {
 public:
@@ -44,11 +42,8 @@ public:
 
   void set_restrict_values_to_list(bool val = true);
 
-  void on_editing_started(Gtk::CellEditable* cell_editable, const Glib::ustring& path);
-
-  friend void c_callback_CellRendererList_on_editing_started(GtkCellRenderer* /* self */, GtkCellEditable* cell_editable, const gchar* /* path */, void* data);
-
 private:
+  void on_editing_started(Gtk::CellEditable* cell_editable, const Glib::ustring& path);
 
   //Tree model columns for the Combo CellRenderer in the TreeView column:
   class ModelColumns : public Gtk::TreeModel::ColumnRecord
diff --git a/glom/utility_widgets/db_adddel/db_adddel.cc b/glom/utility_widgets/db_adddel/db_adddel.cc
index 231660b..93908f6 100644
--- a/glom/utility_widgets/db_adddel/db_adddel.cc
+++ b/glom/utility_widgets/db_adddel/db_adddel.cc
@@ -1799,7 +1799,7 @@ void DbAddDel::on_treeview_cell_edited(const Glib::ustring& path_string, const G
                 Gtk::TreeView::Column* pColumn = m_TreeView.get_column(model_column_index);
                 if(pColumn)
                 {
-                  Gtk::CellRendererText* pCell = dynamic_cast<Gtk::CellRendererText*>(pColumn->get_first_cell_renderer());
+                  Gtk::CellRendererText* pCell = dynamic_cast<Gtk::CellRendererText*>(pColumn->get_first_cell());
                   if(pCell)
                   {
                     //TreeView::set_cursor(), or start_editing() would get the old value back from the model again
diff --git a/glom/utility_widgets/db_adddel/glom_db_treemodel.cc b/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
index 77d29da..e9cd22d 100644
--- a/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
+++ b/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
@@ -646,10 +646,7 @@ bool DbTreeModel::check_treeiter_validity(const iterator& iter) const
 
 bool DbTreeModel::iter_is_valid(const iterator& iter) const
 {
-  if(!check_treeiter_validity(iter))
-    return false;
-
-  return Gtk::TreeModel::iter_is_valid(iter);
+  return check_treeiter_validity(iter);
 }
 
 
diff --git a/glom/utility_widgets/db_adddel/glom_db_treemodel.h b/glom/utility_widgets/db_adddel/glom_db_treemodel.h
index f98e7d4..fa58077 100644
--- a/glom/utility_widgets/db_adddel/glom_db_treemodel.h
+++ b/glom/utility_widgets/db_adddel/glom_db_treemodel.h
@@ -136,7 +136,7 @@ private:
    virtual Path get_path_vfunc(const iterator& iter) const;
    virtual bool get_iter_vfunc(const Path& path, iterator& iter) const;
 
-   virtual bool iter_is_valid(const iterator& iter) const;
+   bool iter_is_valid(const iterator& iter) const;
 
    virtual void set_value_impl(const iterator& row, int column, const Glib::ValueBase& value);
 



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