[glom] Fix the build with the latest gtkmm 3 API.



commit beb349bcc5244e9d5161d5b64ac200a96691df0e
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Sep 29 10:14:22 2010 +0200

    Fix the build with the latest gtkmm 3 API.
    
    * glom/application.cc:
    * glom/dialog_existing_or_new.cc:
    * glom/frame_glom.cc:
    * glom/mode_design/translation/window_translations.cc:
      Use FileFilter via RefPtr.
    * glom/bakery/app_withdoc_gtk.cc: Use RecentFilter via RefPtr.
    * glom/mode_data/db_adddel/db_adddel.cc:
    * glom/mode_data/placeholder-glom[h|cc]:
    * glom/utility_widgets/flowtable[h|cc]:
    * glom/utility_widgets/imageglom.[h|cc]: Change use of get_size() to
      get_preferred_size() and change on_expose_event() to on_draw().

 ChangeLog                                          |   16 +++++++++
 glom/application.cc                                |    8 ++--
 glom/bakery/app_withdoc_gtk.cc                     |    4 +-
 glom/dialog_existing_or_new.cc                     |    6 ++--
 glom/frame_glom.cc                                 |   12 +++---
 glom/mode_data/db_adddel/db_adddel.cc              |    2 +-
 glom/mode_data/placeholder-glom.cc                 |   33 ++++++--------------
 glom/mode_data/placeholder-glom.h                  |    2 +-
 .../mode_design/translation/window_translations.cc |   12 +++---
 glom/utility_widgets/flowtable.cc                  |   24 +++++++-------
 glom/utility_widgets/flowtable.h                   |    2 +-
 glom/utility_widgets/imageglom.cc                  |   10 +++---
 glom/utility_widgets/imageglom.h                   |    2 +-
 13 files changed, 68 insertions(+), 65 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index cffb3cb..8f7629b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2010-09-29  Murray Cumming  <murrayc murrayc com>
+
+	Fix the build with the latest gtkmm 3 API.
+
+	* glom/application.cc:
+	* glom/dialog_existing_or_new.cc:
+	* glom/frame_glom.cc:
+	* glom/mode_design/translation/window_translations.cc:
+  Use FileFilter via RefPtr.
+	* glom/bakery/app_withdoc_gtk.cc: Use RecentFilter via RefPtr.
+	* glom/mode_data/db_adddel/db_adddel.cc:
+	* glom/mode_data/placeholder-glom[h|cc]:
+	* glom/utility_widgets/flowtable[h|cc]:
+	* glom/utility_widgets/imageglom.[h|cc]: Change use of get_size() to
+  get_preferred_size() and change on_expose_event() to on_draw().
+
 2010-09-24  Murray Cumming  <murrayc murrayc com>
 
 	Fix the build.
diff --git a/glom/application.cc b/glom/application.cc
index 73e17e3..6df660e 100644
--- a/glom/application.cc
+++ b/glom/application.cc
@@ -2837,10 +2837,10 @@ void Application::on_menu_developer_restore_backup()
   file_dlg.set_transient_for(*this);
   file_dlg.set_local_only(); //Because we can't untar remote files.
 
-  Gtk::FileFilter filter;
-  filter.set_name(_(".tar.gz Backup files"));
-  filter.add_pattern("*.tar.gz");
-  filter.add_pattern("*.tgz");
+  Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
+  filter->set_name(_(".tar.gz Backup files"));
+  filter->add_pattern("*.tar.gz");
+  filter->add_pattern("*.tgz");
   file_dlg.add_filter(filter);
 
   file_dlg.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
diff --git a/glom/bakery/app_withdoc_gtk.cc b/glom/bakery/app_withdoc_gtk.cc
index cf58acc..5e15991 100644
--- a/glom/bakery/app_withdoc_gtk.cc
+++ b/glom/bakery/app_withdoc_gtk.cc
@@ -220,7 +220,7 @@ void App_WithDoc_Gtk::init_menus_file_recentfiles(const Glib::ustring& path)
     Gtk::MenuItem* pMenuItem = dynamic_cast<Gtk::MenuItem*>(m_refUIManager->get_widget(path));
     if(pMenuItem)
     {
-      Gtk::RecentFilter filter;
+      Glib::RefPtr<Gtk::RecentFilter> filter = Gtk::RecentFilter::create();
 
       //Add the mime-types, so that it only shows those documents:
       for(type_list_strings::iterator iter = m_mime_types.begin(); iter != m_mime_types.end(); ++iter)
@@ -228,7 +228,7 @@ void App_WithDoc_Gtk::init_menus_file_recentfiles(const Glib::ustring& path)
         const Glib::ustring mime_type = *iter;
 
         //TODO: Find a gio equivalent for gnome_vfs_mime_type_is_known(). murrayc.
-        filter.add_mime_type(mime_type);
+        filter->add_mime_type(mime_type);
       }
 
       Gtk::RecentChooserMenu* menu = Gtk::manage(new Gtk::RecentChooserMenu);
diff --git a/glom/dialog_existing_or_new.cc b/glom/dialog_existing_or_new.cc
index ea2614d..341ecab 100644
--- a/glom/dialog_existing_or_new.cc
+++ b/glom/dialog_existing_or_new.cc
@@ -827,9 +827,9 @@ void Dialog_ExistingOrNew::on_select_clicked()
     dialog.set_default_response(Gtk::RESPONSE_OK);
     #endif // GLOM_ENABLE_MAEMO
 
-    Gtk::FileFilter filter;
-    filter.add_mime_type("application/x-glom");
-    filter.set_name("Glom files");
+    Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
+    filter->add_mime_type("application/x-glom");
+    filter->set_name("Glom files");
     dialog.add_filter(filter);
 
     const int response_id = dialog.run();
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index 0110ffe..e918eb9 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -878,13 +878,13 @@ void Frame_Glom::on_menu_file_import()
     Gtk::FileChooserDialog file_chooser(*get_app_window(), _("Open CSV Document"), Gtk::FILE_CHOOSER_ACTION_OPEN);
     file_chooser.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
     file_chooser.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT);
-    Gtk::FileFilter filter_csv;
-    filter_csv.set_name(_("CSV files"));
-    filter_csv.add_mime_type("text/csv");
+    Glib::RefPtr<Gtk::FileFilter> filter_csv = Gtk::FileFilter::create();
+    filter_csv->set_name(_("CSV files"));
+    filter_csv->add_mime_type("text/csv");
     file_chooser.add_filter(filter_csv);
-    Gtk::FileFilter filter_any;
-    filter_any.set_name(_("All files"));
-    filter_any.add_pattern("*");
+    Glib::RefPtr<Gtk::FileFilter> filter_any = Gtk::FileFilter::create();
+    filter_any->set_name(_("All files"));
+    filter_any->add_pattern("*");
     file_chooser.add_filter(filter_any);
 
     if(file_chooser.run() == Gtk::RESPONSE_ACCEPT)
diff --git a/glom/mode_data/db_adddel/db_adddel.cc b/glom/mode_data/db_adddel/db_adddel.cc
index 678fe7c..18f2c77 100644
--- a/glom/mode_data/db_adddel/db_adddel.cc
+++ b/glom/mode_data/db_adddel/db_adddel.cc
@@ -883,7 +883,7 @@ void DbAddDel::construct_specified_columns()
 
 
     Gtk::Requisition requistion_min, requistion_natural; //TODO: Really support natural size.
-    pCellButton->get_size(m_TreeView, requistion_min, requistion_natural);
+    pCellButton->get_preferred_size(m_TreeView, requistion_min, requistion_natural);
 
     m_treeviewcolumn_button->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED); //Needed by fixed-height mode.
 
diff --git a/glom/mode_data/placeholder-glom.cc b/glom/mode_data/placeholder-glom.cc
index 321f74f..2e30704 100644
--- a/glom/mode_data/placeholder-glom.cc
+++ b/glom/mode_data/placeholder-glom.cc
@@ -118,30 +118,17 @@ void PlaceholderGlom::on_unrealize()
   Gtk::Widget::on_unrealize();
 }
 
-bool PlaceholderGlom::on_expose_event(GdkEventExpose* event)
+bool PlaceholderGlom::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
 {
-  if(m_refGdkWindow)
-  {
-    Cairo::RefPtr<Cairo::Context> cr = m_refGdkWindow->create_cairo_context();
-    if(event)
-    {
-      // clip to the area that needs to be re-exposed so we don't draw any
-      // more than we need to.
-      cr->rectangle(event->area.x, event->area.y,
-              event->area.width, event->area.height);
-      cr->clip();
-    }
-
-    // Paint the background:
-    Gdk::Cairo::set_source_color(cr, get_style()->get_bg(Gtk::STATE_NORMAL));
-    cr->paint();
-
-    // Draw the foreground:
-    Gdk::Cairo::set_source_color(cr, get_style()->get_fg(Gtk::STATE_NORMAL));
-    cr->set_line_width(4);
-    cr->rectangle(0, 0,  get_allocation().get_width(), get_allocation().get_height());
-    cr->stroke();
-  }
+  // Paint the background:
+  Gdk::Cairo::set_source_color(cr, get_style()->get_bg(Gtk::STATE_NORMAL));
+  cr->paint();
+
+  // Draw the foreground:
+  Gdk::Cairo::set_source_color(cr, get_style()->get_fg(Gtk::STATE_NORMAL));
+  cr->set_line_width(4);
+  cr->rectangle(0, 0,  get_allocation().get_width(), get_allocation().get_height());
+  cr->stroke();
 
   return true;
 }
