remove icons from messageboxes on gtk
Icons are deprecated in GtkMessageBoxes as of GTK+ 3.12. The GNOME HIG no longer shows icons in example dialogs; see https://developer.gnome.org/hig/stable/dialogs.html.en and https://developer.gnome.org/gtk3/stable/GtkMessageDialog.html
This commit is contained in:
parent
ffff400236
commit
b107d3f440
1 changed files with 6 additions and 24 deletions
|
@ -39,8 +39,7 @@ class GtkMessageBox : public NativeWindowObserver {
|
|||
const std::string& message,
|
||||
const std::string& detail,
|
||||
const std::string& checkbox_label,
|
||||
bool checkbox_checked,
|
||||
const gfx::ImageSkia& icon)
|
||||
bool checkbox_checked)
|
||||
: cancel_id_(cancel_id),
|
||||
checkbox_checked_(false),
|
||||
parent_(static_cast<NativeWindow*>(parent_window)) {
|
||||
|
@ -57,22 +56,6 @@ class GtkMessageBox : public NativeWindowObserver {
|
|||
if (!title.empty())
|
||||
gtk_window_set_title(GTK_WINDOW(dialog_), title.c_str());
|
||||
|
||||
// Set dialog's icon.
|
||||
if (!icon.isNull()) {
|
||||
GdkPixbuf* pixbuf = libgtkui::GdkPixbufFromSkBitmap(*icon.bitmap());
|
||||
GtkIconSource* iconsource = gtk_icon_source_new();
|
||||
GtkIconSet* iconset = gtk_icon_set_new();
|
||||
gtk_icon_source_set_pixbuf(iconsource, pixbuf);
|
||||
gtk_icon_set_add_source(iconset, iconsource);
|
||||
GtkWidget* image = gtk_image_new_from_icon_set(iconset,
|
||||
GTK_ICON_SIZE_DIALOG);
|
||||
gtk_message_dialog_set_image(GTK_MESSAGE_DIALOG(dialog_), image);
|
||||
gtk_widget_show(image);
|
||||
gtk_icon_source_free(iconsource);
|
||||
gtk_icon_set_unref(iconset);
|
||||
g_object_unref(pixbuf);
|
||||
}
|
||||
|
||||
if (!checkbox_label.empty()) {
|
||||
GtkWidget* message_area =
|
||||
gtk_message_dialog_get_message_area(GTK_MESSAGE_DIALOG(dialog_));
|
||||
|
@ -212,9 +195,9 @@ int ShowMessageBox(NativeWindow* parent,
|
|||
const std::string& title,
|
||||
const std::string& message,
|
||||
const std::string& detail,
|
||||
const gfx::ImageSkia& icon) {
|
||||
const gfx::ImageSkia& /*icon*/) {
|
||||
return GtkMessageBox(parent, type, buttons, default_id, cancel_id, title,
|
||||
message, detail, "", false, icon)
|
||||
message, detail, "", false)
|
||||
.RunSynchronous();
|
||||
}
|
||||
|
||||
|
@ -229,10 +212,10 @@ void ShowMessageBox(NativeWindow* parent,
|
|||
const std::string& detail,
|
||||
const std::string& checkbox_label,
|
||||
bool checkbox_checked,
|
||||
const gfx::ImageSkia& icon,
|
||||
const gfx::ImageSkia& /*icon*/,
|
||||
const MessageBoxCallback& callback) {
|
||||
(new GtkMessageBox(parent, type, buttons, default_id, cancel_id, title,
|
||||
message, detail, checkbox_label, checkbox_checked, icon))
|
||||
message, detail, checkbox_label, checkbox_checked))
|
||||
->RunAsynchronous(callback);
|
||||
}
|
||||
|
||||
|
@ -240,8 +223,7 @@ void ShowErrorBox(const base::string16& title, const base::string16& content) {
|
|||
if (Browser::Get()->is_ready()) {
|
||||
GtkMessageBox(nullptr, MESSAGE_BOX_TYPE_ERROR, {"OK"}, -1, 0, "Error",
|
||||
base::UTF16ToUTF8(title).c_str(),
|
||||
base::UTF16ToUTF8(content).c_str(), "", false,
|
||||
gfx::ImageSkia())
|
||||
base::UTF16ToUTF8(content).c_str(), "", false)
|
||||
.RunSynchronous();
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
|
|
Loading…
Reference in a new issue