[anjuta/gnome-3-4] build: Only check for passwords when installing as root (bgo#680136)



commit 59d9ace758c4aa5ed061d74c96db72b0bfc2cc54
Author: Johannes Schmid <jhs gnome org>
Date:   Sun Jul 22 14:11:50 2012 +0200

    build: Only check for passwords when installing as root (bgo#680136)

 plugins/build-basic-autotools/build.c  |   20 +++++++++++---------
 plugins/build-basic-autotools/plugin.c |    5 ++---
 plugins/build-basic-autotools/plugin.h |    2 +-
 3 files changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/plugins/build-basic-autotools/build.c b/plugins/build-basic-autotools/build.c
index 03004bb..bb14a04 100644
--- a/plugins/build-basic-autotools/build.c
+++ b/plugins/build-basic-autotools/build.c
@@ -443,7 +443,7 @@ build_execute_command (BasicAutotoolsPlugin* bplugin, BuildProgram *prog,
 	BuildContext *context;
 	gboolean ok;
 
-	context = build_get_context (bplugin, prog->work_dir, with_view);
+	context = build_get_context (bplugin, prog->work_dir, with_view, FALSE);
 
 	build_set_command_in_context (context, prog);
 	ok = build_execute_command_in_context (context, err);
@@ -462,11 +462,11 @@ build_execute_command (BasicAutotoolsPlugin* bplugin, BuildProgram *prog,
 
 static BuildContext*
 build_save_and_execute_command (BasicAutotoolsPlugin* bplugin, BuildProgram *prog,
-								gboolean with_view, GError **err)
+								gboolean with_view, gboolean check_password, GError **err)
 {
 	BuildContext *context;
 
-	context = build_get_context (bplugin, prog->work_dir, with_view);
+	context = build_get_context (bplugin, prog->work_dir, with_view, check_password);
 
 	build_set_command_in_context (context, prog);
 	if (!build_save_and_execute_command_in_context (context, err))
@@ -509,7 +509,7 @@ build_save_distclean_and_execute_command (BasicAutotoolsPlugin* bplugin, BuildPr
 	BuildConfiguration *config;
 	GList *vars;
 
-	context = build_get_context (bplugin, prog->work_dir, with_view);
+	context = build_get_context (bplugin, prog->work_dir, with_view, FALSE);
 	root_path = g_file_get_path (bplugin->project_root_dir);
 	same = strcmp (prog->work_dir, root_path) != 0;
 	g_free (root_path);
@@ -574,7 +574,7 @@ build_build_file_or_dir (BasicAutotoolsPlugin *plugin,
 	build_program_set_callback (prog, callback, user_data);
 	build_program_add_env_list (prog, vars);
 
-	context = build_save_and_execute_command (plugin, prog, TRUE, err);
+	context = build_save_and_execute_command (plugin, prog, TRUE, FALSE, err);
 	g_free (target);
 	g_object_unref (build_dir);
 
@@ -613,7 +613,7 @@ build_is_file_built (BasicAutotoolsPlugin *plugin, GFile *file,
 	build_program_set_callback (prog, callback, user_data);
 	build_program_add_env_list (prog, vars);
 
-	context = build_save_and_execute_command (plugin, prog, FALSE, err);
+	context = build_save_and_execute_command (plugin, prog, FALSE, FALSE, err);
 
 	g_free (target);
 	g_object_unref (build_dir);
@@ -643,6 +643,7 @@ build_install_dir (BasicAutotoolsPlugin *plugin, GFile *dir,
 {
 	BuildContext *context;
 	gchar* root = get_root_install_command(plugin);
+	gboolean use_root = FALSE;
 	GFile *build_dir;
 	BuildProgram *prog;
 	GString *command;
@@ -689,6 +690,7 @@ build_install_dir (BasicAutotoolsPlugin *plugin, GFile *dir,
 			}
 		}
 		g_string_append (command, first);
+		use_root = TRUE;
 	}
 	else
 	{
@@ -706,7 +708,7 @@ build_install_dir (BasicAutotoolsPlugin *plugin, GFile *dir,
 	build_program_set_callback (prog, callback, user_data);
 	build_program_add_env_list (prog, vars);
 
-	context = build_save_and_execute_command (plugin, prog, TRUE, err);
+	context = build_save_and_execute_command (plugin, prog, TRUE, use_root, err);
 
 	g_string_free (command, TRUE);
 	g_object_unref (build_dir);
@@ -798,7 +800,7 @@ build_tarball (BasicAutotoolsPlugin *plugin)
 	                                       CHOOSE_COMMAND (plugin, BUILD_TARBALL)),
 	build_program_add_env_list (prog, vars);
 
-	context = build_save_and_execute_command (plugin, prog, TRUE, NULL);
+	context = build_save_and_execute_command (plugin, prog, TRUE, FALSE, NULL);
 
 	return context;
 }
@@ -834,7 +836,7 @@ build_compile_file (BasicAutotoolsPlugin *plugin, GFile *file)
 
 		build_program_add_env_list (prog, vars);
 
-		context = build_save_and_execute_command (plugin, prog, TRUE, NULL);
+		context = build_save_and_execute_command (plugin, prog, TRUE, FALSE, NULL);
 		g_object_unref (object);
 	}
 	else
diff --git a/plugins/build-basic-autotools/plugin.c b/plugins/build-basic-autotools/plugin.c
index fcfdbd3..975df2d 100644
--- a/plugins/build-basic-autotools/plugin.c
+++ b/plugins/build-basic-autotools/plugin.c
@@ -1167,7 +1167,7 @@ build_get_context_with_message(BasicAutotoolsPlugin *plugin, const gchar *dir)
 
 BuildContext*
 build_get_context (BasicAutotoolsPlugin *plugin, const gchar *dir,
-		   gboolean with_view)
+                   gboolean with_view, gboolean check_passwd)
 {
 	BuildContext *context = NULL;
 	AnjutaPluginManager *plugin_manager;
@@ -1205,6 +1205,7 @@ build_get_context (BasicAutotoolsPlugin *plugin, const gchar *dir,
 	}
 
 	context->launcher = anjuta_launcher_new ();
+	anjuta_launcher_set_check_passwd_prompt (context->launcher, check_passwd);
 	g_signal_connect (G_OBJECT (context->launcher), "child-exited",
 					  G_CALLBACK (on_build_terminated), context);
 	build_context_push_dir (context, "default", dir);
@@ -2350,7 +2351,6 @@ static void
 value_added_current_editor (AnjutaPlugin *plugin, const char *name,
 							const GValue *value, gpointer data)
 {
-	AnjutaUI *ui;
 	GObject *editor;
 
 	editor = g_value_get_object (value);
@@ -2359,7 +2359,6 @@ value_added_current_editor (AnjutaPlugin *plugin, const char *name,
 		return;
 
 	BasicAutotoolsPlugin *ba_plugin = ANJUTA_PLUGIN_BASIC_AUTOTOOLS (plugin);
-	ui = anjuta_shell_get_ui (plugin->shell, NULL);
 
 	ba_plugin->current_editor = IANJUTA_EDITOR (editor);
 
diff --git a/plugins/build-basic-autotools/plugin.h b/plugins/build-basic-autotools/plugin.h
index 8a029e1..865420f 100644
--- a/plugins/build-basic-autotools/plugin.h
+++ b/plugins/build-basic-autotools/plugin.h
@@ -92,7 +92,7 @@ struct _BasicAutotoolsPluginClass{
 
 typedef struct _BuildContext BuildContext;
 
-BuildContext* build_get_context (BasicAutotoolsPlugin *plugin, const gchar *dir, gboolean with_view);
+BuildContext* build_get_context (BasicAutotoolsPlugin *plugin, const gchar *dir, gboolean with_view, gboolean check_passwd);
 void build_context_destroy (BuildContext *context);
 
 void build_set_command_in_context (BuildContext* context, BuildProgram *prog);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]