After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 645585 - Use TpBaseClient instead of TpSimpleObserver
Use TpBaseClient instead of TpSimpleObserver
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: message-tray
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks: 643594
 
 
Reported: 2011-03-23 16:38 UTC by Guillaume Desmottes
Modified: 2011-04-27 08:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
http://git.collabora.co.uk/?p=user/cassidy/gnome-shell;a=shortlog;h=refs/heads/base-client-645585 (9.29 KB, patch)
2011-03-23 16:42 UTC, Guillaume Desmottes
needs-work Details | Review
http://git.collabora.co.uk/?p=user/cassidy/gnome-shell;a=shortlog;h=refs/heads/base-client-645585 updated (22.39 KB, patch)
2011-03-28 07:09 UTC, Guillaume Desmottes
none Details | Review
http://git.collabora.co.uk/?p=user/cassidy/gnome-shell;a=shortlog;h=refs/heads/base-client-645585 (20.38 KB, patch)
2011-03-28 17:20 UTC, Guillaume Desmottes
none Details | Review
add shell-tp-client (6.82 KB, patch)
2011-04-04 15:02 UTC, Guillaume Desmottes
reviewed Details | Review
telepathyClient.js: use ShellTpClient instead of TpSimpleObserver (1.42 KB, patch)
2011-04-04 15:02 UTC, Guillaume Desmottes
committed Details | Review
Move Telepathy utility functions from shell-global to shell-tp-client (14.85 KB, patch)
2011-04-04 15:02 UTC, Guillaume Desmottes
committed Details | Review
add shell-tp-client (6.88 KB, patch)
2011-04-05 08:27 UTC, Guillaume Desmottes
committed Details | Review

