Merge lp:~osomon/unity/4.0-dash-custom-home-screen into lp:unity/4.0

Proposed by Olivier Tilloy
Status: Rejected
Rejected by: Gord Allott
Proposed branch: lp:~osomon/unity/4.0-dash-custom-home-screen
Merge into: lp:unity/4.0
Diff against target: 72 lines (+28/-4)
1 file modified
plugins/unityshell/src/PlacesHomeView.cpp (+28/-4)
To merge this branch: bzr merge lp:~osomon/unity/4.0-dash-custom-home-screen
Reviewer Review Type Date Requested Status
Gord Allott (community) Approve
Review via email: mp+88017@code.launchpad.net

Commit message

Do not rely solely on the executable name to launch an application, this doesn’t work for applications that are launched with parameters.

Use g_app_info_launch(…) instead.

To post a comment you must log in.
Revision history for this message
Gord Allott (gordallott) wrote :

On Tue 10 Jan 2012 08:52:40 GMT, Olivier Tilloy wrote:
> Olivier Tilloy has proposed merging lp:~osomon/unity/4.0-dash-custom-home-screen into lp:unity/4.0.
>
> Requested reviews:
> Unity Team (unity-team)
> Related bugs:
> Bug #913885 in unity (Ubuntu): "Custom dash shortcut to desktop file drops Exec args"
> https://bugs.launchpad.net/ubuntu/+source/unity/+bug/913885
>
> For more details, see:
> https://code.launchpad.net/~osomon/unity/4.0-dash-custom-home-screen/+merge/88017

Looks good to me, desktop files are great ;) approving

 review approve
 status approved

--
Gordon Allott
Canonical Ltd.
27 Floor, Millbank Tower
London SW1P 4QP
www.canonical.com

review: Approve

Unmerged revisions

1723. By Olivier Tilloy

Do not rely solely on the executable name to launch an application, this doesn’t work for applications that are launched with parameters.

Use g_app_info_launch(…) instead.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/unityshell/src/PlacesHomeView.cpp'
--- plugins/unityshell/src/PlacesHomeView.cpp 2011-12-15 12:15:00 +0000
+++ plugins/unityshell/src/PlacesHomeView.cpp 2012-01-10 08:51:27 +0000
@@ -75,7 +75,8 @@
75 _id(0),75 _id(0),
76 _place_id(NULL),76 _place_id(NULL),
77 _place_section(0),77 _place_section(0),
78 _exec(NULL)78 _exec(NULL),
79 _desktop_filename(NULL)
79 {80 {
80 SetDndEnabled(false, false);81 SetDndEnabled(false, false);
81 }82 }
@@ -84,12 +85,14 @@
84 {85 {
85 g_free(_place_id);86 g_free(_place_id);
86 g_free(_exec);87 g_free(_exec);
88 g_free(_desktop_filename);
87 }89 }
8890
89 int _id;91 int _id;
90 gchar* _place_id;92 gchar* _place_id;
91 guint32 _place_section;93 guint32 _place_section;
92 char* _exec;94 char* _exec;
95 char* _desktop_filename;
93};96};
9497
95PlacesHomeView::PlacesHomeView()98PlacesHomeView::PlacesHomeView()
@@ -344,11 +347,10 @@
344 icon = cicon;347 icon = cicon;
345 g_free(cicon);348 g_free(cicon);
346 }349 }
347 gchar* exec = g_strdup(g_app_info_get_executable(G_APP_INFO(info)));
348 markup = g_strdup_printf(temp, name.c_str());350 markup = g_strdup_printf(temp, name.c_str());
349 shortcut = new Shortcut(icon.c_str(), markup, style->GetHomeTileIconSize());351 shortcut = new Shortcut(icon.c_str(), markup, style->GetHomeTileIconSize());
350 shortcut->_id = TYPE_EXEC;352 shortcut->_id = TYPE_EXEC;
351 shortcut->_exec = exec;353 shortcut->_desktop_filename = g_strdup(g_desktop_app_info_get_filename(info));
352 _layout->AddView(shortcut, 1, nux::eLeft, nux::eFull);354 _layout->AddView(shortcut, 1, nux::eLeft, nux::eFull);
353 shortcut->sigClick.connect(sigc::mem_fun(this, &PlacesHomeView::OnShortcutClicked));355 shortcut->sigClick.connect(sigc::mem_fun(this, &PlacesHomeView::OnShortcutClicked));
354 g_free(markup);356 g_free(markup);
@@ -526,7 +528,29 @@
526 {528 {
527 GError* error = NULL;529 GError* error = NULL;
528530
529 if (!g_spawn_command_line_async(shortcut->_exec, &error))531 if (shortcut->_desktop_filename != NULL)
532 {
533 GDesktopAppInfo* info = g_desktop_app_info_new_from_filename(shortcut->_desktop_filename);
534 if (G_IS_DESKTOP_APP_INFO(info))
535 {
536 if (!g_app_info_launch(G_APP_INFO(info), NULL, NULL, &error))
537 {
538 g_warning("%s: Unable to launch %s: %s",
539 G_STRFUNC,
540 shortcut->_desktop_filename,
541 error->message);
542 g_error_free(error);
543 }
544 g_object_unref(info);
545 }
546 else
547 {
548 g_warning("%s: Unable to build desktop file info from %s",
549 G_STRFUNC,
550 shortcut->_desktop_filename);
551 }
552 }
553 else if (!g_spawn_command_line_async(shortcut->_exec, &error))
530 {554 {
531 g_warning("%s: Unable to launch %s: %s",555 g_warning("%s: Unable to launch %s: %s",
532 G_STRFUNC,556 G_STRFUNC,

Subscribers

People subscribed via source and target branches

to all changes: