[Xfce4-commits] [xfce/xfce4-settings] 15/67: display: Show a confirmation dialog when deleting a profile
noreply at xfce.org
noreply at xfce.org
Sat Sep 22 11:23:06 CEST 2018
This is an automated email from the git hooks/post-receive script.
o c h o s i p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfce4-settings.
commit e29a17b64f7d06a816b614c285be420243888dfc
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Tue Aug 14 00:51:40 2018 +0200
display: Show a confirmation dialog when deleting a profile
---
dialogs/display-settings/main.c | 33 +++++++++++++++++++++++++++------
1 file changed, 27 insertions(+), 6 deletions(-)
diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index 0de08cc..c03cb91 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -1480,14 +1480,35 @@ display_settings_profile_apply (GtkWidget *widget, GtkBuilder *builder)
static void
display_settings_profile_delete (GtkWidget *widget, GtkBuilder *builder)
{
- GtkWidget *entry = gtk_bin_get_child((GtkBin*)gtk_builder_get_object (builder, "randr-profile"));
+ GtkWidget *entry = gtk_bin_get_child ((GtkBin*) gtk_builder_get_object (builder, "randr-profile"));
+
if (gtk_entry_get_text_length (GTK_ENTRY (entry)))
{
- GString *buf = g_string_new (gtk_entry_get_text(GTK_ENTRY(entry)));
- g_string_prepend_c (buf, '/');
- xfconf_channel_reset_property (display_channel, buf->str, True);
- display_settings_profile_combobox_populate (builder);
- gtk_entry_set_text(GTK_ENTRY(entry), "");
+ gint response;
+ gchar *secondary_message;
+
+ secondary_message = g_strdup_printf (_("Do you really want to delete the profile '%s'?"), gtk_entry_get_text (GTK_ENTRY (entry)));
+
+ response = xfce_message_dialog (NULL, _("Question"),
+ "dialog-question",
+ _("Delete display profile"),
+ secondary_message,
+ _("Cancel"), GTK_RESPONSE_NO,
+ XFCE_BUTTON_TYPE_MIXED, _("Delete"), _("Delete"), GTK_RESPONSE_YES,
+ NULL);
+
+ g_free (secondary_message);
+ if (response == GTK_RESPONSE_YES)
+ {
+ GString *buf = g_string_new (gtk_entry_get_text(GTK_ENTRY(entry)));
+ g_string_prepend_c (buf, '/');
+ xfconf_channel_reset_property (display_channel, buf->str, True);
+ display_settings_profile_combobox_populate (builder);
+ gtk_entry_set_text(GTK_ENTRY(entry), "");
+ }
+ else {
+ return;
+ }
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list