Updating branch refs/heads/master to e8991c4032745c9060eed6567c1d3664149fb9c7 (commit) from c01452e04f787999876fd38761c9fbe698cabab7 (commit)
commit e8991c4032745c9060eed6567c1d3664149fb9c7 Author: Landry Breuil <lan...@xfce.org> Date: Wed Apr 25 19:50:44 2012 +0200 Launch the on-mount command async to avoid blocking plugin UI Move error code dialog around to differentiate the case when mount command itself failed from the case when it's the on-mount command panel-plugin/devices.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/panel-plugin/devices.c b/panel-plugin/devices.c index 5f823b7..6de08ae 100644 --- a/panel-plugin/devices.c +++ b/panel-plugin/devices.c @@ -275,7 +275,12 @@ disk_mount (t_disk *pdisk, char *on_mount_cmd, char* mount_command, gboolean eje val = g_spawn_command_line_sync (cmd, &output, &erroutput, &exit_status, &error); DBG("cmd: '%s', returned %d, exit_status=%d", cmd, val, exit_status); if (val == FALSE || exit_status != 0) - goto out; + { + /* show error message if smth failed */ + xfce_dialog_show_error (NULL, error, "%s %s %d, %s %s", _("Mount Plugin: Error executing command."), + _("Returned"), WEXITSTATUS(exit_status), _("error was"), erroutput); + goto out; + } if (on_mount_cmd != NULL && strlen(on_mount_cmd)!=0) { g_free(tmp); @@ -284,17 +289,16 @@ disk_mount (t_disk *pdisk, char *on_mount_cmd, char* mount_command, gboolean eje cmd = NULL; deviceprintf(&tmp, on_mount_cmd, pdisk->device); mountpointprintf(&cmd, tmp, pdisk->mount_point); - val = g_spawn_command_line_sync (cmd, &output, &erroutput, &exit_status, &error); - DBG("cmd: '%s', returned %d, exit_status=%d", cmd, val, exit_status); + val = g_spawn_command_line_async (cmd, &error); + DBG("cmd: '%s', returned %d", cmd, val); + /* show error message if smth failed */ + if (val == FALSE) + xfce_dialog_show_error (NULL, error, "%s", _("Mount Plugin: Error executing on-mount command.")); } out: g_free(cmd); if (tmp) g_free(tmp); - /* show error message if smth failed */ - if (val == FALSE || exit_status != 0) - xfce_dialog_show_error (NULL, error, "%s %s %d, %s %s", _("Mount Plugin: Error executing command."), - _("Returned"), WEXITSTATUS(exit_status), _("error was"), erroutput); } } _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits