diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:59:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:59:44 +0000 |
commit | fb31765cbe33890f325a87015507364156741321 (patch) | |
tree | 0c5cd12aee0a0a6a6e2d542520df5846859bd40d /src/prettytable.h | |
parent | Initial commit. (diff) | |
download | gnome-system-monitor-fb31765cbe33890f325a87015507364156741321.tar.xz gnome-system-monitor-fb31765cbe33890f325a87015507364156741321.zip |
Adding upstream version 42.0.upstream/42.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/prettytable.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/prettytable.h b/src/prettytable.h new file mode 100644 index 0000000..627ac6f --- /dev/null +++ b/src/prettytable.h @@ -0,0 +1,74 @@ +/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +#ifndef _GSM_PRETTY_TABLE_H_ +#define _GSM_PRETTY_TABLE_H_ + +#include <glib.h> +#include <gdk-pixbuf/gdk-pixbuf.h> +#include <glibmm/refptr.h> +#include <giomm/filemonitor.h> + +#include <gdkmm/pixbuf.h> + +#include <map> +#include <string> + +#ifdef HAVE_WNCK +extern "C" { +#define WNCK_I_KNOW_THIS_IS_UNSTABLE +#include <libwnck/libwnck.h> +} +#endif + +class ProcInfo; + +using std::string; + + + +class PrettyTable +{ +public: + PrettyTable(); + ~PrettyTable(); + + void set_icon(ProcInfo &); + +private: + +#ifdef HAVE_WNCK + static void on_application_opened(WnckScreen* screen, WnckApplication* app, gpointer data); + static void on_application_closed(WnckScreen* screen, WnckApplication* app, gpointer data); + + void register_application(pid_t pid, Glib::RefPtr<Gdk::Pixbuf> icon); + void unregister_application(pid_t pid); +#endif + + Glib::RefPtr<Gdk::Pixbuf> get_icon_from_theme(const ProcInfo &); + Glib::RefPtr<Gdk::Pixbuf> get_icon_from_default(const ProcInfo &); + Glib::RefPtr<Gdk::Pixbuf> get_icon_from_gio(const ProcInfo &); +#ifdef HAVE_WNCK + Glib::RefPtr<Gdk::Pixbuf> get_icon_from_wnck(const ProcInfo &); +#endif + Glib::RefPtr<Gdk::Pixbuf> get_icon_from_name(const ProcInfo &); + Glib::RefPtr<Gdk::Pixbuf> get_icon_for_kernel(const ProcInfo &); + Glib::RefPtr<Gdk::Pixbuf> get_icon_dummy(const ProcInfo &); + + bool get_default_icon_name(const string &cmd, string &name); + void file_monitor_event (Glib::RefPtr<Gio::File>, + Glib::RefPtr<Gio::File>, + Gio::FileMonitorEvent); + void init_gio_app_cache (); + + typedef std::map<string, Glib::RefPtr<Gdk::Pixbuf> > IconCache; + typedef std::map<pid_t, Glib::RefPtr<Gdk::Pixbuf> > IconsForPID; + typedef std::map<string, Glib::RefPtr<Gio::AppInfo> > AppCache; + typedef std::map<string, Glib::RefPtr<Gio::FileMonitor> > DesktopDirMonitors; + + IconsForPID apps; + IconCache defaults; + DesktopDirMonitors monitors; + AppCache gio_apps; +}; + + +#endif /* _GSM_PRETTY_TABLE_H_ */ |