[regexxer/murrayc-update: 4/12] Replace use of (deprecated) Gtk::Stock icons.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [regexxer/murrayc-update: 4/12] Replace use of (deprecated) Gtk::Stock icons.
- Date: Tue, 1 Mar 2016 08:28:32 +0000 (UTC)
commit f1063aa124ce189e45d0af75d76da0f280889e87
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Feb 29 23:37:01 2016 +0100
Replace use of (deprecated) Gtk::Stock icons.
src/filetree.cc | 34 ++++++++++++++++++++++++++++------
1 files changed, 28 insertions(+), 6 deletions(-)
---
diff --git a/src/filetree.cc b/src/filetree.cc
index caa66c4..b1736a8 100644
--- a/src/filetree.cc
+++ b/src/filetree.cc
@@ -26,7 +26,9 @@
#include "settings.h"
#include <glibmm.h>
-#include <gtkmm/stock.h>
+#include <gtkmm/icontheme.h>
+
+#include <iostream>
#include <config.h>
@@ -281,9 +283,18 @@ int FileTree::get_modified_count() const
void FileTree::on_style_updated()
{
- pixbuf_directory_ = render_icon_pixbuf(Gtk::Stock::DIRECTORY, Gtk::ICON_SIZE_MENU);
- pixbuf_file_ = render_icon_pixbuf(Gtk::Stock::FILE, Gtk::ICON_SIZE_MENU);
- pixbuf_load_failed_ = render_icon_pixbuf(Gtk::Stock::MISSING_IMAGE, Gtk::ICON_SIZE_MENU);
+ auto theme = Gtk::IconTheme::get_default();
+
+ try
+ {
+ pixbuf_directory_ = theme->load_icon("folder", Gtk::ICON_SIZE_MENU);
+ pixbuf_file_ = theme->load_icon("text-x-generic", Gtk::ICON_SIZE_MENU);
+ pixbuf_load_failed_ = theme->load_icon("missing-image", Gtk::ICON_SIZE_MENU);
+ }
+ catch(const Glib::Error& ex)
+ {
+ std::cerr << G_STRFUNC << ": Could not load icons: " << ex.what() << std::endl;
+ }
Gdk::RGBA rgba = get_style_context()->get_color(Gtk::STATE_FLAG_INSENSITIVE);
color_load_failed_.set_rgba(rgba.get_red(), rgba.get_green(), rgba.get_blue());
@@ -906,6 +917,17 @@ void FileTree::load_file_with_fallback(const Gtk::TreeModel::iterator& iter,
const bool old_load_failed = fileinfo->load_failed;
+ auto theme = Gtk::IconTheme::get_default();
+ Glib::RefPtr<Gdk::Pixbuf> icon;
+ try
+ {
+ icon = theme->load_icon("dialog-error", Gtk::ICON_SIZE_DIALOG);
+ }
+ catch(const Glib::Error& ex)
+ {
+ std::cerr << G_STRFUNC << ": Could not load icon: " << ex.what() << std::endl;
+ }
+
try
{
load_file(fileinfo, fallback_encoding_);
@@ -913,14 +935,14 @@ void FileTree::load_file_with_fallback(const Gtk::TreeModel::iterator& iter,
catch (const Glib::Error& error)
{
fileinfo->buffer = FileBuffer::create_with_error_message(
- render_icon_pixbuf(Gtk::Stock::DIALOG_ERROR, Gtk::ICON_SIZE_DIALOG), error.what());
+ icon, error.what());
}
catch (const ErrorBinaryFile&)
{
const Glib::ustring filename = (*iter)[FileTreeColumns::instance().filename];
fileinfo->buffer = FileBuffer::create_with_error_message(
- render_icon_pixbuf(Gtk::Stock::DIALOG_ERROR, Gtk::ICON_SIZE_DIALOG),
+ icon,
Util::compose(_("\342\200\234%1\342\200\235 seems to be a binary file."), filename));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]