gnome-scan r679 - in trunk: . lib
- From: bersace svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-scan r679 - in trunk: . lib
- Date: Sun, 14 Dec 2008 15:57:08 +0000 (UTC)
Author: bersace
Date: Sun Dec 14 15:57:08 2008
New Revision: 679
URL: http://svn.gnome.org/viewvc/gnome-scan?rev=679&view=rev
Log:
Auto hide option widget label too.
Modified:
trunk/ChangeLog
trunk/lib/gnome-scan-option-box.vala
Modified: trunk/lib/gnome-scan-option-box.vala
==============================================================================
--- trunk/lib/gnome-scan-option-box.vala (original)
+++ trunk/lib/gnome-scan-option-box.vala Sun Dec 14 15:57:08 2008
@@ -32,7 +32,7 @@
int child_visible_count = 0;
int child_expanding_count = 0;
HashTable<Gnome.Scan.Option,OptionWidget> children;
- HashTable<Gnome.Scan.Option,Gtk.Label> labels;
+ HashTable<OptionWidget,Gtk.Label> labels;
construct {
this.spacing = 6;
@@ -45,12 +45,10 @@
alignment.set_padding(0, 0, 24, 0);
this.pack_start(alignment, true, true, 0);
this.table = new Table(0, 2, false);
- this.table.set_col_spacings(6);
- this.table.set_row_spacings(4);
alignment.add(this.table);
children = new HashTable<Gnome.Scan.Option, OptionWidget>(GLib.direct_hash, GLib.direct_equal);
- labels = new HashTable<Gnome.Scan.Option, Gtk.Label>(GLib.direct_hash, GLib.direct_equal);
+ labels = new HashTable<OptionWidget, Gtk.Label>(GLib.direct_hash, GLib.direct_equal);
}
public OptionBox(string label)
@@ -90,11 +88,12 @@
// prepended before the option widget. Accord ":" to
// locale typographic rules.
Label label = new Label(_("%s:").printf(option.title));
- label.set_alignment((float)0, (float)0);
- this.labels.insert(option, label);
+ label.set_alignment((float)0, (float)0.5);
+ this.labels.insert(widget, label);
this.table.attach(label, 0, 1, this.child_count-1, this.child_count,
AttachOptions.FILL, AttachOptions.FILL, 0, 0);
- this.table.attach(widget, 1, 2, this.child_count-1, this.child_count,opts, opts, 0, 0);
+ this.table.attach(widget, 1, 2, this.child_count-1, this.child_count,
+ AttachOptions.FILL|AttachOptions.EXPAND, opts, 0, 0);
}
this.children.insert(option, widget);
@@ -112,22 +111,33 @@
widget.no_show_all = true;
widget.hide();
- // destroy widget
- this.table.remove(widget);
- this.children.remove(option);
-
// destroy label
- var label = this.labels.lookup(option);
+ var label = this.labels.lookup(widget);
if (label != null) {
this.table.remove(label);
- this.labels.remove(option);
+ this.labels.remove(widget);
}
+ // destroy widget
+ this.table.remove(widget);
+ this.children.remove(option);
+
return this.table.get_children().length() == 0;
}
private void on_option_widget_visibility_changed(OptionWidget widget)
{
+ var label = this.labels.lookup(widget);
+ if (label != null) {
+ label.no_show_all = widget.no_show_all;
+ if (widget.visible) {
+ label.show();
+ }
+ else {
+ label.hide();
+ }
+ }
+
if (widget.expand) {
this.child_expanding_count += widget.visible ? +1 : -1;
var parent = (Container) this.parent;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]