[nemiver/profiler] WIP
- From: Fabien Parent <fparent src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver/profiler] WIP
- Date: Sun, 5 Aug 2012 16:27:54 +0000 (UTC)
commit f685ca0c5a09cb7e3f5ef61f8d81e948753fe4cc
Author: Fabien Parent <parent f gmail com>
Date: Sun Aug 5 18:27:15 2012 +0200
WIP
configure.ac | 11 +++++++++++
src/profengine/Makefile.am | 3 ++-
src/profengine/nmv-perf-server.cc | 15 +++++++++++++++
3 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 32c9df0..bf60c2c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,6 +70,8 @@ GSETTINGS_DESKTOP_SCHEMAS=0.0.1
AC_SUBST([GSETTINGS_DESKTOP_SCHEMAS])
LIBGDLMM_VERSION=3.0
AC_SUBST([LIBGDLMM_VERSION])
+LIBPOLKIT_GOBJECT_VERSION=0.105
+AC_SUBST([LIBPOLKIT_GOBJECT_VERSION])
dnl *********************
dnl Checks for programs.
@@ -387,6 +389,15 @@ NEMIVERPROFPERSP_CFLAGS="$NEMIVERPROFPERSP_CFLAGS $CPPUNIT_CFLAGS"
AC_SUBST(NEMIVERPROFPERSP_LIBS)
AC_SUBST(NEMIVERPROFPERSP_CFLAGS)
+DEP_POLKIT="polkit-gobject-1 >= $LIBPOLKIT_GOBJECT_VERSION"
+
+PKG_CHECK_MODULES(NEMIVERPERFSERVER, $DEP_POLKIT)
+NEMIVERPERFSERVER_LIBS="$NEMIVERPERFSERVER_LIBS $CPPUNIT_LIBS"
+NEMIVERPERFSERVER_CFLAGS="$NEMIVERPERFSERVER_CFLAGS $CPPUNIT_CFLAGS"
+
+AC_SUBST(NEMIVERPERFSERVER_LIBS)
+AC_SUBST(NEMIVERPERFSERVER_CFLAGS)
+
NEMIVER_LIBS="$NEMIVERUICOMMON_LIBS"
NEMIVER_CFLAGS="$NEMIVERUICOMMON_CFLAGS"
diff --git a/src/profengine/Makefile.am b/src/profengine/Makefile.am
index 75e7b3c..8d605a2 100644
--- a/src/profengine/Makefile.am
+++ b/src/profengine/Makefile.am
@@ -45,7 +45,7 @@ configdir= NEMIVER_SYSTEM_CONFIG_DIR@
bin_PROGRAMS=nmvperfserver
nmvperfserver_SOURCES=$(h)/nmv-perf-server.cc
nmvperfserver= NEMIVER_MODULES_DIR@
-nmvperfserver_LDADD= NEMIVERPROFPERSP_LIBS@ \
+nmvperfserver_LDADD= NEMIVERPROFPERSP_LIBS@ @NEMIVERPERFSERVER_LIBS@ \
$(abs_top_builddir)/src/common/libnemivercommon.la libperfcommon.la
service_DATA=org.gnome.nemiver.profiler.service
@@ -55,5 +55,6 @@ bus_DATA=org.gnome.nemiver.profiler.conf.in
busdir=/etc/dbus-1/system.d/
INCLUDES= NEMIVERCOMMON_CFLAGS@ @NEMIVERPROFPERSP_CFLAGS@ \
+ NEMIVERPERFSERVER_CFLAGS@ \
-DENABLE_NLS=1 -DDATADIR=\"${datadir}\" \
-I$(top_srcdir)/src -I$(top_srcdir)/src/confmgr
diff --git a/src/profengine/nmv-perf-server.cc b/src/profengine/nmv-perf-server.cc
index e2e5692..3d5d9c8 100644
--- a/src/profengine/nmv-perf-server.cc
+++ b/src/profengine/nmv-perf-server.cc
@@ -31,6 +31,7 @@
#include "nmv-record-options.h"
#include "nmv-perf-engine.h"
+#include <polkit/polkit.h>
#include <glibmm.h>
#include <giomm.h>
#include <glib/gi18n.h>
@@ -181,6 +182,20 @@ struct PerfServer::Priv {
THROW_IF_FAIL (a_connection);
THROW_IF_FAIL (a_invocation);
+ Glib::ustring bus_name = a_invocation->get_sender ();
+
+ PolkitAuthorizationResult *result =
+ polkit_authority_check_authorization_sync
+ (polkit_authority_get_sync (NULL, NULL),
+ polkit_system_bus_name_new (bus_name.c_str ()),
+ "org.gnome.nemiver.profile-app",
+ NULL,
+ POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
+ NULL,
+ NULL);
+ THROW_IF_FAIL (result);
+ THROW_IF_FAIL (polkit_authorization_result_get_is_authorized(result));
+
if(a_request_name == "AttachToPID") {
Glib::Variant<int> pid_param;
Glib::Variant<int> uid_param;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]