Commit e571f424 authored by Javad Rahmatzadeh's avatar Javad Rahmatzadeh
Browse files

remove prefs intro

Fixes #125
parent a373afaa
......@@ -22,6 +22,7 @@ We go to the next version after each release on [GNOME Shell Extensions website]
### Removed
- Gesture API for GNOME Shell 40 and higher.
- Prefs intro.
## [20.0.0 Hayez] - 2022-04-01
......
......@@ -61,15 +61,15 @@ var Prefs = class
* @member {number}
*/
this._windowWidth = 500;
this._windowHeight = 880;
this._windowHeight = 500;
/**
* initial window size for adw
*
* @member {number}
*/
this._windowWidthAdw = 550;
this._windowHeightAdw = 920;
this._windowWidthAdw = 500;
this._windowHeightAdw = 500;
/**
* holds all profile names
......@@ -125,7 +125,6 @@ var Prefs = class
window.add(page);
}
this._prepareIntro(binFolderPath);
this._setValues();
this._guessProfile();
this._onlyShowSupportedRows();
......@@ -154,7 +153,6 @@ var Prefs = class
'main',
'no-results-found',
'profile',
'intro',
'override',
'visibility',
'icons',
......@@ -189,7 +187,6 @@ var Prefs = class
}
this._setListBoxSeparators();
this._prepareIntro(binFolderPath);
this._convertComboBoxTextToDropDown();
this._fixIconObjects();
this._setValues();
......@@ -297,76 +294,6 @@ var Prefs = class
return [geo.width, geo.height, scale];
}
/**
* prepare intro
*
* @param string binFolderPath bin folder path
*
* @returns {void}
*/
_prepareIntro(binFolderPath)
{
let introImgPath = `${binFolderPath}/intro.png`;
let intro = this._builder.get_object('intro');
let imgFile = this._gio.File.new_for_path(introImgPath);
if (!imgFile.query_exists(null)) {
(!this._isAdw) && this._builder.get_object('primary_menu').remove(0);
intro.visible = false;
if (this._isAdw) {
this._builder.get_object('prefs_group').visible = false;
}
return;
}
let imageBox = this._builder.get_object('intro_image_box');
let img;
if (this._gtkVersion === 3) {
img = this._gtk.Image.new_from_file(introImgPath);
img.visible = true;
img.set_size_request(530, 680);
imageBox.add(img);
} else {
img = this._gtk.Picture.new_for_filename(introImgPath);
img.set_can_shrink(false);
imageBox.append(img);
}
if (this._isAdw) {
let elm = this._builder.get_object('prefs_intro_switch');
let show = this._settings.get_boolean('show-prefs-intro');
elm.set_active(show);
intro.visible = show;
}
this._introPrepared = true;
}
/**
* show intro
*
* @returns {void}
*/
_showIntro()
{
let intro = this._builder.get_object('intro');
let show = this._settings.get_boolean('show-prefs-intro');
intro.visible = (this._introPrepared && show) ? true : false;
}
/**
* hide intro
*
* @returns {void}
*/
_hideIntro()
{
let intro = this._builder.get_object('intro');
intro.visible = false;
}
/**
* fix images that holding icons for GTK4
*
......@@ -455,7 +382,6 @@ var Prefs = class
this._registerSearchSignals(window);
this._registerFileChooserSignals(window);
this._registerProfileSignals();
this._registerPrefsIntroSignals();
this._registerActionSignals(window);
}
......@@ -617,29 +543,6 @@ var Prefs = class
}
}
/**
* register prefs intro signals
*
* @returns {void}
*/
_registerPrefsIntroSignals()
{
this._settings.connect('changed::show-prefs-intro', (s) => {
if (s.get_boolean('show-prefs-intro')) {
this._showIntro();
} else {
this._hideIntro();
}
});
if (this._isAdw) {
let prefsSwitch = this._builder.get_object('prefs_intro_switch');
prefsSwitch.connect('state-set', (w) => {
this._settings.set_boolean('show-prefs-intro', w.get_active());
});
}
}
/**
* register action signals
*
......@@ -667,21 +570,6 @@ var Prefs = class
});
actionGroup.add_action(action2);
if (this._introPrepared) {
let showPrefsIntro = this._settings.get_boolean('show-prefs-intro');
let action3 = this._gio.SimpleAction.new_stateful(
'show-intro',
null,
this._glib.Variant.new_boolean(showPrefsIntro),
);
action3.connect('activate', () => {
let show = this._settings.get_boolean('show-prefs-intro');
this._settings.set_boolean('show-prefs-intro', !show);
action3.change_state(this._glib.Variant.new_boolean(!show));
});
actionGroup.add_action(action3);
}
window.insert_action_group('prefs', actionGroup);
}
......@@ -908,12 +796,6 @@ var Prefs = class
profile.visible = (q === '') ? true : false;
}
if (q === '') {
this._showIntro();
} else {
this._hideIntro();
}
for (let [, key] of Object.entries(this._prefsKeys.keys)) {
if (categories[key.category] === undefined) {
......@@ -947,3 +829,4 @@ var Prefs = class
notFound.visible = noResultsFoundVisibility;
}
};
......@@ -4,12 +4,6 @@
<schema id="org.gnome.shell.extensions.just-perfection"
path="/org/gnome/shell/extensions/just-perfection/">
<key type="b" name="show-prefs-intro">
<default>true</default>
<summary>Show Prefs Intro</summary>
<description>Show Prefs Intro Status</description>
</key>
<key type="b" name="panel">
<default>true</default>
<summary>Panel</summary>
......
......@@ -105,42 +105,6 @@
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="intro">
<child>
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="valign">center</property>
<property name="halign">center</property>
<child>
<object class="GtkLinkButton">
<property name="can-focus">True</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="hexpand">0</property>
<property name="vexpand">0</property>
<property name="uri">https://www.patreon.com/justperfection</property>
<child>
<object class="GtkBox" id="intro_image_box">
<property name="can-focus">False</property>
<property name="halign">center</property>
<property name="orientation">vertical</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="override_group">
<property name="title" translatable="yes">Override</property>
......@@ -161,25 +125,6 @@
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="prefs_group">
<property name="title" translatable="yes">Preferences Intro</property>
<child>
<object class="AdwActionRow" id="prefs_intro_row">
<property name="title" translatable="yes">Preferences Intro</property>
<property name="activatable-widget">prefs_intro_switch</property>
<child>
<object class="GtkSwitch" id="prefs_intro_switch">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="support_group">
<property name="title" translatable="yes">Links</property>
......
<?xml version="1.0" encoding="UTF-8"?>
?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkBox" id="intro">
......
......@@ -5,12 +5,6 @@
<!-- MENU -->
<menu id="primary_menu">
<section>
<item>
<attribute name="label" translatable="yes">Preferences Intro</attribute>
<attribute name="action">prefs.show-intro</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Bug Report</attribute>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment