Commit graph

80 commits

Author SHA1 Message Date
Andrea Azzarone
c6776a7be6 online-accounts: Don't segfault if get_all_providers_cb is called during init
Due to an API bug in GNOME Online Accounts, the asynchronous
goa_provider_get_all method doesn't accept a GCancellable argument. This makes
it difficult to cancel an ongoing call when the CcGoaPanel gets destroyed.

This was hacked around by taking a reference on the panel for the duration of
the call. Instead of cancelling a pending call on destruction, it would keep the
panel alive until the call was over.

The hack does not consider the case get_all_providers_cb is called while the
panel is still being initialized. E.g. this happen when create the panel passing
the paramenters "add <provider>" because the constuct properties are set just
after cc_goa_panel_init returns and because goa_provider_add_account will result
in a call to g_main_context_iterate (caused by gtk_dialog_run).

In order to work around this we can call goa_provider_get_all in _constructed()
after all construct properties have been set.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/401
2019-09-10 10:29:43 +12:00
Robert Ancell
a3b2725dfa online-accounts: Fix widgets added by GOA being invisible
Fixes #362
2019-03-22 16:28:44 +13:00
Felipe Borges
ef73a423d7 online-accounts: Add shadow to providers icon
The new icons are flat and are more legible with a shadow, just
like the new GNOME application icons.

See https://gitlab.gnome.org/GNOME/Initiatives/issues/2
2019-03-13 13:47:34 +01:00
Adrien Plazas
e76fca5e6e online-accounts: Ellipsize the labels
This will help the window to fit narrow screens even with long
application names.
2018-11-29 00:48:16 +00:00
Robert Ancell
39e0396fd6 online-accounts: Don't use gtk_widget_show_all
It is removed in GTK+ 4
2018-10-18 01:18:57 +00:00
Debarshi Ray
5579314a38 online-accounts: Track the lifecycle of CcGoaPanel across async calls
Due to an API bug in GNOME Online Accounts, the asynchronous
goa_provider_get_all method doesn't accept a GCancellable argument.
This makes it difficult to cancel an ongoing call when the CcGoaPanel
gets destroyed.

Prior to commit c26f8ae018, this was hacked around by taking a
reference on the panel for the duration of the call. Instead of
cancelling a pending call on destruction, it would keep the panel alive
until the call was over. However, that was lost during commit
c26f8ae018.

One thing to bear in mind is that GtkWidgets, CcGoaPanel is one, can
be destroyed by a gtk_widget_destroy call, which is subtly different
than a simple sequence of g_object_unref calls. When gtk_widget_destroy
is used, it invokes the GObject::dispose virtual method of the widget.
It is expected this will cause anything holding a reference to this
widget to drop their references, leading to GObject::finalize being
called. However, there is no guarantee that this will happen in the
same iteration of the GMainLoop. Therefore, it is possible that when
the goa_provider_get_all call finishes, the CcGoaPanel might be in a
disposed, but not yet finalized state.

When a GObject is in a disposed-but-not-finalized state, only a very
limited number of operations can be performed on it. Its reference
count can be altered, the memory used by the instance struct can be
accessed, but none of the member GObjects can be assumed to be valid.
eg., it's definitely illegal to add new rows to the member GtkListBox.
Hence a boolean flag is used to mark the destroyed state of the panel.

This second part is a small improvement over the earlier hack.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/208
2018-10-05 11:20:37 +02:00
Benjamin Berg
c2f601a9d4 Move common panel code from shell/ to panel/common
This creates a new static library called libwidget which the shell links
against.
2018-04-17 15:26:59 +02:00
Andrea Azzarone
d918b02c1f online-accounts: Complete account removal in cc_goa_panel_finalize()
When removing an online account, gnome-control-center gives the user
the possibility to undo the action showing an "undo notification".
Right now if you close the gnome-control-center window, without dismissing
the notification, the online account will not be properly removed.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/25
2018-03-27 21:09:46 +00:00
Andrea Azzarone
3aa89a836a online-accounts: Restore the "add" command
This reverts parts of commit 5a04e40fef
that don't use goa_provider_set_preseed_data.

https://bugzilla.gnome.org/show_bug.cgi?id=794012
2018-03-05 17:48:26 +01:00
Debarshi Ray
5a04e40fef Revert "online-accounts: Accept requests for account creation on ..."
It's been more than four years and nobody ended up using this feature.
However, the extra cookie management that's necessary to implement this
feature has now exposed code, which people actually use, to a
WebKitGTK+ bug that's taking quite some time to be fixed. Therefore,
this is a good an excuse as any to remove this code.

