Add change watching to dconf-editor (merged from upstream).
This commit is contained in:
parent
35f73f52e3
commit
765f904e71
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.20 2011/06/03 13:26:57 ajacoutot Exp $
|
||||
# $OpenBSD: Makefile,v 1.21 2011/06/22 16:08:15 ajacoutot Exp $
|
||||
|
||||
SHARED_ONLY= Yes
|
||||
|
||||
@ -12,7 +12,7 @@ PKGNAME-main= ${DISTNAME}
|
||||
PKGNAME-editor= dconf-editor-${GNOME_VERSION}
|
||||
|
||||
REVISION-main= 2
|
||||
REVISION-editor=1
|
||||
REVISION-editor=2
|
||||
|
||||
SHARED_LIBS+= dconf 0.0 # 0.0.0
|
||||
SHARED_LIBS+= dconf-dbus-1 0.0 # 0.0.0
|
||||
|
@ -1,13 +1,40 @@
|
||||
$OpenBSD: patch-editor_dconf-model_vala,v 1.4 2011/05/30 15:51:51 ajacoutot Exp $
|
||||
$OpenBSD: patch-editor_dconf-model_vala,v 1.5 2011/06/22 16:08:15 ajacoutot Exp $
|
||||
|
||||
From 9d6096ff7790cb39f2cd1638d98b211556c73ff9 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Ancell <robert.ancell@canonical.com>
|
||||
Date: Mon, 09 May 2011 12:25:46 +0000
|
||||
Subject: Handle flags
|
||||
|
||||
--- editor/dconf-model.vala.orig Mon May 30 17:37:37 2011
|
||||
+++ editor/dconf-model.vala Mon May 30 17:30:46 2011
|
||||
@@ -456,7 +456,7 @@ public class EnumModel: GLib.Object, Gtk.TreeModel
|
||||
From a15802bd044b93c02ecd880d0c2bcb5935b03d92 Mon Sep 17 00:00:00 2001
|
||||
From: Ryan Lortie <desrt@desrt.ca>
|
||||
Date: Wed, 22 Jun 2011 15:46:40 +0000
|
||||
Subject: Add change watching to dconf-editor
|
||||
|
||||
--- editor/dconf-model.vala.orig Wed Jun 22 17:50:47 2011
|
||||
+++ editor/dconf-model.vala Wed Jun 22 17:50:54 2011
|
||||
@@ -118,6 +118,12 @@ public class Key : GLib.Object
|
||||
|
||||
public signal void value_changed();
|
||||
|
||||
+ void item_changed (string key) {
|
||||
+ if ((key.has_suffix ("/") && full_name.has_prefix (key)) || key == full_name) {
|
||||
+ value_changed ();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public Key(SettingsModel model, Directory parent, string name, string full_name)
|
||||
{
|
||||
this.model = model;
|
||||
@@ -125,6 +131,8 @@ public class Key : GLib.Object
|
||||
this.name = name;
|
||||
this.full_name = full_name;
|
||||
this.schema = model.schemas.keys.lookup(full_name);
|
||||
+
|
||||
+ model.item_changed.connect (item_changed);
|
||||
}
|
||||
|
||||
public void set_to_default()
|
||||
@@ -456,7 +464,7 @@ public class EnumModel: GLib.Object, Gtk.TreeModel
|
||||
return typeof(int);
|
||||
}
|
||||
|
||||
@ -16,7 +43,7 @@ Subject: Handle flags
|
||||
{
|
||||
iter.stamp = 0;
|
||||
iter.user_data = value;
|
||||
@@ -464,9 +464,9 @@ public class EnumModel: GLib.Object, Gtk.TreeModel
|
||||
@@ -464,9 +472,9 @@ public class EnumModel: GLib.Object, Gtk.TreeModel
|
||||
iter.user_data3 = value;
|
||||
}
|
||||
|
||||
@ -28,3 +55,28 @@ Subject: Handle flags
|
||||
}
|
||||
|
||||
public bool get_iter(out Gtk.TreeIter iter, Gtk.TreePath path)
|
||||
@@ -556,10 +564,23 @@ public class SettingsModel: GLib.Object, Gtk.TreeModel
|
||||
public DConf.Client client;
|
||||
private Directory root;
|
||||
|
||||
+ public signal void item_changed (string key);
|
||||
+
|
||||
+ void watch_func (DConf.Client client, string path, string[] items, string tag) {
|
||||
+ if (items.length == 0) {
|
||||
+ item_changed (path);
|
||||
+ } else {
|
||||
+ foreach (var item in items) {
|
||||
+ item_changed (path + item);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public SettingsModel()
|
||||
{
|
||||
- client = new DConf.Client ();
|
||||
+ client = new DConf.Client (null, watch_func);
|
||||
root = new Directory(this, null, "/", "/");
|
||||
+ client.watch ("/");
|
||||
|
||||
schemas = new SchemaList();
|
||||
try
|
||||
|
Loading…
x
Reference in New Issue
Block a user