[gtkmm] Move signal-only conversions into the .hg files.



commit c6a8e80787f287d846b53ad9a4f4267a62a647a7
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Sep 25 12:22:42 2013 +0200

    Move signal-only conversions into the .hg files.
    
    * tool/m4/convert_gtk.m4: Conversions from GtkSomething* to
      const RefPtr<>& are for signals only and should be written
      for each use, so we always get the correct reference-counting.
    * gtk/src/*.hg: Move them here instead.

 gtk/src/accelgroup.hg   |    2 +-
 gtk/src/actiongroup.hg  |    1 +
 gtk/src/activatable.hg  |    2 ++
 gtk/src/statusicon.hg   |    2 ++
 gtk/src/textbuffer.hg   |    6 ++++++
 gtk/src/texttag.hg      |    1 +
 gtk/src/texttagtable.hg |    2 ++
 gtk/src/uimanager.hg    |    2 ++
 gtk/src/widget.hg       |    2 ++
 tools/m4/convert_gtk.m4 |   12 ------------
 10 files changed, 19 insertions(+), 13 deletions(-)
---
diff --git a/gtk/src/accelgroup.hg b/gtk/src/accelgroup.hg
index 2c86b9b..66ce86c 100644
--- a/gtk/src/accelgroup.hg
+++ b/gtk/src/accelgroup.hg
@@ -110,7 +110,7 @@ public:
 
   //TODO: _WRAP_METHOD(static bool activate(Object& object, guint accel_key, Gdk::ModifierType accel_mods), 
gtk_accel_groups_activate)
 
-
+#m4 _CONVERSION(`GObject*',`const Glib::RefPtr<Glib::Object>&',`Glib::wrap($3, true)')
   _WRAP_SIGNAL(bool accel_activate(const Glib::RefPtr<Glib::Object>& acceleratable, guint keyval, 
Gdk::ModifierType modifier), "accel_activate", no_default_handler)
 
   //TODO: The C type is unpleasant:
diff --git a/gtk/src/actiongroup.hg b/gtk/src/actiongroup.hg
index 5cb8c0c..54fef95 100644
--- a/gtk/src/actiongroup.hg
+++ b/gtk/src/actiongroup.hg
@@ -97,6 +97,7 @@ public:
   //These are also just C convenience methods that are useless unless you are using the other convenience 
methods:
   _IGNORE(gtk_action_group_set_translate_func, gtk_action_group_set_translation_domain)
 
+#m4 _CONVERSION(`GtkAction*',`const Glib::RefPtr<Action>&',`Glib::wrap($3, true)')
   _WRAP_SIGNAL(void connect_proxy(const Glib::RefPtr<Action>& action, Widget* proxy), "connect_proxy", 
no_default_handler)
   _WRAP_SIGNAL(void disconnect_proxy(const Glib::RefPtr<Action>& action, Widget* proxy), "disconnect_proxy", 
no_default_handler)
   _WRAP_SIGNAL(void pre_activate(const Glib::RefPtr<Action>& action), "pre_activate", no_default_handler)
diff --git a/gtk/src/activatable.hg b/gtk/src/activatable.hg
index 6464b10..3d3e747 100644
--- a/gtk/src/activatable.hg
+++ b/gtk/src/activatable.hg
@@ -62,9 +62,11 @@ public:
   _WRAP_PROPERTY("use-action-appearance", bool, deprecated "See the description of class Activatable.")
 
 #m4 _CONVERSION(`const char*',`const Glib::ustring&',__GCHARP_TO_USTRING)
+#m4 _CONVERSION(`GtkAction*',`const Glib::RefPtr<Action>&',`Glib::wrap($3, true)')
   /** @deprecated See the description of class Activatable.
    */
   _WRAP_VFUNC(void update(const Glib::RefPtr<Action>& action, const Glib::ustring& property_name), update)
+
   /** @deprecated See the description of class Activatable.
    */
   _WRAP_VFUNC(void sync_action_properties(const Glib::RefPtr<Action>& action), sync_action_properties)
