GtkTreeRowReference and Drag-and-Drop

2018-10-24 Thread Mitko Haralanov via gtk-app-devel-list
I've implemented a treeview in my application, which has drag-and-drop
enabled to allow re-ordering of the rows. To support tree model updates
while the user is performing dnd operations, I also have
GtkTreeRowReferences for each row in the model (the model will not have too
many rows).

However, when I move a row during model update, the tree row reference for
that row become invalid after the row-deleted signal handler is processed.
What is strange is that, according to the documentation, it seem that this
is exactly what GtkTreeRowReference is supposed to handle. Shouldn't the
reference be updated to point to the new row? Why would the reference
become invalid if I've *moved* the model row instead of deleted it? The row
still exists just at a different place.

Can someone please clarify this?
Thank you
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Extra space after textview

2018-10-24 Thread Matthew A. Postiff via gtk-app-devel-list

Hi,

Working on a "bug" in a gtk program for a while. We have a window with 
multiple textviews one after the other strung together. Built against 
gtk2, things appear fine. I'm trying to upgrade to gtk3, and running 
into a problem. The following python-gtk programs demonstrate.


In GTK3, the more lines that are in the textview, the more extra blank 
space appears after each textview when it is initially created. And as 
soon as we resize the window, the extra space disappears. It is this 
phantom "extra space" that we need to get rid of. Any ideas what is wrong?


I included the gtk2 version of this code. It does not have the phantom 
space on initial creation.


Thanks for reading,

Matt


#!/usr/bin/env python
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

win = Gtk.Window()
win.connect("destroy", Gtk.main_quit)
win.set_default_size(300, 500)
win.show_all()

scrolledwindow = Gtk.ScrolledWindow()
scrolledwindow.set_border_width(10)
scrolledwindow.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.ALWAYS)
win.add(scrolledwindow)
scrolledwindow.show()

vbox = Gtk.VBox()
scrolledwindow.add(vbox)

vbox.show()

def AddTextView(i):
global vbox;
textview = Gtk.TextView()
textbuffer = textview.get_buffer()
textbuffer.set_text("This is some text inside of a Gtk.TextView. In GTK3, the 
more lines that are here, the more extra blank space appears after the textview when it 
is initially created. And as soon as we resize the window, the extra space disappears. If 
we expand the window a lot, the textviews are laid out tightly, and extra gray space 
appears at the bottom of the window. The same code on gtk2 behaves differently. The 
textviews are packed nicely together if they have lots of text. If they only have a line 
or two, then there are gaps. But if we expand the the window a lot, then gaps appear 
between the textviews instead of at the end. Our problem is with GTK3. How do we 
eliminate the blanks-between-textviews upon initial load?")
textview.set_wrap_mode(Gtk.WrapMode.WORD)
textview.set_hexpand(True) # This is False by default
vbox.add(textview)
textview.show()

for i in range(6): AddTextView(i)

Gtk.main()



--
THE GTK2 VERSION OF THIS PROGRAM IS AS FOLLOWS:

#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk

win = gtk.Window()
win.connect("destroy", gtk.main_quit)
win.set_default_size(300, 500)
win.show_all()

scrolledwindow = gtk.ScrolledWindow()
scrolledwindow.set_border_width(10)
scrolledwindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
win.add(scrolledwindow)
scrolledwindow.show()

vbox = gtk.VBox()
scrolledwindow.add_with_viewport(vbox)

vbox.show()

def AddTextView(i):
global vbox;
textview = gtk.TextView()
textbuffer = textview.get_buffer()
textbuffer.set_text("This is some text inside of a Gtk.TextView. In GTK3, the 
more lines that are here, the more extra blank space appears after the textview when it 
is initially created. And as soon as we resize the window, the extra space disappears. If 
we expand the window a lot, the textviews are laid out tightly, and extra gray space 
appears at the bottom of the window. The same code on gtk2 behaves differently. The 
textviews are packed nicely together if they have lots of text. If they only have a line 
or two, then there are gaps. But if we expand the the window a lot, then gaps appear 
between the textviews instead of at the end. Our problem is with GTK3. How do we 
eliminate the blanks-between-textviews upon initial load?")
textview.set_wrap_mode(gtk.WRAP_WORD)
#textview.set_hexpand(True) # This is True by default
vbox.add(textview)
textview.show()

for i in range(6): AddTextView(i)

gtk.main()

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list