-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

(CC'ing awesome-devel again)

Am 01.05.2010 09:14, Perry Hargrave wrote:
> On Sat, May 01, 2010 at 08:41:20AM +0200, Uli Schlachter wrote:
>> > -----BEGIN PGP SIGNED MESSAGE-----
>> > Hash: SHA256
>> > 
>> > Am 01.05.2010 01:04, perry wrote:
>>> > > list_update()
>>> > >     if updating for a tag object then set the tag's "textbox" property.
>>> > >     this way there is a robust way to find the tag's widget later.
>> > 
>> > What if I use multiple taglists? With some "good" timing, you might 
>> > randomly get
>> > one or another textbox for the tag.
> 1. multiple taglists are cheesy.. :P
> 
> 2. their will be only a single ref from tag->textbox. so i think
> whichever is last through widget.common.list_update should be whats
> used...
> 
>> > 
>> > I'd rather propose to add some kind of callback system awful.prompt for 
>> > setting
>> > the text. That would IMO be more generic. In this case one would then 
>> > "type into
>> > all taglists at the same time".
>> > 
> The tag.textbox hack is to circumvent the indexing taglist problem. I
> don't see how a callback addresses this.
> 
> Do you mean a new awful.prompt modifying tag.name (or any other string buffer)
> and all the widgets being updated from that?
> 
> I guess a tag could have references to all its taglist widgets. Then a
> custom prompt could operate on the text in all of those.. 
> 
>> > For backwards compatibility we could use sth like this:
>> > 
>> > if type(textbox) ~= "function" then
>> >    textbox = function(text) textbox.text = text end
>> > end
>> > 
>> > What do you think?
> .. i don't get your prompt idea. but you certainly know awesome/awful source
> better than I do. 
> 
> I happily would hack away at this prompt idea too, but I don't really get 
> where
> you're going with it.

Let me try to explain with an example:
function callback(text)
   if text ~= nil then
      tag.name = text
   end
   return tag.name
end

function rename(tag, callback)
        keygrabber.run(function (mod, key, event)
                local old = callback()
                local name = old

                if event ~= "press" then
                        return true
                end

                if key:len() == 1 then
                        name = old:sub(1, old:len() - 1) .. key .. "_"
                elseif
                        -- Other stuff...
                end

                callback(name)
                return true
        end)
end

(This is not how I'd implement it, just an example on what I have in mind)

rename() doesn't know anything about a tag object, it just knows that when it
calls callback(text), that text will be displayed somewhere. Might just be a
textbox whose "text" property is set, could be a tag whose name is directly
modified or just anything.
When the tag's name is modified, the taglist gets a signal and updates itself,
that way you indirectly modify the textbox without knowing exactly where it is
"hiding".

One issue I noticed while writing this mail:
Pango markup most likely wouldn't work. Does the prompt need pango markup? (It
"just" adds a "_" to the end of the text, no?)

Uli

P.S.: No idea why/how thunderbird screwed up the quoting. :(
- -- 
- - Buck, when, exactly, did you lose your mind?
- - Three months ago. I woke up one morning married to a pineapple.
  An ugly pineapple... But I loved her!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBCAAGBQJL29rIAAoJECLkKOvLj8sGmnoH/RjyAl72qeCtzr8kevx8cdM2
J4e2bJN21WO113BmgnMSVg2PiTb0+t4jb6cZMMGcZxk2IJ39BLQh9fQ5xDPJS8ev
U8dqAKB4xULn0cHYg8orSozS47Rjd8TNiZm9ghbquhP+OPfxZCdXupj7WWSsXPRq
wT+SjyAVw4vd0GLvXDTEL/c9pmpK5j555YIjjr/8O58DBUTWGED+olrHHIVNjyX3
yORY/1aKf5TX4KNq3vz5lEmQnAeryHnkXYt+vSnPGxKrkujlxE7f9IyHBHJiV8WC
r7pm9nhMULhc2aNcYb1vPQDCV7oyz2pHktMsWfOJq+xeCSkkSdM8ZCa/RUYmDPk=
=MX6o
-----END PGP SIGNATURE-----

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.

Reply via email to