[Xfce4-commits] [apps/xfce4-taskmanager] 01/01: Move legend from tooltip to hide-able statusbar (Bug #14131)

noreply at xfce.org noreply at xfce.org
Wed Apr 24 22:22:53 CEST 2019


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-taskmanager.

commit a18b8bd3c357af82fd68e1e11a046d7727b02c51
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Wed Apr 24 22:22:13 2019 +0200

    Move legend from tooltip to hide-able statusbar (Bug #14131)
---
 src/process-window-gtk3.ui | 59 +++++++++++++++++++++++++++++++++++++++++++++-
 src/process-window.c       | 31 +++++++++++++++++-------
 src/settings-tool-button.c |  4 ++++
 src/settings.c             |  3 +++
 4 files changed, 87 insertions(+), 10 deletions(-)

diff --git a/src/process-window-gtk3.ui b/src/process-window-gtk3.ui
index 2ecaf82..ca99cf5 100644
--- a/src/process-window-gtk3.ui
+++ b/src/process-window-gtk3.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.22.1 -->
 <interface>
   <requires lib="gtk+" version="3.0"/>
   <object class="GtkWindow" id="process-window">
@@ -9,6 +9,9 @@
     <property name="default_height">465</property>
     <property name="icon_name">utilities-system-monitor</property>
     <child>
+      <placeholder/>
+    </child>
+    <child>
       <object class="GtkBox" id="process-vbox">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
@@ -206,6 +209,60 @@
                     <property name="position">0</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkBox" id="legend">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">end</property>
+                    <property name="margin_right">6</property>
+                    <property name="margin_bottom">6</property>
+                    <property name="spacing">18</property>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes"><span foreground='#000000' background='#aed581'>    </span> Starting task</property>
+                        <property name="use_markup">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes"><span foreground='#000000' background='#fff176'>    </span> Changing task</property>
+                        <property name="use_markup">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes"><span foreground='#000000' background='#e57373'>    </span> Terminating task</property>
+                        <property name="use_markup">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
               </object>
               <packing>
                 <property name="resize">True</property>
diff --git a/src/process-window.c b/src/process-window.c
index c93ac3d..2dd7ca5 100644
--- a/src/process-window.c
+++ b/src/process-window.c
@@ -213,13 +213,24 @@ xtm_process_window_class_init (XtmProcessWindowClass *klass)
 }
 
 static void
+xtm_show_legend (XtmProcessWindow *window)
+{
+	gboolean show_legend;
+
+	g_object_get (window->settings,
+				  "show-legend", &show_legend,
+				  NULL);
+	gtk_widget_set_visible (GTK_WIDGET (gtk_builder_get_object (window->builder, "legend")), show_legend);
+}
+
+static void
 xtm_process_window_init (XtmProcessWindow *window)
 {
 	GtkWidget *button;
 	GtkWidget *icon;
 	GtkToolItem *xwininfo;
 	gint width, height;
-	gchar *markup;
+	gboolean show_legend;
 
 	window->settings = xtm_settings_get_default ();
 
@@ -243,6 +254,8 @@ xtm_process_window_init (XtmProcessWindow *window)
 
 	window->settings_button = xtm_settings_tool_button_new ();
 	gtk_toolbar_insert (GTK_TOOLBAR (window->toolbar), GTK_TOOL_ITEM (window->settings_button), 1);
+	g_signal_connect_swapped (window->settings, "notify::show-legend", G_CALLBACK (xtm_show_legend), window);
+	g_object_notify (G_OBJECT (window->settings), "show-legend");
 
 	icon = gtk_image_new_from_icon_name ("xc_crosshair", GTK_ICON_SIZE_LARGE_TOOLBAR);
 	xwininfo = gtk_tool_button_new (icon, _("Identify Window"));
@@ -312,22 +325,19 @@ xtm_process_window_init (XtmProcessWindow *window)
 
 	window->treeview = xtm_process_tree_view_new ();
 	gtk_widget_show (window->treeview);
-	markup = g_strdup_printf (_("<span foreground='#000000' background='#aed581'>    </span> Starting task\n"
-								"<span foreground='#000000' background='#fff176'>    </span> Changing task\n"
-								"<span foreground='#000000' background='#e57373'>    </span> Terminating task"));
-	gtk_widget_set_tooltip_markup (GTK_WIDGET (gtk_builder_get_object (window->builder, "scrolledwindow")), markup);
-	g_free (markup);
 	gtk_container_add (GTK_CONTAINER (gtk_builder_get_object (window->builder, "scrolledwindow")), window->treeview);
 
+	g_object_get (window->settings,
+				  "show-legend", &show_legend,
+				  NULL);
+	gtk_widget_set_visible (GTK_WIDGET (gtk_builder_get_object (window->builder, "legend")), show_legend);
+
 	window->filter_entry = GTK_WIDGET(gtk_builder_get_object (window->builder, "filter-entry"));
 	g_signal_connect (G_OBJECT(window->filter_entry), "icon-press", G_CALLBACK(filter_entry_icon_pressed_cb), NULL);
 	g_signal_connect (G_OBJECT(window->filter_entry), "changed", G_CALLBACK(filter_entry_keyrelease_handler), window->treeview);
 	gtk_widget_set_tooltip_text (window->filter_entry, _("Filter on process name"));
 
 	gtk_widget_grab_focus (GTK_WIDGET (window->filter_entry));
-
-	g_object_unref (window->builder);
-	window->builder = NULL;
 }
 
 static void
@@ -349,6 +359,9 @@ xtm_process_window_finalize (GObject *object)
 
 	if (XTM_IS_SETTINGS (window->settings))
 		g_object_unref (window->settings);
+
+	g_object_unref (window->builder);
+	window->builder = NULL;
 }
 
 /**
diff --git a/src/settings-tool-button.c b/src/settings-tool-button.c
index 274029a..e5e265c 100644
--- a/src/settings-tool-button.c
+++ b/src/settings-tool-button.c
@@ -181,6 +181,10 @@ construct_menu (void)
 	menu_append_item (GTK_MENU (menu), _("CPU"), "column-cpu", settings);
 	menu_append_item (GTK_MENU (menu), _("Priority"), "column-priority", settings);
 
+	mi = gtk_separator_menu_item_new ();
+	gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
+	menu_append_item (GTK_MENU (menu), _("Show Legend"), "show-legend", settings);
+
 	gtk_widget_show_all (menu);
 
 	return menu;
diff --git a/src/settings.c b/src/settings.c
index 4fbf99e..8a01ff6 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -33,6 +33,7 @@
 enum
 {
 	PROP_SHOW_ALL_PROCESSES = 1,
+	PROP_SHOW_LEGEND,
 	PROP_MORE_PRECISION,
 	PROP_FULL_COMMAND_LINE,
 	PROP_SHOW_STATUS_ICON,
@@ -89,6 +90,8 @@ xtm_settings_class_init (XtmSettingsClass *klass)
 	class->set_property = xtm_settings_set_property;
 	g_object_class_install_property (class, PROP_SHOW_ALL_PROCESSES,
 		g_param_spec_boolean ("show-all-processes", "ShowAllProcesses", "Show all processes", FALSE, G_PARAM_READWRITE));
+	g_object_class_install_property (class, PROP_SHOW_LEGEND,
+		g_param_spec_boolean ("show-legend", "ShowLegend", "Show legend", TRUE, G_PARAM_READWRITE));
 	g_object_class_install_property (class, PROP_MORE_PRECISION,
 		g_param_spec_boolean ("more-precision", "MorePrecision", "More precision", FALSE, G_PARAM_READWRITE));
 	g_object_class_install_property (class, PROP_FULL_COMMAND_LINE,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list