From 2c769d13c24ec744c1487d3fc517137230fabe5b Mon Sep 17 00:00:00 2001 From: Simon Steinbeiss Date: Mon, 18 Jan 2021 12:05:07 +0100 Subject: [PATCH] Ellipsize memory and swap labels (Fixes #32) Also show the full values in a tooltip. (cherry picked from commit 7005713f906715c4e960796ad135081c59013d75) --- src/process-statusbar.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/process-statusbar.c b/src/process-statusbar.c index 630af86..a2fd566 100644 --- a/src/process-statusbar.c +++ b/src/process-statusbar.c @@ -92,9 +92,11 @@ xtm_process_statusbar_init (XtmProcessStatusbar *statusbar) gtk_box_pack_start (GTK_BOX (hbox_cpu), statusbar->label_num_processes, TRUE, FALSE, 0); statusbar->label_memory = gtk_label_new (NULL); + gtk_label_set_ellipsize (GTK_LABEL (statusbar->label_memory), PANGO_ELLIPSIZE_END); gtk_box_pack_start (GTK_BOX (hbox_mem), statusbar->label_memory, TRUE, FALSE, 0); statusbar->label_swap = gtk_label_new (NULL); + gtk_label_set_ellipsize (GTK_LABEL (statusbar->label_swap), PANGO_ELLIPSIZE_END); gtk_box_pack_start (GTK_BOX (hbox_mem), statusbar->label_swap, TRUE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), hbox_cpu, TRUE, TRUE, 0); @@ -146,6 +148,7 @@ xtm_process_statusbar_set_property (GObject *object, guint property_id, const GV g_strlcpy(statusbar->memory, g_value_get_string (value), sizeof(statusbar->memory)); text = g_strdup_printf (_("Memory: %s"), statusbar->memory); gtk_label_set_text (GTK_LABEL (statusbar->label_memory), text); + gtk_widget_set_tooltip_text (statusbar->label_memory, text); gdk_rgba_parse (&color, "#cb386c"); gtk_widget_override_color (statusbar->label_memory, GTK_STATE_NORMAL, &color); g_free (text); @@ -155,6 +158,7 @@ xtm_process_statusbar_set_property (GObject *object, guint property_id, const GV g_strlcpy(statusbar->swap, g_value_get_string (value), sizeof(statusbar->swap)); text = g_strdup_printf (_("Swap: %s"), statusbar->swap); gtk_label_set_text (GTK_LABEL (statusbar->label_swap), text); + gtk_widget_set_tooltip_text (statusbar->label_swap, text); g_free (text); break;