This reverts commit 8762e2f8dc

https://bugzilla.gnome.org/show_bug.cgi?id=789469
2017-10-25 12:34:45 +02:00
Georges Basile Stavracas Neto
a9bf8b5b04 online-accounts: Fix parameter parsing
The Online Accounts panel supports two commands: 'add'
and 'show-account'. The 'add' command must receive an
additional parameter, the 'provider' name, and an
optional 'preseed' parameter.

In the past, Settings would just push all the parameters
to a GVariant and pass to the panels. Now, however, it
skips the first one, making the parameter parsing code
in Online Accounts panel wrong.

This patch fix that by refactoring add_account() code,
and fixing the GVariant parameter parsing.
2017-08-19 11:31:18 -03:00
Georges Basile Stavracas Neto
7ccfa25b47 online-accounts: Fix crash after aborting web view and changing panels
The panel owns both the GtkDialog, and the GoaProvider that is used
with the dialog during goa_provider_add_account. When the panel is
destroyed, it drops its references to the provider but not the dialog,
which is a separate top-level widget. Therefore, if the panel is
switched while the WebKitWebView inside the dialog was still
navigating across pages, then WebKitWebView::decide-policy will be
called with an invalid provider.

To avoid this, and a memory leak, the panel should also destroy the
dialog when it is itself getting destructed.

Note that since the GtkDialog is a template child, it must be
destroyed in dispose. GtkWidget's (ie. the panel's) default default
destroy signal handler NULLifies all template children pointers, so
finalize is too late.

https://bugzilla.gnome.org/show_bug.cgi?id=782043
2017-08-17 21:29:15 +02:00
Debarshi Ray
115a1323b4 Revert "online-accounts: Fix crash after aborting web view ..."
I pushed it by mistake. The GtkDialog needs to be destroyed in
dispose, not finalize.

This reverts commit 60cf7f6b27.

https://bugzilla.gnome.org/show_bug.cgi?id=782043
2017-08-17 21:28:59 +02:00
Georges Basile Stavracas Neto
60cf7f6b27 online-accounts: Fix crash after aborting web view and changing panels
The panel owns both the GtkDialog, and the GoaProvider that is used
with the dialog during goa_provider_add_account. When the panel is
destroyed, it drops its references to the provider but not the dialog,
which is a separate top-level widget. Therefore, if the panel is
switched while the WebKitWebView inside the dialog was still
navigating across pages, then WebKitWebView::decide-policy will be
called with an invalid provider.

To avoid this, and a memory leak, the panel should also destroy the
dialog when it is itself getting destructed.

https://bugzilla.gnome.org/show_bug.cgi?id=782043
2017-08-17 20:05:16 +02:00
Allan Day
432d55b30e online-accounts: Improve panel layout
Ensure sufficient spacing within and around rows. Increase panel
height to make it easier to view the list.
2017-02-22 23:12:52 -03:00
Georges Basile Stavracas Neto
fa81d1679a online-accounts: Only show the accounts list when there are accounts
When the user has no account set, the current implementation of the
Online Accounts panel shows a weird 1px line that is the empty list.

Fix that by only showing the list when there are accounts available.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2017-02-22 23:00:49 -03:00
Debarshi Ray
af7c214aaf online-accounts: Consolidate the row modification code a bit
We have different variants of the same code that iterates over all the
rows in a GtkListBox to find the one that corresponds to a given
account. Some action is then performed on the row, depending on the use
case at hand. In future we might want to look at the other rows in the
list to decide whether to hide the entire GtkFrame or not.

Let's consolidate this to reduce some duplication.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2017-02-22 23:00:49 -03:00
Debarshi Ray
25f97f15ce online-accounts: Shuffle some code around
This will make the subsequent commits easier to read.

We are going to change get_row_for_account to be more generic. Moving
this code higher up will let us use it from a few more call sites.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2017-02-22 23:00:49 -03:00
Georges Basile Stavracas Neto
1e580c679b online-accounts: Add an offline message label
When offline, we currently block the new accounts listbox
so that users can't add new accounts. There is, however,
no visual indication that we're offline, besides the listbox.

