Convert remaining RTPixbuf to RTSurface

Changes:
- Remove RTPixbuf use in directory browser to use native GTK mechanism
- Replace RTPixbuf by RTSurface for thumbnail icons
- Remove now useless RTPixbuf class

Fixes:
- Elaborate RTSurface width / height based on the type
This commit is contained in:
Pandagrapher
2022-08-27 11:37:59 +02:00
parent 36222d14a2
commit 50e54aa395
11 changed files with 151 additions and 297 deletions

View File

@@ -23,8 +23,6 @@
#include "guiutils.h"
class RTPixbuf;
class DirBrowser : public Gtk::Box
{
public:
@@ -37,15 +35,13 @@ private:
struct DirTreeColumns : public Gtk::TreeModelColumnRecord {
public:
Gtk::TreeModelColumn<Glib::ustring> filename;
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon1;
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon2;
Gtk::TreeModelColumn<Glib::ustring> icon_name;
Gtk::TreeModelColumn<Glib::ustring> dirname;
Gtk::TreeModelColumn<Glib::RefPtr<Gio::FileMonitor> > monitor;
DirTreeColumns()
{
add(icon1);
add(icon2);
add(icon_name);
add(filename);
add(dirname);
add(monitor);
@@ -55,7 +51,6 @@ private:
DirTreeColumns dtColumns;
Gtk::TreeViewColumn tvc;
Gtk::CellRendererText crt;
Gtk::CellRendererPixbuf crb;
Gtk::TreeView *dirtree;
@@ -64,13 +59,13 @@ private:
void fillRoot ();
std::shared_ptr<RTPixbuf> openfolder;
std::shared_ptr<RTPixbuf> closedfolder;
std::shared_ptr<RTPixbuf> icdrom;
std::shared_ptr<RTPixbuf> ifloppy;
std::shared_ptr<RTPixbuf> ihdd;
std::shared_ptr<RTPixbuf> inetwork;
std::shared_ptr<RTPixbuf> iremovable;
Glib::ustring openfolder;
Glib::ustring closedfolder;
Glib::ustring icdrom;
Glib::ustring ifloppy;
Glib::ustring ihdd;
Glib::ustring inetwork;
Glib::ustring iremovable;
bool expandSuccess;
@@ -96,6 +91,7 @@ public:
void fillDirTree ();
void on_sort_column_changed() const;
void row_expanded (const Gtk::TreeModel::iterator& iter, const Gtk::TreeModel::Path& path);
void row_collapsed (const Gtk::TreeModel::iterator& iter, const Gtk::TreeModel::Path& path);
void row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
void file_changed (const Glib::RefPtr<Gio::File>& file, const Glib::RefPtr<Gio::File>& other_file, Gio::FileMonitorEvent event_type, const Gtk::TreeModel::iterator& iter, const Glib::ustring& dirName);
void open (const Glib::ustring& dirName, const Glib::ustring& fileName = ""); // goes to dir "dirName" and selects file "fileName"