GNOME Bugzilla – Bug 680458
Open specific account through command-line
Last modified: 2012-08-20 17:59:55 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?
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
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?
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
Matthew, thanks for filing this bug. It had escaped my mind. Patch coming up.
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.
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.
(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.
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> ?
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>".
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)
(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.
Created attachment 220922 [details] [review] online-accounts: Open specific account through command-line Updated patch to use goa_client_lookup_by_id.
Review of attachment 220922 [details] [review]: Looks good.
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