[gnome-control-center/wip/hadess/fix-ram-size: 16/17] info: Split code that fetches RAM amount




commit a079eba2a7c457628a4287738c18e9c657c2bd63
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Jan 25 22:52:19 2022 +0100

    info: Split code that fetches RAM amount

 panels/info-overview/cc-info-overview-panel.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/panels/info-overview/cc-info-overview-panel.c b/panels/info-overview/cc-info-overview-panel.c
index 95c616c2e..88aea9900 100644
--- a/panels/info-overview/cc-info-overview-panel.c
+++ b/panels/info-overview/cc-info-overview-panel.c
@@ -723,11 +723,20 @@ get_windowing_system (void)
   return C_("Windowing system (Wayland, X11, or Unknown)", "Unknown");
 }
 
+static guint64
+get_ram_size (void)
+{
+  glibtop_mem mem;
+
+  glibtop_get_mem (&mem);
+  return mem.total;
+}
+
 static void
 info_overview_panel_setup_overview (CcInfoOverviewPanel *self)
 {
   g_autofree gchar *gnome_version = NULL;
-  glibtop_mem mem;
+  guint64 ram_size;
   const glibtop_sysinfo *info;
   g_autofree char *memory_text = NULL;
   g_autofree char *cpu_text = NULL;
@@ -742,8 +751,8 @@ info_overview_panel_setup_overview (CcInfoOverviewPanel *self)
 
   get_hardware_model (self);
 
-  glibtop_get_mem (&mem);
-  memory_text = g_format_size_full (mem.total, G_FORMAT_SIZE_IEC_UNITS);
+  ram_size = get_ram_size ();
+  memory_text = g_format_size_full (ram_size, G_FORMAT_SIZE_IEC_UNITS);
   cc_list_row_set_secondary_label (self->memory_row, memory_text);
 
   info = glibtop_get_sysinfo ();


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