Skip to content

Commit dbee0a0

Browse files
authored
Merge pull request #76 from NikoKrause/fix-imgur-cinnamon-3.4
Fix some JS warnings and imgur wizard for cinnamon 3.4
2 parents b5a7428 + c163342 commit dbee0a0

File tree

5 files changed

+83
-85
lines changed

5 files changed

+83
-85
lines changed

Diff for: capture@rjanja/3.2/applet.js

+31-33
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ ScreenshotNotification.prototype = {
256256
// We hide all types of notifications once the user clicks on them because the common
257257
// outcome of clicking should be the relevant window being brought forward and the user's
258258
// attention switching to the window.
259-
259+
260260
// if (!this.resident) {
261261
// this.emit('done-displaying');
262262
// global.log('destroying it');
@@ -433,7 +433,7 @@ MyApplet.prototype = {
433433
else if (this._uuid) {
434434
global.log(this._uuid + ': ' + msg);
435435
}
436-
436+
437437
},
438438

439439
_initSettings: function() {
@@ -448,7 +448,7 @@ MyApplet.prototype = {
448448
this.settings = new LocalSettings(this._uuid, this._instanceId);
449449
this._localSettings = true;
450450
}
451-
451+
452452
this.settings.connect("settings-changed", Lang.bind(this, this._onSettingsChanged));
453453
this.settings.connect("changed::camera-program", Lang.bind(this, this._onRuntimeChanged));
454454
this.settings.connect("changed::recorder-program", Lang.bind(this, this._onRuntimeChanged));
@@ -526,7 +526,7 @@ MyApplet.prototype = {
526526
return this.run_cinnamon_camera(captureType, null, index);
527527
}
528528
});
529-
529+
530530
// Read current value and if set, add the hotkey
531531
var curVal = this.settings.getValue(key);
532532
if (curVal != '' && curVal != null)
@@ -598,7 +598,7 @@ MyApplet.prototype = {
598598

599599
this._notifLeftClickBehavior = this.settings.getValue('notif-image-left-click');
600600
this._notifRightClickBehavior = this.settings.getValue('notif-image-right-click');
601-
601+
602602
this._showDeleteAction = this.settings.getValue('show-delete-action');
603603
this._showCopyPathAction = this.settings.getValue('show-copy-path-action');
604604
this._showCopyDataAction = this.settings.getValue('show-copy-data-action');
@@ -696,7 +696,7 @@ MyApplet.prototype = {
696696

697697
_onMenuKeyPress: function(actor, event) {
698698
let symbol = event.get_key_symbol();
699-
699+
700700
if (symbol == Clutter.Shift_L)
701701
{
702702
this.setModifier(symbol, true);
@@ -723,7 +723,7 @@ MyApplet.prototype = {
723723

724724
_init: function(metadata, orientation, panelHeight, instanceId) {
725725
Applet.IconApplet.prototype._init.call(this, orientation);
726-
726+
727727
try {
728728
this._programs = {};
729729
this._programSupport = {};
@@ -765,7 +765,7 @@ MyApplet.prototype = {
765765
this.openScreenshotsFolderItem = new Applet.MenuItem(_("Open screenshots folder"),
766766
'folder', Lang.bind(this, this._openScreenshotsFolder));
767767
this._applet_context_menu.addMenuItem(this.openScreenshotsFolderItem);
768-
768+
769769
this.openRecordingsFolderItem = new Applet.MenuItem(_("Open recordings folder"),
770770
'folder', Lang.bind(this, this._openRecordingsFolder));
771771
this._applet_context_menu.addMenuItem(this.openRecordingsFolderItem);
@@ -801,7 +801,7 @@ MyApplet.prototype = {
801801
this._xfixesCursor = xfixesCursor;
802802

803803
this.actor.add_style_class_name('desktop-capture');
804-
804+
805805
this.set_applet_tooltip(_("Screenshot and desktop video"));
806806

807807
this.draw_menu(orientation);
@@ -827,7 +827,7 @@ MyApplet.prototype = {
827827

828828
_checkPaths: function(force) {
829829
force = force || false;
830-
830+
831831
this.openScreenshotsFolderItem.setSensitive(
832832
false != this._getCreateFolder(this._cameraSaveDir, force));
833833

@@ -910,13 +910,13 @@ MyApplet.prototype = {
910910
}
911911
else {
912912
this._outputTitle = new PopupMenu.PopupIconMenuItem(
913-
_("Camera") + ": " + this.get_camera_option('title'),
913+
_("Camera") + ": " + this.get_camera_option('title'),
914914
"camera-photo", St.IconType.SYMBOLIC,
915915
{ reactive: false });
916916
}
917917

918918
this.menu.addMenuItem(this._outputTitle);
919-
919+
920920
if (this.get_camera_program() == 'cinnamon') {
921921
let item = this.menu.addAction(this.indent(_("Window")), Lang.bind(this, function(e) {
922922
return this.run_cinnamon_camera(Screenshot.SelectionType.WINDOW, e);
@@ -935,7 +935,7 @@ MyApplet.prototype = {
935935
if (Main.layoutManager.monitors.length > 1) {
936936
Main.layoutManager.monitors.forEach(function(monitor, index) {
937937
if (index < 3) {
938-
this.menu.addAction(this.indent(_("Monitor %d").format(index + 1)),
938+
this.menu.addAction(this.indent(_("Monitor %d").format(index + 1)),
939939
Lang.bind(this, function(e) {
940940
return this.run_cinnamon_camera(Screenshot.SelectionType.MONITOR, e, index);
941941
}), 'kb-cs-monitor-' + index);
@@ -944,7 +944,7 @@ MyApplet.prototype = {
944944
}
945945

946946
this._redoMenuItem = this.menu.addAction(
947-
this.indent(_("Repeat last")),
947+
this.indent(_("Repeat last")),
948948
Lang.bind(this, this.repeat_cinnamon_camera),
949949
this.settings.getValue('kb-cs-repeat'));
950950

@@ -1024,7 +1024,7 @@ MyApplet.prototype = {
10241024
optionSwitch.connect('toggled', Lang.bind(this, function(e1,v) {
10251025
this._includeCursor = v;
10261026
this.setSettingValue('include-cursor', v);
1027-
1027+
10281028
if (this.get_camera_program() == CAMERA_PROGRAM_GNOME
10291029
&& null !== this._ssSettings) {
10301030
// We can't pass a cursor option to gnome-screenshot,
@@ -1067,7 +1067,7 @@ MyApplet.prototype = {
10671067
this._send_test_notification();
10681068
}));
10691069
}*/
1070-
1070+
10711071

10721072
if (this.has_recorder())
10731073
{
@@ -1077,26 +1077,26 @@ MyApplet.prototype = {
10771077

10781078
if (this.has_recorder_option('gui')) {
10791079
this._outputTitle2 = new PopupMenu.PopupIconMenuItem(
1080-
_("Recorder") + ": " + this.get_recorder_option('title'),
1080+
_("Recorder") + ": " + this.get_recorder_option('title'),
10811081
"media-record", St.IconType.SYMBOLIC);
1082-
1082+
10831083
let guiCommand = this.get_recorder_option('gui');
10841084
this._outputTitle2.connect('activate', Lang.bind(this, function (menuItem, event) {
10851085
this.Exec(guiCommand);
10861086
}));
10871087
}
10881088
else {
10891089
this._outputTitle2 = new PopupMenu.PopupIconMenuItem(
1090-
_("Recorder") + ": " + this.get_recorder_option('title'),
1090+
_("Recorder") + ": " + this.get_recorder_option('title'),
10911091
"media-record", St.IconType.SYMBOLIC, { reactive: false });
10921092
}
1093-
1093+
10941094
this.menu.addMenuItem(this._outputTitle2);
10951095

10961096
if (this.get_recorder_program() == 'cinnamon')
10971097
{
10981098
this._cRecorderItem = this.menu.addAction(
1099-
this.indent(_("Start recording")),
1099+
this.indent(_("Start recording")),
11001100
Lang.bind(this, this._toggle_cinnamon_recorder),
11011101
this.settings.getValue('kb-recorder-stop'));
11021102
// We could try to listen for when recording is activated
@@ -1116,7 +1116,7 @@ MyApplet.prototype = {
11161116
soundSwitch.connect('toggled', Lang.bind(this, function(e1,v) {
11171117
this._recordSound = v;
11181118
this.setSettingValue('record-sound', v);
1119-
1119+
11201120
return false;
11211121
}));
11221122
this.menu.addMenuItem(soundSwitch);
@@ -1303,12 +1303,10 @@ MyApplet.prototype = {
13031303

13041304
let image_file = Gio.file_new_for_path(screenshot.file);
13051305
let image_uri = image_file.get_uri();
1306-
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
13071306
let image_texture = St.TextureCache.get_default().load_uri_sync(
13081307
St.TextureCachePolicy.NONE,
1309-
image_uri,
1310-
this._notificationImageSize, this._notificationImageSize,
1311-
scaleFactor);
1308+
image_uri,
1309+
this._notificationImageSize, this._notificationImageSize);
13121310

13131311
//global.tex = image_texture;
13141312

@@ -1329,7 +1327,7 @@ MyApplet.prototype = {
13291327
//notification.addButton('custom', this._customActionLabel);
13301328
//}
13311329

1332-
notification.connect('action-invoked', Lang.bind(this, function(n, action_id) {
1330+
notification.connect('action-invoked', Lang.bind(this, function(n, action_id) {
13331331
// global.log('Action invoked from notification: ' + action_id);
13341332
return this.handleNotificationResponse(screenshot, action_id, n);
13351333
}));
@@ -1522,7 +1520,7 @@ MyApplet.prototype = {
15221520

15231521
let fnCapture = Lang.bind(this, function() {
15241522
new Screenshot.ScreenshotHelper(type, Lang.bind(this, this.cinnamon_camera_complete),
1525-
{
1523+
{
15261524
includeCursor: this._includeCursor,
15271525
useFlash: this._useCameraFlash,
15281526
includeFrame: this._includeWindowFrame,
@@ -1621,7 +1619,7 @@ MyApplet.prototype = {
16211619
{
16221620
return false;
16231621
}
1624-
1622+
16251623
let file = Gio.file_new_for_path(folderPath + '/' + fileName + '.' + fileExtension);
16261624
let desiredFilepath = file.get_path();
16271625
try {
@@ -1645,7 +1643,7 @@ MyApplet.prototype = {
16451643
if (this.cRecorder.is_recording()) {
16461644
this.cRecorder.pause();
16471645
Meta.enable_unredirect_for_screen(global.screen);
1648-
1646+
16491647
if (!this._useSymbolicIcon) {
16501648
this.set_applet_icon_path(ICON_FILE);
16511649
}
@@ -1927,7 +1925,7 @@ MyApplet.prototype = {
19271925
else {
19281926
options = this.get_recorder_options();
19291927
}
1930-
1928+
19311929
let cmd = options['custom'][custom];
19321930

19331931
if (!cmd) {
@@ -2124,7 +2122,7 @@ MyApplet.prototype = {
21242122

21252123
let accessToken, refreshToken, albumId;
21262124

2127-
let cmd = [ AppletDir + "/imgur-setup.js", AppletDir,
2125+
let cmd = [ AppletDir + "/imgur-setup.js", AppletDir,
21282126
this._imgurAccessToken, this._imgurRefreshToken, this._imgurAlbumId
21292127
].join(' ');
21302128

@@ -2275,7 +2273,7 @@ function main(metadata, orientation, panelHeight, instanceId) {
22752273
Screenshot = imports.screenshot;
22762274
Services = imports.services;
22772275
AppUtil = imports.apputil;
2278-
2276+
22792277
SUPPORT_FILE = AppletDir + '/support.json';
22802278
ICON_FILE = AppletDir + '/icon.png';
22812279
ICON_FILE_ACTIVE = AppletDir + '/icon-active.png';

Diff for: capture@rjanja/3.2/apputil.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ function SpawnOpts(command, options) {
7777
});
7878

7979
opts.logger('Running ' + command);
80-
let pid, stdin, stdout, stderr, stream, reader, success, argv;
80+
let res, pid, stdin, stdout, stderr, stream, reader, success, argv;
8181
[success,argv] = GLib.shell_parse_argv(command);
8282

8383
try {
8484
[res, pid, stdin, stdout, stderr] = GLib.spawn_async_with_pipes(
85-
null, argv, null, GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.DO_NOT_REAP_CHILD, null);
85+
null, argv, null, GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.DO_NOT_REAP_CHILD, null);
8686
}
8787
catch (e) {
8888
opts.logger("Failure creating process");
@@ -94,7 +94,7 @@ function SpawnOpts(command, options) {
9494
opts.onSpawn(pid);
9595

9696
stream = new Gio.DataInputStream({ base_stream : new Gio.UnixInputStream({ fd : stdout }) });
97-
97+
9898
if (typeof opts.onLineOut == 'function') {
9999
this.read = function(stream, func) {
100100
stream.read_line_async(GLib.PRIORITY_LOW, null, Lang.bind(this, function(source, result) {
@@ -132,4 +132,4 @@ function SpawnOpts(command, options) {
132132
opts.logger("Failed to spawn process");
133133
return opts.onFailure();
134134
}
135-
}
135+
}

Diff for: capture@rjanja/3.2/imgur-setup.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ const ImgurWizard = new Lang.Class ({
138138
instructionsLabel3.set_padding(10, 10);
139139
box.pack_start(instructionsLabel3, false, false, 5);
140140

141-
let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, spacing: 0 });
141+
box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, spacing: 0 });
142142
this._stack.add_titled(box, '3', _('Validate PIN'));
143143
let instructionsText = _('Enter PIN to validate access and get tokens.');
144144
let instructionsLabel = new Gtk.Label({ label: instructionsText, use_markup: true});
@@ -156,7 +156,7 @@ const ImgurWizard = new Lang.Class ({
156156
var pinLabel = new Gtk.Label({ label: 'PIN:' });
157157
pinLabel.set_justify(Gtk.Justification.RIGHT);
158158
pinLabel.set_alignment(1.0, 0.5);
159-
box2.pack_start(pinLabel, false, true, 5);
159+
box2.pack_start(pinLabel, false, true, 5);
160160
this._pinEntry = new Gtk.Entry();
161161
this._pinEntry.set_alignment(0.0, 0.5);
162162
this._pinEntry.set_max_width_chars(32);
@@ -166,11 +166,11 @@ const ImgurWizard = new Lang.Class ({
166166
// box2.set_margin(10);
167167
box.pack_start(box2, true, true, 5);
168168

169-
170-
let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, spacing: 0 });
169+
170+
box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, spacing: 0 });
171171
this._stack.add_titled(box, '4', _('Choose album'));
172-
let instructionsText = _('Please choose the album for new screenshots.');
173-
let instructionsLabel = new Gtk.Label({ label: instructionsText, use_markup: true});
172+
instructionsText = _('Please choose the album for new screenshots.');
173+
instructionsLabel = new Gtk.Label({ label: instructionsText, use_markup: true});
174174
instructionsLabel.set_padding(10, 10);
175175
instructionsLabel.set_justify(Gtk.Justification.LEFT);
176176
instructionsLabel.set_alignment(0, 0);
@@ -200,10 +200,10 @@ const ImgurWizard = new Lang.Class ({
200200
box.pack_start(subLabel, false, false, 5);
201201

202202

203-
let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, spacing: 0 });
203+
box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, spacing: 0 });
204204
this._stack.add_titled(box, '5', _('Finished'));
205-
let instructionsText = _('All done!');
206-
let instructionsLabel = new Gtk.Label({ label: instructionsText, use_markup: true});
205+
instructionsText = _('All done!');
206+
instructionsLabel = new Gtk.Label({ label: instructionsText, use_markup: true});
207207
instructionsLabel.set_padding(10, 10);
208208
instructionsLabel.set_justify(Gtk.Justification.LEFT);
209209
instructionsLabel.set_alignment(0, 0);
@@ -357,7 +357,7 @@ const ImgurWizard = new Lang.Class ({
357357
},
358358

359359
verifyPin: function() {
360-
360+
361361
},
362362

363363
_showPinError: function (errorText) {
@@ -391,7 +391,7 @@ function main(argv) {
391391
initEnvironment();
392392
imports.searchPath.push(argv[0]);
393393
imports.searchPath.push('/usr/share/cinnamon/js');
394-
394+
395395
Services = imports.services;
396396
// AppUtil = imports.apputil;
397397

0 commit comments

Comments
 (0)