mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 00:11:59 +02:00
Use new PiP icons when available
Use the new "pip-in" and "pip-out" GNOME symbolic icons if user theme has them for enter/leave floating mode button. When icon is unavailable on the host, old icon will be used instead.
This commit is contained in:
@@ -22,6 +22,7 @@ class ClapperHeaderBarBase extends Gtk.Box
|
||||
|
||||
this.isMaximized = false;
|
||||
this.isMenuOnLeft = true;
|
||||
this.hasPipIcons = false;
|
||||
|
||||
const clapperPath = Misc.getClapperPath();
|
||||
const uiBuilder = Gtk.Builder.new_from_file(
|
||||
@@ -213,17 +214,46 @@ class ClapperHeaderBarBase extends Gtk.Box
|
||||
return button;
|
||||
}
|
||||
|
||||
_updateFloatIcon(isFloating)
|
||||
{
|
||||
const floatButton = this.extraButtonsBox.get_first_child();
|
||||
if(!floatButton) return;
|
||||
|
||||
const iconName = (!this.hasPipIcons)
|
||||
? 'go-bottom-symbolic'
|
||||
: (isFloating)
|
||||
? 'pip-out-symbolic'
|
||||
: 'pip-in-symbolic';
|
||||
|
||||
if(floatButton.icon_name !== iconName)
|
||||
floatButton.icon_name = iconName;
|
||||
}
|
||||
|
||||
_onWindowButtonActivate(action)
|
||||
{
|
||||
}
|
||||
|
||||
_onFloatButtonClicked()
|
||||
_onFloatButtonClicked(button)
|
||||
{
|
||||
}
|
||||
|
||||
_onFullscreenButtonClicked()
|
||||
_onFullscreenButtonClicked(button)
|
||||
{
|
||||
}
|
||||
|
||||
_onIconThemeChanged(iconTheme)
|
||||
{
|
||||
/* Those icons are relatively new,
|
||||
* so check if theme has them */
|
||||
this.hasPipIcons = (
|
||||
iconTheme.has_icon('pip-in-symbolic')
|
||||
&& iconTheme.has_icon('pip-out-symbolic')
|
||||
);
|
||||
|
||||
const { controlsRevealer } = this.root.child;
|
||||
|
||||
this._updateFloatIcon(!controlsRevealer.reveal_child);
|
||||
}
|
||||
});
|
||||
|
||||
var HeaderBarPopover = GObject.registerClass(
|
||||
|
Reference in New Issue
Block a user