Add "Run Task Manager as root" item in "Execute" menu
This commit is contained in:
@@ -66,11 +66,13 @@ dnl ***********************************
|
|||||||
XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.12.0])
|
XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.12.0])
|
||||||
XDT_CHECK_PACKAGE([CAIRO], [cairo], [1.5.0])
|
XDT_CHECK_PACKAGE([CAIRO], [cairo], [1.5.0])
|
||||||
|
|
||||||
dnl ******************************************
|
dnl ***********************************
|
||||||
dnl *** Check for optional package libwnck ***
|
dnl *** Check for optional packages ***
|
||||||
dnl ******************************************
|
dnl ***********************************
|
||||||
XDT_CHECK_OPTIONAL_PACKAGE([WNCK], [libwnck-1.0], [2.0], [wnck], [building with libwnck for window icons/names], [yes])
|
XDT_CHECK_OPTIONAL_PACKAGE([WNCK], [libwnck-1.0], [2.0], [wnck], [building with libwnck for window icons/names], [yes])
|
||||||
AM_CONDITIONAL([HAVE_WNCK], [test x"$WNCK_FOUND" = x"yes"])
|
AM_CONDITIONAL([HAVE_WNCK], [test x"$WNCK_FOUND" = x"yes"])
|
||||||
|
XDT_CHECK_OPTIONAL_PACKAGE([GKSU], [libgksu2], [2.0], [gksu], [building with libgksu to run as root], [yes])
|
||||||
|
AM_CONDITIONAL([HAVE_GKSU], [test x"$GKSU_FOUND" = x"yes"])
|
||||||
|
|
||||||
dnl ***********************************
|
dnl ***********************************
|
||||||
dnl ********** Check for skel *********
|
dnl ********** Check for skel *********
|
||||||
@@ -144,6 +146,7 @@ dnl ***************************
|
|||||||
echo
|
echo
|
||||||
echo "Build Configuration:"
|
echo "Build Configuration:"
|
||||||
echo
|
echo
|
||||||
|
echo "* Gksu: ${GKSU_FOUND:-no} "${GKSU_VERSION:+"(libgksu $GKSU_VERSION)"}
|
||||||
echo "* Wnck: ${WNCK_FOUND:-no} "${WNCK_VERSION:+"(libwnck $WNCK_VERSION)"}
|
echo "* Wnck: ${WNCK_FOUND:-no} "${WNCK_VERSION:+"(libwnck $WNCK_VERSION)"}
|
||||||
echo "* Target OS: $target_os ($ac_os_implementation)"
|
echo "* Target OS: $target_os ($ac_os_implementation)"
|
||||||
echo "* Debug Support: $enable_debug"
|
echo "* Debug Support: $enable_debug"
|
||||||
|
|||||||
@@ -12,12 +12,14 @@ xfce4_taskmanager_CFLAGS = \
|
|||||||
$(GTK_CFLAGS) \
|
$(GTK_CFLAGS) \
|
||||||
$(CAIRO_CFLAGS) \
|
$(CAIRO_CFLAGS) \
|
||||||
$(WNCK_CFLAGS) \
|
$(WNCK_CFLAGS) \
|
||||||
|
$(GKSU_CFLAGS) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
xfce4_taskmanager_LDADD = \
|
xfce4_taskmanager_LDADD = \
|
||||||
$(GTK_LIBS) \
|
$(GTK_LIBS) \
|
||||||
$(CAIRO_LIBS) \
|
$(CAIRO_LIBS) \
|
||||||
$(WNCK_LIBS) \
|
$(WNCK_LIBS) \
|
||||||
|
$(GKSU_LIBS) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
xfce4_taskmanager_SOURCES = \
|
xfce4_taskmanager_SOURCES = \
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_GKSU
|
||||||
|
#include <libgksu/libgksu.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "process-window.h"
|
#include "process-window.h"
|
||||||
#include "process-window_ui.h"
|
#include "process-window_ui.h"
|
||||||
@@ -210,6 +214,16 @@ monitor_update_step_size (XtmProcessWindow *window)
|
|||||||
g_object_set (window->priv->mem_monitor, "step-size", refresh_rate / 1000.0, NULL);
|
g_object_set (window->priv->mem_monitor, "step-size", refresh_rate / 1000.0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GKSU
|
||||||
|
static void
|
||||||
|
run_as_root (XtmProcessWindow *window)
|
||||||
|
{
|
||||||
|
gtk_widget_hide (window->priv->window);
|
||||||
|
gksu_run (g_get_prgname (), NULL);
|
||||||
|
gtk_widget_show (window->priv->window);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
execute_command (const gchar *command)
|
execute_command (const gchar *command)
|
||||||
{
|
{
|
||||||
@@ -256,6 +270,22 @@ show_menu_execute_task (XtmProcessWindow *window)
|
|||||||
if (menu == NULL)
|
if (menu == NULL)
|
||||||
{
|
{
|
||||||
menu = gtk_menu_new ();
|
menu = gtk_menu_new ();
|
||||||
|
|
||||||
|
#ifdef HAVE_GKSU
|
||||||
|
/* Run task manager as root */
|
||||||
|
if (geteuid () != 0)
|
||||||
|
{
|
||||||
|
GtkWidget *image = gtk_image_new_from_icon_name ("utilities-system-monitor", GTK_ICON_SIZE_MENU);
|
||||||
|
GtkWidget *mi = gtk_image_menu_item_new_with_label ("Run Task Manager as root");
|
||||||
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi), image);
|
||||||
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
|
||||||
|
g_signal_connect_swapped (mi, "activate", G_CALLBACK (run_as_root), window);
|
||||||
|
|
||||||
|
mi = gtk_separator_menu_item_new ();
|
||||||
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Find a runner program */
|
/* Find a runner program */
|
||||||
if (program_exists ("xfrun4"))
|
if (program_exists ("xfrun4"))
|
||||||
menu_execute_append_item (GTK_MENU (menu), _("Run Program..."), "xfrun4", "system-run");
|
menu_execute_append_item (GTK_MENU (menu), _("Run Program..."), "xfrun4", "system-run");
|
||||||
|
|||||||
Reference in New Issue
Block a user