[gtksourceviewmm] SourceView: Improve get_source_buffer() and remove deprecated methods.



commit b17c2585720e37f036dc7fecb41910ff142f05b6
Author: Murray Cumming <murrayc murrayc com>
Date:   Sun Jun 13 12:46:37 2010 +0200

    SourceView: Improve get_source_buffer() and remove deprecated methods.
    
    * gtksourceview/src/sourceview.[hg|ccg]: get_source_buffer():
    Just use RefPtr::cast_dynamic<> here, which is all these methods
    really do. This avoids us having ot worry about reference-counting.
    Also remove the deprecated methods.

 gtksourceview/src/sourceview.ccg |   31 +++---------------------
 gtksourceview/src/sourceview.hg  |   47 +-------------------------------------
 2 files changed, 5 insertions(+), 73 deletions(-)
---
diff --git a/gtksourceview/src/sourceview.ccg b/gtksourceview/src/sourceview.ccg
index 8228847..b8cbc6b 100644
--- a/gtksourceview/src/sourceview.ccg
+++ b/gtksourceview/src/sourceview.ccg
@@ -74,18 +74,15 @@ SourceView::SourceView(const Glib::RefPtr<SourceBuffer> &a_buffer) :
 Glib::RefPtr<const SourceBuffer>
 SourceView::get_source_buffer () const
 {
-    Glib::RefPtr<SourceBuffer> buffer ;
-    buffer = Glib::wrap (GTK_SOURCE_BUFFER (get_buffer ()->gobj ()), true);
-    return buffer ;
+    Glib::RefPtr<const Gtk::TextBuffer> buffer = get_buffer();
+    return Glib::RefPtr<const SourceBuffer>::cast_dynamic(buffer);
 }
 
 Glib::RefPtr<SourceBuffer>
 SourceView::get_source_buffer ()
 {
-    Glib::RefPtr<SourceBuffer> buffer ;
-    buffer = Glib::wrap (GTK_SOURCE_BUFFER (get_buffer ()->gobj ()), true) ;
-    return buffer ;
-
+    Glib::RefPtr<Gtk::TextBuffer> buffer = get_buffer();
+    return Glib::RefPtr<SourceBuffer>::cast_dynamic(buffer);
 }
 
 void
@@ -94,26 +91,6 @@ SourceView::set_source_buffer (const Glib::RefPtr<SourceBuffer> &source_buffer)
     set_buffer (source_buffer) ;
 }
 
-#ifndef GTKSOURCEVIEWMM_DISABLE_DEPRECATED
-void
-SourceView::set_mark_category_pixbuf(const Glib::ustring& category, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
-{
-  gtk_source_view_set_mark_category_icon_from_pixbuf(gobj(), category.c_str(), Glib::unwrap(pixbuf));
-}
-
-Glib::RefPtr<Gdk::Pixbuf>
-SourceView::get_mark_category_pixbuf(const Glib::ustring&)
-{
-  return Glib::RefPtr<Gdk::Pixbuf>();
-}
-
-Glib::RefPtr<const Gdk::Pixbuf>
-SourceView::get_mark_category_pixbuf(const Glib::ustring&) const
-{
-  return Glib::RefPtr<const Gdk::Pixbuf>();
-}
-#endif
-
 void
 SourceView::unset_mark_category_icon(const Glib::ustring& category)
 {
diff --git a/gtksourceview/src/sourceview.hg b/gtksourceview/src/sourceview.hg
index f3e72e9..e3ddc2a 100644
--- a/gtksourceview/src/sourceview.hg
+++ b/gtksourceview/src/sourceview.hg
@@ -107,10 +107,6 @@ public:
    **/
   explicit SourceView (const Glib::RefPtr<SourceBuffer> &buffer) ;
 
-// TODO: remove these when breaking API/ABI? SourceView is derived from GtkObject, so it does not need to be accessed by Glib::RefPtr. krnowak
-  _WRAP_CREATE()
-  _WRAP_CREATE(const Glib::RefPtr<SourceBuffer> &buffer)
-
   /** Returns the GtkTextBuffer being displayed by this text view.
    *
    * @return A SourceBuffer.
@@ -285,48 +281,7 @@ public:
    */
   _WRAP_METHOD(gint get_mark_category_priority(const Glib::ustring& category) const, gtk_source_view_get_mark_category_priority)
 
-#ifndef GTKSOURCEVIEWMM_DISABLE_DEPRECATED
-  _IGNORE(gtk_source_view_set_mark_category_pixbuf)
-
-  /** Associates a given @a pixbuf with a given mark @a category.
-   *
-   * If @a pixbuf is empty, the pixbuf is unset.
-   *
-   * @param category A mark category.
-   * @param pixbuf A Gdk::Pixbuf or empty Glib::RefPtr.
-   *
-   * @deprecated Use set_mark_category_icon() instead.
-   *
-   * @newin{2,2}
-   */
-  void set_mark_category_pixbuf(const Glib::ustring& category, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf);
-
-  _IGNORE(gtk_source_view_get_mark_category_pixbuf)
-
-  /** Gets the pixbuf which is associated with the given mark @a category.
-   *
-   * @param category A mark category.
-   *
-   * @return Empty Glib::RefPtr.
-   *
-   * @deprecated Do not use it.
-   *
-   * @newin{2,2}
-   */
-  Glib::RefPtr<Gdk::Pixbuf> get_mark_category_pixbuf(const Glib::ustring& category);
-
-  /** Gets the pixbuf which is associated with the given mark @a category.
-   *
-   * @param category A mark category.
-   *
-   * @return Empty Glib::RefPtr.
-   *
-   * @deprecated Do not use it.
-   *
-   * @newin{2,2}
-   */
-  Glib::RefPtr<const Gdk::Pixbuf> get_mark_category_pixbuf(const Glib::ustring& category) const;
-#endif // GTKSOURCEVIEWMM_DISABLE_DEPRECATED
+  _IGNORE(gtk_source_view_set_mark_category_pixbuf, gtk_source_view_get_mark_category_pixbuf)
 
   /** Sets the icon to be used for @a category to @a pixbuf.
    *



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