Project

General

Profile

unexist.dev

Assorted tidbits and projects

Bug #267

Subtlext::Sublet#data returning wrong value

Added by Dominikh Honnef about 13 years ago. Updated about 13 years ago.

Status:
Closed
Priority:
Urgent
Category:
Bugfix
Target version:
Start date:
11/14/2011
Due date:
% Done:

0%

Estimated time:
0.00 h

Description

Subtlext::Sublet#data seems to be returning the ID or some internal ordering of the sublets, instead of the data. Coincidentally, Subtlext::Sublet#data= has no effect at all.

Example:

require 'subtle/subtlext'

p Subtlext::Sublet.all.map {|s| '%s: %s' % [s, s.data]}
Subtlext::Sublet.all.each {|s| s.data = 'hi' }
p Subtlext::Sublet.all.map {|s| '%s: %s' % [s, s.data]}
# >> ['status: 0', 'cpuchart: 1', 'clock: 2', 'temp: 3', 'mpd: 4']
# >> ['status: 0', 'cpuchart: 1', 'clock: 2', 'temp: 3', 'mpd: 4']

History

#1 Updated by Christoph Kappel about 13 years ago

  • Target version set to Xi
  • Assignee set to Non member users
  • Status changed from Unconfirmed to Confirmed
  • Category set to Bugfix

Sorry, the docs are just outdated here, I changed the behaviour of this method a while ago and apparently forgot to fix docs. I renamed #data= to #send_data in r3122 to make it clear, the method sends data to a sublet, when it has a :data event. The data is passed as second argument to the handler.

Example:

configure :sublet do
  # boiler plate
end

on :data do |s, data|
  s.data = data
end

Subtlext::Sublet[:sublet].send_data("foobar")

The idea for the change was to be able to use multiple ways to update the sublet.

The #data method never worked, xlib doesn't allow a two-way communication and in order to get this working I'd need to export the values of every sublet to a window property. I don't see any benefits for this, especially since sublets are updated quite often, therefore I removed #data.

#2 Updated by Christoph Kappel about 13 years ago

  • Status changed from Confirmed to Closed

Also available in: Atom PDF