mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-12 23:05:31 +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
|
static void
|
||||||
on_contacts_actions_updated (CallsContactsProvider *self)
|
on_contacts_actions_updated (CallsContactsProvider *self)
|
||||||
{
|
{
|
||||||
|
gboolean has_action;
|
||||||
|
gboolean action_enabled;
|
||||||
const char *contact_action_name = "new-contact-data";
|
const char *contact_action_name = "new-contact-data";
|
||||||
|
|
||||||
g_assert (CALLS_IS_CONTACTS_PROVIDER (self));
|
g_assert (CALLS_IS_CONTACTS_PROVIDER (self));
|
||||||
|
|
||||||
if (self->can_add_contacts)
|
has_action =
|
||||||
return;
|
g_action_group_has_action (G_ACTION_GROUP (self->contacts_action_group),
|
||||||
|
contact_action_name);
|
||||||
if (g_action_group_has_action (G_ACTION_GROUP (self->contacts_action_group),
|
action_enabled =
|
||||||
contact_action_name) &&
|
|
||||||
g_action_group_get_action_enabled (G_ACTION_GROUP (self->contacts_action_group),
|
g_action_group_get_action_enabled (G_ACTION_GROUP (self->contacts_action_group),
|
||||||
contact_action_name)) {
|
contact_action_name);
|
||||||
g_debug ("Can add contacts");
|
|
||||||
|
|
||||||
self->can_add_contacts = TRUE;
|
set_can_add_contacts (self, has_action && action_enabled);
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_CAN_ADD_CONTACTS]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue