[calls/wip/ui-manage-accounts: 24/26] account-row: Disable GtkSwitch if there is no account
- From: Evangelos Ribeiro Tzaras <devrtz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [calls/wip/ui-manage-accounts: 24/26] account-row: Disable GtkSwitch if there is no account
- Date: Fri, 16 Jul 2021 12:16:34 +0000 (UTC)
commit 3ae2440046535b2405602ad8abbb91c1190a796a
Author: Evangelos Ribeiro Tzaras <evangelos tzaras puri sm>
Date: Tue Jun 29 15:51:22 2021 +0200
account-row: Disable GtkSwitch if there is no account
src/calls-account-row.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
---
diff --git a/src/calls-account-row.c b/src/calls-account-row.c
index ddffb589..ff4f2304 100644
--- a/src/calls-account-row.c
+++ b/src/calls-account-row.c
@@ -119,6 +119,21 @@ on_credentials_updated (CallsAccountRow *self)
hdy_avatar_set_text (self->avatar, user);
}
+
+static void
+on_account_changed (CallsAccountRow *self)
+{
+ CallsAccount *account = calls_credentials_get_account (self->credentials);
+
+ if (account) {
+ gtk_widget_set_sensitive (GTK_WIDGET (self->online_switch), TRUE);
+
+ } else {
+ gtk_widget_set_sensitive (GTK_WIDGET (self->online_switch), FALSE);
+ gtk_switch_set_active (self->online_switch, FALSE);
+ }
+}
+
static void
calls_account_row_set_property (GObject *object,
guint property_id,
@@ -172,6 +187,11 @@ calls_account_row_constructed (GObject *object)
self);
on_credentials_updated (self);
+
+ g_signal_connect_swapped (self->credentials,
+ "notify::account",
+ G_CALLBACK (on_account_changed),
+ self);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]