Avoid unhandled exception Gtk::IconThemeError.

This commit is contained in:
Alexander Shaduri
2017-05-18 15:35:14 +00:00
parent 413ba1c1a9
commit 0bfbebeb8b
3 changed files with 13 additions and 26 deletions
+4 -14
View File
@@ -30,12 +30,10 @@ case $type in
icc)
flags="CC=icc64 CXX=icpc64 --disable-user-flags --enable-tests" ;;
win32)
flags="CC=i386-pc-mingw32-gcc CXX=i386-pc-mingw32-g++ \
PKG_CONFIG_PATH=/cross/w32/target/lib/pkgconfig PKG_CONFIG_LIBDIR=\"\" \
PATH=\"/cross/w32/gcc-bin:/cross/w32/target/bin:$PATH\" \
--with-windows-gtk-name=gtk2-runtime-2.24.10-2012-10-10-ash --disable-user-flags \
--with-nsis=/root/.wine/drive_c/Programs_x86/NSIS/makensis.exe \
--enable-optimize-options --enable-tests --build=i686-linux --host=i386-pc-mingw32" ;;
flags="PATH=\"/usr/i686-w64-mingw32/bin:/usr/i686-w64-mingw32/sys-root/mingw/bin:$PATH\" \
--disable-user-flags \
--with-nsis=/usr/bin/makensis \
--enable-optimize-options --enable-tests --build=i686-linux --host=i686-w64-mingw32" ;;
win32-debug)
flags="CC=i386-pc-mingw32-gcc CXX=i386-pc-mingw32-g++ \
PKG_CONFIG_PATH=/cross/w32/target/lib/pkgconfig PKG_CONFIG_LIBDIR=\"\" \
@@ -53,14 +51,6 @@ case $type in
LDFLAGS=\"-R/opt/sun/target64/lib64 -L/opt/sun/target64/lib64\" \
PKG_CONFIG_PATH=\"/opt/sun/target64/lib64/pkgconfig:/usr/lib64/pkgconfig\" \
PKG_CONFIG_LIBDIR=\"\" --enable-tests" ;;
portland)
flags="CC=pgcc CXX=pgCC LDFLAGS=\"-s\" CFLAGS=\"-Minform=warn -Bstatic_pgi\" \
CXXFLAGS=\"-Minform=warn -Bstatic_pgi -noswitcherror -define_macro=HZ_NO_COMPILER_AUTOINCLUDE\" \
--enable-tests" ;;
open64)
flags="CC=/opt/open64/bin/opencc CXX=/opt/open64/bin/openCC CXXFLAGS=\"-Wall\" \
--enable-tests" ;;
esac
+1 -9
View File
@@ -13,15 +13,7 @@
#define APP_GTKMM_UTILS_H
#include <string>
#include <gtkmm/widget.h>
#include <gtkmm/treeviewcolumn.h>
#include <gtkmm/treemodelcolumn.h>
#include <gtkmm/treeview.h>
#include <gtkmm/combobox.h>
#include <gtkmm/cellrenderertext.h>
#include <gtkmm/iconview.h>
#include <gtkmm/liststore.h>
#include <gtkmm/icontheme.h> // must include (even if gtkmm.h is included) for older gtkmm (at least 2.6, but not 2.12)
#include <gtkmm.h>
#include "hz/down_cast.h"
+8 -3
View File
@@ -71,7 +71,12 @@ class GscMainWindowIconView : public Gtk::IconView {
// icons
Glib::RefPtr<Gtk::IconTheme> default_icon_theme = Gtk::IconTheme::get_default();
Glib::RefPtr<Gtk::IconTheme> default_icon_theme;
try {
default_icon_theme = Gtk::IconTheme::get_default();
} catch (...) {
// nothing
}
// Try Gnome icons icons first, they are usually more consistent with Gnome desktop
// (this should work only if gnome-settings-daemon is running, so no harm on other desktops).
@@ -94,7 +99,7 @@ class GscMainWindowIconView : public Gtk::IconView {
}
// last resort. gtk has gtk-harddisk built-in. it may not be the right size, but what else can we do?
if (!hd_icon)
if (!hd_icon && default_icon_theme)
hd_icon = default_icon_theme->load_icon("gtk-harddisk", 48, Gtk::IconLookupFlags(0));
@@ -113,7 +118,7 @@ class GscMainWindowIconView : public Gtk::IconView {
}
}
if (!cddvd_icon)
if (!cddvd_icon && default_icon_theme)
cddvd_icon = default_icon_theme->load_icon("gtk-cdrom", 48, Gtk::IconLookupFlags(0));