[gtkmm] Replace deprecated Glib::ScopedPtr with make_unique_g_free().



commit 637be0d00b9f835166d10de4bcc7efe6ec2c49ca
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Jan 18 11:29:59 2016 +0100

    Replace deprecated Glib::ScopedPtr with make_unique_g_free().

 demos/gtk-demo/example_dialog.cc |    2 +-
 gdk/src/dragcontext.ccg          |    2 +-
 gdk/src/types.ccg                |    4 ++--
 gtk/src/clipboard.ccg            |    4 ++--
 gtk/src/colorselection.ccg       |    2 +-
 gtk/src/selectiondata.ccg        |    2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/demos/gtk-demo/example_dialog.cc b/demos/gtk-demo/example_dialog.cc
index 6d36b63..49d89f6 100644
--- a/demos/gtk-demo/example_dialog.cc
+++ b/demos/gtk-demo/example_dialog.cc
@@ -113,7 +113,7 @@ void Example_Dialog::on_button_message()
   Glib::ustring strMessage = "This message box has been popped up the following\n"
                              "number of times:\n\n";
   {
-    Glib::ScopedPtr<char> buf (g_strdup_printf("%d", m_count));
+    auto buf = Glib::make_unique_ptr_gfree(g_strdup_printf("%d", m_count));
     strMessage += buf.get();
   }
   Gtk::MessageDialog dialog(*this, strMessage, false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true); //true = 
modal
diff --git a/gdk/src/dragcontext.ccg b/gdk/src/dragcontext.ccg
index cc0b53b..017a193 100644
--- a/gdk/src/dragcontext.ccg
+++ b/gdk/src/dragcontext.ccg
@@ -21,7 +21,7 @@
 #include <gdkmm/window.h>
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
-#include <glibmm/utility.h> //For ScopedPtr<>.
+#include <glibmm/utility.h> //For Glib::make_unique_ptr_gfree<>.
 
 namespace Gdk
 {
diff --git a/gdk/src/types.ccg b/gdk/src/types.ccg
index 6ca71d2..b04b433 100644
--- a/gdk/src/types.ccg
+++ b/gdk/src/types.ccg
@@ -69,7 +69,7 @@ GdkAtom AtomStringTraits::to_c_type(const std::string& atom_name)
 std::string AtomStringTraits::to_cpp_type(GdkAtom atom)
 {
   if(const auto atom_name = gdk_atom_name(atom))
-    return std::string(Glib::ScopedPtr<char>(atom_name).get());
+    return std::string(Glib::make_unique_ptr_gfree(atom_name).get());
   else
     return std::string();
 }
@@ -84,7 +84,7 @@ GdkAtom AtomUstringTraits::to_c_type(const Glib::ustring& atom_name)
 Glib::ustring AtomUstringTraits::to_cpp_type(GdkAtom atom)
 {
   if(const auto atom_name = gdk_atom_name(atom))
-    return Glib::ustring(Glib::ScopedPtr<char>(atom_name).get());
+    return Glib::ustring(Glib::make_unique_ptr_gfree(atom_name).get());
   else
     return Glib::ustring();
 }
diff --git a/gtk/src/clipboard.ccg b/gtk/src/clipboard.ccg
index fb4cf8b..b45dc86 100644
--- a/gtk/src/clipboard.ccg
+++ b/gtk/src/clipboard.ccg
@@ -22,7 +22,7 @@
 
 #include <gtkmm/textbuffer.h>
 #include <gtkmm/selectiondata_private.h>
-#include <glibmm/utility.h> //For ScopedPtr<>.
+#include <glibmm/utility.h> //For make_unique_ptr_gfree<>.
 #include <gtk/gtk.h>
 
 namespace
@@ -311,7 +311,7 @@ std::string Clipboard::wait_for_rich_text(const Glib::RefPtr<TextBuffer>& buffer
   {
     gchar* format_atom_name = gdk_atom_name(format_atom);
     if(format_atom_name)
-      format = Glib::ScopedPtr<char>(format_atom_name).get(); //This frees the buffer.
+      format = Glib::make_unique_ptr_gfree(format_atom_name).get(); //This frees the buffer.
 
     result = std::string((char*)text, length);
     g_free(text);
diff --git a/gtk/src/colorselection.ccg b/gtk/src/colorselection.ccg
index 9369cf5..f010be7 100644
--- a/gtk/src/colorselection.ccg
+++ b/gtk/src/colorselection.ccg
@@ -101,7 +101,7 @@ std::vector<Gdk::Color> ColorSelection::palette_from_string(const Glib::ustring&
 Glib::ustring ColorSelection::palette_to_string(const std::vector<Gdk::Color>& colors)
 {
   if(char *const str = gtk_color_selection_palette_to_string(Glib::ArrayHandler<Gdk::Color, 
Gdk::ColorTraits>::vector_to_array(colors).data (), colors.size()))
-    return Glib::ustring(Glib::ScopedPtr<char>(str).get());
+    return Glib::ustring(Glib::make_unique_ptr_gfree(str).get());
   else
     return Glib::ustring();
 }
diff --git a/gtk/src/selectiondata.ccg b/gtk/src/selectiondata.ccg
index 5a36b86..a6ee912 100644
--- a/gtk/src/selectiondata.ccg
+++ b/gtk/src/selectiondata.ccg
@@ -19,7 +19,7 @@
 
 #include <gtkmm/textbuffer.h>
 #include <gdkmm/pixbuf.h>
-#include <glibmm/utility.h> //For ScopedPtr<>.
+#include <glibmm/utility.h> //For make_unique_ptr_gfree<>.
 #include <gtk/gtk.h>
 
 


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