[Aptitude-svn-commit] r3391 - in branches/aptitude-0.3/aptitude: . src/vscreen

Daniel Burrows dburrows@costa.debian.org
Tue, 07 Jun 2005 20:29:14 +0000


Author: dburrows
Date: Tue Jun  7 20:29:12 2005
New Revision: 3391

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/vscreen/vs_util.cc
Log:
Implement the file viewer dialog as a specialized OK dialog.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Tue Jun  7 20:29:12 2005
@@ -1,5 +1,9 @@
 2005-06-07  Daniel Burrows  <dburrows@debian.org>
 
+	* src/vscreen/vs_util.cc:
+
+	Implement the file viewer as a specialized OK dialog.
+
 	* src/vscreen/vscreen.cc:
 
 	Force edit-line widgets to always appear white-on-black, even in

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_util.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_util.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_util.cc	Tue Jun  7 20:29:12 2005
@@ -36,6 +36,7 @@
 
   table->add_widget(w, 0, 0, 1, 1, true, true);
   table->add_widget(new vs_center(okbutton), 1, 0, 1, 1, false, false);
+  table->connect_key("Confirm", &global_bindings, okbutton->pressed.make_slot());
 
   vs_frame *frame=new vs_frame(table);
 
@@ -243,29 +244,16 @@
   vs_file_pager *p=new vs_file_pager(fn);
   vs_scrollbar *scrollbar=new vs_scrollbar(vs_scrollbar::VERTICAL, 0, 0);
   vs_table *t=new vs_table;
-  vs_frame *f=new vs_frame(t);
-  vs_center *c=new vs_center(f);
-
-  vs_button *b=new vs_button("Ok");
-
-  b->pressed.connect(sigc::mem_fun(*c, &vs_center::destroy));
-
-  if(okslot)
-    b->pressed.connect(*okslot);
-
-  f->set_bg_style(st);
 
   t->add_widget_opts(p, 0, 0, 1, 1,
-		     vs_table::SHRINK | vs_table::ALIGN_CENTER,
-		     vs_table::SHRINK | vs_table::ALIGN_CENTER);
+		     vs_table::EXPAND | vs_table::FILL | vs_table::SHRINK | vs_table::ALIGN_CENTER,
+		     vs_table::FILL | vs_table::SHRINK | vs_table::ALIGN_CENTER);
   t->add_widget_opts(scrollbar, 0, 1, 1, 1,
 		     vs_table::ALIGN_CENTER,
-		     vs_table::EXPAND | vs_table::SHRINK | vs_table::ALIGN_CENTER);
-  t->add_widget_opts(b, 1, 0, 1, 2,
-		     vs_table::ALIGN_CENTER | vs_table::SHRINK,
-		     vs_table::ALIGN_CENTER);
+		     vs_table::EXPAND | vs_table::FILL);
+
+  //t->set_bg_style(style_attrs_off(A_REVERSE));
 
-  t->connect_key("Confirm", &global_bindings, b->pressed.make_slot());
   p->line_changed.connect(sigc::mem_fun(*scrollbar, &vs_scrollbar::set_slider));
   p->do_line_signal();
   scrollbar->scrollbar_interaction.connect(sigc::mem_fun(*p, &vs_pager::scroll_page));
@@ -273,7 +261,7 @@
   if(searchslot)
     p->connect_key("Search", &global_bindings, sigc::bind(*searchslot, p));
 
-  return c;
+  return vs_dialog_ok(t, okslot, _("Ok"), st);
 }
 
 vscreen_widget *vs_dialog_fileview(string fn,