diff --git a/gtk/src/statusicon.hg b/gtk/src/statusicon.hg
index 8a048b2..aee6a14 100644
--- a/gtk/src/statusicon.hg
+++ b/gtk/src/statusicon.hg
@@ -207,6 +207,8 @@ public:
   _WRAP_SIGNAL(bool button_press_event(GdkEventButton* event), button_press_event)
   _WRAP_SIGNAL(bool button_release_event(GdkEventButton* event), button_release_event)
   _WRAP_SIGNAL(bool scroll_event(GdkEventScroll* event), scroll_event)
+
+#m4 _CONVERSION(`GtkTooltip*',`const Glib::RefPtr<Tooltip>&',`Glib::wrap($3, true)')
   _WRAP_SIGNAL(bool query_tooltip(int x, int y, bool keyboard_mode, const Glib::RefPtr<Tooltip>& tooltip), 
query_tooltip)
 };
 
diff --git a/gtk/src/textbuffer.hg b/gtk/src/textbuffer.hg
index b782909..95cc236 100644
--- a/gtk/src/textbuffer.hg
+++ b/gtk/src/textbuffer.hg
@@ -528,12 +528,18 @@ _CONVERSION(`const char*',`const Glib::ustring&',`Glib::ustring(p1, p1 + p2)')
 
 #m4 _CONVERSION(`GdkPixbuf*',`const Glib::RefPtr<Gdk::Pixbuf>&', Glib::wrap($3, true))
   _WRAP_SIGNAL(void insert_pixbuf(const TextBuffer::iterator& pos, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf), 
"insert_pixbuf")
+
+#m4 _CONVERSION(`GtkTextChildAnchor*',`const Glib::RefPtr<ChildAnchor>&',`Glib::wrap($3, true)')
   _WRAP_SIGNAL(void insert_child_anchor(const TextBuffer::iterator& pos, const Glib::RefPtr<ChildAnchor>& 
anchor), "insert_child_anchor")
 
   _WRAP_SIGNAL(void erase(const TextBuffer::iterator& start, const TextBuffer::iterator& end), 
"delete_range")
   _WRAP_SIGNAL(void changed(), "changed")
   _WRAP_SIGNAL(void modified_changed(), "modified_changed")
+
+#m4 _CONVERSION(`GtkTextMark*',`const Glib::RefPtr<TextBuffer::Mark>&',`Glib::wrap($3, true)')
   _WRAP_SIGNAL(void mark_set(const TextBuffer::iterator& location, const Glib::RefPtr<TextBuffer::Mark>& 
mark), "mark_set")
+
+#m4 _CONVERSION(`GtkTextTag*',`const Glib::RefPtr<TextBuffer::Tag>&',`Glib::wrap($3, true)')
   _WRAP_SIGNAL(void mark_deleted(const Glib::RefPtr<TextBuffer::Mark>& mark), "mark_deleted")
   _WRAP_SIGNAL(void apply_tag(const Glib::RefPtr<TextBuffer::Tag>& tag, const TextBuffer::iterator& 
range_begin, const TextBuffer::iterator& range_end), "apply_tag")
   _WRAP_SIGNAL(void remove_tag(const Glib::RefPtr<TextBuffer::Tag>& tag, const TextBuffer::iterator& 
range_begin, const TextBuffer::iterator& range_end), "remove_tag")
diff --git a/gtk/src/texttag.hg b/gtk/src/texttag.hg
index 0cd69bc..d04bfd2 100644
--- a/gtk/src/texttag.hg
+++ b/gtk/src/texttag.hg
@@ -67,6 +67,7 @@ public:
   _WRAP_METHOD(void set_priority(int priority), gtk_text_tag_set_priority)
   _WRAP_METHOD(bool event(const Glib::RefPtr<Glib::Object>& event_object, GdkEvent* event, const TextIter& 
iter), gtk_text_tag_event)
 
