[gparted] Only use Gtk::Window::set_default_icon_name method when available (#695279)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Only use Gtk::Window::set_default_icon_name method when available (#695279)
- Date: Wed, 20 Mar 2013 19:23:50 +0000 (UTC)
commit a04210788399736ff7f097cb75650ebcbd0a4950
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Sun Mar 3 23:01:05 2013 +0000
Only use Gtk::Window::set_default_icon_name method when available (#695279)
GParted fails to compile on RHEL/CentOS 5.9 because it doesn't provide
the Gtk::Window::set_default_icon_name() method. The "gtkmm GTK::Window
Class Reference" document says that set_default_icon_name() is available
in gtkmm >= 2.6, however it is not available in RHEL/CentOS 5.9 with
gtkmm 2.10.
Add an autoconf compile and link check for the set_default_icon_name()
method and make GParted only use the method when available.
Bug #695279 - GParted doesn't compile on RHEL / CentOS 5.9
configure.in | 29 +++++++++++++++++++++++++++++
src/Win_GParted.cc | 6 ++++--
2 files changed, 33 insertions(+), 2 deletions(-)
---
diff --git a/configure.in b/configure.in
index f8962ad..b047caa 100644
--- a/configure.in
+++ b/configure.in
@@ -263,6 +263,35 @@ PKG_CHECK_EXISTS(
)
+dnl Check for Gtk::Window::set_default_icon_name() method
+dnl NOTE:
+dnl The documentation says that set_default_icon_name() is available in gtkmm >= 2.6.
+dnl gtkmm GTK::Window Class Reference
+dnl https://developer.gnome.org/gtkmm/3.6/classGtk_1_1Window.html#a533d03e9b92d8ccd142ab3a44005cae4
+dnl However it is not available in RHEL/CentOS 5.9 with gtkmm 2.10. Therefore a package
+dnl version check isn't sufficient. Instead perform a more accurate, but slower, compile
+dnl and link a test program check.
+AC_LANG_PUSH([C++])
+CXXFLAGS_save="$CXXFLAGS"
+CXXFLAGS="$CXXFLAGS `pkg-config gtkmm-2.4 --cflags --libs`"
+AC_MSG_CHECKING([for Gtk::Window::set_default_icon_name method])
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <gtkmm.h>]],
+ [[Gtk::Window mywindow;
+ mywindow.set_default_icon_name("myappname");
+ ]]
+ )],
+ [AC_DEFINE([HAVE_SET_DEFAULT_ICON_NAME], 1,
+ [Define to 1 if gtkmm-2.4 provides Gtk::Window::set_default_icon_name() method.])
+ AC_MSG_RESULT([yes])
+ ],
+ [AC_MSG_RESULT([no])]
+)
+CXXFLAGS="$CXXFLAGS_save"
+AC_LANG_POP([C++])
+
+
dnl GTKMM 2.16 needed for gtk_show_uri()
PKG_CHECK_EXISTS([gtkmm-2.4 >= 2.16.0],
[AC_DEFINE([HAVE_GTK_SHOW_URI], 1, [Define to 1 if you have gtk_show_uri])],
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index 5893658..3e27dda 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -75,14 +75,16 @@ Win_GParted::Win_GParted( const std::vector<Glib::ustring> & user_devices )
this ->set_title( _("GParted") );
this ->set_default_size( 775, 500 );
+#ifdef HAVE_SET_DEFAULT_ICON_NAME
try
{
this ->set_default_icon_name( "gparted" ) ;
}
catch ( Glib::Exception & e )
- {
+ {
std::cout << e .what() << std::endl ;
- }
+ }
+#endif
//Pack the main box
this ->add( vbox_main );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]