Merge pull request #151 from Rafostar/comply-gjs

Comply with GJS packaging
This commit is contained in:
Rafał Dzięgiel
2021-09-06 17:56:53 +02:00
committed by GitHub
7 changed files with 30 additions and 42 deletions

View File

@@ -1,17 +0,0 @@
#!@GJS@
/* pkg init enforces the imports path to the folder
* named after the pkg name, but I would prefer to have
* the bundled subprocess stored in the same directory */
imports.searchPath.unshift('@datadir@/@PACKAGE_NAME@');
const Package = imports.package;
Package.init({
name: '@PACKAGE_NAME@.@ID_POSTFIX@',
version: '@PACKAGE_VERSION@',
prefix: '@prefix@',
libdir: '@libdir@',
datadir: '@datadir@',
});
Package.run(imports.src.main@ID_POSTFIX@);

View File

@@ -1,12 +1,10 @@
#!@GJS@ #!@GJS@
const Package = imports.package; imports.package.init({
Package.init({
name: '@PACKAGE_NAME@', name: '@PACKAGE_NAME@',
version: '@PACKAGE_VERSION@', version: '@PACKAGE_VERSION@',
prefix: '@prefix@', prefix: '@prefix@',
libdir: '@libdir@', libdir: '@libdir@',
datadir: '@datadir@', datadir: '@datadir@',
}); });
Package.run(imports.src.main); imports.package.run(imports.src.main@ID_POSTFIX@);

View File

@@ -2,7 +2,6 @@ clapper_apps = ['', 'Remote', 'Daemon']
foreach id_postfix : clapper_apps foreach id_postfix : clapper_apps
app_postfix = (id_postfix != '') ? '.' + id_postfix : '' app_postfix = (id_postfix != '') ? '.' + id_postfix : ''
template_type = (id_postfix != '') ? '.Subprocess' : ''
bin_conf = configuration_data() bin_conf = configuration_data()
bin_conf.set('GJS', find_program('gjs').path()) bin_conf.set('GJS', find_program('gjs').path())
@@ -14,7 +13,7 @@ foreach id_postfix : clapper_apps
bin_conf.set('datadir', join_paths(get_option('prefix'), get_option('datadir'))) bin_conf.set('datadir', join_paths(get_option('prefix'), get_option('datadir')))
configure_file( configure_file(
input: 'com.github.rafostar.Clapper' + template_type + '.in', input: 'com.github.rafostar.Clapper.in',
output: 'com.github.rafostar.Clapper' + app_postfix, output: 'com.github.rafostar.Clapper' + app_postfix,
configuration: bin_conf, configuration: bin_conf,
install: true, install: true,

View File

@@ -1,4 +1,4 @@
const { Gio, GObject, Gtk } = imports.gi; const { Gio, GObject, Gdk, Gtk } = imports.gi;
const { AppBase } = imports.src.appBase; const { AppBase } = imports.src.appBase;
const { Widget } = imports.src.widget; const { Widget } = imports.src.widget;
const Debug = imports.src.debug; const Debug = imports.src.debug;
@@ -43,6 +43,22 @@ class ClapperApp extends AppBase
this._openFilesAsync(files).then(() => this.activate()).catch(debug); 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) _onWindowMap(window)
{ {
window.disconnect(this.mapSignal); window.disconnect(this.mapSignal);

View File

@@ -1,4 +1,4 @@
const { Gio, GLib, GObject, Gdk, Gtk } = imports.gi; const { Gio, GLib, GObject, Gtk } = imports.gi;
const Debug = imports.src.debug; const Debug = imports.src.debug;
const FileOps = imports.src.fileOps; const FileOps = imports.src.fileOps;
const Misc = imports.src.misc; const Misc = imports.src.misc;
@@ -131,16 +131,5 @@ class ClapperAppBase extends Gtk.Application
} }
else if(hasAdwIcons) else if(hasAdwIcons)
window.remove_css_class('adwicons'); window.remove_css_class('adwicons');
const display = Gdk.Display.get_default();
if(!display) return;
const iconTheme = Gtk.IconTheme.get_for_display(display);
if(!iconTheme) return;
const { headerBar } = window.child.revealerTop;
if(!headerBar) return;
headerBar._onIconThemeChanged(iconTheme);
} }
}); });

View File

@@ -28,4 +28,12 @@ class ClapperHeaderBar extends HeaderBarBase
{ {
this.root.fullscreen(); this.root.fullscreen();
} }
_onIconThemeChanged(iconTheme)
{
super._onIconThemeChanged(iconTheme);
const { controlsRevealer } = this.root.child;
this._updateFloatIcon(!controlsRevealer.reveal_child);
}
}); });

View File

@@ -245,16 +245,11 @@ class ClapperHeaderBarBase extends Gtk.Box
_onIconThemeChanged(iconTheme) _onIconThemeChanged(iconTheme)
{ {
/* Those icons are relatively new, /* Those icons are new, so check if theme has them */
* so check if theme has them */
this.hasPipIcons = ( this.hasPipIcons = (
iconTheme.has_icon('pip-in-symbolic') iconTheme.has_icon('pip-in-symbolic')
&& iconTheme.has_icon('pip-out-symbolic') && iconTheme.has_icon('pip-out-symbolic')
); );
const { controlsRevealer } = this.root.child;
this._updateFloatIcon(!controlsRevealer.reveal_child);
} }
}); });