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
=== modified file 'extensions/apps.vala'
--- extensions/apps.vala 2013-06-29 18:14:54 +0000
+++ extensions/apps.vala 2013-06-29 22:20:38 +0000
@@ -192,7 +192,10 @@
192 launcher.file.trash (null);192 launcher.file.trash (null);
193 store.remove (iter);193 store.remove (iter);
194#if HAVE_WIN32194#if HAVE_WIN32
195 // TODO: implement Win32 version195 string filename = Midori.Download.clean_filename (launcher.name);
196 var lnk_filename = Midori.Sokoke.get_win32_desktop_lnk_path_from_title (filename);
197 var lnk_file = File.new_for_path (lnk_filename);
198 lnk_file.trash ();
196#else199#else
197 var data_dir = File.new_for_path (Midori.Paths.get_user_data_dir ());200 var data_dir = File.new_for_path (Midori.Paths.get_user_data_dir ());
198 string filename = Midori.Download.clean_filename (launcher.name);201 string filename = Midori.Download.clean_filename (launcher.name);
199202
=== modified file 'midori/midori.vapi'
--- midori/midori.vapi 2013-06-29 18:01:37 +0000
+++ midori/midori.vapi 2013-06-29 22:20:38 +0000
@@ -253,6 +253,7 @@
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_WIN32255 #if HAVE_WIN32
256 public static string get_win32_desktop_lnk_path_from_title (string title);
256 public static void create_win32_desktop_lnk (string prefix, string title, string uri);257 public static void create_win32_desktop_lnk (string prefix, string title, string uri);
257 #endif258 #endif
258 }259 }
259260
=== modified file 'midori/sokoke.c'
--- midori/sokoke.c 2013-06-29 18:01:37 +0000
+++ midori/sokoke.c 2013-06-29 22:20:38 +0000
@@ -1154,26 +1154,36 @@
1154}1154}
11551155
1156#ifdef G_OS_WIN321156#ifdef G_OS_WIN32
1157void1157gchar*
1158sokoke_create_win32_desktop_lnk (gchar* prefix, gchar* title, gchar* uri)1158sokoke_get_win32_desktop_lnk_path_from_title (gchar* title)
1159{1159{
1160 gchar* exec_dir, *exec_path, *argument;
1161 gchar* filename, *lnk_file, *lnk_path;
1162 gchar* launcher_type;
1163
1164 WCHAR desktop_dir[MAX_PATH];1160 WCHAR desktop_dir[MAX_PATH];
1165 WCHAR w[MAX_PATH];1161 gchar* filename, *lnk_path, *lnk_file;
1166
1167 IShellLink* pShellLink;
1168 IPersistFile* pPersistFile;
11691162
1170 /* Retrive current path of User's Desktop directory, could be moved / on different partition */1163 /* Retrive current path of User's Desktop directory, could be moved / on different partition */
1171 SHGetFolderPath (NULL, CSIDL_DESKTOPDIRECTORY, NULL, SHGFP_TYPE_CURRENT, &desktop_dir);1164 SHGetFolderPath (NULL, CSIDL_DESKTOPDIRECTORY, NULL, SHGFP_TYPE_CURRENT, (LPSTR)&desktop_dir);
1172 /* CSIDL_PROGRAMS for "start menu -> programs" instead - needs saner/shorter filename */1165 /* CSIDL_PROGRAMS for "start menu -> programs" instead - needs saner/shorter filename */
11731166
1174 filename = midori_download_clean_filename (title);1167 filename = midori_download_clean_filename (title);
1175 lnk_file = g_strconcat (filename, ".lnk", NULL);1168 lnk_file = g_strconcat (filename, ".lnk", NULL);
1176 lnk_path = g_build_filename (desktop_dir, lnk_file, NULL);1169 lnk_path = g_build_filename ((gchar*)desktop_dir, lnk_file, NULL);
1170
1171 g_free (filename);
1172 g_free (lnk_file);
1173
1174 return lnk_path;
1175}
1176
1177void
1178sokoke_create_win32_desktop_lnk (gchar* prefix, gchar* title, gchar* uri)
1179{
1180 WCHAR w[MAX_PATH];
1181
1182 gchar* exec_dir, *exec_path, *argument;
1183 gchar* lnk_path, *launcher_type;
1184
1185 IShellLink* pShellLink;
1186 IPersistFile* pPersistFile;
11771187
1178 exec_dir = g_win32_get_package_installation_directory_of_module (NULL);1188 exec_dir = g_win32_get_package_installation_directory_of_module (NULL);
1179 exec_path = g_build_filename (exec_dir, "bin", "midori.exe", NULL);1189 exec_path = g_build_filename (exec_dir, "bin", "midori.exe", NULL);
@@ -1193,6 +1203,7 @@
1193 /* pShellLink->lpVtbl->SetIconLocation (pShellLink, icon_path, icon_index); */1203 /* pShellLink->lpVtbl->SetIconLocation (pShellLink, icon_path, icon_index); */
11941204
1195 /* Save link */1205 /* Save link */
1206 lnk_path = sokoke_get_win32_desktop_lnk_path_from_title (title);
1196 pShellLink->lpVtbl->QueryInterface (pShellLink, &IID_IPersistFile, (LPVOID *)&pPersistFile);1207 pShellLink->lpVtbl->QueryInterface (pShellLink, &IID_IPersistFile, (LPVOID *)&pPersistFile);
1197 MultiByteToWideChar (CP_UTF8, 0, lnk_path, -1, w, MAX_PATH);1208 MultiByteToWideChar (CP_UTF8, 0, lnk_path, -1, w, MAX_PATH);
1198 pPersistFile->lpVtbl->Save (pPersistFile, w, TRUE);1209 pPersistFile->lpVtbl->Save (pPersistFile, w, TRUE);
@@ -1203,8 +1214,6 @@
1203 g_free (exec_dir);1214 g_free (exec_dir);
1204 g_free (exec_path);1215 g_free (exec_path);
1205 g_free (argument);1216 g_free (argument);
1206 g_free (filename);
1207 g_free (lnk_file);
1208 g_free (lnk_path);1217 g_free (lnk_path);
1209 g_free (launcher_type);1218 g_free (launcher_type);
1210}1219}
12111220
=== modified file 'midori/sokoke.h'
--- midori/sokoke.h 2013-06-29 18:01:37 +0000
+++ midori/sokoke.h 2013-06-29 22:20:38 +0000
@@ -129,6 +129,9 @@
129sokoke_search_entry_new (const gchar* placeholder_text);129sokoke_search_entry_new (const gchar* placeholder_text);
130130
131#ifdef G_OS_WIN32131#ifdef G_OS_WIN32
132gchar*
133sokoke_get_win32_desktop_lnk_path_from_title (gchar* title);
134
132void135void
133sokoke_create_win32_desktop_lnk (gchar* prefix, gchar* title, gchar* uri);136sokoke_create_win32_desktop_lnk (gchar* prefix, gchar* title, gchar* uri);
134#endif137#endif

Subscribers

People subscribed via source and target branches

to all changes: