Merge lp:~midori/midori/hierarchy into lp:midori

Proposed by Cris Dywan
Status: Merged
Approved by: Paweł Forysiuk
Approved revision: 6338
Merged at revision: 6397
Proposed branch: lp:~midori/midori/hierarchy
Merge into: lp:midori
Diff against target: 68 lines (+13/-9)
3 files modified
extensions/nojs/nojs.c (+2/-2)
katze/midori-paths.vala (+10/-6)
midori/midori-view.c (+1/-1)
To merge this branch: bzr merge lp:~midori/midori/hierarchy
Reviewer Review Type Date Requested Status
Paweł Forysiuk Approve
Review via email: mp+184451@code.launchpad.net

Commit message

Make get_res_filename work with different hierarchies

To post a comment you must log in.
Revision history for this message
Cris Dywan (kalikiana) wrote :

I tested the fix from Paweł successfully.

Revision history for this message
Paweł Forysiuk (tuxator) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'extensions/nojs/nojs.c'
2--- extensions/nojs/nojs.c 2013-08-02 22:18:16 +0000
3+++ extensions/nojs/nojs.c 2013-09-09 09:57:32 +0000
4@@ -383,8 +383,8 @@
5
6 gchar* nojs_get_icon_path (const gchar* icon)
7 {
8- gchar* res_dir = midori_paths_get_res_filename ("");
9- return g_build_filename (res_dir, "nojs", icon, NULL);
10+ gchar* nojs_dir = midori_paths_get_res_filename("nojs");
11+ return g_build_filename (nojs_dir, icon, NULL);
12 }
13
14 /* Menu icon of a view has changed */
15
16=== modified file 'katze/midori-paths.vala'
17--- katze/midori-paths.vala 2013-09-08 17:20:49 +0000
18+++ katze/midori-paths.vala 2013-09-09 09:57:32 +0000
19@@ -306,7 +306,7 @@
20 if (strcmp (Environment.get_variable ("MIDORI_DEBUG"), "paths") == 0) {
21 stdout.printf ("command_line: %s\nexec_path: %s\nres: %s\nlib: %s\n",
22 get_command_line_str (true), exec_path,
23- get_res_filename (""), get_lib_path (PACKAGE_NAME));
24+ get_res_filename ("about.css"), get_lib_path (PACKAGE_NAME));
25 }
26 }
27
28@@ -345,6 +345,7 @@
29
30 public static string get_res_filename (string filename) {
31 assert (command_line != null);
32+ assert (filename != "");
33 #if HAVE_WIN32
34 return Path.build_filename (exec_path, "share", PACKAGE_NAME, "res", filename);
35 #else
36@@ -353,11 +354,14 @@
37 return path;
38
39 /* Fallback to build folder */
40- path = Path.build_filename ((File.new_for_path (exec_path)
41- .get_parent ().get_path ()), "data", filename);
42- if (Posix.access (path, Posix.F_OK) == 0)
43- return path;
44-
45+ File? parent = File.new_for_path (exec_path).get_parent ();
46+ while (parent != null) {
47+ var data = parent.get_child ("data");
48+ var child = data.get_child (filename);
49+ if (child.query_exists ())
50+ return child.get_path ();
51+ parent = parent.get_parent ();
52+ }
53 return Path.build_filename (MDATADIR, PACKAGE_NAME, "res", filename);
54 #endif
55 }
56
57=== modified file 'midori/midori-view.c'
58--- midori/midori-view.c 2013-09-08 17:20:49 +0000
59+++ midori/midori-view.c 2013-09-09 09:57:32 +0000
60@@ -3960,7 +3960,7 @@
61 }
62 else if (!strcmp (uri, "about:paths"))
63 {
64- gchar* res_dir = midori_paths_get_res_filename ("");
65+ gchar* res_dir = midori_paths_get_res_filename ("about.css");
66 gchar* lib_dir = midori_paths_get_lib_path (PACKAGE_NAME);
67 data = g_markup_printf_escaped ("<body><h1>%s</h1>"
68 "<p>config: <code>%s</code></p>"

Subscribers

People subscribed via source and target branches

to all changes: