diff options
Diffstat (limited to 'libempathy-gtk/empathy-account-widget.c')
-rw-r--r-- | libempathy-gtk/empathy-account-widget.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 02ca44cf3..684ff4c9c 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -61,6 +61,9 @@ typedef struct { gboolean simple; + gboolean contains_pending_changes; + gboolean original_enabled_checkbox_value; + /* An EmpathyAccountWidget can be used to either create an account or * modify it. When we are creating an account, this member is set to TRUE */ gboolean creating_account; @@ -97,6 +100,7 @@ account_widget_set_control_buttons_sensitivity (EmpathyAccountWidget *self, { gtk_widget_set_sensitive (priv->apply_button, sensitive); gtk_widget_set_sensitive (priv->cancel_button, sensitive); + priv->contains_pending_changes = sensitive; } } @@ -109,10 +113,7 @@ account_widget_handle_control_buttons_sensitivity (EmpathyAccountWidget *self) is_valid = empathy_account_settings_is_valid (priv->settings); if (!priv->simple) - { - gtk_widget_set_sensitive (priv->apply_button, is_valid); - gtk_widget_set_sensitive (priv->cancel_button, is_valid); - } + account_widget_set_control_buttons_sensitivity (self, is_valid); g_signal_emit (self, signals[HANDLE_APPLY], 0, is_valid); } @@ -1237,9 +1238,11 @@ do_constructed (GObject *obj) priv->enabled_checkbox = gtk_check_button_new_with_label (_("Enabled")); + priv->original_enabled_checkbox_value = + empathy_account_is_enabled (account); gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON (priv->enabled_checkbox), - empathy_account_is_enabled (account)); + priv->original_enabled_checkbox_value); g_object_get (priv->table_common_settings, "n-rows", &nb_rows, "n-columns", &nb_columns, NULL); @@ -1388,6 +1391,26 @@ empathy_account_widget_init (EmpathyAccountWidget *self) /* public methods */ void +empathy_account_widget_discard_pending_changes + (EmpathyAccountWidget *widget) +{ + EmpathyAccountWidgetPriv *priv = GET_PRIV (widget); + + empathy_account_settings_discard_changes (priv->settings); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->enabled_checkbox), + priv->original_enabled_checkbox_value); + priv->contains_pending_changes = FALSE; +} + +gboolean +empathy_account_widget_contains_pending_changes (EmpathyAccountWidget *widget) +{ + EmpathyAccountWidgetPriv *priv = GET_PRIV (widget); + + return priv->contains_pending_changes; +} + +void empathy_account_widget_handle_params (EmpathyAccountWidget *self, const gchar *first_widget, ...) |