cpumem applet patch



This patch adds pause/continue to the cpu/mem applet. (my computer is slow &
the cpu applet causes a momentary 'freeze' in GL apps, ie games).

the patch applies cleanly to gnome-applets-1.1.8 & 1.1.9 (& i assume 1.1.90,
but i haven't grabbed that yet :)

(pls. tell me if you want the patches in some other form)

mibus
-- 
Robert Mibus <mibus@bigpond.com>
"Never put off until tomorrow that which can be done the day after tomorrow." (Mark Twain)
--- cpumemusage.c~orig	Mon Apr 17 22:23:45 2000
+++ cpumemusage.c	Mon Apr 17 22:49:50 2000
@@ -155,6 +155,33 @@
 }
 
 static void
+cpumemusage_pause (AppletWidget *applet, gpointer data)
+{
+	applet_widget_callback_set_sensitive  (APPLET_WIDGET (applet),
+					       "cont",
+					       1);
+	applet_widget_callback_set_sensitive  (APPLET_WIDGET (applet),
+					       "pause",
+					       0);
+
+	gnome_proc_bar_stop (GNOME_PROC_BAR (mem));
+	gnome_proc_bar_stop (GNOME_PROC_BAR (cpu));
+}
+
+static void
+cpumemusage_cont (AppletWidget *applet, gpointer data)
+{
+	applet_widget_callback_set_sensitive  (APPLET_WIDGET (applet),
+					       "cont",
+					       0);
+	applet_widget_callback_set_sensitive  (APPLET_WIDGET (applet),
+					       "pause",
+					       1);
+	gnome_proc_bar_start (GNOME_PROC_BAR (cpu), CPU_UPDATE_MSEC, NULL);
+	gnome_proc_bar_start (GNOME_PROC_BAR (mem), MEM_UPDATE_MSEC, NULL);
+}
+
+static void
 cpumemusage_about (AppletWidget *applet, gpointer data)
 {
         static GtkWidget   *about     = NULL;
@@ -285,6 +312,24 @@
 
         cpumemusage = cpumemusage_widget();
         applet_widget_add( APPLET_WIDGET(applet), cpumemusage );
+
+	applet_widget_register_stock_callback (APPLET_WIDGET(applet),
+					       "pause",
+					       GNOME_STOCK_MENU_TIMER_STOP,
+					       _("Pause"),
+					       cpumemusage_pause,
+					       NULL);
+
+	applet_widget_register_stock_callback (APPLET_WIDGET(applet),
+					       "cont",
+					       GNOME_STOCK_MENU_TIMER,
+					       _("Continue"),
+					       cpumemusage_cont,
+					       NULL);
+
+	applet_widget_callback_set_sensitive  (APPLET_WIDGET (applet),
+					       "cont",
+					       0);
 
 	applet_widget_register_stock_callback (APPLET_WIDGET (applet),
 					       "help",
--- cpumemusage.sgml~orig	Mon Apr 17 23:02:14 2000
+++ cpumemusage.sgml	Mon Apr 17 22:57:25 2000
@@ -75,7 +75,11 @@
    <sect2 id="cpumemusage-right-click">
     <title>Right-Click Pop-Up Menu Items</title>
     <para> 
-      There are no extra menu items in the applet. 
+      The only extra menu items are 'Pause' and 'Continue'.
+      'Pause' is used to temporarily suspend the applet.
+      'Continue' returns the applet to its normal state.
+      The 'Pause' feature can be used if the applet is interrupting an
+      important processor-intensive function, for example GLQuake.
     </para>
    </sect2>
   

PGP signature



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