Updating branch refs/heads/master
         to e7fe287e191ed4107b27bc7287cddd5fc41167dc (commit)
       from c0eb5740896eef86aee1c40061ed443179a08f6a (commit)

commit e7fe287e191ed4107b27bc7287cddd5fc41167dc
Author: Mike Massonnet <[email protected]>
Date:   Mon May 24 02:25:04 2010 +0200

    Show tooltip with system information on status icon

 src/main.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/main.c b/src/main.c
index 73edbca..db9087a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -48,6 +48,7 @@ init_timeout (void)
        guint num_processes;
        gfloat cpu, memory, swap;
        guint64 swap_free, swap_total;
+       gchar tooltip[1024];
 
        xtm_task_manager_get_system_info (task_manager, &num_processes, &cpu, 
&memory, &swap);
        xtm_process_window_set_system_info (XTM_PROCESS_WINDOW (window), 
num_processes, cpu, memory, swap);
@@ -55,6 +56,24 @@ init_timeout (void)
        xtm_task_manager_get_swap_usage (task_manager, &swap_free, &swap_total);
        xtm_process_window_show_swap_usage (XTM_PROCESS_WINDOW (window), 
(swap_total > 0));
 
+#if GTK_CHECK_VERSION (2,16,0)
+       g_snprintf (tooltip, 1024,
+                       _("<b>Processes:</b> %u\n"
+                       "<b>CPU:</b> %.0f%%\n"
+                       "<b>Memory:</b> %.0f%%\n"
+                       "<b>Swap:</b> %.0f%%"),
+                       num_processes, cpu, memory, swap);
+       gtk_status_icon_set_tooltip_markup (GTK_STATUS_ICON (status_icon), 
tooltip);
+#else
+       g_snprintf (tooltip, 1024,
+                       _("Processes: %u\n"
+                       "CPU: %.0f%%\n"
+                       "Memory: %.0f%%\n"
+                       "Swap: %.0f%%"),
+                       cpu, num_processes, memory, swap);
+       gtk_status_icon_set_tooltip (GTK_STATUS_ICON (status_icon), tooltip);
+#endif
+
        xtm_task_manager_update_model (task_manager);
 
        if (timeout == 0)
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to