[anjuta] run-program: Default to Yes in "The program is already running" dialog.
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] run-program: Default to Yes in "The program is already running" dialog.
- Date: Sat, 22 Dec 2012 21:26:26 +0000 (UTC)
commit ebfa9a50a3d674d378769a81ba7e8bdde259075a
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date: Sat Dec 22 20:32:35 2012 +0100
run-program: Default to Yes in "The program is already running" dialog.
It's in my opinion more common that you want to close the previous instance when you try
to run a new one.
Fix this by adding a boolean default_to_yes paramaeter to
anjuta_util_dialog_boolean_question().
https://bugzilla.gnome.org/show_bug.cgi?id=690650
libanjuta/anjuta-utils.c | 5 ++++-
libanjuta/anjuta-utils.h | 1 +
plugins/build-basic-autotools/build.c | 3 ++-
plugins/debug-manager/start.c | 2 +-
plugins/gdb/debugger.c | 2 +-
plugins/project-import/plugin.c | 4 ++--
plugins/project-manager/plugin.c | 2 +-
plugins/run-program/plugin.c | 2 +-
plugins/tools/dialog.c | 3 ++-
plugins/tools/editor.c | 3 ++-
10 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/libanjuta/anjuta-utils.c b/libanjuta/anjuta-utils.c
index 12bc92b..f8ddd26 100644
--- a/libanjuta/anjuta-utils.c
+++ b/libanjuta/anjuta-utils.c
@@ -381,7 +381,8 @@ anjuta_util_dialog_error_system (GtkWindow* parent, gint errnum,
}
gboolean
-anjuta_util_dialog_boolean_question (GtkWindow *parent, const gchar *mesg, ...)
+anjuta_util_dialog_boolean_question (GtkWindow *parent, gboolean default_to_yes,
+ const gchar *mesg, ...)
{
gchar* message;
va_list args;
@@ -406,6 +407,8 @@ anjuta_util_dialog_boolean_question (GtkWindow *parent, const gchar *mesg, ...)
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO, "%s", message);
+ if (default_to_yes)
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
ret = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
diff --git a/libanjuta/anjuta-utils.h b/libanjuta/anjuta-utils.h
index 0beca35..e2dd960 100644
--- a/libanjuta/anjuta-utils.h
+++ b/libanjuta/anjuta-utils.h
@@ -57,6 +57,7 @@ void anjuta_util_dialog_info (GtkWindow *parent,
void anjuta_util_dialog_error_system (GtkWindow* parent, gint errnum,
const gchar * mesg, ... );
gboolean anjuta_util_dialog_boolean_question (GtkWindow *parent,
+ gboolean default_to_yes,
const gchar * mesg, ...);
gboolean anjuta_util_dialog_input (GtkWindow *parent,
const gchar *label,
diff --git a/plugins/build-basic-autotools/build.c b/plugins/build-basic-autotools/build.c
index ae48359..eab1772 100644
--- a/plugins/build-basic-autotools/build.c
+++ b/plugins/build-basic-autotools/build.c
@@ -523,7 +523,8 @@ build_save_distclean_and_execute_command (BasicAutotoolsPlugin* bplugin, BuildPr
BuildProgram *new_prog;
// Need to run make clean before
- if (!anjuta_util_dialog_boolean_question (GTK_WINDOW (ANJUTA_PLUGIN (bplugin)->shell), _("Before using this new configuration, the default one needs to be removed. Do you want to do that ?"), NULL))
+ if (!anjuta_util_dialog_boolean_question (GTK_WINDOW (ANJUTA_PLUGIN (bplugin)->shell), FALSE,
+ _("Before using this new configuration, the default one needs to be removed. Do you want to do that ?"), NULL))
{
if (err)
*err = g_error_new (ianjuta_builder_error_quark (),
diff --git a/plugins/debug-manager/start.c b/plugins/debug-manager/start.c
index 4ef6d3e..fdfd025 100644
--- a/plugins/debug-manager/start.c
+++ b/plugins/debug-manager/start.c
@@ -1390,7 +1390,7 @@ dma_quit_debugger (DmaStart* this)
gchar *msg = _("The program is running.\n"
"Do you still want to stop the debugger?");
- if (!anjuta_util_dialog_boolean_question (GTK_WINDOW (this->plugin->shell), msg)) return FALSE;
+ if (!anjuta_util_dialog_boolean_question (GTK_WINDOW (this->plugin->shell), FALSE, msg)) return FALSE;
}
dma_queue_interrupt (this->debugger);
diff --git a/plugins/gdb/debugger.c b/plugins/gdb/debugger.c
index 898a6db..dd15b2a 100644
--- a/plugins/gdb/debugger.c
+++ b/plugins/gdb/debugger.c
@@ -2086,7 +2086,7 @@ debugger_is_connected (Debugger *debugger, const GDBMIValue *mi_results,
* It is something like, "No such file or directory" */
msg = g_strdup_printf(_("Unable to connect to remote target, %s\nDo you want to try again?"),
error->message);
- retry = anjuta_util_dialog_boolean_question (debugger->priv->parent_win, msg);
+ retry = anjuta_util_dialog_boolean_question (debugger->priv->parent_win, FALSE, msg);
g_free (msg);
if (retry)
{
diff --git a/plugins/project-import/plugin.c b/plugins/project-import/plugin.c
index 6027565..e5455a0 100644
--- a/plugins/project-import/plugin.c
+++ b/plugins/project-import/plugin.c
@@ -75,7 +75,7 @@ project_import_generate_file (AnjutaPluginDescription *backend, ProjectImportDia
if (error->domain == G_IO_ERROR && error->code == G_IO_ERROR_EXISTS)
{
gchar *prjfile = g_file_get_parse_name (project_file);
- if (anjuta_util_dialog_boolean_question (GTK_WINDOW (import_dialog),
+ if (anjuta_util_dialog_boolean_question (GTK_WINDOW (import_dialog), FALSE,
_("A file named \"%s\" already exists. "
"Do you want to replace it?"), prjfile))
{
@@ -179,7 +179,7 @@ project_import_generate_file (AnjutaPluginDescription *backend, ProjectImportDia
if (stream == NULL && error->domain == G_IO_ERROR && error->code == G_IO_ERROR_EXISTS)
{
gchar *prjfile = g_file_get_parse_name (project_file);
- if (anjuta_util_dialog_boolean_question (GTK_WINDOW (import_dialog),
+ if (anjuta_util_dialog_boolean_question (GTK_WINDOW (import_dialog), FALSE,
_("A file named \"%s\" already exists. "
"Do you want to replace it?"), prjfile))
{
diff --git a/plugins/project-manager/plugin.c b/plugins/project-manager/plugin.c
index 286862e..8218245 100644
--- a/plugins/project-manager/plugin.c
+++ b/plugins/project-manager/plugin.c
@@ -736,7 +736,7 @@ confirm_removal (ProjectManagerPlugin *plugin, GList *selected)
}
answer =
- anjuta_util_dialog_boolean_question (get_plugin_parent_window (plugin),
+ anjuta_util_dialog_boolean_question (get_plugin_parent_window (plugin), FALSE,
mesg->str, _("Confirm remove"));
g_string_free (mesg, TRUE);
diff --git a/plugins/run-program/plugin.c b/plugins/run-program/plugin.c
index b4ee5c0..f766716 100644
--- a/plugins/run-program/plugin.c
+++ b/plugins/run-program/plugin.c
@@ -227,7 +227,7 @@ on_run_program_activate (GtkAction* action, RunProgramPlugin* plugin)
{
gchar *msg = _("The program is already running.\n"
"Do you want to stop it before restarting a new instance?");
- if (anjuta_util_dialog_boolean_question (GTK_WINDOW ( ANJUTA_PLUGIN (plugin)->shell), msg))
+ if (anjuta_util_dialog_boolean_question (GTK_WINDOW ( ANJUTA_PLUGIN (plugin)->shell), TRUE, msg))
{
run_plugin_kill_program (plugin, FALSE);
}
diff --git a/plugins/tools/dialog.c b/plugins/tools/dialog.c
index bbc7e88..3e0d374 100644
--- a/plugins/tools/dialog.c
+++ b/plugins/tools/dialog.c
@@ -174,7 +174,8 @@ atp_on_tool_delete (GtkButton *button, gpointer user_data)
tool = get_current_tool (this);
if ((tool != NULL) && (atp_user_tool_get_storage (tool) > ATP_TSTORE_GLOBAL))
{
- if (anjuta_util_dialog_boolean_question (GTK_WINDOW (this->dialog), _("Are you sure you want to delete the '%s' tool?"), atp_user_tool_get_name(tool)))
+ if (anjuta_util_dialog_boolean_question (GTK_WINDOW (this->dialog), FALSE,
+ _("Are you sure you want to delete the '%s' tool?"), atp_user_tool_get_name(tool)))
{
atp_user_tool_free (tool);
atp_tool_dialog_refresh (this, NULL);
diff --git a/plugins/tools/editor.c b/plugins/tools/editor.c
index af13d47..f5c90dc 100644
--- a/plugins/tools/editor.c
+++ b/plugins/tools/editor.c
@@ -823,7 +823,8 @@ atp_on_editor_dialog_response (GtkDialog *dialog, gint response, gpointer user_d
group = anjuta_ui_get_accel_group(ui);
if (gtk_accel_group_query (group, accel_key, accel_mods, NULL) != NULL)
{
- if (!anjuta_util_dialog_boolean_question (GTK_WINDOW (this->dialog), _("The shortcut is already used by another component in Anjuta. Do you want to keep it anyway?")))
+ if (!anjuta_util_dialog_boolean_question (GTK_WINDOW (this->dialog), FALSE,
+ _("The shortcut is already used by another component in Anjuta. Do you want to keep it anyway?")))
{
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]