summaryrefslogtreecommitdiffstats
path: root/src/pacman/callback.c
diff options
context:
space:
mode:
authorChantry Xavier <shiningxc@gmail.com>2008-02-19 00:44:09 +0100
committerDan McGee <dan@archlinux.org>2008-02-25 01:17:49 +0100
commit143135e666f5564240868810f0b8f4bc46ff87b5 (patch)
treed70bb426c06e9ee0dc94481ed5144aedca0bc54c /src/pacman/callback.c
parentca1a187131d95604ff2c33df3c1ec80ef4af789b (diff)
downloadpacman-143135e666f5564240868810f0b8f4bc46ff87b5.tar.gz
pacman-143135e666f5564240868810f0b8f4bc46ff87b5.tar.xz
Improve yesno function.
Add a preset paramater to yesno function saying which answer should be the default. Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-June/008470.html This allows us to answer no by default to some questions, like the -Scc one mentioned in the above thread, and implemented by this patch. Another advantage is that we don't have to repeat the [Y/n] in every questions. It's only put once in yesno function. This highly reduces the chances that YES and NO strings are translated, but not some questions, which lead to obvious confusions. Finally, the noconfirm variable only needs to be used in that yesno function. So all other usages of it were removed. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Diffstat (limited to 'src/pacman/callback.c')
-rw-r--r--src/pacman/callback.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index b16c79ee..ef161855 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -251,41 +251,33 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
case PM_TRANS_CONV_INSTALL_IGNOREPKG:
if(data2) {
/* TODO we take this route based on data2 being not null? WTF */
- *response = yesno(_(":: %s requires installing %s from IgnorePkg/IgnoreGroup. Install anyway? [Y/n] "),
+ *response = yesno(1, _(":: %s requires installing %s from IgnorePkg/IgnoreGroup. Install anyway?"),
alpm_pkg_get_name(data1),
alpm_pkg_get_name(data2));
} else {
- *response = yesno(_(":: %s is in IgnorePkg/IgnoreGroup. Install anyway? [Y/n] "),
+ *response = yesno(1, _(":: %s is in IgnorePkg/IgnoreGroup. Install anyway?"),
alpm_pkg_get_name(data1));
}
break;
case PM_TRANS_CONV_REMOVE_HOLDPKG:
- *response = yesno(_(":: %s is designated as a HoldPkg. Remove anyway? [Y/n] "),
+ *response = yesno(1, _(":: %s is designated as a HoldPkg. Remove anyway?"),
alpm_pkg_get_name(data1));
break;
case PM_TRANS_CONV_REPLACE_PKG:
- if(!config->noconfirm) {
- *response = yesno(_(":: Replace %s with %s/%s? [Y/n] "),
- alpm_pkg_get_name(data1),
- (char *)data3,
- alpm_pkg_get_name(data2));
- } else {
- printf(_("Replacing %s with %s/%s\n"),
- alpm_pkg_get_name(data1),
- (char *)data3,
- alpm_pkg_get_name(data2));
- *response = 1;
- }
+ *response = yesno(1, _(":: Replace %s with %s/%s?"),
+ alpm_pkg_get_name(data1),
+ (char *)data3,
+ alpm_pkg_get_name(data2));
break;
case PM_TRANS_CONV_CONFLICT_PKG:
- *response = yesno(_(":: %s conflicts with %s. Remove %s? [Y/n] "),
+ *response = yesno(1, _(":: %s conflicts with %s. Remove %s?"),
(char *)data1,
(char *)data2,
(char *)data2);
break;
case PM_TRANS_CONV_LOCAL_NEWER:
if(!config->op_s_downloadonly) {
- *response = yesno(_(":: %s-%s: local version is newer. Upgrade anyway? [Y/n] "),
+ *response = yesno(1, _(":: %s-%s: local version is newer. Upgrade anyway?"),
alpm_pkg_get_name(data1),
alpm_pkg_get_version(data1));
} else {
@@ -293,12 +285,8 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
}
break;
case PM_TRANS_CONV_CORRUPTED_PKG:
- if(!config->noconfirm) {
- *response = yesno(_(":: File %s is corrupted. Do you want to delete it? [Y/n] "),
- (char *)data1);
- } else {
- *response = 1;
- }
+ *response = yesno(1, _(":: File %s is corrupted. Do you want to delete it?"),
+ (char *)data1);
break;
}
}