From 98d2b80103932dd45c0ffd010255e4c6245fcbbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Tue, 7 Sep 2021 19:34:51 +0200 Subject: [PATCH] Add PiP and play icons as gresource Add missing PiP icons from web devel kit. Also add play/pause icons at the right size and remove all workarounds/scaling implemented or these two. Playback icons are always two bars for pause and triangle for play, so hopefully this will not be problematic, as this guaranties the right size for them that Adwaita unfortunately cannot provide. --- css/styles.css | 9 -- ...github.rafostar.Clapper.data.gresource.xml | 9 ++ data/icons/pause-symbolic.svg | 7 ++ data/icons/pip-in-symbolic.svg | 112 ++++++++++++++++++ data/icons/pip-out-symbolic.svg | 112 ++++++++++++++++++ data/icons/play-symbolic.svg | 4 + data/meson.build | 6 + lib/gst/clapper/meson.build | 2 - meson.build | 3 + src/app.js | 16 --- src/appBase.js | 35 +----- src/controls.js | 5 +- src/headerbar.js | 8 -- src/headerbarBase.js | 16 +-- src/player.js | 6 - src/widgetRemote.js | 5 +- 16 files changed, 263 insertions(+), 92 deletions(-) create mode 100644 data/com.github.rafostar.Clapper.data.gresource.xml create mode 100644 data/icons/pause-symbolic.svg create mode 100644 data/icons/pip-in-symbolic.svg create mode 100644 data/icons/pip-out-symbolic.svg create mode 100644 data/icons/play-symbolic.svg diff --git a/css/styles.css b/css/styles.css index cbdb7547..ec400cec 100644 --- a/css/styles.css +++ b/css/styles.css @@ -98,9 +98,6 @@ scale trough slider { font-size: 21px; font-weight: 500; } -.adwicons .clappercontrols { - margin-bottom: -1px; -} .clappercontrols { margin-left: 2px; margin-right: 2px; @@ -136,12 +133,6 @@ scale trough slider { .fullscreen.tvmode .clappercontrols button image { -gtk-icon-size: 24px; } -.adwicons .playbackicon { - -gtk-icon-size: 20px; -} -.adwicons.fullscreen.tvmode .playbackicon { - -gtk-icon-size: 28px; -} .clappercontrolsbutton.text-button label { font-family: 'Cantarell', sans-serif; font-variant-numeric: tabular-nums; diff --git a/data/com.github.rafostar.Clapper.data.gresource.xml b/data/com.github.rafostar.Clapper.data.gresource.xml new file mode 100644 index 00000000..354d467e --- /dev/null +++ b/data/com.github.rafostar.Clapper.data.gresource.xml @@ -0,0 +1,9 @@ + + + + icons/play-symbolic.svg + icons/pause-symbolic.svg + icons/pip-in-symbolic.svg + icons/pip-out-symbolic.svg + + diff --git a/data/icons/pause-symbolic.svg b/data/icons/pause-symbolic.svg new file mode 100644 index 00000000..f2804257 --- /dev/null +++ b/data/icons/pause-symbolic.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/data/icons/pip-in-symbolic.svg b/data/icons/pip-in-symbolic.svg new file mode 100644 index 00000000..c3d488ad --- /dev/null +++ b/data/icons/pip-in-symbolic.svg @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/icons/pip-out-symbolic.svg b/data/icons/pip-out-symbolic.svg new file mode 100644 index 00000000..6e9c10d0 --- /dev/null +++ b/data/icons/pip-out-symbolic.svg @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/icons/play-symbolic.svg b/data/icons/play-symbolic.svg new file mode 100644 index 00000000..c3499170 --- /dev/null +++ b/data/icons/play-symbolic.svg @@ -0,0 +1,4 @@ + + + + diff --git a/data/meson.build b/data/meson.build index 49e37d72..f897a2b9 100644 --- a/data/meson.build +++ b/data/meson.build @@ -19,3 +19,9 @@ install_data('com.github.rafostar.Clapper.desktop', install_data('com.github.rafostar.Clapper.metainfo.xml', install_dir: join_paths(sharedir, 'metainfo') ) +gnome.compile_resources('com.github.rafostar.Clapper.data', + 'com.github.rafostar.Clapper.data.gresource.xml', + gresource_bundle: true, + install: true, + install_dir: pkgdatadir, +) diff --git a/lib/gst/clapper/meson.build b/lib/gst/clapper/meson.build index ed4e4efe..b54d0e99 100644 --- a/lib/gst/clapper/meson.build +++ b/lib/gst/clapper/meson.build @@ -1,5 +1,3 @@ -gnome = import('gnome') - gstclapper_sources = [ 'gstclapper.c', 'gstclapper-signal-dispatcher.c', diff --git a/meson.build b/meson.build index 5e706f90..3cb10da6 100644 --- a/meson.build +++ b/meson.build @@ -8,10 +8,13 @@ project('com.github.rafostar.Clapper', 'c', 'cpp', ] ) +gnome = import('gnome') i18n = import('i18n') python = import('python') python_bin = python.find_installation('python3') +pkgdatadir = join_paths(get_option('datadir'), meson.project_name()) + if not python_bin.found() error('No valid python3 binary found') endif diff --git a/src/app.js b/src/app.js index 9ce377da..e888cc83 100644 --- a/src/app.js +++ b/src/app.js @@ -43,22 +43,6 @@ class ClapperApp extends AppBase this._openFilesAsync(files).then(() => this.activate()).catch(debug); } - _onIconThemeChanged(gtkSettings) - { - super._onIconThemeChanged(gtkSettings); - - const display = Gdk.Display.get_default(); - if(!display) return; - - const iconTheme = Gtk.IconTheme.get_for_display(display); - if(!iconTheme) return; - - const { headerBar } = this.active_window.child.revealerTop; - if(!headerBar) return; - - headerBar._onIconThemeChanged(iconTheme); - } - _onWindowMap(window) { window.disconnect(this.mapSignal); diff --git a/src/appBase.js b/src/appBase.js index d24cc263..0a40d6c9 100644 --- a/src/appBase.js +++ b/src/appBase.js @@ -31,6 +31,10 @@ class ClapperAppBase extends Gtk.Application title: Misc.appName, }); + /* FIXME: AFAIK there is no way to detect theme rounded corners. + * Having 2/4 corners rounded in floating mode is not good. */ + window.add_css_class('adwrounded'); + if(!settings.get_boolean('render-shadows')) window.add_css_class('gpufriendly'); @@ -99,37 +103,6 @@ class ClapperAppBase extends Gtk.Application 'gtk-application-prefer-dark-theme', Gio.SettingsBindFlags.GET ); - this._onThemeChanged(gtkSettings); - this._onIconThemeChanged(gtkSettings); - gtkSettings.connect('notify::gtk-theme-name', this._onThemeChanged.bind(this)); - gtkSettings.connect('notify::gtk-icon-theme-name', this._onIconThemeChanged.bind(this)); this.doneFirstActivate = true; } - - _onThemeChanged(gtkSettings) - { - const theme = gtkSettings.gtk_theme_name; - const window = this.active_window; - - debug(`user selected theme: ${theme}`); - - /* FIXME: AFAIK there is no way to detect theme rounded corners. - Having 2/4 corners rounded in floating mode is not good. */ - if(!window.has_css_class('adwrounded')) - window.add_css_class('adwrounded'); - } - - _onIconThemeChanged(gtkSettings) - { - const iconThemeName = gtkSettings.gtk_icon_theme_name; - const window = this.active_window; - const hasAdwIcons = window.has_css_class('adwicons'); - - if(iconThemeName === 'Adwaita' || iconThemeName === 'Default') { - if(!hasAdwIcons) - window.add_css_class('adwicons'); - } - else if(hasAdwIcons) - window.remove_css_class('adwicons'); - } }); diff --git a/src/controls.js b/src/controls.js index ca8d5880..82b0dfad 100644 --- a/src/controls.js +++ b/src/controls.js @@ -37,10 +37,9 @@ class ClapperControls extends Gtk.Box this.chapterHideId = null; this.togglePlayButton = new Buttons.IconToggleButton( - 'media-playback-start-symbolic', - 'media-playback-pause-symbolic' + 'play-symbolic', + 'pause-symbolic' ); - this.togglePlayButton.child.add_css_class('playbackicon'); this.togglePlayButton.connect( 'clicked', this._onTogglePlayClicked.bind(this) ); diff --git a/src/headerbar.js b/src/headerbar.js index 497b13e9..d41a519f 100644 --- a/src/headerbar.js +++ b/src/headerbar.js @@ -28,12 +28,4 @@ class ClapperHeaderBar extends HeaderBarBase { this.root.fullscreen(); } - - _onIconThemeChanged(iconTheme) - { - super._onIconThemeChanged(iconTheme); - - const { controlsRevealer } = this.root.child; - this._updateFloatIcon(!controlsRevealer.reveal_child); - } }); diff --git a/src/headerbarBase.js b/src/headerbarBase.js index 63ce1e9c..46950070 100644 --- a/src/headerbarBase.js +++ b/src/headerbarBase.js @@ -23,7 +23,6 @@ class ClapperHeaderBarBase extends Gtk.Box this.isMaximized = false; this.isMenuOnLeft = true; - this.hasPipIcons = false; const uiBuilder = Misc.getBuilderForName('clapper.ui'); @@ -53,7 +52,7 @@ class ClapperHeaderBarBase extends Gtk.Box this.extraButtonsBox.add_css_class('linked'); const floatButton = new Gtk.Button({ - icon_name: 'go-bottom-symbolic', + icon_name: 'pip-in-symbolic', can_focus: false, }); floatButton.add_css_class('osd'); @@ -221,9 +220,7 @@ class ClapperHeaderBarBase extends Gtk.Box const floatButton = this.extraButtonsBox.get_first_child(); if(!floatButton) return; - const iconName = (!this.hasPipIcons) - ? 'go-bottom-symbolic' - : (isFloating) + const iconName = (isFloating) ? 'pip-out-symbolic' : 'pip-in-symbolic'; @@ -242,15 +239,6 @@ class ClapperHeaderBarBase extends Gtk.Box _onFullscreenButtonClicked(button) { } - - _onIconThemeChanged(iconTheme) - { - /* Those icons are new, so check if theme has them */ - this.hasPipIcons = ( - iconTheme.has_icon('pip-in-symbolic') - && iconTheme.has_icon('pip-out-symbolic') - ); - } }); var HeaderBarPopover = GObject.registerClass({ diff --git a/src/player.js b/src/player.js index b2ff737e..be0aeae3 100644 --- a/src/player.js +++ b/src/player.js @@ -676,12 +676,6 @@ class ClapperPlayer extends GstClapper.Clapper this.set_audio_video_offset(value); debug(`set audio-video offset: ${value}`); break; - case 'dark-theme': - root = this.widget.get_root(); - if(!root) break; - - root.application._onThemeChanged(Gtk.Settings.get_default()); - break; case 'play-flags': const initialFlags = this.pipeline.flags; const settingsFlags = settings.get_int(key); diff --git a/src/widgetRemote.js b/src/widgetRemote.js index 1e6d75a8..06ea269f 100644 --- a/src/widgetRemote.js +++ b/src/widgetRemote.js @@ -23,11 +23,10 @@ class ClapperWidgetRemote extends Gtk.Grid /* FIXME: create better way to add buttons for * remote app without duplicating too much code */ this.togglePlayButton = new Buttons.IconToggleButton( - 'media-playback-start-symbolic', - 'media-playback-pause-symbolic' + 'play-symbolic', + 'pause-symbolic' ); this.togglePlayButton.remove_css_class('flat'); - this.togglePlayButton.child.add_css_class('playbackicon'); this.togglePlayButton.connect( 'clicked', () => this.sendWs('toggle_play') );