[dconf-editor] 'Set to default' shortcut.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] 'Set to default' shortcut.
- Date: Wed, 25 Jan 2017 06:46:43 +0000 (UTC)
commit bddbd43f86d7387bf89f8f17ab5ca5f65908ab34
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Wed Jan 25 07:45:35 2017 +0100
'Set to default' shortcut.
editor/dconf-window.vala | 12 ++++++++++++
editor/help-overlay.ui | 7 +++++++
editor/key-list-box-row.vala | 21 ++++++++++++++-------
editor/registry-view.vala | 22 +++++++++++++++++++++-
4 files changed, 54 insertions(+), 8 deletions(-)
---
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 9ec399e..cfd6af5 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -356,6 +356,18 @@ class DConfWindow : ApplicationWindow
registry_view.discard_row_popover ();
registry_view.toggle_boolean_key ();
return true;
+ // case "BackSpace": // ?
+ case "Delete":
+ case "KP_Delete":
+ case "decimalpoint":
+ case "period":
+ case "KP_Decimal":
+ if (info_button.active || bookmarks_button.active)
+ return false;
+ registry_view.set_search_mode (false);
+ registry_view.discard_row_popover ();
+ registry_view.set_to_default ();
+ return true;
default:
break; // TODO make <ctrl>v work; https://bugzilla.gnome.org/show_bug.cgi?id=762257 is
WONTFIX
}
diff --git a/editor/help-overlay.ui b/editor/help-overlay.ui
index 5b17974..a395c02 100644
--- a/editor/help-overlay.ui
+++ b/editor/help-overlay.ui
@@ -94,6 +94,13 @@
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">Set to default</property>
+ <property name="accelerator"><Primary>Delete</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">True</property>
<property name="title" translatable="yes" context="shortcut window">Toggle boolean
value</property>
<property name="accelerator"><Primary>Return</property>
</object>
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index b0fc4a9..537b300 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -20,6 +20,7 @@ using Gtk;
private abstract class ClickableListBoxRow : EventBox
{
public signal void on_row_clicked ();
+ public signal void on_delete_call ();
public abstract string get_text ();
@@ -109,6 +110,9 @@ private class FolderListBoxRow : ClickableListBoxRow
popover.new_action ("open", () => on_row_clicked ());
popover.new_copy_action (get_text ());
+ popover.new_section ();
+ popover.new_action ("recursivereset", () => on_delete_call ());
+
return true;
}
}
@@ -450,24 +454,27 @@ private class ContextPopover : Popover
{
case "customize":
/* Translators: "open key-editor dialog" action in the right-click menu on the list of keys
*/
- current_section.append (_("Customize…"), group_dot_action); return;
+ current_section.append (_("Customize…"), group_dot_action); return;
case "default1":
/* Translators: "reset key value" action in the right-click menu on the list of keys */
- current_section.append (_("Set to default"), group_dot_action); return;
+ current_section.append (_("Set to default"), group_dot_action); return;
case "default2":
- new_multi_default_action (group_dot_action); return;
+ new_multi_default_action (group_dot_action); return;
case "dismiss":
/* Translators: "dismiss change" action in the right-click menu on a key with pending
changes */
- current_section.append (_("Dismiss change"), group_dot_action); return;
+ current_section.append (_("Dismiss change"), group_dot_action); return;
case "open":
/* Translators: "open folder" action in the right-click menu on a folder */
- current_section.append (_("Open"), group_dot_action); return;
+ current_section.append (_("Open"), group_dot_action); return;
case "erase":
/* Translators: "erase key" action in the right-click menu on a key without schema */
- current_section.append (_("Erase key"), group_dot_action); return;
+ current_section.append (_("Erase key"), group_dot_action); return;
case "unerase":
/* Translators: "dismiss change" action in the right-click menu on a key without schema
planned to be erased */
- current_section.append (_("Do not erase"), group_dot_action); return;
+ current_section.append (_("Do not erase"), group_dot_action); return;
+ case "recursivereset":
+ /* Translators: "reset recursively" action in the right-click menu on a folder */
+ current_section.append (_("Reset recursively"), group_dot_action); return;
default:
assert_not_reached ();
}
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index 2382e69..1e369d1 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -261,9 +261,13 @@ class RegistryView : Grid, PathElement
{
ClickableListBoxRow row;
SettingObject setting_object = (SettingObject) item;
+ ulong on_delete_call_handler;
if (setting_object is Directory)
+ {
row = new FolderListBoxRow (setting_object.name, setting_object.full_name);
+ on_delete_call_handler = row.on_delete_call.connect (() => reset_objects (((Directory)
setting_object).key_model, true));
+ }
else
{
if (setting_object is GSettingsKey)
@@ -273,6 +277,7 @@ class RegistryView : Grid, PathElement
Key key = (Key) setting_object;
KeyListBoxRow key_row = (KeyListBoxRow) row;
+ on_delete_call_handler = row.on_delete_call.connect (() => set_key_value (key, null));
ulong set_key_value_handler = key_row.set_key_value.connect ((variant) => { set_key_value (key,
variant); set_delayed_icon (row, key); });
ulong change_dismissed_handler = key_row.change_dismissed.connect (() => revealer.dismiss_change
(key));
@@ -292,6 +297,7 @@ class RegistryView : Grid, PathElement
ulong button_press_event_handler = row.button_press_event.connect (on_button_pressed);
row.destroy.connect (() => {
+ row.disconnect (on_delete_call_handler);
row.disconnect (on_row_clicked_handler);
row.disconnect (button_press_event_handler);
});
@@ -393,8 +399,13 @@ class RegistryView : Grid, PathElement
public void reset (bool recursively)
{
+ reset_objects (key_model, recursively);
+ }
+
+ private void reset_objects (GLib.ListStore? objects, bool recursively)
+ {
enter_delay_mode ();
- reset_generic (key_model, recursively);
+ reset_generic (objects, recursively);
revealer.warn_if_no_planned_changes ();
}
@@ -482,6 +493,15 @@ class RegistryView : Grid, PathElement
((KeyListBoxRow) ((!) selected_row).get_child ()).toggle_boolean_key ();
}
+ public void set_to_default ()
+ {
+ ListBoxRow? selected_row = get_key_row ();
+ if (selected_row == null)
+ return;
+
+ ((ClickableListBoxRow) ((!) selected_row).get_child ()).on_delete_call ();
+ }
+
public void discard_row_popover ()
{
ListBoxRow? selected_row = get_key_row ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]