summaryrefslogtreecommitdiff
path: root/plugins
diff options
authorBrandon Schaefer <brandontschaefer@gmail.com>2012-06-29 15:15:29 -0700
committerBrandon Schaefer <brandontschaefer@gmail.com>2012-06-29 15:15:29 -0700
commitdc8d9ce541e255f4581747f1280b9689b39868af (patch)
treece4a5fedb75f4d137657ce16599b88ddc3270e1d /plugins
parentcad0bd7ca28cdfe42392abc034a0b00b597e68a1 (diff)
parentbbf067650a9c18fcee5265fa7d53f5d9a2cd2757 (diff)
*merged trunk
(bzr r2452.2.2)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/unityshell/src/DebugDBusInterface.cpp19
-rw-r--r--plugins/unityshell/src/XPathQueryPart.cpp32
2 files changed, 29 insertions, 22 deletions
diff --git a/plugins/unityshell/src/DebugDBusInterface.cpp b/plugins/unityshell/src/DebugDBusInterface.cpp
index 9d7a24971..42e55de39 100644
--- a/plugins/unityshell/src/DebugDBusInterface.cpp
+++ b/plugins/unityshell/src/DebugDBusInterface.cpp
@@ -60,13 +60,17 @@ const char* DebugDBusInterface::DBUS_DEBUG_OBJECT_PATH = "/com/canonical/Unity/D
const gchar DebugDBusInterface::introspection_xml[] =
" <node>"
- " <interface name='com.canonical.Unity.Debug.Introspection'>"
+ " <interface name='com.canonical.Autopilot.Introspection'>"
""
" <method name='GetState'>"
" <arg type='s' name='piece' direction='in' />"
- " <arg type='aa{sv}' name='state' direction='out' />"
+ " <arg type='a(sv)' name='state' direction='out' />"
" </method>"
""
+ " </interface>"
+ ""
+ " <interface name='com.canonical.Unity.Debug.Logging'>"
+ ""
" <method name='StartLogToFile'>"
" <arg type='s' name='file_path' direction='in' />"
" </method>"
@@ -223,14 +227,17 @@ GVariant* GetState(std::string const& query)
// process the XPath query:
std::list<Introspectable*> parts = GetIntrospectableNodesFromQuery(query, _parent_introspectable);
GVariantBuilder builder;
- g_variant_builder_init(&builder, G_VARIANT_TYPE("aa{sv}"));
-
+ g_variant_builder_init(&builder, G_VARIANT_TYPE("a(sv)"));
+ if (parts.empty())
+ {
+ LOG_WARNING(logger) << "Query '" << query << "' Did not match anything.";
+ }
for (Introspectable *node : parts)
{
- g_variant_builder_add_value(&builder, node->Introspect());
+ g_variant_builder_add(&builder, "(sv)", node->GetName().c_str(), node->Introspect());
}
- return g_variant_new("(aa{sv})", &builder);
+ return g_variant_new("(a(sv))", &builder);
}
void StartLogToFile(std::string const& file_path)
diff --git a/plugins/unityshell/src/XPathQueryPart.cpp b/plugins/unityshell/src/XPathQueryPart.cpp
index cf3026733..a42a65c34 100644
--- a/plugins/unityshell/src/XPathQueryPart.cpp
+++ b/plugins/unityshell/src/XPathQueryPart.cpp
@@ -41,12 +41,12 @@ XPathQueryPart::XPathQueryPart(std::string const& query_part)
{
std::vector<std::string> part_pieces;
boost::algorithm::split(part_pieces, query_part, boost::algorithm::is_any_of("[]="));
- // Boost's split() implementation does not match it's documentation! According to the
- // docs, it's not supposed to add empty strings, but it does, which is a PITA. This
+ // Boost's split() implementation does not match it's documentation! According to the
+ // docs, it's not supposed to add empty strings, but it does, which is a PITA. This
// next line removes them:
- part_pieces.erase( std::remove_if( part_pieces.begin(),
- part_pieces.end(),
- boost::bind( &std::string::empty, _1 ) ),
+ part_pieces.erase( std::remove_if( part_pieces.begin(),
+ part_pieces.end(),
+ boost::bind( &std::string::empty, _1 ) ),
part_pieces.end());
if (part_pieces.size() == 1)
{
@@ -71,7 +71,7 @@ bool XPathQueryPart::Matches(Introspectable* node) const
bool matches = false;
if (param_name_ == "")
{
- matches = node->GetName() == node_name_;
+ matches = (node_name_ == "*" || node->GetName() == node_name_);
}
else
{
@@ -85,9 +85,9 @@ bool XPathQueryPart::Matches(Introspectable* node) const
if (prop_value != NULL)
{
GVariantClass prop_val_type = g_variant_classify(prop_value);
- // it'd be nice to be able to do all this with one method. However, the booleans need
+ // it'd be nice to be able to do all this with one method. However, the booleans need
// special treatment, and I can't figure out how to group all the integer types together
- // without resorting to template functions.... and we all know what happens when you
+ // without resorting to template functions.... and we all know what happens when you
// start doing that...
switch (prop_val_type)
{
@@ -116,7 +116,7 @@ bool XPathQueryPart::Matches(Introspectable* node) const
std::stringstream stream(param_value_);
int val; // changing this to guchar causes problems.
stream >> val;
- matches = (stream.rdstate() & (stream.badbit|stream.failbit)) == 0 &&
+ matches = (stream.rdstate() & (stream.badbit|stream.failbit)) == 0 &&
val == g_variant_get_byte(prop_value);
}
break;
@@ -125,7 +125,7 @@ bool XPathQueryPart::Matches(Introspectable* node) const
std::stringstream stream(param_value_);
gint16 val;
stream >> val;
- matches = (stream.rdstate() & (stream.badbit|stream.failbit)) == 0 &&
+ matches = (stream.rdstate() & (stream.badbit|stream.failbit)) == 0 &&
val == g_variant_get_int16(prop_value);
}
break;
@@ -134,8 +134,8 @@ bool XPathQueryPart::Matches(Introspectable* node) const
std::stringstream stream(param_value_);
guint16 val;
stream >> val;
- matches = (stream.rdstate() & (stream.badbit|stream.failbit)) == 0 &&
- val == g_variant_get_uint16(prop_value);
+ matches = (stream.rdstate() & (stream.badbit|stream.failbit)) == 0 &&
+ val == g_variant_get_uint16(prop_value);
}
break;
case G_VARIANT_CLASS_INT32:
@@ -143,7 +143,7 @@ bool XPathQueryPart::Matches(Introspectable* node) const
std::stringstream stream(param_value_);
gint32 val;
stream >> val;
- matches = (stream.rdstate() & (stream.badbit|stream.failbit)) == 0 &&
+ matches = (stream.rdstate() & (stream.badbit|stream.failbit)) == 0 &&
val == g_variant_get_int32(prop_value);
}
break;
@@ -152,7 +152,7 @@ bool XPathQueryPart::Matches(Introspectable* node) const
std::stringstream stream(param_value_);
guint32 val;
stream >> val;
- matches = (stream.rdstate() & (stream.badbit|stream.failbit)) == 0 &&
+ matches = (stream.rdstate() & (stream.badbit|stream.failbit)) == 0 &&
val == g_variant_get_uint32(prop_value);
}
break;
@@ -161,7 +161,7 @@ bool XPathQueryPart::Matches(Introspectable* node) const
std::stringstream stream(param_value_);
gint64 val;
stream >> val;
- matches = (stream.rdstate() & (stream.badbit|stream.failbit)) == 0 &&
+ matches = (stream.rdstate() & (stream.badbit|stream.failbit)) == 0 &&
val == g_variant_get_int64(prop_value);
}
break;
@@ -170,7 +170,7 @@ bool XPathQueryPart::Matches(Introspectable* node) const
std::stringstream stream(param_value_);
guint64 val;
stream >> val;
- matches = (stream.rdstate() & (stream.badbit|stream.failbit)) == 0 &&
+ matches = (stream.rdstate() & (stream.badbit|stream.failbit)) == 0 &&
val == g_variant_get_uint64(prop_value);
}
break;