util_gtk.cc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright (c) 2019 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #include "atom/browser/ui/util_gtk.h"
  5. #include <gtk/gtk.h>
  6. namespace util_gtk {
  7. // Copied from L40-L55 in
  8. // https://cs.chromium.org/chromium/src/chrome/browser/ui/libgtkui/select_file_dialog_impl_gtk.cc
  9. #if GTK_CHECK_VERSION(3, 90, 0)
  10. // GTK stock items have been deprecated. The docs say to switch to using the
  11. // strings "_Open", etc. However this breaks i18n. We could supply our own
  12. // internationalized strings, but the "_" in these strings is significant: it's
  13. // the keyboard shortcut to select these actions. TODO: Provide
  14. // internationalized strings when GTK provides support for it.
  15. const char* const kCancelLabel = "_Cancel";
  16. const char* const kNoLabel = "_No";
  17. const char* const kOkLabel = "_OK";
  18. const char* const kOpenLabel = "_Open";
  19. const char* const kSaveLabel = "_Save";
  20. const char* const kYesLabel = "_Yes";
  21. #else
  22. G_GNUC_BEGIN_IGNORE_DEPRECATIONS
  23. const char* const kCancelLabel = GTK_STOCK_CANCEL;
  24. const char* const kNoLabel = GTK_STOCK_NO;
  25. const char* const kOkLabel = GTK_STOCK_OK;
  26. const char* const kOpenLabel = GTK_STOCK_OPEN;
  27. const char* const kSaveLabel = GTK_STOCK_SAVE;
  28. const char* const kYesLabel = GTK_STOCK_YES;
  29. G_GNUC_END_IGNORE_DEPRECATIONS
  30. #endif
  31. } // namespace util_gtk