diff options
author | Jonathan Tellier <jonathan.tellier@gmail.com> | 2009-08-27 00:52:45 +0800 |
---|---|---|
committer | jtellier <jonathan.tellier@collabora.co.uk> | 2009-08-29 02:27:43 +0800 |
commit | 435a811e440c3a5a79f504fa6f2850e63673f49a (patch) | |
tree | 0b3631df59ac2f7f935612b2e076e9ad0c2c7773 /libempathy-gtk/empathy-account-widget.c | |
parent | 36e602e834790033aed3c8b82a93404efb1585ad (diff) | |
download | gsoc2013-empathy-435a811e440c3a5a79f504fa6f2850e63673f49a.tar gsoc2013-empathy-435a811e440c3a5a79f504fa6f2850e63673f49a.tar.gz gsoc2013-empathy-435a811e440c3a5a79f504fa6f2850e63673f49a.tar.bz2 gsoc2013-empathy-435a811e440c3a5a79f504fa6f2850e63673f49a.tar.lz gsoc2013-empathy-435a811e440c3a5a79f504fa6f2850e63673f49a.tar.xz gsoc2013-empathy-435a811e440c3a5a79f504fa6f2850e63673f49a.tar.zst gsoc2013-empathy-435a811e440c3a5a79f504fa6f2850e63673f49a.zip |
Asking for confirmation before losing pending accounts changes.
If an account has pending changes, we now ask for a confirmation before:
- Adding a new account
- Closing the accounts dialog
- Selecting a new account.
Those are all options which discard pending changes.
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, ...) |