From 435a811e440c3a5a79f504fa6f2850e63673f49a Mon Sep 17 00:00:00 2001 From: Jonathan Tellier Date: Wed, 26 Aug 2009 12:52:45 -0400 Subject: 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. --- libempathy-gtk/empathy-account-widget.c | 33 ++++- libempathy-gtk/empathy-account-widget.h | 5 + libempathy-gtk/empathy-ui-utils.c | 28 ++++ libempathy-gtk/empathy-ui-utils.h | 6 + src/empathy-accounts-dialog.c | 243 +++++++++++++++++++++++++++++--- 5 files changed, 294 insertions(+), 21 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); @@ -1387,6 +1390,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, diff --git a/libempathy-gtk/empathy-account-widget.h b/libempathy-gtk/empathy-account-widget.h index d4111eba2..75214fac8 100644 --- a/libempathy-gtk/empathy-account-widget.h +++ b/libempathy-gtk/empathy-account-widget.h @@ -65,6 +65,11 @@ EmpathyAccountWidget * empathy_account_widget_new_for_protocol ( EmpathyAccountSettings *settings, gboolean simple); +gboolean empathy_account_widget_contains_pending_changes + (EmpathyAccountWidget *widget); +void empathy_account_widget_discard_pending_changes + (EmpathyAccountWidget *widget); + G_END_DECLS #endif /* __EMPATHY_ACCOUNT_WIDGET_H__ */ diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index 3089c46ea..e7b8fce74 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -1551,3 +1551,31 @@ empathy_receive_file_with_file_chooser (EmpathyFTHandler *handler) gtk_widget_show (widget); } + +/** empathy_show_yes_no_question_dialog: + * @parent: The parent of the message dialog + * @message: The question message + * @response_callback: The callback connected to the "response" signal of + * the message dialog. + * @user_data: User data to pass to the @response_callback. + * + * A simple utility function to create a modal yes/no question message dialog + * and hooking to its "response" signal. + */ +void empathy_show_yes_no_question_dialog (GtkWindow *parent, + gchar *message, + GCallback response_callback, + gpointer user_data) +{ + GtkWidget *message_dialog; + + message_dialog = gtk_message_dialog_new (parent, + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + message); + + g_signal_connect (message_dialog, "response", response_callback, user_data); + + gtk_widget_show (message_dialog); +} diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h index 39baeaf41..2d54f987c 100644 --- a/libempathy-gtk/empathy-ui-utils.h +++ b/libempathy-gtk/empathy-ui-utils.h @@ -113,6 +113,12 @@ gchar * empathy_make_absolute_url (const gchar *url); gchar * empathy_make_absolute_url_len (const gchar *url, guint len); +/* Message Dialogs */ +void empathy_show_yes_no_question_dialog (GtkWindow *parent, + gchar *message, + GCallback response_callback, + gpointer user_data); + G_END_DECLS #endif /* __EMPATHY_UI_UTILS_H__ */ diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index 0a193e34e..b146396c9 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -87,6 +87,14 @@ typedef struct { GtkWidget *label_type; GtkWidget *settings_widget; + /* We have to keep a reference on the actual EmpathyAccountWidget, not just + * his GtkWidget. it is the only reliable source we can query to know if + * there are any unsaved changes to the currently selected account. We can't + * look at the account settings because it does not contain everything that + * can be changed using the EmpathyAccountWidget. For instance, it does not + * contain the state of the "Enabled" checkbox. */ + EmpathyAccountWidget *setting_widget_object; + gboolean connecting_show; guint connecting_id; @@ -98,6 +106,16 @@ typedef struct { GtkWindow *parent_window; EmpathyAccount *initial_selection; + + /* Those are needed when changing the selected row. When a user selects + * another account and there are unsaved changes on the currently selected + * one, a confirmation message box is presented to him. Since his answer + * is retrieved asynchronously, we keep some information as member of the + * EmpathyAccountsDialog object. */ + gboolean force_change_row; + gchar *destination_path; + + } EmpathyAccountsDialogPriv; enum { @@ -120,6 +138,11 @@ static void accounts_dialog_account_display_name_changed_cb ( static EmpathyAccountSettings * accounts_dialog_model_get_selected_settings ( EmpathyAccountsDialog *dialog); +static gboolean accounts_dialog_get_settings_iter ( + EmpathyAccountsDialog *dialog, + EmpathyAccountSettings *settings, + GtkTreeIter *iter); + static void accounts_dialog_model_select_first (EmpathyAccountsDialog *dialog); static void accounts_dialog_update (EmpathyAccountsDialog *dialog, @@ -163,7 +186,7 @@ empathy_account_dialog_widget_cancelled_cb (EmpathyAccountWidget *widget_object, COL_ACCOUNT_SETTINGS_POINTER, &settings, COL_ACCOUNT_POINTER, &account, -1); - empathy_account_settings_discard_changes (settings); + empathy_account_widget_discard_pending_changes (priv->setting_widget_object); if (account == NULL) { @@ -249,17 +272,13 @@ static void account_dialog_create_settings_widget (EmpathyAccountsDialog *dialog, EmpathyAccountSettings *settings) { - EmpathyAccountWidget *widget_object = NULL; EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); gchar *icon_name; - widget_object = empathy_account_widget_new_for_protocol (settings, FALSE); - priv->settings_widget = empathy_account_widget_get_widget (widget_object); - - g_signal_connect (widget_object, "account-created", + g_signal_connect (priv->setting_widget_object, "account-created", G_CALLBACK (empathy_account_dialog_account_created_cb), dialog); - g_signal_connect (widget_object, "cancelled", + g_signal_connect (priv->setting_widget_object, "cancelled", G_CALLBACK (empathy_account_dialog_widget_cancelled_cb), dialog); gtk_container_add (GTK_CONTAINER (priv->alignment_settings), @@ -311,6 +330,31 @@ accounts_dialog_model_select_first (EmpathyAccountsDialog *dialog) } } +static gboolean +accounts_dialog_has_pending_change (EmpathyAccountsDialog *dialog, + EmpathyAccount **account) +{ + gboolean has_pending_changes; + GtkTreeIter iter; + GtkTreeModel *model; + EmpathyAccountSettings *settings; + EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); + + model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview)); + settings = accounts_dialog_model_get_selected_settings (dialog); + + if (accounts_dialog_get_settings_iter (dialog, settings, &iter)) + gtk_tree_model_get (model, &iter, COL_ACCOUNT_POINTER, account, -1); + + has_pending_changes = account != NULL && priv->setting_widget_object != NULL + && empathy_account_widget_contains_pending_changes ( + priv->setting_widget_object); + + g_object_unref (settings); + + return has_pending_changes; +} + static void accounts_dialog_protocol_changed_cb (GtkWidget *widget, EmpathyAccountsDialog *dialog) @@ -345,11 +389,10 @@ accounts_dialog_protocol_changed_cb (GtkWidget *widget, } static void -accounts_dialog_button_add_clicked_cb (GtkWidget *button, - EmpathyAccountsDialog *dialog) +accounts_dialog_setup_ui_to_add_account (EmpathyAccountsDialog *dialog) { - GtkTreeView *view; - GtkTreeModel *model; + GtkTreeView *view; + GtkTreeModel *model; EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); view = GTK_TREE_VIEW (priv->treeview); @@ -373,6 +416,54 @@ accounts_dialog_button_add_clicked_cb (GtkWidget *button, gtk_widget_grab_focus (priv->combobox_protocol); } +static void +accounts_dialog_add_pending_changes_response_cb (GtkDialog *message_dialog, + gint response_id, + gpointer *user_data) +{ + EmpathyAccountsDialog *dialog = EMPATHY_ACCOUNTS_DIALOG (user_data); + EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); + + gtk_widget_destroy (GTK_WIDGET (message_dialog)); + + if (response_id == GTK_RESPONSE_YES) + { + empathy_account_widget_discard_pending_changes ( + priv->setting_widget_object); + accounts_dialog_setup_ui_to_add_account (dialog); + } +} + +static void +accounts_dialog_button_add_clicked_cb (GtkWidget *button, + EmpathyAccountsDialog *dialog) +{ + EmpathyAccount *account; + EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); + + if (accounts_dialog_has_pending_change (dialog, &account)) + { + gchar *message; + + message = g_strdup_printf ( + _("There are unsaved modification regarding your %s account.\n" + "You are about to create a new account, which will discard\n" + "your changes. Are you sure you want to proceed?"), + empathy_account_get_display_name (account)); + + empathy_show_yes_no_question_dialog (GTK_WINDOW (priv->window), + message, + G_CALLBACK (accounts_dialog_add_pending_changes_response_cb), + dialog); + + g_free (message); + } + else + { + accounts_dialog_setup_ui_to_add_account (dialog); + } +} + static void accounts_dialog_update_settings (EmpathyAccountsDialog *dialog, EmpathyAccountSettings *settings) @@ -761,16 +852,103 @@ accounts_dialog_model_selection_changed (GtkTreeSelection *selection, is_selection = gtk_tree_selection_get_selected (selection, &model, &iter); settings = accounts_dialog_model_get_selected_settings (dialog); - - if (settings != NULL) - empathy_account_settings_discard_changes (settings); - accounts_dialog_update_settings (dialog, settings); if (settings != NULL) g_object_unref (settings); } +static void +accounts_dialog_selection_change_response_cb (GtkDialog *message_dialog, + gint response_id, + gpointer *user_data) +{ + EmpathyAccountsDialog *dialog = EMPATHY_ACCOUNTS_DIALOG (user_data); + EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); + + gtk_widget_destroy (GTK_WIDGET (message_dialog)); + + if (response_id == GTK_RESPONSE_YES) + { + /* The user wants to lose unsaved changes to the currently selected + * account and select another account. We discard the changes and + * select the other account. */ + GtkTreeIter iter; + GtkTreeSelection *selection; + GtkTreeModel *model; + + priv->force_change_row = TRUE; + empathy_account_widget_discard_pending_changes ( + priv->setting_widget_object); + + model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview)); + selection = gtk_tree_view_get_selection ( + GTK_TREE_VIEW (priv->treeview)); + + if (gtk_tree_model_get_iter_from_string (model, + &iter, priv->destination_path)) + { + /* This will trigger a call to + * accounts_dialog_account_selection_change() */ + gtk_tree_selection_select_iter (selection, &iter); + } + } + else + { + priv->force_change_row = FALSE; + } +} + +static gboolean +accounts_dialog_account_selection_change (GtkTreeSelection *selection, + GtkTreeModel *model, + GtkTreePath *path, + gboolean path_currently_selected, + gpointer data) +{ + g_message ("path_currently_selected: %d - path: %s", path_currently_selected, gtk_tree_path_to_string (path)); + + EmpathyAccount *account; + EmpathyAccountsDialog *dialog = EMPATHY_ACCOUNTS_DIALOG (data); + EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); + + if (priv->force_change_row) + { + /* We came back here because the user wants to discard changes to his + * modified account. The changes have already been discarded so we + * just change the selected row. */ + priv->force_change_row = FALSE; + return TRUE; + } + + if (accounts_dialog_has_pending_change (dialog, &account)) + { + /* The currently selected account has some unsaved changes. We ask + * the user if he really wants to lose his changes and select another + * account */ + priv->destination_path = gtk_tree_path_to_string (path); + gchar *message; + + message = g_strdup_printf ( + _("There are unsaved modification regarding your %s account.\n" + "You are about to select another account, which will discard\n" + "your changes. Are you sure you want to proceed?"), + empathy_account_get_display_name (account)); + + empathy_show_yes_no_question_dialog (GTK_WINDOW (priv->window), + message, G_CALLBACK (accounts_dialog_selection_change_response_cb), + dialog); + + g_free (message); + } + else + { + return TRUE; + } + + return FALSE; +} + static void accounts_dialog_model_setup (EmpathyAccountsDialog *dialog) { @@ -789,6 +967,8 @@ accounts_dialog_model_setup (EmpathyAccountsDialog *dialog) selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); + gtk_tree_selection_set_select_function (selection, + accounts_dialog_account_selection_change, dialog, NULL); g_signal_connect (selection, "changed", G_CALLBACK (accounts_dialog_model_selection_changed), @@ -1211,12 +1391,43 @@ accounts_dialog_button_help_clicked_cb (GtkWidget *button, empathy_url_show (button, "ghelp:empathy?accounts-window"); } +static void +accounts_dialog_close_response_cb (GtkDialog *message_dialog, + gint response_id, + gpointer user_data) +{ + GtkWidget *account_dialog = GTK_WIDGET (user_data); + + gtk_widget_destroy (GTK_WIDGET (message_dialog)); + + if (response_id == GTK_RESPONSE_YES) + gtk_widget_destroy (account_dialog); +} + static void accounts_dialog_response_cb (GtkWidget *widget, gint response, EmpathyAccountsDialog *dialog) { - if (response == GTK_RESPONSE_CLOSE) + EmpathyAccount *account; + EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); + + if (accounts_dialog_has_pending_change (dialog, &account)) + { + gchar *message; + + message = g_strdup_printf ( + _("There are unsaved modifications regarding your %s account.\n" + "Are you sure you want to close the window? "), + empathy_account_get_display_name (account)); + + empathy_show_yes_no_question_dialog (GTK_WINDOW (priv->window), + message, G_CALLBACK (accounts_dialog_close_response_cb), + widget); + + g_free (message); + } + else if (response == GTK_RESPONSE_CLOSE) gtk_widget_destroy (widget); } -- cgit v1.2.3 From 1855aa4b32cc4bf06f9dd748b5c1a24c25129f0b Mon Sep 17 00:00:00 2001 From: Jonathan Tellier Date: Thu, 27 Aug 2009 11:57:18 -0400 Subject: Minor changes to EmpathyAccountWidget and EmpathyAccountsDialog - account_widget_entry_changed_common is not called when an entry loses focus. Since this function is called on every keystroke, it was unnecessary to call it again on focus-out-event. - The EmpathyAccountWidget's control buttons' sensitivity (and contains_pending_changes member) is not altered when the state of the "Enabled" checkbox is changed due to an event which was not initiated by the user. - Fixed capitalization error in a comment in empathy-accounts-dialog.c --- libempathy-gtk/empathy-account-widget.c | 19 +++---------------- src/empathy-accounts-dialog.c | 2 +- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 684ff4c9c..df0dc967b 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -151,16 +151,6 @@ account_widget_entry_changed_common (EmpathyAccountWidget *self, } } -static gboolean -account_widget_entry_focus_cb (GtkWidget *widget, - GdkEventFocus *event, - EmpathyAccountWidget *self) -{ - account_widget_entry_changed_common (self, GTK_ENTRY (widget), TRUE); - - return FALSE; -} - static void account_widget_entry_changed_cb (GtkEditable *entry, EmpathyAccountWidget *self) @@ -356,9 +346,6 @@ account_widget_setup_widget (EmpathyAccountWidget *self, gtk_entry_set_visibility (GTK_ENTRY (widget), FALSE); } - g_signal_connect (widget, "focus-out-event", - G_CALLBACK (account_widget_entry_focus_cb), - self); g_signal_connect (widget, "changed", G_CALLBACK (account_widget_entry_changed_cb), self); } @@ -1045,7 +1032,7 @@ empathy_account_widget_enabled_cb (EmpathyAccount *account, } static void -account_widget_enabled_toggled_cb (GtkToggleButton *toggle_button, +account_widget_enabled_released_cb (GtkToggleButton *toggle_button, gpointer user_data) { account_widget_handle_control_buttons_sensitivity ( @@ -1256,8 +1243,8 @@ do_constructed (GObject *obj) gtk_widget_show (priv->enabled_checkbox); - g_signal_connect (G_OBJECT (priv->enabled_checkbox), "toggled", - G_CALLBACK (account_widget_enabled_toggled_cb), self); + g_signal_connect (G_OBJECT (priv->enabled_checkbox), "released", + G_CALLBACK (account_widget_enabled_released_cb), self); } /* hook up to widget destruction to unref ourselves */ diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index b146396c9..08d6d224e 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -88,7 +88,7 @@ typedef struct { GtkWidget *settings_widget; /* We have to keep a reference on the actual EmpathyAccountWidget, not just - * his GtkWidget. it is the only reliable source we can query to know if + * his GtkWidget. It is the only reliable source we can query to know if * there are any unsaved changes to the currently selected account. We can't * look at the account settings because it does not contain everything that * can be changed using the EmpathyAccountWidget. For instance, it does not -- cgit v1.2.3 From 4c9f8ec9fb3173f3641ca344d3c743f582965a02 Mon Sep 17 00:00:00 2001 From: Jonathan Tellier Date: Thu, 27 Aug 2009 13:03:03 -0400 Subject: Fixed crash when checking if an account has pending changes --- src/empathy-accounts-dialog.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index 08d6d224e..abc2b4bbd 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -350,7 +350,8 @@ accounts_dialog_has_pending_change (EmpathyAccountsDialog *dialog, && empathy_account_widget_contains_pending_changes ( priv->setting_widget_object); - g_object_unref (settings); + if (settings != NULL) + g_object_unref (settings); return has_pending_changes; } @@ -906,8 +907,6 @@ accounts_dialog_account_selection_change (GtkTreeSelection *selection, gboolean path_currently_selected, gpointer data) { - g_message ("path_currently_selected: %d - path: %s", path_currently_selected, gtk_tree_path_to_string (path)); - EmpathyAccount *account; EmpathyAccountsDialog *dialog = EMPATHY_ACCOUNTS_DIALOG (data); EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); -- cgit v1.2.3 From 8a6993197695c0b8448754d5389811a6d72e0009 Mon Sep 17 00:00:00 2001 From: Jonathan Tellier Date: Thu, 27 Aug 2009 13:15:56 -0400 Subject: Fixed style --- src/empathy-accounts-dialog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index abc2b4bbd..31e29b687 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -217,7 +217,7 @@ get_default_display_name (EmpathyAccountSettings *settings) if (login_id != NULL) { - if (!tp_strdiff(protocol, "irc")) + if (!tp_strdiff (protocol, "irc")) { const gchar* server; server = empathy_account_settings_get_string (settings, "server"); -- cgit v1.2.3 From cb75a2c77a35fbf7ace246d5c45d7ecda8ae8ab1 Mon Sep 17 00:00:00 2001 From: Jonathan Tellier Date: Fri, 28 Aug 2009 10:45:54 -0400 Subject: Improved confirmation dialog shown to the user before discarding changes - Split the confirmation dialog's text into a primary and secondary section. - Changed the button label to "Cancel" and "Discard" instead of "Yes" and "No". - Added a accounts_dialog_show_question_dialog() function to show question dialogs related to the accounts dialog and connect to its "response" signal. - Removed the empathy_show_yes_no_question_dialog() function since it was added for this specific patch but is no longer used. --- libempathy-gtk/empathy-ui-utils.c | 28 ------- libempathy-gtk/empathy-ui-utils.h | 6 -- src/empathy-accounts-dialog.c | 153 +++++++++++++++++++++++--------------- 3 files changed, 94 insertions(+), 93 deletions(-) diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index e7b8fce74..3089c46ea 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -1551,31 +1551,3 @@ empathy_receive_file_with_file_chooser (EmpathyFTHandler *handler) gtk_widget_show (widget); } - -/** empathy_show_yes_no_question_dialog: - * @parent: The parent of the message dialog - * @message: The question message - * @response_callback: The callback connected to the "response" signal of - * the message dialog. - * @user_data: User data to pass to the @response_callback. - * - * A simple utility function to create a modal yes/no question message dialog - * and hooking to its "response" signal. - */ -void empathy_show_yes_no_question_dialog (GtkWindow *parent, - gchar *message, - GCallback response_callback, - gpointer user_data) -{ - GtkWidget *message_dialog; - - message_dialog = gtk_message_dialog_new (parent, - GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_YES_NO, - message); - - g_signal_connect (message_dialog, "response", response_callback, user_data); - - gtk_widget_show (message_dialog); -} diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h index 2d54f987c..39baeaf41 100644 --- a/libempathy-gtk/empathy-ui-utils.h +++ b/libempathy-gtk/empathy-ui-utils.h @@ -113,12 +113,6 @@ gchar * empathy_make_absolute_url (const gchar *url); gchar * empathy_make_absolute_url_len (const gchar *url, guint len); -/* Message Dialogs */ -void empathy_show_yes_no_question_dialog (GtkWindow *parent, - gchar *message, - GCallback response_callback, - gpointer user_data); - G_END_DECLS #endif /* __EMPATHY_UI_UTILS_H__ */ diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index 31e29b687..807c78b97 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -57,6 +57,11 @@ /* Flashing delay for icons (milliseconds). */ #define FLASH_TIMEOUT 500 +/* The primary text of the dialog shown to the user when he is about to lose + * unsaved changes */ +#define PENDING_CHANGES_QUESTION_PRIMARY_TEXT \ + "There are unsaved modification regarding your %s account." + #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountsDialog) G_DEFINE_TYPE (EmpathyAccountsDialog, empathy_accounts_dialog, G_TYPE_OBJECT); @@ -417,6 +422,46 @@ accounts_dialog_setup_ui_to_add_account (EmpathyAccountsDialog *dialog) gtk_widget_grab_focus (priv->combobox_protocol); } +static void +accounts_dialog_show_question_dialog (EmpathyAccountsDialog *dialog, + gchar *primary_text, + gchar *secondary_text, + GCallback response_callback, + gpointer user_data, + const gchar *first_button_text, + ...) +{ + va_list button_args; + GtkWidget *message_dialog; + const gchar *button_text; + EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); + + message_dialog = gtk_message_dialog_new (GTK_WINDOW (priv->window), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_NONE, + primary_text); + + gtk_message_dialog_format_secondary_text ( + GTK_MESSAGE_DIALOG (message_dialog), secondary_text); + + va_start (button_args, first_button_text); + for (button_text = first_button_text; + button_text; + button_text = va_arg (button_args, const gchar *)) + { + gint response_id; + response_id = va_arg (button_args, gint); + + gtk_dialog_add_button (GTK_DIALOG (message_dialog), button_text, response_id); + } + va_end (button_args); + + g_signal_connect (message_dialog, "response", response_callback, user_data); + + gtk_widget_show (message_dialog); +} + static void accounts_dialog_add_pending_changes_response_cb (GtkDialog *message_dialog, gint response_id, @@ -440,24 +485,22 @@ accounts_dialog_button_add_clicked_cb (GtkWidget *button, EmpathyAccountsDialog *dialog) { EmpathyAccount *account; - EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); if (accounts_dialog_has_pending_change (dialog, &account)) { - gchar *message; - - message = g_strdup_printf ( - _("There are unsaved modification regarding your %s account.\n" - "You are about to create a new account, which will discard\n" - "your changes. Are you sure you want to proceed?"), - empathy_account_get_display_name (account)); - - empathy_show_yes_no_question_dialog (GTK_WINDOW (priv->window), - message, - G_CALLBACK (accounts_dialog_add_pending_changes_response_cb), - dialog); - - g_free (message); + gchar *question_dialog_primary_text = g_strdup_printf ( + PENDING_CHANGES_QUESTION_PRIMARY_TEXT, + empathy_account_get_display_name (account)); + + accounts_dialog_show_question_dialog (dialog, question_dialog_primary_text, + "You are about to create a new account, which will discard\n" + "your changes. Are you sure you want to proceed?", + G_CALLBACK (accounts_dialog_add_pending_changes_response_cb), + dialog, + GTK_STOCK_CANCEL, GTK_RESPONSE_NO, + GTK_STOCK_DISCARD, GTK_RESPONSE_YES, NULL); + + g_free (question_dialog_primary_text); } else { @@ -716,7 +759,7 @@ accounts_dialog_view_delete_activated_cb (EmpathyCellRendererActivatable *cell, EmpathyAccount *account; GtkTreeModel *model; GtkTreeIter iter; - GtkWidget *message_dialog; + gchar *question_dialog_primary_text; EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview)); @@ -733,34 +776,23 @@ accounts_dialog_view_delete_activated_cb (EmpathyCellRendererActivatable *cell, return; } - message_dialog = gtk_message_dialog_new - (GTK_WINDOW (priv->window), - GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_NONE, - _("You are about to remove your %s account!\n" - "Are you sure you want to proceed?"), - empathy_account_get_display_name (account)); - - gtk_message_dialog_format_secondary_text - (GTK_MESSAGE_DIALOG (message_dialog), + question_dialog_primary_text = g_strdup_printf ( + _("You are about to remove your %s account!\n" + "Are you sure you want to proceed?"), + empathy_account_get_display_name (account)); + + accounts_dialog_show_question_dialog (dialog, question_dialog_primary_text, _("Any associated conversations and chat rooms will NOT be " "removed if you decide to proceed.\n" "\n" "Should you decide to add the account back at a later time, " - "they will still be available.")); - - gtk_dialog_add_button (GTK_DIALOG (message_dialog), - GTK_STOCK_CANCEL, - GTK_RESPONSE_NO); - gtk_dialog_add_button (GTK_DIALOG (message_dialog), - GTK_STOCK_REMOVE, - GTK_RESPONSE_YES); - - g_signal_connect (message_dialog, "response", - G_CALLBACK (accounts_dialog_delete_account_response_cb), dialog); + "they will still be available."), + G_CALLBACK (accounts_dialog_delete_account_response_cb), + dialog, + GTK_STOCK_CANCEL, GTK_RESPONSE_NO, + GTK_STOCK_REMOVE, GTK_RESPONSE_YES, NULL); - gtk_widget_show (message_dialog); + g_free (question_dialog_primary_text); if (account != NULL) g_object_unref (account); @@ -925,20 +957,22 @@ accounts_dialog_account_selection_change (GtkTreeSelection *selection, /* The currently selected account has some unsaved changes. We ask * the user if he really wants to lose his changes and select another * account */ + gchar *question_dialog_primary_text; priv->destination_path = gtk_tree_path_to_string (path); - gchar *message; - message = g_strdup_printf ( - _("There are unsaved modification regarding your %s account.\n" - "You are about to select another account, which will discard\n" - "your changes. Are you sure you want to proceed?"), + question_dialog_primary_text = g_strdup_printf ( + PENDING_CHANGES_QUESTION_PRIMARY_TEXT, empathy_account_get_display_name (account)); - empathy_show_yes_no_question_dialog (GTK_WINDOW (priv->window), - message, G_CALLBACK (accounts_dialog_selection_change_response_cb), - dialog); + accounts_dialog_show_question_dialog (dialog, question_dialog_primary_text, + "You are about to select another account, which will discard\n" + "your changes. Are you sure you want to proceed?", + G_CALLBACK (accounts_dialog_selection_change_response_cb), + dialog, + GTK_STOCK_CANCEL, GTK_RESPONSE_NO, + GTK_STOCK_DISCARD, GTK_RESPONSE_YES, NULL); - g_free (message); + g_free (question_dialog_primary_text); } else { @@ -1409,22 +1443,23 @@ accounts_dialog_response_cb (GtkWidget *widget, EmpathyAccountsDialog *dialog) { EmpathyAccount *account; - EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); if (accounts_dialog_has_pending_change (dialog, &account)) { - gchar *message; - - message = g_strdup_printf ( - _("There are unsaved modifications regarding your %s account.\n" - "Are you sure you want to close the window? "), - empathy_account_get_display_name (account)); + gchar *question_dialog_primary_text; + question_dialog_primary_text = g_strdup_printf ( + PENDING_CHANGES_QUESTION_PRIMARY_TEXT, + empathy_account_get_display_name (account)); - empathy_show_yes_no_question_dialog (GTK_WINDOW (priv->window), - message, G_CALLBACK (accounts_dialog_close_response_cb), - widget); + accounts_dialog_show_question_dialog (dialog, question_dialog_primary_text, + "You are about to close the window, which will discard\n" + "your changes. Are you sure you want to proceed?", + G_CALLBACK (accounts_dialog_close_response_cb), + widget, + GTK_STOCK_CANCEL, GTK_RESPONSE_NO, + GTK_STOCK_DISCARD, GTK_RESPONSE_YES, NULL); - g_free (message); + g_free (question_dialog_primary_text); } else if (response == GTK_RESPONSE_CLOSE) gtk_widget_destroy (widget); -- cgit v1.2.3 From 9b845e9ce1fe88006335f73a02ff68853757bd30 Mon Sep 17 00:00:00 2001 From: Jonathan Tellier Date: Fri, 28 Aug 2009 11:06:14 -0400 Subject: Simplified the code that checks if selected account has pending changes --- src/empathy-accounts-dialog.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index 807c78b97..6cfc830d1 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -342,22 +342,18 @@ accounts_dialog_has_pending_change (EmpathyAccountsDialog *dialog, gboolean has_pending_changes; GtkTreeIter iter; GtkTreeModel *model; - EmpathyAccountSettings *settings; + GtkTreeSelection *selection; EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); - model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview)); - settings = accounts_dialog_model_get_selected_settings (dialog); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview)); - if (accounts_dialog_get_settings_iter (dialog, settings, &iter)) + if (gtk_tree_selection_get_selected (selection, &model, &iter)) gtk_tree_model_get (model, &iter, COL_ACCOUNT_POINTER, account, -1); has_pending_changes = account != NULL && priv->setting_widget_object != NULL && empathy_account_widget_contains_pending_changes ( priv->setting_widget_object); - if (settings != NULL) - g_object_unref (settings); - return has_pending_changes; } -- cgit v1.2.3 From 0f70b1bfb5714c98aa70d062b5ac7ec0e5a03dac Mon Sep 17 00:00:00 2001 From: Jonathan Tellier Date: Fri, 28 Aug 2009 11:23:44 -0400 Subject: Using GtkTreeRowReference instead of a string path. - When the user selects another account and has pending changes to the currently selected account, we need to keed track of the destination row. Instead of saving that information as the string representation of a GtkTreePath, we now use a GtkTreeRowReference. --- src/empathy-accounts-dialog.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index 6cfc830d1..5e5c94756 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -118,7 +118,7 @@ typedef struct { * is retrieved asynchronously, we keep some information as member of the * EmpathyAccountsDialog object. */ gboolean force_change_row; - gchar *destination_path; + GtkTreeRowReference *destination_row; } EmpathyAccountsDialogPriv; @@ -897,30 +897,31 @@ accounts_dialog_selection_change_response_cb (GtkDialog *message_dialog, gtk_widget_destroy (GTK_WIDGET (message_dialog)); - if (response_id == GTK_RESPONSE_YES) + if (response_id == GTK_RESPONSE_YES && priv->destination_row != NULL) { /* The user wants to lose unsaved changes to the currently selected * account and select another account. We discard the changes and * select the other account. */ - GtkTreeIter iter; + GtkTreePath *path; GtkTreeSelection *selection; - GtkTreeModel *model; priv->force_change_row = TRUE; empathy_account_widget_discard_pending_changes ( priv->setting_widget_object); - model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview)); + path = gtk_tree_row_reference_get_path (priv->destination_row); selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW (priv->treeview)); - if (gtk_tree_model_get_iter_from_string (model, - &iter, priv->destination_path)) + if (path != NULL) { /* This will trigger a call to * accounts_dialog_account_selection_change() */ - gtk_tree_selection_select_iter (selection, &iter); + gtk_tree_selection_select_path (selection, path); + gtk_tree_path_free (path); } + + gtk_tree_row_reference_free (priv->destination_row); } else { @@ -954,7 +955,7 @@ accounts_dialog_account_selection_change (GtkTreeSelection *selection, * the user if he really wants to lose his changes and select another * account */ gchar *question_dialog_primary_text; - priv->destination_path = gtk_tree_path_to_string (path); + priv->destination_row = gtk_tree_row_reference_new (model, path); question_dialog_primary_text = g_strdup_printf ( PENDING_CHANGES_QUESTION_PRIMARY_TEXT, -- cgit v1.2.3 From e84021944cfde5665a5286b1dbabe296a67f7231 Mon Sep 17 00:00:00 2001 From: Jonathan Tellier Date: Fri, 28 Aug 2009 14:19:47 -0400 Subject: Fixed bug which would occur when deleting account with pending changes - When the selected account was NULL, accounts_dialog_has_pending_change() would not check its state correctly. That function is working with a pointer on a pointer to the account and was not dereferencing properly. - The pointer to the account we pass to accounts_dialog_has_pending_change() is now properly initialized to NULL. - When deleting an account, the COL_ACCOUNT_POINTER column is now properly set to NULL. --- src/empathy-accounts-dialog.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index 5e5c94756..2b233258d 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -339,7 +339,6 @@ static gboolean accounts_dialog_has_pending_change (EmpathyAccountsDialog *dialog, EmpathyAccount **account) { - gboolean has_pending_changes; GtkTreeIter iter; GtkTreeModel *model; GtkTreeSelection *selection; @@ -350,11 +349,9 @@ accounts_dialog_has_pending_change (EmpathyAccountsDialog *dialog, if (gtk_tree_selection_get_selected (selection, &model, &iter)) gtk_tree_model_get (model, &iter, COL_ACCOUNT_POINTER, account, -1); - has_pending_changes = account != NULL && priv->setting_widget_object != NULL + return *account != NULL && priv->setting_widget_object != NULL && empathy_account_widget_contains_pending_changes ( priv->setting_widget_object); - - return has_pending_changes; } static void @@ -480,7 +477,7 @@ static void accounts_dialog_button_add_clicked_cb (GtkWidget *button, EmpathyAccountsDialog *dialog) { - EmpathyAccount *account; + EmpathyAccount *account = NULL; if (accounts_dialog_has_pending_change (dialog, &account)) { @@ -738,6 +735,7 @@ accounts_dialog_delete_account_response_cb (GtkDialog *message_dialog, accounts_dialog_account_display_name_changed_cb, account_dialog); empathy_account_remove_async (account, NULL, NULL); g_object_unref (account); + account = NULL; } gtk_list_store_remove (GTK_LIST_STORE (model), &iter); @@ -791,7 +789,10 @@ accounts_dialog_view_delete_activated_cb (EmpathyCellRendererActivatable *cell, g_free (question_dialog_primary_text); if (account != NULL) - g_object_unref (account); + { + g_object_unref (account); + account = NULL; + } } static void @@ -936,7 +937,7 @@ accounts_dialog_account_selection_change (GtkTreeSelection *selection, gboolean path_currently_selected, gpointer data) { - EmpathyAccount *account; + EmpathyAccount *account = NULL; EmpathyAccountsDialog *dialog = EMPATHY_ACCOUNTS_DIALOG (data); EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); @@ -1439,7 +1440,7 @@ accounts_dialog_response_cb (GtkWidget *widget, gint response, EmpathyAccountsDialog *dialog) { - EmpathyAccount *account; + EmpathyAccount *account = NULL; if (accounts_dialog_has_pending_change (dialog, &account)) { -- cgit v1.2.3 From 4bca222891fc950ce1f18de66a86f1a9ace6eba5 Mon Sep 17 00:00:00 2001 From: Jonathan Tellier Date: Fri, 28 Aug 2009 14:36:45 -0400 Subject: Merged with master --- src/empathy-accounts-dialog.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index 2b233258d..3c86878f9 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -280,7 +280,14 @@ account_dialog_create_settings_widget (EmpathyAccountsDialog *dialog, EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); gchar *icon_name; - priv->settings_widget = empathy_account_widget_get_widget (widget_object); + priv->setting_widget_object = + empathy_account_widget_new_for_protocol (settings, FALSE); + + priv->settings_widget = + empathy_account_widget_get_widget (priv->setting_widget_object); + + priv->settings_widget = + empathy_account_widget_get_widget (priv->setting_widget_object); g_signal_connect (priv->setting_widget_object, "account-created", G_CALLBACK (empathy_account_dialog_account_created_cb), dialog); g_signal_connect (priv->setting_widget_object, "cancelled", -- cgit v1.2.3 From 6600e6d9ff8505c9ef1765c1ca2ba17faad6f837 Mon Sep 17 00:00:00 2001 From: Jonathan Tellier Date: Fri, 28 Aug 2009 14:50:30 -0400 Subject: Marked strings for translation. --- src/empathy-accounts-dialog.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index 3c86878f9..ebc8efe6d 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -60,7 +60,7 @@ /* The primary text of the dialog shown to the user when he is about to lose * unsaved changes */ #define PENDING_CHANGES_QUESTION_PRIMARY_TEXT \ - "There are unsaved modification regarding your %s account." + _("There are unsaved modification regarding your %s account.") #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountsDialog) G_DEFINE_TYPE (EmpathyAccountsDialog, empathy_accounts_dialog, G_TYPE_OBJECT); @@ -493,8 +493,8 @@ accounts_dialog_button_add_clicked_cb (GtkWidget *button, empathy_account_get_display_name (account)); accounts_dialog_show_question_dialog (dialog, question_dialog_primary_text, - "You are about to create a new account, which will discard\n" - "your changes. Are you sure you want to proceed?", + _("You are about to create a new account, which will discard\n" + "your changes. Are you sure you want to proceed?"), G_CALLBACK (accounts_dialog_add_pending_changes_response_cb), dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_NO, @@ -970,8 +970,8 @@ accounts_dialog_account_selection_change (GtkTreeSelection *selection, empathy_account_get_display_name (account)); accounts_dialog_show_question_dialog (dialog, question_dialog_primary_text, - "You are about to select another account, which will discard\n" - "your changes. Are you sure you want to proceed?", + _("You are about to select another account, which will discard\n" + "your changes. Are you sure you want to proceed?"), G_CALLBACK (accounts_dialog_selection_change_response_cb), dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_NO, @@ -1457,8 +1457,8 @@ accounts_dialog_response_cb (GtkWidget *widget, empathy_account_get_display_name (account)); accounts_dialog_show_question_dialog (dialog, question_dialog_primary_text, - "You are about to close the window, which will discard\n" - "your changes. Are you sure you want to proceed?", + _("You are about to close the window, which will discard\n" + "your changes. Are you sure you want to proceed?"), G_CALLBACK (accounts_dialog_close_response_cb), widget, GTK_STOCK_CANCEL, GTK_RESPONSE_NO, -- cgit v1.2.3 From cd277c0c7cbe0389c242abb58b995389000f3e53 Mon Sep 17 00:00:00 2001 From: Jonathan Tellier Date: Fri, 28 Aug 2009 14:55:27 -0400 Subject: Fixed style --- src/empathy-accounts-dialog.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index ebc8efe6d..c90074baa 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -488,19 +488,20 @@ accounts_dialog_button_add_clicked_cb (GtkWidget *button, if (accounts_dialog_has_pending_change (dialog, &account)) { - gchar *question_dialog_primary_text = g_strdup_printf ( - PENDING_CHANGES_QUESTION_PRIMARY_TEXT, - empathy_account_get_display_name (account)); - - accounts_dialog_show_question_dialog (dialog, question_dialog_primary_text, - _("You are about to create a new account, which will discard\n" - "your changes. Are you sure you want to proceed?"), - G_CALLBACK (accounts_dialog_add_pending_changes_response_cb), - dialog, - GTK_STOCK_CANCEL, GTK_RESPONSE_NO, - GTK_STOCK_DISCARD, GTK_RESPONSE_YES, NULL); - - g_free (question_dialog_primary_text); + gchar *question_dialog_primary_text = g_strdup_printf ( + PENDING_CHANGES_QUESTION_PRIMARY_TEXT, + empathy_account_get_display_name (account)); + + accounts_dialog_show_question_dialog (dialog, + question_dialog_primary_text, + _("You are about to create a new account, which will discard\n" + "your changes. Are you sure you want to proceed?"), + G_CALLBACK (accounts_dialog_add_pending_changes_response_cb), + dialog, + GTK_STOCK_CANCEL, GTK_RESPONSE_NO, + GTK_STOCK_DISCARD, GTK_RESPONSE_YES, NULL); + + g_free (question_dialog_primary_text); } else { @@ -969,7 +970,8 @@ accounts_dialog_account_selection_change (GtkTreeSelection *selection, PENDING_CHANGES_QUESTION_PRIMARY_TEXT, empathy_account_get_display_name (account)); - accounts_dialog_show_question_dialog (dialog, question_dialog_primary_text, + accounts_dialog_show_question_dialog (dialog, + question_dialog_primary_text, _("You are about to select another account, which will discard\n" "your changes. Are you sure you want to proceed?"), G_CALLBACK (accounts_dialog_selection_change_response_cb), @@ -1456,7 +1458,8 @@ accounts_dialog_response_cb (GtkWidget *widget, PENDING_CHANGES_QUESTION_PRIMARY_TEXT, empathy_account_get_display_name (account)); - accounts_dialog_show_question_dialog (dialog, question_dialog_primary_text, + accounts_dialog_show_question_dialog (dialog, + question_dialog_primary_text, _("You are about to close the window, which will discard\n" "your changes. Are you sure you want to proceed?"), G_CALLBACK (accounts_dialog_close_response_cb), -- cgit v1.2.3