From 7a18c414b937ffec3210e550acaa3594c5b5b8d7 Mon Sep 17 00:00:00 2001 From: Jasper Huijsmans Date: Fri, 28 Dec 2007 11:30:10 +0100 Subject: [PATCH 4/4] Improve 0install support. The exec field of the entry can be filled in; the name field is temporary and will be updated when the 0install callback returns. --- plugins/launcher/launcher-dnd-0install.c | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/plugins/launcher/launcher-dnd-0install.c b/plugins/launcher/launcher-dnd-0install.c index 08347a2..11d64f9 100644 --- a/plugins/launcher/launcher-dnd-0install.c +++ b/plugins/launcher/launcher-dnd-0install.c @@ -67,10 +67,6 @@ launcher_entry_update_from_interface (LauncherEntry *e, " sys.stdout.write(iface_cache.get_icon_path(iface));", NULL, NULL}; - /* Set the command to "0launch iface" */ - g_free (e->exec); - e->exec = g_strconcat ("0launch ", iface, NULL); - /* Get the name and summary from the interface file. Since 0launch * worked, the user should have Python... */ @@ -141,7 +137,7 @@ zero_install_launch_done (GPid pid, else { xfce_warn(_("The Zero Install GUI has finished, but the launcher dialog " - "has disappeared in the meantime. Not adding launcher " + "has disappeared in the meantime. Not updating launcher " "(but any files downloaded have not been lost).")); } } @@ -151,11 +147,12 @@ zero_install_launch_done (GPid pid, panel_slice_free(ZeroInstallProcess, info); } -/** The user wants to add a launcher for 'interface'. Confirm that it +/** + * The user wants to add a launcher for 'interface'. Confirm that it * is a valid Zero Install interface, download archives needed to run * the program, and then add it as a launcher. - * Note: This function will return immediately without adding or updating - * the entry. The update happens later in a callback. + * Note: This function will return immediately with only a temporary + * update of the entry. The full update happens later in a callback. */ gboolean launcher_dnd_handle_zeroinstall_interface (const char *file, @@ -183,6 +180,15 @@ launcher_dnd_handle_zeroinstall_interface (const char *file, return FALSE; } + /* set temporary name */ + g_free (entry->name); + entry->name = g_path_get_basename (file); + + /* set the command to "0launch iface" */ + g_free (entry->exec); + entry->exec = g_strconcat ("0launch ", file, NULL); + + /* add 0install callback */ info = panel_slice_new0 (ZeroInstallProcess); info->interface_uri = g_strdup(file); -- 1.5.3.7