Author: aschnell
Date: Sun Feb 1 20:51:49 2009
New Revision: 55176
URL: http://svn.opensuse.org/viewcvs/yast?rev=55176&view=rev
Log:
- make dbus session bus also available
Added:
trunk/core/agent-dbus/conf/dbus.session.scr
trunk/core/agent-dbus/conf/dbus.system.scr (contents, props changed)
- copied, changed from r55173, trunk/core/agent-dbus/conf/dbus.scr
Removed:
trunk/core/agent-dbus/conf/dbus.scr
Modified:
trunk/core/agent-dbus/conf/Makefile.am
trunk/core/agent-dbus/src/DbusAgent.cc
trunk/core/agent-dbus/src/DbusAgent.h
trunk/storage/storage/src/modules/Storage.ycp
Modified: trunk/core/agent-dbus/conf/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/agent-dbus/conf/Makefile.am?rev=55176&r1=55175&r2=55176&view=diff
==============================================================================
--- trunk/core/agent-dbus/conf/Makefile.am (original)
+++ trunk/core/agent-dbus/conf/Makefile.am Sun Feb 1 20:51:49 2009
@@ -2,6 +2,6 @@
# Makefile.am for core/agent-dbus/conf
#
-scrconf_DATA = dbus.scr
+scrconf_DATA = dbus.system.scr dbus.session.scr
EXTRA_DIST = $(scrconf_DATA)
Added: trunk/core/agent-dbus/conf/dbus.session.scr
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/agent-dbus/conf/dbus.session.scr?rev=55176&view=auto
==============================================================================
--- trunk/core/agent-dbus/conf/dbus.session.scr (added)
+++ trunk/core/agent-dbus/conf/dbus.session.scr Sun Feb 1 20:51:49 2009
@@ -0,0 +1,11 @@
+/**
+ * File:
+ * dbus.session.scr
+ * Authors:
+ * Arvin Schnell
+ */
+.dbus.session
+
+`ag_dbus(
+ `Bus("session")
+)
Copied: trunk/core/agent-dbus/conf/dbus.system.scr (from r55173, trunk/core/agent-dbus/conf/dbus.scr)
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/agent-dbus/conf/dbus.system.scr?p2=trunk/core/agent-dbus/conf/dbus.system.scr&p1=trunk/core/agent-dbus/conf/dbus.scr&r1=55173&r2=55176&rev=55176&view=diff
==============================================================================
--- trunk/core/agent-dbus/conf/dbus.scr (original)
+++ trunk/core/agent-dbus/conf/dbus.system.scr Sun Feb 1 20:51:49 2009
@@ -1,9 +1,11 @@
/**
* File:
- * dbus.scr
+ * dbus.system.scr
* Authors:
* Arvin Schnell
*/
-.dbus
+.dbus.system
-`ag_dbus()
+`ag_dbus(
+ `Bus("system")
+)
Modified: trunk/core/agent-dbus/src/DbusAgent.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/agent-dbus/src/DbusAgent.cc?rev=55176&r1=55175&r2=55176&view=diff
==============================================================================
--- trunk/core/agent-dbus/src/DbusAgent.cc (original)
+++ trunk/core/agent-dbus/src/DbusAgent.cc Sun Feb 1 20:51:49 2009
@@ -13,22 +13,9 @@
DbusAgent::DbusAgent()
+ : connection(NULL)
{
- y2milestone("connecting dbus");
-
dbus_error_init(&error);
-
- connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
- if (dbus_error_is_set(&error))
- {
- y2error("dbus_bus_get failed (%s)\n", error.message);
- dbus_error_free(&error);
- }
-
- if (connection == NULL)
- {
- y2error("connecting dbus failed");
- }
}
@@ -185,3 +172,49 @@
return YCPError(string("Undefined subpath for Execute(") + path->toString() + ")");
}
+
+
+YCPValue
+DbusAgent::otherCommand(const YCPTerm& term)
+{
+ string sym = term->name();
+
+ if (sym == "Bus")
+ {
+ if (term->size() != 1 || !term->value(0)->isString())
+ {
+ return YCPError("Bad number of arguments. Expecting Bus (\"type\")");
+ }
+
+ string bus = term->value(0)->asString()->value();
+ if (bus == "system")
+ connect(DBUS_BUS_SYSTEM);
+ else if (bus == "session")
+ connect(DBUS_BUS_SESSION);
+ else
+ return YCPError("Unknown bus");
+
+ return YCPBoolean(true);
+ }
+
+ return YCPNull();
+}
+
+
+void
+DbusAgent::connect(DBusBusType type)
+{
+ y2milestone("connecting dbus");
+
+ connection = dbus_bus_get(type, &error);
+ if (dbus_error_is_set(&error))
+ {
+ y2error("dbus_bus_get() failed (%s)", error.message);
+ dbus_error_free(&error);
+ }
+
+ if (connection == NULL)
+ {
+ y2error("connecting dbus failed");
+ }
+}
Modified: trunk/core/agent-dbus/src/DbusAgent.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/agent-dbus/src/DbusAgent.h?rev=55176&r1=55175&r2=55176&view=diff
==============================================================================
--- trunk/core/agent-dbus/src/DbusAgent.h (original)
+++ trunk/core/agent-dbus/src/DbusAgent.h Sun Feb 1 20:51:49 2009
@@ -52,8 +52,15 @@
*/
virtual YCPList Dir(const YCPPath& path) { return YCPList(); }
+ /**
+ * Used for mounting the agent.
+ */
+ virtual YCPValue otherCommand(const YCPTerm& term);
+
private:
+ void connect(DBusBusType type);
+
DBusConnection* connection;
DBusError error;
Modified: trunk/storage/storage/src/modules/Storage.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Storage.ycp?rev=55176&r1=55175&r2=55176&view=diff
==============================================================================
--- trunk/storage/storage/src/modules/Storage.ycp (original)
+++ trunk/storage/storage/src/modules/Storage.ycp Sun Feb 1 20:51:49 2009
@@ -6383,7 +6383,7 @@
if (!on)
{
- SCR::Execute(.dbus.method,
+ SCR::Execute(.dbus.system.method,
$[ `destination : "org.freedesktop.Hal",
`path : "/org/freedesktop/Hal/Manager",
`interface : "org.freedesktop.Hal.Manager",
@@ -6393,7 +6393,7 @@
}
else
{
- SCR::Execute(.dbus.method,
+ SCR::Execute(.dbus.system.method,
$[ `destination : "org.freedesktop.Hal",
`path : "/org/freedesktop/Hal/Manager",
`interface : "org.freedesktop.Hal.Manager",
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org