[gnome-system-monitor] dialog: use short process name instead of full



commit 9f65cede4b231f255fe574e909b201289769a01b
Author: Ognjen Galic <smclt30p gmail com>
Date:   Thu Mar 15 12:54:41 2018 +0100

    dialog: use short process name instead of full
    
    When there is a long process name, the name of the
    process in the kill dialog is show in full. This is a problem
    because long process names (such as google chrome) cause the dialog
    to extend all the way across the room.
    
    This patch fixes that by just displaying the short process name
    without the command line parameters.
    
    Signed-off-by: Ognjen Galic <smclt30p gmail com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788066

 src/procdialogs.cpp |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/procdialogs.cpp b/src/procdialogs.cpp
index 5c70a58..e6017ba 100644
--- a/src/procdialogs.cpp
+++ b/src/procdialogs.cpp
@@ -72,23 +72,27 @@ procdialog_create_kill_dialog (GsmApplication *app, int signal)
         // get the last selected row
         gtk_tree_selection_selected_foreach (app->selection, get_last_selected,
                                          &selected_process);
+
+       std::string *process_name = &selected_process->name;
+       std::string short_process_name = process_name->substr(0, process_name->find(" "));
+
         switch (signal) {
             case SIGKILL:
                 /*xgettext: primary alert message for killing single process*/
                 primary = g_strdup_printf (_("Are you sure you want to kill the selected process “%s” (PID: 
%u)?"),
-                                           selected_process->name.c_str(),
+                                           short_process_name.c_str(),
                                            selected_process->pid);
                 break;
             case SIGTERM:
                 /*xgettext: primary alert message for ending single process*/
                 primary = g_strdup_printf (_("Are you sure you want to end the selected process “%s” (PID: 
%u)?"),
-                                           selected_process->name.c_str(),
+                                           short_process_name.c_str(),
                                            selected_process->pid);
                 break;
             default: // SIGSTOP
                 /*xgettext: primary alert message for stopping single process*/
                 primary = g_strdup_printf (_("Are you sure you want to stop the selected process “%s” (PID: 
%u)?"),
-                                           selected_process->name.c_str(),
+                                           short_process_name.c_str(),
                                            selected_process->pid);
                 break;
         }


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