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 680458 - Open specific account through command-line
Open specific account through command-line
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Online Accounts
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: GNOME Online Accounts maintainer(s)
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-07-23 15:34 UTC by Matthew Barnes
Modified: 2012-08-20 17:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Untested patch (3.47 KB, patch)
2012-07-24 16:05 UTC, Matthew Barnes
none Details | Review
Tested patch (3.60 KB, patch)
2012-07-25 14:13 UTC, Matthew Barnes
none Details | Review
online-accounts: Open specific account through command-line (3.99 KB, patch)
2012-08-08 15:05 UTC, Debarshi Ray
needs-work Details | Review
online-accounts: Open specific account through command-line (3.77 KB, patch)
2012-08-11 10:16 UTC, Debarshi Ray
accepted-commit_now Details | Review

Description Matthew Barnes 2012-07-23 15:34:52 UTC
Several panels in gnome-control-center present a list of items on the left hand side and details about the selected item on the right hand side.  Some examples include Online Accounts, Bluetooth, Network, Printers, Details, and User Accounts.

My particular use case is for Online Accounts.  I would like to open gnome-control-center to a particular Online Account from Evolution, since Evolution defers disabling and deleting such accounts to the Online Accounts interface.

My initial proposal was twarted by the realization that gnome-control-center currently takes a list of panels to display.  That doesn't seem very useful to me, so here's my proposal anyway:

   gnome-control-center [ PANEL_NAME  [ ITEM_NAME ] ]

This would take a single PANEL_NAME argument which works the same as the current command-line arguments.  The second and optional argument is an ITEM_NAME.

The ITEM_NAME would simply be passed to the panel module verbatim.  The panel module would then interpret the ITEM_NAME and select the corresponding item (if applicable) or just ignore it.

The meaning of ITEM_NAME would be panel-specific.  For Online Accounts, ITEM_NAME could be an account ID.  For other panels, ITEM_NAME could be a device ID or user ID.

Does this sound feasible, or is the current command-line parsing unchangable?
Comment 1 Matthias Clasen 2012-07-24 13:01:43 UTC
I don't think we accept more than one panel name - don't see how that would make sense either. We already have some cases where we allow to specify a tab on multitabbed panels, e.g 

gnome-control-center keyboard shortcuts
gnome-control-center region formats

I could easily see us extend that to

gnome-control-center online-accounts exchange
Comment 2 Matthew Barnes 2012-07-24 13:16:38 UTC
Ah you're right.  The arguments are collected by way of G_OPTION_REMAINING into a variable named "start_panels", but that indeed looks like just a misnomer.  Good, so we're closer than I thought.

Rishi - can you take a look at whether the current control center infrastructure is adequate for passing an account ID from the command-line up to the Online Accounts panel?
Comment 3 Bastien Nocera 2012-07-24 13:36:39 UTC
Look for ARGV in cc-sound-panel.c for examples of how to do it, there's already a framework for that, and you'd need support directly in the goa panel.

That works for example:
$ gnome-control-center sound effects
Comment 4 Debarshi Ray 2012-07-24 14:30:22 UTC
Matthew, thanks for filing this bug. It had escaped my mind. Patch coming up.
Comment 5 Matthew Barnes 2012-07-24 16:05:08 UTC
Created attachment 219588 [details] [review]
Untested patch

(In reply to comment #3)
> Look for ARGV in cc-sound-panel.c for examples of how to do it, there's already
> a framework for that, and you'd need support directly in the goa panel.

Thanks for the tip.  Here's a patch for the online-accounts panel.

Patch is untested because gnome-control-center's dependencies are too bleeding edge for me to easily build right now, but it's a starting point at least.
Comment 6 Matthew Barnes 2012-07-25 14:13:07 UTC
Created attachment 219629 [details] [review]
Tested patch

Had time today to struggle through all the dependency issues so I could actually build and test gnome-control-center with the patch.  The original patch had some typos, but otherwise worked.  Here's an updated one that actually builds.
Comment 7 Debarshi Ray 2012-08-08 14:59:35 UTC
(In reply to comment #6)
> Created an attachment (id=219629) [details] [review]
> Tested patch
> 
> Had time today to struggle through all the dependency issues so I could
> actually build and test gnome-control-center with the patch.  The original
> patch had some typos, but otherwise worked.  Here's an updated one that
> actually builds.

Works for me.
Comment 8 Debarshi Ray 2012-08-08 15:01:11 UTC
I am thinking if we should go even further and support things like:
+ gnome-control-center online-accounts add facebook
+ gnome-control-center online-accounts refresh google
+ gnome-control-center online-accounts show <account_id>

?
Comment 9 Debarshi Ray 2012-08-08 15:05:45 UTC
Created attachment 220694 [details] [review]
online-accounts: Open specific account through command-line

Same patch in "git format-patch" form attributed to "Matthew Barnes <mbarnes@redhat.com>".
Comment 10 Bastien Nocera 2012-08-08 15:19:33 UTC
Review of attachment 220694 [details] [review]:

::: panels/online-accounts/cc-online-accounts-panel.c
@@ +482,3 @@
+
+  /* XXX A "lookup by account ID" convenience function in GoaClient
+   *     would be helpful since this is such a common operation. */

Why aren't we fixing g-o-a there then?

@@ +493,3 @@
+      gboolean match;
+
+      /* XXX I assume this doesn't need to be thread-safe? */

Can we fix that? (the property setting should happen in the main loop)
Comment 11 Matthew Barnes 2012-08-10 13:09:19 UTC
(In reply to comment #10)
> Why aren't we fixing g-o-a there then?

Rishi said he'll be adding such a function to GOA.

> Can we fix that? (the property setting should happen in the main loop)

Feel free to remove the comment then.  I was just being paranoid.
Comment 12 Debarshi Ray 2012-08-11 10:16:07 UTC
Created attachment 220922 [details] [review]
online-accounts: Open specific account through command-line

Updated patch to use goa_client_lookup_by_id.
Comment 13 Bastien Nocera 2012-08-20 09:56:37 UTC
Review of attachment 220922 [details] [review]:

Looks good.
Comment 14 Debarshi Ray 2012-08-20 17:59:55 UTC
commit 7dd80f829fe092e25d8e8c8bb64eb467c30db3be
Author:     Matthew Barnes <mbarnes@redhat.com>
AuthorDate: Wed Aug 8 17:04:39 2012 +0200
Commit:     Bastien Nocera <hadess@hadess.net>
CommitDate: Sat Aug 18 20:19:15 2012 +0100

    online-accounts: Open specific account through command-line
    
    Bump required GOA version to 3.5.90 for goa_client_lookup_by_id.
    
    Fixes: https://bugzilla.gnome.org/680458