Merge lp:~alexlauni/unity/state-introspection into lp:unity
| Status: | Merged |
|---|---|
| Approved by: | Neil J. Patel on 2010-11-24 |
| Approved revision: | 632 |
| Merged at revision: | 626 |
| Proposed branch: | lp:~alexlauni/unity/state-introspection |
| Merge into: | lp:unity |
| Diff against target: |
708 lines (+500/-55) 10 files modified
src/Introspectable.cpp (+61/-0) src/Introspectable.h (+54/-0) src/IntrospectionDBusInterface.cpp (+223/-0) src/IntrospectionDBusInterface.h (+54/-0) src/Launcher.cpp (+9/-0) src/Launcher.h (+47/-42) src/PanelView.cpp (+9/-0) src/PanelView.h (+8/-2) src/unity.cpp (+16/-1) src/unity.h (+19/-10) |
| To merge this branch: | bzr merge lp:~alexlauni/unity/state-introspection |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Neil J. Patel (community) | 2010-11-22 | Approve on 2010-11-24 | |
|
Review via email:
|
|||
Description of the Change
Implements a debugging interface to get a snapshot of what Unity's internal data structures contain.
In have a few comments in addition to what Neil said. But generally
nice work Alex :-)
> === added file 'src/Introspect
> SNIP
> +Introspectable
> +{
> + GVariant *result;
> + GVariant *childResults;
> + GVariantBuilder *builder;
> +
> + builder = g_variant_
> + for (std::list<
> + g_variant_
> + }
> + addProperties (builder);
> +
> + childResults = g_variant_new ("(a{sv})", builder);
> + g_variant_
> +
> + if (_children.size () > 0) {
> + builder = g_variant_
> + g_variant_
> + result = g_variant_new ("(a{sv})", builder);
> + g_variant_
> +
> + return result;
> + }
> +
> + return childResults;
> +}
You can use a stack allocated GVariantBuilder here to simplify the
code somewhat. You rarely need heap allocated ones.
> === added file 'src/StateIntro
> +void
> +StateIntrospec
> +{
> + _owner_id = g_bus_own_name (G_BUS_
> + UNITY_STATE_
> + G_BUS_NAME_
> + &StateIntrospec
> + &StateIntrospec
> + &StateIntrospec
> + this,
> + NULL);
> +
> +}
I don't think we need to own a particular name on the bus for
debugging. We should probably assume that Unity owns the
com.canonical.Unity name and just let the rest be object hierarchies
below that name. Neil?
> +void
> +StateIntrospec
> + const gchar *sender,
> + const gchar *objectPath,
> + const gchar *ifaceName,
> + const gchar *methodName,
> + GVariant *parameters,
> + GDBusMethodInvo
> + gpointer data)
> +{
> + if (g_strcmp0 (methodName, "GetState") == 0) {
> + GVariant *ret;
> + const gchar *input;
> + g_variant_get (parameters, "(&s)", &input);
> +
> + ret = getState (input);
> + g_dbus_
> + g_variant_unref (ret);
> + } else {
> + g_dbus_
> +...
And two more things :-)
Is it StateIntrospection or just Introspection? I think just
Introspection makes sense, in which case you should probably rename
StateIntrospect
I don't think the new files have been added to Makefile.am?
| Neil J. Patel (njpatel) wrote : | # |
RE: DBus, we don't have any one object owning the name right now and I don't plan to add that at least until the week after next, so I think it's okay as it is right now, it would be simple-enough to move to another file once I have that sorted in my head.
Just own/unown com.canonical.Unity from the Compiz plugin load/unload.
There's nothing more to it.
It could possibly just be part of this branch. Alex - can you locate the
Compiz hooks?
On Nov 24, 2010 3:41 PM, "Neil J. Patel" <email address hidden> wrote:
> RE: DBus, we don't have any one object owning the name right now and I
don't plan to add that at least until the week after next, so I think it's
okay as it is right now, it would be simple-enough to move to another file
once I have that sorted in my head.
>
>
> --
>
https:/
> Your team Unity Team is subscribed to branch lp:unity.
- 622. By Alex Launi on 2010-11-24
-
Fix copyright in headers
- 623. By Alex Launi on 2010-11-24
-
Fix Canonical DBus namespacing
- 624. By Alex Launi on 2010-11-24
-
Fix method names
- 625. By Alex Launi on 2010-11-24
-
run astyle over my files
- 626. By Alex Launi on 2010-11-24
-
free gerror after failing to register bus
- 627. By Alex Launi on 2010-11-24
-
Fix compilation
- 628. By Alex Launi on 2010-11-24
-
Make DBusMethodCall private
- 629. By Alex Launi on 2010-11-24
-
Rename DBus interface from StateIntrospection to Introspection
- 630. By Alex Launi on 2010-11-24
-
Add example of property adding to Introspectable.h
- 631. By Alex Launi on 2010-11-24
-
A last couple of for s/State//
| Neil J. Patel (njpatel) wrote : | # |
Well, no, 'cos there are some bits and pieces that will depend on that and which I'd like to make testable, and hence I can't keep it tied to the plugin, otherwise I'll just have it to move it from there later. So, seeing as this is done, I'll take this as the lesser of two evils today :)
Approved pending the fix of the conflict with trunk as mentioned on #ayatana.
Nice work, and don't forget to add your name to AUTHORS :)
- 632. By Alex Launi on 2010-11-24
-
Merge trunk


Overall looks great, there are some fixes needed, though:
- Use copyright headers from the other files, should be GPLv3 (no later), (C) Canonical and Authored by: You.
- /com/canonical not /org/canonical, same for org.canoni....
- g_error_free after printing the error
- static void Hello() not
static void
Hello ()
- Does initStateIntros pection need to be it's own function? Can't be done in the constructor of StateIntrospect ionDBusInterfac e?
- Style:
- AddChild not addChild
- 2sp indenting
- parenthesis on new line
Re: Style, sorry this isn't more obvious, I'll make sure to clean up the existing code and make a note in the source too. You can use `astyle -s2 -b -S -N -w -Y -M80 -p -H -d -j -k3 -n -z2` to update the style of the code to the correct one (apart from function names, of course).