[gtkmm-documentation] Adapt to latest versions of gtk+ and gtkmm
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] Adapt to latest versions of gtk+ and gtkmm
- Date: Fri, 3 Nov 2017 17:37:28 +0000 (UTC)
commit 66aedac7feefad0323b3c784b4bb3de7a06e1e47
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Fri Nov 3 18:35:39 2017 +0100
Adapt to latest versions of gtk+ and gtkmm
Window icons and AboutDialog logos are cairo surfaces.
Gdk::Screen is gone. It's replaced by Gdk::Display.
examples/book/buildapp/step9/exampleappwindow.cc | 3 ++-
examples/book/dialogs/aboutdialog/examplewindow.cc | 3 ++-
examples/book/toolpalette/canvas.h | 2 +-
examples/book/toolpalette/examplewindow.cc | 6 +++++-
4 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/examples/book/buildapp/step9/exampleappwindow.cc
b/examples/book/buildapp/step9/exampleappwindow.cc
index 1cfb83c..63acd68 100644
--- a/examples/book/buildapp/step9/exampleappwindow.cc
+++ b/examples/book/buildapp/step9/exampleappwindow.cc
@@ -114,7 +114,8 @@ ExampleAppWindow::ExampleAppWindow(BaseObjectType* cobject,
set_show_menubar(true);
// Set the window icon.
- set_icon(Gdk::Pixbuf::create_from_resource("/org/gtkmm/exampleapp/exampleapp.png"));
+ set_icon(Gdk::Cairo::create_surface_from_pixbuf(
+ Gdk::Pixbuf::create_from_resource("/org/gtkmm/exampleapp/exampleapp.png"), 1));
}
//static
diff --git a/examples/book/dialogs/aboutdialog/examplewindow.cc
b/examples/book/dialogs/aboutdialog/examplewindow.cc
index 0574f73..aa00884 100644
--- a/examples/book/dialogs/aboutdialog/examplewindow.cc
+++ b/examples/book/dialogs/aboutdialog/examplewindow.cc
@@ -39,7 +39,8 @@ ExampleWindow::ExampleWindow()
m_Dialog.set_transient_for(*this);
- m_Dialog.set_logo(Gdk::Pixbuf::create_from_resource("/about/gtkmm_logo.gif", -1, 40, true));
+ m_Dialog.set_logo(Gdk::Cairo::create_surface_from_pixbuf(
+ Gdk::Pixbuf::create_from_resource("/about/gtkmm_logo.gif", -1, 40, true), 1));
m_Dialog.set_program_name("Example application");
m_Dialog.set_version("1.0.0");
m_Dialog.set_copyright("Murray Cumming");
diff --git a/examples/book/toolpalette/canvas.h b/examples/book/toolpalette/canvas.h
index b4aaded..d944b31 100644
--- a/examples/book/toolpalette/canvas.h
+++ b/examples/book/toolpalette/canvas.h
@@ -39,7 +39,7 @@ private:
if (icon_name.empty())
icon_name = button->get_label();
- auto icon_theme = Gtk::IconTheme::get_for_screen(canvas->get_screen());
+ auto icon_theme = Gtk::IconTheme::get_for_display(canvas->get_display());
int width = 0;
int height = 0; //ignored
Gtk::IconSize::lookup(Gtk::BuiltinIconSize::DIALOG, width, height);
diff --git a/examples/book/toolpalette/examplewindow.cc b/examples/book/toolpalette/examplewindow.cc
index 562011f..6a1919a 100644
--- a/examples/book/toolpalette/examplewindow.cc
+++ b/examples/book/toolpalette/examplewindow.cc
@@ -19,7 +19,7 @@
void ExampleWindow::load_icon_items()
{
- auto icon_theme = Gtk::IconTheme::get_for_screen(get_screen());
+ auto icon_theme = Gtk::IconTheme::get_for_display(get_display());
typedef std::vector<Glib::ustring> type_stringvec;
type_stringvec icon_names = icon_theme->list_icons();
@@ -58,6 +58,10 @@ void ExampleWindow::load_icon_items()
// that can't be loaded.
continue;
}
+ catch (const Gdk::PixbufError& /* ex */)
+ {
+ continue;
+ }
// Skip large icons, just to make the ToolPalette look better.
if (pixbuf->get_width() > 2*requested_icon_size ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]