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();
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 nightBackgroundPreview = this.builder.get_object('night_background_preview');
const updateBackgroundsBackgroundsNightBackgroundButtonUri = () => {
@@ -492,6 +502,16 @@ const Preferences = class {
this.settings.set_string('background-night', backgroundsBackgroundsNightBackgroundButton.get_uri());
});
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() {
@@ -519,6 +539,16 @@ const Preferences = class {
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');
this.settings.bind(
'command-sunset',
@@ -526,6 +556,16 @@ const Preferences = class {
'text',
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() {
+152 -25
View File
@@ -638,7 +638,6 @@
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">8</property>
<child>
<object class="GtkButton" id="prefs_schedule_ondemand_shortcut_button">
<property name="label" translatable="yes">Choose</property>
@@ -660,6 +659,9 @@
<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>
@@ -667,6 +669,9 @@
<property name="position">1</property>
</packing>
</child>
<style>
<class name="linked"/>
</style>
</object>
<packing>
<property name="expand">False</property>
@@ -2089,15 +2094,44 @@
</packing>
</child>
<child>
<object class="GtkFileChooserButton" id="prefs_backgrounds_backgrounds_day_background_button">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="filter">image_filter</property>
<property name="preview_widget">day_background_preview</property>
<property name="use_preview_label">False</property>
<property name="title" translatable="yes">Select your background image</property>
<property name="spacing">8</property>
<child>
<object class="GtkFileChooserButton" id="prefs_backgrounds_backgrounds_day_background_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="filter">image_filter</property>
<property name="preview_widget">day_background_preview</property>
<property name="use_preview_label">False</property>
<property name="title" translatable="yes">Select your background image</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_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>
<property name="expand">True</property>
@@ -2149,15 +2183,44 @@
</packing>
</child>
<child>
<object class="GtkFileChooserButton" id="prefs_backgrounds_backgrounds_night_background_button">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="filter">image_filter</property>
<property name="preview_widget">night_background_preview</property>
<property name="use_preview_label">False</property>
<property name="title" translatable="yes">Select your background image</property>
<property name="spacing">8</property>
<child>
<object class="GtkFileChooserButton" id="prefs_backgrounds_backgrounds_night_background_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="filter">image_filter</property>
<property name="preview_widget">night_background_preview</property>
<property name="use_preview_label">False</property>
<property name="title" translatable="yes">Select your background image</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_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>
<property name="expand">True</property>
@@ -2375,14 +2438,46 @@
</packing>
</child>
<child>
<object class="GtkEntry" id="prefs_commands_commands_sunrise_command_entry">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="width_chars">36</property>
<property name="truncate_multiline">True</property>
<property name="placeholder_text" translatable="yes">notify-send "Hello sunshine!"</property>
<child>
<object class="GtkEntry" id="prefs_commands_commands_sunrise_command_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="width_chars">28</property>
<property name="truncate_multiline">True</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>
<packing>
<property name="expand">True</property>
@@ -2434,14 +2529,46 @@
</packing>
</child>
<child>
<object class="GtkEntry" id="prefs_commands_commands_sunset_command_entry">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="width_chars">36</property>
<property name="truncate_multiline">True</property>
<property name="placeholder_text" translatable="yes">notify-send "Hello moonshine!"</property>
<child>
<object class="GtkEntry" id="prefs_commands_commands_sunset_command_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="width_chars">28</property>
<property name="truncate_multiline">True</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>
<packing>
<property name="expand">True</property>