GNOME Bugzilla – Bug 629075
Add folks command line application
Last modified: 2010-12-30 18:00:43 UTC
I've got a local branch with a partially-working command line application to allow interactive inspection of all the data exposed by libfolks. It's not ready to be reviewed yet; I'm just creating the bug so that the dependencies can be tracked.
(Mass changing milestones; please search for this phrase to delete the bug spam.)
Created attachment 170774 [details] [review] Add a folks command line client http://git.collabora.co.uk/?p=user/pwith/folks;a=shortlog;h=refs/heads/629075-folks-inspect This is a mostly finished command line client. It needs some polish, and the signal handling needs some improvement, but it's mostly there.
(In reply to comment #2) > Created an attachment (id=170774) [details] [review] > Add a folks command line client > > http://git.collabora.co.uk/?p=user/pwith/folks;a=shortlog;h=refs/heads/629075-folks-inspect > > This is a mostly finished command line client. It needs some polish, and the > signal handling needs some improvement, but it's mostly there. Finally got around to looking at this. It mostly looks good (and way more thorough than I expected!), but I'm hitting some compiler errors (with the latest vala 0.10.x from git): ========================= make[3]: Entering directory `/home/treitter/checkout/gnome/folks/tools/inspect' VALAC folks_inspect_vala.stamp signal-manager.vala:346.25-346.68: error: `GLib.Closure' does not have a default constructor Closure closure = new Closure (this.CLOSURE_STRUCT_SIZE, this); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ signal-manager.vala:347.7-347.30: error: The name `set_meta_marshal' does not exist in the context of `GLib.Closure?' closure.set_meta_marshal (null, this.signal_meta_marshaller); ^^^^^^^^^^^^^^^^^^^^^^^^ Compilation failed: 2 error(s), 0 warning(s) ========================= Closure looks like an empty class.
(In reply to comment #3) > Closure looks like an empty class. That's bug #629074, which has been fixed, but I fear only for Vala 0.12.x. I don't see why it couldn't be fixed for 0.10.x too though.
(In reply to comment #4) > (In reply to comment #3) > > Closure looks like an empty class. > > That's bug #629074, which has been fixed, but I fear only for Vala 0.12.x. I > don't see why it couldn't be fixed for 0.10.x too though. Well, we need to port to 0.12.x anyhow, so no need to wait for a newer 0.10.x release anyhow.
I just tried this again on top of the latest master. After adjusting to the new Thread.create() API, ======================================================================== diff --git a/tools/inspect/inspect.vala b/tools/inspect/inspect.vala index ef66039..57cf571 100644 --- a/tools/inspect/inspect.vala +++ b/tools/inspect/inspect.vala @@ -98,7 +98,7 @@ public class Folks.Inspect.Client : Object try { - this.folks_thread = Thread.create ( + this.folks_thread = Thread<void*>.create<void*> ( this.folks_thread_main, true); } catch (ThreadError e) ======================================================================== I hit some new bug with variadic functions (bug #638308), as well as a variable-naming bug that we can work around (bug #638310). ======================================================================== One bit I'm not clear about: private bool parse_signal_id (string input, out Type class_type, out Object? class_instance, out string? signal_name, out string? detail_string) { ... string _signal_name = (parts.length > 1) ? parts[1] : null; string _detail_string = (parts.length > 2) ? parts[2] : null; /* FIXME: is this really meant to check the parameters (which don't seem * to be initialized in the calling Vala code), or should it be * checking the _signal_name, _detail_string temporary variables above? */ if (signal_name == "" || detail_string == "") { Utils.print_line ("Invalid signal identifier '%s'.", input); return false; } ... }
I was pointed to a work-around for bug #638308, so I did a little testing, found and worked around #638363, and merged the result: commit 96b1a7b28989b50cc0bb2241ece5889a2b7fb0cf Author: Philip Withnall <philip.withnall@collabora.co.uk> Date: Mon Sep 6 19:38:21 2010 +0100 Bug 629075 – Add folks command line application Add an interactive command line inspection utility for libfolks. Closes: bgo#629075. NEWS | 4 + configure.ac | 21 ++ tools/Makefile.am | 8 + tools/inspect/Makefile.am | 40 +++ tools/inspect/command-backends.vala | 102 ++++++ tools/inspect/command-help.vala | 89 +++++ tools/inspect/command-individuals.vala | 90 +++++ tools/inspect/command-persona-stores.vala | 107 ++++++ tools/inspect/command-personas.vala | 81 +++++ tools/inspect/command-quit.vala | 57 ++++ tools/inspect/command-signals.vala | 250 ++++++++++++++ tools/inspect/inspect.vala | 223 +++++++++++++ tools/inspect/signal-manager.vala | 502 +++++++++++++++++++++++++++++ tools/inspect/utils.vala | 477 +++++++++++++++++++++++++++ 14 files changed, 2051 insertions(+), 0 deletions(-)
(In reply to comment #6) > ... > One bit I'm not clear about: > > private bool parse_signal_id (string input, > out Type class_type, > out Object? class_instance, > out string? signal_name, > out string? detail_string) > { > ... > string _signal_name = (parts.length > 1) ? parts[1] : null; > string _detail_string = (parts.length > 2) ? parts[2] : null; > > /* FIXME: is this really meant to check the parameters (which don't seem > * to be initialized in the calling Vala code), or should it be > * checking the _signal_name, _detail_string temporary variables above? > */ > if (signal_name == "" || detail_string == "") > { > Utils.print_line ("Invalid signal identifier '%s'.", input); > return false; > } > ... > } I realized I didn't resolve this issue - could you double-check this, Philip? The names of some of the variables changed so search for the function name.
(In reply to comment #8) > I realized I didn't resolve this issue - could you double-check this, Philip? > The names of some of the variables changed so search for the function name. You're absolutely right. Fixed: commit 0f65abfa48d5f615419a871a726ca38d9cb3c76b Author: Philip Withnall <philip.withnall@collabora.co.uk> Date: Thu Dec 30 17:59:37 2010 +0000 Fix some variable names in the inspector signal parsing code See: https://bugzilla.gnome.org/show_bug.cgi?id=629075#c8 tools/inspect/command-signals.vala | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)