[dconf-editor] Add an Erase key button in the infobar.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Add an Erase key button in the infobar.
- Date: Thu, 21 Jul 2016 01:45:45 +0000 (UTC)
commit 9f070f038a0c966cc3e7779f8fb3f931037437e1
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Jul 21 03:44:56 2016 +0200
Add an Erase key button in the infobar.
editor/registry-info.ui | 9 +++++++++
editor/registry-info.vala | 34 ++++++++++++++++++++++++++++++++--
2 files changed, 41 insertions(+), 2 deletions(-)
---
diff --git a/editor/registry-info.ui b/editor/registry-info.ui
index 19bc2a4..01751b1 100644
--- a/editor/registry-info.ui
+++ b/editor/registry-info.ui
@@ -23,6 +23,15 @@
<property name="label" translatable="yes"><b>No schema available.</b>
Dconf Editor can’t find a schema associated with this key. The application that installed this key may have
been removed, may have stop the use of this key, or may use a relocatable schema for defining its
keys.</property>
</object>
</child>
+ <child>
+ <object class="GtkButton" id="erase_button">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Erase key</property>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/editor/registry-info.vala b/editor/registry-info.vala
index 44d8842..7cedd39 100644
--- a/editor/registry-info.vala
+++ b/editor/registry-info.vala
@@ -22,9 +22,30 @@ class RegistryInfo : Grid
{
[GtkChild] private Revealer no_schema_warning;
[GtkChild] private ListBox properties_list_box;
+ [GtkChild] private Button erase_button;
+
+ private ulong erase_button_handler = 0;
+ private ulong revealer_reload_1_handler = 0;
+ private ulong revealer_reload_2_handler = 0;
public bool populate_properties_list_box (ModificationsRevealer revealer, Key key)
{
+ if (erase_button_handler != 0)
+ {
+ erase_button.disconnect (erase_button_handler);
+ erase_button_handler = 0;
+ }
+ if (revealer_reload_1_handler != 0)
+ {
+ revealer.disconnect (revealer_reload_1_handler);
+ revealer_reload_1_handler = 0;
+ }
+ if (revealer_reload_2_handler != 0)
+ {
+ revealer.disconnect (revealer_reload_2_handler);
+ revealer_reload_2_handler = 0;
+ }
+
bool has_schema;
unowned Variant [] dict_container;
key.properties.get ("(ba{ss})", out has_schema, out dict_container);
@@ -90,7 +111,8 @@ class RegistryInfo : Grid
bool disable_revealer_for_switch = false;
GSettingsKey gkey = (GSettingsKey) key;
- revealer.reload.connect (() => {
+ revealer_reload_1_handler = revealer.reload.connect (() => {
+ warning ("reload 1");
disable_revealer_for_switch = true;
custom_value_switch.set_active (gkey.is_default);
disable_revealer_for_switch = false; // TODO bad but needed
@@ -125,6 +147,14 @@ class RegistryInfo : Grid
}
});
}
+ else
+ {
+ erase_button_handler = erase_button.clicked.connect (() => {
+ revealer.enter_delay_mode ();
+ revealer.add_delayed_setting (key, null);
+ });
+ }
+
key_editor_child.value_has_changed.connect ((enable_revealer, is_valid) => {
if (disable_revealer_for_value)
disable_revealer_for_value = false;
@@ -142,7 +172,7 @@ class RegistryInfo : Grid
}
});
key_editor_child.child_activated.connect (() => { revealer.apply_delayed_settings (); }); // TODO
"only" used for string-based and spin widgets
- revealer.reload.connect (() => {
+ revealer_reload_2_handler = revealer.reload.connect (() => {
disable_revealer_for_value = true;
key_editor_child.reload (key.value);
if (tmp_string == "<flags>")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]