Merge lp:~tuxator/midori/apple-2 into lp:~kalikiana/midori/apple

Proposed by Paweł Forysiuk
Status: Merged
Merged at revision: 6205
Proposed branch: lp:~tuxator/midori/apple-2
Merge into: lp:~kalikiana/midori/apple
Diff against target: 111 lines (+31/-15)
4 files modified
extensions/apps.vala (+4/-1)
midori/midori.vapi (+1/-0)
midori/sokoke.c (+23/-14)
midori/sokoke.h (+3/-0)
To merge this branch: bzr merge lp:~tuxator/midori/apple-2
Reviewer Review Type Date Requested Status
Cris Dywan Pending
Review via email: mp+172223@code.launchpad.net

Commit message

Implement deleting default launcher on win32

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'extensions/apps.vala'
2--- extensions/apps.vala 2013-06-29 18:14:54 +0000
3+++ extensions/apps.vala 2013-06-29 22:20:38 +0000
4@@ -192,7 +192,10 @@
5 launcher.file.trash (null);
6 store.remove (iter);
7 #if HAVE_WIN32
8- // TODO: implement Win32 version
9+ string filename = Midori.Download.clean_filename (launcher.name);
10+ var lnk_filename = Midori.Sokoke.get_win32_desktop_lnk_path_from_title (filename);
11+ var lnk_file = File.new_for_path (lnk_filename);
12+ lnk_file.trash ();
13 #else
14 var data_dir = File.new_for_path (Midori.Paths.get_user_data_dir ());
15 string filename = Midori.Download.clean_filename (launcher.name);
16
17=== modified file 'midori/midori.vapi'
18--- midori/midori.vapi 2013-06-29 18:01:37 +0000
19+++ midori/midori.vapi 2013-06-29 22:20:38 +0000
20@@ -253,6 +253,7 @@
21 namespace Sokoke {
22 public static uint gtk_action_count_modifiers (Gtk.Action action);
23 #if HAVE_WIN32
24+ public static string get_win32_desktop_lnk_path_from_title (string title);
25 public static void create_win32_desktop_lnk (string prefix, string title, string uri);
26 #endif
27 }
28
29=== modified file 'midori/sokoke.c'
30--- midori/sokoke.c 2013-06-29 18:01:37 +0000
31+++ midori/sokoke.c 2013-06-29 22:20:38 +0000
32@@ -1154,26 +1154,36 @@
33 }
34
35 #ifdef G_OS_WIN32
36-void
37-sokoke_create_win32_desktop_lnk (gchar* prefix, gchar* title, gchar* uri)
38+gchar*
39+sokoke_get_win32_desktop_lnk_path_from_title (gchar* title)
40 {
41- gchar* exec_dir, *exec_path, *argument;
42- gchar* filename, *lnk_file, *lnk_path;
43- gchar* launcher_type;
44-
45 WCHAR desktop_dir[MAX_PATH];
46- WCHAR w[MAX_PATH];
47-
48- IShellLink* pShellLink;
49- IPersistFile* pPersistFile;
50+ gchar* filename, *lnk_path, *lnk_file;
51
52 /* Retrive current path of User's Desktop directory, could be moved / on different partition */
53- SHGetFolderPath (NULL, CSIDL_DESKTOPDIRECTORY, NULL, SHGFP_TYPE_CURRENT, &desktop_dir);
54+ SHGetFolderPath (NULL, CSIDL_DESKTOPDIRECTORY, NULL, SHGFP_TYPE_CURRENT, (LPSTR)&desktop_dir);
55 /* CSIDL_PROGRAMS for "start menu -> programs" instead - needs saner/shorter filename */
56
57 filename = midori_download_clean_filename (title);
58 lnk_file = g_strconcat (filename, ".lnk", NULL);
59- lnk_path = g_build_filename (desktop_dir, lnk_file, NULL);
60+ lnk_path = g_build_filename ((gchar*)desktop_dir, lnk_file, NULL);
61+
62+ g_free (filename);
63+ g_free (lnk_file);
64+
65+ return lnk_path;
66+}
67+
68+void
69+sokoke_create_win32_desktop_lnk (gchar* prefix, gchar* title, gchar* uri)
70+{
71+ WCHAR w[MAX_PATH];
72+
73+ gchar* exec_dir, *exec_path, *argument;
74+ gchar* lnk_path, *launcher_type;
75+
76+ IShellLink* pShellLink;
77+ IPersistFile* pPersistFile;
78
79 exec_dir = g_win32_get_package_installation_directory_of_module (NULL);
80 exec_path = g_build_filename (exec_dir, "bin", "midori.exe", NULL);
81@@ -1193,6 +1203,7 @@
82 /* pShellLink->lpVtbl->SetIconLocation (pShellLink, icon_path, icon_index); */
83
84 /* Save link */
85+ lnk_path = sokoke_get_win32_desktop_lnk_path_from_title (title);
86 pShellLink->lpVtbl->QueryInterface (pShellLink, &IID_IPersistFile, (LPVOID *)&pPersistFile);
87 MultiByteToWideChar (CP_UTF8, 0, lnk_path, -1, w, MAX_PATH);
88 pPersistFile->lpVtbl->Save (pPersistFile, w, TRUE);
89@@ -1203,8 +1214,6 @@
90 g_free (exec_dir);
91 g_free (exec_path);
92 g_free (argument);
93- g_free (filename);
94- g_free (lnk_file);
95 g_free (lnk_path);
96 g_free (launcher_type);
97 }
98
99=== modified file 'midori/sokoke.h'
100--- midori/sokoke.h 2013-06-29 18:01:37 +0000
101+++ midori/sokoke.h 2013-06-29 22:20:38 +0000
102@@ -129,6 +129,9 @@
103 sokoke_search_entry_new (const gchar* placeholder_text);
104
105 #ifdef G_OS_WIN32
106+gchar*
107+sokoke_get_win32_desktop_lnk_path_from_title (gchar* title);
108+
109 void
110 sokoke_create_win32_desktop_lnk (gchar* prefix, gchar* title, gchar* uri);
111 #endif

Subscribers

People subscribed via source and target branches

to all changes: