[dconf-editor] Add CLI option to not display initial warning.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Add CLI option to not display initial warning.
- Date: Sun, 3 Dec 2017 17:29:49 +0000 (UTC)
commit 1abe3396384244a20cd8ffac92ecd8b451246141
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Sun Dec 3 18:29:13 2017 +0100
Add CLI option to not display initial warning.
editor/dconf-editor.ui | 1 -
editor/dconf-editor.vala | 9 +++++++--
editor/dconf-window.vala | 11 +++++------
3 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/editor/dconf-editor.ui b/editor/dconf-editor.ui
index eea6e47..980ee49 100644
--- a/editor/dconf-editor.ui
+++ b/editor/dconf-editor.ui
@@ -6,7 +6,6 @@
<property name="title" translatable="yes">dconf Editor</property>
<property name="height-request">550</property>
<property name="width-request">770</property>
- <signal name="show" handler="on_show"/>
<signal name="key-press-event" handler="on_key_press_event"/>
<signal name="button-press-event" handler="on_button_press_event"/>
<signal name="window-state-event" handler="on_window_state_event"/>
diff --git a/editor/dconf-editor.vala b/editor/dconf-editor.vala
index f6a62bb..f4356e4 100644
--- a/editor/dconf-editor.vala
+++ b/editor/dconf-editor.vala
@@ -17,9 +17,12 @@
class ConfigurationEditor : Gtk.Application
{
+ private bool disable_warning = false;
+
private const OptionEntry [] option_entries =
{
{ "version", 'v', 0, OptionArg.NONE, null, N_("Print release version and exit"), null },
+ { "I-understand-that-changing-options-can-break-applications", 0, 0, OptionArg.NONE, null, N_("Do
not show initial warning"), null },
{}
};
@@ -63,6 +66,8 @@ class ConfigurationEditor : Gtk.Application
stdout.printf ("%1$s %2$s\n", "dconf-editor", Config.VERSION);
return Posix.EXIT_SUCCESS;
}
+ if (options.contains ("I-understand-that-changing-options-can-break-applications"))
+ disable_warning = true;
return -1;
}
@@ -139,7 +144,7 @@ class ConfigurationEditor : Gtk.Application
}
// TODO more tests
- add_window (new DConfWindow (path));
+ add_window (new DConfWindow (disable_warning, path));
first_window = false;
}
else
@@ -161,7 +166,7 @@ class ConfigurationEditor : Gtk.Application
{
if (first_window)
{
- add_window (new DConfWindow (null));
+ add_window (new DConfWindow (disable_warning, null));
first_window = false;
}
get_active_window ().present ();
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index cc4717b..19cd4c8 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -72,10 +72,13 @@ class DConfWindow : ApplicationWindow
private ulong small_keys_list_rows_handler = 0;
private ulong small_bookmarks_rows_handler = 0;
- public DConfWindow (string? path)
+ public DConfWindow (bool disable_warning, string? path)
{
model = new SettingsModel (settings);
+ if (!disable_warning && settings.get_boolean ("show-warning"))
+ show.connect (show_initial_warning);
+
add_action_entries (action_entries, this);
set_default_size (settings.get_int ("window-width"), settings.get_int ("window-height"));
@@ -185,12 +188,8 @@ class DConfWindow : ApplicationWindow
* * Window management callbacks
\*/
- [GtkCallback]
- private void on_show ()
+ private void show_initial_warning ()
{
- if (!settings.get_boolean ("show-warning"))
- return;
-
Gtk.MessageDialog dialog = new MessageDialog (this, DialogFlags.MODAL, MessageType.INFO,
ButtonsType.NONE, _("Thanks for using Dconf Editor for editing your settings!"));
dialog.format_secondary_text (_("Don’t forget that some options may break applications, so be
careful."));
dialog.add_buttons (_("I’ll be careful."), ResponseType.ACCEPT);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]