Convert GtkTextView::text properties

2007-07-07  Johan Dahlin  <jdahlin@async.com.br>

    * gtk/gtk-builder-convert (GtkBuilderConverter._convert_textview_text): 
    Convert GtkTextView::text properties


svn path=/trunk/; revision=18389
This commit is contained in:
Johan Dahlin 2007-07-07 15:11:52 +00:00 committed by Johan Dahlin
parent 5a4ed10fae
commit 6257f681d2
4 changed files with 21 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2007-07-07 Johan Dahlin <jdahlin@async.com.br>
* gtk/gtk-builder-convert (GtkBuilderConverter._convert_textview_text):
Convert GtkTextView::text properties
2007-07-06 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkprivate-quartz.h:

View File

@ -1,3 +1,7 @@
2007-07-07 Johan Dahlin <jdahlin@async.com.br>
* gtk/gtk-builder-convert.xml: Update
2007-04-05 Matthias clasen <mclasen@redhat.com>
* gtk/tmpl/gtkbuilder.sgml: Pixbuf properties

View File

@ -28,9 +28,6 @@ its output the file specified as the second argument.
<refsect1><title>Bugs</title>
<para>
GtkTextView text is not converted into a GtkTextBuffer.
</para>
<para>
Toolbars are not handled.
</para>
<para>

View File

@ -19,7 +19,6 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# TODO:
# GtkTextView.text -> GtkTextBuffer
# Toolbars
"""Usage: gtk-builder-convert [OPTION] [INPUT] [OUTPUT]
@ -233,6 +232,8 @@ class GtkBuilderConverter(object):
elif prop_name == "items" and klass in ['GtkComboBox',
'GtkComboBoxEntry']:
self._convert_combobox_items(node, prop)
elif prop_name == "text" and klass == 'GtkTextView':
self._convert_textview_text(prop)
def _remove_window(self, node):
object_node = get_object_node(get_child_nodes(node)[0])
@ -442,6 +443,16 @@ class GtkBuilderConverter(object):
attribute.setAttribute('name', 'text')
attribute.appendChild(self._dom.createTextNode('0'))
def _convert_textview_text(self, prop):
data = prop.childNodes[0].data
if prop.hasAttribute('translatable'):
prop.removeAttribute('translatable')
tbuffer = self._create_object("GtkTextBuffer", None,
template='textbuffer',
text=data)
prop.childNodes[0].data = tbuffer.getAttribute('id')
self._interface.childNodes.insert(0, tbuffer)
def _packing_prop_to_child_attr(self, node, prop_name, prop_val,
attr_val=None):
for child in node.getElementsByTagName("child"):