[gnote] Do not use deprecated Stock items in HIGDialog



commit 646065a28e96197c58cce4726a2dbdd29a5c496c
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun May 2 20:08:19 2021 +0300

    Do not use deprecated Stock items in HIGDialog

 src/notebooks/createnotebookdialog.cpp |  4 ++--
 src/utils.cpp                          | 32 +++++++++++++-------------------
 src/utils.hpp                          |  3 +--
 3 files changed, 16 insertions(+), 23 deletions(-)
---
diff --git a/src/notebooks/createnotebookdialog.cpp b/src/notebooks/createnotebookdialog.cpp
index 737ca1fc..ad1a45ad 100644
--- a/src/notebooks/createnotebookdialog.cpp
+++ b/src/notebooks/createnotebookdialog.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012-2013,2017,2019 Aurimas Cernius
+ * Copyright (C) 2012-2013,2017,2019,2021 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -64,7 +64,7 @@ namespace gnote {
       
       set_extra_widget(table);
       
-      add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL, false);
+      add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL, false);
       add_button (m_gnote.icon_manager().get_icon(IconManager::NOTEBOOK_NEW, 16),
                   // Translation note: This is the Create button in the Create
                   // New Note Dialog.
diff --git a/src/utils.cpp b/src/utils.cpp
index b932fa14..f809ef21 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -34,7 +34,6 @@
 #include <gtkmm/checkmenuitem.h>
 #include <gtkmm/icontheme.h>
 #include <gtkmm/image.h>
-#include <gtkmm/stock.h>
 #include <gtkmm/textbuffer.h>
 
 #include "sharp/xmlreader.hpp"
@@ -342,20 +341,16 @@ namespace gnote {
 
       switch (msg_type) {
       case Gtk::MESSAGE_ERROR:
-        m_image = new Gtk::Image (Gtk::Stock::DIALOG_ERROR,
-                                  Gtk::ICON_SIZE_DIALOG);
+        m_image = new Gtk::Image("dialog-error", Gtk::ICON_SIZE_DIALOG);
         break;
       case Gtk::MESSAGE_QUESTION:
-        m_image = new Gtk::Image (Gtk::Stock::DIALOG_QUESTION,
-                                  Gtk::ICON_SIZE_DIALOG);
+        m_image = new Gtk::Image("dialog-question", Gtk::ICON_SIZE_DIALOG);
         break;
       case Gtk::MESSAGE_INFO:
-        m_image = new Gtk::Image (Gtk::Stock::DIALOG_INFO,
-                                  Gtk::ICON_SIZE_DIALOG);
+        m_image = new Gtk::Image("dialog-information", Gtk::ICON_SIZE_DIALOG);
         break;
       case Gtk::MESSAGE_WARNING:
-        m_image = new Gtk::Image (Gtk::Stock::DIALOG_WARNING,
-                                  Gtk::ICON_SIZE_DIALOG);
+        m_image = new Gtk::Image("dialog-warning", Gtk::ICON_SIZE_DIALOG);
         break;
       default:
         break;
@@ -404,21 +399,21 @@ namespace gnote {
       case Gtk::BUTTONS_NONE:
         break;
       case Gtk::BUTTONS_OK:
-        add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK, true);
+        add_button(_("_OK"), Gtk::RESPONSE_OK, true);
         break;
       case Gtk::BUTTONS_CLOSE:
-        add_button (Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE, true);
+        add_button(_("_Close"), Gtk::RESPONSE_CLOSE, true);
         break;
       case Gtk::BUTTONS_CANCEL:
-        add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL, true);
+        add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL, true);
         break;
       case Gtk::BUTTONS_YES_NO:
-        add_button (Gtk::Stock::NO, Gtk::RESPONSE_NO, false);
-        add_button (Gtk::Stock::YES, Gtk::RESPONSE_YES, true);
+        add_button(_("_No"), Gtk::RESPONSE_NO, false);
+        add_button(_("_Yes"), Gtk::RESPONSE_YES, true);
         break;
       case Gtk::BUTTONS_OK_CANCEL:
-        add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL, false);
-        add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK, true);
+        add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL, false);
+        add_button(_("_OK"), Gtk::RESPONSE_OK, true);
         break;
       }
 
@@ -436,10 +431,9 @@ namespace gnote {
     }
 
 
-    void HIGMessageDialog::add_button(const Gtk::BuiltinStockID& stock_id, 
-                                       Gtk::ResponseType resp, bool is_default)
+    void HIGMessageDialog::add_button(const Glib::ustring & label, Gtk::ResponseType resp, bool is_default)
     {
-      Gtk::Button *button = manage(new Gtk::Button (stock_id));
+      Gtk::Button *button = manage(new Gtk::Button(label, true));
       button->property_can_default().set_value(true);
       
       add_button(button, resp, is_default);
diff --git a/src/utils.hpp b/src/utils.hpp
index 941b958d..58b5a00d 100644
--- a/src/utils.hpp
+++ b/src/utils.hpp
@@ -106,8 +106,7 @@ class Preferences;
       HIGMessageDialog(Gtk::Window *, GtkDialogFlags flags, Gtk::MessageType msg_type, 
                        Gtk::ButtonsType btn_type, const Glib::ustring & header = Glib::ustring(),
                        const Glib::ustring & msg = Glib::ustring());
-      void add_button(const Gtk::BuiltinStockID& stock_id, 
-                       Gtk::ResponseType response, bool is_default);
+      void add_button(const Glib::ustring & label, Gtk::ResponseType response, bool is_default);
       void add_button(const Glib::RefPtr<Gdk::Pixbuf> & pixbuf, 
                       const Glib::ustring & label_text, 
                       Gtk::ResponseType response, bool is_default);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]