[gtkmm] Deprecate some methods using Gdk::Color, to fix the build.



commit 29c47eb4f7b9bf1d18f68091cbad172d3ab1de5d
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Jan 5 17:28:52 2012 +0100

    Deprecate some methods using Gdk::Color, to fix the build.
    
    * gdk/gdkmm/general.[h|cc]: Deprecate set_source_color().
    * gtk/src/cellview.hg: Deprecate set_background_color().
    * gtk/src/colorbutton.[hg|ccg]: Deprecate get_color().
    * gtk/src/colorselection.hg: Deprecate set_current_color().
    
    And add #defines to let us continue to use the deprecated C API in
    our deprecated C++ API implementation.

 ChangeLog                 |   12 ++++++++++++
 gdk/gdkmm/general.cc      |    9 +++++++++
 gdk/gdkmm/general.h       |    5 +++++
 gtk/src/cellview.hg       |    9 +++++++--
 gtk/src/colorbutton.ccg   |    4 ++++
 gtk/src/colorbutton.hg    |   11 ++++++++++-
 gtk/src/colorselection.hg |    7 ++++++-
 7 files changed, 53 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6ac980f..d12dcbf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-01-05  Murray Cumming  <murrayc murrayc com>
+
+	Deprecate some methods using Gdk::Color, to fix the build.
+
+	* gdk/gdkmm/general.[h|cc]: Deprecate set_source_color().
+	* gtk/src/cellview.hg: Deprecate set_background_color().
+	* gtk/src/colorbutton.[hg|ccg]: Deprecate get_color().
+	* gtk/src/colorselection.hg: Deprecate set_current_color().
+
+	And add #defines to let us continue to use the deprecated C API in 
+	our deprecated C++ API implementation.
+
 2012-01-04  Kjell Ahlstedt  <kjell ahlstedt bredband net>
 
 	ComboBoxText: Constructor: Add a TODO comment.
diff --git a/gdk/gdkmm/general.cc b/gdk/gdkmm/general.cc
index 181ab27..8c05928 100644
--- a/gdk/gdkmm/general.cc
+++ b/gdk/gdkmm/general.cc
@@ -18,10 +18,16 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+//Allow use of deprecated API,
+//in the API that we also deprecate, but cannot remove yet:
+#undef GDK_DISABLE_DEPRECATED
+#define GDK_DISABLE_DEPRECATION_WARNINGS 1
+
 #include <gdkmm/general.h>
 #include <gdkmm/color.h>
 #include <gdk/gdk.h>
 
