# File gconf/sample/basic-gconf-app.rb, line 75 def create_config_entry(key) hbox = Gtk::HBox.new(false, 5) label = Gtk::Label.new(key) entry = Gtk::Entry.new hbox.pack_start(label, false, false) hbox.pack_end(entry, false, false) value = @client[key] entry.text = value unless value.nil? # The prefs dialog knows NOTHING about the existence # of the main window; it is purely a way to fool # with the GConf database. It never does something like change # the main window directly; it ONLY changes GConf keys via # GConf::Client. This is _important_, because people may configure # your app without using your preferences dialog. commit_entry = proc { text = entry.text if text.empty? @client.unset key else @client[key] = text end false } entry.signal_connect('focus_out_event', &commit_entry) entry.signal_connect('activate', &commit_entry) # Set the entry insensitive if the key it edits isn't writable. # Technically, we should update this sensitivity if the key gets # a change notify, but that's probably overkill. entry.sensitive = @client.key_is_writable? key return hbox end