diff --git a/glom/mode_data/placeholder-glom.h b/glom/mode_data/placeholder-glom.h
index aac4083..e70a60a 100644
--- a/glom/mode_data/placeholder-glom.h
+++ b/glom/mode_data/placeholder-glom.h
@@ -49,7 +49,7 @@ private:
   virtual void on_size_allocate(Gtk::Allocation& allocation);
   virtual void on_realize();
   virtual void on_unrealize();
-  virtual bool on_expose_event(GdkEventExpose* event);
+  virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
 
   Glib::RefPtr<Gdk::Window> m_refGdkWindow;
 };
diff --git a/glom/mode_design/translation/window_translations.cc b/glom/mode_design/translation/window_translations.cc
index 665ca1e..cda089e 100644
--- a/glom/mode_design/translation/window_translations.cc
+++ b/glom/mode_design/translation/window_translations.cc
@@ -499,9 +499,9 @@ void Window_Translations::on_button_export()
   file_dlg.set_do_overwrite_confirmation();
   
   // Only po files
-  Gtk::FileFilter filter;
-  filter.set_name(_("Po files"));
-  filter.add_pattern("*.po");
+  Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
+  filter->set_name(_("Po files"));
+  filter->add_pattern("*.po");
   file_dlg.add_filter(filter);
 
   file_dlg.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
@@ -577,9 +577,9 @@ void Window_Translations::on_button_import()
   file_dlg.set_transient_for(*this);
 
   // Only po files
-  Gtk::FileFilter filter;
-  filter.set_name(_("Po files"));
-  filter.add_pattern("*.po");
+  Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
+  filter->set_name(_("Po files"));
+  filter->add_pattern("*.po");
   file_dlg.add_filter(filter);
 
   file_dlg.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
diff --git a/glom/utility_widgets/flowtable.cc b/glom/utility_widgets/flowtable.cc
index 65640ca..18a9b5c 100644
--- a/glom/utility_widgets/flowtable.cc
+++ b/glom/utility_widgets/flowtable.cc
@@ -231,7 +231,7 @@ void FlowTable::get_item_requested_width(const FlowTableItem& item, int& first,
       //Discover how much space this child needs:
       //TODO: Which one should we use?
       Gtk::Requisition child_requisition_request_min, child_requisition_request_natural;
-      first_widget->get_size(child_requisition_request_min, child_requisition_request_natural);
+      first_widget->get_preferred_size(child_requisition_request_min, child_requisition_request_natural);
       first = child_requisition_request_natural.width;
     }
 
@@ -240,7 +240,7 @@ void FlowTable::get_item_requested_width(const FlowTableItem& item, int& first,
       //Discover how much space this child needs:
       //TODO: Which one should we use?
       Gtk::Requisition child_requisition_request_min, child_requisition_request_natural;
-      second_widget->get_size(child_requisition_request_min, child_requisition_request_natural);
+      second_widget->get_preferred_size(child_requisition_request_min, child_requisition_request_natural);
       second = child_requisition_request_min.width;
     }
   }
@@ -261,17 +261,17 @@ int FlowTable::get_item_requested_height(const FlowTableItem& item) const
       // Ask the child how much space it needs:
       //TODO: Which one should we use?
       Gtk::Requisition child_requisition_request_min, child_requisition_request_natural;
-      first->get_size(child_requisition_request_min, child_requisition_request_natural);
+      first->get_preferred_size(child_requisition_request_min, child_requisition_request_natural);
 
       max_child_height = child_requisition_request_min.height;
     }
 
     if(child_is_visible(second))
