fix 'GTK_STOCK_*' deprecation warnings

This commit is contained in:
Charles Kerr 2018-02-09 09:57:39 -06:00
parent efb44050db
commit e5eeab6e29

View file

@ -13,6 +13,8 @@
#include "chrome/browser/ui/libgtkui/gtk_util.h" #include "chrome/browser/ui/libgtkui/gtk_util.h"
#include "ui/views/widget/desktop_aura/x11_desktop_handler.h" #include "ui/views/widget/desktop_aura/x11_desktop_handler.h"
#include <glib/gi18n.h> // _() macro
namespace file_dialog { namespace file_dialog {
namespace { namespace {
@ -39,20 +41,20 @@ class FileChooserDialog {
const DialogSettings& settings) const DialogSettings& settings)
: parent_(static_cast<atom::NativeWindowViews*>(settings.parent_window)), : parent_(static_cast<atom::NativeWindowViews*>(settings.parent_window)),
filters_(settings.filters) { filters_(settings.filters) {
const char* confirm_text = GTK_STOCK_OK; const char* confirm_text = _("_OK");
if (!settings.button_label.empty()) if (!settings.button_label.empty())
confirm_text = settings.button_label.c_str(); confirm_text = settings.button_label.c_str();
else if (action == GTK_FILE_CHOOSER_ACTION_SAVE) else if (action == GTK_FILE_CHOOSER_ACTION_SAVE)
confirm_text = GTK_STOCK_SAVE; confirm_text = _("_Save");
else if (action == GTK_FILE_CHOOSER_ACTION_OPEN) else if (action == GTK_FILE_CHOOSER_ACTION_OPEN)
confirm_text = GTK_STOCK_OPEN; confirm_text = _("_Open");
dialog_ = gtk_file_chooser_dialog_new( dialog_ = gtk_file_chooser_dialog_new(
settings.title.c_str(), settings.title.c_str(),
NULL, NULL,
action, action,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("_Cancel"), GTK_RESPONSE_CANCEL,
confirm_text, GTK_RESPONSE_ACCEPT, confirm_text, GTK_RESPONSE_ACCEPT,
NULL); NULL);
if (parent_) { if (parent_) {