mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-12 14:55:33 +00:00
contact-provider: Allow can-add-contacts to be reset
Under normal conditions it is not expected that whether we can add contacts or not (based on the presence of the appropriate action on gnome-contacts) changes. Nevertheless it can be beneficial for debugging when installing patched and unpatched versions of gnome-contacts.
This commit is contained in:
parent
b948629274
commit
79401f6227
1 changed files with 25 additions and 11 deletions
|
@ -190,25 +190,39 @@ folks_prepare_cb (GObject *obj,
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
set_can_add_contacts (CallsContactsProvider *self,
|
||||
gboolean can_add)
|
||||
{
|
||||
g_assert (CALLS_IS_CONTACTS_PROVIDER (self));
|
||||
|
||||
g_info ("Can%s add contacts", can_add ? "" : "not");
|
||||
|
||||
if (self->can_add_contacts == can_add)
|
||||
return;
|
||||
|
||||
self->can_add_contacts = can_add;
|
||||
g_object_notify_by_pspec(G_OBJECT (self), props[PROP_CAN_ADD_CONTACTS]);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
on_contacts_actions_updated (CallsContactsProvider *self)
|
||||
{
|
||||
gboolean has_action;
|
||||
gboolean action_enabled;
|
||||
const char *contact_action_name = "new-contact-data";
|
||||
|
||||
g_assert (CALLS_IS_CONTACTS_PROVIDER (self));
|
||||
|
||||
if (self->can_add_contacts)
|
||||
return;
|
||||
has_action =
|
||||
g_action_group_has_action (G_ACTION_GROUP (self->contacts_action_group),
|
||||
contact_action_name);
|
||||
action_enabled =
|
||||
g_action_group_get_action_enabled (G_ACTION_GROUP (self->contacts_action_group),
|
||||
contact_action_name);
|
||||
|
||||
if (g_action_group_has_action (G_ACTION_GROUP (self->contacts_action_group),
|
||||
contact_action_name) &&
|
||||
g_action_group_get_action_enabled (G_ACTION_GROUP (self->contacts_action_group),
|
||||
contact_action_name)) {
|
||||
g_debug ("Can add contacts");
|
||||
|
||||
self->can_add_contacts = TRUE;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_CAN_ADD_CONTACTS]);
|
||||
}
|
||||
set_can_add_contacts (self, has_action && action_enabled);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue