[gtkmm] Gtk::ToggleAction: Deprecate the create() that uses (deprecated) StockID



commit db67440bf31955f3c495ddbf6358f9f62bc7fbff
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Thu Dec 19 17:08:23 2013 +0100

    Gtk::ToggleAction: Deprecate the create() that uses (deprecated) StockID
    
    * gtk/src/toggleaction.[hg|ccg]: Deprecate the create() that uses StockID.
    This should not be an API break because you could not use this deprecated
    method if you had disabled deprecated API, because it takes a deprecated
    type as parameter.

 gtk/src/toggleaction.ccg |   16 ++++++++++++++++
 gtk/src/toggleaction.hg  |    6 ++++--
 2 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/gtk/src/toggleaction.ccg b/gtk/src/toggleaction.ccg
index 7eae3b8..3b244b2 100644
--- a/gtk/src/toggleaction.ccg
+++ b/gtk/src/toggleaction.ccg
@@ -21,12 +21,14 @@
 namespace Gtk
 {
 
+_DEPRECATE_IFDEF_START
 ToggleAction::ToggleAction(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& 
label, const Glib::ustring& tooltip, bool is_active)
 :
   _CONSTRUCT("name", name.c_str(), "stock_id", stock_id.get_c_str(), "label", (label.empty() ? 0 : 
label.c_str()), "tooltip", (tooltip.empty() ? 0 : tooltip.c_str()))
 {
   set_active(is_active);
 }
+_DEPRECATE_IFDEF_END
 
 ToggleAction::ToggleAction(const Glib::ustring& name, const Glib::ustring& icon_name, const Glib::ustring& 
label, const Glib::ustring& tooltip, bool is_active)
 :
@@ -37,13 +39,27 @@ ToggleAction::ToggleAction(const Glib::ustring& name, const Glib::ustring& icon_
 
 Glib::RefPtr<ToggleAction> ToggleAction::create(const Glib::ustring& name, const Glib::ustring& label, const 
Glib::ustring& tooltip, bool is_active)
 {
+_DEPRECATE_IFDEF_START
   return Glib::RefPtr<ToggleAction>( new ToggleAction(name, Gtk::StockID(), label, tooltip, is_active) );
+#else // GTKMM_DISABLE_DEPRECATED
+  // StockID is deprecated. Can't call the constructor that takes a StockID.
+  Glib::RefPtr<ToggleAction> action(new ToggleAction());
+  action->set_name(name);
+  action->set_active(is_active);
+  if (!label.empty())
+    action->set_label(label);
+  if (!tooltip.empty())
+    action->set_tooltip(tooltip);
+  return action;
+_DEPRECATE_IFDEF_END
 }
 
+_DEPRECATE_IFDEF_START
 Glib::RefPtr<ToggleAction> ToggleAction::create(const Glib::ustring& name, const Gtk::StockID& stock_id, 
const Glib::ustring& label, const Glib::ustring& tooltip, bool is_active)
 {
   return Glib::RefPtr<ToggleAction>( new ToggleAction(name, stock_id, label, tooltip, is_active) );
 }
+_DEPRECATE_IFDEF_END
 
 Glib::RefPtr<ToggleAction> ToggleAction::create_with_icon_name(const Glib::ustring& name, const 
Glib::ustring& icon_name, const Glib::ustring& label, const Glib::ustring& tooltip, bool is_active)
 {
diff --git a/gtk/src/toggleaction.hg b/gtk/src/toggleaction.hg
index dd1346d..03d8e82 100644
--- a/gtk/src/toggleaction.hg
+++ b/gtk/src/toggleaction.hg
@@ -47,7 +47,6 @@ protected:
   _CTOR_DEFAULT
 
 _DEPRECATE_IFDEF_START
-
   /** Creates a toggle action.
    *
    * @param name      A unique name for the action.
@@ -57,7 +56,7 @@ _DEPRECATE_IFDEF_START
    * @param tooltip   A tooltip for the action.
    * @param is_active The default checked state of the action.
    *
-   * @deprecated Stock IDs are deprecated, so use the other construtor.
+   * @deprecated Stock IDs are deprecated, so use another constructor.
    */
    explicit ToggleAction(const Glib::ustring& name, const StockID& stock_id = StockID(), const 
Glib::ustring& label = Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring(), bool is_active = 
false);
 _DEPRECATE_IFDEF_END
@@ -91,6 +90,7 @@ public:
    */
    static Glib::RefPtr<ToggleAction> create(const Glib::ustring& name, const Glib::ustring& label = 
Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring(), bool is_active = false);
 
+_DEPRECATE_IFDEF_START
   /** Creates a toggle action with a stock ID.
    * The tock ID is used to set a default icon, text and accelerator for
    * the toggle action.
@@ -103,8 +103,10 @@ public:
    * @param is_active The default checked state of the action.
    *
    * @return A new ToggleAction.
+   * @deprecated Stock IDs are deprecated, so use another create() method.
    */
    static Glib::RefPtr<ToggleAction> create(const Glib::ustring& name, const Gtk::StockID& stock_id, const 
Glib::ustring& label = Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring(), bool is_active = 
false);
+_DEPRECATE_IFDEF_END
 
   /** Creates a toggle action with an icon name.
    * The toggle action's icon will reflect the specified icon name in the


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