[Aptitude-svn-commit] r4284 - in branches/aptitude-0.3/aptitude: .
src
Daniel Burrows
dburrows at costa.debian.org
Mon Sep 26 07:02:23 UTC 2005
Author: dburrows
Date: Mon Sep 26 07:02:16 2005
New Revision: 4284
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/ui.cc
Log:
Add a checkbox widget to disable the annoying popup forever.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Mon Sep 26 07:02:16 2005
@@ -2,6 +2,13 @@
* src/ui.cc:
+ Add a configuration option to suppress the warning message, and
+ display a customized dialog box that allows the user to disable
+ the message in the future. With the other changes, this finally
+ (Closes: #175408).
+
+ * src/ui.cc:
+
Make show_message() generate reverse video by default again.
* src/download_list.cc, src/download_list.h, src/generic/util/slotarg.h, src/ui.h, src/vscreen/slotarg.h, src/vscreen/vs_menu.h, src/vscreen/vs_menu.cc:
Modified: branches/aptitude-0.3/aptitude/src/ui.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/ui.cc (original)
+++ branches/aptitude-0.3/aptitude/src/ui.cc Mon Sep 26 07:02:16 2005
@@ -43,6 +43,7 @@
#include "../config.h"
#include "aptitude.h"
+#include "apt_config_widgets.h"
#include "apt_options.h"
#include "broken_indicator.h"
#include "defaults.h"
@@ -71,6 +72,7 @@
#include <vscreen/vs_table.h>
#include <vscreen/vs_text_layout.h>
#include <vscreen/vs_transient.h>
+#include <vscreen/vs_togglebutton.h>
#include <vscreen/vs_tree.h>
#include <vscreen/vs_util.h>
@@ -264,15 +266,71 @@
error_dialog_layout->append_fragment(apt_error_fragment());
}
+static void read_only_permissions_table_destroyed(apt_config_widget &w)
+{
+ w.commit();
+ apt_dumpcfg(PACKAGE);
+
+ delete &w;
+}
+
static bool do_read_only_permission()
{
if(active_download)
return false;
else
{
- // Only display this message once.
- show_message(_("WARNING: the package cache is opened in read-only mode! This change and all subsequent changes will not be saved unless you stop all other running apt-based programs and select \"Become root\" from the Actions menu."));
(*apt_cache_file)->set_read_only(false);
+
+
+ if(!aptcfg->FindB(PACKAGE "::Suppress-Read-Only-Warning", false))
+ {
+ vs_table_ref t(vs_table::create());
+
+ fragment *f = wrapbox(text_fragment(_("WARNING: the package cache is opened in read-only mode! This change and all subsequent changes will not be saved unless you stop all other running apt-based programs and select \"Become root\" from the Actions menu.")));
+
+ t->add_widget_opts(vs_text_layout::create(f),
+ 0, 0, 1, 1, vs_table::EXPAND | vs_table::FILL | vs_table::SHRINK,
+ vs_table::EXPAND | vs_table::FILL);
+
+ apt_bool_widget *w = new apt_bool_widget(_("Never display this message again."),
+ PACKAGE "::Suppress-Read-Only-Warning", false);
+
+ // HACK:
+ t->add_widget_opts(vs_label::create(""), 1, 0, 1, 1,
+ vs_table::EXPAND | vs_table::FILL | vs_table::SHRINK,
+ 0);
+
+ t->add_widget_opts(w->cb, 2, 0, 1, 1,
+ vs_table::EXPAND | vs_table::FILL | vs_table::SHRINK,
+ vs_table::EXPAND | vs_table::FILL);
+
+ // HACK:
+ t->add_widget_opts(vs_label::create(""), 3, 0, 1, 1,
+ vs_table::EXPAND | vs_table::FILL | vs_table::SHRINK,
+ 0);
+
+ vs_button_ref ok(vs_button::create(_("Ok")));
+
+ t->add_widget_opts(ok, 4, 0, 1, 1,
+ vs_table::EXPAND | vs_table::SHRINK,
+ vs_table::EXPAND);
+
+ t->show_all();
+
+ t->focus_widget(ok);
+
+ vs_frame_ref frame = vs_frame::create(t);
+ frame->set_bg_style(style_attrs_flip(A_REVERSE));
+
+ vs_center_ref c = vs_center::create(frame);
+
+ ok->pressed.connect(sigc::mem_fun(c.unsafe_get_ref(), &vscreen_widget::destroy));
+ c->destroyed.connect(sigc::bind(sigc::ptr_fun(&read_only_permissions_table_destroyed), sigc::ref(*w)));
+
+ popup_widget(c);
+ }
+
return true;
}
}
More information about the Aptitude-svn-commit
mailing list