[Xfce4-commits] [apps/xfce4-taskmanager] 03/03: Added the process tree to the settings.

noreply at xfce.org noreply at xfce.org
Wed Dec 3 23:28:14 CET 2014


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

peter pushed a commit to branch peter/tree-model
in repository apps/xfce4-taskmanager.

commit dbd10ae65593664809d66d8675480a26a2ce1033
Author: Peter de Ridder <peter at xfce.org>
Date:   Sat Mar 15 00:00:30 2014 +0100

    Added the process tree to the settings.
---
 src/process-tree-view.c |   11 +++++++++--
 src/settings-dialog.c   |    1 +
 src/settings-dialog.ui  |   16 +++++++++++++++-
 src/settings.c          |    3 +++
 4 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/src/process-tree-view.c b/src/process-tree-view.c
index 298e17d..53c8a33 100644
--- a/src/process-tree-view.c
+++ b/src/process-tree-view.c
@@ -86,6 +86,7 @@ xtm_process_tree_view_init (XtmProcessTreeView *treeview)
 	GtkCellRenderer *cell_text, *cell_right_aligned;
 	GtkTreeViewColumn *column;
 	gboolean visible;
+	gboolean tree;
 
 	treeview->settings = xtm_settings_get_default ();
 	g_signal_connect (treeview->settings, "notify", G_CALLBACK (settings_changed), treeview);
@@ -94,7 +95,7 @@ xtm_process_tree_view_init (XtmProcessTreeView *treeview)
 		gchar *uid_name;
 		get_owner_uid (&treeview->owner_uid, &uid_name);
 		g_free (uid_name);
-		g_object_get (treeview->settings, "show-all-processes", &treeview->show_all_processes_cached, NULL);
+		g_object_get (treeview->settings, "show-all-processes", &treeview->show_all_processes_cached, "process-tree", &tree, NULL);
 	}
 
 	/* Create tree view model */
@@ -111,7 +112,7 @@ xtm_process_tree_view_init (XtmProcessTreeView *treeview)
 
 	treeview->model_tree = xtm_process_tree_model_new (GTK_TREE_MODEL (treeview->model_filter));
 
-	g_object_set (treeview, "search-column", XTM_PTV_COLUMN_COMMAND, "model", treeview->model_tree, NULL);
+	g_object_set (treeview, "search-column", XTM_PTV_COLUMN_COMMAND, "model", tree ? treeview->model_tree : treeview->model_filter, NULL);
 
 	treeview->cmd_filter = NULL;
 
@@ -701,6 +702,12 @@ settings_changed (GObject *object, GParamSpec *pspec, XtmProcessTreeView *treevi
 		g_object_get (object, pspec->name, &treeview->show_all_processes_cached, NULL);
 		gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (treeview->model_filter));
 	}
+	else if (!g_strcmp0 (pspec->name, "process-tree"))
+	{
+		gboolean tree;
+		g_object_get (object, pspec->name, &tree, NULL);
+		gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), tree ? treeview->model_tree : treeview->model_filter);
+	}
 }
 
 
diff --git a/src/settings-dialog.c b/src/settings-dialog.c
index b191430..5b5b9d4 100644
--- a/src/settings-dialog.c
+++ b/src/settings-dialog.c
@@ -108,6 +108,7 @@ xtm_settings_dialog_init (XtmSettingsDialog *dialog)
 	builder_bind_toggle_button (builder, "button-monitor-paint-box", dialog->settings, "monitor-paint-box");
 	builder_bind_toggle_button (builder, "button-prompt-terminate-task", dialog->settings, "prompt-terminate-task");
 	builder_bind_toggle_button (builder, "button-show-status-icon", dialog->settings, "show-status-icon");
+	builder_bind_toggle_button (builder, "button-process-tree", dialog->settings, "process-tree");
 
 	{
 		guint n;
diff --git a/src/settings-dialog.ui b/src/settings-dialog.ui
index 4c84edc..64f10b8 100644
--- a/src/settings-dialog.ui
+++ b/src/settings-dialog.ui
@@ -101,6 +101,20 @@
                                   </packing>
                                 </child>
                                 <child>
+                                  <object class="GtkCheckButton" id="button-process-tree">
+                                    <property name="label" translatable="yes">Show processes as tree</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</property>
+                                    <property name="draw_indicator">True</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">4</property>
+                                  </packing>
+                                </child>
+                                <child>
                                   <object class="GtkHBox" id="hbox-toolbar-style">
                                     <property name="visible">True</property>
                                     <property name="spacing">6</property>
@@ -122,7 +136,7 @@
                                   <packing>
                                     <property name="expand">False</property>
                                     <property name="fill">False</property>
-                                    <property name="position">4</property>
+                                    <property name="position">5</property>
                                   </packing>
                                 </child>
                               </object>
diff --git a/src/settings.c b/src/settings.c
index 8ad5837..8d5e550 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -54,6 +54,7 @@ enum
 	PROP_SORT_TYPE,
 	PROP_WINDOW_WIDTH,
 	PROP_WINDOW_HEIGHT,
+	PROP_PROCESS_TREE,
 	N_PROPS,
 };
 typedef struct _XtmSettingsClass XtmSettingsClass;
@@ -129,6 +130,8 @@ xtm_settings_class_init (XtmSettingsClass *klass)
 		g_param_spec_int ("window-width", "WindowWidth", "Window width", -1, G_MAXINT, -1, G_PARAM_READWRITE));
 	g_object_class_install_property (class, PROP_WINDOW_HEIGHT,
 		g_param_spec_int ("window-height", "WindowHeight", "Window height", -1, G_MAXINT, -1, G_PARAM_READWRITE));
+	g_object_class_install_property (class, PROP_PROCESS_TREE,
+		g_param_spec_boolean ("process-tree", "ProcessTreeView", "Process tree", FALSE, G_PARAM_READWRITE));
 }
 
 static void

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


More information about the Xfce4-commits mailing list