[gnome-control-center] info: add memory info
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] info: add memory info
- Date: Tue, 11 Jan 2011 00:45:51 +0000 (UTC)
commit 176e072b591e7728253a79bb90099c7615c0733e
Author: William Jon McCann <jmccann redhat com>
Date: Mon Jan 10 17:56:52 2011 -0500
info: add memory info
configure.ac | 2 ++
panels/info/Makefile.am | 3 ++-
panels/info/cc-info-panel.c | 14 +++++++++++++-
3 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ddce855..f22a4cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -115,6 +115,8 @@ AC_SUBST(GTK_ENGINE_DIR)
PKG_CHECK_MODULES(GLIB, glib-2.0)
+PKG_CHECK_MODULES(LIBGTOP, libgtop-2.0)
+
PKG_CHECK_MODULES(POLKIT, polkit-gobject-1 >= 0.97)
PKG_CHECK_MODULES(CHEESE, gstreamer-0.10 cheese-gtk >= 2.29.90, have_cheese=yes, have_cheese=no)
diff --git a/panels/info/Makefile.am b/panels/info/Makefile.am
index 7877d0e..3f21346 100644
--- a/panels/info/Makefile.am
+++ b/panels/info/Makefile.am
@@ -1,5 +1,6 @@
INCLUDES = \
$(PANEL_CFLAGS) \
+ $(LIBGTOP_CFLAGS) \
$(GNOMECC_CAPPLETS_CFLAGS) \
-DGNOMECC_UI_DIR="\"$(uidir)\"" \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
@@ -15,7 +16,7 @@ libinfo_la_SOURCES = \
cc-info-panel.c \
cc-info-panel.h
-libinfo_la_LIBADD = $(PANEL_LIBS) $(CAPPLET_LIBS)
+libinfo_la_LIBADD = $(PANEL_LIBS) $(CAPPLET_LIBS) $(LIBGTOP_LIBS)
libinfo_la_LDFLAGS = $(PANEL_LDFLAGS)
uidir = $(pkgdatadir)/ui
diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c
index aba746a..2f5b1f1 100644
--- a/panels/info/cc-info-panel.c
+++ b/panels/info/cc-info-panel.c
@@ -21,6 +21,11 @@
#include "cc-info-panel.h"
+#include <glibtop/fsusage.h>
+#include <glibtop/mountlist.h>
+#include <glibtop/mem.h>
+#include <glibtop/sysinfo.h>
+
#define WID(b, w) (GtkWidget *) gtk_builder_get_object (b, w)
G_DEFINE_DYNAMIC_TYPE (CcInfoPanel, cc_info_panel, CC_TYPE_PANEL)
@@ -226,6 +231,8 @@ cc_info_panel_init (CcInfoPanel *self)
GError *error;
GtkWidget *widget;
gboolean res;
+ glibtop_mem mem;
+ char *text;
self->priv = INFO_PANEL_PRIVATE (self);
@@ -248,13 +255,18 @@ cc_info_panel_init (CcInfoPanel *self)
&self->priv->gnome_date);
if (res)
{
- char *text;
widget = WID (self->priv->builder, "version_label");
text = g_strdup_printf ("Version %s", self->priv->gnome_version);
gtk_label_set_text (GTK_LABEL (widget), text);
g_free (text);
}
+ glibtop_get_mem (&mem);
+ text = g_format_size_for_display (mem.total);
+ widget = WID (self->priv->builder, "memory_label");
+ gtk_label_set_text (GTK_LABEL (widget), text);
+ g_free (text);
+
widget = WID (self->priv->builder, "info_vbox");
gtk_widget_reparent (widget, (GtkWidget *) self);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]