Merge branch 'feature/prefs-clear-buttons' into 'master'

Add clear buttons

See merge request rmnvgr/nightthemeswitcher-gnome-shell-extension!44
This commit is contained in:
Romain
2020-08-07 11:31:45 +00:00
2 changed files with 192 additions and 25 deletions
+40
View File
@@ -474,6 +474,16 @@ const Preferences = class {
}); });
updateBackgroundsBackgroundsDayBackgroundButtonUri(); updateBackgroundsBackgroundsDayBackgroundButtonUri();
const backgroundsBackgroundsDayBackgroundClearButton = this.builder.get_object('prefs_backgrounds_backgrounds_day_background_clear_button');
backgroundsBackgroundsDayBackgroundClearButton.connect('clicked', () => {
this.settings.set_string('background-day', '');
});
const updateBackgroundsBackgroundsDayBackgroundClearButtonSensitivity = () => {
backgroundsBackgroundsDayBackgroundClearButton.sensitive = !!this.settings.get_string('background-day');
};
this.settings.connect('changed::background-day', () => updateBackgroundsBackgroundsDayBackgroundClearButtonSensitivity());
updateBackgroundsBackgroundsDayBackgroundClearButtonSensitivity();
const backgroundsBackgroundsNightBackgroundButton = this.builder.get_object('prefs_backgrounds_backgrounds_night_background_button'); const backgroundsBackgroundsNightBackgroundButton = this.builder.get_object('prefs_backgrounds_backgrounds_night_background_button');
const nightBackgroundPreview = this.builder.get_object('night_background_preview'); const nightBackgroundPreview = this.builder.get_object('night_background_preview');
const updateBackgroundsBackgroundsNightBackgroundButtonUri = () => { const updateBackgroundsBackgroundsNightBackgroundButtonUri = () => {
@@ -492,6 +502,16 @@ const Preferences = class {
this.settings.set_string('background-night', backgroundsBackgroundsNightBackgroundButton.get_uri()); this.settings.set_string('background-night', backgroundsBackgroundsNightBackgroundButton.get_uri());
}); });
updateBackgroundsBackgroundsNightBackgroundButtonUri(); updateBackgroundsBackgroundsNightBackgroundButtonUri();
const backgroundsBackgroundsNightBackgroundClearButton = this.builder.get_object('prefs_backgrounds_backgrounds_night_background_clear_button');
backgroundsBackgroundsNightBackgroundClearButton.connect('clicked', () => {
this.settings.set_string('background-night', '');
});
const updateBackgroundsBackgroundsNightBackgroundClearButtonSensitivity = () => {
backgroundsBackgroundsNightBackgroundClearButton.sensitive = !!this.settings.get_string('background-night');
};
this.settings.connect('changed::background-night', () => updateBackgroundsBackgroundsNightBackgroundClearButtonSensitivity());
updateBackgroundsBackgroundsNightBackgroundClearButtonSensitivity();
} }
_connectCommandsPreferences() { _connectCommandsPreferences() {
@@ -519,6 +539,16 @@ const Preferences = class {
Gio.SettingsBindFlags.DEFAULT Gio.SettingsBindFlags.DEFAULT
); );
const commandsCommandsSunriseCommandClearButton = this.builder.get_object('prefs_commands_commands_sunrise_command_clear_button');
commandsCommandsSunriseCommandClearButton.connect('clicked', () => {
this.settings.set_string('command-sunrise', '');
});
const updateCommandsCommandsSunriseCommandClearButtonSensitivity = () => {
commandsCommandsSunriseCommandClearButton.sensitive = !!this.settings.get_string('command-sunrise');
};
this.settings.connect('changed::command-sunrise', () => updateCommandsCommandsSunriseCommandClearButtonSensitivity());
updateCommandsCommandsSunriseCommandClearButtonSensitivity();
const commandsCommandsSunsetCommandEntry = this.builder.get_object('prefs_commands_commands_sunset_command_entry'); const commandsCommandsSunsetCommandEntry = this.builder.get_object('prefs_commands_commands_sunset_command_entry');
this.settings.bind( this.settings.bind(
'command-sunset', 'command-sunset',
@@ -526,6 +556,16 @@ const Preferences = class {
'text', 'text',
Gio.SettingsBindFlags.DEFAULT Gio.SettingsBindFlags.DEFAULT
); );
const commandsCommandsSunsetCommandClearButton = this.builder.get_object('prefs_commands_commands_sunset_command_clear_button');
commandsCommandsSunsetCommandClearButton.connect('clicked', () => {
this.settings.set_string('command-sunset', '');
});
const updateCommandsCommandsSunsetCommandClearButtonSensitivity = () => {
commandsCommandsSunsetCommandClearButton.sensitive = !!this.settings.get_string('command-sunset');
};
this.settings.connect('changed::command-sunset', () => updateCommandsCommandsSunsetCommandClearButtonSensitivity());
updateCommandsCommandsSunsetCommandClearButtonSensitivity();
} }
_connectOndemandKeyboardShortcutDialog() { _connectOndemandKeyboardShortcutDialog() {
+130 -3
View File
@@ -638,7 +638,6 @@
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="spacing">8</property>
<child> <child>
<object class="GtkButton" id="prefs_schedule_ondemand_shortcut_button"> <object class="GtkButton" id="prefs_schedule_ondemand_shortcut_button">
<property name="label" translatable="yes">Choose</property> <property name="label" translatable="yes">Choose</property>
@@ -660,6 +659,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<style>
<class name="destructive-action"/>
</style>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -667,6 +669,9 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<style>
<class name="linked"/>
</style>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -2088,6 +2093,12 @@
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="spacing">8</property>
<child> <child>
<object class="GtkFileChooserButton" id="prefs_backgrounds_backgrounds_day_background_button"> <object class="GtkFileChooserButton" id="prefs_backgrounds_backgrounds_day_background_button">
<property name="visible">True</property> <property name="visible">True</property>
@@ -2099,6 +2110,29 @@
<property name="use_preview_label">False</property> <property name="use_preview_label">False</property>
<property name="title" translatable="yes">Select your background image</property> <property name="title" translatable="yes">Select your background image</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="prefs_backgrounds_backgrounds_day_background_clear_button">
<property name="label" translatable="yes">Clear</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<style>
<class name="destructive-action"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
@@ -2148,6 +2182,12 @@
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="spacing">8</property>
<child> <child>
<object class="GtkFileChooserButton" id="prefs_backgrounds_backgrounds_night_background_button"> <object class="GtkFileChooserButton" id="prefs_backgrounds_backgrounds_night_background_button">
<property name="visible">True</property> <property name="visible">True</property>
@@ -2159,6 +2199,29 @@
<property name="use_preview_label">False</property> <property name="use_preview_label">False</property>
<property name="title" translatable="yes">Select your background image</property> <property name="title" translatable="yes">Select your background image</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="prefs_backgrounds_backgrounds_night_background_clear_button">
<property name="label" translatable="yes">Clear</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<style>
<class name="destructive-action"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
@@ -2374,15 +2437,47 @@
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<child> <child>
<object class="GtkEntry" id="prefs_commands_commands_sunrise_command_entry"> <object class="GtkEntry" id="prefs_commands_commands_sunrise_command_entry">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="width_chars">36</property> <property name="width_chars">28</property>
<property name="truncate_multiline">True</property> <property name="truncate_multiline">True</property>
<property name="placeholder_text" translatable="yes">notify-send "Hello sunshine!"</property> <property name="placeholder_text" translatable="yes">notify-send "Hello sunshine!"</property>
<property name="input_purpose">terminal</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="prefs_commands_commands_sunrise_command_clear_button">
<property name="label" translatable="yes">Clear</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<style>
<class name="destructive-action"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="linked"/>
</style>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@@ -2433,15 +2528,47 @@
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<child> <child>
<object class="GtkEntry" id="prefs_commands_commands_sunset_command_entry"> <object class="GtkEntry" id="prefs_commands_commands_sunset_command_entry">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="width_chars">36</property> <property name="width_chars">28</property>
<property name="truncate_multiline">True</property> <property name="truncate_multiline">True</property>
<property name="placeholder_text" translatable="yes">notify-send "Hello moonshine!"</property> <property name="placeholder_text" translatable="yes">notify-send "Hello moonshine!"</property>
<property name="input_purpose">terminal</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="prefs_commands_commands_sunset_command_clear_button">
<property name="label" translatable="yes">Clear</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<style>
<class name="destructive-action"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="linked"/>
</style>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>