Description Guillaume Desmottes 2011-03-23 16:38:01 UTC
The first step before implementing more client type (bug #643594) is to port to TpBaseClient. I have a branch doing exactly that while staying feature equivalent with the current code.
Comment 1 Guillaume Desmottes 2011-03-23 16:42:43 UTC
Created attachment 184147 [details] [review]
http://git.collabora.co.uk/?p=user/cassidy/gnome-shell;a=shortlog;h=refs/heads/base-client-645585

 js/ui/telepathyClient.js |   10 +--
 src/Makefile.am          |    2 +
 src/shell-tp-client.c    |  192 ++++++++++++++++++++++++++++++++++++++++++++++
 src/shell-tp-client.h    |   60 ++++++++++++++
 4 files changed, 256 insertions(+), 8 deletions(-)
Comment 2 Dan Winship 2011-03-23 20:21:02 UTC
Comment on attachment 184147 [details] [review]
http://git.collabora.co.uk/?p=user/cassidy/gnome-shell;a=shortlog;h=refs/heads/base-client-645585

quick skim...

If we're going to have shell-tp-client.c, can you move the telepathy-related wrapper methods from shell-global there? Yes, they don't belong with ShellTpClient, but they belong even less with ShellGlobal...

The function-pointer-as-object-property thing is very weird... you should have ShellTpClient emit a signal, which the JS code would connect to.

>+ * shell_tp_client_new:
>+ * @dbus: a #TpDBusDaemon object, may not be %NULL
>+ * @observe_impl: (scope call): the function called when ObserveChannels
>+ * is called

So this is irrelevant if you rewrite to use a signal, but "(scope call)" means "the callback can be freed once shell_tp_client_new() returns". (You want "(scope notified)", but you don't actually need to specify it anyway because it figures that out automatically from the function signature.)
Comment 3 Guillaume Desmottes 2011-03-28 07:08:47 UTC
(In reply to comment #2)
> (From update of attachment 184147 [details] [review])
> If we're going to have shell-tp-client.c, can you move the telepathy-related
> wrapper methods from shell-global there? Yes, they don't belong with
> ShellTpClient, but they belong even less with ShellGlobal...

done

> The function-pointer-as-object-property thing is very weird... you should have
> ShellTpClient emit a signal, which the JS code would connect to.

I did it the same way as it's implemented in TpSimpleObserver. A signal
doesn't really fit here because we have to make sure that the callback is
called once and only once.

> >+ * shell_tp_client_new:
> >+ * @dbus: a #TpDBusDaemon object, may not be %NULL
> >+ * @observe_impl: (scope call): the function called when ObserveChannels
> >+ * is called
> 
> So this is irrelevant if you rewrite to use a signal, but "(scope call)" means
> "the callback can be freed once shell_tp_client_new() returns". (You want
> "(scope notified)", but you don't actually need to specify it anyway because it
> figures that out automatically from the function signature.)

I removed the annotation (squased).
Comment 4 Guillaume Desmottes 2011-03-28 07:09:15 UTC
Created attachment 184417 [details] [review]
http://git.collabora.co.uk/?p=user/cassidy/gnome-shell;a=shortlog;h=refs/heads/base-client-645585 updated

 js/ui/telepathyClient.js |   10 +-
 src/Makefile.am          |    2 +
 src/shell-global.c       |  127 ------------------
 src/shell-global.h       |   27 ----
 src/shell-tp-client.c    |  321 ++++++++++++++++++++++++++++++++++++++++++++++
 src/shell-tp-client.h    |   87 +++++++++++++
 6 files changed, 412 insertions(+), 162 deletions(-)
Comment 5 Guillaume Desmottes 2011-03-28 17:18:49 UTC
(In reply to comment #3)
> > The function-pointer-as-object-property thing is very weird... you should have
> > ShellTpClient emit a signal, which the JS code would connect to.
> 
> I did it the same way as it's implemented in TpSimpleObserver. A signal
> doesn't really fit here because we have to make sure that the callback is
> called once and only once.

I tried this and failed because of bug #645978.

I also tried passing the different callbacks to the constructor and failed
because of bug #645979 so I ended up using setter to pass the callbacks.

Attaching a updated patch.
Comment 6 Guillaume Desmottes 2011-03-28 17:20:38 UTC
Created attachment 184483 [details] [review]
http://git.collabora.co.uk/?p=user/cassidy/gnome-shell;a=shortlog;h=refs/heads/base-client-645585

 js/ui/telepathyClient.js |   11 +--
 src/Makefile.am          |    2 +
 src/shell-global.c       |  127 -----------------------
 src/shell-global.h       |   27 -----
 src/shell-tp-client.c    |  254 ++++++++++++++++++++++++++++++++++++++++++++++
 src/shell-tp-client.h    |   89 ++++++++++++++++
 6 files changed, 348 insertions(+), 162 deletions(-)
Comment 7 Guillaume Desmottes 2011-04-04 15:02:16 UTC
Created attachment 185114 [details] [review]
add shell-tp-client
Comment 8 Guillaume Desmottes 2011-04-04 15:02:20 UTC
Created attachment 185115 [details] [review]
telepathyClient.js: use ShellTpClient instead of TpSimpleObserver
Comment 9 Guillaume Desmottes 2011-04-04 15:02:23 UTC
Created attachment 185116 [details] [review]
Move Telepathy utility functions from shell-global to shell-tp-client
Comment 10 Jasper St. Pierre (not reading bugmail) 2011-04-04 15:40:15 UTC
Review of attachment 185114 [details] [review]:

Looks fine if you're sure that this will be a drop-in replacement.

I assume you're going to add all the Approver/Handler stuff?

::: src/shell-tp-client.c
@@ +61,3 @@
+  ShellTpClient *self = (ShellTpClient *) client;
+
+  self->priv->observe_impl (self, account, connection, channels,

Might want to add a guard for observe_impl, to make sure it's not NULL.

::: src/shell-tp-client.h
@@ +34,3 @@
+  (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_TP_CLIENT, \
+                            ShellTpClientClass))
+#define TP_IS_TP_CLIENT(obj) \

was this supposed to be SHELL_IS_TP_CLIENT?
Comment 11 Guillaume Desmottes 2011-04-05 08:27:03 UTC
(In reply to comment #10)
> Review of attachment 185114 [details] [review]:
> 
> Looks fine if you're sure that this will be a drop-in replacement.

I tested it and didn't notice any regression. The internal code path is pretty similar.

> I assume you're going to add all the Approver/Handler stuff?

Yep, that's the plan.

> ::: src/shell-tp-client.c
> @@ +61,3 @@
> +  ShellTpClient *self = (ShellTpClient *) client;
> +
> +  self->priv->observe_impl (self, account, connection, channels,
> 
> Might want to add a guard for observe_impl, to make sure it's not NULL.

Good idea; added.

> ::: src/shell-tp-client.h
> @@ +34,3 @@
> +  (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_TP_CLIENT, \
> +                            ShellTpClientClass))
> +#define TP_IS_TP_CLIENT(obj) \
> 
> was this supposed to be SHELL_IS_TP_CLIENT?

Nice catch; fixed.
Comment 12 Guillaume Desmottes 2011-04-05 08:27:14 UTC
Created attachment 185178 [details] [review]
add shell-tp-client
Comment 13 Guillaume Desmottes 2011-04-19 12:26:59 UTC
Anything blocking this branch?
Comment 14 Dan Winship 2011-04-19 12:36:58 UTC
gnome-shell is in self-imposed code freeze until 3.0.1 goes out. We should be able to land it shortly after that.
Comment 15 Dan Winship 2011-04-26 15:12:28 UTC
Comment on attachment 185178 [details] [review]
add shell-tp-client

just nitpicks. ok to commit after fixing

>+static void
>+observe_channels (
>+    TpBaseClient *client,
>+    TpAccount *account,

fix this to be indented/aligned like other shell .c files. (no newline after "(", and with variable names aligned on each line).

Likewise for shell_tp_client_set_observe_channels_func, and also in the .h file.
Comment 16 Dan Winship 2011-04-26 15:14:07 UTC
Comment on attachment 185116 [details] [review]
Move Telepathy utility functions from shell-global to shell-tp-client

(didn't actually look very careful. I'm assuming you can cut+paste :)
Comment 17 Guillaume Desmottes 2011-04-27 08:46:43 UTC
Cool, I fixed the identation/alignement and pushed the branch. Thanks for the review!


commit 227da257765a94a8dd0734b0d632005e25b99840
Author: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Date:   Mon Mar 28 09:08:13 2011 +0200

    Move Telepathy utility functions from shell-global to shell-tp-client
    
    https://bugzilla.gnome.org/show_bug.cgi?id=645585

commit 2028f33e3856e05c166919c286469d4ffd40cce8
Author: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Date:   Wed Mar 23 11:22:42 2011 +0100

    telepathyClient.js: use ShellTpClient instead of TpSimpleObserver
    
    https://bugzilla.gnome.org/show_bug.cgi?id=645585

commit 145bf19636a5ba73f8e8382783e6905a6fdc811b
Author: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Date:   Mon Mar 14 12:38:06 2011 +0100

    add shell-tp-client
    
    https://bugzilla.gnome.org/show_bug.cgi?id=645585