[nautilus] destructive-action: set style for permanent delete button
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] destructive-action: set style for permanent delete button
- Date: Fri, 24 Feb 2017 13:28:26 +0000 (UTC)
commit 310c77554f23b07861d664444a5ab726f469d523
Author: Eduard Čuba <cuba edo gmail com>
Date: Mon Feb 20 17:36:50 2017 +0100
destructive-action: set style for permanent delete button
Delete button in confirmation dialog of nautilus-file-operations
does not follow GNOME Human Interface Guidelines.
https://developer.gnome.org/hig/stable/buttons.html.en
To fix this use 'destructive-action' style class
for this button. Class changes button color to red,
preventing user from permanently deleting his files
by accident.
https://bugzilla.gnome.org/show_bug.cgi?id=771356
src/nautilus-file-operations.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index c62c755..ac6d491 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -1182,6 +1182,7 @@ do_run_simple_dialog (gpointer _data)
RunSimpleDialogData *data = _data;
const char *button_title;
GtkWidget *dialog;
+ GtkWidget *button;
int result;
int response_id;
@@ -1209,8 +1210,14 @@ do_run_simple_dialog (gpointer _data)
continue;
}
- gtk_dialog_add_button (GTK_DIALOG (dialog), button_title, response_id);
+ button = gtk_dialog_add_button (GTK_DIALOG (dialog), button_title, response_id);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), response_id);
+
+ if (g_strcmp0(button_title, DELETE) == 0)
+ {
+ gtk_style_context_add_class(gtk_widget_get_style_context(button),
+ "destructive-action");
+ }
}
if (data->details_text)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]