Fix that by adding a descriptive label that's only visible
when offline.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2017-02-22 23:00:49 -03:00
Georges Basile Stavracas Neto
e9198bdb4d online-accounts: Add a bottom row to display non-branded providers
As per the mockups, and mimicking the dialog behavior, add a bottom
row that shows non-branded providers.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2017-02-22 23:00:49 -03:00
Georges Basile Stavracas Neto
13da84e451 online-accounts: Add margins to the rows' icons
Per Allan's request, add more margin to the rows' icons.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2017-02-17 17:23:59 +01:00
Georges Basile Stavracas Neto
1f1f2e2b1f online-accounts: Always keep editor dialog size the minimum
When adding and editing accounts, the different options that Online
Accounts provides may require different sizes of the dialog. There is,
however, a specific issue where the dialog can't resize because a
provider widget is interefering with the others.

Fix that by making the dialog's stack non-homogeneous, and making sure
to always reset the dialog size before showing it.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2017-02-17 17:19:45 +01:00
Georges Basile Stavracas Neto
6c633621a4 online-accounts: Drop GoaAddAccountDialog
The dialog is not used anymore, and can be safely removed.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2017-02-13 16:00:53 +01:00
Georges Basile Stavracas Neto
a6858fff62 online-accounts: Hide remove button when account is locked
https://bugzilla.gnome.org/show_bug.cgi?id=774222
2017-02-13 15:09:26 +01:00
Georges Basile Stavracas Neto
5807bb4cc3 online-accounts: Add separators between listbox rows
https://bugzilla.gnome.org/show_bug.cgi?id=774222
2017-02-13 14:59:14 +01:00
Georges Basile Stavracas Neto
14d0988208 online-accounts: Bring back account removal
Following the previous commit, this commit effectively brings
back the account removal feature that was temporarily removed
by 4e197b491f.

This is now reimplemented as an in-app notification, and users
now have the option to undo an accidentally removed account.

Some changes by Debarshi Ray.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2017-02-13 14:37:08 +01:00
Georges Basile Stavracas Neto
d50a07da56 online-accounts: Make adding an account inline to the edit dialog
When adding an account, the old proccess was: use the (removed) toolbar
to open the New Account dialog, select a provider in that dialog, add
the account and see the newly created account in the panel itself.

That approach had issues, e.g. the user would have to close the dialog
if she mistakenly selected a provider. After moving the provider list
to the panel itself, it doesn't make sense anymore to have another
provider list inside the dialog.

Fix this by moving the new account view to the accounts dialog.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2017-02-08 17:33:46 +01:00
Georges Basile Stavracas Neto
6f60e64075 online-accounts: Fix typo
This was introduced while rebasing
c26f8ae018

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2017-02-08 16:26:09 +01:00
Georges Basile Stavracas Neto
76062e1106 online-accounts: Add a stack to the account dialog
This will be used to unify the account creation proccess and the
account editor.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2017-01-03 18:50:23 +01:00
Georges Basile Stavracas Neto
dce3e168d2 online-accounts: Remove unused widgets
These widgets are not used anymore, and they're not present in the
latest designs.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2017-01-03 18:36:41 +01:00
Georges Basile Stavracas Neto
c26f8ae018 online-accounts: Add a providers listbox to the panel
This commit starts moving the contents of the add account dialog
class to the panel itself, by adding a providers listbox below
the list of available account as per the new mockups. As a side effect,
this commit temporarily makes removing an account non-functional.

The next commits are focused on finishing this move and removing
the add account dialog.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2017-01-03 17:52:07 +01:00
Georges Basile Stavracas Neto
4e197b491f online-accounts: Make the main listbox non-selectable
Instead of selecting an account, this commit makes the account
editor dialog only visible through explicit activation of the
account row.

As a side effect, this commit temporarily makes removing an
account non-functional.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2016-12-15 19:40:28 +01:00
Debarshi Ray
182cac1ea3 online-accounts: Update the UI if IsLocked changes
We want to check the IsLocked property whenever we call
show_page_account. ie. when we show an account for the first time, and
also when the displayed account emits account-changed. Hence it is
better to have them together.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2016-12-15 19:08:47 +01:00
Georges Basile Stavracas Neto
1a427a8ac3 online-accounts: Use a dialog to manage the online account
Following the mockups, the Online Accounts panel shall use a modal
dialog to edit online accounts.

This commit moves the current widgets to a dialog, and shows this
dialog whenever an account is selected.

Some changes by Debarshi Ray.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2016-12-15 17:51:59 +01:00
Georges Basile Stavracas Neto
54df308648 online-accounts: Use the ui file to connect to signals
Simplify the code by using the GtkBuilder file to connect to the
signals instead of manually doing it in the code.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2016-11-30 17:23:10 +01:00
Georges Basile Stavracas Neto
bdde40ac15 online-accounts: Use a listbox instead of a treeview
As part of the port to the redesigned Online Accounts panel,
the main widget to be displayed is a GtkListBox, so we can have
finer control of the UI elements and eventually be able to put
real widgets instead of using cell renderers.

