[gnome-system-monitor/gnome-3-8] Refresh the process list icons on icon theme change. https://bugzilla.gnome.org/show_bug.cgi?id=4851



commit 0b8574e70c2541b1c4da93fd0b0140bc44fce61d
Author: Robert Roth <robert roth off gmail com>
Date:   Sun Apr 28 00:41:09 2013 +0300

    Refresh the process list icons on icon theme change.
    https://bugzilla.gnome.org/show_bug.cgi?id=485139

 src/callbacks.cpp |   14 ++++++++++++++
 src/callbacks.h   |    2 ++
 src/proctable.cpp |    3 +++
 3 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/callbacks.cpp b/src/callbacks.cpp
index e965f66..543ed0f 100644
--- a/src/callbacks.cpp
+++ b/src/callbacks.cpp
@@ -476,6 +476,20 @@ cb_timeout (gpointer data)
     return TRUE;
 }
 
+void
+cb_refresh_icons (GtkIconTheme *theme, gpointer data)
+{
+    ProcmanApp * const app = static_cast<ProcmanApp *>(data);
+    if(app->timeout) {
+        g_source_remove (app->timeout);
+    }
+
+    for (ProcInfo::Iterator it(ProcInfo::begin()); it != ProcInfo::end(); ++it) {
+        app->pretty_table->set_icon(*(it->second));
+    }
+
+    cb_timeout(app);
+}
 
 void
 cb_radio_processes(GtkAction *action, GtkRadioAction *current, gpointer data)
diff --git a/src/callbacks.h b/src/callbacks.h
index 3b80013..3be5220 100644
--- a/src/callbacks.h
+++ b/src/callbacks.h
@@ -66,6 +66,8 @@ gint            cb_update_disks (gpointer data);
 gint            cb_user_refresh (GtkAction* action, gpointer data);
 gint            cb_timeout (gpointer data);
 
+void            cb_refresh_icons (GtkIconTheme *theme, gpointer data);
+
 void            cb_radio_processes(GtkAction *action,
                                    GtkRadioAction *current,
                                    gpointer data);
diff --git a/src/proctable.cpp b/src/proctable.cpp
index 6de3d5e..63c1417 100644
--- a/src/proctable.cpp
+++ b/src/proctable.cpp
@@ -427,6 +427,9 @@ proctable_new (ProcmanApp * const app)
         gtk_tree_view_column_set_visible(column, FALSE);
     }
 
+    GtkIconTheme* theme = gtk_icon_theme_get_default();
+    g_signal_connect(G_OBJECT (theme), "changed", G_CALLBACK (cb_refresh_icons), app);
+    
 #ifdef HAVE_SYSTEMD
     if (sd_booted() <= 0)
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]