[gnome-usage] better-box: Rewrite BetterBox from C to Vala
- From: Petr Štětka <pstetka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-usage] better-box: Rewrite BetterBox from C to Vala
- Date: Wed, 3 May 2017 12:38:15 +0000 (UTC)
commit 68ef94a115dca33d3ce784c5e9378cc54590cd0a
Author: Petr Štětka <pstetka redhat com>
Date: Wed May 3 14:28:16 2017 +0200
better-box: Rewrite BetterBox from C to Vala
https://bugzilla.gnome.org/show_bug.cgi?id=781607#c22
src/better-box.vala | 23 +++++++++++++++++++++++
src/meson.build | 1 +
2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/better-box.vala b/src/better-box.vala
new file mode 100644
index 0000000..aa027b8
--- /dev/null
+++ b/src/better-box.vala
@@ -0,0 +1,23 @@
+namespace Usage {
+
+ public class BetterBox : Gtk.Box
+ {
+ public int max_width_request { get; set; default = -1; }
+
+ private new void get_preferred_width(out int minimum_width, out int natural_width)
+ {
+ int min_width;
+ int nat_width;
+ get_preferred_width(out min_width, out nat_width);
+
+ if (max_width_request > 0)
+ {
+ if (min_width > max_width_request)
+ min_width = max_width_request;
+
+ if (nat_width > max_width_request)
+ nat_width = max_width_request;
+ }
+ }
+ }
+}
diff --git a/src/meson.build b/src/meson.build
index 55396ab..80d9c5c 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,5 +1,6 @@
vala_sources = [
'application.vala',
+ 'better-box.vala',
'color-rectangle.vala',
'cpu-graph-table.vala',
'cpu-graph.vala',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]