[gtkmm] Fixed compilation errors introduced in previous changes.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Fixed compilation errors introduced in previous changes.
- Date: Thu, 27 Jan 2011 22:59:49 +0000 (UTC)
commit 28066532f60c3a15276e58bcf71e1c5918e96540
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Thu Jan 27 23:58:46 2011 +0100
Fixed compilation errors introduced in previous changes.
* gdk/src/types.ccg:
* gdk/src/types.hg: Added traits for Glib::ustring GdkAtoms.
* gdk/src/display.ccg:
* gdk/src/window.ccg: Use new traits.
* gtk/src/textbuffer.ccg: Ditto. And remove the bogus word.
ChangeLog | 10 ++++++++++
gdk/src/display.ccg | 8 ++++----
gdk/src/types.ccg | 15 +++++++++++++++
gdk/src/types.hg | 17 +++++++++++++++++
gdk/src/window.ccg | 2 +-
gtk/src/textbuffer.ccg | 6 +++---
6 files changed, 50 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a886cf5..4f06115 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2011-01-27 Krzesimir Nowak <qdlacz gmail com>
+ Fixed compilation errors introduced in previous changes.
+
+ * gdk/src/types.ccg:
+ * gdk/src/types.hg: Added traits for Glib::ustring GdkAtoms.
+ * gdk/src/display.ccg:
+ * gdk/src/window.ccg: Use new traits.
+ * gtk/src/textbuffer.ccg: Ditto. And remove the bogus word.
+
+2011-01-27 Krzesimir Nowak <qdlacz gmail com>
+
Adapted Gdk and Gtk to vectorutils.
* gdk/gdkmm/list.h: Deleted.
diff --git a/gdk/src/display.ccg b/gdk/src/display.ccg
index 56d7584..6078d51 100644
--- a/gdk/src/display.ccg
+++ b/gdk/src/display.ccg
@@ -31,17 +31,17 @@ namespace Gdk
bool Display::set_selection_owner(const Glib::RefPtr<Window>& owner, Glib::ustring& selection, guint32 time_, bool send_event)
{
- return gdk_selection_owner_set_for_display(gobj(), owner->gobj(), Gdk::AtomString::to_c_type(selection), time_, (gboolean)send_event);
+ return gdk_selection_owner_set_for_display(gobj(), owner->gobj(), Gdk::AtomUstring::to_c_type(selection), time_, (gboolean)send_event);
}
Glib::RefPtr<Window> Display::get_selection_owner(const Glib::ustring& selection)
{
- return Glib::wrap(gdk_selection_owner_get_for_display(gobj(), Gdk::AtomString::to_c_type(selection)) , true);
+ return Glib::wrap(gdk_selection_owner_get_for_display(gobj(), Gdk::AtomUstring::to_c_type(selection)) , true);
}
void Display::selection_send_notify(GdkNativeWindow requestor, Glib::ustring& selection, Glib::ustring& target, Glib::ustring& property, guint32 time_)
{
- gdk_selection_send_notify_for_display(gobj(), requestor, Gdk::AtomString::to_c_type(selection), Gdk::AtomString::to_c_type(target), Gdk::AtomString::to_c_type(property), time_);
+ gdk_selection_send_notify_for_display(gobj(), requestor, Gdk::AtomUstring::to_c_type(selection), Gdk::AtomUstring::to_c_type(target), Gdk::AtomUstring::to_c_type(property), time_);
}
void Display::store_clipboard(const Glib::RefPtr<Gdk::Window>& clipboard_window, guint32 time_)
@@ -56,7 +56,7 @@ void Display::store_clipboard(const Glib::RefPtr<Gdk::Window>& clipboard_window,
gdk_display_store_clipboard(gobj(),
Glib::unwrap (clipboard_window),
time_,
- Glib::ArrayHandler<Glib::ustring, AtomStringTraits>::vector_to_array(targets).data (),
+ Glib::ArrayHandler<Glib::ustring, AtomUstringTraits>::vector_to_array(targets).data (),
targets.size ());
}
}
diff --git a/gdk/src/types.ccg b/gdk/src/types.ccg
index a5a28e4..bb40949 100644
--- a/gdk/src/types.ccg
+++ b/gdk/src/types.ccg
@@ -53,6 +53,21 @@ std::string AtomStringTraits::to_cpp_type(GdkAtom atom)
return std::string();
}
+// static
+GdkAtom AtomUstringTraits::to_c_type(const Glib::ustring& atom_name)
+{
+ return gdk_atom_intern(atom_name.c_str(), 0);
+}
+
+// static
+Glib::ustring AtomUstringTraits::to_cpp_type(GdkAtom atom)
+{
+ if(char *const atom_name = gdk_atom_name(atom))
+ return Glib::ustring(Glib::ScopedPtr<char>(atom_name).get());
+ else
+ return Glib::ustring();
+}
+
} // namespace Gdk
diff --git a/gdk/src/types.hg b/gdk/src/types.hg
index 4e3cfff..632535b 100644
--- a/gdk/src/types.hg
+++ b/gdk/src/types.hg
@@ -131,6 +131,23 @@ struct AtomStringTraits
// we don't want it to look like we're calling a template trait, but
// a utility function. -Bryan
typedef AtomStringTraits AtomString;
+
+struct AtomUstringTraits
+{
+ typedef Glib::ustring CppType;
+ typedef GdkAtom CType;
+ typedef GdkAtom CTypeNonConst;
+
+ static GdkAtom to_c_type(GdkAtom atom) { return atom; }
+ static void release_c_type(GdkAtom) {}
+
+ // These aren't worth to be inlined since doing so
+ // would expose way too much of the implementation.
+ static GdkAtom to_c_type (const Glib::ustring& atom_name);
+ static Glib::ustring to_cpp_type(GdkAtom atom);
+};
+
+typedef AtomUstringTraits AtomUstring;
#endif //DOXYGEN_SHOULD_SKIP_THIS
} // namespace Gdk
diff --git a/gdk/src/window.ccg b/gdk/src/window.ccg
index 535b50e..4abfa80 100644
--- a/gdk/src/window.ccg
+++ b/gdk/src/window.ccg
@@ -61,7 +61,7 @@ void Window::restack(bool above)
Glib::RefPtr<DragContext> Window::drag_begin (const std::vector<Glib::ustring>& targets)
{
- return Glib::wrap (gdk_drag_begin (gobj (), Glib::ListHandler<Glib::ustring, AtomStringTraits>::vector_to_list(targets).data ()), true);
+ return Glib::wrap (gdk_drag_begin (gobj (), Glib::ListHandler<Glib::ustring, AtomUstringTraits>::vector_to_list(targets).data ()), true);
}
diff --git a/gtk/src/textbuffer.ccg b/gtk/src/textbuffer.ccg
index 0534f5e..d32b8d6 100644
--- a/gtk/src/textbuffer.ccg
+++ b/gtk/src/textbuffer.ccg
@@ -1,4 +1,4 @@
-Atom// -*- c++ -*-
+// -*- c++ -*-
/* $Id: textbuffer.ccg,v 1.8 2006/11/20 09:19:49 murrayc Exp $ */
/* Copyright(C) 1998-2002 The gtkmm Development Team
@@ -503,14 +503,14 @@ std::vector<Glib::ustring> TextBuffer::get_serialize_formats() const
{
int n_atoms = 0;
GdkAtom* atoms = gtk_text_buffer_get_serialize_formats(const_cast<GtkTextBuffer*>(gobj()), &n_atoms);
- return Glib::ArrayHandler<Glib::ustring, Gdk::AtomStringTraits>::array_to_vector(atoms, n_atoms, Glib::OWNERSHIP_SHALLOW);
+ return Glib::ArrayHandler<Glib::ustring, Gdk::AtomUstringTraits>::array_to_vector(atoms, n_atoms, Glib::OWNERSHIP_SHALLOW);
}
std::vector<Glib::ustring> TextBuffer::get_deserialize_formats() const
{
int n_atoms = 0;
GdkAtom* atoms = gtk_text_buffer_get_deserialize_formats(const_cast<GtkTextBuffer*>(gobj()), &n_atoms);
- return Glib::ArrayHandler<Glib::ustring, Gdk::AtomStringTraits>::array_to_vector(atoms, n_atoms, Glib::OWNERSHIP_SHALLOW);
+ return Glib::ArrayHandler<Glib::ustring, Gdk::AtomUstringTraits>::array_to_vector(atoms, n_atoms, Glib::OWNERSHIP_SHALLOW);
}
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]