+#m4 _CONVERSION(`GObject*',`const Glib::RefPtr<Glib::Object>&',`Glib::wrap($3, true)')
   _WRAP_SIGNAL(bool event(const Glib::RefPtr<Glib::Object>& event_object, GdkEvent* event, const TextIter& 
iter), "event")
 
   _WRAP_PROPERTY("name", Glib::ustring) //construct-only.
diff --git a/gtk/src/texttagtable.hg b/gtk/src/texttagtable.hg
index 389de3c..c6b22ca 100644
--- a/gtk/src/texttagtable.hg
+++ b/gtk/src/texttagtable.hg
@@ -56,7 +56,9 @@ public:
 
   _WRAP_METHOD(int get_size() const, gtk_text_tag_table_get_size)
 
+_CONVERSION(`GtkTextTag*',`const Glib::RefPtr<TextTag>&',`Glib::wrap($3, true)')
   _WRAP_SIGNAL(void tag_changed(const Glib::RefPtr<TextTag>& tag, bool size_changed), "tag_changed")
+
   _WRAP_SIGNAL(void tag_added(const Glib::RefPtr<TextTag>& tag), "tag_added")
   _WRAP_SIGNAL(void tag_removed(const Glib::RefPtr<TextTag>& tag), "tag_removed")
 
diff --git a/gtk/src/uimanager.hg b/gtk/src/uimanager.hg
index c787d99..35389cc 100644
--- a/gtk/src/uimanager.hg
+++ b/gtk/src/uimanager.hg
@@ -259,6 +259,8 @@ public:
 
   _WRAP_SIGNAL(void add_widget(Widget* widget), add_widget)
   _WRAP_SIGNAL(void actions_changed(), actions_changed)
+
+#m4 _CONVERSION(`GtkAction*',`const Glib::RefPtr<Action>&',`Glib::wrap($3, true)')
   _WRAP_SIGNAL(void connect_proxy(const Glib::RefPtr<Action>& action, Widget* widget), connect_proxy)
   _WRAP_SIGNAL(void disconnect_proxy(const Glib::RefPtr<Action>& action, Widget* widget), disconnect_proxy)
   _WRAP_SIGNAL(void pre_activate(const Glib::RefPtr<Action>& action), pre_activate)
diff --git a/gtk/src/widget.hg b/gtk/src/widget.hg
index 02f75a0..15c9e90 100644
--- a/gtk/src/widget.hg
+++ b/gtk/src/widget.hg
@@ -717,6 +717,7 @@ dnl
 
   //_WRAP_SIGNAL(Glib::RefPtr<Atk::Object> get_accessible(), "get_accessible", ifdef GTKMM_ATKMM_ENABLED, 
refreturn, deprecated)
 
+_CONVERSION(`GdkScreen*',`const Glib::RefPtr<Gdk::Screen>&',`Glib::wrap($3, true)')
   _WRAP_SIGNAL(void screen_changed(const Glib::RefPtr<Gdk::Screen>& previous_screen), "screen_changed")
 
   _WRAP_SIGNAL(void composited_changed(), "composited_changed", no_default_handler)
@@ -734,6 +735,7 @@ dnl
   _IGNORE_SIGNAL("destroy-event")
 
    // TODO: Remove no_default_handler when we can break ABI:
+#m4 _CONVERSION(`GtkTooltip*',`const Glib::RefPtr<Tooltip>&',`Glib::wrap($3, true)')
   _WRAP_SIGNAL(bool query_tooltip(int x, int y, bool keyboard_tooltip, const Glib::RefPtr<Tooltip>& 
tooltip), "query_tooltip", no_default_handler)
 
   //(This was added to GTK+ 2.8 but forgotten by us until gtkmm 2.13/14):
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index b78610f..c3839e6 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -612,8 +612,6 @@ _CONVERSION(`GtkPageOrientation',`PageOrientation',`($2)$3')
 _CONVERSION(`PageSetup&',`GtkPageSetup*',__FR2P)
 _CONVERSION(`const PageSetup&',`GtkPageSetup*',__FCR2P)
 _CONVERSION(`GtkPageSetup*',`Glib::RefPtr<PageSetup>',`Glib::wrap($3)')
-# TODO: What uses this?
-_CONVERSION(`GtkPageSetup*',`const Glib::RefPtr<PageSetup>',`Glib::wrap($3)')
 _CONVERSION(`const Glib::RefPtr<PageSetup>',`GtkPageSetup*',__CONVERT_REFPTR_TO_P($3))
 _CONVERSION(`const Glib::RefPtr<PageSetup>&',`GtkPageSetup*',__CONVERT_REFPTR_TO_P($3))
 
@@ -651,7 +649,6 @@ _CONVERSION(`GtkPrintCapabilities',`PrintCapabilities',`($2)$3')
 
 #Tooltip
 #TODO: This should not be here:
-_CONVERSION(`GtkTooltip*',`const Glib::RefPtr<Tooltip>&',`Glib::wrap($3, true)')
 _CONVERSION(`const Glib::RefPtr<Tooltip>&',`GtkTooltip*',__CONVERT_REFPTR_TO_P($3))
 
 
@@ -665,25 +662,16 @@ _CONVERSION(`const GtkTextIter*',`const TextIter&',Glib::wrap($3))
 _CONVERSION(`const GtkTextIter*',`const TextBuffer::iterator&',Glib::wrap($3))
 _CONVERSION(`const TextIter&',`GtkTextIter*',__FCR2P)
 _CONVERSION(`const TextBuffer::iterator&',`GtkTextIter*',__FCR2P)
-_CONVERSION(`GtkTextChildAnchor*',`const Glib::RefPtr<ChildAnchor>&',`Glib::wrap($3, true)')
-_CONVERSION(`GtkTextMark*',`const Glib::RefPtr<Mark>&',`Glib::wrap($3, true)')
-_CONVERSION(`GtkTextMark*',`const Glib::RefPtr<TextBuffer::Mark>&',`Glib::wrap($3, true)')
-_CONVERSION(`GtkTextTag*',`const Glib::RefPtr<TextTag>&',`Glib::wrap($3, true)')
-_CONVERSION(`GtkTextTag*',`const Glib::RefPtr<TextBuffer::Tag>&',`Glib::wrap($3, true)')
-_CONVERSION(`GObject*',`const Glib::RefPtr<Glib::Object>&',`Glib::wrap($3, true)')
 _CONVERSION(`GtkTreePath*',`const TreeModel::Path&',`Gtk::TreePath($3, true)')
 _CONVERSION(`GtkTreePath*',`const Path&',`Gtk::TreePath($3, true)')
 _CONVERSION(`TreeViewColumn*',`GtkTreeViewColumn*',__FP2P)
 
 _CONVERSION(`GtkSelectionData*',`const SelectionData&', `SelectionData_WithoutOwnership($3)')
 _CONVERSION(`GtkSelectionData*',`SelectionData&', `SelectionData_WithoutOwnership($3)')
-_CONVERSION(`GtkTreeModel*',`const Glib::RefPtr<const TreeModel>&',`Glib::wrap($3, true)')
 _CONVERSION(`const Glib::RefPtr<const TreeModel>&',`GtkTreeModel*',__CONVERT_CONST_REFPTR_TO_P)
 #_CONVERSION(`GtkTreeIter*',`const TreeModel::iterator&',Glib::wrap($3, true))
-_CONVERSION(`GdkScreen*',`const Glib::RefPtr<Gdk::Screen>&',`Glib::wrap($3, true)')
 _CONVERSION(`CellRenderer*',`GtkCellRenderer*',__FP2P)
 _CONVERSION(`GtkCellRenderer*',`CellRenderer*',__RP2P)
-_CONVERSION(`GtkAction*',`const Glib::RefPtr<Action>&',`Glib::wrap($3, true)')
 
 _CONVERSION(`Align',`float',`_gtkmm_align_float_from_enum($3)')
 


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