Permalink
Browse files

Make the mount call sync, and leave the rest async

  • Loading branch information...
1 parent 73393ce commit 167ae4fa27c8af45ee1704c2c7c95e92d2ff0b84 David Mohr committed Aug 4, 2010
View
2 src/grub-choose-default-main.c
@@ -37,7 +37,7 @@ void mount (void)
config_dir = g_get_user_config_dir ();
script = g_build_filename (CONFIG_DIR, "mount", NULL);
- grub_choose_default_exec (config_dir, script, NULL);
+ grub_choose_default_exec (config_dir, script, TRUE, NULL);
g_free (script);
}
View
31 src/grub-choose-default-util.c
@@ -68,7 +68,7 @@ grub_choose_default_error_message (GtkWidget *parent, gchar * message)
* Searches in directory for script or script* and tries to execute it.
*/
gboolean
-grub_choose_default_exec(const gchar * directory, const gchar * script, GError **error)
+grub_choose_default_exec(const gchar * directory, const gchar * script, gboolean sync, GError **error)
{
gchar * path;
#ifdef G_OS_WIN32
@@ -131,14 +131,27 @@ grub_choose_default_exec(const gchar * directory, const gchar * script, GError *
argv[1] = NULL;
}
- r = g_spawn_async (NULL,
- argv,
- NULL,
- G_SPAWN_SEARCH_PATH,
- NULL,
- NULL,
- NULL,
- error);
+ if (sync) {
+ r = g_spawn_sync (NULL,
+ argv,
+ NULL,
+ G_SPAWN_SEARCH_PATH,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ error);
+ } else {
+ r = g_spawn_async (NULL,
+ argv,
+ NULL,
+ G_SPAWN_SEARCH_PATH,
+ NULL,
+ NULL,
+ NULL,
+ error);
+ }
g_free (path);
return r;
View
2 src/grub-choose-default-util.h
@@ -25,7 +25,7 @@ G_BEGIN_DECLS
#define CONFIG_DIR "grub-choose-default"
-gboolean grub_choose_default_exec (const gchar * directory, const gchar * script, GError **error);
+gboolean grub_choose_default_exec (const gchar * directory, const gchar * script, gboolean sync, GError **error);
void grub_choose_default_error (GtkWidget *parent, GError *error);
void grub_choose_default_error_message (GtkWidget *parent, gchar * message);
View
4 src/grub-choose-default-window.c
@@ -290,7 +290,7 @@ perform_reboot (GrubChooseDefaultWindow *win)
config_dir = g_get_user_config_dir ();
- r = grub_choose_default_exec (config_dir, script, NULL);
+ r = grub_choose_default_exec (config_dir, script, FALSE, NULL);
if (r)
{
@@ -299,7 +299,7 @@ perform_reboot (GrubChooseDefaultWindow *win)
for (config_dirs = g_get_system_config_dirs (); *config_dirs != NULL; config_dirs++)
{
- r = grub_choose_default_exec (*config_dirs, script, NULL);
+ r = grub_choose_default_exec (*config_dirs, script, FALSE, NULL);
if (r)
break;
}

0 comments on commit 167ae4f

Please sign in to comment.