Merge lp:~kalikiana/midori/apple into lp:midori

Proposed by Cris Dywan
Status: Merged
Approved by: Paweł Forysiuk
Approved revision: 6208
Merged at revision: 6273
Proposed branch: lp:~kalikiana/midori/apple
Merge into: lp:midori
Diff against target: 534 lines (+199/-40)
11 files modified
extensions/apps.vala (+94/-28)
katze/katze-item.c (+0/-2)
katze/midori-paths.vala (+2/-0)
midori/midori-completion.vala (+17/-3)
midori/midori-locationaction.c (+2/-1)
midori/midori-searchcompletion.vala (+2/-5)
midori/midori.vapi (+4/-0)
midori/sokoke.c (+67/-0)
midori/sokoke.h (+8/-0)
midori/wscript_build (+1/-1)
wscript (+2/-0)
To merge this branch: bzr merge lp:~kalikiana/midori/apple
Reviewer Review Type Date Requested Status
Paweł Forysiuk Approve
Cris Dywan Abstain
Review via email: mp+167846@code.launchpad.net

Commit message

Read apps/ profiles from folder, leave launchers separate

Description of the change

Read apps/ profiles from folder, leave launchers separate

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

Need to fix monitoring after the refactoring and ignore the error if the app/ profile folder exists, desc should still be created if -a was used on its own.

review: Needs Fixing
Revision history for this message
Paweł Forysiuk (tuxator) wrote :

regarding profiles and win32

it seems to refuse to parse Exec line if there is a backslash there,
so
midori -c c:\dir\other\dir\md5sum
needs to be
midori -c c:\\dir\\other\\dir\\md5sum

Fixing this makes launcher for profile appear on the panel at least

from launching from cli -c arg needs to be double quoted instead it would just run into first
space in the path and thinks it is the whole path
so
midori -c c:\\Documents and Settings\\user
will be launched as

midori -c C:\\Documents

But even with quotes in exec line in desktop file it does not seem to launch properly
about:paths show regular version paths and it just shows google - like in launch where
no existing config is found

additionally i get following error on the cli

** (midori4:1524): WARNING **: fd_recv(): failed with 10054 (errno = 0)

Adding paths to files when showing warings should not hurt as well.

Revision history for this message
Cris Dywan (kalikiana) :
review: Abstain
lp:~kalikiana/midori/apple updated
6205. By Paweł Forysiuk

Implement deleting default launcher on win32

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

I did not check this before but unfortunately adding monitors seems to kill midori ;/
Also there is a problem when there is unicode title it will create launcher but desktop file will not
be parsed so it will not show in the panel, this seems to come from name and i think it is the same
issue as with completion and such.

I implemented deleting default lnk file but we need to sort out crasher and codepage stuff.

review: Needs Fixing
Revision history for this message
Cris Dywan (kalikiana) wrote :

Is it possible that SHGetFolderPath returns a local encoding such as ISO-8859-1? How about using g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP) instead?

I haven't seen a crash due to monitoring, a backtrace would be useful.

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

no crash when using glib function but monitoring does not seem to work, i need to restart midori

lp:~kalikiana/midori/apple updated
6206. By Paweł Forysiuk

Use glib funtion to get destkop folder on win32

6207. By Paweł Forysiuk

Check if file exists before removing lnk file

6208. By Paweł Forysiuk

Don't needlessly recompute filename from launcher title

Revision history for this message
Cris Dywan (kalikiana) wrote :

Please review to get this into trunk and simply file the last Win32 quirks as bugs (monitoring and unicode handling).

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

Looks fine so far

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'extensions/apps.vala'
--- extensions/apps.vala 2013-06-21 23:18:01 +0000
+++ extensions/apps.vala 2013-07-04 20:20:33 +0000
@@ -22,11 +22,41 @@
2222
23 internal static async void create (string prefix, GLib.File folder, string uri, string title, Gtk.Widget proxy) {23 internal static async void create (string prefix, GLib.File folder, string uri, string title, Gtk.Widget proxy) {
24 /* Strip LRE leading character and / */24 /* Strip LRE leading character and / */
25 string exec = prefix + uri;
26 string name = title.delimit ("‪/", ' ').strip();25 string name = title.delimit ("‪/", ' ').strip();
27 string filename = Midori.Download.clean_filename (name) + ".desktop";26 string filename = Midori.Download.clean_filename (name);
28 // TODO: Midori.Paths.get_icon save to png27 string exec;
28#if HAVE_WIN32
29 string doubleslash_uri = uri.replace ("\\", "\\\\");
30 string quoted_uri = GLib.Shell.quote (doubleslash_uri);
31 exec = prefix + quoted_uri;
32#else
33 exec = prefix + uri;
34#endif
35 try {
36 folder.make_directory_with_parents (null);
37 }
38 catch (Error error) {
39 /* It's not an error if the folder already exists;
40 any fatal problems will fail further down the line */
41 }
42
29 string icon_name = Midori.Stock.WEB_BROWSER;43 string icon_name = Midori.Stock.WEB_BROWSER;
44 try {
45 var pixbuf = Midori.Paths.get_icon (uri, null);
46 if (pixbuf == null)
47 throw new FileError.EXIST ("No favicon loaded");
48 string icon_filename = folder.get_child ("icon.png").get_path ();
49 pixbuf.save (icon_filename, "png", null, "compression", "7", null);
50#if HAVE_WIN32
51 string doubleslash_icon = icon_filename.replace ("\\", "\\\\");
52 icon_name = doubleslash_icon;
53#else
54 icon_name = icon_filename;
55#endif
56 }
57 catch (Error error) {
58 GLib.warning (_("Failed to fetch application icon in %s: %s"), folder.get_path (), error.message);
59 }
30 string contents = """60 string contents = """
31 [Desktop Entry]61 [Desktop Entry]
32 Version=1.062 Version=1.0
@@ -37,16 +67,25 @@
37 Icon=%s67 Icon=%s
38 Categories=Network;68 Categories=Network;
39 """.printf (name, exec, PACKAGE_NAME, icon_name);69 """.printf (name, exec, PACKAGE_NAME, icon_name);
40 var file = folder.get_child (filename);70 var file = folder.get_child ("desc");
41 var browser = proxy.get_toplevel () as Midori.Browser;71 var browser = proxy.get_toplevel () as Midori.Browser;
42 try {72 try {
43 var stream = yield file.replace_async (null, false, GLib.FileCreateFlags.NONE);73 var stream = yield file.replace_async (null, false, GLib.FileCreateFlags.NONE);
44 yield stream.write_async (contents.data);74 yield stream.write_async (contents.data);
75 // Create a launcher/ menu
76#if HAVE_WIN32
77 Midori.Sokoke.create_win32_desktop_lnk (prefix, filename, uri);
78#else
79 var data_dir = File.new_for_path (Midori.Paths.get_user_data_dir ());
80 yield file.copy_async (data_dir.get_child ("applications").get_child (filename + ".desktop"),
81 GLib.FileCopyFlags.NONE);
82#endif
4583
46 browser.send_notification (_("Launcher created"),84 browser.send_notification (_("Launcher created"),
47 _("You can now run <b>%s</b> from your launcher or menu").printf (name));85 _("You can now run <b>%s</b> from your launcher or menu").printf (name));
48 }86 }
49 catch (Error error) {87 catch (Error error) {
88 warning (_("Failed to create new launcher: %s").printf (error.message));
50 browser.send_notification (_("Error creating launcher"),89 browser.send_notification (_("Error creating launcher"),
51 _("Failed to create new launcher: %s").printf (error.message));90 _("Failed to create new launcher: %s").printf (error.message));
52 }91 }
@@ -57,11 +96,9 @@
57 }96 }
5897
59 bool init (GLib.Cancellable? cancellable) throws GLib.Error {98 bool init (GLib.Cancellable? cancellable) throws GLib.Error {
60 if (!file.get_basename ().has_suffix (".desktop"))
61 return false;
62
63 var keyfile = new GLib.KeyFile ();99 var keyfile = new GLib.KeyFile ();
64 keyfile.load_from_file (file.get_path (), GLib.KeyFileFlags.NONE);100 keyfile.load_from_file (file.get_child ("desc").get_path (), GLib.KeyFileFlags.NONE);
101
65 exec = keyfile.get_string ("Desktop Entry", "Exec");102 exec = keyfile.get_string ("Desktop Entry", "Exec");
66 if (!exec.has_prefix (APP_PREFIX) && !exec.has_prefix (PROFILE_PREFIX))103 if (!exec.has_prefix (APP_PREFIX) && !exec.has_prefix (PROFILE_PREFIX))
67 return false;104 return false;
@@ -79,6 +116,7 @@
79 Gtk.TreeView treeview;116 Gtk.TreeView treeview;
80 Katze.Array array;117 Katze.Array array;
81 GLib.File app_folder;118 GLib.File app_folder;
119 GLib.File profile_folder;
82120
83 public unowned string get_stock_id () {121 public unowned string get_stock_id () {
84 return Midori.Stock.WEB_BROWSER;122 return Midori.Stock.WEB_BROWSER;
@@ -102,7 +140,7 @@
102 string uuid = g_dbus_generate_guid ();140 string uuid = g_dbus_generate_guid ();
103 string config = Path.build_path (Path.DIR_SEPARATOR_S,141 string config = Path.build_path (Path.DIR_SEPARATOR_S,
104 Midori.Paths.get_user_data_dir (), PACKAGE_NAME, "profiles", uuid);142 Midori.Paths.get_user_data_dir (), PACKAGE_NAME, "profiles", uuid);
105 Launcher.create.begin (PROFILE_PREFIX, app_folder,143 Launcher.create.begin (PROFILE_PREFIX, profile_folder.get_child (uuid),
106 config, _("Midori (%s)").printf (uuid), this);144 config, _("Midori (%s)").printf (uuid), this);
107 });145 });
108 toolbar.insert (profile, -1);146 toolbar.insert (profile, -1);
@@ -115,7 +153,8 @@
115 app.show ();153 app.show ();
116 app.clicked.connect (() => {154 app.clicked.connect (() => {
117 var view = (get_toplevel () as Midori.Browser).tab as Midori.View;155 var view = (get_toplevel () as Midori.Browser).tab as Midori.View;
118 Launcher.create.begin (APP_PREFIX, app_folder,156 string checksum = Checksum.compute_for_string (ChecksumType.MD5, view.get_display_uri (), -1);
157 Launcher.create.begin (APP_PREFIX, app_folder.get_child (checksum),
119 view.get_display_uri (), view.get_display_title (), this);158 view.get_display_uri (), view.get_display_title (), this);
120 });159 });
121 toolbar.insert (app, -1);160 toolbar.insert (app, -1);
@@ -151,6 +190,18 @@
151 try {190 try {
152 launcher.file.trash (null);191 launcher.file.trash (null);
153 store.remove (iter);192 store.remove (iter);
193
194 string filename = Midori.Download.clean_filename (launcher.name);
195#if HAVE_WIN32
196 string lnk_filename = Midori.Sokoke.get_win32_desktop_lnk_path_for_filename (filename);
197 if (Posix.access (lnk_filename, Posix.F_OK) == 0) {
198 var lnk_file = File.new_for_path (lnk_filename);
199 lnk_file.trash ();
200 }
201#else
202 var data_dir = File.new_for_path (Midori.Paths.get_user_data_dir ());
203 data_dir.get_child ("applications").get_child (filename + ".desktop").trash ();
204#endif
154 }205 }
155 catch (Error error) {206 catch (Error error) {
156 GLib.critical (error.message);207 GLib.critical (error.message);
@@ -163,7 +214,7 @@
163 return false;214 return false;
164 }215 }
165216
166 public Sidebar (Katze.Array array, GLib.File app_folder) {217 public Sidebar (Katze.Array array, GLib.File app_folder, GLib.File profile_folder) {
167 Gtk.TreeViewColumn column;218 Gtk.TreeViewColumn column;
168219
169 treeview = new Gtk.TreeView.with_model (store);220 treeview = new Gtk.TreeView.with_model (store);
@@ -204,6 +255,7 @@
204 launcher_added (item);255 launcher_added (item);
205256
206 this.app_folder = app_folder;257 this.app_folder = app_folder;
258 this.profile_folder = profile_folder;
207 }259 }
208260
209 private int tree_sort_func (Gtk.TreeModel model, Gtk.TreeIter a, Gtk.TreeIter b) {261 private int tree_sort_func (Gtk.TreeModel model, Gtk.TreeIter a, Gtk.TreeIter b) {
@@ -228,11 +280,18 @@
228280
229 Launcher launcher;281 Launcher launcher;
230 model.get (iter, 0, out launcher);282 model.get (iter, 0, out launcher);
231 if (launcher.icon_name != null)283
284 try {
285 int icon_width = 48, icon_height = 48;
286 Gtk.icon_size_lookup_for_settings (get_settings (),
287 Gtk.IconSize.DIALOG, out icon_width, out icon_height);
288 var pixbuf = new Gdk.Pixbuf.from_file_at_size (launcher.icon_name, icon_width, icon_height);
289 renderer.set ("pixbuf", pixbuf);
290 }
291 catch (Error error) {
232 renderer.set ("icon-name", launcher.icon_name);292 renderer.set ("icon-name", launcher.icon_name);
233 else293 }
234 renderer.set ("stock-id", Gtk.STOCK_FILE);294 renderer.set ("stock-size", Gtk.IconSize.DIALOG,
235 renderer.set ("stock-size", Gtk.IconSize.BUTTON,
236 "xpad", 4);295 "xpad", 4);
237 }296 }
238297
@@ -258,7 +317,8 @@
258 private class Manager : Midori.Extension {317 private class Manager : Midori.Extension {
259 internal Katze.Array array;318 internal Katze.Array array;
260 internal GLib.File app_folder;319 internal GLib.File app_folder;
261 internal GLib.FileMonitor? monitor;320 internal GLib.File profile_folder;
321 internal GLib.List<GLib.FileMonitor> monitors;
262 internal GLib.List<Gtk.Widget> widgets;322 internal GLib.List<Gtk.Widget> widgets;
263323
264 void app_changed (GLib.File file, GLib.File? other, GLib.FileMonitorEvent event) {324 void app_changed (GLib.File file, GLib.File? other, GLib.FileMonitorEvent event) {
@@ -282,9 +342,7 @@
282 }342 }
283 }343 }
284344
285 async void populate_apps () {345 async void populate_apps (File app_folder) {
286 var data_dir = File.new_for_path (Midori.Paths.get_user_data_dir ());
287 app_folder = data_dir.get_child ("applications");
288 try {346 try {
289 try {347 try {
290 app_folder.make_directory_with_parents (null);348 app_folder.make_directory_with_parents (null);
@@ -294,8 +352,9 @@
294 throw folder_error;352 throw folder_error;
295 }353 }
296354
297 monitor = app_folder.monitor_directory (0, null);355 var monitor = app_folder.monitor_directory (0, null);
298 monitor.changed.connect (app_changed);356 monitor.changed.connect (app_changed);
357 monitors.append (monitor);
299358
300 var enumerator = yield app_folder.enumerate_children_async ("standard::name", 0);359 var enumerator = yield app_folder.enumerate_children_async ("standard::name", 0);
301 while (true) {360 while (true) {
@@ -303,9 +362,9 @@
303 if (files == null)362 if (files == null)
304 break;363 break;
305 foreach (var info in files) {364 foreach (var info in files) {
306 var desktop_file = app_folder.get_child (info.get_name ());365 var file = app_folder.get_child (info.get_name ());
307 try {366 try {
308 var launcher = new Launcher (desktop_file);367 var launcher = new Launcher (file);
309 if (launcher.init ())368 if (launcher.init ())
310 array.add_item (launcher);369 array.add_item (launcher);
311 }370 }
@@ -316,8 +375,7 @@
316 }375 }
317 }376 }
318 catch (Error io_error) {377 catch (Error io_error) {
319 monitor = null;378 warning ("Failed to list apps (%s): %s",
320 warning ("Failed to list .desktop files (%s): %s",
321 app_folder.get_path (), io_error.message);379 app_folder.get_path (), io_error.message);
322 }380 }
323 }381 }
@@ -328,13 +386,14 @@
328 menu.append (menuitem);386 menu.append (menuitem);
329 menuitem.activate.connect (() => {387 menuitem.activate.connect (() => {
330 var view = browser.tab as Midori.View;388 var view = browser.tab as Midori.View;
331 Launcher.create.begin (APP_PREFIX, app_folder,389 string checksum = Checksum.compute_for_string (ChecksumType.MD5, view.get_display_uri (), -1);
390 Launcher.create.begin (APP_PREFIX, app_folder.get_child (checksum),
332 view.get_display_uri (), view.get_display_title (), browser);391 view.get_display_uri (), view.get_display_title (), browser);
333 });392 });
334 }393 }
335394
336 void browser_added (Midori.Browser browser) {395 void browser_added (Midori.Browser browser) {
337 var viewable = new Sidebar (array, app_folder);396 var viewable = new Sidebar (array, app_folder, profile_folder);
338 viewable.show ();397 viewable.show ();
339 browser.panel.append_page (viewable);398 browser.panel.append_page (viewable);
340 browser.populate_tool_menu.connect (tool_menu_populated);399 browser.populate_tool_menu.connect (tool_menu_populated);
@@ -344,7 +403,12 @@
344403
345 void activated (Midori.App app) {404 void activated (Midori.App app) {
346 array = new Katze.Array (typeof (Launcher));405 array = new Katze.Array (typeof (Launcher));
347 populate_apps.begin ();406 var data_dir = File.new_for_path (Midori.Paths.get_user_data_dir ()).get_child (PACKAGE_NAME);
407 monitors = new GLib.List<GLib.FileMonitor> ();
408 app_folder = data_dir.get_child ("apps");
409 populate_apps.begin (app_folder);
410 profile_folder = data_dir.get_child ("profiles");
411 populate_apps.begin (profile_folder);
348 widgets = new GLib.List<Gtk.Widget> ();412 widgets = new GLib.List<Gtk.Widget> ();
349 foreach (var browser in app.get_browsers ())413 foreach (var browser in app.get_browsers ())
350 browser_added (browser);414 browser_added (browser);
@@ -353,8 +417,10 @@
353417
354 void deactivated () {418 void deactivated () {
355 var app = get_app ();419 var app = get_app ();
356 if (monitor != null)420 foreach (var monitor in monitors)
357 monitor.changed.disconnect (app_changed);421 monitor.changed.disconnect (app_changed);
422 monitors = null;
423
358 app.add_browser.disconnect (browser_added);424 app.add_browser.disconnect (browser_added);
359 foreach (var widget in widgets)425 foreach (var widget in widgets)
360 widget.destroy ();426 widget.destroy ();
361427
=== modified file 'katze/katze-item.c'
--- katze/katze-item.c 2013-06-25 16:26:37 +0000
+++ katze/katze-item.c 2013-07-04 20:20:33 +0000
@@ -447,8 +447,6 @@
447447
448 if (widget && KATZE_ITEM_IS_FOLDER (item))448 if (widget && KATZE_ITEM_IS_FOLDER (item))
449 return gtk_widget_render_icon (widget, GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU, NULL);449 return gtk_widget_render_icon (widget, GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU, NULL);
450 if ((pixbuf = midori_paths_get_icon (katze_item_get_icon (item), NULL)))
451 return pixbuf;
452 if ((pixbuf = midori_paths_get_icon (item->uri, widget)))450 if ((pixbuf = midori_paths_get_icon (item->uri, widget)))
453 return pixbuf;451 return pixbuf;
454 return NULL;452 return NULL;
455453
=== modified file 'katze/midori-paths.vala'
--- katze/midori-paths.vala 2013-06-26 21:54:50 +0000
+++ katze/midori-paths.vala 2013-07-04 20:20:33 +0000
@@ -424,6 +424,8 @@
424 if (widget != null)424 if (widget != null)
425 Gtk.icon_size_lookup_for_settings (widget.get_settings (),425 Gtk.icon_size_lookup_for_settings (widget.get_settings (),
426 Gtk.IconSize.MENU, out icon_width, out icon_height);426 Gtk.IconSize.MENU, out icon_width, out icon_height);
427 else
428 icon_width = icon_height = 0 /* maximum size */;
427#if HAVE_WEBKIT2429#if HAVE_WEBKIT2
428 /* TODO async430 /* TODO async
429 var database = WebKit.WebContext.get_default ().get_favicon_database ();431 var database = WebKit.WebContext.get_default ().get_favicon_database ();
430432
=== modified file 'midori/midori-completion.vala'
--- midori/midori-completion.vala 2013-05-19 09:43:05 +0000
+++ midori/midori-completion.vala 2013-07-04 20:20:33 +0000
@@ -52,6 +52,7 @@
52 MARKUP,52 MARKUP,
53 BACKGROUND,53 BACKGROUND,
54 YALIGN,54 YALIGN,
55 SIZE,
55 N56 N
56 }57 }
5758
@@ -60,8 +61,8 @@
60 completions = new List<Completion> ();61 completions = new List<Completion> ();
61 next_position = 0;62 next_position = 0;
62 model = new Gtk.ListStore (Columns.N,63 model = new Gtk.ListStore (Columns.N,
63 typeof (Gdk.Pixbuf), typeof (string), typeof (string),64 typeof (GLib.Icon), typeof (string), typeof (string),
64 typeof (string), typeof (float));65 typeof (string), typeof (float), typeof (uint));
65 }66 }
6667
67 public void add (Completion completion) {68 public void add (Completion completion) {
@@ -78,6 +79,17 @@
78 return false;79 return false;
79 }80 }
8081
82 private GLib.Icon? scale_if_needed (GLib.Icon? icon) {
83 if (icon is Gdk.Pixbuf) {
84 var pixbuf = icon as Gdk.Pixbuf;
85 int icon_width = 16, icon_height = 16;
86 Gtk.icon_size_lookup (Gtk.IconSize.MENU, out icon_width, out icon_height);
87 if (pixbuf.width > icon_width || pixbuf.height > icon_height)
88 return pixbuf.scale_simple (icon_width, icon_height, Gdk.InterpType.BILINEAR);
89 }
90 return icon;
91 }
92
81 private void fill_model (Midori.Completion completion, List<Midori.Suggestion>? suggestions) {93 private void fill_model (Midori.Completion completion, List<Midori.Suggestion>? suggestions) {
82 if (need_to_clear) {94 if (need_to_clear) {
83 model.clear ();95 model.clear ();
@@ -91,6 +103,7 @@
91 Columns.URI, "about:completion-description",103 Columns.URI, "about:completion-description",
92 Columns.MARKUP, "<b>%s</b>\n".printf (Markup.escape_text (completion.description)),104 Columns.MARKUP, "<b>%s</b>\n".printf (Markup.escape_text (completion.description)),
93 Columns.ICON, null,105 Columns.ICON, null,
106 Columns.SIZE, Gtk.IconSize.MENU,
94 Columns.BACKGROUND, null,107 Columns.BACKGROUND, null,
95 Columns.YALIGN, 0.25);108 Columns.YALIGN, 0.25);
96 }109 }
@@ -110,7 +123,8 @@
110 Columns.URI, suggestion.uri,123 Columns.URI, suggestion.uri,
111 Columns.MARKUP, suggestion.use_markup124 Columns.MARKUP, suggestion.use_markup
112 ? suggestion.markup : Markup.escape_text (suggestion.markup),125 ? suggestion.markup : Markup.escape_text (suggestion.markup),
113 Columns.ICON, suggestion.icon,126 Columns.ICON, scale_if_needed (suggestion.icon),
127 Columns.SIZE, Gtk.IconSize.MENU,
114 Columns.BACKGROUND, suggestion.background,128 Columns.BACKGROUND, suggestion.background,
115 Columns.YALIGN, 0.25);129 Columns.YALIGN, 0.25);
116130
117131
=== modified file 'midori/midori-locationaction.c'
--- midori/midori-locationaction.c 2013-06-21 20:49:53 +0000
+++ midori/midori-locationaction.c 2013-07-04 20:20:33 +0000
@@ -714,7 +714,8 @@
714 renderer = gtk_cell_renderer_pixbuf_new ();714 renderer = gtk_cell_renderer_pixbuf_new ();
715 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (column), renderer, FALSE);715 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (column), renderer, FALSE);
716 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (column), renderer,716 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (column), renderer,
717 "pixbuf", MIDORI_AUTOCOMPLETER_COLUMNS_ICON,717 "gicon", MIDORI_AUTOCOMPLETER_COLUMNS_ICON,
718 "stock-size", MIDORI_AUTOCOMPLETER_COLUMNS_SIZE,
718 "yalign", MIDORI_AUTOCOMPLETER_COLUMNS_YALIGN,719 "yalign", MIDORI_AUTOCOMPLETER_COLUMNS_YALIGN,
719 "cell-background", MIDORI_AUTOCOMPLETER_COLUMNS_BACKGROUND,720 "cell-background", MIDORI_AUTOCOMPLETER_COLUMNS_BACKGROUND,
720 NULL);721 NULL);
721722
=== modified file 'midori/midori-searchcompletion.vala'
--- midori/midori-searchcompletion.vala 2013-05-19 09:43:05 +0000
+++ midori/midori-searchcompletion.vala 2013-07-04 20:20:33 +0000
@@ -39,16 +39,13 @@
39 var suggestions = new List<Suggestion> ();39 var suggestions = new List<Suggestion> ();
40 uint n = 0;40 uint n = 0;
41 foreach (var item in items) {41 foreach (var item in items) {
42 string icon, uri, title, desc;42 string uri, title, desc;
43 item.get ("icon", out icon);
44 item.get ("uri", out uri);43 item.get ("uri", out uri);
45 item.get ("name", out title);44 item.get ("name", out title);
46 item.get ("text", out desc);45 item.get ("text", out desc);
47 string search_uri = URI.for_search (uri, text);46 string search_uri = URI.for_search (uri, text);
48 string search_title = _("Search with %s").printf (title);47 string search_title = _("Search with %s").printf (title);
49 Gdk.Pixbuf? pixbuf = Midori.Paths.get_icon (icon, null);48 Gdk.Pixbuf? pixbuf = Midori.Paths.get_icon (uri, null);
50 if (pixbuf == null)
51 pixbuf = Midori.Paths.get_icon (uri, null);
52 string search_desc = search_title + "\n" + desc ?? uri;49 string search_desc = search_title + "\n" + desc ?? uri;
53 /* FIXME: Theming? Win32? */50 /* FIXME: Theming? Win32? */
54 string background = "gray";51 string background = "gray";
5552
=== modified file 'midori/midori.vapi'
--- midori/midori.vapi 2013-05-28 20:02:29 +0000
+++ midori/midori.vapi 2013-07-04 20:20:33 +0000
@@ -252,6 +252,10 @@
252 [CCode (cheader_filename = "midori/sokoke.h", lower_case_cprefix = "sokoke_")]252 [CCode (cheader_filename = "midori/sokoke.h", lower_case_cprefix = "sokoke_")]
253 namespace Sokoke {253 namespace Sokoke {
254 public static uint gtk_action_count_modifiers (Gtk.Action action);254 public static uint gtk_action_count_modifiers (Gtk.Action action);
255 #if HAVE_WIN32
256 public static string get_win32_desktop_lnk_path_for_filename (string filename);
257 public static void create_win32_desktop_lnk (string prefix, string filename, string uri);
258 #endif
255 }259 }
256}260}
257261
258262
=== modified file 'midori/sokoke.c'
--- midori/sokoke.c 2013-06-26 21:54:50 +0000
+++ midori/sokoke.c 2013-07-04 20:20:33 +0000
@@ -34,6 +34,11 @@
34#include <glib/gstdio.h>34#include <glib/gstdio.h>
35#include "katze/katze.h"35#include "katze/katze.h"
3636
37#ifdef G_OS_WIN32
38#include <windows.h>
39#include <shlobj.h>
40#endif
41
37static gchar*42static gchar*
38sokoke_js_string_utf8 (JSStringRef js_string)43sokoke_js_string_utf8 (JSStringRef js_string)
39{44{
@@ -1116,3 +1121,65 @@
1116 return entry;1121 return entry;
1117}1122}
11181123
1124#ifdef G_OS_WIN32
1125gchar*
1126sokoke_get_win32_desktop_lnk_path_for_filename (gchar* filename)
1127{
1128 const gchar* desktop_dir;
1129 gchar* lnk_path, *lnk_file;
1130
1131 /* CSIDL_PROGRAMS for "start menu -> programs" instead - needs saner/shorter filename */
1132 desktop_dir = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
1133
1134 lnk_file = g_strconcat (filename, ".lnk", NULL);
1135 lnk_path = g_build_filename (desktop_dir, lnk_file, NULL);
1136
1137 g_free (lnk_file);
1138
1139 return lnk_path;
1140}
1141
1142void
1143sokoke_create_win32_desktop_lnk (gchar* prefix, gchar* filename, gchar* uri)
1144{
1145 WCHAR w[MAX_PATH];
1146
1147 gchar* exec_dir, *exec_path, *argument;
1148 gchar* lnk_path, *launcher_type;
1149
1150 IShellLink* pShellLink;
1151 IPersistFile* pPersistFile;
1152
1153 exec_dir = g_win32_get_package_installation_directory_of_module (NULL);
1154 exec_path = g_build_filename (exec_dir, "bin", "midori.exe", NULL);
1155
1156 if (g_str_has_suffix (prefix, " -a "))
1157 launcher_type = "-a";
1158 else if (g_str_has_suffix (prefix, " -c "))
1159 launcher_type = "-c";
1160
1161 argument = g_strdup_printf ("%s \"%s\"", launcher_type, uri);
1162
1163 /* Create link */
1164 CoCreateInstance (&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (LPVOID *)&pShellLink);
1165 pShellLink->lpVtbl->SetPath (pShellLink, exec_path);
1166 pShellLink->lpVtbl->SetArguments (pShellLink, argument);
1167 /* TODO: support adding site favicon as webapp icon */
1168 /* pShellLink->lpVtbl->SetIconLocation (pShellLink, icon_path, icon_index); */
1169
1170 /* Save link */
1171 lnk_path = sokoke_get_win32_desktop_lnk_path_for_filename (filename);
1172 pShellLink->lpVtbl->QueryInterface (pShellLink, &IID_IPersistFile, (LPVOID *)&pPersistFile);
1173 MultiByteToWideChar (CP_UTF8, 0, lnk_path, -1, w, MAX_PATH);
1174 pPersistFile->lpVtbl->Save (pPersistFile, w, TRUE);
1175
1176 pPersistFile->lpVtbl->Release (pPersistFile);
1177 pShellLink->lpVtbl->Release (pShellLink);
1178
1179 g_free (exec_dir);
1180 g_free (exec_path);
1181 g_free (argument);
1182 g_free (lnk_path);
1183 g_free (launcher_type);
1184}
1185#endif
11191186
=== modified file 'midori/sokoke.h'
--- midori/sokoke.h 2013-04-11 20:38:19 +0000
+++ midori/sokoke.h 2013-07-04 20:20:33 +0000
@@ -128,4 +128,12 @@
128GtkWidget*128GtkWidget*
129sokoke_search_entry_new (const gchar* placeholder_text);129sokoke_search_entry_new (const gchar* placeholder_text);
130130
131#ifdef G_OS_WIN32
132gchar*
133sokoke_get_win32_desktop_lnk_path_for_filename (gchar* filename);
134
135void
136sokoke_create_win32_desktop_lnk (gchar* prefix, gchar* filename, gchar* uri);
137#endif
138
131#endif /* !__SOKOKE_H__ */139#endif /* !__SOKOKE_H__ */
132140
=== modified file 'midori/wscript_build'
--- midori/wscript_build 2013-05-14 17:52:15 +0000
+++ midori/wscript_build 2013-07-04 20:20:33 +0000
@@ -9,7 +9,7 @@
9progressive = True9progressive = True
10libs = 'M UNIQUE LIBSOUP GMODULE GTHREAD LIBIDN GIO GTK SQLITE ' \10libs = 'M UNIQUE LIBSOUP GMODULE GTHREAD LIBIDN GIO GTK SQLITE ' \
11 'LIBNOTIFY WEBKIT JAVASCRIPTCOREGTK LIBXML X11 XSS WS2_32 ' \11 'LIBNOTIFY WEBKIT JAVASCRIPTCOREGTK LIBXML X11 XSS WS2_32 ' \
12 'GCR GRANITE ZEITGEIST'12 'GCR GRANITE ZEITGEIST OLE32 UUID '
1313
14if Options.commands['build'] or Options.commands['check']:14if Options.commands['build'] or Options.commands['check']:
15 blddir = str (bld.bldnode)[6:] # dir:// + absolute path15 blddir = str (bld.bldnode)[6:] # dir:// + absolute path
1616
=== modified file 'wscript'
--- wscript 2013-06-30 14:37:38 +0000
+++ wscript 2013-07-04 20:20:33 +0000
@@ -309,6 +309,8 @@
309 conf.check (function_name='inet_addr', header_name='sys/types.h sys/socket.h netinet/in.h arpa/inet.h')309 conf.check (function_name='inet_addr', header_name='sys/types.h sys/socket.h netinet/in.h arpa/inet.h')
310 conf.define ('HAVE_OSX', int(sys.platform == 'darwin'))310 conf.define ('HAVE_OSX', int(sys.platform == 'darwin'))
311 if Options.platform == 'win32':311 if Options.platform == 'win32':
312 conf.check (lib='ole32')
313 conf.check (lib='uuid')
312 conf.env.append_value ('LINKFLAGS', '-mwindows')314 conf.env.append_value ('LINKFLAGS', '-mwindows')
313 conf.env.append_value ('program_LINKFLAGS', ['-Wl,--out-implib=default/midori/libmidori.a', '-Wl,--export-all-symbols'])315 conf.env.append_value ('program_LINKFLAGS', ['-Wl,--out-implib=default/midori/libmidori.a', '-Wl,--export-all-symbols'])
314 else:316 else:

Subscribers

People subscribed via source and target branches

to all changes: