mirror of
https://github.com/oleid/gnome-shell-teatime.git
synced 2022-04-29 18:53:50 +00:00
Clean-up globals and eliminate warnings on Gnome-3.26
This commit is contained in:
parent
5a58727a67
commit
ce26373bd7
@ -1,18 +1,15 @@
|
|||||||
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
|
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: t -*- */
|
||||||
/* Olaf Leidinger <oleid@mescharet.de>
|
/* Olaf Leidinger <oleid@mescharet.de>
|
||||||
Thomas Liebetraut <thomas@tommie-lie.de>
|
Thomas Liebetraut <thomas@tommie-lie.de>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const Gdk = imports.gi.Gdk;
|
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const GLib = imports.gi.GLib;
|
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Mainloop = imports.mainloop; // timer
|
const Mainloop = imports.mainloop; // timer
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const Layout = imports.ui.layout;
|
const Layout = imports.ui.layout;
|
||||||
const FileUtils = imports.misc.fileUtils;
|
|
||||||
|
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const MessageTray = imports.ui.messageTray;
|
const MessageTray = imports.ui.messageTray;
|
||||||
@ -25,8 +22,6 @@ const Me = ExtensionUtils.getCurrentExtension();
|
|||||||
const Utils = Me.imports.utils;
|
const Utils = Me.imports.utils;
|
||||||
const Icon = Me.imports.icon;
|
const Icon = Me.imports.icon;
|
||||||
|
|
||||||
const bUseGnome34Workarounds = imports.misc.extensionUtils.versionCheck(["3.4"], imports.misc.config.PACKAGE_VERSION);
|
|
||||||
|
|
||||||
const _ = Utils.getTranslationFunc();
|
const _ = Utils.getTranslationFunc();
|
||||||
const N_ = function (e) {
|
const N_ = function (e) {
|
||||||
return e;
|
return e;
|
||||||
@ -194,9 +189,9 @@ const TeaTime = new Lang.Class({
|
|||||||
},
|
},
|
||||||
_createMenu: function () {
|
_createMenu: function () {
|
||||||
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
||||||
this._settings.connect("changed::" + Utils.TEATIME_STEEP_TIMES_KEY,
|
this._settings.connect("changed::" + this.config_keys.steep_times,
|
||||||
Lang.bind(this, this._updateTeaList));
|
Lang.bind(this, this._updateTeaList));
|
||||||
this._settings.connect("changed::" + Utils.TEATIME_GRAPHICAL_COUNTDOWN_KEY,
|
this._settings.connect("changed::" + this.config_keys.graphical_countdown,
|
||||||
Lang.bind(this, this._updateCountdownType));
|
Lang.bind(this, this._updateCountdownType));
|
||||||
|
|
||||||
this.teaItemCont = new PopupMenu.PopupMenuSection();
|
this.teaItemCont = new PopupMenu.PopupMenuSection();
|
||||||
@ -236,7 +231,7 @@ const TeaTime = new Lang.Class({
|
|||||||
this.teaItemCont.removeAll();
|
this.teaItemCont.removeAll();
|
||||||
|
|
||||||
// fill with new teas
|
// fill with new teas
|
||||||
let list = this._settings.get_value(Utils.TEATIME_STEEP_TIMES_KEY).unpack();
|
let list = this._settings.get_value(this.config_keys.steep_times).unpack();
|
||||||
for (let teaname in list) {
|
for (let teaname in list) {
|
||||||
let time = list[teaname].get_uint32();
|
let time = list[teaname].get_uint32();
|
||||||
|
|
||||||
@ -248,7 +243,7 @@ const TeaTime = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
_updateCountdownType: function (config, output) {
|
_updateCountdownType: function (config, output) {
|
||||||
let bWantGraphicalCountdown = this._settings.get_boolean(Utils.TEATIME_GRAPHICAL_COUNTDOWN_KEY);
|
let bWantGraphicalCountdown = this._settings.get_boolean(this.config_keys.graphical_countdown);
|
||||||
|
|
||||||
if (bWantGraphicalCountdown != this._bGraphicalCountdown) {
|
if (bWantGraphicalCountdown != this._bGraphicalCountdown) {
|
||||||
if (this._idleTimeout != null) {
|
if (this._idleTimeout != null) {
|
||||||
@ -286,11 +281,11 @@ const TeaTime = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
_showNotification: function (subject, text) {
|
_showNotification: function (subject, text) {
|
||||||
let source = (bUseGnome34Workarounds) ?
|
let source = (Utils.isGnome34()) ?
|
||||||
new MessageTray.Source(_("TeaTime applet")) :
|
new MessageTray.Source(_("TeaTime applet")) :
|
||||||
new MessageTray.Source(_("TeaTime applet"), 'utilities-teatime');
|
new MessageTray.Source(_("TeaTime applet"), 'utilities-teatime');
|
||||||
|
|
||||||
if (bUseGnome34Workarounds) {
|
if (Utils.isGnome34()) {
|
||||||
source.createNotificationIcon =
|
source.createNotificationIcon =
|
||||||
function () {
|
function () {
|
||||||
let iconBox = new St.Bin();
|
let iconBox = new St.Bin();
|
||||||
@ -315,7 +310,7 @@ const TeaTime = new Lang.Class({
|
|||||||
this._stopTime = new Date();
|
this._stopTime = new Date();
|
||||||
this._cntdownStart = time;
|
this._cntdownStart = time;
|
||||||
|
|
||||||
this._bGraphicalCountdown = this._settings.get_boolean(Utils.TEATIME_GRAPHICAL_COUNTDOWN_KEY);
|
this._bGraphicalCountdown = this._settings.get_boolean(this.config_keys.graphical_countdown);
|
||||||
|
|
||||||
let dt = this._bGraphicalCountdown ?
|
let dt = this._bGraphicalCountdown ?
|
||||||
Math.max(1.0, time / 90) // set time step to fit animation
|
Math.max(1.0, time / 90) // set time step to fit animation
|
||||||
@ -355,7 +350,7 @@ const TeaTime = new Lang.Class({
|
|||||||
this.actor.add_actor(this._logo);
|
this.actor.add_actor(this._logo);
|
||||||
this._playSound();
|
this._playSound();
|
||||||
|
|
||||||
if (!bUseGnome34Workarounds && this._settings.get_boolean(Utils.TEATIME_FULLSCREEN_NOTIFICATION_KEY)) {
|
if (!Utils.isGnome34() && this._settings.get_boolean(this.config_keys.fullscreen_notification)) {
|
||||||
this.dialog = new TeaTimeFullscreenNotification();
|
this.dialog = new TeaTimeFullscreenNotification();
|
||||||
this.dialog.show();
|
this.dialog.show();
|
||||||
} else {
|
} else {
|
||||||
@ -371,9 +366,9 @@ const TeaTime = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
_playSound: function () {
|
_playSound: function () {
|
||||||
let bPlayAlarmSound = this._settings.get_boolean(Utils.TEATIME_USE_ALARM_SOUND_KEY);
|
let bPlayAlarmSound = this._settings.get_boolean(this.config_keys.use_alarm_sound);
|
||||||
if (bPlayAlarmSound) {
|
if (bPlayAlarmSound) {
|
||||||
Utils.playSound(this._settings.get_string(Utils.TEATIME_ALARM_SOUND_KEY));
|
Utils.playSound(this._settings.get_string(this.config_keys.alarm_sound));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_showPreferences: function () {
|
_showPreferences: function () {
|
||||||
@ -404,7 +399,8 @@ const TeaTime = new Lang.Class({
|
|||||||
let scaling = Utils.getGlobalDisplayScaleFactor();
|
let scaling = Utils.getGlobalDisplayScaleFactor();
|
||||||
this._logo.setScaling(scaling);
|
this._logo.setScaling(scaling);
|
||||||
this._graphicalTimer.setScaling(scaling);
|
this._graphicalTimer.setScaling(scaling);
|
||||||
}
|
},
|
||||||
|
config_keys: Utils.GetConfigKeys()
|
||||||
});
|
});
|
||||||
|
|
||||||
function init(metadata) {
|
function init(metadata) {
|
||||||
|
@ -17,7 +17,7 @@ const ExUt = imports.misc.extensionUtils;
|
|||||||
const Me = ExUt.getCurrentExtension();
|
const Me = ExUt.getCurrentExtension();
|
||||||
const Utils = Me.imports.utils;
|
const Utils = Me.imports.utils;
|
||||||
|
|
||||||
const TwoColorIcon = new Lang.Class({
|
var TwoColorIcon = new Lang.Class({
|
||||||
Name: 'TwoColorIcon',
|
Name: 'TwoColorIcon',
|
||||||
Extends: St.DrawingArea,
|
Extends: St.DrawingArea,
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ const TwoColorIcon = new Lang.Class({
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const TeaPot = {
|
var TeaPot = {
|
||||||
width: 484,
|
width: 484,
|
||||||
height: 295,
|
height: 295,
|
||||||
draw: function (cr, stat, primary, secundary) {
|
draw: function (cr, stat, primary, secundary) {
|
||||||
@ -130,7 +130,7 @@ const TeaPot = {
|
|||||||
}; // TeaPot
|
}; // TeaPot
|
||||||
|
|
||||||
|
|
||||||
const Pie = {
|
var Pie = {
|
||||||
width: 1,
|
width: 1,
|
||||||
height: 1,
|
height: 1,
|
||||||
draw: function (cr, stat, primary, secundary) {
|
draw: function (cr, stat, primary, secundary) {
|
||||||
|
51
src/prefs.js
51
src/prefs.js
@ -1,14 +1,8 @@
|
|||||||
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
|
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: t -*- */
|
||||||
/* Olaf Leidinger <oleid@mescharet.de>
|
/* Olaf Leidinger <oleid@mescharet.de>
|
||||||
Thomas Liebetraut <thomas@tommie-lie.de>
|
Thomas Liebetraut <thomas@tommie-lie.de>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const Gdk = imports.gi.Gdk;
|
|
||||||
const Gio = imports.gi.Gio;
|
|
||||||
const GLib = imports.gi.GLib;
|
|
||||||
const Mainloop = imports.mainloop; // timer
|
|
||||||
const Clutter = imports.gi.Clutter;
|
|
||||||
|
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Gtk = imports.gi.Gtk;
|
const Gtk = imports.gi.Gtk;
|
||||||
const GObject = imports.gi.GObject;
|
const GObject = imports.gi.GObject;
|
||||||
@ -17,15 +11,12 @@ const ExtensionUtils = imports.misc.extensionUtils;
|
|||||||
const Me = ExtensionUtils.getCurrentExtension();
|
const Me = ExtensionUtils.getCurrentExtension();
|
||||||
const Utils = Me.imports.utils;
|
const Utils = Me.imports.utils;
|
||||||
|
|
||||||
const bUseGnome34Workarounds = imports.misc.extensionUtils.versionCheck(["3.4"], imports.misc.config.PACKAGE_VERSION);
|
|
||||||
|
|
||||||
const _ = Utils.getTranslationFunc();
|
const _ = Utils.getTranslationFunc();
|
||||||
const N_ = function (e) {
|
const N_ = function (e) {
|
||||||
return e;
|
return e;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const Columns = {
|
const Columns = {
|
||||||
TEA_NAME: 0,
|
TEA_NAME: 0,
|
||||||
STEEP_TIME: 1,
|
STEEP_TIME: 1,
|
||||||
@ -104,7 +95,7 @@ const TeaTimePrefsWidget = new Lang.Class({
|
|||||||
this.alarmSoundFile.connect("selection_changed", Lang.bind(this, this._saveSoundFile));
|
this.alarmSoundFile.connect("selection_changed", Lang.bind(this, this._saveSoundFile));
|
||||||
|
|
||||||
|
|
||||||
if (!bUseGnome34Workarounds) {
|
if (!Utils.isGnome34()) {
|
||||||
// Full screen notifications currently not working on GNOME 3.4, thus don't show the switch
|
// Full screen notifications currently not working on GNOME 3.4, thus don't show the switch
|
||||||
this.attach(labelFN, 0 /*col*/ , curRow /*row*/ , 2 /*col span*/ , 1 /*row span*/ );
|
this.attach(labelFN, 0 /*col*/ , curRow /*row*/ , 2 /*col span*/ , 1 /*row span*/ );
|
||||||
this.attach(this.fullscreenNotificationSwitch, 2, curRow, 1, 1);
|
this.attach(this.fullscreenNotificationSwitch, 2, curRow, 1, 1);
|
||||||
@ -191,12 +182,13 @@ const TeaTimePrefsWidget = new Lang.Class({
|
|||||||
if (this._inhibitUpdate)
|
if (this._inhibitUpdate)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.fullscreenNotificationSwitch.active = this._settings.get_boolean(Utils.TEATIME_FULLSCREEN_NOTIFICATION_KEY)
|
this.fullscreenNotificationSwitch.active = this._settings.get_boolean(this.config_keys.fullscreen_notification)
|
||||||
|
|
||||||
this.graphicalCountdownSwitch.active = this._settings.get_boolean(Utils.TEATIME_GRAPHICAL_COUNTDOWN_KEY)
|
this.graphicalCountdownSwitch.active = this._settings.get_boolean(this.config_keys.graphical_countdown)
|
||||||
this.alarmSoundSwitch.active = this._settings.get_boolean(Utils.TEATIME_USE_ALARM_SOUND_KEY)
|
this.alarmSoundSwitch.active = this._settings.get_boolean(this.config_keys.use_alarm_sound)
|
||||||
let list = this._settings.get_value(Utils.TEATIME_STEEP_TIMES_KEY).unpack();
|
let list = this._settings.get_value(this.config_keys.steep_times).unpack();
|
||||||
this.alarmSoundFile.set_uri(this._settings.get_string(Utils.TEATIME_ALARM_SOUND_KEY));
|
let file_name = this._settings.get_string(this.config_keys.alarm_sound);
|
||||||
|
this.alarmSoundFile.set_uri(file_name);
|
||||||
|
|
||||||
// stop everyone from reacting to the changes we are about to produce
|
// stop everyone from reacting to the changes we are about to produce
|
||||||
// in the model
|
// in the model
|
||||||
@ -251,7 +243,7 @@ const TeaTimePrefsWidget = new Lang.Class({
|
|||||||
if (this._inhibitUpdate)
|
if (this._inhibitUpdate)
|
||||||
return;
|
return;
|
||||||
this._inhibitUpdate = true;
|
this._inhibitUpdate = true;
|
||||||
this._settings.set_boolean(Utils.TEATIME_FULLSCREEN_NOTIFICATION_KEY,
|
this._settings.set_boolean(this.config_keys.fullscreen_notification,
|
||||||
sw.active);
|
sw.active);
|
||||||
this._inhibitUpdate = false;
|
this._inhibitUpdate = false;
|
||||||
},
|
},
|
||||||
@ -260,7 +252,7 @@ const TeaTimePrefsWidget = new Lang.Class({
|
|||||||
if (this._inhibitUpdate)
|
if (this._inhibitUpdate)
|
||||||
return;
|
return;
|
||||||
this._inhibitUpdate = true;
|
this._inhibitUpdate = true;
|
||||||
this._settings.set_boolean(Utils.TEATIME_GRAPHICAL_COUNTDOWN_KEY,
|
this._settings.set_boolean(this.config_keys.graphical_countdown,
|
||||||
sw.active);
|
sw.active);
|
||||||
this._inhibitUpdate = false;
|
this._inhibitUpdate = false;
|
||||||
},
|
},
|
||||||
@ -269,7 +261,7 @@ const TeaTimePrefsWidget = new Lang.Class({
|
|||||||
if (this._inhibitUpdate)
|
if (this._inhibitUpdate)
|
||||||
return;
|
return;
|
||||||
this._inhibitUpdate = true;
|
this._inhibitUpdate = true;
|
||||||
this._settings.set_boolean(Utils.TEATIME_USE_ALARM_SOUND_KEY,
|
this._settings.set_boolean(this.config_keys.use_alarm_sound,
|
||||||
sw.active);
|
sw.active);
|
||||||
this._inhibitUpdate = false;
|
this._inhibitUpdate = false;
|
||||||
},
|
},
|
||||||
@ -277,17 +269,23 @@ const TeaTimePrefsWidget = new Lang.Class({
|
|||||||
// don't update the backend if someone else is messing with the model
|
// don't update the backend if someone else is messing with the model
|
||||||
if (this._inhibitUpdate)
|
if (this._inhibitUpdate)
|
||||||
return;
|
return;
|
||||||
if (this._settings.get_string(Utils.TEATIME_ALARM_SOUND_KEY) != this.alarmSoundFile.get_uri()) {
|
let alarm_sound = this.alarmSoundFile.get_uri();
|
||||||
|
Utils.debug(this._settings.get_string(this.config_keys.alarm_sound) + "-->" + alarm_sound);
|
||||||
|
|
||||||
|
let have_value = Utils.isType(alarm_sound, "string");
|
||||||
|
let setting_is_different =
|
||||||
|
this._settings.get_string(this.config_keys.alarm_sound) != alarm_sound;
|
||||||
|
if (have_value && setting_is_different) {
|
||||||
this._inhibitUpdate = true;
|
this._inhibitUpdate = true;
|
||||||
|
|
||||||
let uri = this.alarmSoundFile.get_uri();
|
Utils.playSound(alarm_sound);
|
||||||
|
this._settings.set_string(this.config_keys.alarm_sound, alarm_sound);
|
||||||
Utils.playSound(uri);
|
|
||||||
this._settings.set_string(Utils.TEATIME_ALARM_SOUND_KEY, uri);
|
|
||||||
this._inhibitUpdate = false;
|
this._inhibitUpdate = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_save: function (store, path_, iter_) {
|
_save: function (store, path_, iter_) {
|
||||||
|
const GLib = imports.gi.GLib;
|
||||||
|
|
||||||
// don't update the backend if someone else is messing with the model
|
// don't update the backend if someone else is messing with the model
|
||||||
if (this._inhibitUpdate)
|
if (this._inhibitUpdate)
|
||||||
return;
|
return;
|
||||||
@ -304,10 +302,11 @@ const TeaTimePrefsWidget = new Lang.Class({
|
|||||||
// disable updating it here to avoid an infinite loop
|
// disable updating it here to avoid an infinite loop
|
||||||
this._inhibitUpdate = true;
|
this._inhibitUpdate = true;
|
||||||
|
|
||||||
this._settings.set_value(Utils.TEATIME_STEEP_TIMES_KEY, settingsValue);
|
this._settings.set_value(this.config_keys.steep_times, settingsValue);
|
||||||
|
|
||||||
this._inhibitUpdate = false;
|
this._inhibitUpdate = false;
|
||||||
}
|
},
|
||||||
|
config_keys: Utils.GetConfigKeys()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
42
src/utils.js
42
src/utils.js
@ -1,20 +1,9 @@
|
|||||||
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
|
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: t -*- */
|
||||||
/* Olaf Leidinger <oleid@mescharet.de>
|
/* Olaf Leidinger <oleid@mescharet.de>
|
||||||
Thomas Liebetraut <thomas@tommie-lie.de>
|
Thomas Liebetraut <thomas@tommie-lie.de>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const Gio = imports.gi.Gio;
|
|
||||||
const Lang = imports.lang;
|
|
||||||
const ExtensionUtils = imports.misc.extensionUtils;
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
const Me = ExtensionUtils.getCurrentExtension();
|
|
||||||
const Config = imports.misc.config;
|
|
||||||
const Gst = imports.gi.Gst;
|
|
||||||
|
|
||||||
const TEATIME_STEEP_TIMES_KEY = 'steep-times';
|
|
||||||
const TEATIME_FULLSCREEN_NOTIFICATION_KEY = 'fullscreen-notification';
|
|
||||||
const TEATIME_GRAPHICAL_COUNTDOWN_KEY = 'graphical-countdown';
|
|
||||||
const TEATIME_USE_ALARM_SOUND_KEY = 'use-alarm-sound';
|
|
||||||
const TEATIME_ALARM_SOUND_KEY = 'alarm-sound-file';
|
|
||||||
|
|
||||||
const ENABLE_LOGGING = false;
|
const ENABLE_LOGGING = false;
|
||||||
|
|
||||||
@ -23,6 +12,16 @@ function debug(text) {
|
|||||||
log("**TeaTime >: " + text);
|
log("**TeaTime >: " + text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function GetConfigKeys() {
|
||||||
|
return {
|
||||||
|
steep_times: 'steep-times',
|
||||||
|
fullscreen_notification: 'fullscreen-notification',
|
||||||
|
graphical_countdown: 'graphical-countdown',
|
||||||
|
use_alarm_sound: 'use-alarm-sound',
|
||||||
|
alarm_sound: 'alarm-sound-file'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function getExtensionLocaleDir() {
|
function getExtensionLocaleDir() {
|
||||||
// check if this extension was built with "make zip-file", and thus
|
// check if this extension was built with "make zip-file", and thus
|
||||||
// has the locale files in a subfolder
|
// has the locale files in a subfolder
|
||||||
@ -31,7 +30,7 @@ function getExtensionLocaleDir() {
|
|||||||
let localLocaleDir = ExtensionUtils.getCurrentExtension().dir.get_child('locale');
|
let localLocaleDir = ExtensionUtils.getCurrentExtension().dir.get_child('locale');
|
||||||
let selectedDir = (localLocaleDir.query_exists(null)) ?
|
let selectedDir = (localLocaleDir.query_exists(null)) ?
|
||||||
localLocaleDir.get_path() :
|
localLocaleDir.get_path() :
|
||||||
Config.LOCALEDIR;
|
imports.misc.config.LOCALEDIR;
|
||||||
|
|
||||||
debug("Using locale dir: " + selectedDir);
|
debug("Using locale dir: " + selectedDir);
|
||||||
|
|
||||||
@ -58,6 +57,8 @@ function getTranslationFunc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getSettings(schema) {
|
function getSettings(schema) {
|
||||||
|
const Gio = imports.gi.Gio;
|
||||||
|
|
||||||
let extension = ExtensionUtils.getCurrentExtension();
|
let extension = ExtensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
schema = schema || extension.metadata['settings-schema'];
|
schema = schema || extension.metadata['settings-schema'];
|
||||||
@ -114,8 +115,13 @@ function formatTime(sec_num) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function playSound(uri) {
|
function playSound(uri) {
|
||||||
|
const Gst = imports.gi.Gst;
|
||||||
|
const Lang = imports.lang;
|
||||||
|
|
||||||
|
debug("Playing " + uri);
|
||||||
|
|
||||||
if (typeof this.player == 'undefined') {
|
if (typeof this.player == 'undefined') {
|
||||||
Gst.init(null, 0);
|
Gst.init(null);
|
||||||
this.player = Gst.ElementFactory.make("playbin", "player");
|
this.player = Gst.ElementFactory.make("playbin", "player");
|
||||||
this.playBus = this.player.get_bus();
|
this.playBus = this.player.get_bus();
|
||||||
this.playBus.add_signal_watch();
|
this.playBus.add_signal_watch();
|
||||||
@ -143,3 +149,11 @@ function getGlobalDisplayScaleFactor() {
|
|||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
return St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
return St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isType(value, typename) {
|
||||||
|
return typeof value == typename;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isGnome34() {
|
||||||
|
return imports.misc.extensionUtils.versionCheck(["3.4"], imports.misc.config.PACKAGE_VERSION);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user