Skip to content

Commit

Permalink
xfce-bluetooth: connect the "trusted" and "blocked" checkboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
ncopa committed Jan 30, 2015
1 parent d17807d commit 7f18937
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
13 changes: 0 additions & 13 deletions data/bluetooth-preferences.ui
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,6 @@
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="btn_trust">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" comments="translators: toolbar item: keep it as short as possible">Trust</property>
<property name="icon_name">trust</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="btn_properties">
<property name="visible">True</property>
Expand Down
22 changes: 22 additions & 0 deletions src/xfce-bluetooth.vala
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,28 @@ public class XfceBluetoothApp : GLib.Object {
private void treeview_add_toggle_col(TreeView v, string title, DevCols col, bool sensitive) {
var toggle = new CellRendererToggle();
toggle.sensitive = sensitive;
toggle.toggled.connect((toggle, treepathstr) => {
bool newvalue = !toggle.active;
TreePath treepath = new Gtk.TreePath.from_string (treepathstr);
TreeIter iter;
device_store.get_iter(out iter, treepath);

Value objpath = Value(typeof(string));
device_store.get_value(iter, DevCols.OBJPATH, out objpath);

var device = new BluezDevice(new ObjectPath(objpath.get_string()));
switch (col) {
case DevCols.TRUSTED:
device.trusted = newvalue;
break;
case DevCols.BLOCKED:
device.blocked = newvalue;
break;
}

device_store.set(iter, col, newvalue);
stderr.printf("tree path: %s\tobject path: %s\n", treepathstr, objpath.get_string());
});
v.insert_column_with_attributes (-1, title, toggle, "active", col);
}

Expand Down

0 comments on commit 7f18937

Please sign in to comment.