[gtkmm/vector] Partially adapt Gtk to vector utils.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm/vector] Partially adapt Gtk to vector utils.
- Date: Sun, 23 Jan 2011 11:20:08 +0000 (UTC)
commit af9395696c1dfc2ea91e189e5206d1b2c550910d
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Sun Jan 23 12:19:38 2011 +0100
Partially adapt Gtk to vector utils.
gtk/gtkmm/stock.cc | 4 +-
gtk/gtkmm/stock.h | 2 +-
gtk/src/aboutdialog.ccg | 2 +
gtk/src/aboutdialog.hg | 29 +++++++++++++------------
gtk/src/action.ccg | 2 +
gtk/src/action.hg | 10 +++++---
gtk/src/actiongroup.ccg | 2 +
gtk/src/actiongroup.hg | 8 +++++-
gtk/src/application.ccg | 2 +
gtk/src/application.hg | 10 +++++---
gtk/src/builder.ccg | 15 ++++++++++---
gtk/src/builder.hg | 20 ++++++++++--------
gtk/src/celllayout.ccg | 2 +
gtk/src/celllayout.hg | 10 +++++---
gtk/src/clipboard.ccg | 48 +++++++++++++++++--------------------------
gtk/src/clipboard.hg | 22 ++++++++++----------
gtk/src/colorselection.ccg | 18 ++++++++++------
gtk/src/colorselection.hg | 8 ++++--
gtk/src/container.ccg | 10 +++++---
gtk/src/container.hg | 16 +++++++++-----
gtk/src/dialog.ccg | 4 +-
gtk/src/dialog.hg | 4 ++-
gtk/src/enums.hg | 15 +++++++++++++
gtk/src/filechooser.ccg | 2 +
gtk/src/filechooser.hg | 25 ++++++++++++----------
gtk/src/iconinfo.ccg | 14 ++++++------
gtk/src/iconinfo.hg | 4 ++-
gtk/src/iconset.ccg | 4 +-
gtk/src/iconset.hg | 2 +-
gtk/src/icontheme.ccg | 18 +++++++++-------
gtk/src/icontheme.hg | 20 ++++++++++--------
31 files changed, 206 insertions(+), 146 deletions(-)
---
diff --git a/gtk/gtkmm/stock.cc b/gtk/gtkmm/stock.cc
index 2ab73f1..56b6925 100644
--- a/gtk/gtkmm/stock.cc
+++ b/gtk/gtkmm/stock.cc
@@ -162,9 +162,9 @@ bool lookup(const Gtk::StockID& stock_id, Gtk::IconSize size, Gtk::Image& image)
return (image.gobj() != 0);
}
-Glib::SListHandle<Gtk::StockID,Gtk::StockID_Traits> get_ids()
+std::vector<Gtk::StockID> get_ids()
{
- return Glib::SListHandle<Gtk::StockID,Gtk::StockID_Traits>(
+ return Glib::SListHandler<Gtk::StockID,Gtk::StockID_Traits>::array_to_vector (
gtk_stock_list_ids(), Glib::OWNERSHIP_DEEP);
}
diff --git a/gtk/gtkmm/stock.h b/gtk/gtkmm/stock.h
index 51842f6..e7ed80c 100644
--- a/gtk/gtkmm/stock.h
+++ b/gtk/gtkmm/stock.h
@@ -217,7 +217,7 @@ bool lookup(const Gtk::StockID& stock_id, Gtk::IconSize size, Gtk::Image& image)
*
* @return list of all known stock IDs.
*/
-Glib::SListHandle<Gtk::StockID,Gtk::StockID_Traits> get_ids();
+std::vector<Gtk::StockID> get_ids();
} // namespace Stock
diff --git a/gtk/src/aboutdialog.ccg b/gtk/src/aboutdialog.ccg
index 2be6eee..2f70d48 100644
--- a/gtk/src/aboutdialog.ccg
+++ b/gtk/src/aboutdialog.ccg
@@ -20,4 +20,6 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
diff --git a/gtk/src/aboutdialog.hg b/gtk/src/aboutdialog.hg
index e1dfd36..b8ae745 100644
--- a/gtk/src/aboutdialog.hg
+++ b/gtk/src/aboutdialog.hg
@@ -18,8 +18,9 @@
_CONFIGINCLUDE(gtkmmconfig.h)
+#include <vector>
+
#include <gtkmm/dialog.h>
-//#include <glibmm/listhandle.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/dialog_p.h)
@@ -72,19 +73,19 @@ public:
_WRAP_METHOD(Glib::ustring get_website_label() const, gtk_about_dialog_get_website_label)
_WRAP_METHOD(void set_website_label(const Glib::ustring& website_label), gtk_about_dialog_set_website_label)
- #m4 _CONVERSION(`const gchar**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3)')
-
- _WRAP_METHOD(Glib::StringArrayHandle get_authors() const, gtk_about_dialog_get_authors)
+#m4 _CONVERSION(`const gchar**',`std::vector<Glib::ustring>',`Glib::ArrayHandler<Glib::ustring>::array_to_vector ($3, Glib::OWNERSHIP_NONE)')
+ _WRAP_METHOD(std::vector<Glib::ustring> get_authors() const, gtk_about_dialog_get_authors)
- _WRAP_METHOD(void set_authors(const Glib::StringArrayHandle& authors) const, gtk_about_dialog_set_authors)
+#m4 _CONVERSION(`const std::vector<Glib::ustring>&',`const gchar**',`Glib::ArrayHandler<Glib::ustring>::vector_to_array ($3).data ()')
+ _WRAP_METHOD(void set_authors(const std::vector<Glib::ustring>& authors) const, gtk_about_dialog_set_authors)
- _WRAP_METHOD(Glib::StringArrayHandle get_documenters() const, gtk_about_dialog_get_documenters)
+ _WRAP_METHOD(std::vector<Glib::ustring> get_documenters() const, gtk_about_dialog_get_documenters)
- #m4 _CONVERSION(`const Glib::StringArrayHandle&',`const gchar**',`const_cast<const gchar**>(($3).data())')
+ #m4 _CONVERSION(`const std::vector<Glib::ustring>&',`const gchar**',`const_cast<const gchar**>(($3).data())')
- _WRAP_METHOD(void set_documenters(const Glib::StringArrayHandle& documenters), gtk_about_dialog_set_documenters)
- _WRAP_METHOD(Glib::StringArrayHandle get_artists() const, gtk_about_dialog_get_artists)
- _WRAP_METHOD(void set_artists(const Glib::StringArrayHandle& artists), gtk_about_dialog_set_artists)
+ _WRAP_METHOD(void set_documenters(const std::vector<Glib::ustring>& documenters), gtk_about_dialog_set_documenters)
+ _WRAP_METHOD(std::vector<Glib::ustring> get_artists() const, gtk_about_dialog_get_artists)
+ _WRAP_METHOD(void set_artists(const std::vector<Glib::ustring>& artists), gtk_about_dialog_set_artists)
_WRAP_METHOD(Glib::ustring get_translator_credits() const, gtk_about_dialog_get_translator_credits)
_WRAP_METHOD(void set_translator_credits(const Glib::ustring& translator_credits), gtk_about_dialog_set_translator_credits)
@@ -108,10 +109,10 @@ public:
_WRAP_PROPERTY("website_label", Glib::ustring)
_WRAP_PROPERTY("license", Glib::ustring)
_WRAP_PROPERTY("license-type", License)
- _WRAP_PROPERTY("authors", Glib::StringArrayHandle)
- _WRAP_PROPERTY("documenters", Glib::StringArrayHandle)
- _WRAP_PROPERTY("translator_credits", Glib::StringArrayHandle)
- _WRAP_PROPERTY("artists", Glib::StringArrayHandle)
+ _WRAP_PROPERTY("authors", std::vector<Glib::ustring>)
+ _WRAP_PROPERTY("documenters", std::vector<Glib::ustring>)
+ _WRAP_PROPERTY("translator_credits", std::vector<Glib::ustring>)
+ _WRAP_PROPERTY("artists", std::vector<Glib::ustring>)
_WRAP_PROPERTY("logo", Glib::RefPtr<Gdk::Pixbuf>)
_WRAP_PROPERTY("logo_icon_name", Glib::ustring)
_WRAP_PROPERTY("wrap_license", bool)
diff --git a/gtk/src/action.ccg b/gtk/src/action.ccg
index ea88e6a..aaf2325 100644
--- a/gtk/src/action.ccg
+++ b/gtk/src/action.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
#include <gtkmm/menu.h>
diff --git a/gtk/src/action.hg b/gtk/src/action.hg
index e326110..e362b21 100644
--- a/gtk/src/action.hg
+++ b/gtk/src/action.hg
@@ -17,6 +17,8 @@
_CONFIGINCLUDE(gtkmmconfig.h)
+#include <vector>
+
#include <gtkmm/widget.h>
#include <gtkmm/accelgroup.h>
#include <gtkmm/stockid.h>
@@ -162,11 +164,11 @@ public:
_IGNORE(gtk_action_connect_proxy, gtk_action_disconnect_proxy) // deprecated
#m4 dnl // This isn't in convert_gtk.m4, and the default behaviour is wrong.
-#m4 _CONVERSION(`GSList*', `Glib::SListHandle<Widget*>', `$2($3, Glib::OWNERSHIP_NONE)')
-#m4 _CONVERSION(`GSList*', `Glib::SListHandle<const Widget*>', `$2($3, Glib::OWNERSHIP_NONE)')
+#m4 _CONVERSION(`GSList*', `std::vector<Widget*>', `Glib::SListHandler<Widget*>::slist_to_vector ($3, Glib::OWNERSHIP_NONE)')
+#m4 _CONVERSION(`GSList*', `std::vector<const Widget*>', `Glib::SListHandler<const Widget*>::slist_to_vector ($3, Glib::OWNERSHIP_NONE)')
- _WRAP_METHOD(Glib::SListHandle<Widget*> get_proxies(), gtk_action_get_proxies)
- _WRAP_METHOD(Glib::SListHandle<const Widget*> get_proxies() const, gtk_action_get_proxies)
+ _WRAP_METHOD(std::vector<Widget*> get_proxies(), gtk_action_get_proxies)
+ _WRAP_METHOD(std::vector<const Widget*> get_proxies() const, gtk_action_get_proxies)
_WRAP_METHOD(void connect_accelerator(), gtk_action_connect_accelerator)
_WRAP_METHOD(void disconnect_accelerator(), gtk_action_disconnect_accelerator)
diff --git a/gtk/src/actiongroup.ccg b/gtk/src/actiongroup.ccg
index 23af142..5ab0cc9 100644
--- a/gtk/src/actiongroup.ccg
+++ b/gtk/src/actiongroup.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
#include <gtkmm/accelmap.h>
diff --git a/gtk/src/actiongroup.hg b/gtk/src/actiongroup.hg
index bf4e6fa..beac950 100644
--- a/gtk/src/actiongroup.hg
+++ b/gtk/src/actiongroup.hg
@@ -17,6 +17,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <gtkmm/widget.h>
#include <gtkmm/action.h>
#include <gtkmm/accelkey.h>
@@ -51,8 +53,10 @@ public:
_WRAP_METHOD(Glib::RefPtr<Action> get_action(const Glib::ustring& action_name), gtk_action_group_get_action, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Action> get_action(const Glib::ustring& action_name) const, gtk_action_group_get_action, refreturn, constversion)
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Action> > get_actions(), gtk_action_group_list_actions)
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<const Action> > get_actions() const, gtk_action_group_list_actions)
+#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<Action> >',`Glib::ListHandler< Glib::RefPtr<Action> >::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<Action> > get_actions(), gtk_action_group_list_actions)
+#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<const Action> >',`Glib::ListHandler< Glib::RefPtr<const Action> >::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<const Action> > get_actions() const, gtk_action_group_list_actions)
void add(const Glib::RefPtr<Action>& action);
_IGNORE(gtk_action_group_add_action)
diff --git a/gtk/src/application.ccg b/gtk/src/application.ccg
index d8273d7..c839677 100644
--- a/gtk/src/application.ccg
+++ b/gtk/src/application.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
#include <gtkmm/window.h>
#include <glibmm/init.h>
diff --git a/gtk/src/application.hg b/gtk/src/application.hg
index b8caba0..1df39e2 100644
--- a/gtk/src/application.hg
+++ b/gtk/src/application.hg
@@ -17,6 +17,8 @@
_CONFIGINCLUDE(gtkmmconfig.h)
+#include <vector>
+
#include <giomm/application.h>
#include <gtkmm/actiongroup.h>
@@ -70,11 +72,11 @@ public:
_WRAP_CREATE(int argc, char** argv, const Glib::ustring& application_id, Gio::ApplicationFlags flags = Gio::APPLICATION_FLAGS_NONE)
-#m4 _CONVERSION(`GList*',`Glib::ListHandle<Window*>',`$2($3, Glib::OWNERSHIP_NONE)')
- _WRAP_METHOD(Glib::ListHandle<Window*> get_windows(), gtk_application_get_windows)
+#m4 _CONVERSION(`GList*',`std::vector<Window*>',`Glib::ListHandler<Window*>::list_to_vector ($3, Glib::OWNERSHIP_NONE)')
+ _WRAP_METHOD(std::vector<Window*> get_windows(), gtk_application_get_windows)
-#m4 _CONVERSION(`GList*',`Glib::ListHandle<const Window*>',`$2($3, Glib::OWNERSHIP_NONE)')
- _WRAP_METHOD(Glib::ListHandle<const Window*> get_windows() const, gtk_application_get_windows)
+#m4 _CONVERSION(`GList*',`std::vector<const Window*>',`Glib::ListHandler<const Window*>::list_to_vector ($3, Glib::OWNERSHIP_NONE)')
+ _WRAP_METHOD(std::vector<const Window*> get_windows() const, gtk_application_get_windows)
/** Adds a window to the Gtk::Application.
*
diff --git a/gtk/src/builder.ccg b/gtk/src/builder.ccg
index 0c2867a..bc50f49 100644
--- a/gtk/src/builder.ccg
+++ b/gtk/src/builder.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
// Allow GtkBuilder to instantiate a gtkmm derived GType instead of the regular
@@ -77,7 +79,7 @@ Glib::RefPtr<Builder> Builder::create_from_file(const std::string& filename, con
}
//static
-Glib::RefPtr<Builder> Builder::create_from_file(const std::string& filename, const Glib::StringArrayHandle& object_ids)
+Glib::RefPtr<Builder> Builder::create_from_file(const std::string& filename, const std::vector<Glib::ustring>& object_ids)
{
Glib::RefPtr<Builder> builder = Builder::create();
if(builder->add_from_file(filename, object_ids))
@@ -120,7 +122,7 @@ Glib::RefPtr<Builder> Builder::create_from_string(const Glib::ustring& buffer,
//static
Glib::RefPtr<Builder> Builder::create_from_string(const Glib::ustring& buffer,
- const Glib::StringArrayHandle& object_ids)
+ const std::vector<Glib::ustring>& object_ids)
{
Glib::RefPtr<Builder> builder = Builder::create();
if(builder->add_from_string(buffer, object_ids))
@@ -173,10 +175,15 @@ bool Builder::add_from_string(const Glib::ustring& buffer, const Glib::ustring&
return add_from_string(buffer, object_ids);
}
-bool Builder::add_from_string(const Glib::ustring& buffer, const Glib::StringArrayHandle& object_ids)
+bool Builder::add_from_string(const Glib::ustring& buffer, const std::vector<Glib::ustring>& object_ids)
{
GError* gerror = 0;
- bool retvalue = gtk_builder_add_objects_from_string(gobj(), buffer.c_str(), -1 /* means null-terminated */, const_cast<char**>(object_ids.data()), &(gerror));
+ bool retvalue = gtk_builder_add_objects_from_string(
+ gobj(),
+ buffer.c_str(),
+ -1 /* means null-terminated */,
+ const_cast<char**>(Glib::ArrayHandler<Glib::ustring>::vector_to_array (object_ids).data ()),
+ &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
diff --git a/gtk/src/builder.hg b/gtk/src/builder.hg
index 3bc07ad..cf32479 100644
--- a/gtk/src/builder.hg
+++ b/gtk/src/builder.hg
@@ -17,6 +17,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <gtkmm/widget.h>
_DEFS(gtkmm,gtk)
@@ -77,7 +79,7 @@ public:
*/
static Glib::RefPtr<Builder> create_from_file(const std::string& filename, const Glib::ustring& object_id);
//This is just to avoid the ambiguous call when using a string literal,
- //caused by the overload that takes a StringArrayHandle.
+ //caused by the overload that takes a std::vector<Glib::ustring>.
/** Parses a file containing a GtkBuilder UI definition, building only the requested object.
*
* If you are adding an object that depends on an object that is not
@@ -105,7 +107,7 @@ public:
*
* @newin{2,14}
*/
- static Glib::RefPtr<Builder> create_from_file(const std::string& filename, const Glib::StringArrayHandle& object_ids);
+ static Glib::RefPtr<Builder> create_from_file(const std::string& filename, const std::vector<Glib::ustring>& object_ids);
/** Parses a string containing a GtkBuilder UI definition.
*
@@ -117,7 +119,7 @@ public:
*/
static Glib::RefPtr<Builder> create_from_string(const Glib::ustring& buffer);
//This is just to avoid the ambiguous call when using a string literal,
- //caused by the overload that takes a StringArrayHandle.
+ //caused by the overload that takes a std::vector<Glib::ustring>.
/** Parses a string containing a GtkBuilder UI definition building only the requested object.
*
* @param buffer The string to parse.
@@ -153,7 +155,7 @@ public:
*
* @newin{2,14}
*/
- static Glib::RefPtr<Builder> create_from_string(const Glib::ustring& buffer, const Glib::StringArrayHandle& object_ids);
+ static Glib::RefPtr<Builder> create_from_string(const Glib::ustring& buffer, const std::vector<Glib::ustring>& object_ids);
_IGNORE(gtk_builder_add_objects_from_file)
/** Parses a file containing a GtkBuilder UI definition,
@@ -168,7 +170,7 @@ public:
_WRAP_METHOD(bool add_from_file(const std::string& filename), gtk_builder_add_from_file, errthrow)
//This is just to avoid the ambiguous call when using a string literal,
- //caused by the overload that takes a StringArrayHandle.
+ //caused by the overload that takes a std::vector<Glib::ustring>.
/** Parses a file containing a GtkBuilder UI definition,
* building only the requested object,
* and merges it with the current contents of the builder.
@@ -203,11 +205,11 @@ public:
*/
bool add_from_file(const std::string& filename, const Glib::ustring& object_id);
-#m4 _CONVERSION(`const Glib::StringArrayHandle&',`gchar**',`const_cast<char**>(($3).data())')
- _WRAP_METHOD(bool add_from_file(const std::string& filename, const Glib::StringArrayHandle& object_ids), gtk_builder_add_objects_from_file, errthrow)
+#m4 _CONVERSION(`const std::vector<Glib::ustring>&',`gchar**',`const_cast<char**>(Glib::ArrayHandler<Glib::ustring>::vector_to_array ($3).data())')
+ _WRAP_METHOD(bool add_from_file(const std::string& filename, const std::vector<Glib::ustring>& object_ids), gtk_builder_add_objects_from_file, errthrow)
//This is just to avoid the ambiguous call when using a string literal,
- //caused by the overload that takes a StringArrayHandle.
+ //caused by the overload that takes a std::vector<Glib::ustring>.
/** Parses a string containing a GtkBuilder UI definition
* and merges it with the current contents of the builder.
*
@@ -256,7 +258,7 @@ public:
*
* @newin{2,14}
*/
- bool add_from_string(const Glib::ustring& buffer, const Glib::StringArrayHandle& object_ids);
+ bool add_from_string(const Glib::ustring& buffer, const std::vector<Glib::ustring>& object_ids);
_IGNORE(gtk_builder_add_objects_from_string)
/** Parses a string containing a GtkBuilder UI definition
diff --git a/gtk/src/celllayout.ccg b/gtk/src/celllayout.ccg
index 78d70fd..ee0d9e9 100644
--- a/gtk/src/celllayout.ccg
+++ b/gtk/src/celllayout.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtkmm/cellarea.h>
#include <gtk/gtk.h>
diff --git a/gtk/src/celllayout.hg b/gtk/src/celllayout.hg
index f976d41..a55aa89 100644
--- a/gtk/src/celllayout.hg
+++ b/gtk/src/celllayout.hg
@@ -17,6 +17,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <glibmm/interface.h>
//#include <gtkmm/cellarea.h>
#include <gtkmm/cellrenderer.h>
@@ -55,10 +57,10 @@ public:
_WRAP_METHOD(void pack_start(CellRenderer& cell, bool expand = true), gtk_cell_layout_pack_start)
_WRAP_METHOD(void pack_end(CellRenderer& cell, bool expand = true), gtk_cell_layout_pack_end)
- #m4 _CONVERSION(`GList*', `Glib::ListHandle<CellRenderer*>', `$2($3, Glib::OWNERSHIP_SHALLOW)')
- #m4 _CONVERSION(`GList*', `Glib::ListHandle<const CellRenderer*>', `$2($3, Glib::OWNERSHIP_SHALLOW)')
- _WRAP_METHOD(Glib::ListHandle<CellRenderer*> get_cells(), gtk_cell_layout_get_cells)
- _WRAP_METHOD(Glib::ListHandle<const CellRenderer*> get_cells() const, gtk_cell_layout_get_cells)
+#m4 _CONVERSION(`GList*', `std::vector<CellRenderer*>', `Glib::ListHandler<CellRenderer*>::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+#m4 _CONVERSION(`GList*', `std::vector<const CellRenderer*>', `Glib::ListHandler<const CellRenderer*>::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<CellRenderer*> get_cells(), gtk_cell_layout_get_cells)
+ _WRAP_METHOD(std::vector<const CellRenderer*> get_cells() const, gtk_cell_layout_get_cells)
/** Gets the CellRenderer for the column.
* You should dynamic_cast<> to the expected derived CellRenderer type.
diff --git a/gtk/src/clipboard.ccg b/gtk/src/clipboard.ccg
index 0379162..7893742 100644
--- a/gtk/src/clipboard.ccg
+++ b/gtk/src/clipboard.ccg
@@ -17,6 +17,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtkmm/textbuffer.h>
#include <gtkmm/selectiondata_private.h>
#include <glibmm/utility.h> //For ScopedPtr<>.
@@ -111,15 +113,8 @@ static void SignalProxy_TargetsReceived_gtk_callback(GtkClipboard*, GdkAtom* ato
try
{
- // TODO: This conversion should normally be performed in a custom
- // Traits implementation. Alternatively, a real container could
- // have been used as the argument instead of handle.
- const unsigned int n_names = (n_atoms > 0) ? n_atoms : 0;
- char** names = g_new(char*, n_names);
-
- std::transform(&atoms[0], &atoms[n_names], &names[0], &gdk_atom_name);
-
- (*slot)(Glib::StringArrayHandle(names, n_names, Glib::OWNERSHIP_DEEP));
+ // TODO: check if the ownership is good.
+ (*slot) (Glib::ArrayHandler<std::string, AtomStringTraits>::array_to_vector (names, n_atoms > 0 ? n_atoms : 0, Glib::OWNERSHIP_NONE));
}
catch (...)
{
@@ -169,8 +164,9 @@ static void SignalProxy_UrisReceived_gtk_callback(GtkClipboard*, gchar** uris, v
try
{
+ // TODO: check if the ownetship is good. krnowak.
//Handle: Does this take ownership? It should probalby copy. murrayc.
- (*the_slot)( Glib::StringArrayHandle(uris) );
+ (*the_slot)( Glib::ArrayHandler<Glib::ustring>::array_to_vector (uris, Glib::OWNERSHIP_NONE) );
}
catch(...)
{
@@ -200,14 +196,16 @@ static void SignalProxy_ImageReceived_gtk_callback(GtkClipboard*, GdkPixbuf* ima
namespace Gtk
{
-bool Clipboard::set(const ArrayHandle_TargetEntry& targets,
+bool Clipboard::set(const std::vector<TargetEntry>& targets,
const SlotGet& slot_get, const SlotClear& slot_clear)
{
// Create a signal proxy. A pointer to this will be passed through the callback's data parameter.
SignalProxy_GetClear *const pSignalProxy = new SignalProxy_GetClear(slot_get, slot_clear);
return gtk_clipboard_set_with_data(
- gobj(), targets.data(), targets.size(),
+ gobj(),
+ Glib::ArrayHandler<TargetEntry, TargetEntry_Traits>::vector_to_array (targets).data (),
+ targets.size(),
&SignalProxy_GetClear_gtk_callback_get,
&SignalProxy_GetClear_gtk_callback_clear,
pSignalProxy);
@@ -278,30 +276,22 @@ SelectionData Clipboard::wait_for_contents(const Glib::ustring& target) const
return SelectionData(cData, false /* take_copy */);
}
-Glib::StringArrayHandle Clipboard::wait_for_targets() const
+std::vector<std::string> Clipboard::wait_for_targets() const
{
- char** names = 0;
- GdkAtom* atoms = 0;
- int n_targets = 0;
-
- // TODO: This works, but is not the intended way to use the array handles.
- // Normally one would define custom Traits for the conversion, but that is
- // not possible here because it would break binary compatibility.
- if (gtk_clipboard_wait_for_targets(const_cast<GtkClipboard*>(gobj()), &atoms, &n_targets))
+ GdkAtom* atoms (0);
+ int n_targets (0);
+
+ if (!gtk_clipboard_wait_for_targets(const_cast<GtkClipboard*>(gobj()), &atoms, &n_targets))
{
- names = g_new(char*, n_targets);
- std::transform(&atoms[0], &atoms[n_targets], &names[0], &gdk_atom_name);
- g_free(atoms);
- }
- else
n_targets = 0;
+ }
- return Glib::StringArrayHandle(names, n_targets, Glib::OWNERSHIP_DEEP);
+ return Glib::ArrayHandler<std::string, AtomStringTraits>::array_to_vector (atoms, n_targets, Glib::OWNERSHIP_SHALLOW);
}
-void Clipboard::set_can_store(const ArrayHandle_TargetEntry& targets)
+void Clipboard::set_can_store(const std::vector<TargetEntry>& targets)
{
- gtk_clipboard_set_can_store( gobj(), targets.data(), targets.size() );
+ gtk_clipboard_set_can_store( gobj(), Glib::ArrayHandler<TargetEntry, TargetEntry_Traits>::vector_to_array (targets).data (), targets.size() );
}
void Clipboard::set_can_store()
diff --git a/gtk/src/clipboard.hg b/gtk/src/clipboard.hg
index 7d251fe..ed9dbc7 100644
--- a/gtk/src/clipboard.hg
+++ b/gtk/src/clipboard.hg
@@ -19,6 +19,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <gdkmm/display.h>
#include <gdkmm/pixbuf.h>
#include <gtkmm/targetentry.h>
@@ -93,7 +95,7 @@ public:
* the clipboard data failed then the provided callback methods
* will be ignored.
*/
- bool set(const ArrayHandle_TargetEntry& targets, const SlotGet& slot_get, const SlotClear& slot_clear);
+ bool set(const std::vector<TargetEntry>& targets, const SlotGet& slot_get, const SlotClear& slot_clear);
_IGNORE(gtk_clipboard_set_with_owner, gtk_clipboard_set_with_data)
_WRAP_METHOD(Glib::RefPtr<Glib::Object> get_owner(), gtk_clipboard_get_owner, refreturn)
@@ -176,8 +178,8 @@ public:
_IGNORE(gtk_clipboard_request_rich_text)
- /// For instance: void on_uris_received(const Glib::StringArrayHandle& uris);
- typedef sigc::slot<void, const Glib::StringArrayHandle&> SlotUrisReceived;
+ /// For instance: void on_uris_received(const std::vector<Glib::ustring>& uris);
+ typedef sigc::slot<void, const std::vector<Glib::ustring>&> SlotUrisReceived;
/** Requests the contents of the clipboard as URIs. When the URIs are
* later received @a slot will be called.
@@ -216,8 +218,8 @@ public:
void request_image(const SlotImageReceived& slot);
_IGNORE(gtk_clipboard_request_image)
- /// For instance: void on_targetsreceived(const Glib::StringArrayHandle& targets);
- typedef sigc::slot<void, const Glib::StringArrayHandle&> SlotTargetsReceived;
+ /// For instance: void on_targets_received(const std::vector<Glib::ustring>& targets);
+ typedef sigc::slot<void, const std::vector<Glib::ustring>&> SlotTargetsReceived;
/** Requests the contents of the clipboard as list of supported targets.
* When the list is later received, callback will be called.
@@ -227,9 +229,7 @@ public:
*
* @param slot a function to call when the targets are received,
* or the retrieval fails. (It will always be called
- * one way or the other.) Remember that Glib::StringArrayHandle
- * is an intermediate type, so you should convert it to a
- * standard C++ container.
+ * one way or the other.)
*
* @newin{2,4}
*/
@@ -270,10 +270,10 @@ public:
*
* @newin{2,4}
*/
- Glib::StringArrayHandle wait_for_targets() const;
+ std::vector<std::string> wait_for_targets() const;
_IGNORE(gtk_clipboard_wait_for_targets)
- _WRAP_METHOD(Glib::StringArrayHandle wait_for_uris() const, gtk_clipboard_wait_for_uris)
+ _WRAP_METHOD(std::vector<Glib::ustring> wait_for_uris() const, gtk_clipboard_wait_for_uris)
/** Hints that the clipboard data should be stored somewhere when the application exits or when store()
* is called.
@@ -283,7 +283,7 @@ public:
*
* @param targets Array containing information about which forms should be stored.
*/
- void set_can_store(const ArrayHandle_TargetEntry& targets);
+ void set_can_store(const std::vector<TargetEntry>& targets);
/** Hints that all forms of clipboard data should be stored somewhere when the application exits or when store()
* is called.
diff --git a/gtk/src/colorselection.ccg b/gtk/src/colorselection.ccg
index a4bf3c3..bb0b7b0 100644
--- a/gtk/src/colorselection.ccg
+++ b/gtk/src/colorselection.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
@@ -34,7 +36,7 @@ static void global_change_palette_hook_callback(GdkScreen* screen, const GdkColo
{
(*global_change_palette_hook)(
Glib::wrap(screen, true),
- Gdk::ArrayHandle_Color(colors, n_colors, Glib::OWNERSHIP_NONE));
+ Glib::ArrayHandler<Gdk::Color, Gdk::ColorTraits>::array_to_vector (colors, n_colors, Glib::OWNERSHIP_NONE));
}
catch(...)
{
@@ -43,12 +45,14 @@ static void global_change_palette_hook_callback(GdkScreen* screen, const GdkColo
}
static void old_change_palette_hook_callback(const Glib::RefPtr<Gdk::Screen>& screen,
- const Gdk::ArrayHandle_Color& colors,
+ const std::vector<Gdk::Color>& colors,
GtkColorSelectionChangePaletteWithScreenFunc func)
{
g_return_if_fail(func != 0);
- (*func)(Glib::unwrap(screen), colors.data(), colors.size());
+ (*func)(Glib::unwrap(screen),
+ Glib::ArrayHandler<Gdk::Color, Gdk::ColorTraits>::vector_to_array (colors).data(),
+ colors.size());
}
} // anonymous namespace
@@ -86,20 +90,20 @@ Gdk::RGBA ColorSelection::get_previous_rgba() const
}
// static
-Gdk::ArrayHandle_Color ColorSelection::palette_from_string(const Glib::ustring& str)
+std::vector<Gdk::Color> ColorSelection::palette_from_string(const Glib::ustring& str)
{
GdkColor* colors = 0;
int n_colors = 0;
gtk_color_selection_palette_from_string(str.c_str(), &colors, &n_colors);
- return Gdk::ArrayHandle_Color(colors, n_colors, Glib::OWNERSHIP_SHALLOW);
+ return Glib::ArrayHandler<Gdk::Color, Gdk::ColorTraits>::array_to_vector (colors, n_colors, Glib::OWNERSHIP_SHALLOW);
}
// static
-Glib::ustring ColorSelection::palette_to_string(const Gdk::ArrayHandle_Color& colors)
+Glib::ustring ColorSelection::palette_to_string(const std::vector<Gdk::Color>& colors)
{
- if(char *const str = gtk_color_selection_palette_to_string(colors.data(), colors.size()))
+ 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());
else
return Glib::ustring();
diff --git a/gtk/src/colorselection.hg b/gtk/src/colorselection.hg
index 5f19577..a73507e 100644
--- a/gtk/src/colorselection.hg
+++ b/gtk/src/colorselection.hg
@@ -21,6 +21,8 @@ _DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/box_p.h)
_PINCLUDE(gtkmm/private/dialog_p.h)
+#include <vector>
+
#include <gtkmm/box.h>
#include <gtkmm/dialog.h>
#include <gtkmm/button.h>
@@ -69,11 +71,11 @@ public:
_WRAP_METHOD(bool is_adjusting() const, gtk_color_selection_is_adjusting)
- static Gdk::ArrayHandle_Color palette_from_string(const Glib::ustring& str);
- static Glib::ustring palette_to_string(const Gdk::ArrayHandle_Color& colors);
+ static std::vector<Gdk::Color> palette_from_string(const Glib::ustring& str);
+ static Glib::ustring palette_to_string(const std::vector<Gdk::Color>& colors);
typedef sigc::slot<void, const Glib::RefPtr<Gdk::Screen>&,
- const Gdk::ArrayHandle_Color&> SlotChangePaletteHook;
+ const std::vector<Gdk::Color>&> SlotChangePaletteHook;
static SlotChangePaletteHook set_change_palette_hook(const SlotChangePaletteHook& slot);
diff --git a/gtk/src/container.ccg b/gtk/src/container.ccg
index b864ab9..95b3cb0 100644
--- a/gtk/src/container.ccg
+++ b/gtk/src/container.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtkmm/adjustment.h>
#include <gtk/gtk.h>
@@ -177,20 +179,20 @@ bool Container::has_focus_chain() const
return gtk_container_get_focus_chain(const_cast<GtkContainer*>(gobj()), 0);
}
-Glib::ListHandle<Widget*> Container::get_focus_chain()
+std::vector<Widget*> Container::get_focus_chain()
{
GList* list = 0;
gtk_container_get_focus_chain(gobj(), &list);
- return Glib::ListHandle<Widget*>(list, Glib::OWNERSHIP_SHALLOW);
+ return Glib::ListHandler<Widget*>::list_to_vector (list, Glib::OWNERSHIP_SHALLOW);
}
-Glib::ListHandle<const Widget*> Container::get_focus_chain() const
+std::vector<const Widget*> Container::get_focus_chain() const
{
GList* list = 0;
gtk_container_get_focus_chain(const_cast<GtkContainer*>(gobj()), &list);
- return Glib::ListHandle<const Widget*>(list, Glib::OWNERSHIP_SHALLOW);
+ return Glib::ListHandler<const Widget*>::list_to_vector (list, Glib::OWNERSHIP_SHALLOW);
}
diff --git a/gtk/src/container.hg b/gtk/src/container.hg
index feb8a04..242b032 100644
--- a/gtk/src/container.hg
+++ b/gtk/src/container.hg
@@ -17,7 +17,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <glibmm/listhandle.h>
+#include <vector>
+
#include <gtkmm/widget.h>
_DEFS(gtkmm,gtk)
@@ -106,20 +107,23 @@ public:
/// (internal) Operate on contained items (see foreach())
//_WRAP_METHOD(void foreach_full_(GtkCallback callback,GtkCallbackMarshal marshal, gpointer data,GDestroyNotify notify),gtk_container_foreach_full)
- _WRAP_METHOD(Glib::ListHandle<Widget*> get_children(), gtk_container_get_children)
- _WRAP_METHOD(Glib::ListHandle<const Widget*> get_children() const, gtk_container_get_children)
+#m4 _CONVERSION(`GList*',`std::vector<Widget*>',`Glib::ListHandler<Widget*>::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<Widget*> get_children(), gtk_container_get_children)
+#m4 _CONVERSION(`GList*',`std::vector<const Widget*>',`Glib::ListHandler<Widget*>::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<const Widget*> get_children() const, gtk_container_get_children)
//TODO: See https://bugzilla.gnome.org/show_bug.cgi?id=630800
//_WRAP_METHOD(void propagate_expose(Widget& child, GdkEventExpose* event), gtk_container_propagate_expose)
- _WRAP_METHOD(void set_focus_chain(const Glib::ListHandle<Widget*>& focusable_widgets),
+#m4 _CONVERSION(`const std::vector<Widget*>&',`GList*',`Glib::ListHandler<Widget*>::vector_to_list($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(void set_focus_chain(const std::vector<Widget*>& focusable_widgets),
gtk_container_set_focus_chain)
// gtk_container_get_focus_chain() has been split up into two
// functions in order to make implicit container conversion possible.
bool has_focus_chain() const;
- Glib::ListHandle<Widget*> get_focus_chain();
- Glib::ListHandle<const Widget*> get_focus_chain() const;
+ std::vector<Widget*> get_focus_chain();
+ std::vector<const Widget*> get_focus_chain() const;
_WRAP_METHOD(void unset_focus_chain(), gtk_container_unset_focus_chain)
diff --git a/gtk/src/dialog.ccg b/gtk/src/dialog.ccg
index a3c5b2e..d8dd68c 100644
--- a/gtk/src/dialog.ccg
+++ b/gtk/src/dialog.ccg
@@ -38,9 +38,9 @@ Dialog::Dialog(const Glib::ustring& title, bool modal)
set_modal(modal);
}
-void Dialog::set_alternative_button_order_from_array(const Glib::ArrayHandle<int>& new_order)
+void Dialog::set_alternative_button_order_from_array(const std::vector<int>& new_order)
{
- gtk_dialog_set_alternative_button_order_from_array(gobj(), new_order.size(), const_cast<int*>(new_order.data()));
+ gtk_dialog_set_alternative_button_order_from_array(gobj(), new_order.size(), const_cast<int*>(Glib::ArrayHandler<int>::vector_to_array (new_order).data()));
}
} // namespace Gtk
diff --git a/gtk/src/dialog.hg b/gtk/src/dialog.hg
index 8e8b14e..4732b81 100644
--- a/gtk/src/dialog.hg
+++ b/gtk/src/dialog.hg
@@ -19,6 +19,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <gtkmm/window.h>
#include <gtkmm/box.h>
#include <gtkmm/button.h>
@@ -103,7 +105,7 @@ public:
*
* @newinp26
*/
- void set_alternative_button_order_from_array(const Glib::ArrayHandle<int>& new_order);
+ void set_alternative_button_order_from_array(const std::vector<int>& new_order);
_IGNORE(gtk_dialog_set_alternative_button_order_from_array, gtk_dialog_set_alternative_button_order)
_WRAP_METHOD(void response(int response_id), gtk_dialog_response)
diff --git a/gtk/src/enums.hg b/gtk/src/enums.hg
index 0a05f12..53de901 100644
--- a/gtk/src/enums.hg
+++ b/gtk/src/enums.hg
@@ -205,6 +205,21 @@ public:
static Glib::ustring get_name(IconSize size);
};
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+struct IconSizeTraits
+{
+ typedef Gtk::IconSize CppType;
+ typedef const GtkIconSize CType;
+ typedef GtkIconSize CTypeNonConst;
+
+ static CType to_c_type (CType c_obj) { return c_obj; }
+ static void release_c_type (CType) {}
+ static CType to_c_type (const CppType& cpp_obj) { return cpp_obj; }
+ static CppType to_cpp_type (CType c_obj) { return CppType (c_obj); }
+};
+#endif //DOXYGEN_SHOULD_SKIP_THIS
+
} // namespace Gtk
diff --git a/gtk/src/filechooser.ccg b/gtk/src/filechooser.ccg
index bba54ce..483654f 100644
--- a/gtk/src/filechooser.ccg
+++ b/gtk/src/filechooser.ccg
@@ -18,5 +18,7 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
//#include <gtk/gtkfilesystem.h> //We include this semi-private header just to get GTK_FILE_SYSTEM_ERROR.
diff --git a/gtk/src/filechooser.hg b/gtk/src/filechooser.hg
index b18d435..9636c92 100644
--- a/gtk/src/filechooser.hg
+++ b/gtk/src/filechooser.hg
@@ -17,6 +17,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <gtkmm/widget.h>
#include <gtkmm/filefilter.h>
#include <giomm/file.h>
@@ -89,8 +91,8 @@ public:
_WRAP_METHOD(void select_all(), gtk_file_chooser_select_all)
_WRAP_METHOD(void unselect_all(), gtk_file_chooser_unselect_all)
-#m4 _CONVERSION(`GSList*',`Glib::SListHandle<std::string>',__FL2H_DEEP)
- _WRAP_METHOD(Glib::SListHandle<std::string> get_filenames() const, gtk_file_chooser_get_filenames)
+#m4 _CONVERSION(`GSList*',`std::vector<std::string>',`Glib::SListHandler<std::string>::slist_to_vector ($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector<std::string> get_filenames() const, gtk_file_chooser_get_filenames)
_WRAP_METHOD(bool set_current_folder(const std::string& filename), gtk_file_chooser_set_current_folder)
_WRAP_METHOD(std::string get_current_folder() const, gtk_file_chooser_get_current_folder)
@@ -102,7 +104,8 @@ public:
_WRAP_METHOD(bool set_uri(const Glib::ustring& uri), gtk_file_chooser_set_uri)
_WRAP_METHOD(bool select_uri(const Glib::ustring& uri), gtk_file_chooser_select_uri)
_WRAP_METHOD(void unselect_uri(const Glib::ustring& uri), gtk_file_chooser_unselect_uri)
- _WRAP_METHOD(Glib::SListHandle<Glib::ustring> get_uris() const, gtk_file_chooser_get_uris)
+#m4 _CONVERSION(`GSList*',`std::vector<Glib::ustring>',`Glib::SListHandler<Glib::ustring>::slist_to_vector ($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector<Glib::ustring> get_uris() const, gtk_file_chooser_get_uris)
_WRAP_METHOD(bool set_current_folder_uri(const Glib::ustring& uri), gtk_file_chooser_set_current_folder_uri)
_WRAP_METHOD(Glib::ustring get_current_folder_uri() const, gtk_file_chooser_get_current_folder_uri)
@@ -112,8 +115,8 @@ public:
_WRAP_METHOD(bool select_file(const Glib::RefPtr<const Gio::File>& file), gtk_file_chooser_select_file, errthrow)
_WRAP_METHOD(void unselect_file(const Glib::RefPtr<const Gio::File>& file), gtk_file_chooser_unselect_file)
-#m4 _CONVERSION(`GSList*',`Glib::SListHandle< Glib::RefPtr<Gio::File> >',`Glib::SListHandle< Glib::RefPtr<Gio::File> >($3, Glib::OWNERSHIP_DEEP)')
- _WRAP_METHOD(Glib::SListHandle< Glib::RefPtr<Gio::File> > get_files(), gtk_file_chooser_get_files)
+#m4 _CONVERSION(`GSList*',`std::vector< Glib::RefPtr<Gio::File> >',`Glib::SListHandler< Glib::RefPtr<Gio::File> >::slist_to_vector ($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<Gio::File> > get_files(), gtk_file_chooser_get_files)
_WRAP_METHOD(bool set_current_folder_file(const Glib::RefPtr<const Gio::File>& file), gtk_file_chooser_set_current_folder_file, errthrow)
@@ -156,10 +159,10 @@ public:
_WRAP_METHOD(void add_filter(const Glib::RefPtr<FileFilter>& filter), gtk_file_chooser_add_filter)
_WRAP_METHOD(void remove_filter (const Glib::RefPtr<FileFilter>& filter), gtk_file_chooser_remove_filter)
-_CONVERSION(`GSList*',`Glib::SListHandle< Glib::RefPtr<FileFilter> >',__FL2H_SHALLOW)
-_CONVERSION(`GSList*',`Glib::SListHandle< Glib::RefPtr<const FileFilter> >',__FL2H_SHALLOW)
- _WRAP_METHOD(Glib::SListHandle< Glib::RefPtr<FileFilter> > list_filters(), gtk_file_chooser_list_filters)
- _WRAP_METHOD(Glib::SListHandle< Glib::RefPtr<const FileFilter> > list_filters() const, gtk_file_chooser_list_filters)
+_CONVERSION(`GSList*',`std::vector< Glib::RefPtr<FileFilter> >',`Glib::SListHandler< Glib::RefPtr<FileFilter> >::slist_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+_CONVERSION(`GSList*',`std::vector< Glib::RefPtr<const FileFilter> >',`Glib::SListHandler< Glib::RefPtr<const FileFilter> >::slist_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<FileFilter> > list_filters(), gtk_file_chooser_list_filters)
+ _WRAP_METHOD(std::vector< Glib::RefPtr<const FileFilter> > list_filters() const, gtk_file_chooser_list_filters)
/* Current filter
*/
@@ -172,11 +175,11 @@ _CONVERSION(`GSList*',`Glib::SListHandle< Glib::RefPtr<const FileFilter> >',__FL
_WRAP_METHOD(bool add_shortcut_folder(const std::string& folder), gtk_file_chooser_add_shortcut_folder, errthrow)
_WRAP_METHOD(bool remove_shortcut_folder(const std::string& folder), gtk_file_chooser_remove_shortcut_folder, errthrow)
- _WRAP_METHOD(Glib::SListHandle<std::string> list_shortcut_folders() const, gtk_file_chooser_list_shortcut_folders)
+ _WRAP_METHOD(std::vector<std::string> list_shortcut_folders() const, gtk_file_chooser_list_shortcut_folders)
_WRAP_METHOD(bool add_shortcut_folder_uri(const Glib::ustring& uri), gtk_file_chooser_add_shortcut_folder_uri, errthrow)
_WRAP_METHOD(bool remove_shortcut_folder_uri(const Glib::ustring& uri), gtk_file_chooser_remove_shortcut_folder_uri, errthrow)
- _WRAP_METHOD(Glib::SListHandle<Glib::ustring> list_shortcut_folder_uris() const, gtk_file_chooser_list_shortcut_folder_uris)
+ _WRAP_METHOD(std::vector<Glib::ustring> list_shortcut_folder_uris() const, gtk_file_chooser_list_shortcut_folder_uris)
/** This signal is emitted when the current folder in a FileChooser
diff --git a/gtk/src/iconinfo.ccg b/gtk/src/iconinfo.ccg
index 7b19759..f791595 100644
--- a/gtk/src/iconinfo.ccg
+++ b/gtk/src/iconinfo.ccg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
#include <gtkmm/icontheme.h>
@@ -26,19 +28,17 @@ IconInfo::IconInfo(const Glib::RefPtr<IconTheme>& icon_theme, const Glib::RefPtr
{
}
-bool IconInfo::get_attach_points(Glib::ArrayHandle<Gdk::Point>& /* points */) const
+std::vector<Gdk::Point> IconInfo::get_attach_points() const
{
GdkPoint* c_attach_points = 0;
gint n_points = 0;
- bool result = gtk_icon_info_get_attach_points (const_cast<GtkIconInfo*>(gobj()), &c_attach_points, &n_points);
+ gtk_icon_info_get_attach_points (const_cast<GtkIconInfo*>(gobj()), &c_attach_points, &n_points);
- if(c_attach_points)
+ if (c_attach_points)
{
- //TODO: We can't use = with an ArrayHandle.
- //Investigate whether the bool return value has a special meaning - maybe we can just return an empty ArrayHandle.
- //points = Glib::ArrayHandle<Gdk::Point>(reinterpret_cast<Gdk::Point*>(c_attach_points), (size_t)n_points, Glib::OWNERSHIP_SHALLOW); //We use OWNERSHIP_SHALLOW because we just need to g_free() the array and nothing more.
+ return Glib::ArrayHandler<Gdk::Point, Gdk::PointTraits>::array_to_vector (c_attach_points, n_points, Glib::OWNERSHIP_DEEP);
}
- return result;
+ return std::vector<Gdk::Point> ();
}
IconInfo::operator bool() const
diff --git a/gtk/src/iconinfo.hg b/gtk/src/iconinfo.hg
index 38af9cc..d2c873d 100644
--- a/gtk/src/iconinfo.hg
+++ b/gtk/src/iconinfo.hg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <gtkmm/stylecontext.h>
#include <gdkmm/rectangle.h>
#include <gdkmm/pixbuf.h>
@@ -62,7 +64,7 @@ public:
_WRAP_METHOD(bool get_embedded_rect(Gdk::Rectangle& rectangle) const, gtk_icon_info_get_embedded_rect)
//TODO: Documentation.
- bool get_attach_points(Glib::ArrayHandle<Gdk::Point>& points) const;
+ std::vector<Gdk::Point> get_attach_points() const;
_WRAP_METHOD(Glib::ustring get_display_name() const, gtk_icon_info_get_display_name)
};
diff --git a/gtk/src/iconset.ccg b/gtk/src/iconset.ccg
index d597c6b..1966067 100644
--- a/gtk/src/iconset.ccg
+++ b/gtk/src/iconset.ccg
@@ -31,13 +31,13 @@ IconSet::IconSet(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
gobject_ = gtk_icon_set_new_from_pixbuf(Glib::unwrap(pixbuf));
}
-Glib::ArrayHandle<IconSize> IconSet::get_sizes() const
+std::vector<IconSize> IconSet::get_sizes() const
{
GtkIconSize* pSizes = 0;
int n_sizes = 0;
gtk_icon_set_get_sizes(const_cast<GtkIconSet*>(gobj()), &pSizes, &n_sizes);
- return Glib::ArrayHandle<IconSize>((IconSize*) pSizes, n_sizes, Glib::OWNERSHIP_SHALLOW);
+ return Glib::ArrayHandler<IconSize, IconSizeTraits>(pSizes, n_sizes, Glib::OWNERSHIP_SHALLOW);
}
IconSet IconSet::lookup_default(const Gtk::StockID& stock_id) //static
diff --git a/gtk/src/iconset.hg b/gtk/src/iconset.hg
index d11749b..2059e34 100644
--- a/gtk/src/iconset.hg
+++ b/gtk/src/iconset.hg
@@ -55,7 +55,7 @@ public:
_WRAP_METHOD(void add_source(const IconSource& source), gtk_icon_set_add_source)
- Glib::ArrayHandle<IconSize> get_sizes() const;
+ std::vector<IconSize> get_sizes() const;
/** Looks for an icon in the list of default icon factories.
* @param stock_id StockID to search for
diff --git a/gtk/src/icontheme.ccg b/gtk/src/icontheme.ccg
index 01d602d..3499060 100644
--- a/gtk/src/icontheme.ccg
+++ b/gtk/src/icontheme.ccg
@@ -15,36 +15,38 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h> //For gtk_icon_theme_error_get_type().
namespace Gtk
{
-void IconTheme::set_search_path(const Glib::ArrayHandle<Glib::ustring>& path)
+void IconTheme::set_search_path(const std::vector<std::string>& path)
{
- gtk_icon_theme_set_search_path(gobj(), const_cast<const char**>(path.data()), path.size());
+ gtk_icon_theme_set_search_path(gobj(), const_cast<const char**>(Glib::ArrayHandler<std::string>::vector_to_array (path).data ()), path.size());
}
-Glib::ArrayHandle<Glib::ustring> IconTheme::get_search_path() const
+Glib::ArrayHandle<std::string> IconTheme::get_search_path() const
{
int temp_int = 0;
gchar** temp_path = 0;
gtk_icon_theme_get_search_path(const_cast<GtkIconTheme*>(gobj()), &temp_path, &temp_int);
- return Glib::ArrayHandle<Glib::ustring>((const char**) temp_path, temp_int, Glib::OWNERSHIP_DEEP);
+ return Glib::ArrayHandler<std::string>::array_to_vector (temp_path, temp_int, Glib::OWNERSHIP_DEEP);
}
-Glib::ArrayHandle<int> IconTheme::get_icon_sizes(const Glib::ustring& icon_name) const
+std::vector<int> IconTheme::get_icon_sizes(const Glib::ustring& icon_name) const
{
int* pArrayInts = gtk_icon_theme_get_icon_sizes(const_cast<GtkIconTheme*>(gobj()), icon_name.c_str());
//pArrayInts is null-terminated.
- return Glib::ArrayHandle<int>(pArrayInts, Glib::OWNERSHIP_SHALLOW);
+ return Glib::ArrayHandler<int>::array_to_vector(pArrayInts, Glib::OWNERSHIP_SHALLOW);
}
-Glib::ListHandle<Glib::ustring> IconTheme::list_icons() const
+std::vector<Glib::ustring> IconTheme::list_icons() const
{
- return Glib::ListHandle<Glib::ustring>(gtk_icon_theme_list_icons(const_cast<GtkIconTheme*>(gobj()), 0 /* means all icons according to the C documentation. */ ), Glib::OWNERSHIP_SHALLOW);
+ return Glib::ListHandler<Glib::ustring>::array_to_vector (gtk_icon_theme_list_icons(const_cast<GtkIconTheme*>(gobj()), 0 /* means all icons according to the C documentation. */ ), Glib::OWNERSHIP_SHALLOW);
}
diff --git a/gtk/src/icontheme.hg b/gtk/src/icontheme.hg
index 2da19a7..26794ce 100644
--- a/gtk/src/icontheme.hg
+++ b/gtk/src/icontheme.hg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <gdkmm/pixbuf.h>
#include <gdkmm/screen.h>
@@ -47,14 +49,14 @@ public:
_WRAP_METHOD(static Glib::RefPtr<IconTheme> get_default(), gtk_icon_theme_get_default, refreturn)
_WRAP_METHOD(static Glib::RefPtr<IconTheme> get_for_screen(const Glib::RefPtr<Gdk::Screen>& screen), gtk_icon_theme_get_for_screen, refreturn)
_WRAP_METHOD(void set_screen(const Glib::RefPtr<Gdk::Screen>& screen), gtk_icon_theme_set_screen)
- void set_search_path(const Glib::ArrayHandle<Glib::ustring>& path);
- Glib::ArrayHandle<Glib::ustring> get_search_path() const;
+ void set_search_path(const std::vector<std::string>& path);
+ std::vector<std::string> get_search_path() const;
_WRAP_METHOD(void append_search_path(const Glib::ustring& path), gtk_icon_theme_append_search_path)
_WRAP_METHOD(void prepend_search_path(const Glib::ustring& path), gtk_icon_theme_prepend_search_path)
_WRAP_METHOD(void set_custom_theme(const Glib::ustring& theme_name), gtk_icon_theme_set_custom_theme)
_WRAP_METHOD(bool has_icon(const Glib::ustring& icon_name) const, gtk_icon_theme_has_icon)
- Glib::ArrayHandle<int> get_icon_sizes(const Glib::ustring& icon_name) const;
+ std::vector<int> get_icon_sizes(const Glib::ustring& icon_name) const;
_IGNORE(gtk_icon_theme_get_icon_sizes)
_WRAP_METHOD(IconInfo lookup_icon(const Glib::ustring& icon_name, int size, IconLookupFlags flags) const, gtk_icon_theme_lookup_icon)
@@ -62,13 +64,13 @@ public:
_WRAP_METHOD(IconInfo lookup_icon(const Glib::RefPtr<const Gio::Icon>& icon, int size, IconLookupFlags flags) const, gtk_icon_theme_lookup_by_gicon)
- #m4 _CONVERSION(`const Glib::StringArrayHandle&',`const gchar*[]',`const_cast<const gchar**>(($3).data())')
- _WRAP_METHOD(IconInfo choose_icon(const Glib::StringArrayHandle& icon_names, int size, IconLookupFlags flags), gtk_icon_theme_choose_icon)
+ #m4 _CONVERSION(`const std::vector<Glib::ustring>&',`const gchar*[]',`const_cast<const gchar**>(Glib::ArrayHandler<Glib::ustring>::vector_to_array ($3).data ())')
+ _WRAP_METHOD(IconInfo choose_icon(const std::vector<Glib::ustring>& icon_names, int size, IconLookupFlags flags), gtk_icon_theme_choose_icon)
_WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> load_icon(const Glib::ustring& icon_name, int size, IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_load_icon, errthrow)
-
- _WRAP_METHOD(Glib::ListHandle<Glib::ustring> list_icons(const Glib::ustring& context) const, gtk_icon_theme_list_icons)
+#m4 _CONVERSION(`GList*',`std::vector<Glib::ustring>',`Glib::ListHandle<Glib::ustring>::list_to_vector ($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector<Glib::ustring> list_icons(const Glib::ustring& context) const, gtk_icon_theme_list_icons)
/** Lists the icons in the current icon theme.
*
@@ -77,9 +79,9 @@ public:
*
* @newin{2,10}.
*/
- Glib::ListHandle<Glib::ustring> list_icons() const;
+ std::vector<Glib::ustring> list_icons() const;
- _WRAP_METHOD(Glib::ListHandle<Glib::ustring> list_contexts() const, gtk_icon_theme_list_contexts)
+ _WRAP_METHOD(std::vector<Glib::ustring> list_contexts() const, gtk_icon_theme_list_contexts)
_WRAP_METHOD(Glib::ustring get_example_icon_name() const, gtk_icon_theme_get_example_icon_name)
_WRAP_METHOD(bool rescan_if_needed(), gtk_icon_theme_rescan_if_needed)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]