diff --git a/buttons.patch b/buttons.patch deleted file mode 100644 index 8330eb6..0000000 --- a/buttons.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff -up gnome-system-monitor-2.27.4/src/procdialogs.cpp.buttons gnome-system-monitor-2.27.4/src/procdialogs.cpp ---- gnome-system-monitor-2.27.4/src/procdialogs.cpp.buttons 2009-08-22 16:50:30.072430091 -0400 -+++ gnome-system-monitor-2.27.4/src/procdialogs.cpp 2009-08-22 16:52:41.435680298 -0400 -@@ -190,27 +190,16 @@ procdialog_create_renice_dialog (ProcDat - gtk_dialog_set_has_separator (GTK_DIALOG (renice_dialog), FALSE); - gtk_container_set_border_width (GTK_CONTAINER (renice_dialog), 5); - -- button = gtk_button_new (); -+ button = gtk_button_new_with_mnemonic (_("Change _Priority")); - GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); -- -- align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); -- gtk_container_add (GTK_CONTAINER (button), align); -- -- hbox = gtk_hbox_new (FALSE, 2); -- gtk_container_add (GTK_CONTAINER (align), hbox); -- - icon = gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON); -- gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0); -- -- label = gtk_label_new_with_mnemonic (_("Change _Priority")); -- gtk_label_set_mnemonic_widget (GTK_LABEL (label), button); -- gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0); -+ gtk_button_set_image (GTK_BUTTON (button), icon); - - gtk_dialog_add_action_widget (GTK_DIALOG (renice_dialog), button, 100); - - gtk_dialog_set_default_response (GTK_DIALOG (renice_dialog), 100); - new_nice_value = -100; -- -+ - dialog_vbox = GTK_DIALOG (dialog)->vbox; - gtk_box_set_spacing (GTK_BOX (dialog_vbox), 2); - gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5); diff --git a/gnome-system-monitor-2.25.91-polkit.patch b/gnome-system-monitor-2.25.91-polkit.patch deleted file mode 100644 index a430709..0000000 --- a/gnome-system-monitor-2.25.91-polkit.patch +++ /dev/null @@ -1,1262 +0,0 @@ -diff -up gnome-system-monitor-2.28.2/configure.in.polkit gnome-system-monitor-2.28.2/configure.in ---- gnome-system-monitor-2.28.2/configure.in.polkit 2010-09-27 19:13:17.000000000 -0400 -+++ gnome-system-monitor-2.28.2/configure.in 2010-09-30 13:00:35.606603002 -0400 -@@ -35,10 +35,35 @@ GIOMM_REQUIRED=2.16.0 - GLIBMM_REQUIRED=2.14 - LIBXML_REQUIRED=2.0 - RSVG_REQUIRED=2.12 --DBUS_REQUIRED=0.7 -+POLKIT_REQUIRED=0.92 -+DBUS_GLIB_REQUIRED=0.71 -+DBUS_REQUIRED=1.1.2 - --PKG_CHECK_MODULES(PROCMAN, glib-2.0 >= $GLIB_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgtop-2.0 >= $LIBGTOP_REQUIRED libwnck-1.0 >= $LIBWNCK_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gtkmm-2.4 >= $GTKMM_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED librsvg-2.0 >= $RSVG_REQUIRED glibmm-2.4 >= $GLIBMM_REQUIRED giomm-2.4 >= $GIOMM_REQUIRED dbus-glib-1 >= $DBUS_REQUIRED) - -+PKG_CHECK_MODULES(PROCMAN, glib-2.0 >= $GLIB_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgtop-2.0 >= $LIBGTOP_REQUIRED libwnck-1.0 >= $LIBWNCK_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gtkmm-2.4 >= $GTKMM_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED librsvg-2.0 >= $RSVG_REQUIRED glibmm-2.4 >= $GLIBMM_REQUIRED giomm-2.4 >= $GIOMM_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED) -+ -+# PolicyKit detection; defaults to 'auto' (use it if it's available) -+# -+POLKIT_CFLAGS= -+POLKIT_LIBS= -+AC_ARG_ENABLE(polkit, AS_HELP_STRING([--enable-polkit],[Enable PolicyKit support (auto)]),enable_polkit=$enableval,enable_polkit=auto) -+if test "x$enable_polkit" = "xno" ; then -+ HAVE_POLKIT=no -+else -+ HAVE_POLKIT=no -+ PKG_CHECK_MODULES(POLKIT, polkit-gobject-1 >= $POLKIT_REQUIRED dbus-1 >= $DBUS_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED gobject-2.0, HAVE_POLKIT=yes, HAVE_POLKIT=no) -+ -+ if test "x$enable_polkit" = "xyes" -a "x$HAVE_POLKIT" = "xno" ; then -+ AC_MSG_ERROR(PolicyKit support explicity enabled but not available) -+ fi -+ -+ if test "x$HAVE_POLKIT" = "xyes" ; then -+ AC_DEFINE(HAVE_POLKIT, 1, [Defined if PolicyKit support is enabled]) -+ fi -+fi -+AM_CONDITIONAL(HAVE_POLKIT, test "x$HAVE_POLKIT" = "xyes") -+AC_SUBST(POLKIT_CFLAGS) -+AC_SUBST(POLKIT_LIBS) - - AC_ARG_ENABLE(more-warnings, - [AC_HELP_STRING([--enable-more-warnings], [Maximum compiler warnings])], -@@ -98,6 +123,7 @@ Configuration: - C++ Compiler: ${CXX} - CFLAGS: ${CFLAGS} - CXXFLAGS: ${CXXFLAGS} -+ PolicyKit support: ${HAVE_POLKIT} - Maintainer mode: ${USER_MAINTAINER_MODE} - Languages: ${ALL_LINGUAS} - " -diff -up gnome-system-monitor-2.28.2/po/POTFILES.in.polkit gnome-system-monitor-2.28.2/po/POTFILES.in ---- gnome-system-monitor-2.28.2/po/POTFILES.in.polkit 2010-02-09 08:23:26.000000000 -0500 -+++ gnome-system-monitor-2.28.2/po/POTFILES.in 2010-09-30 13:00:35.584603002 -0400 -@@ -8,6 +8,7 @@ src/callbacks.cpp - src/defaulttable.h - src/disks.cpp - src/e_date.c -+src/gnome-system-monitor.policy.in - src/gnome-system-monitor.schemas.in - src/gsm_color_button.c - src/interface.cpp -diff -up gnome-system-monitor-2.28.2/src/callbacks.cpp.polkit gnome-system-monitor-2.28.2/src/callbacks.cpp -diff -up gnome-system-monitor-2.28.2/src/gnome-system-monitor-mechanism.c.polkit gnome-system-monitor-2.28.2/src/gnome-system-monitor-mechanism.c ---- gnome-system-monitor-2.28.2/src/gnome-system-monitor-mechanism.c.polkit 2010-09-30 13:00:35.587603002 -0400 -+++ gnome-system-monitor-2.28.2/src/gnome-system-monitor-mechanism.c 2010-09-30 13:00:35.609603002 -0400 -@@ -0,0 +1,592 @@ -+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- -+ * -+ * Copyright (C) 2007 David Zeuthen -+ * -+ * 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 of the License, 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. -+ * -+ */ -+ -+#ifdef HAVE_CONFIG_H -+# include "config.h" -+#endif -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static gboolean no_exit = FALSE; -+ -+/*--------------------------------------------------------------------------------------------------------------*/ -+ -+#define GNOME_SYSTEM_MONITOR_TYPE_MECHANISM (gnome_system_monitor_mechanism_get_type ()) -+#define GNOME_SYSTEM_MONITOR_MECHANISM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNOME_SYSTEM_MONITOR_TYPE_MECHANISM, GnomeSystemMonitorMechanism)) -+#define GNOME_SYSTEM_MONITOR_MECHANISM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GNOME_SYSTEM_MONITOR_TYPE_MECHANISM, GnomeSystemMonitorMechanismClass)) -+#define GNOME_SYSTEM_MONITOR_IS_MECHANISM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNOME_SYSTEM_MONITOR_TYPE_MECHANISM)) -+#define GNOME_SYSTEM_MONITOR_IS_MECHANISM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNOME_SYSTEM_MONITOR_TYPE_MECHANISM)) -+#define GNOME_SYSTEM_MONITOR_MECHANISM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNOME_SYSTEM_MONITOR_TYPE_MECHANISM, GnomeSystemMonitorMechanismClass)) -+ -+typedef struct GnomeSystemMonitorMechanismPrivate GnomeSystemMonitorMechanismPrivate; -+ -+typedef struct -+{ -+ GObject parent; -+ GnomeSystemMonitorMechanismPrivate *priv; -+} GnomeSystemMonitorMechanism; -+ -+typedef struct -+{ -+ GObjectClass parent_class; -+} GnomeSystemMonitorMechanismClass; -+ -+typedef enum -+{ -+ GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_GENERAL, -+ GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_NOT_PRIVILEGED, -+ GNOME_SYSTEM_MONITOR_MECHANISM_NUM_ERRORS -+} GnomeSystemMonitorMechanismError; -+ -+#define GNOME_SYSTEM_MONITOR_MECHANISM_ERROR gnome_system_monitor_mechanism_error_quark () -+ -+GType gnome_system_monitor_mechanism_error_get_type (void); -+#define GNOME_SYSTEM_MONITOR_MECHANISM_TYPE_ERROR (gnome_system_monitor_mechanism_error_get_type ()) -+ -+ -+GQuark gnome_system_monitor_mechanism_error_quark (void); -+GType gnome_system_monitor_mechanism_get_type (void); -+GnomeSystemMonitorMechanism *gnome_system_monitor_mechanism_new (void); -+ -+/* exported methods */ -+gboolean gnome_system_monitor_mechanism_kill (GnomeSystemMonitorMechanism *mechanism, -+ int pid, -+ int sig, -+ DBusGMethodInvocation *context); -+ -+gboolean gnome_system_monitor_mechanism_renice (GnomeSystemMonitorMechanism *mechanism, -+ int pid, -+ int nice_value, -+ DBusGMethodInvocation *context); -+ -+/*--------------------------------------------------------------------------------------------------------------*/ -+#include "gnome-system-monitor-mechanism-glue.h" -+ -+static gboolean -+do_exit (gpointer user_data) -+{ -+ g_debug ("Exiting due to inactivity"); -+ exit (1); -+ return FALSE; -+} -+ -+static void -+reset_killtimer (void) -+{ -+ static guint timer_id = 0; -+ -+ if (no_exit) -+ return; -+ -+ if (timer_id > 0) { -+ g_source_remove (timer_id); -+ } -+ g_debug ("Setting killtimer to 30 seconds..."); -+ timer_id = g_timeout_add (30 * 1000, do_exit, NULL); -+} -+ -+struct GnomeSystemMonitorMechanismPrivate -+{ -+ DBusGConnection *system_bus_connection; -+ DBusGProxy *system_bus_proxy; -+ PolkitAuthority *pol_ctx; -+}; -+ -+static void gnome_system_monitor_mechanism_class_init (GnomeSystemMonitorMechanismClass *klass); -+static void gnome_system_monitor_mechanism_init (GnomeSystemMonitorMechanism *seat); -+static void gnome_system_monitor_mechanism_finalize (GObject *object); -+ -+G_DEFINE_TYPE (GnomeSystemMonitorMechanism, gnome_system_monitor_mechanism, G_TYPE_OBJECT) -+ -+#define GNOME_SYSTEM_MONITOR_MECHANISM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNOME_SYSTEM_MONITOR_TYPE_MECHANISM, GnomeSystemMonitorMechanismPrivate)) -+ -+GQuark -+gnome_system_monitor_mechanism_error_quark (void) -+{ -+ static GQuark ret = 0; -+ -+ if (ret == 0) { -+ ret = g_quark_from_static_string ("gnome_system_monitor_mechanism_error"); -+ } -+ -+ return ret; -+} -+ -+ -+#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC } -+ -+GType -+gnome_system_monitor_mechanism_error_get_type (void) -+{ -+ static GType etype = 0; -+ -+ if (etype == 0) -+ { -+ static const GEnumValue values[] = -+ { -+ ENUM_ENTRY (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_GENERAL, "GeneralError"), -+ ENUM_ENTRY (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_NOT_PRIVILEGED, "NotPrivileged"), -+ { 0, 0, 0 } -+ }; -+ -+ g_assert (GNOME_SYSTEM_MONITOR_MECHANISM_NUM_ERRORS == G_N_ELEMENTS (values) - 1); -+ -+ etype = g_enum_register_static ("GnomeSystemMonitorMechanismError", values); -+ } -+ -+ return etype; -+} -+ -+ -+static GObject * -+gnome_system_monitor_mechanism_constructor (GType type, -+ guint n_construct_properties, -+ GObjectConstructParam *construct_properties) -+{ -+ GnomeSystemMonitorMechanism *mechanism; -+ GnomeSystemMonitorMechanismClass *klass; -+ -+ klass = GNOME_SYSTEM_MONITOR_MECHANISM_CLASS (g_type_class_peek (GNOME_SYSTEM_MONITOR_TYPE_MECHANISM)); -+ -+ mechanism = GNOME_SYSTEM_MONITOR_MECHANISM ( -+ G_OBJECT_CLASS (gnome_system_monitor_mechanism_parent_class)->constructor (type, -+ n_construct_properties, -+ construct_properties)); -+ -+ return G_OBJECT (mechanism); -+} -+ -+static void -+gnome_system_monitor_mechanism_class_init (GnomeSystemMonitorMechanismClass *klass) -+{ -+ GObjectClass *object_class = G_OBJECT_CLASS (klass); -+ -+ object_class->constructor = gnome_system_monitor_mechanism_constructor; -+ object_class->finalize = gnome_system_monitor_mechanism_finalize; -+ -+ g_type_class_add_private (klass, sizeof (GnomeSystemMonitorMechanismPrivate)); -+ -+ dbus_g_object_type_install_info (GNOME_SYSTEM_MONITOR_TYPE_MECHANISM, &dbus_glib_gnome_system_monitor_mechanism_object_info); -+ -+ dbus_g_error_domain_register (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR, NULL, GNOME_SYSTEM_MONITOR_MECHANISM_TYPE_ERROR); -+ -+} -+ -+static void -+gnome_system_monitor_mechanism_init (GnomeSystemMonitorMechanism *mechanism) -+{ -+ mechanism->priv = GNOME_SYSTEM_MONITOR_MECHANISM_GET_PRIVATE (mechanism); -+ -+} -+ -+static void -+gnome_system_monitor_mechanism_finalize (GObject *object) -+{ -+ GnomeSystemMonitorMechanism *mechanism; -+ -+ g_return_if_fail (object != NULL); -+ g_return_if_fail (GNOME_SYSTEM_MONITOR_IS_MECHANISM (object)); -+ -+ mechanism = GNOME_SYSTEM_MONITOR_MECHANISM (object); -+ -+ g_return_if_fail (mechanism->priv != NULL); -+ -+ g_object_unref (mechanism->priv->system_bus_proxy); -+ -+ G_OBJECT_CLASS (gnome_system_monitor_mechanism_parent_class)->finalize (object); -+} -+ -+static gboolean -+register_mechanism (GnomeSystemMonitorMechanism *mechanism) -+{ -+ GError *error = NULL; -+ -+ mechanism->priv->pol_ctx = polkit_authority_get (); -+ -+ error = NULL; -+ mechanism->priv->system_bus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); -+ if (mechanism->priv->system_bus_connection == NULL) { -+ if (error != NULL) { -+ g_critical ("error getting system bus: %s", error->message); -+ g_error_free (error); -+ } -+ goto error; -+ } -+ -+ dbus_g_connection_register_g_object (mechanism->priv->system_bus_connection, "/", -+ G_OBJECT (mechanism)); -+ -+ mechanism->priv->system_bus_proxy = dbus_g_proxy_new_for_name (mechanism->priv->system_bus_connection, -+ DBUS_SERVICE_DBUS, -+ DBUS_PATH_DBUS, -+ DBUS_INTERFACE_DBUS); -+ -+ reset_killtimer (); -+ -+ return TRUE; -+ -+error: -+ return FALSE; -+} -+ -+ -+GnomeSystemMonitorMechanism * -+gnome_system_monitor_mechanism_new (void) -+{ -+ GObject *object; -+ gboolean res; -+ -+ object = g_object_new (GNOME_SYSTEM_MONITOR_TYPE_MECHANISM, NULL); -+ -+ res = register_mechanism (GNOME_SYSTEM_MONITOR_MECHANISM (object)); -+ if (! res) { -+ g_object_unref (object); -+ return NULL; -+ } -+ -+ return GNOME_SYSTEM_MONITOR_MECHANISM (object); -+} -+ -+static PolkitSubject * -+get_caller_from_context (GnomeSystemMonitorMechanism *mechanism, DBusGMethodInvocation *context) -+{ -+ char *sender; -+ PolkitSubject *pk_caller; -+ -+ sender = dbus_g_method_get_sender (context); -+ pk_caller = polkit_system_bus_name_new (sender); -+ g_free (sender); -+ -+ return pk_caller; -+} -+ -+/* note, we take ownership of the passed PolkitSubject object */ -+static gboolean -+_check_polkit_for_action_for_caller (GnomeSystemMonitorMechanism *mechanism, -+ DBusGMethodInvocation *context, -+ PolkitSubject *subject, -+ const char *action) -+{ -+ GError *error; -+ PolkitAuthorizationResult *result; -+ -+ error = NULL; -+ -+ result = polkit_authority_check_authorization_sync (mechanism->priv->pol_ctx, -+ subject, -+ action, -+ NULL, -+ POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION, -+ NULL, NULL); -+ g_object_unref (subject); -+ -+ if (!polkit_authorization_result_get_is_authorized (result)) { -+ error = g_error_new (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR, -+ GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_NOT_PRIVILEGED, -+ "%s", -+ action); -+ dbus_g_method_return_error (context, error); -+ g_error_free (error); -+ g_object_unref (result); -+ return FALSE; -+ } -+ -+ g_object_unref (result); -+ return TRUE; -+} -+ -+static gboolean -+_check_polkit_for_action (GnomeSystemMonitorMechanism *mechanism, -+ DBusGMethodInvocation *context, -+ const char *action) -+{ -+ PolkitSubject *subject; -+ -+ /* Check that caller is privileged */ -+ if ((subject = get_caller_from_context (mechanism, context)) == NULL) -+ return FALSE; -+ -+ return _check_polkit_for_action_for_caller (mechanism, context, subject, action); -+} -+ -+/*--------------------------------------------------------------------------------------------------------------*/ -+/* exported methods */ -+ -+gboolean -+gnome_system_monitor_mechanism_kill (GnomeSystemMonitorMechanism *mechanism, -+ int pid, -+ int sig, -+ DBusGMethodInvocation *context) -+{ -+ reset_killtimer (); -+ -+ if (!_check_polkit_for_action (mechanism, context, "org.gnome.system-monitor.kill")) -+ return FALSE; -+ -+ g_debug ("Sending signal %d to pid %d", sig, pid); -+ -+ if (kill (pid, sig) != 0) { -+ GError *error; -+ error = g_error_new (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR, -+ GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_GENERAL, -+ "Error sending signal %d to pid %d: %m", sig, pid); -+ g_warning ("Error: %s", error->message); -+ dbus_g_method_return_error (context, error); -+ g_error_free (error); -+ return FALSE; -+ } -+ -+ dbus_g_method_return (context); -+ return TRUE; -+} -+ -+static gboolean -+get_uid_from_context (GnomeSystemMonitorMechanism *mechanism, -+ DBusGMethodInvocation *context, -+ uid_t *uid) -+{ -+ char *sender; -+ DBusConnection *con; -+ -+ con = dbus_g_connection_get_connection (dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL)); -+ if (con == NULL) -+ return FALSE; -+ -+ sender = dbus_g_method_get_sender (context); -+ *uid = dbus_bus_get_unix_user (con, sender, NULL); -+ g_free (sender); -+ -+ if (*uid == (unsigned)-1) -+ return FALSE; -+ -+ return TRUE; -+} -+ -+gboolean -+gnome_system_monitor_mechanism_renice (GnomeSystemMonitorMechanism *mechanism, -+ int pid, -+ int nice_value, -+ DBusGMethodInvocation *context) -+{ -+ uid_t caller_uid; -+ uid_t process_uid; -+ PolkitSubject *subject; -+ char *procpath; -+ struct stat statbuf; -+ const char *action_id; -+ -+ reset_killtimer (); -+ -+ /* Hmm; is there a better way to do this? This may be Linux specific.. */ -+ procpath = g_strdup_printf ("/proc/%d", pid); -+ if (stat (procpath, &statbuf) != 0) { -+ GError *error; -+ error = g_error_new (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR, -+ GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_GENERAL, -+ "Error figuring out uid for pid %d", pid); -+ g_warning ("Error: %s", error->message); -+ dbus_g_method_return_error (context, error); -+ g_error_free (error); -+ g_free (procpath); -+ return FALSE; -+ } -+ g_free (procpath); -+ process_uid = statbuf.st_uid; -+ -+ subject = get_caller_from_context (mechanism, context); -+ if (subject == NULL) -+ return FALSE; -+ -+ if (!get_uid_from_context (mechanism, context, &caller_uid)) { -+ GError *error; -+ error = g_error_new (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR, -+ GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_GENERAL, -+ "Error figuring out uid of caller"); -+ g_warning ("Error: %s", error->message); -+ dbus_g_method_return_error (context, error); -+ g_error_free (error); -+ g_object_unref (subject); -+ return FALSE; -+ } -+ -+ if (caller_uid == process_uid) { -+ action_id = "org.gnome.system-monitor.increase-own-priority"; -+ } else { -+ action_id = "org.gnome.system-monitor.change-priority"; -+ } -+ -+ if (!_check_polkit_for_action_for_caller (mechanism, context, subject, action_id)) { -+ return FALSE; -+ } -+ -+ g_debug ("Renicing pid %d (owned by uid %d) to priority %d on behalf of uid %d (action_id=%s)", -+ pid, process_uid, nice_value, caller_uid, action_id); -+ -+ errno = 0; -+ if (setpriority (PRIO_PROCESS, pid, nice_value) != 0) { -+ GError *error; -+ error = g_error_new (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR, -+ GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_GENERAL, -+ "Error renicing pid %d to priority %d: %m", pid, nice_value); -+ g_warning ("Error: %s", error->message); -+ dbus_g_method_return_error (context, error); -+ g_error_free (error); -+ return FALSE; -+ } -+ -+ dbus_g_method_return (context); -+ return TRUE; -+} -+ -+/*--------------------------------------------------------------------------------------------------------------*/ -+ -+#define BUS_NAME "org.gnome.SystemMonitor.Mechanism" -+ -+static gboolean -+acquire_name_on_proxy (DBusGProxy *bus_proxy) -+{ -+ GError *error; -+ guint result; -+ gboolean res; -+ gboolean ret; -+ -+ ret = FALSE; -+ -+ if (bus_proxy == NULL) { -+ goto out; -+ } -+ -+ error = NULL; -+ res = dbus_g_proxy_call (bus_proxy, -+ "RequestName", -+ &error, -+ G_TYPE_STRING, BUS_NAME, -+ G_TYPE_UINT, 0, -+ G_TYPE_INVALID, -+ G_TYPE_UINT, &result, -+ G_TYPE_INVALID); -+ if (! res) { -+ if (error != NULL) { -+ g_warning ("Failed to acquire %s: %s", BUS_NAME, error->message); -+ g_error_free (error); -+ } else { -+ g_warning ("Failed to acquire %s", BUS_NAME); -+ } -+ goto out; -+ } -+ -+ if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { -+ if (error != NULL) { -+ g_warning ("Failed to acquire %s: %s", BUS_NAME, error->message); -+ g_error_free (error); -+ } else { -+ g_warning ("Failed to acquire %s", BUS_NAME); -+ } -+ goto out; -+ } -+ -+ ret = TRUE; -+ -+ out: -+ return ret; -+} -+ -+int -+main (int argc, char **argv) -+{ -+ GMainLoop *loop; -+ GnomeSystemMonitorMechanism *mechanism; -+ DBusGProxy *bus_proxy; -+ DBusGConnection *connection; -+ int ret; -+ GError *error; -+ GOptionContext *context; -+ static GOptionEntry entries [] = { -+ { "no-exit", 0, 0, G_OPTION_ARG_NONE, &no_exit, N_("Don't exit after 30 seconds of inactivity"), NULL }, -+ { NULL } -+ }; -+ -+ ret = 1; -+ -+ g_type_init (); -+ -+ context = g_option_context_new (_("PolicyKit GNOME session daemon")); -+ g_option_context_add_main_entries (context, entries, NULL); -+ g_option_context_parse (context, &argc, &argv, NULL); -+ g_option_context_free (context); -+ -+ -+ error = NULL; -+ connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); -+ if (connection == NULL) { -+ g_warning ("Couldn't connect to system bus: %s", error->message); -+ g_error_free (error); -+ goto out; -+ } -+ -+ bus_proxy = dbus_g_proxy_new_for_name (connection, -+ DBUS_SERVICE_DBUS, -+ DBUS_PATH_DBUS, -+ DBUS_INTERFACE_DBUS); -+ if (bus_proxy == NULL) { -+ g_warning ("Could not construct bus_proxy object; bailing out"); -+ goto out; -+ } -+ -+ if (!acquire_name_on_proxy (bus_proxy) ) { -+ g_warning ("Could not acquire name; bailing out"); -+ goto out; -+ } -+ -+ mechanism = gnome_system_monitor_mechanism_new (); -+ -+ if (mechanism == NULL) { -+ goto out; -+ } -+ -+ loop = g_main_loop_new (NULL, FALSE); -+ -+ g_main_loop_run (loop); -+ -+ g_object_unref (mechanism); -+ g_main_loop_unref (loop); -+ ret = 0; -+ -+out: -+ return ret; -+} -diff -up gnome-system-monitor-2.28.2/src/gnome-system-monitor-mechanism.xml.polkit gnome-system-monitor-2.28.2/src/gnome-system-monitor-mechanism.xml ---- gnome-system-monitor-2.28.2/src/gnome-system-monitor-mechanism.xml.polkit 2010-09-30 13:00:35.588603002 -0400 -+++ gnome-system-monitor-2.28.2/src/gnome-system-monitor-mechanism.xml 2010-09-30 13:00:35.588603002 -0400 -@@ -0,0 +1,15 @@ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff -up gnome-system-monitor-2.28.2/src/interface.cpp.polkit gnome-system-monitor-2.28.2/src/interface.cpp ---- gnome-system-monitor-2.28.2/src/interface.cpp.polkit 2010-02-09 08:23:26.000000000 -0500 -+++ gnome-system-monitor-2.28.2/src/interface.cpp 2010-09-30 13:00:35.611603002 -0400 -@@ -30,6 +30,10 @@ - #include - #include - -+#ifdef HAVE_POLKIT -+# include -+#endif -+ - #include "procman.h" - #include "callbacks.h" - #include "interface.h" -@@ -58,6 +62,7 @@ static const GtkActionEntry menu_entries - N_("Quit the program"), G_CALLBACK (cb_app_exit) }, - - -+#ifndef HAVE_POLKIT - { "StopProcess", NULL, N_("_Stop Process"), "S", - N_("Stop process"), G_CALLBACK(cb_kill_sigstop) }, - { "ContProcess", NULL, N_("_Continue Process"), "C", -@@ -67,6 +72,7 @@ static const GtkActionEntry menu_entries - N_("Force process to finish normally"), G_CALLBACK (cb_end_process) }, - { "KillProcess", NULL, N_("_Kill Process"), "K", - N_("Force process to finish immediately"), G_CALLBACK (cb_kill_process) }, -+#endif - { "ChangePriority", NULL, N_("_Change Priority..."), "N", - N_("Change the order of priority of process"), G_CALLBACK (cb_renice) }, - { "Preferences", GTK_STOCK_PREFERENCES, NULL, NULL, -@@ -186,10 +192,16 @@ create_proc_view (ProcData *procdata) - hbox2 = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, FALSE, 0); - -+#ifdef HAVE_POLKIT -+ procdata->endprocessbutton = gtk_button_new (); -+ gtk_activatable_set_related_action (GTK_ACTIVATABLE (procdata->endprocessbutton), -+ procdata->sigterm_action); -+#else - procdata->endprocessbutton = gtk_button_new_with_mnemonic (_("End _Process")); -- gtk_box_pack_end (GTK_BOX (hbox2), procdata->endprocessbutton, FALSE, FALSE, 0); - g_signal_connect (G_OBJECT (procdata->endprocessbutton), "clicked", - G_CALLBACK (cb_end_process_button_pressed), procdata); -+#endif -+ gtk_box_pack_end (GTK_BOX (hbox2), procdata->endprocessbutton, FALSE, FALSE, 0); - - - /* create popup_menu */ -@@ -670,6 +682,41 @@ create_main_window (ProcData *procdata) - G_CALLBACK(cb_radio_processes), - procdata); - -+#ifdef HAVE_POLKIT -+ procdata->sigstop_action = gtk_action_new ("StopProcess", -+ _("_Stop Process"), -+ _("Stop process"), -+ NULL); -+ g_signal_connect (procdata->sigstop_action, "activate", G_CALLBACK (cb_kill_sigstop), procdata); -+ gtk_action_group_add_action_with_accel (procdata->action_group, -+ GTK_ACTION (procdata->sigstop_action), -+ "S"); -+ -+ procdata->sigcont_action = gtk_action_new ("ContProcess", -+ _("_Continue Process"), -+ _("Continue process"), -+ NULL); -+ g_signal_connect (procdata->sigcont_action, "activate", G_CALLBACK (cb_kill_sigcont), procdata); -+ gtk_action_group_add_action_with_accel (procdata->action_group, GTK_ACTION (procdata->sigcont_action), -+ "C"); -+ -+ procdata->sigterm_action = gtk_action_new ("EndProcess", -+ _("End _Process"), -+ _("Force process to finish normally"), -+ NULL); -+ g_signal_connect (procdata->sigterm_action, "activate", G_CALLBACK (cb_end_process), procdata); -+ gtk_action_group_add_action_with_accel (procdata->action_group, GTK_ACTION (procdata->sigterm_action), -+ "E"); -+ -+ procdata->sigkill_action = gtk_action_new ("KillProcess", -+ _("_Kill Process"), -+ _("Force process to finish immediately"), -+ NULL); -+ g_signal_connect (procdata->sigkill_action, "activate", G_CALLBACK (cb_kill_process), procdata); -+ gtk_action_group_add_action_with_accel (procdata->action_group, GTK_ACTION (procdata->sigkill_action), -+ "K"); -+#endif -+ - gtk_ui_manager_insert_action_group (procdata->uimanager, - procdata->action_group, - 0); -@@ -677,7 +724,6 @@ create_main_window (ProcData *procdata) - menubar = gtk_ui_manager_get_widget (procdata->uimanager, "/MenuBar"); - gtk_box_pack_start (GTK_BOX (main_box), menubar, FALSE, FALSE, 0); - -- - /* create the main notebook */ - procdata->notebook = notebook = gtk_notebook_new (); - gtk_box_pack_start (GTK_BOX (main_box), -@@ -774,23 +820,26 @@ update_sensitivity(ProcData *data) - processes_sensitivity = (data->config.current_tab == PROCMAN_TAB_PROCESSES); - selected_sensitivity = (processes_sensitivity && data->selected_process != NULL); - -+#ifndef HAVE_POLKIT - if(data->endprocessbutton) { - /* avoid error on startup if endprocessbutton - has not been built yet */ - gtk_widget_set_sensitive(data->endprocessbutton, selected_sensitivity); - } -+#endif - - for (i = 0; i != G_N_ELEMENTS(processes_actions); ++i) { - action = gtk_action_group_get_action(data->action_group, - processes_actions[i]); -- gtk_action_set_sensitive(action, processes_sensitivity); -+ gtk_action_set_sensitive(action, selected_sensitivity); - } - - for (i = 0; i != G_N_ELEMENTS(selected_actions); ++i) { - action = gtk_action_group_get_action(data->action_group, - selected_actions[i]); -- gtk_action_set_sensitive(action, selected_sensitivity); -+ gtk_action_set_sensitive(action, processes_sensitivity); - } -+ - } - - static void -diff -up gnome-system-monitor-2.28.2/src/Makefile.am.polkit gnome-system-monitor-2.28.2/src/Makefile.am ---- gnome-system-monitor-2.28.2/src/Makefile.am.polkit 2010-02-09 08:23:26.000000000 -0500 -+++ gnome-system-monitor-2.28.2/src/Makefile.am 2010-09-30 13:00:35.613603002 -0400 -@@ -4,7 +4,9 @@ INCLUDES = \ - -DPROCMAN_DATADIR=\""$(datadir)/procman/"\" \ - -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ - -DDATADIR=\""$(datadir)"\" \ -- @PROCMAN_CFLAGS@ -+ @PROCMAN_CFLAGS@ \ -+ @POLKIT_CFLAGS@ \ -+ @POLKIT_CFLAGS@ - - bin_PROGRAMS = gnome-system-monitor - -@@ -35,8 +37,11 @@ gnome_system_monitor_SOURCES = \ - e_date.c e_date.h \ - gsm_color_button.c gsm_color_button.h - -+if HAVE_POLKIT -+gnome_system_monitor_SOURCES += gnome-system-monitor-mechanism-client-glue.h -+endif - --gnome_system_monitor_LDADD = @PROCMAN_LIBS@ libbacon.la -+gnome_system_monitor_LDADD = @PROCMAN_LIBS@ @POLKIT_LIBS@ libbacon.la - - - noinst_LTLIBRARIES = libbacon.la -@@ -52,8 +57,44 @@ schema_ins = gnome-system-monitor.schem - schema_DATA = $(schema_ins:.schemas.in=.schemas) - @INTLTOOL_SCHEMAS_RULE@ - -+###################################################################### -+if HAVE_POLKIT -+ -+polkit_policydir = $(datadir)/polkit-1/actions -+dist_polkit_policy_DATA = org.gnome.system-monitor.policy -+# You will need a recent intltool or the patch from this bug http://bugzilla.gnome.org/show_bug.cgi?id=462312 -+@INTLTOOL_POLICY_RULE@ -+ -+gnome-system-monitor-mechanism-client-glue.h: gnome-system-monitor-mechanism.xml Makefile.am -+ dbus-binding-tool --prefix=gnome_system_monitor_mechanism --mode=glib-client --output=gnome-system-monitor-mechanism-client-glue.h gnome-system-monitor-mechanism.xml -+ -+gnome-system-monitor-mechanism-glue.h: gnome-system-monitor-mechanism.xml Makefile.am -+ dbus-binding-tool --prefix=gnome_system_monitor_mechanism --mode=glib-server --output=gnome-system-monitor-mechanism-glue.h gnome-system-monitor-mechanism.xml -+ -+dbusconfdir = $(sysconfdir)/dbus-1/system.d -+dbusconf_DATA = org.gnome.SystemMonitor.Mechanism.conf -+ -+org.gnome.SystemMonitor.Mechanism.service : org.gnome.SystemMonitor.Mechanism.service.in Makefile.am -+ sed -e s_libexecdir_$(libexecdir)_ org.gnome.SystemMonitor.Mechanism.service.in > org.gnome.SystemMonitor.Mechanism.service -+ -+dbussyssvcdir = $(datadir)/dbus-1/system-services -+dbussyssvc_DATA = org.gnome.SystemMonitor.Mechanism.service -+ -+libexec_PROGRAMS = gnome-system-monitor-mechanism -+gnome_system_monitor_mechanism_SOURCES = \ -+ gnome-system-monitor-mechanism-glue.h \ -+ gnome-system-monitor-mechanism.c -+ -+gnome_system_monitor_mechanism_CFLAGS = $(POLKIT_CFLAGS) -+gnome_system_monitor_mechanism_LDADD = $(POLKIT_LIBS) -+endif -+###################################################################### -+ -+ - EXTRA_DIST = \ -- $(schema_ins) -+ $(schema_ins) \ -+ org.gnome.system-monitor.policy.in \ -+ org.gnome.system-monitor.service.in - - CLEANFILES = \ - $(schema_DATA) -diff -up gnome-system-monitor-2.28.2/src/org.gnome.SystemMonitor.Mechanism.conf.polkit gnome-system-monitor-2.28.2/src/org.gnome.SystemMonitor.Mechanism.conf ---- gnome-system-monitor-2.28.2/src/org.gnome.SystemMonitor.Mechanism.conf.polkit 2010-09-30 13:00:35.593603002 -0400 -+++ gnome-system-monitor-2.28.2/src/org.gnome.SystemMonitor.Mechanism.conf 2010-09-30 13:00:35.614603002 -0400 -@@ -0,0 +1,15 @@ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff -up gnome-system-monitor-2.28.2/src/org.gnome.SystemMonitor.Mechanism.service.in.polkit gnome-system-monitor-2.28.2/src/org.gnome.SystemMonitor.Mechanism.service.in ---- gnome-system-monitor-2.28.2/src/org.gnome.SystemMonitor.Mechanism.service.in.polkit 2010-09-30 13:00:35.594603002 -0400 -+++ gnome-system-monitor-2.28.2/src/org.gnome.SystemMonitor.Mechanism.service.in 2010-09-30 13:00:35.594603002 -0400 -@@ -0,0 +1,4 @@ -+[D-BUS Service] -+Name=org.gnome.SystemMonitor.Mechanism -+Exec=libexecdir/gnome-system-monitor-mechanism -+User=root -diff -up gnome-system-monitor-2.28.2/src/org.gnome.system-monitor.policy.in.polkit gnome-system-monitor-2.28.2/src/org.gnome.system-monitor.policy.in ---- gnome-system-monitor-2.28.2/src/org.gnome.system-monitor.policy.in.polkit 2010-09-30 13:00:35.595603002 -0400 -+++ gnome-system-monitor-2.28.2/src/org.gnome.system-monitor.policy.in 2010-09-30 13:00:35.615603002 -0400 -@@ -0,0 +1,50 @@ -+ -+ -+ -+ -+ -+ -+ -+ -+ The GNOME Project -+ http://online.gnome.org/application?id=gnome-system-monitor -+ utilities-system-monitor -+ -+ -+ <_description>Change priority of a process owned by another user -+ <_message>Changing the priority of a process owned by another user requires privileges -+ -+ no -+ auth_admin -+ -+ -+ -+ -+ <_description>Increase the priority of a processes -+ <_message>Increasing the priority of one of your own processes requires privileges -+ -+ no -+ auth_self_keep -+ -+ -+ -+ -+ <_description>Kill a process owned by another user -+ <_message>Killing a process owned by another user requires privileges -+ -+ no -+ auth_admin -+ -+ -+ -+ -diff -up gnome-system-monitor-2.28.2/src/procactions.cpp.polkit gnome-system-monitor-2.28.2/src/procactions.cpp ---- gnome-system-monitor-2.28.2/src/procactions.cpp.polkit 2010-02-09 08:23:26.000000000 -0500 -+++ gnome-system-monitor-2.28.2/src/procactions.cpp 2010-09-30 13:00:35.616603002 -0400 -@@ -31,6 +31,10 @@ - #include "procdialogs.h" - #include "callbacks.h" - -+#ifdef HAVE_POLKIT -+# include "gnome-system-monitor-mechanism-client-glue.h" -+# include -+#endif - - static void - renice_single_process (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) -@@ -48,6 +52,10 @@ renice_single_process (GtkTreeModel *mod - if (!info) - return; - -+ /* docs for getpriority suggest clearing errno before the call -+ * since -1 is a legitimate return value */ -+ errno = 0; -+ - error = setpriority (PRIO_PROCESS, info->pid, args->nice_value); - - /* success */ -@@ -55,6 +63,28 @@ renice_single_process (GtkTreeModel *mod - - saved_errno = errno; - -+#ifdef HAVE_POLKIT -+ /* need to be root */ -+ if (errno == EPERM || errno == EACCES) { -+ GError *error = NULL; -+ -+ if (!org_gnome_SystemMonitor_Mechanism_renice (args->procdata->mechanism_proxy, -+ info->pid, -+ args->nice_value, -+ &error)) { -+ /* TODO: Handle "require privileges" */ -+ error_msg = g_strdup_printf ( -+ _("Cannot renice process with pid %d to nice value %d: " -+ "%s"), -+ info->pid, args->nice_value, error->message); -+ g_error_free (error); -+ } else { -+ return; -+ } -+ } else { -+ return; -+ } -+#else - /* need to be root */ - if(errno == EPERM || errno == EACCES) { - gboolean success; -@@ -69,10 +99,11 @@ renice_single_process (GtkTreeModel *mod - saved_errno = errno; - } - } -+#endif - - /* failed */ - error_msg = g_strdup_printf ( -- _("Cannot change the priority of process with pid %d to %d.\n" -+ _("Cannot change the priority of process with pid %d to %d: " - "%s"), - info->pid, args->nice_value, g_strerror(saved_errno)); - -@@ -135,6 +166,28 @@ kill_single_process (GtkTreeModel *model - - saved_errno = errno; - -+#ifdef HAVE_POLKIT -+ /* need to be root */ -+ if (errno == EPERM) { -+ GError *error = NULL; -+ -+ if (!org_gnome_SystemMonitor_Mechanism_kill (args->procdata->mechanism_proxy, -+ info->pid, -+ args->signal, -+ &error)) { -+ /* TODO: Handle "require privileges" */ -+ error_msg = g_strdup_printf ( -+ _("Cannot kill process with pid %d with signal %d.\n" -+ "%s"), -+ info->pid, args->signal, error->message); -+ g_error_free (error); -+ } else { -+ return; -+ } -+ } else { -+ return; -+ } -+#else - /* need to be root */ - if(errno == EPERM) { - gboolean success; -@@ -149,12 +202,12 @@ kill_single_process (GtkTreeModel *model - saved_errno = errno; - } - } -- - /* failed */ - error_msg = g_strdup_printf ( - _("Cannot kill process with pid %d with signal %d.\n" - "%s"), - info->pid, args->signal, g_strerror(saved_errno)); -+#endif - - dialog = gtk_message_dialog_new ( - NULL, -@@ -188,3 +241,4 @@ kill_process (ProcData *procdata, int si - procdata); - proctable_update_all (procdata); - } -+ -diff -up gnome-system-monitor-2.28.2/src/procdialogs.cpp.polkit gnome-system-monitor-2.28.2/src/procdialogs.cpp ---- gnome-system-monitor-2.28.2/src/procdialogs.cpp.polkit 2010-09-27 19:13:17.000000000 -0400 -+++ gnome-system-monitor-2.28.2/src/procdialogs.cpp 2010-09-30 13:01:39.444603008 -0400 -@@ -123,29 +123,34 @@ get_nice_level (gint nice) - return _("(Very Low Priority)"); - } - -+typedef struct { -+ GtkWidget *priority_label; -+ ProcData *procdata; -+} ReniceClosure; -+ - static void - renice_scale_changed (GtkAdjustment *adj, gpointer data) - { -- GtkWidget *label = GTK_WIDGET (data); -- -+ ReniceClosure *rc = (ReniceClosure *) data; -+ - new_nice_value = int(gtk_adjustment_get_value (adj)); -- gtk_label_set_text (GTK_LABEL (label), get_nice_level (new_nice_value)); -- -+‣‧‧‧‧‧‧gtk_label_set_text (GTK_LABEL (rc->priority_label), get_nice_level (new_nice_value));‣‧‧‣‧‧‧‧‧‧‧ - } - - static void - renice_dialog_button_pressed (GtkDialog *dialog, gint id, gpointer data) - { -- ProcData *procdata = static_cast(data); -- -+ ReniceClosure *rc = (ReniceClosure *) data; -+ - if (id == 100) { - if (new_nice_value == -100) - return; -- renice(procdata, new_nice_value); -+ renice(rc->procdata, new_nice_value); - } - - gtk_widget_destroy (GTK_WIDGET (dialog)); - renice_dialog = NULL; -+ g_free (rc); - } - - void -@@ -155,7 +160,6 @@ procdialog_create_renice_dialog (ProcDat - GtkWidget *dialog = NULL; - GtkWidget *dialog_vbox; - GtkWidget *vbox; -- GtkWidget *hbox; - GtkWidget *label; - GtkWidget *priority_label; - GtkWidget *table; -@@ -163,14 +167,19 @@ procdialog_create_renice_dialog (ProcDat - GtkWidget *hscale; - GtkWidget *button; - GtkWidget *align; -+ GtkWidget *hbox; - GtkWidget *icon; - gchar *text; -+ ReniceClosure *rc; - - if (renice_dialog) - return; - - if (!info) - return; -+ -+ rc = g_new0 (ReniceClosure, 1); -+ rc->procdata = procdata; - - dialog = gtk_dialog_new_with_buttons (_("Change Priority"), NULL, - GTK_DIALOG_DESTROY_WITH_PARENT, -@@ -180,7 +189,7 @@ procdialog_create_renice_dialog (ProcDat - gtk_window_set_resizable (GTK_WINDOW (renice_dialog), FALSE); - gtk_dialog_set_has_separator (GTK_DIALOG (renice_dialog), FALSE); - gtk_container_set_border_width (GTK_CONTAINER (renice_dialog), 5); -- -+ - button = gtk_button_new (); - gtk_widget_set_can_default (button, TRUE); - -@@ -198,6 +207,7 @@ procdialog_create_renice_dialog (ProcDat - gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0); - - gtk_dialog_add_action_widget (GTK_DIALOG (renice_dialog), button, 100); -+ - gtk_dialog_set_default_response (GTK_DIALOG (renice_dialog), 100); - new_nice_value = -100; - -@@ -238,15 +248,16 @@ procdialog_create_renice_dialog (ProcDat - gtk_label_set_use_markup (GTK_LABEL (label), TRUE); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); - g_free (text); -+ -+ rc->priority_label = priority_label; -+ new_nice_value = info->nice; - - g_signal_connect (G_OBJECT (dialog), "response", -- G_CALLBACK (renice_dialog_button_pressed), procdata); -+ G_CALLBACK (renice_dialog_button_pressed), rc); - g_signal_connect (G_OBJECT (renice_adj), "value_changed", -- G_CALLBACK (renice_scale_changed), priority_label); -+ G_CALLBACK (renice_scale_changed), rc); - - gtk_widget_show_all (dialog); -- -- - } - - static void -diff -up gnome-system-monitor-2.28.2/src/procman.cpp.polkit gnome-system-monitor-2.28.2/src/procman.cpp ---- gnome-system-monitor-2.28.2/src/procman.cpp.polkit 2010-09-27 19:13:17.000000000 -0400 -+++ gnome-system-monitor-2.28.2/src/procman.cpp 2010-09-30 13:00:35.620603002 -0400 -@@ -36,6 +36,10 @@ - #include - #include - -+#ifdef HAVE_POLKIT -+# include -+#endif -+ - #include "load-graph.h" - #include "procman.h" - #include "interface.h" -@@ -58,7 +62,25 @@ ProcData::ProcData() - disk_timeout(0), - cpu_total_time(1), - cpu_total_time_last(1) --{ } -+{ -+#ifdef HAVE_POLKIT -+ GError *error; -+ DBusGConnection *bus; -+ -+ error = NULL; -+ bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); -+ if (bus == NULL) { -+ g_warning ("Couldn't connect to system bus: %s", error->message); -+ g_error_free (error); -+ this->mechanism_proxy = NULL; -+ } else { -+ this->mechanism_proxy = dbus_g_proxy_new_for_name (bus, -+ "org.gnome.SystemMonitor.Mechanism", -+ "/", -+ "org.gnome.SystemMonitor.Mechanism"); -+ } -+#endif -+} - - - ProcData* ProcData::get_instance() -diff -up gnome-system-monitor-2.28.2/src/procman.h.polkit gnome-system-monitor-2.28.2/src/procman.h ---- gnome-system-monitor-2.28.2/src/procman.h.polkit 2010-02-09 08:23:26.000000000 -0500 -+++ gnome-system-monitor-2.28.2/src/procman.h 2010-09-30 13:00:35.622603002 -0400 -@@ -33,6 +33,10 @@ - #include - #include - -+#ifdef HAVE_POLKIT -+# include -+#endif -+ - struct ProcInfo; - struct ProcData; - struct LoadGraph; -@@ -210,6 +214,15 @@ struct ProcData - GtkWidget *app; - GtkUIManager *menu; - -+#ifdef HAVE_POLKIT -+ DBusGProxy *mechanism_proxy; -+ -+ GtkAction *sigstop_action; -+ GtkAction *sigcont_action; -+ GtkAction *sigterm_action; -+ GtkAction *sigkill_action; -+#endif -+ - unsigned frequency; - - SmoothRefresh *smooth_refresh; -@@ -230,7 +243,6 @@ gboolean procman_get_tree_state (GConfCl - - - -- - struct ReniceArgs - { - ProcData *procdata; diff --git a/memmapsdialog.patch b/memmapsdialog.patch deleted file mode 100644 index 4765aff..0000000 --- a/memmapsdialog.patch +++ /dev/null @@ -1,74 +0,0 @@ ---- gnome-system-monitor-2.27.4/src/memmaps.cpp 2009-07-11 08:50:19.000000000 -0400 -+++ hacked/src/memmaps.cpp 2009-08-22 18:42:09.037680410 -0400 -@@ -452,18 +452,17 @@ - g_free (memmaps); - } - -- -- --static gboolean window_delete_event(GtkWidget *, GdkEvent *, gpointer data) -+static void -+dialog_response (GtkDialog *dialog, gint response_id, gpointer data) - { - MemMapsData * const mmdata = static_cast(data); - - g_source_remove (mmdata->timer); - - delete mmdata; -- return FALSE; --} - -+ gtk_widget_destroy (GTK_WIDGET (dialog)); -+} - - static MemMapsData* - create_memmapsdata (ProcData *procdata) -@@ -601,27 +600,17 @@ - mmdata = create_memmapsdata (procdata); - mmdata->info = info; - -- memmapsdialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); -- gtk_window_set_transient_for(GTK_WINDOW(memmapsdialog), GTK_WINDOW(procdata->app)); -- gtk_window_set_destroy_with_parent(GTK_WINDOW(memmapsdialog), TRUE); -- // gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); -- gtk_window_set_title(GTK_WINDOW(memmapsdialog), _("Memory Maps")); -+ memmapsdialog = gtk_dialog_new_with_buttons (_("Memory Maps"), GTK_WINDOW (procdata->app), -+ GTK_DIALOG_DESTROY_WITH_PARENT, -+ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, -+ NULL); - gtk_window_set_resizable(GTK_WINDOW(memmapsdialog), TRUE); - gtk_window_set_default_size(GTK_WINDOW(memmapsdialog), 575, 400); -- // gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); -- gtk_container_set_border_width(GTK_CONTAINER(memmapsdialog), 12); -+ gtk_dialog_set_has_separator(GTK_DIALOG(memmapsdialog), FALSE); -+ gtk_container_set_border_width(GTK_CONTAINER(memmapsdialog), 5); - -- GtkWidget *mainbox = gtk_vbox_new(FALSE, 12); -- gtk_container_add(GTK_CONTAINER(memmapsdialog), mainbox); -- -- vbox = mainbox; -- gtk_box_set_spacing (GTK_BOX (vbox), 2); -- gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); -- -- dialog_vbox = gtk_vbox_new (FALSE, 6); -+ dialog_vbox = GTK_DIALOG (memmapsdialog)->vbox; - gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5); -- gtk_box_pack_start (GTK_BOX (vbox), dialog_vbox, TRUE, TRUE, 0); -- - - label = procman_make_label_for_mmaps_or_ofiles ( - _("_Memory maps for process \"%s\" (PID %u):"), -@@ -643,10 +632,10 @@ - - gtk_box_pack_start (GTK_BOX (dialog_vbox), scrolled, TRUE, TRUE, 0); - -- gtk_widget_show_all (memmapsdialog); -+ g_signal_connect (G_OBJECT (memmapsdialog), "response", -+ G_CALLBACK(dialog_response), mmdata); - -- g_signal_connect(G_OBJECT(memmapsdialog), "delete-event", -- G_CALLBACK(window_delete_event), mmdata); -+ gtk_widget_show_all (memmapsdialog); - - mmdata->timer = g_timeout_add_seconds (5, memmaps_timer, mmdata); - diff --git a/more-than-4-cpus.patch b/more-than-4-cpus.patch deleted file mode 100644 index 3fe89ac..0000000 --- a/more-than-4-cpus.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 9f6a52fa2b1a9e423808959a2ce7fea37f67656c Mon Sep 17 00:00:00 2001 -From: Marc-Antoine Perennou -Date: Fri, 25 Mar 2011 18:11:21 +0100 -Subject: [PATCH] Temporary workaround for CPU with more than 4 cores - -We do not provide colors after cpu-color3 in the schema -Use only the 4 colors from the scheme for now ---- - src/callbacks.cpp | 2 +- - src/procman.cpp | 4 ++-- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/callbacks.cpp b/src/callbacks.cpp -index 88d1f3d..7c7e6e3 100644 ---- a/src/callbacks.cpp -+++ b/src/callbacks.cpp -@@ -235,7 +235,7 @@ cb_cpu_color_changed (GSMColorButton *cp, gpointer data) - gint i = GPOINTER_TO_INT (data); - GSettings *settings = g_settings_new (GSM_GSETTINGS_SCHEMA); - -- g_snprintf(key, sizeof key, "cpu-color%d", i); -+ g_snprintf(key, sizeof key, "cpu-color%d", i%4); - - change_settings_color(settings, key, cp); - } -diff --git a/src/procman.cpp b/src/procman.cpp -index 9b9292a..daebdc7 100644 ---- a/src/procman.cpp -+++ b/src/procman.cpp -@@ -181,7 +181,7 @@ color_changed_cb (GSettings *settings, const gchar *key, gpointer data) - - if (g_str_has_prefix (key, "cpu-color")) { - for (int i = 0; i < procdata->config.num_cpus; i++) { -- string cpu_key = make_string(g_strdup_printf("cpu-color%d", i)); -+ string cpu_key = make_string(g_strdup_printf("cpu-color%d", i%4)); - if (cpu_key == key) { - gdk_color_parse (color, &procdata->config.cpu_color[i]); - procdata->cpu_graph->colors.at(i) = procdata->config.cpu_color[i]; -@@ -279,7 +279,7 @@ procman_data_new (GSettings *settings) - - for (int i = 0; i < pd->config.num_cpus; i++) { - gchar *key; -- key = g_strdup_printf ("cpu-color%d", i); -+ key = g_strdup_printf ("cpu-color%d", i%4); - - color = g_settings_get_string (settings, key); - if (!color) --- -1.7.4.1.433.gcd306.dirty - diff --git a/polkit.patch b/polkit.patch deleted file mode 100644 index d0f4d08..0000000 --- a/polkit.patch +++ /dev/null @@ -1,1274 +0,0 @@ -diff -up gnome-system-monitor-2.28.2/configure.in.polkit gnome-system-monitor-2.28.2/configure.in ---- gnome-system-monitor-2.28.2/configure.in.polkit 2010-09-27 19:13:17.000000000 -0400 -+++ gnome-system-monitor-2.28.2/configure.in 2010-09-30 14:27:14.731603002 -0400 -@@ -35,10 +35,35 @@ GIOMM_REQUIRED=2.16.0 - GLIBMM_REQUIRED=2.14 - LIBXML_REQUIRED=2.0 - RSVG_REQUIRED=2.12 --DBUS_REQUIRED=0.7 -+POLKIT_REQUIRED=0.92 -+DBUS_GLIB_REQUIRED=0.71 -+DBUS_REQUIRED=1.1.2 - --PKG_CHECK_MODULES(PROCMAN, glib-2.0 >= $GLIB_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgtop-2.0 >= $LIBGTOP_REQUIRED libwnck-1.0 >= $LIBWNCK_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gtkmm-2.4 >= $GTKMM_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED librsvg-2.0 >= $RSVG_REQUIRED glibmm-2.4 >= $GLIBMM_REQUIRED giomm-2.4 >= $GIOMM_REQUIRED dbus-glib-1 >= $DBUS_REQUIRED) - -+PKG_CHECK_MODULES(PROCMAN, glib-2.0 >= $GLIB_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgtop-2.0 >= $LIBGTOP_REQUIRED libwnck-1.0 >= $LIBWNCK_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gtkmm-2.4 >= $GTKMM_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED librsvg-2.0 >= $RSVG_REQUIRED glibmm-2.4 >= $GLIBMM_REQUIRED giomm-2.4 >= $GIOMM_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED) -+ -+# PolicyKit detection; defaults to 'auto' (use it if it's available) -+# -+POLKIT_CFLAGS= -+POLKIT_LIBS= -+AC_ARG_ENABLE(polkit, AS_HELP_STRING([--enable-polkit],[Enable PolicyKit support (auto)]),enable_polkit=$enableval,enable_polkit=auto) -+if test "x$enable_polkit" = "xno" ; then -+ HAVE_POLKIT=no -+else -+ HAVE_POLKIT=no -+ PKG_CHECK_MODULES(POLKIT, polkit-gobject-1 >= $POLKIT_REQUIRED dbus-1 >= $DBUS_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED gobject-2.0, HAVE_POLKIT=yes, HAVE_POLKIT=no) -+ -+ if test "x$enable_polkit" = "xyes" -a "x$HAVE_POLKIT" = "xno" ; then -+ AC_MSG_ERROR(PolicyKit support explicity enabled but not available) -+ fi -+ -+ if test "x$HAVE_POLKIT" = "xyes" ; then -+ AC_DEFINE(HAVE_POLKIT, 1, [Defined if PolicyKit support is enabled]) -+ fi -+fi -+AM_CONDITIONAL(HAVE_POLKIT, test "x$HAVE_POLKIT" = "xyes") -+AC_SUBST(POLKIT_CFLAGS) -+AC_SUBST(POLKIT_LIBS) - - AC_ARG_ENABLE(more-warnings, - [AC_HELP_STRING([--enable-more-warnings], [Maximum compiler warnings])], -@@ -98,6 +123,7 @@ Configuration: - C++ Compiler: ${CXX} - CFLAGS: ${CFLAGS} - CXXFLAGS: ${CXXFLAGS} -+ PolicyKit support: ${HAVE_POLKIT} - Maintainer mode: ${USER_MAINTAINER_MODE} - Languages: ${ALL_LINGUAS} - " -diff -up gnome-system-monitor-2.28.2/po/POTFILES.in.polkit gnome-system-monitor-2.28.2/po/POTFILES.in ---- gnome-system-monitor-2.28.2/po/POTFILES.in.polkit 2010-02-09 08:23:26.000000000 -0500 -+++ gnome-system-monitor-2.28.2/po/POTFILES.in 2010-09-30 14:27:14.732603002 -0400 -@@ -8,6 +8,7 @@ src/callbacks.cpp - src/defaulttable.h - src/disks.cpp - src/e_date.c -+src/gnome-system-monitor.policy.in - src/gnome-system-monitor.schemas.in - src/gsm_color_button.c - src/interface.cpp -diff -up gnome-system-monitor-2.28.2/src/gnome-system-monitor-mechanism.c.polkit gnome-system-monitor-2.28.2/src/gnome-system-monitor-mechanism.c ---- gnome-system-monitor-2.28.2/src/gnome-system-monitor-mechanism.c.polkit 2010-09-30 14:27:14.734603002 -0400 -+++ gnome-system-monitor-2.28.2/src/gnome-system-monitor-mechanism.c 2010-09-30 14:27:14.734603002 -0400 -@@ -0,0 +1,592 @@ -+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- -+ * -+ * Copyright (C) 2007 David Zeuthen -+ * -+ * 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 of the License, 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. -+ * -+ */ -+ -+#ifdef HAVE_CONFIG_H -+# include "config.h" -+#endif -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static gboolean no_exit = FALSE; -+ -+/*--------------------------------------------------------------------------------------------------------------*/ -+ -+#define GNOME_SYSTEM_MONITOR_TYPE_MECHANISM (gnome_system_monitor_mechanism_get_type ()) -+#define GNOME_SYSTEM_MONITOR_MECHANISM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNOME_SYSTEM_MONITOR_TYPE_MECHANISM, GnomeSystemMonitorMechanism)) -+#define GNOME_SYSTEM_MONITOR_MECHANISM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GNOME_SYSTEM_MONITOR_TYPE_MECHANISM, GnomeSystemMonitorMechanismClass)) -+#define GNOME_SYSTEM_MONITOR_IS_MECHANISM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNOME_SYSTEM_MONITOR_TYPE_MECHANISM)) -+#define GNOME_SYSTEM_MONITOR_IS_MECHANISM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNOME_SYSTEM_MONITOR_TYPE_MECHANISM)) -+#define GNOME_SYSTEM_MONITOR_MECHANISM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNOME_SYSTEM_MONITOR_TYPE_MECHANISM, GnomeSystemMonitorMechanismClass)) -+ -+typedef struct GnomeSystemMonitorMechanismPrivate GnomeSystemMonitorMechanismPrivate; -+ -+typedef struct -+{ -+ GObject parent; -+ GnomeSystemMonitorMechanismPrivate *priv; -+} GnomeSystemMonitorMechanism; -+ -+typedef struct -+{ -+ GObjectClass parent_class; -+} GnomeSystemMonitorMechanismClass; -+ -+typedef enum -+{ -+ GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_GENERAL, -+ GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_NOT_PRIVILEGED, -+ GNOME_SYSTEM_MONITOR_MECHANISM_NUM_ERRORS -+} GnomeSystemMonitorMechanismError; -+ -+#define GNOME_SYSTEM_MONITOR_MECHANISM_ERROR gnome_system_monitor_mechanism_error_quark () -+ -+GType gnome_system_monitor_mechanism_error_get_type (void); -+#define GNOME_SYSTEM_MONITOR_MECHANISM_TYPE_ERROR (gnome_system_monitor_mechanism_error_get_type ()) -+ -+ -+GQuark gnome_system_monitor_mechanism_error_quark (void); -+GType gnome_system_monitor_mechanism_get_type (void); -+GnomeSystemMonitorMechanism *gnome_system_monitor_mechanism_new (void); -+ -+/* exported methods */ -+gboolean gnome_system_monitor_mechanism_kill (GnomeSystemMonitorMechanism *mechanism, -+ int pid, -+ int sig, -+ DBusGMethodInvocation *context); -+ -+gboolean gnome_system_monitor_mechanism_renice (GnomeSystemMonitorMechanism *mechanism, -+ int pid, -+ int nice_value, -+ DBusGMethodInvocation *context); -+ -+/*--------------------------------------------------------------------------------------------------------------*/ -+#include "gnome-system-monitor-mechanism-glue.h" -+ -+static gboolean -+do_exit (gpointer user_data) -+{ -+ g_debug ("Exiting due to inactivity"); -+ exit (1); -+ return FALSE; -+} -+ -+static void -+reset_killtimer (void) -+{ -+ static guint timer_id = 0; -+ -+ if (no_exit) -+ return; -+ -+ if (timer_id > 0) { -+ g_source_remove (timer_id); -+ } -+ g_debug ("Setting killtimer to 30 seconds..."); -+ timer_id = g_timeout_add (30 * 1000, do_exit, NULL); -+} -+ -+struct GnomeSystemMonitorMechanismPrivate -+{ -+ DBusGConnection *system_bus_connection; -+ DBusGProxy *system_bus_proxy; -+ PolkitAuthority *pol_ctx; -+}; -+ -+static void gnome_system_monitor_mechanism_class_init (GnomeSystemMonitorMechanismClass *klass); -+static void gnome_system_monitor_mechanism_init (GnomeSystemMonitorMechanism *seat); -+static void gnome_system_monitor_mechanism_finalize (GObject *object); -+ -+G_DEFINE_TYPE (GnomeSystemMonitorMechanism, gnome_system_monitor_mechanism, G_TYPE_OBJECT) -+ -+#define GNOME_SYSTEM_MONITOR_MECHANISM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNOME_SYSTEM_MONITOR_TYPE_MECHANISM, GnomeSystemMonitorMechanismPrivate)) -+ -+GQuark -+gnome_system_monitor_mechanism_error_quark (void) -+{ -+ static GQuark ret = 0; -+ -+ if (ret == 0) { -+ ret = g_quark_from_static_string ("gnome_system_monitor_mechanism_error"); -+ } -+ -+ return ret; -+} -+ -+ -+#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC } -+ -+GType -+gnome_system_monitor_mechanism_error_get_type (void) -+{ -+ static GType etype = 0; -+ -+ if (etype == 0) -+ { -+ static const GEnumValue values[] = -+ { -+ ENUM_ENTRY (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_GENERAL, "GeneralError"), -+ ENUM_ENTRY (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_NOT_PRIVILEGED, "NotPrivileged"), -+ { 0, 0, 0 } -+ }; -+ -+ g_assert (GNOME_SYSTEM_MONITOR_MECHANISM_NUM_ERRORS == G_N_ELEMENTS (values) - 1); -+ -+ etype = g_enum_register_static ("GnomeSystemMonitorMechanismError", values); -+ } -+ -+ return etype; -+} -+ -+ -+static GObject * -+gnome_system_monitor_mechanism_constructor (GType type, -+ guint n_construct_properties, -+ GObjectConstructParam *construct_properties) -+{ -+ GnomeSystemMonitorMechanism *mechanism; -+ GnomeSystemMonitorMechanismClass *klass; -+ -+ klass = GNOME_SYSTEM_MONITOR_MECHANISM_CLASS (g_type_class_peek (GNOME_SYSTEM_MONITOR_TYPE_MECHANISM)); -+ -+ mechanism = GNOME_SYSTEM_MONITOR_MECHANISM ( -+ G_OBJECT_CLASS (gnome_system_monitor_mechanism_parent_class)->constructor (type, -+ n_construct_properties, -+ construct_properties)); -+ -+ return G_OBJECT (mechanism); -+} -+ -+static void -+gnome_system_monitor_mechanism_class_init (GnomeSystemMonitorMechanismClass *klass) -+{ -+ GObjectClass *object_class = G_OBJECT_CLASS (klass); -+ -+ object_class->constructor = gnome_system_monitor_mechanism_constructor; -+ object_class->finalize = gnome_system_monitor_mechanism_finalize; -+ -+ g_type_class_add_private (klass, sizeof (GnomeSystemMonitorMechanismPrivate)); -+ -+ dbus_g_object_type_install_info (GNOME_SYSTEM_MONITOR_TYPE_MECHANISM, &dbus_glib_gnome_system_monitor_mechanism_object_info); -+ -+ dbus_g_error_domain_register (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR, NULL, GNOME_SYSTEM_MONITOR_MECHANISM_TYPE_ERROR); -+ -+} -+ -+static void -+gnome_system_monitor_mechanism_init (GnomeSystemMonitorMechanism *mechanism) -+{ -+ mechanism->priv = GNOME_SYSTEM_MONITOR_MECHANISM_GET_PRIVATE (mechanism); -+ -+} -+ -+static void -+gnome_system_monitor_mechanism_finalize (GObject *object) -+{ -+ GnomeSystemMonitorMechanism *mechanism; -+ -+ g_return_if_fail (object != NULL); -+ g_return_if_fail (GNOME_SYSTEM_MONITOR_IS_MECHANISM (object)); -+ -+ mechanism = GNOME_SYSTEM_MONITOR_MECHANISM (object); -+ -+ g_return_if_fail (mechanism->priv != NULL); -+ -+ g_object_unref (mechanism->priv->system_bus_proxy); -+ -+ G_OBJECT_CLASS (gnome_system_monitor_mechanism_parent_class)->finalize (object); -+} -+ -+static gboolean -+register_mechanism (GnomeSystemMonitorMechanism *mechanism) -+{ -+ GError *error = NULL; -+ -+ mechanism->priv->pol_ctx = polkit_authority_get (); -+ -+ error = NULL; -+ mechanism->priv->system_bus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); -+ if (mechanism->priv->system_bus_connection == NULL) { -+ if (error != NULL) { -+ g_critical ("error getting system bus: %s", error->message); -+ g_error_free (error); -+ } -+ goto error; -+ } -+ -+ dbus_g_connection_register_g_object (mechanism->priv->system_bus_connection, "/", -+ G_OBJECT (mechanism)); -+ -+ mechanism->priv->system_bus_proxy = dbus_g_proxy_new_for_name (mechanism->priv->system_bus_connection, -+ DBUS_SERVICE_DBUS, -+ DBUS_PATH_DBUS, -+ DBUS_INTERFACE_DBUS); -+ -+ reset_killtimer (); -+ -+ return TRUE; -+ -+error: -+ return FALSE; -+} -+ -+ -+GnomeSystemMonitorMechanism * -+gnome_system_monitor_mechanism_new (void) -+{ -+ GObject *object; -+ gboolean res; -+ -+ object = g_object_new (GNOME_SYSTEM_MONITOR_TYPE_MECHANISM, NULL); -+ -+ res = register_mechanism (GNOME_SYSTEM_MONITOR_MECHANISM (object)); -+ if (! res) { -+ g_object_unref (object); -+ return NULL; -+ } -+ -+ return GNOME_SYSTEM_MONITOR_MECHANISM (object); -+} -+ -+static PolkitSubject * -+get_caller_from_context (GnomeSystemMonitorMechanism *mechanism, DBusGMethodInvocation *context) -+{ -+ char *sender; -+ PolkitSubject *pk_caller; -+ -+ sender = dbus_g_method_get_sender (context); -+ pk_caller = polkit_system_bus_name_new (sender); -+ g_free (sender); -+ -+ return pk_caller; -+} -+ -+/* note, we take ownership of the passed PolkitSubject object */ -+static gboolean -+_check_polkit_for_action_for_caller (GnomeSystemMonitorMechanism *mechanism, -+ DBusGMethodInvocation *context, -+ PolkitSubject *subject, -+ const char *action) -+{ -+ GError *error; -+ PolkitAuthorizationResult *result; -+ -+ error = NULL; -+ -+ result = polkit_authority_check_authorization_sync (mechanism->priv->pol_ctx, -+ subject, -+ action, -+ NULL, -+ POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION, -+ NULL, NULL); -+ g_object_unref (subject); -+ -+ if (!polkit_authorization_result_get_is_authorized (result)) { -+ error = g_error_new (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR, -+ GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_NOT_PRIVILEGED, -+ "%s", -+ action); -+ dbus_g_method_return_error (context, error); -+ g_error_free (error); -+ g_object_unref (result); -+ return FALSE; -+ } -+ -+ g_object_unref (result); -+ return TRUE; -+} -+ -+static gboolean -+_check_polkit_for_action (GnomeSystemMonitorMechanism *mechanism, -+ DBusGMethodInvocation *context, -+ const char *action) -+{ -+ PolkitSubject *subject; -+ -+ /* Check that caller is privileged */ -+ if ((subject = get_caller_from_context (mechanism, context)) == NULL) -+ return FALSE; -+ -+ return _check_polkit_for_action_for_caller (mechanism, context, subject, action); -+} -+ -+/*--------------------------------------------------------------------------------------------------------------*/ -+/* exported methods */ -+ -+gboolean -+gnome_system_monitor_mechanism_kill (GnomeSystemMonitorMechanism *mechanism, -+ int pid, -+ int sig, -+ DBusGMethodInvocation *context) -+{ -+ reset_killtimer (); -+ -+ if (!_check_polkit_for_action (mechanism, context, "org.gnome.system-monitor.kill")) -+ return FALSE; -+ -+ g_debug ("Sending signal %d to pid %d", sig, pid); -+ -+ if (kill (pid, sig) != 0) { -+ GError *error; -+ error = g_error_new (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR, -+ GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_GENERAL, -+ "Error sending signal %d to pid %d: %m", sig, pid); -+ g_warning ("Error: %s", error->message); -+ dbus_g_method_return_error (context, error); -+ g_error_free (error); -+ return FALSE; -+ } -+ -+ dbus_g_method_return (context); -+ return TRUE; -+} -+ -+static gboolean -+get_uid_from_context (GnomeSystemMonitorMechanism *mechanism, -+ DBusGMethodInvocation *context, -+ uid_t *uid) -+{ -+ char *sender; -+ DBusConnection *con; -+ -+ con = dbus_g_connection_get_connection (dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL)); -+ if (con == NULL) -+ return FALSE; -+ -+ sender = dbus_g_method_get_sender (context); -+ *uid = dbus_bus_get_unix_user (con, sender, NULL); -+ g_free (sender); -+ -+ if (*uid == (unsigned)-1) -+ return FALSE; -+ -+ return TRUE; -+} -+ -+gboolean -+gnome_system_monitor_mechanism_renice (GnomeSystemMonitorMechanism *mechanism, -+ int pid, -+ int nice_value, -+ DBusGMethodInvocation *context) -+{ -+ uid_t caller_uid; -+ uid_t process_uid; -+ PolkitSubject *subject; -+ char *procpath; -+ struct stat statbuf; -+ const char *action_id; -+ -+ reset_killtimer (); -+ -+ /* Hmm; is there a better way to do this? This may be Linux specific.. */ -+ procpath = g_strdup_printf ("/proc/%d", pid); -+ if (stat (procpath, &statbuf) != 0) { -+ GError *error; -+ error = g_error_new (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR, -+ GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_GENERAL, -+ "Error figuring out uid for pid %d", pid); -+ g_warning ("Error: %s", error->message); -+ dbus_g_method_return_error (context, error); -+ g_error_free (error); -+ g_free (procpath); -+ return FALSE; -+ } -+ g_free (procpath); -+ process_uid = statbuf.st_uid; -+ -+ subject = get_caller_from_context (mechanism, context); -+ if (subject == NULL) -+ return FALSE; -+ -+ if (!get_uid_from_context (mechanism, context, &caller_uid)) { -+ GError *error; -+ error = g_error_new (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR, -+ GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_GENERAL, -+ "Error figuring out uid of caller"); -+ g_warning ("Error: %s", error->message); -+ dbus_g_method_return_error (context, error); -+ g_error_free (error); -+ g_object_unref (subject); -+ return FALSE; -+ } -+ -+ if (caller_uid == process_uid) { -+ action_id = "org.gnome.system-monitor.increase-own-priority"; -+ } else { -+ action_id = "org.gnome.system-monitor.change-priority"; -+ } -+ -+ if (!_check_polkit_for_action_for_caller (mechanism, context, subject, action_id)) { -+ return FALSE; -+ } -+ -+ g_debug ("Renicing pid %d (owned by uid %d) to priority %d on behalf of uid %d (action_id=%s)", -+ pid, process_uid, nice_value, caller_uid, action_id); -+ -+ errno = 0; -+ if (setpriority (PRIO_PROCESS, pid, nice_value) != 0) { -+ GError *error; -+ error = g_error_new (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR, -+ GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_GENERAL, -+ "Error renicing pid %d to priority %d: %m", pid, nice_value); -+ g_warning ("Error: %s", error->message); -+ dbus_g_method_return_error (context, error); -+ g_error_free (error); -+ return FALSE; -+ } -+ -+ dbus_g_method_return (context); -+ return TRUE; -+} -+ -+/*--------------------------------------------------------------------------------------------------------------*/ -+ -+#define BUS_NAME "org.gnome.SystemMonitor.Mechanism" -+ -+static gboolean -+acquire_name_on_proxy (DBusGProxy *bus_proxy) -+{ -+ GError *error; -+ guint result; -+ gboolean res; -+ gboolean ret; -+ -+ ret = FALSE; -+ -+ if (bus_proxy == NULL) { -+ goto out; -+ } -+ -+ error = NULL; -+ res = dbus_g_proxy_call (bus_proxy, -+ "RequestName", -+ &error, -+ G_TYPE_STRING, BUS_NAME, -+ G_TYPE_UINT, 0, -+ G_TYPE_INVALID, -+ G_TYPE_UINT, &result, -+ G_TYPE_INVALID); -+ if (! res) { -+ if (error != NULL) { -+ g_warning ("Failed to acquire %s: %s", BUS_NAME, error->message); -+ g_error_free (error); -+ } else { -+ g_warning ("Failed to acquire %s", BUS_NAME); -+ } -+ goto out; -+ } -+ -+ if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { -+ if (error != NULL) { -+ g_warning ("Failed to acquire %s: %s", BUS_NAME, error->message); -+ g_error_free (error); -+ } else { -+ g_warning ("Failed to acquire %s", BUS_NAME); -+ } -+ goto out; -+ } -+ -+ ret = TRUE; -+ -+ out: -+ return ret; -+} -+ -+int -+main (int argc, char **argv) -+{ -+ GMainLoop *loop; -+ GnomeSystemMonitorMechanism *mechanism; -+ DBusGProxy *bus_proxy; -+ DBusGConnection *connection; -+ int ret; -+ GError *error; -+ GOptionContext *context; -+ static GOptionEntry entries [] = { -+ { "no-exit", 0, 0, G_OPTION_ARG_NONE, &no_exit, N_("Don't exit after 30 seconds of inactivity"), NULL }, -+ { NULL } -+ }; -+ -+ ret = 1; -+ -+ g_type_init (); -+ -+ context = g_option_context_new (_("PolicyKit GNOME session daemon")); -+ g_option_context_add_main_entries (context, entries, NULL); -+ g_option_context_parse (context, &argc, &argv, NULL); -+ g_option_context_free (context); -+ -+ -+ error = NULL; -+ connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); -+ if (connection == NULL) { -+ g_warning ("Couldn't connect to system bus: %s", error->message); -+ g_error_free (error); -+ goto out; -+ } -+ -+ bus_proxy = dbus_g_proxy_new_for_name (connection, -+ DBUS_SERVICE_DBUS, -+ DBUS_PATH_DBUS, -+ DBUS_INTERFACE_DBUS); -+ if (bus_proxy == NULL) { -+ g_warning ("Could not construct bus_proxy object; bailing out"); -+ goto out; -+ } -+ -+ if (!acquire_name_on_proxy (bus_proxy) ) { -+ g_warning ("Could not acquire name; bailing out"); -+ goto out; -+ } -+ -+ mechanism = gnome_system_monitor_mechanism_new (); -+ -+ if (mechanism == NULL) { -+ goto out; -+ } -+ -+ loop = g_main_loop_new (NULL, FALSE); -+ -+ g_main_loop_run (loop); -+ -+ g_object_unref (mechanism); -+ g_main_loop_unref (loop); -+ ret = 0; -+ -+out: -+ return ret; -+} -diff -up gnome-system-monitor-2.28.2/src/gnome-system-monitor-mechanism.xml.polkit gnome-system-monitor-2.28.2/src/gnome-system-monitor-mechanism.xml ---- gnome-system-monitor-2.28.2/src/gnome-system-monitor-mechanism.xml.polkit 2010-09-30 14:27:14.735603002 -0400 -+++ gnome-system-monitor-2.28.2/src/gnome-system-monitor-mechanism.xml 2010-09-30 14:27:14.735603002 -0400 -@@ -0,0 +1,15 @@ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff -up gnome-system-monitor-2.28.2/src/interface.cpp.polkit gnome-system-monitor-2.28.2/src/interface.cpp ---- gnome-system-monitor-2.28.2/src/interface.cpp.polkit 2010-02-09 08:23:26.000000000 -0500 -+++ gnome-system-monitor-2.28.2/src/interface.cpp 2010-09-30 14:27:14.737603002 -0400 -@@ -30,6 +30,10 @@ - #include - #include - -+#ifdef HAVE_POLKIT -+# include -+#endif -+ - #include "procman.h" - #include "callbacks.h" - #include "interface.h" -@@ -58,6 +62,7 @@ static const GtkActionEntry menu_entries - N_("Quit the program"), G_CALLBACK (cb_app_exit) }, - - -+#ifndef HAVE_POLKIT - { "StopProcess", NULL, N_("_Stop Process"), "S", - N_("Stop process"), G_CALLBACK(cb_kill_sigstop) }, - { "ContProcess", NULL, N_("_Continue Process"), "C", -@@ -67,6 +72,7 @@ static const GtkActionEntry menu_entries - N_("Force process to finish normally"), G_CALLBACK (cb_end_process) }, - { "KillProcess", NULL, N_("_Kill Process"), "K", - N_("Force process to finish immediately"), G_CALLBACK (cb_kill_process) }, -+#endif - { "ChangePriority", NULL, N_("_Change Priority..."), "N", - N_("Change the order of priority of process"), G_CALLBACK (cb_renice) }, - { "Preferences", GTK_STOCK_PREFERENCES, NULL, NULL, -@@ -186,10 +192,16 @@ create_proc_view (ProcData *procdata) - hbox2 = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, FALSE, 0); - -+#ifdef HAVE_POLKIT -+ procdata->endprocessbutton = gtk_button_new (); -+ gtk_activatable_set_related_action (GTK_ACTIVATABLE (procdata->endprocessbutton), -+ procdata->sigterm_action); -+#else - procdata->endprocessbutton = gtk_button_new_with_mnemonic (_("End _Process")); -- gtk_box_pack_end (GTK_BOX (hbox2), procdata->endprocessbutton, FALSE, FALSE, 0); - g_signal_connect (G_OBJECT (procdata->endprocessbutton), "clicked", - G_CALLBACK (cb_end_process_button_pressed), procdata); -+#endif -+ gtk_box_pack_end (GTK_BOX (hbox2), procdata->endprocessbutton, FALSE, FALSE, 0); - - - /* create popup_menu */ -@@ -670,6 +682,41 @@ create_main_window (ProcData *procdata) - G_CALLBACK(cb_radio_processes), - procdata); - -+#ifdef HAVE_POLKIT -+ procdata->sigstop_action = gtk_action_new ("StopProcess", -+ _("_Stop Process"), -+ _("Stop process"), -+ NULL); -+ g_signal_connect (procdata->sigstop_action, "activate", G_CALLBACK (cb_kill_sigstop), procdata); -+ gtk_action_group_add_action_with_accel (procdata->action_group, -+ GTK_ACTION (procdata->sigstop_action), -+ "S"); -+ -+ procdata->sigcont_action = gtk_action_new ("ContProcess", -+ _("_Continue Process"), -+ _("Continue process"), -+ NULL); -+ g_signal_connect (procdata->sigcont_action, "activate", G_CALLBACK (cb_kill_sigcont), procdata); -+ gtk_action_group_add_action_with_accel (procdata->action_group, GTK_ACTION (procdata->sigcont_action), -+ "C"); -+ -+ procdata->sigterm_action = gtk_action_new ("EndProcess", -+ _("End _Process"), -+ _("Force process to finish normally"), -+ NULL); -+ g_signal_connect (procdata->sigterm_action, "activate", G_CALLBACK (cb_end_process), procdata); -+ gtk_action_group_add_action_with_accel (procdata->action_group, GTK_ACTION (procdata->sigterm_action), -+ "E"); -+ -+ procdata->sigkill_action = gtk_action_new ("KillProcess", -+ _("_Kill Process"), -+ _("Force process to finish immediately"), -+ NULL); -+ g_signal_connect (procdata->sigkill_action, "activate", G_CALLBACK (cb_kill_process), procdata); -+ gtk_action_group_add_action_with_accel (procdata->action_group, GTK_ACTION (procdata->sigkill_action), -+ "K"); -+#endif -+ - gtk_ui_manager_insert_action_group (procdata->uimanager, - procdata->action_group, - 0); -@@ -677,7 +724,6 @@ create_main_window (ProcData *procdata) - menubar = gtk_ui_manager_get_widget (procdata->uimanager, "/MenuBar"); - gtk_box_pack_start (GTK_BOX (main_box), menubar, FALSE, FALSE, 0); - -- - /* create the main notebook */ - procdata->notebook = notebook = gtk_notebook_new (); - gtk_box_pack_start (GTK_BOX (main_box), -@@ -774,23 +820,26 @@ update_sensitivity(ProcData *data) - processes_sensitivity = (data->config.current_tab == PROCMAN_TAB_PROCESSES); - selected_sensitivity = (processes_sensitivity && data->selected_process != NULL); - -+#ifndef HAVE_POLKIT - if(data->endprocessbutton) { - /* avoid error on startup if endprocessbutton - has not been built yet */ - gtk_widget_set_sensitive(data->endprocessbutton, selected_sensitivity); - } -+#endif - - for (i = 0; i != G_N_ELEMENTS(processes_actions); ++i) { - action = gtk_action_group_get_action(data->action_group, - processes_actions[i]); -- gtk_action_set_sensitive(action, processes_sensitivity); -+ gtk_action_set_sensitive(action, selected_sensitivity); - } - - for (i = 0; i != G_N_ELEMENTS(selected_actions); ++i) { - action = gtk_action_group_get_action(data->action_group, - selected_actions[i]); -- gtk_action_set_sensitive(action, selected_sensitivity); -+ gtk_action_set_sensitive(action, processes_sensitivity); - } -+ - } - - static void -diff -up gnome-system-monitor-2.28.2/src/Makefile.am.polkit gnome-system-monitor-2.28.2/src/Makefile.am ---- gnome-system-monitor-2.28.2/src/Makefile.am.polkit 2010-02-09 08:23:26.000000000 -0500 -+++ gnome-system-monitor-2.28.2/src/Makefile.am 2010-09-30 14:27:14.739603002 -0400 -@@ -4,7 +4,9 @@ INCLUDES = \ - -DPROCMAN_DATADIR=\""$(datadir)/procman/"\" \ - -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ - -DDATADIR=\""$(datadir)"\" \ -- @PROCMAN_CFLAGS@ -+ @PROCMAN_CFLAGS@ \ -+ @POLKIT_CFLAGS@ \ -+ @POLKIT_CFLAGS@ - - bin_PROGRAMS = gnome-system-monitor - -@@ -35,8 +37,11 @@ gnome_system_monitor_SOURCES = \ - e_date.c e_date.h \ - gsm_color_button.c gsm_color_button.h - -+if HAVE_POLKIT -+gnome_system_monitor_SOURCES += gnome-system-monitor-mechanism-client-glue.h -+endif - --gnome_system_monitor_LDADD = @PROCMAN_LIBS@ libbacon.la -+gnome_system_monitor_LDADD = @PROCMAN_LIBS@ @POLKIT_LIBS@ libbacon.la - - - noinst_LTLIBRARIES = libbacon.la -@@ -52,8 +57,44 @@ schema_ins = gnome-system-monitor.schem - schema_DATA = $(schema_ins:.schemas.in=.schemas) - @INTLTOOL_SCHEMAS_RULE@ - -+###################################################################### -+if HAVE_POLKIT -+ -+polkit_policydir = $(datadir)/polkit-1/actions -+dist_polkit_policy_DATA = org.gnome.system-monitor.policy -+# You will need a recent intltool or the patch from this bug http://bugzilla.gnome.org/show_bug.cgi?id=462312 -+@INTLTOOL_POLICY_RULE@ -+ -+gnome-system-monitor-mechanism-client-glue.h: gnome-system-monitor-mechanism.xml Makefile.am -+ dbus-binding-tool --prefix=gnome_system_monitor_mechanism --mode=glib-client --output=gnome-system-monitor-mechanism-client-glue.h gnome-system-monitor-mechanism.xml -+ -+gnome-system-monitor-mechanism-glue.h: gnome-system-monitor-mechanism.xml Makefile.am -+ dbus-binding-tool --prefix=gnome_system_monitor_mechanism --mode=glib-server --output=gnome-system-monitor-mechanism-glue.h gnome-system-monitor-mechanism.xml -+ -+dbusconfdir = $(sysconfdir)/dbus-1/system.d -+dbusconf_DATA = org.gnome.SystemMonitor.Mechanism.conf -+ -+org.gnome.SystemMonitor.Mechanism.service : org.gnome.SystemMonitor.Mechanism.service.in Makefile.am -+ sed -e s_libexecdir_$(libexecdir)_ org.gnome.SystemMonitor.Mechanism.service.in > org.gnome.SystemMonitor.Mechanism.service -+ -+dbussyssvcdir = $(datadir)/dbus-1/system-services -+dbussyssvc_DATA = org.gnome.SystemMonitor.Mechanism.service -+ -+libexec_PROGRAMS = gnome-system-monitor-mechanism -+gnome_system_monitor_mechanism_SOURCES = \ -+ gnome-system-monitor-mechanism-glue.h \ -+ gnome-system-monitor-mechanism.c -+ -+gnome_system_monitor_mechanism_CFLAGS = $(POLKIT_CFLAGS) -+gnome_system_monitor_mechanism_LDADD = $(POLKIT_LIBS) -+endif -+###################################################################### -+ -+ - EXTRA_DIST = \ -- $(schema_ins) -+ $(schema_ins) \ -+ org.gnome.system-monitor.policy.in \ -+ org.gnome.system-monitor.service.in - - CLEANFILES = \ - $(schema_DATA) -diff -up gnome-system-monitor-2.28.2/src/org.gnome.SystemMonitor.Mechanism.conf.polkit gnome-system-monitor-2.28.2/src/org.gnome.SystemMonitor.Mechanism.conf ---- gnome-system-monitor-2.28.2/src/org.gnome.SystemMonitor.Mechanism.conf.polkit 2010-09-30 14:27:14.740603002 -0400 -+++ gnome-system-monitor-2.28.2/src/org.gnome.SystemMonitor.Mechanism.conf 2010-09-30 14:27:14.740603002 -0400 -@@ -0,0 +1,15 @@ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff -up gnome-system-monitor-2.28.2/src/org.gnome.SystemMonitor.Mechanism.service.in.polkit gnome-system-monitor-2.28.2/src/org.gnome.SystemMonitor.Mechanism.service.in ---- gnome-system-monitor-2.28.2/src/org.gnome.SystemMonitor.Mechanism.service.in.polkit 2010-09-30 14:27:14.741603002 -0400 -+++ gnome-system-monitor-2.28.2/src/org.gnome.SystemMonitor.Mechanism.service.in 2010-09-30 14:27:14.741603002 -0400 -@@ -0,0 +1,4 @@ -+[D-BUS Service] -+Name=org.gnome.SystemMonitor.Mechanism -+Exec=libexecdir/gnome-system-monitor-mechanism -+User=root -diff -up gnome-system-monitor-2.28.2/src/org.gnome.system-monitor.policy.in.polkit gnome-system-monitor-2.28.2/src/org.gnome.system-monitor.policy.in ---- gnome-system-monitor-2.28.2/src/org.gnome.system-monitor.policy.in.polkit 2010-09-30 14:27:14.742603002 -0400 -+++ gnome-system-monitor-2.28.2/src/org.gnome.system-monitor.policy.in 2010-09-30 14:27:14.743603002 -0400 -@@ -0,0 +1,50 @@ -+ -+ -+ -+ -+ -+ -+ -+ -+ The GNOME Project -+ http://online.gnome.org/application?id=gnome-system-monitor -+ utilities-system-monitor -+ -+ -+ <_description>Change priority of a process owned by another user -+ <_message>Changing the priority of a process owned by another user requires privileges -+ -+ no -+ auth_admin -+ -+ -+ -+ -+ <_description>Increase the priority of a processes -+ <_message>Increasing the priority of one of your own processes requires privileges -+ -+ no -+ auth_self_keep -+ -+ -+ -+ -+ <_description>Kill a process owned by another user -+ <_message>Killing a process owned by another user requires privileges -+ -+ no -+ auth_admin -+ -+ -+ -+ -diff -up gnome-system-monitor-2.28.2/src/procactions.cpp.polkit gnome-system-monitor-2.28.2/src/procactions.cpp ---- gnome-system-monitor-2.28.2/src/procactions.cpp.polkit 2010-02-09 08:23:26.000000000 -0500 -+++ gnome-system-monitor-2.28.2/src/procactions.cpp 2010-09-30 14:27:14.744603002 -0400 -@@ -31,6 +31,10 @@ - #include "procdialogs.h" - #include "callbacks.h" - -+#ifdef HAVE_POLKIT -+# include "gnome-system-monitor-mechanism-client-glue.h" -+# include -+#endif - - static void - renice_single_process (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) -@@ -48,6 +52,10 @@ renice_single_process (GtkTreeModel *mod - if (!info) - return; - -+ /* docs for getpriority suggest clearing errno before the call -+ * since -1 is a legitimate return value */ -+ errno = 0; -+ - error = setpriority (PRIO_PROCESS, info->pid, args->nice_value); - - /* success */ -@@ -55,6 +63,28 @@ renice_single_process (GtkTreeModel *mod - - saved_errno = errno; - -+#ifdef HAVE_POLKIT -+ /* need to be root */ -+ if (errno == EPERM || errno == EACCES) { -+ GError *error = NULL; -+ -+ if (!org_gnome_SystemMonitor_Mechanism_renice (args->procdata->mechanism_proxy, -+ info->pid, -+ args->nice_value, -+ &error)) { -+ /* TODO: Handle "require privileges" */ -+ error_msg = g_strdup_printf ( -+ _("Cannot renice process with pid %d to nice value %d: " -+ "%s"), -+ info->pid, args->nice_value, error->message); -+ g_error_free (error); -+ } else { -+ return; -+ } -+ } else { -+ return; -+ } -+#else - /* need to be root */ - if(errno == EPERM || errno == EACCES) { - gboolean success; -@@ -69,10 +99,11 @@ renice_single_process (GtkTreeModel *mod - saved_errno = errno; - } - } -+#endif - - /* failed */ - error_msg = g_strdup_printf ( -- _("Cannot change the priority of process with pid %d to %d.\n" -+ _("Cannot change the priority of process with pid %d to %d: " - "%s"), - info->pid, args->nice_value, g_strerror(saved_errno)); - -@@ -135,6 +166,28 @@ kill_single_process (GtkTreeModel *model - - saved_errno = errno; - -+#ifdef HAVE_POLKIT -+ /* need to be root */ -+ if (errno == EPERM) { -+ GError *error = NULL; -+ -+ if (!org_gnome_SystemMonitor_Mechanism_kill (args->procdata->mechanism_proxy, -+ info->pid, -+ args->signal, -+ &error)) { -+ /* TODO: Handle "require privileges" */ -+ error_msg = g_strdup_printf ( -+ _("Cannot kill process with pid %d with signal %d.\n" -+ "%s"), -+ info->pid, args->signal, error->message); -+ g_error_free (error); -+ } else { -+ return; -+ } -+ } else { -+ return; -+ } -+#else - /* need to be root */ - if(errno == EPERM) { - gboolean success; -@@ -149,12 +202,12 @@ kill_single_process (GtkTreeModel *model - saved_errno = errno; - } - } -- - /* failed */ - error_msg = g_strdup_printf ( - _("Cannot kill process with pid %d with signal %d.\n" - "%s"), - info->pid, args->signal, g_strerror(saved_errno)); -+#endif - - dialog = gtk_message_dialog_new ( - NULL, -@@ -188,3 +241,4 @@ kill_process (ProcData *procdata, int si - procdata); - proctable_update_all (procdata); - } -+ -diff -up gnome-system-monitor-2.28.2/src/procdialogs.cpp.polkit gnome-system-monitor-2.28.2/src/procdialogs.cpp ---- gnome-system-monitor-2.28.2/src/procdialogs.cpp.polkit 2010-09-27 19:13:17.000000000 -0400 -+++ gnome-system-monitor-2.28.2/src/procdialogs.cpp 2010-09-30 14:27:49.183603015 -0400 -@@ -123,29 +123,34 @@ get_nice_level (gint nice) - return _("(Very Low Priority)"); - } - -+typedef struct { -+ GtkWidget *priority_label; -+ ProcData *procdata; -+} ReniceClosure; -+ - static void - renice_scale_changed (GtkAdjustment *adj, gpointer data) - { -- GtkWidget *label = GTK_WIDGET (data); -- -- new_nice_value = int(gtk_adjustment_get_value (adj)); -- gtk_label_set_text (GTK_LABEL (label), get_nice_level (new_nice_value)); -- -+ ReniceClosure *rc = (ReniceClosure *) data; -+ -+ new_nice_value = int(gtk_adjustment_get_value (adj)); -+ gtk_label_set_text (GTK_LABEL (rc->priority_label), get_nice_level (new_nice_value)); - } - - static void - renice_dialog_button_pressed (GtkDialog *dialog, gint id, gpointer data) - { -- ProcData *procdata = static_cast(data); -- -+ ReniceClosure *rc = (ReniceClosure *) data; -+ - if (id == 100) { - if (new_nice_value == -100) - return; -- renice(procdata, new_nice_value); -+ renice(rc->procdata, new_nice_value); - } - - gtk_widget_destroy (GTK_WIDGET (dialog)); - renice_dialog = NULL; -+ g_free (rc); - } - - void -@@ -155,7 +160,6 @@ procdialog_create_renice_dialog (ProcDat - GtkWidget *dialog = NULL; - GtkWidget *dialog_vbox; - GtkWidget *vbox; -- GtkWidget *hbox; - GtkWidget *label; - GtkWidget *priority_label; - GtkWidget *table; -@@ -163,14 +167,19 @@ procdialog_create_renice_dialog (ProcDat - GtkWidget *hscale; - GtkWidget *button; - GtkWidget *align; -+ GtkWidget *hbox; - GtkWidget *icon; - gchar *text; -+ ReniceClosure *rc; - - if (renice_dialog) - return; - - if (!info) - return; -+ -+ rc = g_new0 (ReniceClosure, 1); -+ rc->procdata = procdata; - - dialog = gtk_dialog_new_with_buttons (_("Change Priority"), NULL, - GTK_DIALOG_DESTROY_WITH_PARENT, -@@ -180,24 +189,14 @@ procdialog_create_renice_dialog (ProcDat - gtk_window_set_resizable (GTK_WINDOW (renice_dialog), FALSE); - gtk_dialog_set_has_separator (GTK_DIALOG (renice_dialog), FALSE); - gtk_container_set_border_width (GTK_CONTAINER (renice_dialog), 5); -- -- button = gtk_button_new (); -- gtk_widget_set_can_default (button, TRUE); -- -- align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); -- gtk_container_add (GTK_CONTAINER (button), align); -- -- hbox = gtk_hbox_new (FALSE, 2); -- gtk_container_add (GTK_CONTAINER (align), hbox); - -+ button = gtk_button_new_with_mnemonic (_("Change _Priority")); -+ gtk_widget_set_can_default (button, TRUE); - icon = gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON); -- gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0); -- -- label = gtk_label_new_with_mnemonic (_("Change _Priority")); -- gtk_label_set_mnemonic_widget (GTK_LABEL (label), button); -- gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0); -+ gtk_button_set_image (GTK_BUTTON (button), icon); - - gtk_dialog_add_action_widget (GTK_DIALOG (renice_dialog), button, 100); -+ - gtk_dialog_set_default_response (GTK_DIALOG (renice_dialog), 100); - new_nice_value = -100; - -@@ -238,15 +237,16 @@ procdialog_create_renice_dialog (ProcDat - gtk_label_set_use_markup (GTK_LABEL (label), TRUE); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); - g_free (text); -+ -+ rc->priority_label = priority_label; -+ new_nice_value = info->nice; - - g_signal_connect (G_OBJECT (dialog), "response", -- G_CALLBACK (renice_dialog_button_pressed), procdata); -+ G_CALLBACK (renice_dialog_button_pressed), rc); - g_signal_connect (G_OBJECT (renice_adj), "value_changed", -- G_CALLBACK (renice_scale_changed), priority_label); -+ G_CALLBACK (renice_scale_changed), rc); - - gtk_widget_show_all (dialog); -- -- - } - - static void -diff -up gnome-system-monitor-2.28.2/src/procman.cpp.polkit gnome-system-monitor-2.28.2/src/procman.cpp ---- gnome-system-monitor-2.28.2/src/procman.cpp.polkit 2010-09-27 19:13:17.000000000 -0400 -+++ gnome-system-monitor-2.28.2/src/procman.cpp 2010-09-30 14:27:14.747603002 -0400 -@@ -36,6 +36,10 @@ - #include - #include - -+#ifdef HAVE_POLKIT -+# include -+#endif -+ - #include "load-graph.h" - #include "procman.h" - #include "interface.h" -@@ -58,7 +62,25 @@ ProcData::ProcData() - disk_timeout(0), - cpu_total_time(1), - cpu_total_time_last(1) --{ } -+{ -+#ifdef HAVE_POLKIT -+ GError *error; -+ DBusGConnection *bus; -+ -+ error = NULL; -+ bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); -+ if (bus == NULL) { -+ g_warning ("Couldn't connect to system bus: %s", error->message); -+ g_error_free (error); -+ this->mechanism_proxy = NULL; -+ } else { -+ this->mechanism_proxy = dbus_g_proxy_new_for_name (bus, -+ "org.gnome.SystemMonitor.Mechanism", -+ "/", -+ "org.gnome.SystemMonitor.Mechanism"); -+ } -+#endif -+} - - - ProcData* ProcData::get_instance() -diff -up gnome-system-monitor-2.28.2/src/procman.h.polkit gnome-system-monitor-2.28.2/src/procman.h ---- gnome-system-monitor-2.28.2/src/procman.h.polkit 2010-02-09 08:23:26.000000000 -0500 -+++ gnome-system-monitor-2.28.2/src/procman.h 2010-09-30 14:27:14.748603002 -0400 -@@ -33,6 +33,10 @@ - #include - #include - -+#ifdef HAVE_POLKIT -+# include -+#endif -+ - struct ProcInfo; - struct ProcData; - struct LoadGraph; -@@ -210,6 +214,15 @@ struct ProcData - GtkWidget *app; - GtkUIManager *menu; - -+#ifdef HAVE_POLKIT -+ DBusGProxy *mechanism_proxy; -+ -+ GtkAction *sigstop_action; -+ GtkAction *sigcont_action; -+ GtkAction *sigterm_action; -+ GtkAction *sigkill_action; -+#endif -+ - unsigned frequency; - - SmoothRefresh *smooth_refresh; -@@ -230,7 +243,6 @@ gboolean procman_get_tree_state (GConfCl - - - -- - struct ReniceArgs - { - ProcData *procdata; diff --git a/polkit1.patch b/polkit1.patch deleted file mode 100644 index 47f22d8..0000000 --- a/polkit1.patch +++ /dev/null @@ -1,751 +0,0 @@ -diff -u -r gnome-system-monitor-2.26.1/configure.in hacked/configure.in ---- gnome-system-monitor-2.26.1/configure.in 2009-05-13 22:57:12.774294225 -0400 -+++ hacked/configure.in 2009-05-13 22:23:34.635013108 -0400 -@@ -35,8 +35,7 @@ - GLIBMM_REQUIRED=2.14 - LIBXML_REQUIRED=2.0 - RSVG_REQUIRED=2.12 --POLKIT_GNOME_REQUIRED=0.7 --POLKIT_DBUS_REQUIRED=0.7 -+POLKIT_REQUIRED=0.92 - DBUS_GLIB_REQUIRED=0.71 - DBUS_REQUIRED=1.1.2 - -@@ -45,16 +44,14 @@ - - # PolicyKit detection; defaults to 'auto' (use it if it's available) - # --POLKIT_GNOME_CFLAGS= --POLKIT_GNOME_LIBS= --POLKIT_DBUS_CFLAGS= --POLKIT_DBUS_LIBS= -+POLKIT_CFLAGS= -+POLKIT_LIBS= - AC_ARG_ENABLE(polkit, AS_HELP_STRING([--enable-polkit],[Enable PolicyKit support (auto)]),enable_polkit=$enableval,enable_polkit=auto) - if test "x$enable_polkit" = "xno" ; then - HAVE_POLKIT=no - else - HAVE_POLKIT=no -- PKG_CHECK_MODULES(POLKIT_GNOME, polkit-gnome >= $POLKIT_GNOME_REQUIRED dbus-1 >= $DBUS_REQUIRED, HAVE_POLKIT=yes, HAVE_POLKIT=no) -+ PKG_CHECK_MODULES(POLKIT, polkit-gobject-1 >= $POLKIT_REQUIRED dbus-1 >= $DBUS_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED gobject-2.0, HAVE_POLKIT=yes, HAVE_POLKIT=no) - - if test "x$enable_polkit" = "xyes" -a "x$HAVE_POLKIT" = "xno" ; then - AC_MSG_ERROR(PolicyKit support explicity enabled but not available) -@@ -62,14 +59,11 @@ - - if test "x$HAVE_POLKIT" = "xyes" ; then - AC_DEFINE(HAVE_POLKIT, 1, [Defined if PolicyKit support is enabled]) -- PKG_CHECK_MODULES(POLKIT_DBUS, polkit-dbus >= $POLKIT_DBUS_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED gobject-2.0) - fi - fi - AM_CONDITIONAL(HAVE_POLKIT, test "x$HAVE_POLKIT" = "xyes") --AC_SUBST(POLKIT_GNOME_CFLAGS) --AC_SUBST(POLKIT_GNOME_LIBS) --AC_SUBST(POLKIT_DBUS_CFLAGS) --AC_SUBST(POLKIT_DBUS_LIBS) -+AC_SUBST(POLKIT_CFLAGS) -+AC_SUBST(POLKIT_LIBS) - - AC_ARG_ENABLE(more-warnings, - [AC_HELP_STRING([--enable-more-warnings], [Maximum compiler warnings])], -diff -u -r gnome-system-monitor-2.26.1/src/callbacks.cpp hacked/src/callbacks.cpp ---- gnome-system-monitor-2.26.1/src/callbacks.cpp 2009-05-13 22:57:12.776261325 -0400 -+++ hacked/src/callbacks.cpp 2009-05-13 22:23:34.636012198 -0400 -@@ -210,13 +210,11 @@ - - - --#ifndef HAVE_POLKIT - void - cb_end_process_button_pressed (GtkButton *button, gpointer data) - { - kill_process_helper(static_cast(data), SIGTERM); - } --#endif - - - static void change_gconf_color(GConfClient *client, const char *key, -@@ -288,7 +286,6 @@ - ProcData * const procdata = static_cast(data); - - procdata->selection = selection; -- procdata->selected_process = NULL; - - /* get the most recent selected process and determine if there are - ** no selected processes -diff -u -r gnome-system-monitor-2.26.1/src/gnome-system-monitor-mechanism.c hacked/src/gnome-system-monitor-mechanism.c ---- gnome-system-monitor-2.26.1/src/gnome-system-monitor-mechanism.c 2009-05-13 22:57:12.777261253 -0400 -+++ hacked/src/gnome-system-monitor-mechanism.c 2009-05-13 22:30:21.357048484 -0400 -@@ -40,7 +40,7 @@ - #include - #include - #include --#include -+#include - - static gboolean no_exit = FALSE; - -@@ -124,7 +124,7 @@ - { - DBusGConnection *system_bus_connection; - DBusGProxy *system_bus_proxy; -- PolKitContext *pol_ctx; -+ PolkitAuthority *pol_ctx; - }; - - static void gnome_system_monitor_mechanism_class_init (GnomeSystemMonitorMechanismClass *klass); -@@ -232,50 +232,11 @@ - } - - static gboolean --pk_io_watch_have_data (GIOChannel *channel, GIOCondition condition, gpointer user_data) --{ -- int fd; -- PolKitContext *pk_context = user_data; -- fd = g_io_channel_unix_get_fd (channel); -- polkit_context_io_func (pk_context, fd); -- return TRUE; --} -- --static int --pk_io_add_watch (PolKitContext *pk_context, int fd) --{ -- guint id = 0; -- GIOChannel *channel; -- channel = g_io_channel_unix_new (fd); -- if (channel == NULL) -- goto out; -- id = g_io_add_watch (channel, G_IO_IN, pk_io_watch_have_data, pk_context); -- if (id == 0) { -- g_io_channel_unref (channel); -- goto out; -- } -- g_io_channel_unref (channel); --out: -- return id; --} -- --static void --pk_io_remove_watch (PolKitContext *pk_context, int watch_id) --{ -- g_source_remove (watch_id); --} -- --static gboolean - register_mechanism (GnomeSystemMonitorMechanism *mechanism) - { - GError *error = NULL; - -- mechanism->priv->pol_ctx = polkit_context_new (); -- polkit_context_set_io_watch_functions (mechanism->priv->pol_ctx, pk_io_add_watch, pk_io_remove_watch); -- if (!polkit_context_init (mechanism->priv->pol_ctx, NULL)) { -- g_critical ("cannot initialize libpolkit"); -- goto error; -- } -+ mechanism->priv->pol_ctx = polkit_authority_get (); - - error = NULL; - mechanism->priv->system_bus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); -@@ -321,93 +282,66 @@ - return GNOME_SYSTEM_MONITOR_MECHANISM (object); - } - --static PolKitCaller * -+static PolkitSubject * - get_caller_from_context (GnomeSystemMonitorMechanism *mechanism, DBusGMethodInvocation *context) - { -- const char *sender; -- GError *error; -- DBusError dbus_error; -- PolKitCaller *pk_caller; -+ char *sender; -+ PolkitSubject *pk_caller; - - sender = dbus_g_method_get_sender (context); -- dbus_error_init (&dbus_error); -- pk_caller = polkit_caller_new_from_dbus_name ( -- dbus_g_connection_get_connection (mechanism->priv->system_bus_connection), -- sender, -- &dbus_error); -- if (pk_caller == NULL) { -- error = g_error_new (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR, -- GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_GENERAL, -- "Error getting information about caller: %s: %s", -- dbus_error.name, dbus_error.message); -- dbus_error_free (&dbus_error); -- dbus_g_method_return_error (context, error); -- g_error_free (error); -- return NULL; -- } -+ pk_caller = polkit_system_bus_name_new (sender); -+ g_free (sender); - - return pk_caller; - } - --/* note, we take ownership of the passed PolKitCaller object */ -+/* note, we take ownership of the passed PolkitSubject object */ - static gboolean --_check_polkit_for_action_for_caller (GnomeSystemMonitorMechanism *mechanism, -+_check_polkit_for_action_for_caller (GnomeSystemMonitorMechanism *mechanism, - DBusGMethodInvocation *context, -- PolKitCaller *pk_caller, -- const char *action, -- const char *action_secondary) -+ PolkitSubject *subject, -+ const char *action) - { - GError *error; -- PolKitAction *pk_action; -- PolKitResult pk_result; -+ PolkitAuthorizationResult *result; - - error = NULL; - -- pk_action = polkit_action_new (); -- polkit_action_set_action_id (pk_action, action); -- pk_result = polkit_context_is_caller_authorized (mechanism->priv->pol_ctx, -- pk_action, -- pk_caller, -- TRUE, -- NULL); -- if (pk_result != POLKIT_RESULT_YES) { -- polkit_action_set_action_id (pk_action, action_secondary); -- pk_result = polkit_context_is_caller_authorized (mechanism->priv->pol_ctx, -- pk_action, -- pk_caller, -- TRUE, -- NULL); -- } -- polkit_action_unref (pk_action); -- polkit_caller_unref (pk_caller); -+ result = polkit_authority_check_authorization_sync (mechanism->priv->pol_ctx, -+ subject, -+ action, -+ NULL, -+ POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION, -+ NULL, NULL); -+ g_object_unref (subject); - -- if (pk_result != POLKIT_RESULT_YES) { -+ if (!polkit_authorization_result_get_is_authorized (result)) { - error = g_error_new (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR, - GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_NOT_PRIVILEGED, -- "%s %s <-- (action, result)", -- action, -- polkit_result_to_string_representation (pk_result)); -+ "%s", -+ action); - dbus_g_method_return_error (context, error); - g_error_free (error); -+ g_object_unref (result); - return FALSE; - } - -+ g_object_unref (result); - return TRUE; - } - - static gboolean --_check_polkit_for_action (GnomeSystemMonitorMechanism *mechanism, -- DBusGMethodInvocation *context, -- const char *action, -- const char *action_secondary) -+_check_polkit_for_action (GnomeSystemMonitorMechanism *mechanism, -+ DBusGMethodInvocation *context, -+ const char *action) - { -- PolKitCaller *pk_caller; -+ PolkitSubject *subject; - - /* Check that caller is privileged */ -- if ((pk_caller = get_caller_from_context (mechanism, context)) == NULL) -+ if ((subject = get_caller_from_context (mechanism, context)) == NULL) - return FALSE; - -- return _check_polkit_for_action_for_caller (mechanism, context, pk_caller, action, action_secondary); -+ return _check_polkit_for_action_for_caller (mechanism, context, subject, action); - } - - /*--------------------------------------------------------------------------------------------------------------*/ -@@ -421,7 +355,7 @@ - { - reset_killtimer (); - -- if (!_check_polkit_for_action (mechanism, context, "org.gnome.system-monitor.kill", NULL)) -+ if (!_check_polkit_for_action (mechanism, context, "org.gnome.system-monitor.kill")) - return FALSE; - - g_debug ("Sending signal %d to pid %d", sig, pid); -@@ -441,6 +375,28 @@ - return TRUE; - } - -+static gboolean -+get_uid_from_context (GnomeSystemMonitorMechanism *mechanism, -+ DBusGMethodInvocation *context, -+ uid_t *uid) -+{ -+ char *sender; -+ DBusConnection *con; -+ -+ con = dbus_g_connection_get_connection (dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL)); -+ if (con == NULL) -+ return FALSE; -+ -+ sender = dbus_g_method_get_sender (context); -+ *uid = dbus_bus_get_unix_user (con, sender, NULL); -+ g_free (sender); -+ -+ if (*uid == (unsigned)-1) -+ return FALSE; -+ -+ return TRUE; -+} -+ - gboolean - gnome_system_monitor_mechanism_renice (GnomeSystemMonitorMechanism *mechanism, - int pid, -@@ -449,11 +405,10 @@ - { - uid_t caller_uid; - uid_t process_uid; -- PolKitCaller *pk_caller; -+ PolkitSubject *subject; - char *procpath; - struct stat statbuf; - const char *action_id; -- const char *action_id_secondary; - - reset_killtimer (); - -@@ -473,11 +428,11 @@ - g_free (procpath); - process_uid = statbuf.st_uid; - -- pk_caller = get_caller_from_context (mechanism, context); -- if (pk_caller == NULL) -+ subject = get_caller_from_context (mechanism, context); -+ if (subject == NULL) - return FALSE; - -- if (!polkit_caller_get_uid (pk_caller, &caller_uid)) { -+ if (!get_uid_from_context (mechanism, context, &caller_uid)) { - GError *error; - error = g_error_new (GNOME_SYSTEM_MONITOR_MECHANISM_ERROR, - GNOME_SYSTEM_MONITOR_MECHANISM_ERROR_GENERAL, -@@ -485,24 +440,21 @@ - g_warning ("Error: %s", error->message); - dbus_g_method_return_error (context, error); - g_error_free (error); -- polkit_caller_unref (pk_caller); -+ g_object_unref (subject); - return FALSE; - } - - if (caller_uid == process_uid) { -- /* we need either .increase-own-priority or .change-priority */ - action_id = "org.gnome.system-monitor.increase-own-priority"; -- action_id_secondary = "org.gnome.system-monitor.change-priority"; - } else { - action_id = "org.gnome.system-monitor.change-priority"; -- action_id_secondary = NULL; - } - -- if (!_check_polkit_for_action_for_caller (mechanism, context, pk_caller, action_id, action_id_secondary)) { -+ if (!_check_polkit_for_action_for_caller (mechanism, context, subject, action_id)) { - return FALSE; - } - -- g_debug ("Renicing pid %d (owned by uid %d) to priority %d on behalf of uid %d (action_id=%s)", -+ g_debug ("Renicing pid %d (owned by uid %d) to priority %d on behalf of uid %d (action_id=%s)", - pid, process_uid, nice_value, caller_uid, action_id); - - errno = 0; -diff -u -r gnome-system-monitor-2.26.1/src/interface.cpp hacked/src/interface.cpp ---- gnome-system-monitor-2.26.1/src/interface.cpp 2009-05-13 22:57:12.780261944 -0400 -+++ hacked/src/interface.cpp 2009-05-13 22:23:34.638019736 -0400 -@@ -31,7 +31,7 @@ - #include - - #ifdef HAVE_POLKIT --# include -+# include - #endif - - #include "procman.h" -@@ -193,7 +193,9 @@ - gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, FALSE, 0); - - #ifdef HAVE_POLKIT -- procdata->endprocessbutton = polkit_gnome_action_create_button (procdata->sigterm_action); -+ procdata->endprocessbutton = gtk_button_new (); -+ gtk_activatable_set_related_action (GTK_ACTIVATABLE (procdata->endprocessbutton), -+ procdata->sigterm_action); - #else - procdata->endprocessbutton = gtk_button_new_with_mnemonic (_("End _Process")); - g_signal_connect (G_OBJECT (procdata->endprocessbutton), "clicked", -@@ -681,39 +683,35 @@ - procdata); - - #ifdef HAVE_POLKIT -- procdata->sigstop_action = polkit_gnome_action_new_default ("StopProcess", -- NULL, -- _("_Stop Process"), -- _("Stop process")); -- g_object_set (procdata->sigstop_action, "auth-label", _("_Stop Process..."), NULL); -+ procdata->sigstop_action = gtk_action_new ("StopProcess", -+ _("_Stop Process"), -+ _("Stop process"), -+ NULL); - g_signal_connect (procdata->sigstop_action, "activate", G_CALLBACK (cb_kill_sigstop), procdata); - gtk_action_group_add_action_with_accel (procdata->action_group, - GTK_ACTION (procdata->sigstop_action), - "S"); - -- procdata->sigcont_action = polkit_gnome_action_new_default ("ContProcess", -- NULL, -- _("_Continue Process"), -- _("Continue process")); -- g_object_set (procdata->sigcont_action, "auth-label", _("_Continue Process..."), NULL); -+ procdata->sigcont_action = gtk_action_new ("ContProcess", -+ _("_Continue Process"), -+ _("Continue process"), -+ NULL); - g_signal_connect (procdata->sigcont_action, "activate", G_CALLBACK (cb_kill_sigcont), procdata); - gtk_action_group_add_action_with_accel (procdata->action_group, GTK_ACTION (procdata->sigcont_action), - "C"); - -- procdata->sigterm_action = polkit_gnome_action_new_default ("EndProcess", -- NULL, -- _("End _Process"), -- _("Force process to finish normally")); -- g_object_set (procdata->sigterm_action, "auth-label", _("End _Process..."), NULL); -+ procdata->sigterm_action = gtk_action_new ("EndProcess", -+ _("End _Process"), -+ _("Force process to finish normally"), -+ NULL); - g_signal_connect (procdata->sigterm_action, "activate", G_CALLBACK (cb_end_process), procdata); - gtk_action_group_add_action_with_accel (procdata->action_group, GTK_ACTION (procdata->sigterm_action), - "E"); - -- procdata->sigkill_action = polkit_gnome_action_new_default ("KillProcess", -- NULL, -- _("_Kill Process"), -- _("Force process to finish immediately")); -- g_object_set (procdata->sigkill_action, "auth-label", _("_Kill Process..."), NULL); -+ procdata->sigkill_action = gtk_action_new ("KillProcess", -+ _("_Kill Process"), -+ _("Force process to finish immediately"), -+ NULL); - g_signal_connect (procdata->sigkill_action, "activate", G_CALLBACK (cb_kill_process), procdata); - gtk_action_group_add_action_with_accel (procdata->action_group, GTK_ACTION (procdata->sigkill_action), - "K"); -@@ -839,36 +837,9 @@ - for (i = 0; i != G_N_ELEMENTS(selected_actions); ++i) { - action = gtk_action_group_get_action(data->action_group, - selected_actions[i]); --#ifdef HAVE_POLKIT -- if (POLKIT_GNOME_IS_ACTION (action)) { -- polkit_gnome_action_set_sensitive (POLKIT_GNOME_ACTION (action), selected_sensitivity); -- } else { -- gtk_action_set_sensitive(action, selected_sensitivity); -- } --#else -- gtk_action_set_sensitive(action, selected_sensitivity); --#endif -+ gtk_action_set_sensitive(action, processes_sensitivity); - } - --#ifdef HAVE_POLKIT -- /* update the PolicyKit actions */ -- if (data->selected_process != NULL) { -- ProcInfo *pi = data->selected_process; -- PolKitAction *pk_action; -- -- /* TODO: multiple processes may be selected; consider all of them */ -- -- if (pi->uid == getuid ()) { -- pk_action = NULL; -- } else { -- pk_action = data->pk_action_kill; -- } -- g_object_set (data->sigstop_action, "polkit-action", pk_action, NULL); -- g_object_set (data->sigcont_action, "polkit-action", pk_action, NULL); -- g_object_set (data->sigterm_action, "polkit-action", pk_action, NULL); -- g_object_set (data->sigkill_action, "polkit-action", pk_action, NULL); -- } --#endif - } - - static void -diff -u -r gnome-system-monitor-2.26.1/src/Makefile.am hacked/src/Makefile.am ---- gnome-system-monitor-2.26.1/src/Makefile.am 2009-05-13 22:57:12.807264047 -0400 -+++ hacked/src/Makefile.am 2009-05-13 22:23:34.639041036 -0400 -@@ -5,8 +5,8 @@ - -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ - -DDATADIR=\""$(datadir)"\" \ - @PROCMAN_CFLAGS@ \ -- @POLKIT_DBUS_CFLAGS@ \ -- @POLKIT_GNOME_CFLAGS@ -+ @POLKIT_CFLAGS@ \ -+ @POLKIT_CFLAGS@ - - bin_PROGRAMS = gnome-system-monitor - -@@ -42,7 +42,7 @@ - gnome_system_monitor_SOURCES += gnome-system-monitor-mechanism-client-glue.h - endif - --gnome_system_monitor_LDADD = @PROCMAN_LIBS@ @POLKIT_GNOME_LIBS@ libbacon.la -+gnome_system_monitor_LDADD = @PROCMAN_LIBS@ @POLKIT_LIBS@ libbacon.la - - - noinst_LTLIBRARIES = libbacon.la -@@ -61,7 +61,7 @@ - ###################################################################### - if HAVE_POLKIT - --polkit_policydir = $(datadir)/PolicyKit/policy -+polkit_policydir = $(datadir)/polkit-1/actions - dist_polkit_policy_DATA = org.gnome.system-monitor.policy - # You will need a recent intltool or the patch from this bug http://bugzilla.gnome.org/show_bug.cgi?id=462312 - @INTLTOOL_POLICY_RULE@ -@@ -86,8 +86,8 @@ - gnome-system-monitor-mechanism-glue.h \ - gnome-system-monitor-mechanism.c - --gnome_system_monitor_mechanism_CFLAGS = $(POLKIT_DBUS_CFLAGS) --gnome_system_monitor_mechanism_LDADD = $(POLKIT_DBUS_LIBS) -+gnome_system_monitor_mechanism_CFLAGS = $(POLKIT_CFLAGS) -+gnome_system_monitor_mechanism_LDADD = $(POLKIT_LIBS) - endif - ###################################################################### - -diff -u -r gnome-system-monitor-2.26.1/src/org.gnome.SystemMonitor.Mechanism.conf hacked/src/org.gnome.SystemMonitor.Mechanism.conf ---- gnome-system-monitor-2.26.1/src/org.gnome.SystemMonitor.Mechanism.conf 2009-05-13 22:57:12.782262429 -0400 -+++ hacked/src/org.gnome.SystemMonitor.Mechanism.conf 2009-05-13 22:53:53.916316134 -0400 -@@ -8,4 +8,8 @@ - - - -+ -+ -+ -+ - -diff -u -r gnome-system-monitor-2.26.1/src/org.gnome.system-monitor.policy.in hacked/src/org.gnome.system-monitor.policy.in ---- gnome-system-monitor-2.26.1/src/org.gnome.system-monitor.policy.in 2009-05-13 22:57:12.784261935 -0400 -+++ hacked/src/org.gnome.system-monitor.policy.in 2009-05-13 22:23:34.640011979 -0400 -@@ -34,7 +34,7 @@ - <_message>Increasing the priority of one of your own processes requires privileges - - no -- auth_self_keep_always -+ auth_self_keep - - - -diff -u -r gnome-system-monitor-2.26.1/src/procactions.cpp hacked/src/procactions.cpp ---- gnome-system-monitor-2.26.1/src/procactions.cpp 2009-05-13 22:57:12.785264168 -0400 -+++ hacked/src/procactions.cpp 2009-05-13 22:23:34.640011979 -0400 -@@ -33,7 +33,7 @@ - - #ifdef HAVE_POLKIT - # include "gnome-system-monitor-mechanism-client-glue.h" --# include -+# include - #endif - - static void -diff -u -r gnome-system-monitor-2.26.1/src/procdialogs.cpp hacked/src/procdialogs.cpp ---- gnome-system-monitor-2.26.1/src/procdialogs.cpp 2009-05-13 22:57:12.787262906 -0400 -+++ hacked/src/procdialogs.cpp 2009-05-13 22:23:34.641019659 -0400 -@@ -35,11 +35,6 @@ - #include "procman_gnomesu.h" - #include "procman_gksu.h" - --#ifdef HAVE_POLKIT --# include "gnome-system-monitor-mechanism-client-glue.h" --# include --#endif -- - static GtkWidget *renice_dialog = NULL; - static GtkWidget *prefs_dialog = NULL; - static gint new_nice_value = 0; -@@ -129,56 +124,8 @@ - typedef struct { - GtkWidget *priority_label; - ProcData *procdata; --#ifdef HAVE_POLKIT -- PolKitGnomeAction *renice_action; --#endif - } ReniceClosure; - --#ifdef HAVE_POLKIT --static void --_renice_compute_polkit_action (ReniceClosure *rc) --{ -- if (rc->procdata->selected_process != NULL) { -- ProcInfo *pi = rc->procdata->selected_process; -- -- if (pi->uid == getuid ()) { -- if (new_nice_value < pi->nice) { -- GValue v; -- GValueArray *va; -- -- g_warning ("foo"); -- -- memset (&v, 0, sizeof (GValue)); -- g_value_init (&v, G_TYPE_POINTER); -- g_value_set_pointer (&v, rc->procdata->pk_action_change_priority); -- va = g_value_array_new (1); -- g_value_array_prepend (va, &v); -- -- g_object_set (rc->renice_action, -- "polkit-action", -- rc->procdata->pk_action_increase_own_priority, -- "polkit-action-sufficient", -- va, -- NULL); -- -- g_value_array_free (va); -- goto out; -- } -- } else { -- g_object_set (rc->renice_action, -- "polkit-action", -- rc->procdata->pk_action_change_priority, NULL); -- goto out; -- } -- } -- -- g_object_set (rc->renice_action, "polkit-action", NULL, NULL); -- --out: -- ; --} --#endif -- - static void - renice_scale_changed (GtkAdjustment *adj, gpointer data) - { -@@ -186,9 +133,6 @@ - - new_nice_value = int(adj->value); - gtk_label_set_text (GTK_LABEL (rc->priority_label), get_nice_level (new_nice_value)); --#ifdef HAVE_POLKIT -- _renice_compute_polkit_action (rc); --#endif - } - - static void -@@ -204,10 +148,6 @@ - - gtk_widget_destroy (GTK_WIDGET (dialog)); - renice_dialog = NULL; -- --#ifdef HAVE_POLKIT -- g_object_unref (G_OBJECT (rc->renice_action)); --#endif - g_free (rc); - } - -@@ -224,11 +164,9 @@ - GtkObject *renice_adj; - GtkWidget *hscale; - GtkWidget *button; --#ifndef HAVE_POLKIT -- GtkWidget *hbox; - GtkWidget *align; -+ GtkWidget *hbox; - GtkWidget *icon; --#endif - gchar *text; - ReniceClosure *rc; - -@@ -250,19 +188,6 @@ - gtk_dialog_set_has_separator (GTK_DIALOG (renice_dialog), FALSE); - gtk_container_set_border_width (GTK_CONTAINER (renice_dialog), 5); - --#ifdef HAVE_POLKIT -- rc->renice_action = polkit_gnome_action_new_default ("ReniceProcessButton", -- NULL, -- _("Change _Priority"), -- NULL); -- g_object_set (rc->renice_action, -- "auth-label", _("Change _Priority..."), -- "yes-icon-name", GTK_STOCK_OK, -- NULL); -- -- button = polkit_gnome_action_create_button (rc->renice_action); -- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); --#else - button = gtk_button_new (); - GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); - -@@ -279,7 +204,6 @@ - gtk_label_set_mnemonic_widget (GTK_LABEL (label), button); - gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0); - --#endif - gtk_dialog_add_action_widget (GTK_DIALOG (renice_dialog), button, 100); - - gtk_dialog_set_default_response (GTK_DIALOG (renice_dialog), 100); -@@ -325,7 +249,6 @@ - - rc->priority_label = priority_label; - new_nice_value = info->nice; -- _renice_compute_polkit_action (rc); - - g_signal_connect (G_OBJECT (dialog), "response", - G_CALLBACK (renice_dialog_button_pressed), rc); -diff -u -r gnome-system-monitor-2.26.1/src/procman.cpp hacked/src/procman.cpp ---- gnome-system-monitor-2.26.1/src/procman.cpp 2009-05-13 22:57:12.790293839 -0400 -+++ hacked/src/procman.cpp 2009-05-13 22:23:34.642011835 -0400 -@@ -79,15 +79,6 @@ - "/", - "org.gnome.SystemMonitor.Mechanism"); - } -- -- this->pk_action_kill = polkit_action_new (); -- polkit_action_set_action_id (this->pk_action_kill, "org.gnome.system-monitor.kill"); -- -- this->pk_action_change_priority = polkit_action_new (); -- polkit_action_set_action_id (this->pk_action_change_priority, "org.gnome.system-monitor.change-priority"); -- -- this->pk_action_increase_own_priority = polkit_action_new (); -- polkit_action_set_action_id (this->pk_action_increase_own_priority, "org.gnome.system-monitor.increase-own-priority"); - #endif - } - -diff -u -r gnome-system-monitor-2.26.1/src/procman.h hacked/src/procman.h ---- gnome-system-monitor-2.26.1/src/procman.h 2009-05-13 22:57:12.791293418 -0400 -+++ hacked/src/procman.h 2009-05-13 22:23:34.643012042 -0400 -@@ -35,7 +35,6 @@ - - #ifdef HAVE_POLKIT - # include --# include - #endif - - struct ProcInfo; -@@ -219,14 +218,10 @@ - #ifdef HAVE_POLKIT - DBusGProxy *mechanism_proxy; - -- PolKitAction *pk_action_kill; -- PolKitAction *pk_action_change_priority; -- PolKitAction *pk_action_increase_own_priority; -- -- PolKitGnomeAction *sigstop_action; -- PolKitGnomeAction *sigcont_action; -- PolKitGnomeAction *sigterm_action; -- PolKitGnomeAction *sigkill_action; -+ GtkAction *sigstop_action; -+ GtkAction *sigcont_action; -+ GtkAction *sigterm_action; -+ GtkAction *sigkill_action; - #endif - - unsigned frequency; diff --git a/session.patch b/session.patch deleted file mode 100644 index 3643af1..0000000 --- a/session.patch +++ /dev/null @@ -1,934 +0,0 @@ -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 -+ * -+ * 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. -+ */ -+ -+#include -+#include -+#include -+ -+struct _GsmSessionManagerPrivate -+{ -+ DBusGConnection *dbus_connection; -+ DBusGProxy *bus_proxy; -+ DBusGProxy *sm_proxy; -+ guint is_connected :1; -+ -+ GHashTable *clients; -+}; -+ -+static void gsm_session_manager_finalize (GObject *object); -+static void gsm_session_manager_class_install_signals (GsmSessionManagerClass *manager_class); -+ -+static void gsm_session_manager_class_install_properties (GsmSessionManagerClass *manager_class); -+ -+static void gsm_session_manager_get_property (GObject *object, -+ guint prop_id, -+ GValue *value, -+ GParamSpec *pspec); -+ -+static gboolean ensure_connection (GsmSessionManager *manager, -+ GError **error); -+static void get_all_clients (GsmSessionManager *manager); -+ -+enum { -+ PROP_0 = 0, -+ PROP_IS_CONNECTED -+}; -+ -+enum { -+ CLIENT_ADDED = 0, -+ CLIENT_REMOVED, -+ LAST_SIGNAL -+}; -+ -+static guint signals[LAST_SIGNAL]; -+ -+G_DEFINE_TYPE (GsmSessionManager, gsm_session_manager, G_TYPE_OBJECT); -+ -+static void -+gsm_session_manager_class_init (GsmSessionManagerClass *manager_class) -+{ -+ GObjectClass *object_class; -+ -+ object_class = G_OBJECT_CLASS (manager_class); -+ -+ object_class->finalize = gsm_session_manager_finalize; -+ -+ gsm_session_manager_class_install_properties (manager_class); -+ gsm_session_manager_class_install_signals (manager_class); -+ -+ g_type_class_add_private (manager_class, -+ sizeof (GsmSessionManagerPrivate)); -+} -+ -+static void -+gsm_session_manager_class_install_signals (GsmSessionManagerClass *manager_class) -+{ -+ GObjectClass *object_class; -+ -+ object_class = G_OBJECT_CLASS (manager_class); -+ -+ signals[CLIENT_ADDED] = -+ g_signal_new ("client-added", -+ G_OBJECT_CLASS_TYPE (object_class), -+ G_SIGNAL_RUN_LAST, -+ G_STRUCT_OFFSET (GsmSessionManagerClass, client_added), -+ NULL, NULL, -+ g_cclosure_marshal_VOID__STRING, -+ G_TYPE_NONE, 1, G_TYPE_STRING); -+ signals[CLIENT_REMOVED] = -+ g_signal_new ("client-removed", -+ G_OBJECT_CLASS_TYPE (object_class), -+ G_SIGNAL_RUN_LAST, -+ G_STRUCT_OFFSET (GsmSessionManagerClass, client_removed), -+ NULL, NULL, -+ g_cclosure_marshal_VOID__STRING, -+ G_TYPE_NONE, 1, G_TYPE_STRING); -+} -+ -+static void -+gsm_session_manager_class_install_properties (GsmSessionManagerClass *manager_class) -+{ -+ GObjectClass *object_class; -+ GParamSpec *param_spec; -+ -+ object_class = G_OBJECT_CLASS (manager_class); -+ object_class->get_property = gsm_session_manager_get_property; -+ -+ param_spec = g_param_spec_boolean ("is-connected", -+ "Is connected", -+ "Whether we are connected to " -+ "the session manager", -+ FALSE, -+ G_PARAM_READABLE); -+ -+ g_object_class_install_property (object_class, PROP_IS_CONNECTED, -+ param_spec); -+} -+ -+static void -+on_name_owner_changed (DBusGProxy *bus_proxy, -+ const char *name, -+ const char *prev_owner, -+ const char *new_owner, -+ GsmSessionManager *manager) -+{ -+ if (strcmp (name, "org.gnome.SessionManager") != 0) { -+ return; -+ } -+ -+ if (manager->priv->sm_proxy != NULL) { -+ g_object_unref (manager->priv->sm_proxy); -+ manager->priv->sm_proxy = NULL; -+ } -+ -+ g_hash_table_remove_all (manager->priv->clients); -+ -+ if (ensure_connection (manager, NULL)) -+ get_all_clients (manager); -+} -+ -+ -+static void -+get_client_details (GsmSessionManager *manager, -+ const char *obj_path, -+ GsmClientDetailsCallback callback, -+ gpointer data) -+{ -+ DBusGProxy *proxy; -+ GError *error = NULL; -+ gboolean ret; -+ guint status; -+ guint restart_style_hint; -+ guint pid; -+ -+ proxy = dbus_g_proxy_new_for_name (manager->priv->dbus_connection, -+ "org.gnome.SessionManager", -+ obj_path, -+ "org.gnome.SessionManager.Client"); -+ -+ ret = dbus_g_proxy_call (proxy, "GetUnixProcessId", &error, -+ G_TYPE_INVALID, -+ G_TYPE_UINT, &pid, -+ G_TYPE_INVALID); -+ if (error) { -+ g_warning ("ERROR: %s\n", error->message); -+ g_error_free (error); -+ goto cleanup; -+ } -+ if (!ret) { -+ g_warning ("GetUnixProcessId failed\n"); -+ goto cleanup; -+ } -+ -+ ret = dbus_g_proxy_call (proxy, "GetStatus", &error, -+ G_TYPE_INVALID, -+ G_TYPE_UINT, &status, -+ G_TYPE_INVALID); -+ if (error) { -+ g_warning ("ERROR: %s\n", error->message); -+ g_error_free (error); -+ goto cleanup; -+ } -+ if (!ret) { -+ g_warning ("GetStatus failed\n"); -+ goto cleanup; -+ } -+ -+ ret = dbus_g_proxy_call (proxy, "GetRestartStyleHint", &error, -+ G_TYPE_INVALID, -+ G_TYPE_UINT, &restart_style_hint, -+ G_TYPE_INVALID); -+ if (error) { -+ g_warning ("ERROR: %s\n", error->message); -+ g_error_free (error); -+ goto cleanup; -+ } -+ if (!ret) { -+ g_warning ("GetRestartStyleHint failed\n"); -+ goto cleanup; -+ } -+ -+ callback (obj_path, pid, status, restart_style_hint, data); -+ -+cleanup: -+ g_object_unref (proxy); -+} -+ -+ -+typedef struct { -+ guint pid; -+ guint status; -+ guint restart_style_hint; -+} ClientDetails; -+ -+void -+gsm_session_manager_foreach (GsmSessionManager *manager, -+ GsmClientDetailsCallback callback, -+ gpointer data) -+{ -+ GHashTableIter iter; -+ gchar *key; -+ ClientDetails *value; -+ -+ g_hash_table_iter_init (&iter, manager->priv->clients); -+ while (g_hash_table_iter_next (&iter,(gpointer *)&key, (gpointer *)&value)) { -+ callback (key, value->pid, value->status, value->restart_style_hint, data); -+ } -+} -+ -+static void -+add_client (const char *obj_path, -+ guint pid, -+ guint status, -+ guint restart_style_hint, -+ gpointer data) -+{ -+ GsmSessionManager *manager = data; -+ -+ ClientDetails *details; -+ -+ details = g_new (ClientDetails, 1); -+ details->pid = pid; -+ details->status = status; -+ details->restart_style_hint = restart_style_hint; -+ -+ g_hash_table_insert (manager->priv->clients, -+ g_strdup (obj_path), -+ details); -+} -+ -+static void -+get_all_clients (GsmSessionManager *manager) -+{ -+ GError *error = NULL; -+ GPtrArray *array; -+ gboolean ret; -+ gchar *obj_path; -+ guint i; -+ -+ ret = dbus_g_proxy_call (manager->priv->sm_proxy, -+ "GetClients", &error, -+ G_TYPE_INVALID, -+ dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH), &array, -+ G_TYPE_INVALID); -+ -+ if (error) { -+ g_warning ("ERROR: %s\n", error->message); -+ g_error_free (error); -+ return; -+ } -+ if (!ret) { -+ g_warning ("GetClients failed\n"); -+ } -+ -+ for (i = 0; i < array->len; i++) { -+ obj_path = g_ptr_array_index (array, i); -+ get_client_details (manager, obj_path, add_client, manager); -+ } -+ -+ g_ptr_array_foreach (array, (GFunc)g_free, NULL); -+ g_ptr_array_free (array, TRUE); -+} -+ -+ -+ -+static void -+on_client_added (DBusGProxy *sm_proxy, -+ const gchar *obj_path, -+ GsmSessionManager *manager) -+{ -+ get_client_details (manager, obj_path, add_client, manager); -+ -+ g_signal_emit (manager, signals[CLIENT_ADDED], 0, obj_path); -+} -+ -+static void -+on_client_removed (DBusGProxy *sm_proxy, -+ const char *obj_path, -+ GsmSessionManager *manager) -+{ -+ g_signal_emit (manager, signals[CLIENT_REMOVED], 0, obj_path); -+ -+ g_hash_table_remove (manager->priv->clients, obj_path); -+} -+ -+static gboolean -+ensure_connection (GsmSessionManager *manager, -+ GError **error) -+{ -+ GError *connection_error; -+ gboolean is_connected; -+ -+ connection_error = NULL; -+ if (manager->priv->dbus_connection == NULL) { -+ manager->priv->dbus_connection = dbus_g_bus_get (DBUS_BUS_SESSION, -+ &connection_error); -+ -+ if (manager->priv->dbus_connection == NULL) { -+ g_propagate_error (error, connection_error); -+ is_connected = FALSE; -+ goto out; -+ } -+ } -+ if (manager->priv->bus_proxy == NULL) { -+ manager->priv->bus_proxy = -+ dbus_g_proxy_new_for_name_owner (manager->priv->dbus_connection, -+ DBUS_SERVICE_DBUS, -+ DBUS_PATH_DBUS, -+ DBUS_INTERFACE_DBUS, -+ &connection_error); -+ -+ if (manager->priv->bus_proxy == NULL) { -+ g_propagate_error (error, connection_error); -+ is_connected = FALSE; -+ goto out; -+ } -+ -+ dbus_g_proxy_add_signal (manager->priv->bus_proxy, -+ "NameOwnerChanged", -+ G_TYPE_STRING, -+ G_TYPE_STRING, -+ G_TYPE_STRING, -+ G_TYPE_INVALID); -+ dbus_g_proxy_connect_signal (manager->priv->bus_proxy, -+ "NameOwnerChanged", -+ G_CALLBACK (on_name_owner_changed), -+ manager, NULL); -+ } -+ -+ if (manager->priv->sm_proxy == NULL) { -+ manager->priv->sm_proxy = -+ dbus_g_proxy_new_for_name_owner (manager->priv->dbus_connection, -+ "org.gnome.SessionManager", -+ "/org/gnome/SessionManager", -+ "org.gnome.SessionManager", -+ &connection_error); -+ -+ if (manager->priv->sm_proxy == NULL) { -+ g_propagate_error (error, connection_error); -+ is_connected = FALSE; -+ goto out; -+ } -+ -+ dbus_g_proxy_add_signal (manager->priv->sm_proxy, -+ "ClientAdded", -+ DBUS_TYPE_G_OBJECT_PATH, -+ G_TYPE_INVALID); -+ dbus_g_proxy_connect_signal (manager->priv->sm_proxy, -+ "ClientAdded", -+ G_CALLBACK (on_client_added), -+ manager, NULL); -+ -+ dbus_g_proxy_add_signal (manager->priv->sm_proxy, -+ "ClientRemoved", -+ DBUS_TYPE_G_OBJECT_PATH, -+ G_TYPE_INVALID); -+ dbus_g_proxy_connect_signal (manager->priv->sm_proxy, -+ "ClientRemoved", -+ G_CALLBACK (on_client_removed), -+ manager, NULL); -+ } -+ -+ is_connected = TRUE; -+ -+ out: -+ if (manager->priv->is_connected != is_connected) { -+ manager->priv->is_connected = is_connected; -+ g_object_notify (G_OBJECT (manager), "is-connected"); -+ } -+ -+ if (!is_connected) { -+ if (manager->priv->dbus_connection == NULL) { -+ if (manager->priv->bus_proxy != NULL) { -+ g_object_unref (manager->priv->bus_proxy); -+ manager->priv->bus_proxy = NULL; -+ } -+ -+ if (manager->priv->sm_proxy != NULL) { -+ g_object_unref (manager->priv->sm_proxy); -+ manager->priv->sm_proxy = NULL; -+ } -+ } else if (manager->priv->bus_proxy == NULL) { -+ if (manager->priv->sm_proxy != NULL) { -+ g_object_unref (manager->priv->sm_proxy); -+ manager->priv->sm_proxy = NULL; -+ } -+ } -+ } -+ -+ return is_connected; -+} -+ -+ -+static void -+gsm_session_manager_init (GsmSessionManager *manager) -+{ -+ GError *error; -+ -+ manager->priv = G_TYPE_INSTANCE_GET_PRIVATE (manager, GSM_TYPE_SESSION_MANAGER, -+ GsmSessionManagerPrivate); -+ -+ manager->priv->dbus_connection = NULL; -+ manager->priv->bus_proxy = NULL; -+ manager->priv->sm_proxy = NULL; -+ manager->priv->is_connected = FALSE; -+ -+ manager->priv->clients = g_hash_table_new_full (g_str_hash, g_str_equal, -+ g_free, g_free); -+ error = NULL; -+ -+ if (ensure_connection (manager, &error)) { -+ get_all_clients (manager); -+ } -+ else { -+ g_message ("Could not connect to session manager: %s", -+ error->message); -+ g_error_free (error); -+ } -+} -+ -+static void -+gsm_session_manager_finalize (GObject *object) -+{ -+ GsmSessionManager *manager; -+ GObjectClass *parent_class; -+ -+ manager = GSM_SESSION_MANAGER (object); -+ -+ g_hash_table_destroy (manager->priv->clients); -+ -+ parent_class = G_OBJECT_CLASS (gsm_session_manager_parent_class); -+ -+ if (parent_class->finalize != NULL) { -+ parent_class->finalize (object); -+ } -+} -+ -+static void -+gsm_session_manager_get_property (GObject *object, -+ guint prop_id, -+ GValue *value, -+ GParamSpec *pspec) -+{ -+ GsmSessionManager *manager = GSM_SESSION_MANAGER (object); -+ -+ switch (prop_id) { -+ case PROP_IS_CONNECTED: -+ g_value_set_boolean (value, -+ manager->priv->is_connected); -+ break; -+ -+ default: -+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, -+ prop_id, -+ pspec); -+ } -+} -+ -+GsmSessionManager * -+gsm_session_manager_new (void) -+{ -+ GsmSessionManager *manager; -+ -+ manager = g_object_new (GSM_TYPE_SESSION_MANAGER, NULL); -+ -+ return manager; -+} -+ -+GsmSessionManager * -+gsm_session_manager_get (void) -+{ -+ static GsmSessionManager *manager = NULL; -+ -+ if (manager == NULL) { -+ manager = gsm_session_manager_new (); -+ } -+ -+ return g_object_ref (manager); -+} -+ -+gboolean -+gsm_session_manager_get_details (GsmSessionManager *manager, -+ const char *obj_path, -+ guint *pid, -+ guint *status, -+ guint *restart_style_hint) -+{ -+ ClientDetails *details; -+ -+ details = (ClientDetails *)g_hash_table_lookup (manager->priv->clients, obj_path); -+ -+ if (details) { -+ *pid = details->pid; -+ *status = details->status; -+ *restart_style_hint = details->restart_style_hint; -+ return TRUE; -+ } -+ -+ return FALSE; -+} -+ -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 -+ -+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 \ -- gsm_color_button.c gsm_color_button.h -+ 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" - - - 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(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 - void poison(T &t, char c) - {