Commit beb349bc authored by Murray Cumming's avatar Murray Cumming
Browse files

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().
parent 4e99fbda
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.
......
......@@ -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);
......
......@@ -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);
......
......@@ -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();
......
......@@ -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)
......
......@@ -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.
......
......@@ -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;
}
......
......@@ -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;
};
......
......@@ -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);
......
......@@ -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)
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment