update patch
This commit is contained in:
parent
731d6a250f
commit
4e803d85fa
788
session.patch
788
session.patch
@ -1,390 +1,6 @@
|
||||
--- gnome-system-monitor-2.23.5/src/proctable.cpp 2008-05-31 14:38:57.000000000 -0400
|
||||
+++ hacked/src/proctable.cpp 2008-08-07 14:20:34.000000000 -0400
|
||||
@@ -51,6 +51,7 @@
|
||||
#include "util.h"
|
||||
#include "interface.h"
|
||||
#include "selinux.h"
|
||||
+#include "gsm-session-manager.h"
|
||||
|
||||
|
||||
ProcInfo::UserMap ProcInfo::users;
|
||||
@@ -225,6 +226,7 @@
|
||||
N_("Memory"),
|
||||
/* xgettext: wchan, see ps(1) or top(1) */
|
||||
N_("Waiting Channel"),
|
||||
+ N_("Session"),
|
||||
NULL,
|
||||
"POINTER"
|
||||
};
|
||||
@@ -254,9 +256,12 @@
|
||||
G_TYPE_STRING, /* Arguments */
|
||||
G_TYPE_ULONG, /* Memory */
|
||||
G_TYPE_STRING, /* wchan */
|
||||
+ G_TYPE_UINT, /* Session state */
|
||||
+ G_TYPE_UINT, /* Restart style */
|
||||
GDK_TYPE_PIXBUF, /* Icon */
|
||||
G_TYPE_POINTER, /* ProcInfo */
|
||||
- G_TYPE_STRING /* Sexy tooltip */
|
||||
+ G_TYPE_STRING /* Sexy tooltip */
|
||||
+
|
||||
);
|
||||
|
||||
proctree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
||||
@@ -295,7 +300,6 @@
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (proctree), column);
|
||||
gtk_tree_view_set_expander_column (GTK_TREE_VIEW (proctree), column);
|
||||
|
||||
-
|
||||
for (i = COL_USER; i <= COL_WCHAN; i++) {
|
||||
|
||||
GtkCellRenderer *cell;
|
||||
@@ -385,6 +389,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ column = gtk_tree_view_column_new();
|
||||
+ gtk_tree_view_column_set_title(column, _(titles[COL_SESSION_STATE]));
|
||||
+ gtk_tree_view_column_set_resizable(column, FALSE);
|
||||
+ gtk_tree_view_column_set_reorderable(column, TRUE);
|
||||
+ gtk_tree_view_column_set_sort_column_id (column, COL_SESSION_STATE);
|
||||
+ gtk_tree_view_append_column(GTK_TREE_VIEW(proctree), column);
|
||||
+ cell_renderer = gtk_cell_renderer_pixbuf_new ();
|
||||
+ gtk_tree_view_column_pack_start (column, cell_renderer, FALSE);
|
||||
+ gtk_tree_view_column_set_cell_data_func(column, cell_renderer,
|
||||
+ &procman::session_state_cell_data_func,
|
||||
+ GUINT_TO_POINTER(COL_SESSION_STATE),
|
||||
+ NULL);
|
||||
+
|
||||
+ cell_renderer = gtk_cell_renderer_pixbuf_new ();
|
||||
+ gtk_tree_view_column_pack_start (column, cell_renderer, FALSE);
|
||||
+ gtk_tree_view_column_set_cell_data_func(column, cell_renderer,
|
||||
+ &procman::restart_style_cell_data_func,
|
||||
+ GUINT_TO_POINTER(COL_RESTART_STYLE),
|
||||
+ NULL);
|
||||
+
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), proctree);
|
||||
|
||||
procdata->tree = proctree;
|
||||
@@ -834,6 +858,59 @@
|
||||
update_info_mutable_cols(it->second);
|
||||
}
|
||||
|
||||
+static gboolean
|
||||
+clear_session_data (GtkTreeModel *model,
|
||||
+ GtkTreePath *path,
|
||||
+ GtkTreeIter *iter,
|
||||
+ gpointer data)
|
||||
+{
|
||||
+ gtk_tree_store_set (GTK_TREE_STORE (model),
|
||||
+ iter,
|
||||
+ COL_SESSION_STATE, 0,
|
||||
+ COL_RESTART_STYLE, 0,
|
||||
+ -1);
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+update_session_data (const char *obj_path,
|
||||
+ guint pid,
|
||||
+ guint status,
|
||||
+ guint restart_style_hint,
|
||||
+ gpointer data)
|
||||
+{
|
||||
+ GtkTreeModel *model = (GtkTreeModel*)data;
|
||||
+ GtkTreeIter iter;
|
||||
+ guint pid2;
|
||||
+
|
||||
+ gtk_tree_model_get_iter_first (model, &iter);
|
||||
+ do {
|
||||
+ gtk_tree_model_get (model, &iter, COL_PID, &pid2, -1);
|
||||
+ if (pid == pid2) {
|
||||
+ gtk_tree_store_set (GTK_TREE_STORE (model),
|
||||
+ &iter,
|
||||
+ COL_SESSION_STATE, status,
|
||||
+ COL_RESTART_STYLE, restart_style_hint + 1,
|
||||
+ -1);
|
||||
+ return;
|
||||
+ }
|
||||
+ } while (gtk_tree_model_iter_next (model, &iter));
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+add_session_data (ProcData * const procdata)
|
||||
+{
|
||||
+ GsmSessionManager *manager;
|
||||
+ GtkTreeModel *model;
|
||||
+
|
||||
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (procdata->tree));
|
||||
+ gtk_tree_model_foreach (model, clear_session_data, NULL);
|
||||
+
|
||||
+ manager = gsm_session_manager_get ();
|
||||
+ gsm_session_manager_foreach (manager, update_session_data, model);
|
||||
+ g_object_unref (manager);
|
||||
+}
|
||||
|
||||
void
|
||||
proctable_update_list (ProcData * const procdata)
|
||||
@@ -880,6 +957,7 @@
|
||||
procdata->cpu_total_time_last = cpu.total;
|
||||
|
||||
refresh_list (procdata, pid_list, proclist.number);
|
||||
+ add_session_data (procdata);
|
||||
|
||||
selection.restore(procdata->tree);
|
||||
|
||||
--- gnome-system-monitor-2.23.5/src/proctable.h 2008-05-24 17:58:27.000000000 -0400
|
||||
+++ hacked/src/proctable.h 2008-08-07 13:29:23.000000000 -0400
|
||||
@@ -43,6 +43,8 @@
|
||||
COL_ARGS,
|
||||
COL_MEM,
|
||||
COL_WCHAN,
|
||||
+ COL_SESSION_STATE,
|
||||
+ COL_RESTART_STYLE,
|
||||
COL_PIXBUF,
|
||||
COL_POINTER,
|
||||
COL_TOOLTIP,
|
||||
--- gnome-system-monitor-2.23.5/src/util.h 2008-07-21 12:18:47.000000000 -0400
|
||||
+++ hacked/src/util.h 2008-07-29 23:40:25.000000000 -0400
|
||||
@@ -94,6 +94,14 @@
|
||||
GtkTreeModel *model, GtkTreeIter *iter,
|
||||
gpointer user_data);
|
||||
|
||||
+ void session_state_cell_data_func(GtkTreeViewColumn *col, GtkCellRenderer *renderer,
|
||||
+ GtkTreeModel *model, GtkTreeIter *iter,
|
||||
+ gpointer user_data);
|
||||
+
|
||||
+ void restart_style_cell_data_func(GtkTreeViewColumn *col, GtkCellRenderer *renderer,
|
||||
+ GtkTreeModel *model, GtkTreeIter *iter,
|
||||
+ gpointer user_data);
|
||||
+
|
||||
template<typename T>
|
||||
void poison(T &t, char c)
|
||||
{
|
||||
--- gnome-system-monitor-2.23.5/src/util.cpp 2008-07-21 12:18:47.000000000 -0400
|
||||
+++ hacked/src/util.cpp 2008-08-07 13:36:43.000000000 -0400
|
||||
@@ -50,7 +50,81 @@
|
||||
return status;
|
||||
}
|
||||
|
||||
+typedef enum {
|
||||
+ GSM_CLIENT_RESTART_NEVER = 1,
|
||||
+ GSM_CLIENT_RESTART_IF_RUNNING,
|
||||
+ GSM_CLIENT_RESTART_ANYWAY,
|
||||
+ GSM_CLIENT_RESTART_IMMEDIATELY,
|
||||
+} GsmClientRestartStyle;
|
||||
|
||||
+static const char*
|
||||
+format_restart_style (guint state)
|
||||
+{
|
||||
+ const char *status;
|
||||
+
|
||||
+ switch (state)
|
||||
+ {
|
||||
+ case GSM_CLIENT_RESTART_IF_RUNNING:
|
||||
+ status = NULL;
|
||||
+ break;
|
||||
+
|
||||
+ case GSM_CLIENT_RESTART_ANYWAY:
|
||||
+ status = GTK_STOCK_PREFERENCES;
|
||||
+ break;
|
||||
+
|
||||
+ case GSM_CLIENT_RESTART_IMMEDIATELY:
|
||||
+ status = GTK_STOCK_REFRESH;
|
||||
+ break;
|
||||
+
|
||||
+ case GSM_CLIENT_RESTART_NEVER:
|
||||
+ status = GTK_STOCK_DELETE;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ status = NULL;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return status;
|
||||
+}
|
||||
+
|
||||
+typedef enum {
|
||||
+ GSM_CLIENT_UNREGISTERED = 0,
|
||||
+ GSM_CLIENT_REGISTERED,
|
||||
+ GSM_CLIENT_FINISHED,
|
||||
+ GSM_CLIENT_FAILED,
|
||||
+} GsmClientStatus;
|
||||
+
|
||||
+static const char*
|
||||
+format_session_state (guint state)
|
||||
+{
|
||||
+ const char *status;
|
||||
+
|
||||
+ switch (state)
|
||||
+ {
|
||||
+ case GSM_CLIENT_UNREGISTERED:
|
||||
+ status = NULL;
|
||||
+ break;
|
||||
+
|
||||
+ case GSM_CLIENT_REGISTERED:
|
||||
+ status = GTK_STOCK_EXECUTE;
|
||||
+ break;
|
||||
+
|
||||
+ case GSM_CLIENT_FINISHED:
|
||||
+ status = GTK_STOCK_QUIT;
|
||||
+ break;
|
||||
+
|
||||
+ case GSM_CLIENT_FAILED:
|
||||
+ status = GTK_STOCK_HELP;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ status = NULL;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return status;
|
||||
+}
|
||||
|
||||
static char *
|
||||
mnemonic_safe_process_name(const char *process_name)
|
||||
@@ -441,6 +515,58 @@
|
||||
g_object_set(renderer, "text", str, NULL);
|
||||
}
|
||||
|
||||
+ void restart_style_cell_data_func(GtkTreeViewColumn *, GtkCellRenderer *renderer,
|
||||
+ GtkTreeModel *model, GtkTreeIter *iter,
|
||||
+ gpointer user_data)
|
||||
+ {
|
||||
+ const guint index = GPOINTER_TO_UINT(user_data);
|
||||
+
|
||||
+ guint state;
|
||||
+ GValue value = { 0 };
|
||||
+
|
||||
+ gtk_tree_model_get_value(model, iter, index, &value);
|
||||
+
|
||||
+ switch (G_VALUE_TYPE(&value)) {
|
||||
+ case G_TYPE_UINT:
|
||||
+ state = g_value_get_uint(&value);
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ g_assert_not_reached();
|
||||
+ }
|
||||
+
|
||||
+ g_value_unset(&value);
|
||||
+
|
||||
+ const char *str = format_restart_style(state);
|
||||
+ g_object_set(renderer, "icon-name", str, NULL);
|
||||
+ }
|
||||
+
|
||||
+ void session_state_cell_data_func(GtkTreeViewColumn *, GtkCellRenderer *renderer,
|
||||
+ GtkTreeModel *model, GtkTreeIter *iter,
|
||||
+ gpointer user_data)
|
||||
+ {
|
||||
+ const guint index = GPOINTER_TO_UINT(user_data);
|
||||
+
|
||||
+ guint state;
|
||||
+ GValue value = { 0 };
|
||||
+
|
||||
+ gtk_tree_model_get_value(model, iter, index, &value);
|
||||
+
|
||||
+ switch (G_VALUE_TYPE(&value)) {
|
||||
+ case G_TYPE_UINT:
|
||||
+ state = g_value_get_uint(&value);
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ g_assert_not_reached();
|
||||
+ }
|
||||
+
|
||||
+ g_value_unset(&value);
|
||||
+
|
||||
+ const char *str = format_session_state(state);
|
||||
+ g_object_set(renderer, "icon-name", str, NULL);
|
||||
+ }
|
||||
+
|
||||
|
||||
template<>
|
||||
void tree_store_update<const char>(GtkTreeModel* model, GtkTreeIter* iter, int column, const char* new_value)
|
||||
--- /dev/null 2008-08-07 10:02:05.591005357 -0400
|
||||
+++ hacked/src/gsm-session-manager.h 2008-08-07 14:18:33.000000000 -0400
|
||||
@@ -0,0 +1,76 @@
|
||||
+/* gsm-session-manager.h - functions for monitoring the session
|
||||
+ *
|
||||
+ * Copyright (C) 2008 Red Hat, Inc
|
||||
+ * Author: Matthias Clasen
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2, or (at your option)
|
||||
+ * any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
+ * 02111-1307, USA.
|
||||
+ */
|
||||
+#ifndef GSM_SESSION_MANAGER_H
|
||||
+#define GSM_SESSION_MANAGER_H
|
||||
+
|
||||
+#include <glib-object.h>
|
||||
+
|
||||
+G_BEGIN_DECLS
|
||||
+
|
||||
+#define GSM_TYPE_SESSION_MANAGER (gsm_session_manager_get_type ())
|
||||
+#define GSM_SESSION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSM_TYPE_SESSION_MANAGER, GsmSessionManager))
|
||||
+#define GSM_SESSION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSM_TYPE_SESSION_MANAGER, GsmSessionManagerClass))
|
||||
+#define GSM_IS_SESSION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSM_TYPE_SESSION_MANAGER))
|
||||
+#define GSM_IS_SESSION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSM_TYPE_SESSION_MANAGER))
|
||||
+#define GSM_SESSION_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GSM_TYPE_SESSION_MANAGER, GsmSessionManagerClass))
|
||||
+
|
||||
+typedef struct _GsmSessionManager GsmSessionManager;
|
||||
+typedef struct _GsmSessionManagerClass GsmSessionManagerClass;
|
||||
+typedef struct _GsmSessionManagerPrivate GsmSessionManagerPrivate;
|
||||
+
|
||||
+struct _GsmSessionManager {
|
||||
+ GObject parent_instance;
|
||||
+
|
||||
+ GsmSessionManagerPrivate *priv;
|
||||
+};
|
||||
+
|
||||
+struct _GsmSessionManagerClass {
|
||||
+ GObjectClass parent_class;
|
||||
+
|
||||
+ /* signals */
|
||||
+ void (* client_added) (GsmSessionManager *manager,
|
||||
+ const char *obj_path);
|
||||
+ void (*client_removed) (GsmSessionManager *manager,
|
||||
+ const char *obj_path);
|
||||
+};
|
||||
+
|
||||
+typedef void (*GsmClientDetailsCallback) (const char *obj_path,
|
||||
+ guint pid,
|
||||
+ guint status,
|
||||
+ guint restart_style_hint,
|
||||
+ gpointer data);
|
||||
+
|
||||
+GType gsm_session_manager_get_type (void);
|
||||
+
|
||||
+GsmSessionManager *gsm_session_manager_new (void) G_GNUC_MALLOC;
|
||||
+GsmSessionManager *gsm_session_manager_get (void);
|
||||
+void gsm_session_manager_foreach (GsmSessionManager *manager,
|
||||
+ GsmClientDetailsCallback callbac,
|
||||
+ gpointer data);
|
||||
+gboolean gsm_session_manager_get_details (GsmSessionManager *manager,
|
||||
+ const char *obj_path,
|
||||
+ guint *pid,
|
||||
+ guint *status,
|
||||
+ guint *restart_style);
|
||||
+
|
||||
+G_END_DECLS
|
||||
+
|
||||
+#endif /* GSM_SESSION_MANAGER_H */
|
||||
--- /dev/null 2008-08-07 10:02:05.591005357 -0400
|
||||
+++ hacked/src/gsm-session-manager.c 2008-08-07 14:37:00.000000000 -0400
|
||||
diff -up /dev/null gnome-system-monitor-2.23.6/src/gsm-session-manager.c
|
||||
--- /dev/null 2008-08-13 11:36:43.974262811 -0400
|
||||
+++ gnome-system-monitor-2.23.6/src/gsm-session-manager.c 2008-08-13 17:23:15.000000000 -0400
|
||||
@@ -0,0 +1,528 @@
|
||||
+/* gsm-session-manager.h - functions for monitoring the session
|
||||
+ *
|
||||
@ -914,9 +530,90 @@
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
--- gnome-system-monitor-2.23.5/src/Makefile.am 2008-03-18 17:37:00.000000000 -0400
|
||||
+++ hacked/src/Makefile.am 2008-08-07 14:41:21.000000000 -0400
|
||||
@@ -33,7 +33,8 @@
|
||||
diff -up /dev/null gnome-system-monitor-2.23.6/src/gsm-session-manager.h
|
||||
--- /dev/null 2008-08-13 11:36:43.974262811 -0400
|
||||
+++ gnome-system-monitor-2.23.6/src/gsm-session-manager.h 2008-08-13 17:23:15.000000000 -0400
|
||||
@@ -0,0 +1,76 @@
|
||||
+/* gsm-session-manager.h - functions for monitoring the session
|
||||
+ *
|
||||
+ * Copyright (C) 2008 Red Hat, Inc
|
||||
+ * Author: Matthias Clasen
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2, or (at your option)
|
||||
+ * any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
+ * 02111-1307, USA.
|
||||
+ */
|
||||
+#ifndef GSM_SESSION_MANAGER_H
|
||||
+#define GSM_SESSION_MANAGER_H
|
||||
+
|
||||
+#include <glib-object.h>
|
||||
+
|
||||
+G_BEGIN_DECLS
|
||||
+
|
||||
+#define GSM_TYPE_SESSION_MANAGER (gsm_session_manager_get_type ())
|
||||
+#define GSM_SESSION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSM_TYPE_SESSION_MANAGER, GsmSessionManager))
|
||||
+#define GSM_SESSION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSM_TYPE_SESSION_MANAGER, GsmSessionManagerClass))
|
||||
+#define GSM_IS_SESSION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSM_TYPE_SESSION_MANAGER))
|
||||
+#define GSM_IS_SESSION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSM_TYPE_SESSION_MANAGER))
|
||||
+#define GSM_SESSION_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GSM_TYPE_SESSION_MANAGER, GsmSessionManagerClass))
|
||||
+
|
||||
+typedef struct _GsmSessionManager GsmSessionManager;
|
||||
+typedef struct _GsmSessionManagerClass GsmSessionManagerClass;
|
||||
+typedef struct _GsmSessionManagerPrivate GsmSessionManagerPrivate;
|
||||
+
|
||||
+struct _GsmSessionManager {
|
||||
+ GObject parent_instance;
|
||||
+
|
||||
+ GsmSessionManagerPrivate *priv;
|
||||
+};
|
||||
+
|
||||
+struct _GsmSessionManagerClass {
|
||||
+ GObjectClass parent_class;
|
||||
+
|
||||
+ /* signals */
|
||||
+ void (* client_added) (GsmSessionManager *manager,
|
||||
+ const char *obj_path);
|
||||
+ void (*client_removed) (GsmSessionManager *manager,
|
||||
+ const char *obj_path);
|
||||
+};
|
||||
+
|
||||
+typedef void (*GsmClientDetailsCallback) (const char *obj_path,
|
||||
+ guint pid,
|
||||
+ guint status,
|
||||
+ guint restart_style_hint,
|
||||
+ gpointer data);
|
||||
+
|
||||
+GType gsm_session_manager_get_type (void);
|
||||
+
|
||||
+GsmSessionManager *gsm_session_manager_new (void) G_GNUC_MALLOC;
|
||||
+GsmSessionManager *gsm_session_manager_get (void);
|
||||
+void gsm_session_manager_foreach (GsmSessionManager *manager,
|
||||
+ GsmClientDetailsCallback callbac,
|
||||
+ gpointer data);
|
||||
+gboolean gsm_session_manager_get_details (GsmSessionManager *manager,
|
||||
+ const char *obj_path,
|
||||
+ guint *pid,
|
||||
+ guint *status,
|
||||
+ guint *restart_style);
|
||||
+
|
||||
+G_END_DECLS
|
||||
+
|
||||
+#endif /* GSM_SESSION_MANAGER_H */
|
||||
diff -up gnome-system-monitor-2.23.6/src/Makefile.am.session gnome-system-monitor-2.23.6/src/Makefile.am
|
||||
--- gnome-system-monitor-2.23.6/src/Makefile.am.session 2008-08-13 17:23:15.000000000 -0400
|
||||
+++ gnome-system-monitor-2.23.6/src/Makefile.am 2008-08-13 17:24:35.000000000 -0400
|
||||
@@ -35,7 +35,8 @@ gnome_system_monitor_SOURCES = \
|
||||
gconf-keys.cpp gconf-keys.h \
|
||||
iconthemewrapper.cpp iconthemewrapper.h \
|
||||
e_date.c e_date.h \
|
||||
@ -924,5 +621,314 @@
|
||||
+ gsm_color_button.c gsm_color_button.h \
|
||||
+ gsm-session-manager.c gsm-session-manager.h
|
||||
|
||||
if HAVE_POLKIT
|
||||
gnome_system_monitor_SOURCES += gnome-system-monitor-mechanism-client-glue.h
|
||||
diff -up gnome-system-monitor-2.23.6/src/proctable.cpp.session gnome-system-monitor-2.23.6/src/proctable.cpp
|
||||
--- gnome-system-monitor-2.23.6/src/proctable.cpp.session 2008-05-31 14:38:57.000000000 -0400
|
||||
+++ gnome-system-monitor-2.23.6/src/proctable.cpp 2008-08-13 17:23:15.000000000 -0400
|
||||
@@ -51,6 +51,7 @@
|
||||
#include "util.h"
|
||||
#include "interface.h"
|
||||
#include "selinux.h"
|
||||
+#include "gsm-session-manager.h"
|
||||
|
||||
gnome_system_monitor_LDADD = @PROCMAN_LIBS@ libbacon.la
|
||||
|
||||
ProcInfo::UserMap ProcInfo::users;
|
||||
@@ -225,6 +226,7 @@ proctable_new (ProcData * const procdata
|
||||
N_("Memory"),
|
||||
/* xgettext: wchan, see ps(1) or top(1) */
|
||||
N_("Waiting Channel"),
|
||||
+ N_("Session"),
|
||||
NULL,
|
||||
"POINTER"
|
||||
};
|
||||
@@ -254,9 +256,12 @@ proctable_new (ProcData * const procdata
|
||||
G_TYPE_STRING, /* Arguments */
|
||||
G_TYPE_ULONG, /* Memory */
|
||||
G_TYPE_STRING, /* wchan */
|
||||
+ G_TYPE_UINT, /* Session state */
|
||||
+ G_TYPE_UINT, /* Restart style */
|
||||
GDK_TYPE_PIXBUF, /* Icon */
|
||||
G_TYPE_POINTER, /* ProcInfo */
|
||||
G_TYPE_STRING /* Sexy tooltip */
|
||||
+
|
||||
);
|
||||
|
||||
proctree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
||||
@@ -295,7 +300,6 @@ proctable_new (ProcData * const procdata
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (proctree), column);
|
||||
gtk_tree_view_set_expander_column (GTK_TREE_VIEW (proctree), column);
|
||||
|
||||
-
|
||||
for (i = COL_USER; i <= COL_WCHAN; i++) {
|
||||
|
||||
GtkCellRenderer *cell;
|
||||
@@ -385,6 +389,26 @@ proctable_new (ProcData * const procdata
|
||||
}
|
||||
}
|
||||
|
||||
+ column = gtk_tree_view_column_new();
|
||||
+ gtk_tree_view_column_set_title(column, _(titles[COL_SESSION_STATE]));
|
||||
+ gtk_tree_view_column_set_resizable(column, FALSE);
|
||||
+ gtk_tree_view_column_set_reorderable(column, TRUE);
|
||||
+ gtk_tree_view_column_set_sort_column_id (column, COL_SESSION_STATE);
|
||||
+ gtk_tree_view_append_column(GTK_TREE_VIEW(proctree), column);
|
||||
+ cell_renderer = gtk_cell_renderer_pixbuf_new ();
|
||||
+ gtk_tree_view_column_pack_start (column, cell_renderer, FALSE);
|
||||
+ gtk_tree_view_column_set_cell_data_func(column, cell_renderer,
|
||||
+ &procman::session_state_cell_data_func,
|
||||
+ GUINT_TO_POINTER(COL_SESSION_STATE),
|
||||
+ NULL);
|
||||
+
|
||||
+ cell_renderer = gtk_cell_renderer_pixbuf_new ();
|
||||
+ gtk_tree_view_column_pack_start (column, cell_renderer, FALSE);
|
||||
+ gtk_tree_view_column_set_cell_data_func(column, cell_renderer,
|
||||
+ &procman::restart_style_cell_data_func,
|
||||
+ GUINT_TO_POINTER(COL_RESTART_STYLE),
|
||||
+ NULL);
|
||||
+
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), proctree);
|
||||
|
||||
procdata->tree = proctree;
|
||||
@@ -834,6 +858,59 @@ refresh_list (ProcData *procdata, const
|
||||
update_info_mutable_cols(it->second);
|
||||
}
|
||||
|
||||
+static gboolean
|
||||
+clear_session_data (GtkTreeModel *model,
|
||||
+ GtkTreePath *path,
|
||||
+ GtkTreeIter *iter,
|
||||
+ gpointer data)
|
||||
+{
|
||||
+ gtk_tree_store_set (GTK_TREE_STORE (model),
|
||||
+ iter,
|
||||
+ COL_SESSION_STATE, 0,
|
||||
+ COL_RESTART_STYLE, 0,
|
||||
+ -1);
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+update_session_data (const char *obj_path,
|
||||
+ guint pid,
|
||||
+ guint status,
|
||||
+ guint restart_style_hint,
|
||||
+ gpointer data)
|
||||
+{
|
||||
+ GtkTreeModel *model = (GtkTreeModel*)data;
|
||||
+ GtkTreeIter iter;
|
||||
+ guint pid2;
|
||||
+
|
||||
+ gtk_tree_model_get_iter_first (model, &iter);
|
||||
+ do {
|
||||
+ gtk_tree_model_get (model, &iter, COL_PID, &pid2, -1);
|
||||
+ if (pid == pid2) {
|
||||
+ gtk_tree_store_set (GTK_TREE_STORE (model),
|
||||
+ &iter,
|
||||
+ COL_SESSION_STATE, status,
|
||||
+ COL_RESTART_STYLE, restart_style_hint + 1,
|
||||
+ -1);
|
||||
+ return;
|
||||
+ }
|
||||
+ } while (gtk_tree_model_iter_next (model, &iter));
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+add_session_data (ProcData * const procdata)
|
||||
+{
|
||||
+ GsmSessionManager *manager;
|
||||
+ GtkTreeModel *model;
|
||||
+
|
||||
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (procdata->tree));
|
||||
+ gtk_tree_model_foreach (model, clear_session_data, NULL);
|
||||
+
|
||||
+ manager = gsm_session_manager_get ();
|
||||
+ gsm_session_manager_foreach (manager, update_session_data, model);
|
||||
+ g_object_unref (manager);
|
||||
+}
|
||||
|
||||
void
|
||||
proctable_update_list (ProcData * const procdata)
|
||||
@@ -880,6 +957,7 @@ proctable_update_list (ProcData * const
|
||||
procdata->cpu_total_time_last = cpu.total;
|
||||
|
||||
refresh_list (procdata, pid_list, proclist.number);
|
||||
+ add_session_data (procdata);
|
||||
|
||||
selection.restore(procdata->tree);
|
||||
|
||||
diff -up gnome-system-monitor-2.23.6/src/proctable.h.session gnome-system-monitor-2.23.6/src/proctable.h
|
||||
--- gnome-system-monitor-2.23.6/src/proctable.h.session 2008-05-24 17:58:27.000000000 -0400
|
||||
+++ gnome-system-monitor-2.23.6/src/proctable.h 2008-08-13 17:23:15.000000000 -0400
|
||||
@@ -43,6 +43,8 @@ enum
|
||||
COL_ARGS,
|
||||
COL_MEM,
|
||||
COL_WCHAN,
|
||||
+ COL_SESSION_STATE,
|
||||
+ COL_RESTART_STYLE,
|
||||
COL_PIXBUF,
|
||||
COL_POINTER,
|
||||
COL_TOOLTIP,
|
||||
diff -up gnome-system-monitor-2.23.6/src/util.cpp.session gnome-system-monitor-2.23.6/src/util.cpp
|
||||
--- gnome-system-monitor-2.23.6/src/util.cpp.session 2008-07-21 12:18:47.000000000 -0400
|
||||
+++ gnome-system-monitor-2.23.6/src/util.cpp 2008-08-13 17:23:15.000000000 -0400
|
||||
@@ -50,7 +50,81 @@ format_process_state(guint state)
|
||||
return status;
|
||||
}
|
||||
|
||||
+typedef enum {
|
||||
+ GSM_CLIENT_RESTART_NEVER = 1,
|
||||
+ GSM_CLIENT_RESTART_IF_RUNNING,
|
||||
+ GSM_CLIENT_RESTART_ANYWAY,
|
||||
+ GSM_CLIENT_RESTART_IMMEDIATELY,
|
||||
+} GsmClientRestartStyle;
|
||||
|
||||
+static const char*
|
||||
+format_restart_style (guint state)
|
||||
+{
|
||||
+ const char *status;
|
||||
+
|
||||
+ switch (state)
|
||||
+ {
|
||||
+ case GSM_CLIENT_RESTART_IF_RUNNING:
|
||||
+ status = NULL;
|
||||
+ break;
|
||||
+
|
||||
+ case GSM_CLIENT_RESTART_ANYWAY:
|
||||
+ status = GTK_STOCK_PREFERENCES;
|
||||
+ break;
|
||||
+
|
||||
+ case GSM_CLIENT_RESTART_IMMEDIATELY:
|
||||
+ status = GTK_STOCK_REFRESH;
|
||||
+ break;
|
||||
+
|
||||
+ case GSM_CLIENT_RESTART_NEVER:
|
||||
+ status = GTK_STOCK_DELETE;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ status = NULL;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return status;
|
||||
+}
|
||||
+
|
||||
+typedef enum {
|
||||
+ GSM_CLIENT_UNREGISTERED = 0,
|
||||
+ GSM_CLIENT_REGISTERED,
|
||||
+ GSM_CLIENT_FINISHED,
|
||||
+ GSM_CLIENT_FAILED,
|
||||
+} GsmClientStatus;
|
||||
+
|
||||
+static const char*
|
||||
+format_session_state (guint state)
|
||||
+{
|
||||
+ const char *status;
|
||||
+
|
||||
+ switch (state)
|
||||
+ {
|
||||
+ case GSM_CLIENT_UNREGISTERED:
|
||||
+ status = NULL;
|
||||
+ break;
|
||||
+
|
||||
+ case GSM_CLIENT_REGISTERED:
|
||||
+ status = GTK_STOCK_EXECUTE;
|
||||
+ break;
|
||||
+
|
||||
+ case GSM_CLIENT_FINISHED:
|
||||
+ status = GTK_STOCK_QUIT;
|
||||
+ break;
|
||||
+
|
||||
+ case GSM_CLIENT_FAILED:
|
||||
+ status = GTK_STOCK_HELP;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ status = NULL;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return status;
|
||||
+}
|
||||
|
||||
static char *
|
||||
mnemonic_safe_process_name(const char *process_name)
|
||||
@@ -441,6 +515,58 @@ namespace procman
|
||||
g_object_set(renderer, "text", str, NULL);
|
||||
}
|
||||
|
||||
+ void restart_style_cell_data_func(GtkTreeViewColumn *, GtkCellRenderer *renderer,
|
||||
+ GtkTreeModel *model, GtkTreeIter *iter,
|
||||
+ gpointer user_data)
|
||||
+ {
|
||||
+ const guint index = GPOINTER_TO_UINT(user_data);
|
||||
+
|
||||
+ guint state;
|
||||
+ GValue value = { 0 };
|
||||
+
|
||||
+ gtk_tree_model_get_value(model, iter, index, &value);
|
||||
+
|
||||
+ switch (G_VALUE_TYPE(&value)) {
|
||||
+ case G_TYPE_UINT:
|
||||
+ state = g_value_get_uint(&value);
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ g_assert_not_reached();
|
||||
+ }
|
||||
+
|
||||
+ g_value_unset(&value);
|
||||
+
|
||||
+ const char *str = format_restart_style(state);
|
||||
+ g_object_set(renderer, "icon-name", str, NULL);
|
||||
+ }
|
||||
+
|
||||
+ void session_state_cell_data_func(GtkTreeViewColumn *, GtkCellRenderer *renderer,
|
||||
+ GtkTreeModel *model, GtkTreeIter *iter,
|
||||
+ gpointer user_data)
|
||||
+ {
|
||||
+ const guint index = GPOINTER_TO_UINT(user_data);
|
||||
+
|
||||
+ guint state;
|
||||
+ GValue value = { 0 };
|
||||
+
|
||||
+ gtk_tree_model_get_value(model, iter, index, &value);
|
||||
+
|
||||
+ switch (G_VALUE_TYPE(&value)) {
|
||||
+ case G_TYPE_UINT:
|
||||
+ state = g_value_get_uint(&value);
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ g_assert_not_reached();
|
||||
+ }
|
||||
+
|
||||
+ g_value_unset(&value);
|
||||
+
|
||||
+ const char *str = format_session_state(state);
|
||||
+ g_object_set(renderer, "icon-name", str, NULL);
|
||||
+ }
|
||||
+
|
||||
|
||||
template<>
|
||||
void tree_store_update<const char>(GtkTreeModel* model, GtkTreeIter* iter, int column, const char* new_value)
|
||||
diff -up gnome-system-monitor-2.23.6/src/util.h.session gnome-system-monitor-2.23.6/src/util.h
|
||||
--- gnome-system-monitor-2.23.6/src/util.h.session 2008-07-21 12:18:47.000000000 -0400
|
||||
+++ gnome-system-monitor-2.23.6/src/util.h 2008-08-13 17:23:15.000000000 -0400
|
||||
@@ -94,6 +94,14 @@ namespace procman
|
||||
GtkTreeModel *model, GtkTreeIter *iter,
|
||||
gpointer user_data);
|
||||
|
||||
+ void session_state_cell_data_func(GtkTreeViewColumn *col, GtkCellRenderer *renderer,
|
||||
+ GtkTreeModel *model, GtkTreeIter *iter,
|
||||
+ gpointer user_data);
|
||||
+
|
||||
+ void restart_style_cell_data_func(GtkTreeViewColumn *col, GtkCellRenderer *renderer,
|
||||
+ GtkTreeModel *model, GtkTreeIter *iter,
|
||||
+ gpointer user_data);
|
||||
+
|
||||
template<typename T>
|
||||
void poison(T &t, char c)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user