multiload-2 patch
- From: fflewddur <fflewddur dropline net>
- To: Desktop-Devel List <desktop-devel-list gnome org>
- Subject: multiload-2 patch
- Date: 29 Dec 2001 00:07:41 -0500
i first submitted this patch to port multiload to gnome 2.0 a week ago,
but still haven't heard any responses on it. is there any interest in
it? any at all? :)
todd
diff -urN gnome-applets.orig/Makefile.am gnome-applets/Makefile.am
--- gnome-applets.orig/Makefile.am Wed Dec 12 21:59:49 2001
+++ gnome-applets/Makefile.am Sat Dec 22 09:18:26 2001
@@ -1,12 +1,12 @@
## Again, remove the comments on an applet you want to work on
-## gtop_applets = \
+gtop_applets = \
## cpumemusage \
## diskusage \
-## multiload
-## if HAVE_LIBGTOP
-## gtop_SUBDIRS = $(gtop_applets)
-## endif
+ multiload
+if BUILD_GTOP_APPLETS
+gtop_SUBDIRS = $(gtop_applets)
+endif
wordexp_applets = screenshooter
if HAVE_WORDEXP
@@ -74,8 +74,8 @@
$(modemlights_SUBDIRS) \
$(wordexp_SUBDIRS) \
$(cdplayer_SUBDIRS) \
- $(always_built_SUBDIRS)
-## $(gtop_SUBDIRS) \
+ $(always_built_SUBDIRS) \
+ $(gtop_SUBDIRS)
## $(ghttp_SUBDIRS) \
## $(esd_SUBDIRS) \
## omf-install
diff -urN gnome-applets.orig/configure.in gnome-applets/configure.in
--- gnome-applets.orig/configure.in Wed Dec 12 21:59:49 2001
+++ gnome-applets/configure.in Fri Dec 21 21:49:08 2001
@@ -35,6 +35,7 @@
GDK_PIXBUF_REQUIRED=1.3.1
LIBGNOMECANVAS_REQUIRED=1.102.0
SCROLLKEEPER_REQUIRED=0.1.4
+LIBGTOP_REQUIRED=1.0.13
dnl configure argument fo disable schema install
@@ -80,6 +81,14 @@
AM_GCONF_SOURCE_2
fi
+build_gtop_applets=false
+PKG_CHECK_MODULES(GTOP_APPLETS,
+ [libgtop-2.0 >= $LIBGTOP_REQUIRED],
+ build_gtop_applets=true,)
+AC_SUBST(GTOP_APPLETS_CFLAGS)
+AC_SUBST(GTOP_APPLETS_LIBS)
+AM_CONDITIONAL(BUILD_GTOP_APPLETS, $build_gtop_applets)
+
dnl Still need to decide on the checks for these
PKG_CHECK_MODULES(GDK_PIXBUF_APPLETS, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED)
@@ -90,6 +99,10 @@
AC_SUBST(LIBSGNOMECANVAS_APPLETS_CFLAGS)
AC_SUBST(LIBSGNOMECANVAS_APPLETS_LIBS)
+dnl PKG_CHECK_MODULES(GTOP_APPLETS, libgtop-2.0 >= $LIBGTOP_REQUIRED)
+dnl AC_SUBST(GTOP_APPLETS_CFLAGS)
+dnl AC_SUBST(GTOP_APPLETS_LIBS)
+
dnl ************************
dnl ** Set up gettext **
dnl ************************
@@ -407,6 +420,7 @@
geyes/Makefile
geyes/themes/Makefile
cdplayer/Makefile
+multiload/Makefile
])
dnl Mostly Ported Applets
diff -urN gnome-applets.orig/multiload/AUTHORS gnome-applets/multiload/AUTHORS
--- gnome-applets.orig/multiload/AUTHORS Thu Feb 24 15:00:59 2000
+++ gnome-applets/multiload/AUTHORS Fri Dec 21 21:50:28 2001
@@ -1 +1,2 @@
Martin Baulig <martin home-of-linux org>
+Todd Kulesza <fflewddur dropline net>
diff -urN gnome-applets.orig/multiload/CVS/Entries gnome-applets/multiload/CVS/Entries
--- gnome-applets.orig/multiload/CVS/Entries Fri Dec 21 21:47:31 2001
+++ gnome-applets/multiload/CVS/Entries Fri Dec 21 21:50:28 2001
@@ -1,30 +1,30 @@
-/.cvsignore/1.4/Wed Jul 11 21:20:29 2001//
/AUTHORS/1.1/Thu Feb 24 20:00:59 2000//
/ChangeLog/1.18/Thu Aug 2 08:54:31 2001//
/Makefile.am/1.21/Wed Sep 19 16:36:50 2001//
/cpuload.c/1.22/Sun May 21 22:47:26 2000//
-/cpuload_applet.desktop.in/1.1/Thu Jan 25 02:37:42 2001//
/global.h/1.9/Thu Aug 2 08:54:31 2001//
/gnome-cpu.png/1.1/Tue Aug 24 14:46:24 1999//
/gnome-mem.png/1.1/Tue Aug 24 14:46:24 1999//
-/linux-proc.c/1.14/Wed Jul 11 20:56:01 2001//
-/linux-proc.h/1.5/Wed Jul 11 20:56:01 2001//
/load-graph.c/1.23/Mon Jul 2 10:52:44 2001//
/load-graph.h/1.7/Mon Mar 27 02:37:27 2000//
/loadavg.c/1.8/Sun May 21 22:47:27 2000//
-/loadavg_applet.desktop.in/1.1/Thu Jan 25 02:37:42 2001//
-/local-properties.c/1.4/Thu May 4 12:24:02 2000//
/local-properties.h/1.3/Sun Apr 16 20:24:51 2000//
/main.c/1.25/Thu Aug 2 14:22:49 2001//
/memload.c/1.24/Fri May 12 23:21:30 2000//
-/memload_applet.desktop.in/1.1/Thu Jan 25 02:37:42 2001//
-/multiload_applet.gnorba/1.9/Thu Aug 2 08:54:31 2001//
/netload.c/1.15/Fri May 12 23:21:30 2000//
-/netload_applet.desktop.in/1.1/Thu Jan 25 02:37:42 2001//
/properties.c/1.15/Thu Aug 2 08:54:31 2001//
/properties.h/1.10/Thu Aug 2 08:54:31 2001//
-/property-entries.c/1.3/Fri Jan 28 21:20:26 2000//
/property-entries.h/1.1/Mon Dec 28 14:58:42 1998//
/swapload.c/1.24/Fri May 12 23:21:30 2000//
-/swapload_applet.desktop.in/1.1/Thu Jan 25 02:37:42 2001//
-D
+/.cvsignore/1.4/Tue Dec 11 03:18:34 2001//
+/property-entries.c/1.3/Wed Dec 12 18:37:46 2001//
+/local-properties.c/1.4/Sun Dec 16 06:16:36 2001//
+/cpuload_applet.desktop.in/1.1/Sun Dec 16 07:06:46 2001//
+/loadavg_applet.desktop.in/1.1/Sun Dec 16 07:06:46 2001//
+/memload_applet.desktop.in/1.1/Sun Dec 16 07:06:46 2001//
+/multiload_applet.gnorba/1.9/Sun Dec 16 07:06:46 2001//
+/netload_applet.desktop.in/1.1/Sun Dec 16 07:06:46 2001//
+/swapload_applet.desktop.in/1.1/Sun Dec 16 07:06:46 2001//
+D/docs////
+/linux-proc.c/1.14/Wed Dec 19 17:58:38 2001//
+/linux-proc.h/1.5/Wed Dec 19 17:58:38 2001//
diff -urN gnome-applets.orig/multiload/CVS/Entries.Log gnome-applets/multiload/CVS/Entries.Log
--- gnome-applets.orig/multiload/CVS/Entries.Log Fri Dec 21 21:47:31 2001
+++ gnome-applets/multiload/CVS/Entries.Log Wed Dec 31 19:00:00 1969
@@ -1 +0,0 @@
-A D/docs////
diff -urN gnome-applets.orig/multiload/ChangeLog gnome-applets/multiload/ChangeLog
--- gnome-applets.orig/multiload/ChangeLog Thu Aug 2 04:54:31 2001
+++ gnome-applets/multiload/ChangeLog Fri Dec 21 21:50:28 2001
@@ -1,3 +1,9 @@
+2001-12-21 Todd Kulesza <fflewddur dropline net>
+
+ * *.[ch] First pass at the Gnome 2.0 port. All five applets
+ work but the properties dialogs and documentation are
+ non-existant.
+
2001-08-02 Kjartan Maraas <kmaraas gnome org>
* Revert the pageload diff since it doesn't work right.
diff -urN gnome-applets.orig/multiload/GNOME_MultiLoadApplet_Factory.server.in.in gnome-applets/multiload/GNOME_MultiLoadApplet_Factory.server.in.in
--- gnome-applets.orig/multiload/GNOME_MultiLoadApplet_Factory.server.in.in Wed Dec 31 19:00:00 1969
+++ gnome-applets/multiload/GNOME_MultiLoadApplet_Factory.server.in.in Fri Dec 21 21:50:28 2001
@@ -0,0 +1,96 @@
+<oaf_info>
+
+<oaf_server iid="OAFIID:GNOME_MultiLoadApplet_Factory"
+ type="shlib"
+ location="@APPLET_LIBDIR@/libmultiload_applet_2.so">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:Bonobo/GenericFactory:1.0"/>
+ <item value="IDL:Bonobo/Unknown:1.0"/>
+ </oaf_attribute>
+ <oaf_attribute name="name" type="string" value="MultiLoad Applet Factory"/>
+ <oaf_attribute name="description" type="string" value="Factory for creating load applets."/>
+
+</oaf_server>
+
+<oaf_server iid="OAFIID:GNOME_CPULoadApplet"
+ type="factory"
+ location="OAFIID:GNOME_MultiLoadApplet_Factory">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/PanelAppletShell:1.0"/>
+ <item value="IDL:Bonobo/Control:1.0"/>
+ <item value="IDL:Bonobo/Unknown:1.0"/>
+ </oaf_attribute>
+ <oaf_attribute name="name" type="string" value="CPU Load"/>
+ <oaf_attribute name="description" type="string" value="CPU Load Indicator"/>
+ <oaf_attribute name="panel:category" type="string" value="Monitors"/>
+ <oaf_attribute name="panel:icon" type="string" value="gnome-cpu.png"/>
+
+</oaf_server>
+
+<oaf_server iid="OAFIID:GNOME_MemoryLoadApplet"
+ type="factory"
+ location="OAFIID:GNOME_MultiLoadApplet_Factory">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/PanelAppletShell:1.0"/>
+ <item value="IDL:Bonobo/Control:1.0"/>
+ <item value="IDL:Bonobo/Unknown:1.0"/>
+ </oaf_attribute>
+ <oaf_attribute name="name" type="string" value="Memory Load"/>
+ <oaf_attribute name="description" type="string" value="Memory Load Indicator"/>
+ <oaf_attribute name="panel:category" type="string" value="Monitors"/>
+ <oaf_attribute name="panel:icon" type="string" value="gnome-mem.png"/>
+
+</oaf_server>
+
+<oaf_server iid="OAFIID:GNOME_NetLoadApplet"
+ type="factory"
+ location="OAFIID:GNOME_MultiLoadApplet_Factory">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/PanelAppletShell:1.0"/>
+ <item value="IDL:Bonobo/Control:1.0"/>
+ <item value="IDL:Bonobo/Unknown:1.0"/>
+ </oaf_attribute>
+ <oaf_attribute name="name" type="string" value="Net Load"/>
+ <oaf_attribute name="description" type="string" value="Net Load Indicator"/>
+ <oaf_attribute name="panel:category" type="string" value="Monitors"/>
+ <oaf_attribute name="panel:icon" type="string" value="gnome-cpu.png"/>
+
+</oaf_server>
+
+<oaf_server iid="OAFIID:GNOME_SwapLoadApplet"
+ type="factory"
+ location="OAFIID:GNOME_MultiLoadApplet_Factory">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/PanelAppletShell:1.0"/>
+ <item value="IDL:Bonobo/Control:1.0"/>
+ <item value="IDL:Bonobo/Unknown:1.0"/>
+ </oaf_attribute>
+ <oaf_attribute name="name" type="string" value="Swap Load"/>
+ <oaf_attribute name="description" type="string" value="Swap Load Indicator"/>
+ <oaf_attribute name="panel:category" type="string" value="Monitors"/>
+ <oaf_attribute name="panel:icon" type="string" value="gnome-mem.png"/>
+
+</oaf_server>
+
+<oaf_server iid="OAFIID:GNOME_AvgLoadApplet"
+ type="factory"
+ location="OAFIID:GNOME_MultiLoadApplet_Factory">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/PanelAppletShell:1.0"/>
+ <item value="IDL:Bonobo/Control:1.0"/>
+ <item value="IDL:Bonobo/Unknown:1.0"/>
+ </oaf_attribute>
+ <oaf_attribute name="name" type="string" value="Average Load"/>
+ <oaf_attribute name="description" type="string" value="Average Load Indicator"/>
+ <oaf_attribute name="panel:category" type="string" value="Monitors"/>
+ <oaf_attribute name="panel:icon" type="string" value="gnome-cpu.png"/>
+
+</oaf_server>
+
+</oaf_info>
diff -urN gnome-applets.orig/multiload/Makefile.am gnome-applets/multiload/Makefile.am
--- gnome-applets.orig/multiload/Makefile.am Wed Sep 19 12:36:50 2001
+++ gnome-applets/multiload/Makefile.am Fri Dec 21 21:50:28 2001
@@ -1,52 +1,51 @@
-SUBDIRS = docs
-
-INCLUDES = -I. -I$(srcdir) \
+INCLUDES = \
+ -I$(srcdir) \
+ -I$(top_srcdir)/intl \
+ -I$(top_builddir)/intl \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -I$(includedir) $(LIBGTOP_INCS)
-
-bin_PROGRAMS = multiload_applet
-
-multiload_applet_SOURCES = cpuload.c \
- memload.c \
- swapload.c \
- netload.c \
- loadavg.c \
- main.c \
- global.h \
- properties.c \
- properties.h \
- local-properties.c \
- local-properties.h \
- property-entries.c \
- property-entries.h \
- linux-proc.h \
- linux-proc.c \
- load-graph.c \
- load-graph.h
-
-multiload_applet_LDADD = \
- $(GNOME_APPLETS_LIBS) $(INTLLIBS) \
- $(LIBGTOP_LIBS) $(LIBGTOP_EXTRA_LIBS)
-
-appletdir = $(datadir)/applets
-
-Monitorsdir = $(appletdir)/Monitors
-
-Monitors_predata = cpuload_applet.desktop.in \
- memload_applet.desktop.in swapload_applet.desktop.in \
- netload_applet.desktop.in loadavg_applet.desktop.in
-
-Monitors_DATA = $(Monitors_predata:.desktop.in=.desktop)
- XML_I18N_MERGE_DESKTOP_RULE@
-
+ -DG_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED \
+ -DGNOME_DISABLE_DEPRECATED \
+ $(WARN_CFLAGS) \
+ $(GNOME_APPLETS_CFLAGS) \
+ $(GTOP_APPLETS_CFLAGS)
+
+libmultiload_applet_2_la_SOURCES = \
+ global.h \
+ linux-proc.h \
+ load-graph.h \
+ local-properties.h \
+ properties.h \
+ cpuload.c \
+ linux-proc.c \
+ load-graph.c \
+ loadavg.c \
+ main.c \
+ memload.c \
+ netload.c \
+ properties.c \
+ swapload.c
+
+libmultiload_applet_2_la_LIBADD = \
+ $(GNOME_APPLETS_LIBS) \
+ $(GTOP_APPLETS_LIBS)
+
+appletdir = $(libdir)
+applet_LTLIBRARIES = libmultiload_applet_2.la
+
+GNOME_MultiLoadApplet_Factory.server.in: GNOME_MultiLoadApplet_Factory.server.in.in
+ sed -e "s|\ APPLET_LIBDIR\@|$(appletdir)|" $< > $@
+
pixmaps = gnome-cpu.png gnome-mem.png
pixmapdir = $(datadir)/pixmaps
pixmap_DATA = $(pixmaps)
-
-gnorbadir = $(sysconfdir)/CORBA/servers
-gnorba_DATA = multiload_applet.gnorba
-
+
EXTRA_DIST = \
- $(Monitors_DATA) $(Monitors_predata) \
- $(gnorba_DATA) $(pixmaps)
+ GNOME_MultiLoadApplet_Factory.server.in.in \
+ $(pixmaps)
+
+serverdir = $(libdir)/bonobo/servers
+server_in_files = GNOME_MultiLoadApplet_Factory.server.in
+server_DATA = $(server_in_files:.server.in=.server)
+ XML_I18N_MERGE_SERVER_RULE@
\ No newline at end of file
diff -urN gnome-applets.orig/multiload/cpuload.c gnome-applets/multiload/cpuload.c
--- gnome-applets.orig/multiload/cpuload.c Sun May 21 18:47:26 2000
+++ gnome-applets/multiload/cpuload.c Fri Dec 21 21:50:28 2001
@@ -3,6 +3,7 @@
*
* Authors: Tim P. Gerla
* Martin Baulig
+ * Todd Kulesza
*
* With code from wmload.c, v0.9.2, apparently by Ryan Land, rland bc1 com
*
@@ -10,24 +11,36 @@
#include <config.h>
#include <stdio.h>
+#include <config.h>
#include <sys/stat.h>
#include <unistd.h>
#include <signal.h>
#include <dirent.h>
#include <string.h>
#include <time.h>
-#include <config.h>
#include <gnome.h>
-#include <gdk/gdkx.h>
-#include <applet-widget.h>
+#include <panel-applet.h>
+
+#include <gtk/gtk.h>
+#include <libgnomeui/libgnomeui.h>
+#include <libgnome/libgnome.h>
+#include <libgnomeui/gnome-window-icon.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libart_lgpl/libart.h>
+#include <bonobo/bonobo-shlib-factory.h>
#include "global.h"
static void
-about_cb (AppletWidget *widget, gpointer data)
+about_cb (BonoboUIComponent *uic, gpointer data, const gchar *name)
{
static GtkWidget *about = NULL;
- const gchar *authors[8];
+ static const gchar *authors[] =
+ {
+ "Martin Baulig <martin home-of-linux org>",
+ "Todd Kulesza <fflewddur dropline net>\n",
+ NULL
+ };
if (about != NULL)
{
@@ -36,86 +49,81 @@
return;
}
- authors[0] = "Martin Baulig <martin home-of-linux org>";
- authors[1] = NULL;
-
about = gnome_about_new
(_("CPU Load Applet"), VERSION,
- "(C) 1999",
- authors,
+ "(C) 1999, 2001",
_("Released under the GNU general public license.\n\n"
- "CPU Load Meter Applet."),
+ "CPU Load Indicator."),
+ authors,
+ NULL,
+ NULL,
NULL);
- gtk_signal_connect (GTK_OBJECT (about), "destroy",
- GTK_SIGNAL_FUNC (gtk_widget_destroyed), &about);
+ g_signal_connect (G_OBJECT (about), "destroy",
+ G_CALLBACK (gtk_widget_destroyed), &about);
gtk_widget_show (about);
}
-/* start a new instance of the cpuload applet */
-GtkWidget *
-make_cpuload_applet (const gchar *goad_id)
-{
- GtkWidget *applet;
- LoadGraphProperties *prop_data;
- LoadGraph *g;
-
- /* create a new applet_widget */
- applet = applet_widget_new(goad_id);
- /* in the rare case that the communication with the panel
- failed, error out */
- if (!applet)
- g_error (_("Can't create applet!\n"));
-
- prop_data = g_memdup (&multiload_properties.cpuload,
- sizeof (LoadGraphProperties));
-
- g = load_graph_new (APPLET_WIDGET (applet), 4, N_("CPU Load"),
- &multiload_properties.cpuload, prop_data,
- multiload_properties.cpuload.adj_data[0],
- multiload_properties.cpuload.adj_data[1], GetLoad,
- "index.html#CPULOAD-PROPERTIES");
-
- applet_widget_add (APPLET_WIDGET(applet), g->main_widget);
- gtk_widget_show (applet);
-
- load_graph_start (g);
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "properties",
- GNOME_STOCK_MENU_PROP,
- _("Default Properties..."),
- multiload_properties_cb,
- g);
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "local_properties",
- GNOME_STOCK_MENU_PROP,
- _("Properties..."),
- multiload_local_properties_cb,
- g);
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "run_gtop",
- GNOME_STOCK_MENU_INDEX,
- _("Run gtop..."),
- start_gtop_cb, NULL);
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "help",
- GNOME_STOCK_PIXMAP_HELP,
- _("Help"),
- multiload_help_cb,
- "cpuload_applet");
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "about",
- GNOME_STOCK_MENU_ABOUT,
- _("About..."),
- about_cb, NULL);
+static const gchar *cpu_texts [4] = {
+ N_("User"), N_("System"), N_("Nice"), N_("Idle")
+};
+
+static const gchar *cpu_color_defs [4] = {
+ "#ffffffff4fff", "#dfffdfffdfff",
+ "#afffafffafff", "#000000000000"
+};
+
+static const gchar cpuload_menu_xml [] =
+ "<popup name=\"button3\">\n"
+/* " <menuitem name=\"Properties Item\" verb=\"CPULoadProperties\" _label=\"Properties ...\"\n"
+ " pixtype=\"stock\" pixname=\"gtk-properties\"/>\n" */
+ " <menuitem name=\"Procman Item\" verb=\"CPULoadRunProcman\" _label=\"Run Procman ...\"\n"
+ " pixtype=\"stock\" pixname=\"gnome-stock-run\"/>\n"
+ " <menuitem name=\"Help Item\" verb=\"CPULoadHelp\" _label=\"Help\"\n"
+ " pixtype=\"stock\" pixname=\"gtk-help\"/>\n"
+ " <menuitem name=\"About Item\" verb=\"CPULoadAbout\" _label=\"About ...\"\n"
+ " pixtype=\"stock\" pixname=\"gnome-stock-about\"/>\n"
+ "</popup>\n";
+
+static const BonoboUIVerb cpuload_menu_verbs [] = {
+/* BONOBO_UI_VERB ("CPULoadProperties", NULL), */
+ BONOBO_UI_VERB ("CPULoadRunProcman", start_procman_cb),
+ BONOBO_UI_VERB_DATA ("CPULoadHelp", multiload_help_cb, "index.html#CPULOAD-PROPERTIES"),
+ BONOBO_UI_VERB ("CPULoadAbout", about_cb),
- applet_widget_set_tooltip(APPLET_WIDGET(applet), _("CPU Load"));
+ BONOBO_UI_VERB_END
+};
- return applet;
-}
+gboolean
+cpuload_applet_new(PanelApplet *applet)
+{
+ LoadGraph *g;
+ LoadGraphProperties *prop_data;
+
+ /* Setup properties. */
+
+ multiload_properties.cpuload.n = 4;
+ multiload_properties.cpuload.name = "cpuload";
+#ifdef ENABLE_NLS
+ {
+ int i;
+ for (i=0;i<4;i++) cpu_texts[i]=_(cpu_texts[i]);
+ }
+#endif
+ multiload_properties.cpuload.texts = cpu_texts;
+ multiload_properties.cpuload.color_defs = cpu_color_defs;
+ multiload_properties.cpuload.adj_data [0] = 500;
+ multiload_properties.cpuload.adj_data [1] = 40;
+
+ prop_data = g_memdup (&multiload_properties.cpuload, sizeof (LoadGraphProperties));
+ g_print("before load_graph_new (edited)\n");
+ g = load_graph_new (applet, 4, N_("CPU Load"), &multiload_properties.cpuload, prop_data, 500, 40, GetLoad);
+ g_print("after load_graph_new\n");
+ panel_applet_setup_menu (g->applet, cpuload_menu_xml, cpuload_menu_verbs, NULL);
+ g_print("after panel_applet_setup_menu\n");
+ load_graph_start(g);
+ g_print("after load_graph_start\n");
+
+ return TRUE;
+}
\ No newline at end of file
diff -urN gnome-applets.orig/multiload/cpuload_applet.desktop.in gnome-applets/multiload/cpuload_applet.desktop.in
--- gnome-applets.orig/multiload/cpuload_applet.desktop.in Wed Jan 24 21:37:42 2001
+++ gnome-applets/multiload/cpuload_applet.desktop.in Wed Dec 31 19:00:00 1969
@@ -1,7 +0,0 @@
-[Desktop Entry]
-_Name=CPULoad
-_Comment=CPU Load Meter
-Exec=multiload_applet --activate-goad-server=multiload_cpuload_applet
-Icon=gnome-cpu.png
-Terminal=0
-Type=Application
diff -urN gnome-applets.orig/multiload/global.h gnome-applets/multiload/global.h
--- gnome-applets.orig/multiload/global.h Thu Aug 2 04:54:31 2001
+++ gnome-applets/multiload/global.h Fri Dec 21 21:50:28 2001
@@ -2,58 +2,56 @@
#define __GLOBAL_H__
#include <config.h>
-#include <gnome.h>
-#include <applet-widget.h>
-#include <local-properties.h>
-#include <load-graph.h>
+#include <gnome.h>
+#include <panel-applet.h>
-#include <linux-proc.h>
+#include <gtk/gtk.h>
+#include <libgnomeui/libgnomeui.h>
+#include <libgnome/libgnome.h>
+#include <libgnomeui/gnome-window-icon.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libart_lgpl/libart.h>
+
+#include "local-properties.h"
+#include "load-graph.h"
+#include "linux-proc.h"
-BEGIN_GNOME_DECLS
+G_BEGIN_DECLS
/* start a new instance of the cpuload applet */
-GtkWidget *
-make_cpuload_applet (const gchar *goad_id);
+gboolean
+cpuload_applet_new(PanelApplet *applet);
/* start a new instance of the memload applet */
-GtkWidget *
-make_memload_applet (const gchar *goad_id);
+gboolean
+memload_applet_new(PanelApplet *applet);
/* start a new instance of the swapload applet */
-GtkWidget *
-make_swapload_applet (const gchar *goad_id);
+gboolean
+swapload_applet_new(PanelApplet *applet);
/* start a new instance of the netload applet */
-GtkWidget *
-make_netload_applet (const gchar *goad_id);
+gboolean
+netload_applet_new(PanelApplet *applet);
/* start a new instance of the loadavg applet */
-GtkWidget *
-make_loadavg_applet (const gchar *goad_id);
-
-/* show default properties dialog. */
-void
-multiload_properties_cb (AppletWidget *widget, gpointer data);
-
-/* show local properties dialog. */
-void
-multiload_local_properties_cb (AppletWidget *widget, gpointer data);
+gboolean
+loadavg_applet_new(PanelApplet *applet);
/* run gtop */
+/* if gtop is being phased out in favor of procman, is it safe to remove this function? */
void
-start_gtop_cb (AppletWidget *widget, gpointer data);
+start_gtop_cb (BonoboUIComponent *uic, gpointer data, const gchar *name);
-/* show help */
+/* run procman, gtop's replacement */
void
-multiload_help_cb (AppletWidget *widget, gpointer data);
-
-/* Load graph properties descriptor. */
-extern GnomePropertyDescriptor LoadGraphProperty_Descriptor;
+start_procman_cb (BonoboUIComponent *uic, gpointer data, const gchar *name);
-/* Load graph local properties descriptor. */
-extern GnomePropertyDescriptor LoadGraphLocalProperty_Descriptor;
+/* show help */
+void
+multiload_help_cb (BonoboUIComponent *uic, gpointer data, const gchar *name);
-END_GNOME_DECLS
+G_END_DECLS
#endif
diff -urN gnome-applets.orig/multiload/load-graph.c gnome-applets/multiload/load-graph.c
--- gnome-applets.orig/multiload/load-graph.c Mon Jul 2 06:52:44 2001
+++ gnome-applets/multiload/load-graph.c Fri Dec 21 21:50:28 2001
@@ -9,90 +9,63 @@
#include <config.h>
#include <gnome.h>
#include <gdk/gdkx.h>
-#include <applet-widget.h>
+#include <panel-applet.h>
#include "global.h"
-
+/*
static GtkWidget *load_graph_properties_init (GnomePropertyObject *object);
static void load_graph_properties_changed (GnomePropertyObject *object);
static void load_graph_properties_update (GnomePropertyObject *object);
static void load_graph_properties_load (GnomePropertyObject *object);
static void load_graph_properties_save (GnomePropertyObject *object);
-
+*/
static GList *object_list = NULL;
typedef struct _RadioButtonCbData RadioButtonCbData;
struct _RadioButtonCbData
{
- GnomePropertyObject *object;
GtkWidget *button, *color_frame, *data_frame;
gint index;
};
-GnomePropertyDescriptor LoadGraphProperty_Descriptor = {
- sizeof (LoadGraphProperties),
- N_("Load Graph"),
- load_graph_properties_init,
- NULL,
- load_graph_properties_update,
- load_graph_properties_load,
- load_graph_properties_save,
- NULL, NULL, NULL,
- load_graph_properties_changed,
- NULL
-};
-
-static GtkWidget *load_graph_local_properties_init (GnomePropertyObject *object);
-static void load_graph_local_properties_changed (GnomePropertyObject *object);
-static void load_graph_local_properties_update (GnomePropertyObject *object);
-static void load_graph_local_properties_save (GnomePropertyObject *object);
-
-GnomePropertyDescriptor LoadGraphLocalProperty_Descriptor = {
- sizeof (LoadGraphProperties),
- N_("Load Graph"),
- load_graph_local_properties_init,
- NULL,
- load_graph_local_properties_update,
- NULL,
- load_graph_local_properties_save,
- NULL, NULL, NULL,
- load_graph_local_properties_changed,
- NULL
-};
-
/* Redraws the backing pixmap for the load graph and updates the window */
static void
load_graph_draw (LoadGraph *g)
{
guint i, j;
-
+
/* we might get called before the configure event so that
* g->disp->allocation may not have the correct size
* (after the user resized the applet in the prop dialog). */
if (!g->pixmap)
- g->pixmap = gdk_pixmap_new (g->disp->window,
- g->draw_width, g->draw_height,
- gtk_widget_get_visual (g->disp)->depth);
-
+ g->pixmap = gdk_pixmap_new (g->disp->window,
+ g->draw_width, g->draw_height,
+ gtk_widget_get_visual (g->disp)->depth);
+
/* Create GC if necessary. */
- if (!g->gc) {
- g->gc = gdk_gc_new (g->disp->window);
- gdk_gc_copy (g->gc, g->disp->style->white_gc);
+ if (!g->gc)
+ {
+ g->gc = gdk_gc_new (g->disp->window);
+ gdk_gc_copy (g->gc, g->disp->style->black_gc);
}
/* Allocate colors. */
- if (!g->colors_allocated) {
- GdkColormap *colormap;
+ if (!g->colors_allocated)
+ {
+ GdkColormap *colormap;
+
- colormap = gdk_window_get_colormap (g->disp->window);
- for (i = 0; i < g->n; i++) {
- g->colors [i] = g->prop_data_ptr->colors [i];
- gdk_color_alloc (colormap, &(g->colors [i]));
- }
+ colormap = gdk_window_get_colormap (g->disp->window);
+
+ for (i = 0; i < g->n; i++)
+ {
+ g->colors [i] = g->prop_data_ptr->colors [i];
+ gdk_color_alloc (colormap, &(g->colors [i]));
+ }
- g->colors_allocated = 1;
+ g->colors_allocated = 1;
}
/* Erase Rectangle */
@@ -103,18 +76,19 @@
g->disp->allocation.height);
for (i = 0; i < g->draw_width; i++)
- g->pos [i] = g->draw_height;
-
- for (j = 0; j < g->n; j++) {
- gdk_gc_set_foreground (g->gc, &(g->colors [j]));
+ g->pos [i] = g->draw_height;
- for (i = 0; i < g->draw_width; i++) {
- gdk_draw_line (g->pixmap, g->gc,
- g->draw_width - i, g->pos[i],
- g->draw_width - i, g->pos[i] - g->data[i][j]);
+ for (j = 0; j < g->n; j++)
+ {
+ gdk_gc_set_foreground (g->gc, &(g->colors [j]));
+
+ for (i = 0; i < g->draw_width; i++) {
+ gdk_draw_line (g->pixmap, g->gc,
+ g->draw_width - i, g->pos[i],
+ g->draw_width - i, g->pos[i] - g->data[i][j]);
- g->pos [i] -= g->data [i][j];
- }
+ g->pos [i] -= g->data [i][j];
+ }
}
gdk_draw_pixmap (g->disp->window,
@@ -127,6 +101,8 @@
for (i = 0; i < g->draw_width; i++)
memcpy (g->odata [i], g->data [i], g->data_size);
+
+ return;
}
/* Updates the load graph when the timeout expires */
@@ -134,12 +110,12 @@
load_graph_update (LoadGraph *g)
{
guint i, j;
-
+
g->get_data (g->draw_height, g->data [0], g);
for (i=0; i < g->draw_width-1; i++)
- for (j=0; j < g->n; j++)
- g->data [i+1][j] = g->odata [i][j];
+ for (j=0; j < g->n; j++)
+ g->data [i+1][j] = g->odata [i][j];
load_graph_draw (g);
return TRUE;
@@ -167,8 +143,8 @@
g->size = g->prop_data_ptr->adj_data [1];
if (g->pixmap) {
- gdk_pixmap_unref (g->pixmap);
- g->pixmap = NULL;
+ gdk_pixmap_unref (g->pixmap);
+ g->pixmap = NULL;
}
g->allocated = FALSE;
@@ -177,41 +153,48 @@
static void
load_graph_alloc (LoadGraph *g)
{
- PanelOrientType orient;
+ PanelAppletOrient orient;
int pixel_size, i;
if (g->allocated)
- return;
+ return;
- orient = applet_widget_get_panel_orient (g->applet);
- switch (orient) {
- case ORIENT_UP:
- case ORIENT_DOWN:
- g->orient = FALSE;
- break;
- case ORIENT_LEFT:
- case ORIENT_RIGHT:
- g->orient = TRUE;
- break;
+ orient = panel_applet_get_orient (g->applet);
+ switch (orient)
+ {
+ case PANEL_APPLET_ORIENT_UP:
+ case PANEL_APPLET_ORIENT_DOWN:
+ {
+ g->orient = FALSE;
+ break;
+ }
+ case PANEL_APPLET_ORIENT_LEFT:
+ case PANEL_APPLET_ORIENT_RIGHT:
+ {
+ g->orient = TRUE;
+ break;
+ }
default:
- g_assert_not_reached ();
+ g_assert_not_reached ();
}
-
- pixel_size = applet_widget_get_panel_pixel_size (g->applet);
+
+ pixel_size = panel_applet_get_size (g->applet);
g_assert (pixel_size > 0);
g->pixel_size = pixel_size;
- g->show_frame = pixel_size > PIXEL_SIZE_SMALL;
+ /* 36 is the pixel size for a "small" panel */
+/* g->show_frame = pixel_size > 36; */
+ g->show_frame = 1;
if (g->orient) {
- g->draw_width = g->pixel_size;
- g->draw_height = g->size;
+ g->draw_width = g->pixel_size;
+ g->draw_height = g->size;
} else {
- g->draw_width = g->size;
- g->draw_height = g->pixel_size;
+ g->draw_width = g->size;
+ g->draw_height = g->pixel_size;
}
-
+
g->data = g_new0 (guint *, g->draw_width);
g->odata = g_new0 (guint *, g->draw_width);
g->pos = g_new0 (guint, g->draw_width);
@@ -219,8 +202,8 @@
g->data_size = sizeof (guint) * g->n;
for (i = 0; i < g->draw_width; i++) {
- g->data [i] = g_malloc0 (g->data_size);
- g->odata [i] = g_malloc0 (g->data_size);
+ g->data [i] = g_malloc0 (g->data_size);
+ g->odata [i] = g_malloc0 (g->data_size);
}
g->allocated = TRUE;
@@ -231,14 +214,14 @@
gpointer data_ptr)
{
LoadGraph *c = (LoadGraph *) data_ptr;
-
+
load_graph_unalloc (c);
load_graph_alloc (c);
if (!c->pixmap)
- c->pixmap = gdk_pixmap_new (widget->window,
- widget->allocation.width,
- widget->allocation.height,
+ c->pixmap = gdk_pixmap_new (c->disp->window,
+ c->disp->allocation.width,
+ c->disp->allocation.height,
gtk_widget_get_visual (c->disp)->depth);
gdk_draw_rectangle (c->pixmap,
@@ -276,9 +259,10 @@
load_graph_destroy (GtkWidget *widget, gpointer data_ptr)
{
LoadGraph *g = (LoadGraph *) data_ptr;
-
+
load_graph_stop (g);
+ gtk_widget_destroy(widget);
object_list = g_list_remove (object_list, g);
return;
widget = NULL;
@@ -296,27 +280,27 @@
gtk_container_remove (GTK_CONTAINER (g->box->parent), g->box);
if (g->frame) {
- gtk_widget_destroy (g->frame);
- g->frame = NULL;
+ gtk_widget_destroy (g->frame);
+ g->frame = NULL;
}
load_graph_alloc (g);
if (g->show_frame) {
- g->frame = gtk_frame_new (NULL);
- gtk_container_add (GTK_CONTAINER (g->frame), g->box);
- gtk_container_add (GTK_CONTAINER (g->main_widget), g->frame);
- gtk_widget_show (g->frame);
+ g->frame = gtk_frame_new (NULL);
+ gtk_container_add (GTK_CONTAINER (g->frame), g->box);
+ gtk_container_add (GTK_CONTAINER (g->main_widget), g->frame);
+ gtk_widget_show (g->frame);
} else {
- gtk_container_add (GTK_CONTAINER (g->main_widget), g->box);
+ gtk_container_add (GTK_CONTAINER (g->main_widget), g->box);
}
gtk_widget_unref (g->box);
if (g->orient)
- gtk_widget_set_usize (g->main_widget, g->pixel_size, g->size);
+ gtk_widget_set_size_request (g->main_widget, g->pixel_size, g->size);
else
- gtk_widget_set_usize (g->main_widget, g->size, g->pixel_size);
+ gtk_widget_set_size_request (g->main_widget, g->size, g->pixel_size);
}
static gint
@@ -326,9 +310,9 @@
load_graph_alloc (g);
if (g->orient)
- gtk_widget_set_usize (g->main_widget, g->pixel_size, g->size);
+ gtk_widget_set_size_request (g->main_widget, g->pixel_size, g->size);
else
- gtk_widget_set_usize (g->main_widget, g->size, g->pixel_size);
+ gtk_widget_set_size_request (g->main_widget, g->size, g->pixel_size);
return FALSE;
}
@@ -340,18 +324,22 @@
gchar name [BUFSIZ], temp [BUFSIZ];
guint i;
- gnome_config_push_prefix (privcfgpath);
-
- for (i=0; i < g->prop_data->n; i++) {
- GdkColor *color = &(g->prop_data->colors [i]);
+/* gnome_config_push_prefix (privcfgpath); */
+ for (i=0; i < g->prop_data->n; i++)
+ {
+ GdkColor *color = &(g->prop_data->colors [i]);
+/*
g_snprintf (temp, sizeof(temp), "#%04x%04x%04x",
color->red, color->green, color->blue);
+
+ g_snprintf(temp, sizeof(temp), "#0f0f0f");
g_snprintf (name, sizeof(name), "%s/color%d", g->prop_data->name, i);
gnome_config_set_string (name, temp);
+*/
}
-
+/*
g_snprintf (name, sizeof(name), "%s/speed", g->prop_data->name);
gnome_config_set_int (name, g->prop_data->adj_data [0]);
@@ -370,9 +358,10 @@
gnome_config_pop_prefix();
gnome_config_sync();
+*/
/* you need to use the drop_all here since we're all writing to
one file, without it, things might not work too well */
- gnome_config_drop_all ();
+/* gnome_config_drop_all (); */
/* make sure you return FALSE, otherwise your applet might not
work compeltely, there are very few circumstances where you
@@ -385,28 +374,37 @@
return FALSE;
}
+/* FIXME: port to gconf */
static void
applet_load_config (LoadGraph *g)
{
+
gchar name [BUFSIZ], *temp;
guint i;
- gnome_config_push_prefix (g->applet->privcfgpath);
+/* gnome_config_push_prefix (g->applet->privcfgpath); */
if (!g->prop_data->colors)
- g->prop_data->colors = g_new0 (GdkColor, g->prop_data->n);
+ g->prop_data->colors = g_new0 (GdkColor, g->prop_data->n);
- for (i=0; i < g->prop_data->n; i++) {
- GdkColor *color = &(g->prop_data->colors [i]);
+ for (i=0; i < g->prop_data->n; i++)
+ {
+ GdkColor *color = &(g->prop_data->colors [i]);
- g_snprintf (name, sizeof(name), "%s/color%d=%s",
- g->prop_data->name, i, g->prop_data->color_defs [i]);
+ g_snprintf (name, sizeof(name), "%s/color%d=%s",
+ g->prop_data->name, i, g->prop_data->color_defs [i]);
+
+ temp = g_strdup_printf("%s", g->prop_data->color_defs [i]);
+ gdk_color_parse(temp, color);
+ g_free(temp);
+/*
temp = gnome_config_get_string (name);
gdk_color_parse (temp, color);
g_free (temp);
+*/
}
-
+/*
g_snprintf (name, sizeof(name), "%s/speed=%ld",
g->prop_data->name, g->prop_data->adj_data [0]);
g->prop_data->adj_data [0] = gnome_config_get_int (name);
@@ -425,38 +423,56 @@
g_snprintf (name, sizeof(name), "%s/loadavg_type=%d",
g->prop_data->name, g->prop_data->loadavg_type);
g->prop_data->loadavg_type = gnome_config_get_int (name);
-
+*/
if (g->prop_data->use_default)
- g->prop_data_ptr = g->global_prop_data;
+ g->prop_data_ptr = g->global_prop_data;
else
- g->prop_data_ptr = g->prop_data;
-
+ g->prop_data_ptr = g->prop_data;
+/*
gnome_config_pop_prefix ();
+*/
}
LoadGraph *
-load_graph_new (AppletWidget *applet, guint n, gchar *label,
+load_graph_new (PanelApplet *applet, guint n, gchar *label,
LoadGraphProperties *global_prop_data,
- LoadGraphProperties *prop_data, guint speed,
- guint size, LoadGraphDataFunc get_data,
- gchar *help_path)
+ LoadGraphProperties *prop_data,
+ guint speed,
+ guint size, LoadGraphDataFunc get_data)
{
LoadGraph *g;
g = g_new0 (LoadGraph, 1);
- g->applet = applet;
+ g->applet = applet;
+
+ g->main_widget = gtk_vbox_new (FALSE, FALSE);
+ g->box = gtk_vbox_new (FALSE, FALSE);
+
+ if (g->show_frame)
+ {
+ g->frame = gtk_frame_new (NULL);
+ gtk_widget_show(g->frame);
+ gtk_container_add (GTK_CONTAINER (g->frame), g->box);
+ gtk_container_add (GTK_CONTAINER (g->main_widget), g->frame);
+ }
+ else
+ {
+ g->frame = NULL;
+ gtk_container_add (GTK_CONTAINER (g->main_widget), g->box);
+ }
+
g->n = n;
g->prop_data = prop_data;
g->global_prop_data = global_prop_data;
applet_load_config (g);
g->local_prop_data = g_new0 (LocalPropData, 1);
- g->local_prop_data->help_path = help_path; /* no need to dup */
+/* g->local_prop_data->help_path = help_path; */ /* no need to dup */
g->local_prop_data->applet = g->applet;
-
+/*
g->local_prop_data->property_object = gnome_property_object_new
(&LoadGraphLocalProperty_Descriptor, g->prop_data);
@@ -464,7 +480,7 @@
g->local_prop_data->local_property_object_list = g_list_append
(NULL, g->local_prop_data->property_object);
-
+*/
if (g->global_prop_data == &multiload_properties.cpuload)
g->prop_data->type = PROP_CPULOAD;
else if (g->global_prop_data == &multiload_properties.memload)
@@ -488,57 +504,47 @@
g->colors = g_new0 (GdkColor, g->n);
g->timer_index = -1;
+
+// gtk_widget_show_all(GTK_WIDGET(g->applet));
load_graph_alloc (g);
- g->main_widget = gtk_vbox_new (FALSE, FALSE);
- gtk_widget_show (g->main_widget);
-
- g->box = gtk_vbox_new (FALSE, FALSE);
- gtk_widget_show (g->box);
-
- if (g->show_frame) {
- g->frame = gtk_frame_new (NULL);
- gtk_container_add (GTK_CONTAINER (g->frame), g->box);
- gtk_container_add (GTK_CONTAINER (g->main_widget), g->frame);
- } else {
- g->frame = NULL;
- gtk_container_add (GTK_CONTAINER (g->main_widget), g->box);
- }
-
- g->disp = gtk_drawing_area_new ();
- gtk_signal_connect (GTK_OBJECT (g->disp), "expose_event",
- (GtkSignalFunc)load_graph_expose, g);
- gtk_signal_connect (GTK_OBJECT(g->disp), "configure_event",
- (GtkSignalFunc)load_graph_configure, g);
- gtk_signal_connect (GTK_OBJECT(g->disp), "destroy",
- (GtkSignalFunc)load_graph_destroy, g);
- gtk_widget_set_events (g->disp, GDK_EXPOSURE_MASK);
+ if (g->orient)
+ gtk_widget_set_size_request (g->main_widget, g->pixel_size, g->size);
+ else
+ gtk_widget_set_size_request (g->main_widget, g->size, g->pixel_size);
+
+ g->disp = gtk_drawing_area_new ();
+ gtk_widget_set_events (g->disp, GDK_EXPOSURE_MASK);
+
+ g_signal_connect (G_OBJECT (g->disp), "expose_event",
+ G_CALLBACK(load_graph_expose), g);
+ g_signal_connect (G_OBJECT(g->disp), "configure_event",
+ G_CALLBACK(load_graph_configure), g);
+ g_signal_connect (G_OBJECT(g->disp), "destroy",
+ G_CALLBACK(load_graph_destroy), g);
- gtk_box_pack_start_defaults (GTK_BOX (g->box), g->disp);
+ gtk_box_pack_start_defaults (GTK_BOX (g->box), g->disp);
- gtk_signal_connect (GTK_OBJECT (applet), "change_orient",
- GTK_SIGNAL_FUNC (applet_orient_changed_cb),
+ g_signal_connect (G_OBJECT (g->applet), "change_orient",
+ G_CALLBACK (applet_orient_changed_cb),
(gpointer) g);
- gtk_signal_connect (GTK_OBJECT (applet),
- "change_pixel_size",
- GTK_SIGNAL_FUNC (applet_pixel_size_changed_cb),
+ g_signal_connect (G_OBJECT (g->applet), "change_size",
+ G_CALLBACK (applet_pixel_size_changed_cb),
(gpointer) g);
-
- gtk_signal_connect (GTK_OBJECT (applet), "save_session",
- GTK_SIGNAL_FUNC (applet_save_session_cb),
+/*
+ g_signal_connect (G_OBJECT (g->applet), "save_yourself",
+ G_CALLBACK (applet_save_session_cb),
(gpointer) g);
-
- if (g->orient)
- gtk_widget_set_usize (g->main_widget, g->pixel_size, g->size);
- else
- gtk_widget_set_usize (g->main_widget, g->size, g->pixel_size);
-
+*/
object_list = g_list_append (object_list, g);
- gtk_widget_show_all (g->main_widget);
-
+ gtk_container_add(GTK_CONTAINER(g->applet), g->main_widget);
+
+ gtk_widget_show_all(g->main_widget);
+ gtk_widget_show(GTK_WIDGET(g->applet));
+
return g;
label = NULL;
}
@@ -547,7 +553,7 @@
load_graph_start (LoadGraph *g)
{
if (g->timer_index != -1)
- gtk_timeout_remove (g->timer_index);
+ gtk_timeout_remove (g->timer_index);
g->timer_index = gtk_timeout_add (g->prop_data_ptr->adj_data [0],
(GtkFunction) load_graph_update, g);
@@ -557,19 +563,21 @@
load_graph_stop (LoadGraph *g)
{
if (g->timer_index != -1)
- gtk_timeout_remove (g->timer_index);
+ gtk_timeout_remove (g->timer_index);
g->timer_index = -1;
}
+/*
static GtkWidget *
load_graph_properties_init (GnomePropertyObject *object)
{
GtkWidget *vb, *frame;
+*/
/* GtkWidget *label, *entry, *button, *table, *spin; */
- LoadGraphProperties *prop_data = object->prop_data;
+/* LoadGraphProperties *prop_data = object->prop_data; */
/* guint i; */
-
+/*
static const gchar *adj_data_texts [3] = {
N_("Interval:"), N_("Size:"), N_("Maximum:")
};
@@ -687,7 +695,7 @@
for (c = object_list; c; c = c->next) {
LoadGraph *g = (LoadGraph *) c->data;
-
+*/
/* Remember not to use `object->prop_data' here,
* `g->prop_data' is what you want !
*
@@ -707,7 +715,7 @@
*
* Feb 22, Martin Baulig
*/
-
+/*
if (g->prop_data->use_default)
g->prop_data_ptr = g->global_prop_data;
else
@@ -731,16 +739,17 @@
load_graph_alloc (g);
if (g->orient)
- gtk_widget_set_usize (g->main_widget, g->pixel_size, g->size);
+ gtk_widget_set_size_request (g->main_widget, g->pixel_size, g->size);
else
- gtk_widget_set_usize (g->main_widget, g->size, g->pixel_size);
+ gtk_widget_set_size_request (g->main_widget, g->size, g->pixel_size);
load_graph_draw (g);
}
return;
object = NULL;
}
-
+*/
+/*
static void
use_defaults_cb (GtkWidget *widget, RadioButtonCbData *cb_data)
{
@@ -753,7 +762,8 @@
multiload_local_properties_changed (cb_data->object->user_data);
}
-
+*/
+/*
static GtkWidget *
load_graph_local_properties_init (GnomePropertyObject *object)
{
@@ -812,8 +822,8 @@
cb_data->color_frame = color_frame;
cb_data->data_frame = data_frame;
- gtk_signal_connect
- (GTK_OBJECT (button), "toggled", use_defaults_cb, cb_data);
+ g_signal_connect
+ (G_OBJECT (button), "toggled", use_defaults_cb, cb_data);
gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 1);
@@ -844,7 +854,7 @@
for (c = object_list; c; c = c->next) {
LoadGraph *g = (LoadGraph *) c->data;
-
+*/
/* Remember not to use `object->prop_data' here,
* `g->prop_data' is what you want !
*
@@ -864,7 +874,7 @@
*
* Feb 22, Martin Baulig
*/
-
+/*
if (g->prop_data->use_default)
g->prop_data_ptr = g->global_prop_data;
else
@@ -888,12 +898,13 @@
load_graph_alloc (g);
if (g->orient)
- gtk_widget_set_usize (g->main_widget, g->pixel_size, g->size);
+ gtk_widget_set_size_request (g->main_widget, g->pixel_size, g->size);
else
- gtk_widget_set_usize (g->main_widget, g->size, g->pixel_size);
+ gtk_widget_set_size_request (g->main_widget, g->size, g->pixel_size);
load_graph_draw (g);
}
return;
object = NULL;
}
+*/
\ No newline at end of file
diff -urN gnome-applets.orig/multiload/load-graph.h gnome-applets/multiload/load-graph.h
--- gnome-applets.orig/multiload/load-graph.h Sun Mar 26 21:37:27 2000
+++ gnome-applets/multiload/load-graph.h Fri Dec 21 21:50:28 2001
@@ -10,7 +10,7 @@
#define NCPUSTATES 4
struct _LoadGraph {
- AppletWidget *applet;
+ PanelApplet *applet;
guint n;
guint speed, size;
@@ -47,11 +47,11 @@
/* Create new load graph. */
LoadGraph *
-load_graph_new (AppletWidget *applet, guint n, gchar *label,
+load_graph_new (PanelApplet *applet, guint n, gchar *label,
LoadGraphProperties *global_prop_data,
- LoadGraphProperties *prop_data, guint speed,
- guint size, LoadGraphDataFunc get_data,
- gchar *help_path);
+ LoadGraphProperties *prop_data,
+ guint speed,
+ guint size, LoadGraphDataFunc get_data);
/* Start load graph. */
void
diff -urN gnome-applets.orig/multiload/loadavg.c gnome-applets/multiload/loadavg.c
--- gnome-applets.orig/multiload/loadavg.c Sun May 21 18:47:27 2000
+++ gnome-applets/multiload/loadavg.c Fri Dec 21 21:50:28 2001
@@ -3,6 +3,7 @@
*
* Authors: Tim P. Gerla
* Martin Baulig
+ * Todd Kulesza
*
* With code from wmload.c, v0.9.2, apparently by Ryan Land, rland bc1 com
*
@@ -10,25 +11,95 @@
#include <config.h>
#include <stdio.h>
+#include <config.h>
#include <sys/stat.h>
#include <unistd.h>
#include <signal.h>
#include <dirent.h>
#include <string.h>
#include <time.h>
-#include <config.h>
#include <gnome.h>
-#include <gdk/gdkx.h>
-#include <applet-widget.h>
+#include <panel-applet.h>
+
+#include <gtk/gtk.h>
+#include <libgnomeui/libgnomeui.h>
+#include <libgnome/libgnome.h>
+#include <libgnomeui/gnome-window-icon.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libart_lgpl/libart.h>
+#include <bonobo/bonobo-shlib-factory.h>
#include "global.h"
+static void
+about_cb (BonoboUIComponent *uic, gpointer data, const gchar *name)
+{
+ static GtkWidget *about = NULL;
+ static const gchar *authors[] =
+ {
+ "Martin Baulig <martin home-of-linux org>",
+ "Todd Kulesza <fflewddur dropline net>\n",
+ NULL
+ };
+
+ if (about != NULL)
+ {
+ gdk_window_show(about->window);
+ gdk_window_raise(about->window);
+ return;
+ }
+
+ about = gnome_about_new
+ (_("Average Load Applet"), VERSION,
+ "(C) 1999, 2001",
+ _("Released under the GNU general public license.\n\n"
+ "Average Load Indicator."),
+ authors,
+ NULL,
+ NULL,
+ NULL);
+
+ g_signal_connect (G_OBJECT (about), "destroy",
+ G_CALLBACK (gtk_widget_destroyed), &about);
+
+ gtk_widget_show (about);
+}
+
static const char *loadavg_texts [3] = {
N_("Load average over 1 minute"),
N_("Load average over 5 minutes"),
N_("Load average over 15 minutes")
};
+static const gchar *loadavg_texts_main [2] = {
+ N_("Used"), N_("Free")
+};
+
+static const gchar *loadavg_color_defs [2] = {
+ "#cfff5fff5fff", "#00008fff0000"
+};
+
+static const gchar avgload_menu_xml [] =
+ "<popup name=\"button3\">\n"
+/* " <menuitem name=\"Properties Item\" verb=\"AvgLoadProperties\" _label=\"Properties ...\"\n"
+ " pixtype=\"stock\" pixnam=\"gtk-properties\"/>\n" */
+ " <menuitem name=\"Procman Item\" verb=\"AvgLoadRunProcman\" _label=\"Run Procman ...\"\n"
+ " pixtype=\"stock\" pixname=\"gnome-stock-run\"/>\n"
+ " <menuitem name=\"Help Item\" verb=\"AvgLoadHelp\" _label=\"Help\"\n"
+ " pixtype=\"stock\" pixname=\"gtk-help\"/>\n"
+ " <menuitem name=\"About Item\" verb=\"AvgLoadAbout\" _label=\"About ...\"\n"
+ " pixtype=\"stock\" pixname=\"gnome-stock-about\"/>\n"
+ "</popup>\n";
+
+static const BonoboUIVerb avgload_menu_verbs [] = {
+/* BONOBO_UI_VERB ("AvgLoadProperties", NULL), */
+ BONOBO_UI_VERB ("AvgLoadRunProcman", start_procman_cb),
+ BONOBO_UI_VERB_DATA ("AvgLoadHelp", multiload_help_cb, "index.html#LOADAVG-PROPERTIES"),
+ BONOBO_UI_VERB ("AvgLoadAbout", about_cb),
+
+ BONOBO_UI_VERB_END
+};
+/*
static void
loadavg_1_cb (AppletWidget *widget, gpointer data)
{
@@ -82,116 +153,40 @@
applet_widget_set_tooltip (g->applet, _(loadavg_texts [2]));
}
-
-static void
-about_cb (AppletWidget *widget, gpointer data)
-{
- static GtkWidget *about = NULL;
- const gchar *authors[8];
-
- if (about != NULL)
- {
- gdk_window_show(about->window);
- gdk_window_raise(about->window);
- return;
- }
-
- authors[0] = "Martin Baulig <martin home-of-linux org>";
- authors[1] = NULL;
-
- about = gnome_about_new
- (_("Load Average Applet"), VERSION,
- "(C) 1999",
- authors,
- _("Released under the GNU general public license.\n\n"
- "Load Average Meter Applet."),
- NULL);
-
- gtk_signal_connect (GTK_OBJECT (about), "destroy",
- GTK_SIGNAL_FUNC (gtk_widget_destroyed), &about);
-
- gtk_widget_show (about);
-}
+*/
/* start a new instance of the loadavg applet */
-GtkWidget *
-make_loadavg_applet (const gchar *goad_id)
+gboolean
+loadavg_applet_new(PanelApplet *applet)
{
- GtkWidget *applet;
LoadGraphProperties *prop_data;
LoadGraph *g;
- /* create a new applet_widget */
- applet = applet_widget_new(goad_id);
- /* in the rare case that the communication with the panel
- failed, error out */
- if (!applet)
- g_error ("Can't create applet!\n");
+ multiload_properties.loadavg.n = 2;
+ multiload_properties.loadavg.name = "loadavg";
+#ifdef ENABLE_NLS
+ {
+ int i;
+ for (i=0;i<2;i++) loadavg_texts_main[i]=_(loadavg_texts_main[i]);
+ }
+#endif
+ multiload_properties.loadavg.texts = loadavg_texts_main;
+ multiload_properties.loadavg.color_defs = loadavg_color_defs;
+ multiload_properties.loadavg.adj_data [0] = 500;
+ multiload_properties.loadavg.adj_data [1] = 40;
+ multiload_properties.loadavg.adj_data [2] = 10;
prop_data = g_memdup (&multiload_properties.loadavg,
sizeof (LoadGraphProperties));
- g = load_graph_new (APPLET_WIDGET (applet), 2, N_("Load Average"),
+ g = load_graph_new (applet, 2, N_("Load Average"),
&multiload_properties.loadavg, prop_data,
multiload_properties.loadavg.adj_data[0],
- multiload_properties.loadavg.adj_data[1], GetLoadAvg,
- "index.html#LOADAVG-PROPERTIES");
-
- applet_widget_add (APPLET_WIDGET(applet), g->main_widget);
- gtk_widget_show (applet);
-
- load_graph_start (g);
-
- applet_widget_register_callback_dir (APPLET_WIDGET (applet),
- "loadavg/", _("Load Average"));
-
- applet_widget_register_callback (APPLET_WIDGET (applet),
- "loadavg/load_1", _(loadavg_texts [0]),
- loadavg_1_cb, g);
-
- applet_widget_register_callback (APPLET_WIDGET (applet),
- "loadavg/load_5", _(loadavg_texts [1]),
- loadavg_5_cb, g);
-
- applet_widget_register_callback (APPLET_WIDGET (applet),
- "loadavg/load_15", _(loadavg_texts [2]),
- loadavg_15_cb, g);
-
- applet_widget_register_stock_callback (APPLET_WIDGET (applet),
- "properties",
- GNOME_STOCK_MENU_PROP,
- _("Default Properties..."),
- multiload_properties_cb,
- g);
-
- applet_widget_register_stock_callback (APPLET_WIDGET (applet),
- "local_properties",
- GNOME_STOCK_MENU_PROP,
- _("Properties..."),
- multiload_local_properties_cb,
- g);
-
- applet_widget_register_stock_callback (APPLET_WIDGET (applet),
- "run_gtop",
- GNOME_STOCK_MENU_INDEX,
- _("Run gtop..."),
- start_gtop_cb, NULL);
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "help",
- GNOME_STOCK_PIXMAP_HELP,
- _("Help"),
- multiload_help_cb,
- "loadavg_applet");
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "about",
- GNOME_STOCK_MENU_ABOUT,
- _("About..."),
- about_cb, NULL);
+ multiload_properties.loadavg.adj_data[1], GetLoadAvg);
- applet_widget_set_tooltip (APPLET_WIDGET (applet),
- _(loadavg_texts [prop_data->loadavg_type]));
+ panel_applet_setup_menu (PANEL_APPLET (g->applet), avgload_menu_xml, avgload_menu_verbs, NULL);
- return applet;
+ load_graph_start(g);
+
+ return TRUE;
}
diff -urN gnome-applets.orig/multiload/loadavg_applet.desktop.in gnome-applets/multiload/loadavg_applet.desktop.in
--- gnome-applets.orig/multiload/loadavg_applet.desktop.in Wed Jan 24 21:37:42 2001
+++ gnome-applets/multiload/loadavg_applet.desktop.in Wed Dec 31 19:00:00 1969
@@ -1,6 +0,0 @@
-[Desktop Entry]
-_Name=Load Average
-_Comment=Load Average Applet
-Exec=multiload_applet --activate-goad-server=multiload_loadavg_applet
-Terminal=0
-Type=Application
diff -urN gnome-applets.orig/multiload/local-properties.c gnome-applets/multiload/local-properties.c
--- gnome-applets.orig/multiload/local-properties.c Thu May 4 08:24:02 2000
+++ gnome-applets/multiload/local-properties.c Fri Dec 21 21:50:28 2001
@@ -96,20 +96,20 @@
gnome_property_object_list_walk (d->local_property_object_list,
GNOME_PROPERTY_ACTION_LOAD_TEMP);
- gtk_signal_connect (GTK_OBJECT (d->win), "destroy",
- GTK_SIGNAL_FUNC (multiload_local_properties_close),
+ g_signal_connect (G_OBJECT (d->win), "destroy",
+ G_CALLBACK (multiload_local_properties_close),
(gpointer) d);
- gtk_signal_connect (GTK_OBJECT (d->win), "apply",
- GTK_SIGNAL_FUNC (multiload_local_properties_apply),
+ g_signal_connect (G_OBJECT (d->win), "apply",
+ G_CALLBACK (multiload_local_properties_apply),
(gpointer) d);
- gtk_signal_connect (GTK_OBJECT (d->win), "destroy",
- GTK_SIGNAL_FUNC (multiload_local_properties_close),
+ g_signal_connect (G_OBJECT (d->win), "destroy",
+ G_CALLBACK (multiload_local_properties_close),
(gpointer) d);
- gtk_signal_connect (GTK_OBJECT (d->win), "help",
- GTK_SIGNAL_FUNC (phelp_cb), d);
+ g_signal_connect (G_OBJECT (d->win), "help",
+ G_CALLBACK (phelp_cb), d);
- gtk_widget_show_all (d->win);
+ g_widget_show_all (d->win);
}
diff -urN gnome-applets.orig/multiload/local-properties.h gnome-applets/multiload/local-properties.h
--- gnome-applets.orig/multiload/local-properties.h Sun Apr 16 16:24:51 2000
+++ gnome-applets/multiload/local-properties.h Fri Dec 21 21:50:28 2001
@@ -3,13 +3,12 @@
#include <properties.h>
-BEGIN_GNOME_DECLS
+G_BEGIN_DECLS
typedef struct _LocalPropData LocalPropData;
struct _LocalPropData {
- AppletWidget *applet;
- GnomePropertyObject *property_object;
+ PanelApplet *applet;
GList *local_property_object_list;
GtkWidget *win;
gchar *help_path;
@@ -19,6 +18,6 @@
void
multiload_local_properties_changed (LocalPropData *d);
-END_GNOME_DECLS
+G_END_DECLS
#endif
diff -urN gnome-applets.orig/multiload/main.c gnome-applets/multiload/main.c
--- gnome-applets.orig/multiload/main.c Thu Aug 2 10:22:49 2001
+++ gnome-applets/multiload/main.c Fri Dec 21 21:50:28 2001
@@ -3,6 +3,7 @@
*
* Authors: Tim P. Gerla
* Martin Baulig
+ * Todd Kulesza
*
* With code from wmload.c, v0.9.2, apparently by Ryan Land, rland bc1 com
*
@@ -18,234 +19,69 @@
#include <string.h>
#include <time.h>
#include <gnome.h>
-#include <gdk/gdkx.h>
-#include <applet-widget.h>
+#include <panel-applet.h>
+
+#include <gtk/gtk.h>
+#include <libgnomeui/libgnomeui.h>
+#include <libgnome/libgnome.h>
#include <libgnomeui/gnome-window-icon.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libart_lgpl/libart.h>
+#include <bonobo/bonobo-shlib-factory.h>
#include "global.h"
-static const gchar *cpu_texts [4] = {
- N_("User"), N_("System"), N_("Nice"), N_("Idle")
-};
-
-static const gchar *mem_texts [4] = {
- N_("Other"), N_("Shared"), N_("Buffers"), N_("Free")
-};
-
-static const gchar *swap_texts [2] = {
- N_("Used"), N_("Free")
-};
-
-static const gchar *net_texts [4] = {
- N_("SLIP"), N_("PPP"), N_("ETH"), N_("Other"),
-};
-
-static const gchar *loadavg_texts [2] = {
- N_("Used"), N_("Free")
-};
-
-static const gchar *cpu_color_defs [4] = {
- "#ffffffff4fff", "#dfffdfffdfff",
- "#afffafffafff", "#000000000000"
-};
-
-static const gchar *mem_color_defs [4] = {
- "#bfffbfff4fff", "#efffefff4fff",
- "#afffafffafff", "#00008fff0000"
-};
-
-static const gchar *swap_color_defs [4] = {
- "#cfff5fff5fff", "#00008fff0000"
-};
-
-static const gchar *net_color_defs [4] = {
- "#64009500e0e0", "#d300d300d300",
- "#00008fff0000", "#ffffffff4fff"
-};
-
-static const gchar *loadavg_color_defs [2] = {
- "#cfff5fff5fff", "#00008fff0000"
-};
-
-#define ADD_PROPERTIES(x,y) multiload_property_object_list = g_list_append (multiload_property_object_list, gnome_property_object_new (& ## x ## Property_Descriptor, &multiload_properties. ## y ##))
-
-static GtkWidget *
-make_new_applet (const gchar *goad_id)
-{
- if (strstr (goad_id, "multiload_memload_applet"))
- return make_memload_applet (goad_id);
- else if (strstr (goad_id, "multiload_swapload_applet"))
- return make_swapload_applet (goad_id);
- else if (strstr (goad_id, "multiload_netload_applet"))
- return make_netload_applet (goad_id);
- else if (strstr (goad_id, "multiload_loadavg_applet"))
- return make_loadavg_applet (goad_id);
- else
- return make_cpuload_applet (goad_id);
-}
-
-/*when we get a command to start a new widget*/
-static GtkWidget *
-applet_start_new_applet (const gchar *goad_id, const char **params, int nparams)
-{
- return make_new_applet (goad_id);
- params = NULL;
- nparams = 0;
-}
-
/* run gtop (better location for this function?) */
void
-start_gtop_cb (AppletWidget *widget, gpointer data)
+start_gtop_cb (BonoboUIComponent *widget, gpointer data, const gchar *name)
{
gnome_execute_shell(NULL, "gtop");
return;
widget = NULL;
data = NULL;
}
+
+void
+start_procman_cb (BonoboUIComponent *uic, gpointer data, const gchar *name)
+{
+ gnome_execute_shell(NULL, "procman");
+ return;
+}
/* show help for the applet */
+
void
-multiload_help_cb (AppletWidget *applet, gpointer data)
+multiload_help_cb (BonoboUIComponent *uic, gpointer data, const gchar *name)
{
- GnomeHelpMenuEntry help_entry = { NULL, "index.html" };
- help_entry.name = data;
- gnome_help_display(NULL, &help_entry);
+ gnome_help_display(data, NULL, NULL);
+ return;
}
-int
-main (int argc, char **argv)
+static gboolean
+multiload_factory (PanelApplet *applet,
+ const gchar *iid,
+ gpointer data)
{
- const char *goad_id;
- GList *c;
-
- /* Initialize the i18n stuff */
- bindtextdomain (PACKAGE, GNOMELOCALEDIR);
- textdomain (PACKAGE);
-
- applet_widget_init ("multiload_applet", VERSION, argc, argv, NULL, 0, NULL);
- gnome_window_icon_set_default_from_file (GNOME_ICONDIR"/gnome-cpu.png");
-
- goad_id = goad_server_activation_id();
- if(!goad_id)
- return 0;
-
- /* Setup properties. */
-
- multiload_properties.cpuload.n = 4;
- multiload_properties.cpuload.name = "cpuload";
-#ifdef ENABLE_NLS
- {
- int i;
- for (i=0;i<4;i++) cpu_texts[i]=_(cpu_texts[i]);
- }
-#endif
- multiload_properties.cpuload.texts = cpu_texts;
- multiload_properties.cpuload.color_defs = cpu_color_defs;
- multiload_properties.cpuload.adj_data [0] = 500;
- multiload_properties.cpuload.adj_data [1] = 40;
-
- multiload_properties.memload.n = 4;
- multiload_properties.memload.name = "memload";
-#ifdef ENABLE_NLS
- {
- int i;
- for (i=0;i<4;i++) mem_texts[i]=_(mem_texts[i]);
- }
-#endif
- multiload_properties.memload.texts = mem_texts;
- multiload_properties.memload.color_defs = mem_color_defs;
- multiload_properties.memload.adj_data [0] = 500;
- multiload_properties.memload.adj_data [1] = 40;
-
- multiload_properties.swapload.n = 2;
- multiload_properties.swapload.name = "swapload";
-#ifdef ENABLE_NLS
- {
- int i;
- for (i=0;i<2;i++) swap_texts[i]=_(swap_texts[i]);
- }
-#endif
- multiload_properties.swapload.texts = swap_texts;
- multiload_properties.swapload.color_defs = swap_color_defs;
- multiload_properties.swapload.adj_data [0] = 500;
- multiload_properties.swapload.adj_data [1] = 40;
-
- multiload_properties.netload.n = 4;
- multiload_properties.netload.name = "netload";
-#ifdef ENABLE_NLS
- {
- int i;
- for (i=0;i<3;i++) net_texts[i]=_(net_texts[i]);
- }
-#endif
- multiload_properties.netload.texts = net_texts;
- multiload_properties.netload.color_defs = net_color_defs;
- multiload_properties.netload.adj_data [0] = 500;
- multiload_properties.netload.adj_data [1] = 40;
-
- multiload_properties.loadavg.n = 2;
- multiload_properties.loadavg.name = "loadavg";
-#ifdef ENABLE_NLS
- {
- int i;
- for (i=0;i<2;i++) swap_texts[i]=_(swap_texts[i]);
- }
-#endif
- multiload_properties.loadavg.texts = loadavg_texts;
- multiload_properties.loadavg.color_defs = loadavg_color_defs;
- multiload_properties.loadavg.adj_data [0] = 500;
- multiload_properties.loadavg.adj_data [1] = 40;
- multiload_properties.loadavg.adj_data [2] = 10;
-#ifdef ENABLE_NLS
- {
- int i;
- for (i=0;i<2;i++) loadavg_texts[i]=_(loadavg_texts[i]);
- }
-#endif
-
-
- /* Add property objects. */
-
- ADD_PROPERTIES (LoadGraph, cpuload);
- ADD_PROPERTIES (LoadGraph, memload);
- ADD_PROPERTIES (LoadGraph, swapload);
- ADD_PROPERTIES (LoadGraph, netload);
- ADD_PROPERTIES (LoadGraph, loadavg);
-
- /* This looks really ugly, but libgnomeui is already freezed so I can't
- * add new function there ... */
-
- c = g_list_nth (multiload_property_object_list, 0);
- ((GnomePropertyObject *) c->data)->label = gtk_label_new (_("CPU Load"));
- gtk_widget_ref (((GnomePropertyObject *) c->data)->label);
-
- c = g_list_nth (multiload_property_object_list, 1);
- ((GnomePropertyObject *) c->data)->label = gtk_label_new (_("Memory Load"));
- gtk_widget_ref (((GnomePropertyObject *) c->data)->label);
-
- c = g_list_nth (multiload_property_object_list, 2);
- ((GnomePropertyObject *) c->data)->label = gtk_label_new (_("Swap Load"));
- gtk_widget_ref (((GnomePropertyObject *) c->data)->label);
-
- c = g_list_nth (multiload_property_object_list, 3);
- ((GnomePropertyObject *) c->data)->label = gtk_label_new (_("Net Load"));
- gtk_widget_ref (((GnomePropertyObject *) c->data)->label);
-
- c = g_list_nth (multiload_property_object_list, 4);
- ((GnomePropertyObject *) c->data)->label = gtk_label_new (_("Load Average"));
- gtk_widget_ref (((GnomePropertyObject *) c->data)->label);
-
- /* Read properties. */
- multiload_init_properties ();
-
- applet_factory_new ("multiload_applet", NULL, applet_start_new_applet);
-
- /* Only do if factory wasn't requested. */
- if(goad_id && strcmp(goad_id, "multiload_applet"))
- make_new_applet(goad_id);
-
- applet_widget_gtk_main ();
+ gboolean retval = FALSE;
+
+ g_print ("multiload_factory: %s\n", iid);
- return 0;
+ if (!strcmp (iid, "OAFIID:GNOME_CPULoadApplet"))
+ retval = cpuload_applet_new(applet);
+ if (!strcmp (iid, "OAFIID:GNOME_MemoryLoadApplet"))
+ retval = memload_applet_new(applet);
+ if (!strcmp (iid, "OAFIID:GNOME_NetLoadApplet"))
+ retval = netload_applet_new(applet);
+ if (!strcmp (iid, "OAFIID:GNOME_SwapLoadApplet"))
+ retval = swapload_applet_new(applet);
+ if (!strcmp (iid, "OAFIID:GNOME_AvgLoadApplet"))
+ retval = loadavg_applet_new(applet);
+
+ g_print("returning\n");
+ return retval;
}
+
+PANEL_APPLET_BONOBO_SHLIB_FACTORY ("OAFIID:GNOME_MultiLoadApplet_Factory",
+ "MultiLoad Applet factory",
+ multiload_factory, NULL);
\ No newline at end of file
diff -urN gnome-applets.orig/multiload/memload.c gnome-applets/multiload/memload.c
--- gnome-applets.orig/multiload/memload.c Fri May 12 19:21:30 2000
+++ gnome-applets/multiload/memload.c Fri Dec 21 21:50:28 2001
@@ -3,11 +3,13 @@
*
* Authors: Tim P. Gerla
* Martin Baulig
+ * Todd Kulesza
*
* With code from wmload.c, v0.9.2, apparently by Ryan Land, rland bc1 com
*
*/
+#include <config.h>
#include <stdio.h>
#include <config.h>
#include <sys/stat.h>
@@ -16,19 +18,29 @@
#include <dirent.h>
#include <string.h>
#include <time.h>
-#include <config.h>
#include <gnome.h>
-#include <gdk/gdkx.h>
-#include <applet-widget.h>
+#include <panel-applet.h>
+
+#include <gtk/gtk.h>
+#include <libgnomeui/libgnomeui.h>
+#include <libgnome/libgnome.h>
#include <libgnomeui/gnome-window-icon.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libart_lgpl/libart.h>
+#include <bonobo/bonobo-shlib-factory.h>
#include "global.h"
static void
-about_cb (AppletWidget *widget, gpointer data)
+about_cb (BonoboUIComponent *uic, gpointer data, const gchar *name)
{
static GtkWidget *about = NULL;
- const gchar *authors[8];
+ static const gchar *authors[] =
+ {
+ "Martin Baulig <martin home-of-linux org>",
+ "Todd Kulesza <fflewddur dropline net>\n",
+ NULL
+ };
if (about != NULL)
{
@@ -37,88 +49,85 @@
return;
}
- authors[0] = "Martin Baulig <martin home-of-linux org>";
- authors[1] = NULL;
-
about = gnome_about_new
- (_("Memory Load Applet"), VERSION,
- "(C) 1999",
- authors,
+ (_("Memeory Load Applet"), VERSION,
+ "(C) 1999, 2001",
_("Released under the GNU general public license.\n\n"
- "Memory Load Applet."),
+ "Memory Load Indicator."),
+ authors,
+ NULL,
+ NULL,
NULL);
- gnome_window_icon_set_from_file (GTK_WINDOW (about),
- GNOME_ICONDIR"/gnome-mem.png");
- gtk_signal_connect (GTK_OBJECT (about), "destroy",
- GTK_SIGNAL_FUNC (gtk_widget_destroyed), &about);
+ g_signal_connect (G_OBJECT (about), "destroy",
+ G_CALLBACK (gtk_widget_destroyed), &about);
gtk_widget_show (about);
}
+static const gchar *mem_texts [4] = {
+ N_("Other"), N_("Shared"), N_("Buffers"), N_("Free")
+};
+
+static const gchar *mem_color_defs [4] = {
+ "#bfffbfff4fff", "#efffefff4fff",
+ "#afffafffafff", "#00008fff0000"
+};
+
+static const gchar memload_menu_xml [] =
+ "<popup name=\"button3\">\n"
+/* " <menuitem name=\"Properties Item\" verb=\"MemLoadProperties\" _label=\"Properties ...\"\n"
+ " pixtype=\"stock\" pixname=\"gtk-properties\"/>\n" */
+ " <menuitem name=\"Procman Item\" verb=\"MemLoadRunProcman\" _label=\"Run Procman ...\"\n"
+ " pixtype=\"stock\" pixname=\"gnome-stock-run\"/>\n"
+ " <menuitem name=\"Help Item\" verb=\"MemLoadHelp\" _label=\"Help\"\n"
+ " pixtype=\"stock\" pixname=\"gtk-help\"/>\n"
+ " <menuitem name=\"About Item\" verb=\"MemLoadAbout\" _label=\"About ...\"\n"
+ " pixtype=\"stock\" pixname=\"gnome-stock-about\"/>\n"
+ "</popup>\n";
+
+static const BonoboUIVerb memload_menu_verbs [] = {
+/* BONOBO_UI_VERB ("MemLoadProperties", NULL), */
+ BONOBO_UI_VERB ("MemLoadRunProcman", start_procman_cb),
+ BONOBO_UI_VERB_DATA ("MemLoadHelp", multiload_help_cb, "index.html#MEMLOAD-PROPERTIES"),
+ BONOBO_UI_VERB ("MemLoadAbout", about_cb),
+
+ BONOBO_UI_VERB_END
+};
+
/* start a new instance of the memload applet */
-GtkWidget *
-make_memload_applet (const gchar *goad_id)
+gboolean
+memload_applet_new(PanelApplet *applet)
{
- GtkWidget *applet;
LoadGraphProperties *prop_data;
LoadGraph *g;
-
- /* create a new applet_widget */
- applet = applet_widget_new(goad_id);
- /* in the rare case that the communication with the panel
- failed, error out */
- if (!applet)
- g_error (_("Can't create applet!\n"));
+
+ /* Setup Properties */
+
+ multiload_properties.memload.n = 4;
+ multiload_properties.memload.name = "memload";
+#ifdef ENABLE_NLS
+ {
+ int i;
+ for (i=0;i<4;i++) mem_texts[i]=_(mem_texts[i]);
+ }
+#endif
+ multiload_properties.memload.texts = mem_texts;
+ multiload_properties.memload.color_defs = mem_color_defs;
+ multiload_properties.memload.adj_data [0] = 500;
+ multiload_properties.memload.adj_data [1] = 40;
prop_data = g_memdup (&multiload_properties.memload,
sizeof (LoadGraphProperties));
- g = load_graph_new (APPLET_WIDGET (applet), 4, N_("Memory Load"),
+ g = load_graph_new (applet, 4, N_("Memory Load"),
&multiload_properties.memload, prop_data,
multiload_properties.memload.adj_data[0],
- multiload_properties.memload.adj_data[1], GetMemory,
- "index.html#MEMLOAD-PROPERTIES");
-
- applet_widget_add (APPLET_WIDGET(applet), g->main_widget);
- gtk_widget_show (applet);
-
- load_graph_start (g);
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "properties",
- GNOME_STOCK_MENU_PROP,
- _("Default Properties..."),
- multiload_properties_cb,
- g);
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "local_properties",
- GNOME_STOCK_MENU_PROP,
- _("Properties..."),
- multiload_local_properties_cb,
- g);
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "run_gtop",
- GNOME_STOCK_MENU_INDEX,
- _("Run gtop..."),
- start_gtop_cb, NULL);
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "help",
- GNOME_STOCK_PIXMAP_HELP,
- _("Help"),
- multiload_help_cb,
- "memload_applet");
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "about",
- GNOME_STOCK_MENU_ABOUT,
- _("About..."),
- about_cb, NULL);
+ multiload_properties.memload.adj_data[1], GetMemory);
- applet_widget_set_tooltip(APPLET_WIDGET(applet), _("Memory Load"));
+ panel_applet_setup_menu (PANEL_APPLET (g->applet), memload_menu_xml, memload_menu_verbs, NULL);
- return applet;
+ load_graph_start(g);
+
+ return TRUE;
}
diff -urN gnome-applets.orig/multiload/memload_applet.desktop.in gnome-applets/multiload/memload_applet.desktop.in
--- gnome-applets.orig/multiload/memload_applet.desktop.in Wed Jan 24 21:37:42 2001
+++ gnome-applets/multiload/memload_applet.desktop.in Wed Dec 31 19:00:00 1969
@@ -1,7 +0,0 @@
-[Desktop Entry]
-_Name=MemLoad
-_Comment=Memory Load Meter
-Exec=multiload_applet --activate-goad-server=multiload_memload_applet
-Icon=gnome-mem.png
-Terminal=0
-Type=Application
diff -urN gnome-applets.orig/multiload/multiload_applet.gnorba gnome-applets/multiload/multiload_applet.gnorba
--- gnome-applets.orig/multiload/multiload_applet.gnorba Thu Aug 2 04:54:31 2001
+++ gnome-applets/multiload/multiload_applet.gnorba Wed Dec 31 19:00:00 1969
@@ -1,35 +0,0 @@
-[multiload_applet]
-type=exe
-repo_id=IDL:GNOME/GenericFactory:1.0
-description=internal
-location_info=multiload_applet
-
-[multiload_cpuload_applet]
-type=factory
-repo_id=IDL:GNOME/Applet:1.0
-description=CPU Load applet/multi
-location_info=multiload_applet
-
-[multiload_memload_applet]
-type=factory
-repo_id=IDL:GNOME/Applet:1.0
-description=Memory load applet/multi
-location_info=multiload_applet
-
-[multiload_swapload_applet]
-type=factory
-repo_id=IDL:GNOME/Applet:1.0
-description=Swap Load applet/multi
-location_info=multiload_applet
-
-[multiload_netload_applet]
-type=factory
-repo_id=IDL:GNOME/Applet:1.0
-description=Network load applet/multi
-location_info=multiload_applet
-
-[multiload_loadavg_applet]
-type=factory
-repo_id=IDL:GNOME/Applet:1.0
-description=Load average applet/multi
-location_info=multiload_applet
diff -urN gnome-applets.orig/multiload/netload.c gnome-applets/multiload/netload.c
--- gnome-applets.orig/multiload/netload.c Fri May 12 19:21:30 2000
+++ gnome-applets/multiload/netload.c Fri Dec 21 21:50:28 2001
@@ -1,12 +1,14 @@
/* GNOME cpuload/memload panel applet
* (C) 1997 The Free Software Foundation
*
- * Author: Eric S. Raymond
+ * Authors: Eric S. Raymond
+ * Todd Kulesza
*
* With code from wmload.c, v0.9.2, apparently by Ryan Land, rland bc1 com
*
*/
+#include <config.h>
#include <stdio.h>
#include <config.h>
#include <sys/stat.h>
@@ -15,18 +17,29 @@
#include <dirent.h>
#include <string.h>
#include <time.h>
-#include <config.h>
#include <gnome.h>
-#include <gdk/gdkx.h>
-#include <applet-widget.h>
+#include <panel-applet.h>
+
+#include <gtk/gtk.h>
+#include <libgnomeui/libgnomeui.h>
+#include <libgnome/libgnome.h>
+#include <libgnomeui/gnome-window-icon.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libart_lgpl/libart.h>
+#include <bonobo/bonobo-shlib-factory.h>
#include "global.h"
static void
-about_cb (AppletWidget *widget, gpointer data)
+about_cb (BonoboUIComponent *uic, gpointer data, const gchar *name)
{
static GtkWidget *about = NULL;
- const gchar *authors[8];
+ static const gchar *authors[] =
+ {
+ "Martin Baulig <martin home-of-linux org>",
+ "Todd Kulesza <fflewddur dropline net>\n",
+ NULL
+ };
if (about != NULL)
{
@@ -35,86 +48,83 @@
return;
}
- authors[0] = "Martin Baulig <martin home-of-linux org>";
- authors[1] = NULL;
-
about = gnome_about_new
- (_("Network Load Applet"), VERSION,
- "(C) 1999",
- authors,
+ (_("Net Load Applet"), VERSION,
+ "(C) 1999, 2001",
_("Released under the GNU general public license.\n\n"
- "Network Load Meter Applet."),
+ "Net Load Indicator."),
+ authors,
+ NULL,
+ NULL,
NULL);
- gtk_signal_connect (GTK_OBJECT (about), "destroy",
- GTK_SIGNAL_FUNC (gtk_widget_destroyed), &about);
+ g_signal_connect (G_OBJECT (about), "destroy",
+ G_CALLBACK (gtk_widget_destroyed), &about);
gtk_widget_show (about);
}
+static const gchar *net_texts [4] = {
+ N_("SLIP"), N_("PPP"), N_("ETH"), N_("Other"),
+};
+
+static const gchar *net_color_defs [4] = {
+ "#64009500e0e0", "#d300d300d300",
+ "#00008fff0000", "#ffffffff4fff"
+};
+
+static const gchar netload_menu_xml [] =
+ "<popup name=\"button3\">\n"
+/* " <menuitem name=\"Properties Item\" verb=\"NetLoadProperties\" _label=\"Properties ...\"\n"
+ " pixtype=\"stock\" pixname=\"gtk-properties\"/>\n" */
+ " <menuitem name=\"Procman Item\" verb=\"NetLoadRunProcman\" _label=\"Run Procman ...\"\n"
+ " pixtype=\"stock\" pixname=\"gnome-stock-run\"/>\n"
+ " <menuitem name=\"Help Item\" verb=\"NetLoadHelp\" _label=\"Help\"\n"
+ " pixtype=\"stock\" pixname=\"gtk-help\"/>\n"
+ " <menuitem name=\"About Item\" verb=\"NetLoadAbout\" _label=\"About ...\"\n"
+ " pixtype=\"stock\" pixname=\"gnome-stock-about\"/>\n"
+ "</popup>\n";
+
+static const BonoboUIVerb netload_menu_verbs [] = {
+/* BONOBO_UI_VERB ("NetLoadProperties", NULL), */
+ BONOBO_UI_VERB ("NetLoadRunProcman", start_procman_cb),
+ BONOBO_UI_VERB_DATA ("NetLoadHelp", multiload_help_cb, "index.html#NETLOAD-PROPERTIES"),
+ BONOBO_UI_VERB ("NetLoadAbout", about_cb),
+
+ BONOBO_UI_VERB_END
+};
+
/* start a new instance of the netload applet */
-GtkWidget *
-make_netload_applet (const gchar *goad_id)
+gboolean
+netload_applet_new(PanelApplet *applet)
{
- GtkWidget *applet;
LoadGraphProperties *prop_data;
LoadGraph *g;
-
- /* create a new applet_widget */
- applet = applet_widget_new (goad_id);
- /* in the rare case that the communication with the panel
- failed, error out */
- if (!applet)
- g_error (_("Can't create applet!\n"));
+
+ multiload_properties.netload.n = 4;
+ multiload_properties.netload.name = "netload";
+#ifdef ENABLE_NLS
+ {
+ int i;
+ for (i=0;i<3;i++) net_texts[i]=_(net_texts[i]);
+ }
+#endif
+ multiload_properties.netload.texts = net_texts;
+ multiload_properties.netload.color_defs = net_color_defs;
+ multiload_properties.netload.adj_data [0] = 500;
+ multiload_properties.netload.adj_data [1] = 40;
prop_data = g_memdup (&multiload_properties.netload,
sizeof (LoadGraphProperties));
- g = load_graph_new (APPLET_WIDGET (applet), 4, N_("Net Load"),
+ g = load_graph_new (applet, 4, N_("Net Load"),
&multiload_properties.netload, prop_data,
multiload_properties.netload.adj_data[0],
- multiload_properties.netload.adj_data[1], GetNet,
- "index.html#NETLOAD-PROPERTIES");
-
- applet_widget_add (APPLET_WIDGET(applet), g->main_widget);
- gtk_widget_show (applet);
-
- load_graph_start (g);
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "properties",
- GNOME_STOCK_MENU_PROP,
- _("Default Properties..."),
- multiload_properties_cb,
- g);
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "local_properties",
- GNOME_STOCK_MENU_PROP,
- _("Properties..."),
- multiload_local_properties_cb,
- g);
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "run_gtop",
- GNOME_STOCK_MENU_INDEX,
- _("Run gtop..."),
- start_gtop_cb, NULL);
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "help",
- GNOME_STOCK_PIXMAP_HELP,
- _("Help"),
- multiload_help_cb,
- "netload_applet");
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "about",
- GNOME_STOCK_MENU_ABOUT,
- _("About..."),
- about_cb, NULL);
-
- applet_widget_set_tooltip(APPLET_WIDGET(applet), _("Network Load"));
-
- return applet;
+ multiload_properties.netload.adj_data[1], GetNet);
+
+ panel_applet_setup_menu (PANEL_APPLET (g->applet), netload_menu_xml, netload_menu_verbs, NULL);
+
+ load_graph_start(g);
+
+ return TRUE;
}
diff -urN gnome-applets.orig/multiload/netload_applet.desktop.in gnome-applets/multiload/netload_applet.desktop.in
--- gnome-applets.orig/multiload/netload_applet.desktop.in Wed Jan 24 21:37:42 2001
+++ gnome-applets/multiload/netload_applet.desktop.in Wed Dec 31 19:00:00 1969
@@ -1,7 +0,0 @@
-[Desktop Entry]
-_Name=NetLoad
-_Comment=Network Activity Meter
-Exec=multiload_applet --activate-goad-server=multiload_netload_applet
-Icon=
-Terminal=0
-Type=Application
diff -urN gnome-applets.orig/multiload/properties.c gnome-applets/multiload/properties.c
--- gnome-applets.orig/multiload/properties.c Thu Aug 2 04:54:31 2001
+++ gnome-applets/multiload/properties.c Fri Dec 21 21:50:28 2001
@@ -4,11 +4,11 @@
GList *multiload_property_object_list = NULL;
MultiLoadProperties multiload_properties;
-
+/*
static GtkWidget *win = NULL;
void
-multiload_properties_cb (AppletWidget *widget, gpointer data)
+multiload_properties_cb (PanelApplet *widget, gpointer data)
{
LoadGraph *g;
@@ -113,14 +113,14 @@
gnome_property_object_list_walk (multiload_property_object_list,
GNOME_PROPERTY_ACTION_LOAD_TEMP);
- gtk_signal_connect (GTK_OBJECT (win), "apply",
- GTK_SIGNAL_FUNC (multiload_properties_apply), NULL);
+ g_signal_connect (G_OBJECT (win), "apply",
+ G_CALLBACK (multiload_properties_apply), NULL);
- gtk_signal_connect (GTK_OBJECT (win), "destroy",
- GTK_SIGNAL_FUNC (multiload_properties_close), NULL);
+ g_signal_connect (G_OBJECT (win), "destroy",
+ G_CALLBACK (multiload_properties_close), NULL);
- gtk_signal_connect (GTK_OBJECT (win), "help",
- GTK_SIGNAL_FUNC (phelp_cb), NULL);
+ g_signal_connect (G_OBJECT (win), "help",
+ G_CALLBACK (phelp_cb), NULL);
gtk_widget_show_all (win);
gtk_notebook_set_page (GTK_NOTEBOOK (GNOME_PROPERTY_BOX (win)->notebook), prop_class);
@@ -130,3 +130,4 @@
multiload_init_properties (void)
{
}
+*/
\ No newline at end of file
diff -urN gnome-applets.orig/multiload/properties.h gnome-applets/multiload/properties.h
--- gnome-applets.orig/multiload/properties.h Thu Aug 2 04:54:31 2001
+++ gnome-applets/multiload/properties.h Fri Dec 21 21:50:28 2001
@@ -1,9 +1,7 @@
#ifndef __PROPERTIES_H__
#define __PROPERTIES_H__
-#include <property-entries.h>
-
-BEGIN_GNOME_DECLS
+G_BEGIN_DECLS
typedef enum {
PROP_CPULOAD,
@@ -41,13 +39,13 @@
extern GList *multiload_property_object_list;
extern MultiLoadProperties multiload_properties;
-
+/*
void multiload_properties_apply (void);
void multiload_properties_close (void);
void multiload_properties_changed (void);
void multiload_show_properties (PropertyClass prop_class);
void multiload_init_properties (void);
-
-END_GNOME_DECLS
+*/
+G_END_DECLS
#endif
diff -urN gnome-applets.orig/multiload/property-entries.c gnome-applets/multiload/property-entries.c
--- gnome-applets.orig/multiload/property-entries.c Fri Jan 28 16:20:26 2000
+++ gnome-applets/multiload/property-entries.c Fri Dec 21 21:50:28 2001
@@ -91,7 +91,7 @@
cb_data->value = &(temp_values [i]);
cb_data->object = object;
- gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
+ g_signal_connect (G_OBJECT (adjustment), "value_changed",
_property_entry_adjustment_changed_cb,
cb_data);
diff -urN gnome-applets.orig/multiload/property-entries.h gnome-applets/multiload/property-entries.h
--- gnome-applets.orig/multiload/property-entries.h Mon Dec 28 09:58:42 1998
+++ gnome-applets/multiload/property-entries.h Fri Dec 21 21:50:28 2001
@@ -26,7 +26,7 @@
#include <config.h>
#include <gnome.h>
-BEGIN_GNOME_DECLS
+G_BEGIN_DECLS
/* Adjustment block. */
GtkWidget *
@@ -36,6 +36,6 @@
gint *table_pos, const gchar *texts [],
glong *data_ptr, glong *values);
-END_GNOME_DECLS
+G_END_DECLS
#endif
diff -urN gnome-applets.orig/multiload/swapload.c gnome-applets/multiload/swapload.c
--- gnome-applets.orig/multiload/swapload.c Fri May 12 19:21:30 2000
+++ gnome-applets/multiload/swapload.c Fri Dec 21 21:50:28 2001
@@ -3,11 +3,13 @@
*
* Authors: Tim P. Gerla
* Martin Baulig
+ * Todd Kulesza
*
* With code from wmload.c, v0.9.2, apparently by Ryan Land, rland bc1 com
*
*/
+#include <config.h>
#include <stdio.h>
#include <config.h>
#include <sys/stat.h>
@@ -16,19 +18,29 @@
#include <dirent.h>
#include <string.h>
#include <time.h>
-#include <config.h>
#include <gnome.h>
-#include <gdk/gdkx.h>
-#include <applet-widget.h>
+#include <panel-applet.h>
+
+#include <gtk/gtk.h>
+#include <libgnomeui/libgnomeui.h>
+#include <libgnome/libgnome.h>
#include <libgnomeui/gnome-window-icon.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libart_lgpl/libart.h>
+#include <bonobo/bonobo-shlib-factory.h>
#include "global.h"
static void
-about_cb (AppletWidget *widget, gpointer data)
+about_cb (BonoboUIComponent *uic, gpointer data, const gchar *name)
{
static GtkWidget *about = NULL;
- const gchar *authors[8];
+ static const gchar *authors[] =
+ {
+ "Martin Baulig <martin home-of-linux org>",
+ "Todd Kulesza <fflewddur dropline net>\n",
+ NULL
+ };
if (about != NULL)
{
@@ -37,88 +49,82 @@
return;
}
- authors[0] = "Martin Baulig <martin home-of-linux org>";
- authors[1] = NULL;
-
about = gnome_about_new
(_("Swap Load Applet"), VERSION,
- "(C) 1999",
- authors,
+ "(C) 1999, 2001",
_("Released under the GNU general public license.\n\n"
- "Swap Load Meter Applet."),
+ "Swap Load Indicator."),
+ authors,
+ NULL,
+ NULL,
NULL);
- gnome_window_icon_set_from_file (GTK_WINDOW (about),
- GNOME_ICONDIR"/gnome-mem.png");
- gtk_signal_connect (GTK_OBJECT (about), "destroy",
- GTK_SIGNAL_FUNC (gtk_widget_destroyed), &about);
+ g_signal_connect (G_OBJECT (about), "destroy",
+ G_CALLBACK (gtk_widget_destroyed), &about);
gtk_widget_show (about);
}
+static const gchar *swap_texts [2] = {
+ N_("Used"), N_("Free")
+};
+
+static const gchar *swap_color_defs [4] = {
+ "#cfff5fff5fff", "#00008fff0000"
+};
+
+static const gchar swapload_menu_xml [] =
+ "<popup name=\"button3\">\n"
+/* " <menuitem name=\"Properties Item\" verb=\"SwapLoadProperties\" _label=\"Properties ...\"\n"
+ " pixtype=\"stock\" pixname=\"gtk-properties\"/>\n" */
+ " <menuitem name=\"Procman Item\" verb=\"SwapLoadRunProcman\" _label=\"Run Procman ...\"\n"
+ " pixtype=\"stock\" pixname=\"gnome-stock-run\"/>\n"
+ " <menuitem name=\"Help Item\" verb=\"SwapLoadHelp\" _label=\"Help\"\n"
+ " pixtype=\"stock\" pixname=\"gtk-help\"/>\n"
+ " <menuitem name=\"About Item\" verb=\"SwapLoadAbout\" _label=\"About ...\"\n"
+ " pixtype=\"stock\" pixname=\"gnome-stock-about\"/>\n"
+ "</popup>\n";
+
+static const BonoboUIVerb swapload_menu_verbs [] = {
+/* BONOBO_UI_VERB ("SwapLoadProperties", NULL), */
+ BONOBO_UI_VERB ("SwapLoadRunProcman", start_procman_cb),
+ BONOBO_UI_VERB_DATA ("SwapLoadHelp", multiload_help_cb, "index.html#SWAPLOAD-PROPERTIES"),
+ BONOBO_UI_VERB ("SwapLoadAbout", about_cb),
+
+ BONOBO_UI_VERB_END
+};
+
/* start a new instance of the swapload applet */
-GtkWidget *
-make_swapload_applet (const gchar *goad_id)
+gboolean
+swapload_applet_new(PanelApplet *applet)
{
- GtkWidget *applet;
LoadGraphProperties *prop_data;
LoadGraph *g;
-
- /* create a new applet_widget */
- applet = applet_widget_new (goad_id);
- /* in the rare case that the communication with the panel
- failed, error out */
- if (!applet)
- g_error (_("Can't create applet!\n"));
-
+
+ multiload_properties.swapload.n = 2;
+ multiload_properties.swapload.name = "swapload";
+#ifdef ENABLE_NLS
+ {
+ int i;
+ for (i=0;i<2;i++) swap_texts[i]=_(swap_texts[i]);
+ }
+#endif
+ multiload_properties.swapload.texts = swap_texts;
+ multiload_properties.swapload.color_defs = swap_color_defs;
+ multiload_properties.swapload.adj_data [0] = 500;
+ multiload_properties.swapload.adj_data [1] = 40;
+
prop_data = g_memdup (&multiload_properties.swapload,
sizeof (LoadGraphProperties));
- g = load_graph_new (APPLET_WIDGET (applet), 2, N_("Swap Load"),
+ g = load_graph_new (applet, 2, N_("Swap Load"),
&multiload_properties.swapload, prop_data,
multiload_properties.swapload.adj_data[0],
- multiload_properties.swapload.adj_data[1], GetSwap,
- "index.html#SWAPLOAD-PROPERTIES");
-
- applet_widget_add (APPLET_WIDGET(applet), g->main_widget);
- gtk_widget_show (applet);
-
- load_graph_start (g);
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "properties",
- GNOME_STOCK_MENU_PROP,
- _("Default Properties..."),
- multiload_properties_cb,
- g);
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "local_properties",
- GNOME_STOCK_MENU_PROP,
- _("Properties..."),
- multiload_local_properties_cb,
- g);
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "run_gtop",
- GNOME_STOCK_MENU_INDEX,
- _("Run gtop..."),
- start_gtop_cb, NULL);
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "help",
- GNOME_STOCK_PIXMAP_HELP,
- _("Help"),
- multiload_help_cb,
- "swapload_applet");
-
- applet_widget_register_stock_callback (APPLET_WIDGET(applet),
- "about",
- GNOME_STOCK_MENU_ABOUT,
- _("About..."),
- about_cb, NULL);
-
- applet_widget_set_tooltip(APPLET_WIDGET(applet), _("Swap Load"));
-
- return applet;
+ multiload_properties.swapload.adj_data[1], GetSwap);
+
+ panel_applet_setup_menu (PANEL_APPLET (g->applet), swapload_menu_xml, swapload_menu_verbs, NULL);
+
+ load_graph_start(g);
+
+ return TRUE;
}
diff -urN gnome-applets.orig/multiload/swapload_applet.desktop.in gnome-applets/multiload/swapload_applet.desktop.in
--- gnome-applets.orig/multiload/swapload_applet.desktop.in Wed Jan 24 21:37:42 2001
+++ gnome-applets/multiload/swapload_applet.desktop.in Wed Dec 31 19:00:00 1969
@@ -1,7 +0,0 @@
-[Desktop Entry]
-_Name=SwapLoad
-_Comment=Swap Load Meter
-Exec=multiload_applet --activate-goad-server=multiload_swapload_applet
-Icon=
-Terminal=0
-Type=Application
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]