Merge lp:~sil2100/libunity/fix-1062099-6.0 into lp:libunity/6.0

Proposed by Łukasz Zemczak
Status: Merged
Approved by: Paweł Stołowski
Approved revision: 185
Merged at revision: 185
Proposed branch: lp:~sil2100/libunity/fix-1062099-6.0
Merge into: lp:libunity/6.0
Diff against target: 96 lines (+37/-9)
2 files modified
src/unity-launcher.vala (+20/-6)
test/vala/test-launcher-integration.vala (+17/-3)
To merge this branch: bzr merge lp:~sil2100/libunity/fix-1062099-6.0
Reviewer Review Type Date Requested Status
Paweł Stołowski (community) Approve
Review via email: mp+128240@code.launchpad.net

This proposal supersedes a proposal from 2012-10-05.

Commit message

Cherry-picked from trunk rev118: Check for existence of schemas which we don't ship

Description of the change

From trunk:

Check for existence of schemas which we don't ship

To post a comment you must log in.
Revision history for this message
Paweł Stołowski (stolowski) wrote :

+1

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

No commit message specified.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/unity-launcher.vala'
2--- src/unity-launcher.vala 2012-09-18 14:36:14 +0000
3+++ src/unity-launcher.vala 2012-10-05 12:48:25 +0000
4@@ -349,21 +349,35 @@
5 public class LauncherFavorites : Object
6 {
7 public signal void changed ();
8-
9+
10+ private const string LAUNCHER_SCHEMA_NAME = "com.canonical.Unity.Launcher";
11 private static LauncherFavorites? singleton = null;
12 private Settings settings;
13
14 /* We keep both a map and a list in order to have the correct sorting */
15 private HashTable<string,AppInfo?> fav_cache;
16 private string[] fav_list;
17-
18+
19 private LauncherFavorites ()
20 {
21- settings = new Settings ("com.canonical.Unity.Launcher");
22 fav_cache = new HashTable<string,AppInfo?> (str_hash, str_equal);
23- reset_fav_cache ();
24-
25- settings.changed["favorites"].connect (reset_fav_cache);
26+ if (schema_exists (LAUNCHER_SCHEMA_NAME))
27+ {
28+ settings = new Settings (LAUNCHER_SCHEMA_NAME);
29+ reset_fav_cache ();
30+
31+ settings.changed["favorites"].connect (reset_fav_cache);
32+ }
33+ else
34+ {
35+ warning ("Schema \"%s\" is not installed!", LAUNCHER_SCHEMA_NAME);
36+ }
37+ }
38+
39+ private static bool schema_exists (string schema)
40+ {
41+ unowned string[] installed_schemas = Settings.list_schemas ();
42+ return schema in installed_schemas;
43 }
44
45 private void reset_fav_cache ()
46
47=== modified file 'test/vala/test-launcher-integration.vala'
48--- test/vala/test-launcher-integration.vala 2012-09-10 14:21:49 +0000
49+++ test/vala/test-launcher-integration.vala 2012-10-05 12:48:25 +0000
50@@ -25,6 +25,14 @@
51
52 public class Main
53 {
54+ public const string LAUNCHER_SCHEMA_NAME = "com.canonical.Unity.Launcher";
55+
56+ public static bool schema_exists (string schema)
57+ {
58+ unowned string[] installed_schemas = Settings.list_schemas ();
59+ return schema in installed_schemas;
60+ }
61+
62 public static int main (string[] args)
63 {
64 /* Prepend test search path for XDG_DATA_DIRS so we can find
65@@ -38,7 +46,13 @@
66
67 /* Make sure we don't hose the user env with our tests... */
68 Environment.set_variable ("GSETTINGS_BACKEND", "memory", true);
69-
70+
71+ if (!schema_exists (LAUNCHER_SCHEMA_NAME))
72+ {
73+ warning ("Schema \"%s\" is not installed, skipping LauncherFavorites tests", LAUNCHER_SCHEMA_NAME);
74+ return 0;
75+ }
76+
77 Test.init (ref args);
78
79 Test.add_data_func ("/Integration/Launcher/Favorites/UnknownApps",
80@@ -66,7 +80,7 @@
81
82 internal static void set_up () {
83 assert ("memory" == Environment.get_variable ("GSETTINGS_BACKEND"));
84- var settings = new Settings ("com.canonical.Unity.Launcher");
85+ var settings = new Settings (LAUNCHER_SCHEMA_NAME);
86
87 string[] faves = { "rhythmbox.desktop", "file://testapp1.desktop",
88 "application://ubuntu-about.desktop",
89@@ -159,7 +173,7 @@
90 });
91
92 /* Change the faves */
93- var settings = new Settings ("com.canonical.Unity.Launcher");
94+ var settings = new Settings (LAUNCHER_SCHEMA_NAME);
95 string[] new_faves = { "rhythmbox.desktop" };
96 settings.set_strv ("favorites", new_faves);
97

Subscribers

People subscribed via source and target branches

to all changes: