summaryrefslogtreecommitdiff
diff options
-rw-r--r--dash/ResultRenderer.cpp10
-rw-r--r--tests/test_result_renderer.cpp6
2 files changed, 7 insertions, 9 deletions
diff --git a/dash/ResultRenderer.cpp b/dash/ResultRenderer.cpp
index b8166bac6..7b92ff45c 100644
--- a/dash/ResultRenderer.cpp
+++ b/dash/ResultRenderer.cpp
@@ -41,7 +41,7 @@ GdkPixbuf* _icon_hint_get_drag_pixbuf(std::string icon_hint, int size)
GdkPixbuf *pbuf;
GtkIconTheme *theme;
gtk::IconInfo info;
- GError *error = NULL;
+ glib::Error error;
glib::Object<GIcon> icon;
if (icon_hint.empty())
@@ -51,10 +51,9 @@ GdkPixbuf* _icon_hint_get_drag_pixbuf(std::string icon_hint, int size)
{
pbuf = gdk_pixbuf_new_from_file_at_scale (icon_hint.c_str(),
size, size, TRUE, &error);
- if (error != NULL || !pbuf || !GDK_IS_PIXBUF (pbuf))
+ if (error || !pbuf || !GDK_IS_PIXBUF (pbuf))
{
icon_hint = "application-default-icon";
- g_clear_error (&error);
}
else
return pbuf;
@@ -101,10 +100,9 @@ GdkPixbuf* _icon_hint_get_drag_pixbuf(std::string icon_hint, int size)
pbuf = gtk_icon_info_load_icon(info, &error);
- if (error != NULL)
+ if (error)
{
- g_error_free (error);
- pbuf = NULL;
+ pbuf = nullptr;
}
return pbuf;
diff --git a/tests/test_result_renderer.cpp b/tests/test_result_renderer.cpp
index d35fc2ff5..6455b3bb5 100644
--- a/tests/test_result_renderer.cpp
+++ b/tests/test_result_renderer.cpp
@@ -46,7 +46,7 @@ GdkPixbuf* GetIconData(std::string icon_hint, int size)
{
GdkPixbuf *pbuf;
GtkIconTheme *theme;
- GError *error = NULL;
+ glib::Error error;
theme = gtk_icon_theme_get_default();
glib::Object<GIcon> icon(g_icon_new_for_string(icon_hint.c_str(), NULL));
@@ -55,9 +55,9 @@ GdkPixbuf* GetIconData(std::string icon_hint, int size)
{
gtk::IconInfo info = gtk_icon_theme_lookup_by_gicon(theme, icon, size, (GtkIconLookupFlags)0);
pbuf = gtk_icon_info_load_icon(info, &error);
- if (error != NULL)
+
+ if (error)
{
- g_error_free (error);
pbuf = NULL;
}
}