-    {   
+    {
       // Ask the child how much space it needs:
       //TODO: Which one should we use?
       Gtk::Requisition child_requisition_request_min, child_requisition_request_natural;
-      second->get_size(child_requisition_request_min, child_requisition_request_natural);
+      second->get_preferred_size(child_requisition_request_min, child_requisition_request_natural);
 
       max_child_height = MAX(max_child_height, child_requisition_request_min.height);
     }
@@ -451,7 +451,7 @@ Gtk::Allocation FlowTable::assign_child(Gtk::Widget* widget, int x, int y)
   //Discover how much space this child needs:;
   //TODO: Which one should we use?
   Gtk::Requisition child_requisition_request_min, child_requisition_request_natural;
-  widget->get_size(child_requisition_request_min, child_requisition_request_natural);
+  widget->get_preferred_size(child_requisition_request_min, child_requisition_request_natural);
 
   //Give it as much space as it wants:
   return assign_child(widget, x, y, child_requisition_request_min.width, child_requisition_request_min.height);
@@ -487,10 +487,10 @@ void FlowTable::get_item_max_width_requested(guint start, guint height, guint& f
     guint item_first_width = 0;
     guint singles_width = 0;
     if(child_is_visible(first))
-    {      
+    {
       //TODO: Which one should we use?
       Gtk::Requisition child_requisition_request_min, child_requisition_request_natural;
-      first->get_size(child_requisition_request_min, child_requisition_request_natural);
+      first->get_preferred_size(child_requisition_request_min, child_requisition_request_natural);
 
       if(child_is_visible(second))
       {
@@ -512,7 +512,7 @@ void FlowTable::get_item_max_width_requested(guint start, guint height, guint& f
     {
       //TODO: Which one should we use?
       Gtk::Requisition child_requisition_request_min, child_requisition_request_natural;
-      second->get_size(child_requisition_request_min, child_requisition_request_natural);
+      second->get_preferred_size(child_requisition_request_min, child_requisition_request_natural);
 
       item_second_width = child_requisition_request_min.width;
       //g_warning("item_second_width=%d", item_second_width);
@@ -551,7 +551,7 @@ void FlowTable::on_size_allocate(Gtk::Allocation& allocation)
 
   set_allocation(allocation);
 
-  //This will be used in on_expose_event():
+  //This will be used in on_draw():
   m_lines_horizontal.clear();
   m_lines_vertical.clear();
 
@@ -878,7 +878,7 @@ void FlowTable::on_unrealize()
   Gtk::Container::on_unrealize();
 }
 
-bool FlowTable::on_expose_event(GdkEventExpose* event)
+bool FlowTable::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
 {
   if(m_design_mode)
   {
@@ -909,7 +909,7 @@ bool FlowTable::on_expose_event(GdkEventExpose* event)
     }
   }
 
-  return Gtk::Container::on_expose_event(event);
+  return Gtk::Container::on_draw(cr);
 }
 
 bool FlowTable::get_column_for_first_widget(const Gtk::Widget& first, guint& column)
diff --git a/glom/utility_widgets/flowtable.h b/glom/utility_widgets/flowtable.h
index 56fb090..be7de54 100644
--- a/glom/utility_widgets/flowtable.h
+++ b/glom/utility_widgets/flowtable.h
@@ -98,7 +98,7 @@ protected:
   //Virtual method overrides:
   void on_realize();
   void on_unrealize();
-  bool on_expose_event(GdkEventExpose* event);
+  bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
 
   int get_column_height(guint start_widget, guint widget_count, int& total_width) const;
 
diff --git a/glom/utility_widgets/imageglom.cc b/glom/utility_widgets/imageglom.cc
index 1b11e6b..9d3ec9e 100644
--- a/glom/utility_widgets/imageglom.cc
+++ b/glom/utility_widgets/imageglom.cc
@@ -264,9 +264,9 @@ Gnome::Gda::Value ImageGlom::get_value() const
   return Gnome::Gda::Value();
 }
 
-bool ImageGlom::on_expose_event(GdkEventExpose* event)
+bool ImageGlom::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
 {
-  const bool result = Gtk::EventBox::on_expose_event(event);
+  const bool result = Gtk::EventBox::on_draw(cr);
 
   scale();
   return result;
@@ -319,9 +319,9 @@ void ImageGlom::on_menupopup_activate_select_file()
   Gtk::FileChooserDialog dialog(_("Choose Image"), Gtk::FILE_CHOOSER_ACTION_OPEN);
 
   //Get image formats only:
-  Gtk::FileFilter filter;
-  filter.set_name(_("Images"));
-  filter.add_pixbuf_formats();
+  Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
+  filter->set_name(_("Images"));
+  filter->add_pixbuf_formats();
   dialog.add_filter(filter);
 
   dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
diff --git a/glom/utility_widgets/imageglom.h b/glom/utility_widgets/imageglom.h
index 392ebfd..5dae71d 100644
--- a/glom/utility_widgets/imageglom.h
+++ b/glom/utility_widgets/imageglom.h
@@ -61,7 +61,7 @@ private:
 
   // Note that these are normal signal handlers when glibmm was compiled
   // without default signal handler API.
-  virtual bool on_expose_event(GdkEventExpose* event);
+  virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
 
   virtual bool on_button_press_event(GdkEventButton *event);
 



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