+
 namespace Gdk
 {
 
@@ -54,12 +60,15 @@ void flush()
 namespace Cairo
 {
 
+#ifndef GDKMM_DISABLE_DEPRECATED
 
 void set_source_color(const ::Cairo::RefPtr< ::Cairo::Context >& context, const Gdk::Color& color)
 {
   gdk_cairo_set_source_color(context->cobj(), const_cast<GdkColor*>(color.gobj()));
 }
 
+#endif //GDKMM_DISABLE_DEPRECATED
+
 void set_source_rgba(const ::Cairo::RefPtr< ::Cairo::Context >& context, const Gdk::RGBA& color)
 {
   gdk_cairo_set_source_rgba(context->cobj(), const_cast<GdkRGBA*>(color.gobj()));
diff --git a/gdk/gdkmm/general.h b/gdk/gdkmm/general.h
index f230a57..869cb8a 100644
--- a/gdk/gdkmm/general.h
+++ b/gdk/gdkmm/general.h
@@ -41,14 +41,19 @@ void flush();
 namespace Cairo
 {
 
+#ifndef GDKMM_DISABLE_DEPRECATED
+
 /** Sets the specified Gdk::Color as the source color of the Cairo context.
  * @param @context The cairo context.
  * @param color The color to use as the source color.
  *
  * @newin{2,10}
+ * @deprecated Use set_source_rgba() instead.
  */
 void set_source_color(const ::Cairo::RefPtr< ::Cairo::Context >& context, const Gdk::Color& color);
 
+#endif //GDKMM_DISABLE_DEPRECATED
+
 /** Sets the specified Gdk::RGBA as the source color of the Cairo context.
  * @param @context The cairo context.
  * @param color The color to use as the source color.
diff --git a/gtk/src/cellview.hg b/gtk/src/cellview.hg
index 495e490..b41c489 100644
--- a/gtk/src/cellview.hg
+++ b/gtk/src/cellview.hg
@@ -32,6 +32,11 @@ _CONFIGINCLUDE(gtkmmconfig.h)
 _DEFS(gtkmm,gtk)
 _PINCLUDE(gtkmm/private/widget_p.h)
 
+#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
+#undef GTK_DISABLE_DEPRECATED
+#define GDK_DISABLE_DEPRECATION_WARNINGS 1
+#m4 _POP()
+
 namespace Gtk
 {
 
@@ -90,7 +95,7 @@ public:
   _WRAP_METHOD(TreeModel::Path get_displayed_row() const, gtk_cell_view_get_displayed_row)
   _IGNORE(gtk_cell_view_get_size_of_row) //deprecated
 
-  _WRAP_METHOD(void set_background_color(const Gdk::Color& color), gtk_cell_view_set_background_color)
+  _WRAP_METHOD(void set_background_color(const Gdk::Color& color), gtk_cell_view_set_background_color, deprecated "Use set_background_rgba instead.")
   _WRAP_METHOD(void set_background_rgba(const Gdk::RGBA& rgba), gtk_cell_view_set_background_rgba)
   
   _WRAP_METHOD(bool get_draw_sensitive() const, gtk_cell_view_get_draw_sensitive)
@@ -101,7 +106,7 @@ public:
   _IGNORE(gtk_cell_view_get_cell_renderers) //deprecated
 
   _WRAP_PROPERTY("background", Glib::ustring)
-  _WRAP_PROPERTY("background-gdk", Gdk::Color)
+  _WRAP_PROPERTY("background-gdk", Gdk::Color) //TODO: Deprecate this.
   _WRAP_PROPERTY("background-rgba", Gdk::RGBA)
   _WRAP_PROPERTY("background-set", bool)
   _WRAP_PROPERTY("model", Glib::RefPtr<TreeModel>)
diff --git a/gtk/src/colorbutton.ccg b/gtk/src/colorbutton.ccg
index c450856..23bc6f9 100644
--- a/gtk/src/colorbutton.ccg
+++ b/gtk/src/colorbutton.ccg
@@ -26,6 +26,8 @@
 namespace Gtk
 {
 
+#ifndef GTKMM_DISABLE_DEPRECATED
+
 Gdk::Color ColorButton::get_color() const
 {
   Gdk::Color color;
@@ -33,6 +35,8 @@ Gdk::Color ColorButton::get_color() const
   return color;
 }
 
+#endif //GTKMM_DISABLE_DEPRECATED
+
 Gdk::RGBA ColorButton::get_rgba() const
 {
   Gdk::RGBA color;
diff --git a/gtk/src/colorbutton.hg b/gtk/src/colorbutton.hg
index f486ca6..cc09407 100644
--- a/gtk/src/colorbutton.hg
+++ b/gtk/src/colorbutton.hg
@@ -25,6 +25,10 @@
 _DEFS(gtkmm,gtk)
 _PINCLUDE(gtkmm/private/button_p.h)
 
+#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
+#undef GTK_DISABLE_DEPRECATED
+#define GDK_DISABLE_DEPRECATION_WARNINGS 1
+#m4 _POP()
 
 namespace Gtk
 {
@@ -85,6 +89,8 @@ public:
   _WRAP_METHOD(void set_alpha(guint16 alpha), gtk_color_button_set_alpha)
   _WRAP_METHOD(void set_rgba(const Gdk::RGBA& color), gtk_color_button_set_rgba)
 
+#ifndef GTKMM_DISABLE_DEPRECATED
+
   /** Returns a copy of the the current color.
    *
    * Changes to the return value will have no effect on the Gtk::ColorButton.
@@ -92,10 +98,13 @@ public:
    * @return A Gdk::Color representing the current internal color of the Gtk::ColorButton.
    *
    * @newin{2,4}
+   * @deprecated Use get_rgba() instead.
    */
   Gdk::Color get_color() const;
   _IGNORE(gtk_color_button_get_color)
 
+#endif //GTKMM_DISABLE_DEPRECATED
+
   /** Returns a copy of the the current color.
    *
    * Changes to the return value will have no effect on the Gtk::ColorButton.
@@ -115,7 +124,7 @@ public:
 
   _WRAP_PROPERTY("use-alpha", bool)
   _WRAP_PROPERTY("title", Glib::ustring)
-  _WRAP_PROPERTY("color", Gdk::Color)
+  _WRAP_PROPERTY("color", Gdk::Color) //TODO: Deprecated
   _WRAP_PROPERTY("rgba", Gdk::RGBA)
   _WRAP_PROPERTY("alpha", guint16) //Todo: Remove thsi when we remove the "color" property too.
 
diff --git a/gtk/src/colorselection.hg b/gtk/src/colorselection.hg
index cb1a0d3..138480d 100644
--- a/gtk/src/colorselection.hg
+++ b/gtk/src/colorselection.hg
@@ -21,6 +21,11 @@ _DEFS(gtkmm,gtk)
 _PINCLUDE(gtkmm/private/hvbox_p.h)
 _PINCLUDE(gtkmm/private/dialog_p.h)
 
+#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
+#undef GTK_DISABLE_DEPRECATED
+#define GDK_DISABLE_DEPRECATION_WARNINGS 1
+#m4 _POP()
+
 #include <vector>
 
 #include <gtkmm/box.h>
@@ -53,7 +58,7 @@ public:
   _WRAP_METHOD(void set_has_opacity_control(bool has_opacity = true), gtk_color_selection_set_has_opacity_control)
   _WRAP_METHOD(bool get_has_palette() const, gtk_color_selection_get_has_palette)
   _WRAP_METHOD(void set_has_palette(bool has_palette = true), gtk_color_selection_set_has_palette)
-  _WRAP_METHOD(void set_current_color(const Gdk::Color& color), gtk_color_selection_set_current_color)
+  _WRAP_METHOD(void set_current_color(const Gdk::Color& color), gtk_color_selection_set_current_color, deprecated "Use set_current_rgba() instead.")
   _WRAP_METHOD(void set_current_alpha(guint16 alpha), gtk_color_selection_set_current_alpha)
   Gdk::Color get_current_color() const;
   _WRAP_METHOD(guint16 get_current_alpha() const, gtk_color_selection_get_current_alpha)



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