This commit, then, makes the Online Account panel use a listbox
widget in the sidebar. The behavior of the panel was not changed.

Since its using a listbox now, we can drop the custom GoaPanelAccountsModel
class.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2016-11-30 17:16:35 +01:00
Georges Basile Stavracas Neto
902ab4e448 online-accounts: Turn into a template class
https://bugzilla.gnome.org/show_bug.cgi?id=774222
2016-11-30 17:16:35 +01:00
Georges Basile Stavracas Neto
e5208a397a online-accounts: Remove unnecessary code
Calling gtk_style_context_set_junction_sides makes no visual
difference. We are using stock GTK+ containers, which should already
be taking care of this.

https://bugzilla.gnome.org/show_bug.cgi?id=774222
2016-11-30 17:16:35 +01:00
Georges Basile Stavracas Neto
013b2d865b online-accounts: Use G_DECLARE_FINAL_TYPE
https://bugzilla.gnome.org/show_bug.cgi?id=774222
2016-11-30 17:16:35 +01:00
Debarshi Ray
2cb0f5e3a3 online-accounts: Let goa_provider_show_account create the full UI
It is not ideal to have the UI split across a semi-stable,
cross-module interface boundary. Non-trivial changes to the UI require
changes to the goa_provider_show_account interface. In fact, we were
already not using it the way it was originally intended to be.
Moreover, it prevents us from having a sufficiently different UI for
certain account types.

Instead, let's just pass a vertical GtkBox to the GoaProvider and let
it fill it up whichever way it wants to.

Bump required GOA version for the new goa_provider_show_account
behaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=769213
2016-08-14 12:18:52 +02:00
Christophe Fergeau
c84722248e shell: Revert "Let panels have their own commandline flags"
This reverts commit 31a8a99440.

This was meant for bgo#695885 which has stalled for a while, so this
feature has no in-tree user. This commit removes it for now, this can be
readded when users for it materialize.

https://bugzilla.gnome.org/show_bug.cgi?id=751597
2015-07-16 11:49:34 +02:00
Bastien Nocera
cff4336032 online-accounts: Prevent the attention-needed icon from getting hidden
By making sure that the label inside each of the list items gets
only whatever space is left by the left and right-side icons.

https://bugzilla.gnome.org/show_bug.cgi?id=746538
2015-04-13 15:05:40 +02:00
Debarshi Ray
b24bfa8197 online-accounts: Disable the remove button for locked accounts
Bump required GOA version for the IsLocked property.

https://bugzilla.gnome.org/show_bug.cgi?id=737665
2015-04-13 14:19:59 +02:00
Rui Matos
54227dc21e online-accounts: Fix deprecated API usage
https://bugzilla.gnome.org/show_bug.cgi?id=740986
2014-12-05 16:13:29 +01:00
Daniel Mustieles
2c5951819d Updated FSF's address 2014-01-29 11:27:38 +01:00
Rui Matos
9288bbbffc online-accounts: Remove unused toplevel window from .ui file
https://bugzilla.gnome.org/show_bug.cgi?id=708286
2013-10-01 10:05:03 +02:00
Debarshi Ray
15b4c7a1bb online-accounts: Fix the use of GtkGrids for showing an account
This has the nice side-effect that rows in the different grids can no
longer get misaligned.

https://bugzilla.gnome.org/show_bug.cgi?id=706645
2013-08-23 16:19:51 +02:00
Marco Barisione
82e6777cb1 online-accounts: use the async function to get all the providers
https://bugzilla.gnome.org/show_bug.cgi?id=706148
2013-08-22 15:27:40 +01:00
Yosef Or Boczko
a9f6f69f70 online-accounts: drop GtkStock
https://bugzilla.gnome.org/show_bug.cgi?id=704178
2013-07-19 15:57:12 +03:00
Emanuele Aina
8762e2f8dc online-accounts: Accept requests for account creation on DBus/cmdline
Also accepts additional data to pre-seed the GOA dialog, in particular
the provider name (eg. 'google') and provider-specific data encoded in a
a GVariant dict ('a{sv}') to eg. pass cookies from an existing web
session (this is only available from DBus activation).

It can be run from the command line as:
 $ gnome-control-center online-accounts add google

https://bugzilla.gnome.org/show_bug.cgi?id=694315
2013-04-23 18:32:59 +02:00