Skip to content

Commit 56dd8c2

Browse files
committed
First version commit
1 parent 9a8ba47 commit 56dd8c2

12 files changed

+1174
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gnome-shell-extension-rss-feed

contributors.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Tomas Gažovič [email protected]
2+
Janka Gažovičová [email protected]

icons/logo rss.png

1.74 KB
Loading

[email protected]/convenience.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
Copyright (c) 2011-2012, Giovanni Campagna <[email protected]>
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
* Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the above copyright
9+
notice, this list of conditions and the following disclaimer in the
10+
documentation and/or other materials provided with the distribution.
11+
* Neither the name of the GNOME nor the
12+
names of its contributors may be used to endorse or promote products
13+
derived from this software without specific prior written permission.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
19+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25+
*/
26+
27+
const Gio = imports.gi.Gio;
28+
const ExtensionUtils = imports.misc.extensionUtils;
29+
30+
31+
/**
32+
* getSettings:
33+
* @schema: (optional): the GSettings schema id
34+
*
35+
* Builds and return a GSettings schema for @schema, using schema files
36+
* in extensionsdir/schemas. If @schema is not provided, it is taken from
37+
* metadata['settings-schema'].
38+
*/
39+
function getSettings(schema) {
40+
let extension = ExtensionUtils.getCurrentExtension();
41+
42+
schema = schema || extension.metadata['settings-schema'];
43+
44+
const GioSSS = Gio.SettingsSchemaSource;
45+
46+
// check if this extension was built with "make zip-file", and thus
47+
// has the schema files in a subfolder
48+
// otherwise assume that extension has been installed in the
49+
// same prefix as gnome-shell (and therefore schemas are available
50+
// in the standard folders)
51+
let schemaDir = extension.dir.get_child('schemas');
52+
let schemaSource;
53+
if (schemaDir.query_exists(null))
54+
schemaSource = GioSSS.new_from_directory(schemaDir.get_path(),
55+
GioSSS.get_default(),
56+
false);
57+
else
58+
schemaSource = GioSSS.get_default();
59+
60+
61+
let schemaObj = schemaSource.lookup(schema, true);
62+
if (!schemaObj)
63+
throw new Error('Schema ' + schema + ' could not be found for extension '
64+
+ extension.metadata.uuid + '. Please check your installation.');
65+
66+
return new Gio.Settings({ settings_schema: schemaObj });
67+
}

0 commit comments

Comments
 (0)