# File gconf/sample/basic-gconf-app.rb, line 115 def create_configurable_widget(key) frame = Gtk::Frame.new('Value of "%s"' % key) label = Gtk::Label.new frame.add label value = @client[key] label.text = value unless value.nil? # Notification callback for our label widgets that # monitor the current value of a gconf key. i.e. # we are conceptually "configuring" the label widgets notify_id = @client.notify_add(key) { | cli, entry | # Note that value can be NULL (unset) or it can have # the wrong type! Need to check that to survive # gconftool-2 --break-key if entry.value.nil? label.text = "" else label.text = entry.value end } # Remove the notification callback when the widget monitoring # notifications is destroyed label.signal_connect('destroy') { # Note that notify_id will be 0 if there was an error, # so we handle that @client.notify_remove notify_id unless (notify_id == 0) } return frame end