[gnome-clocks] Simplify AnalogFrame
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] Simplify AnalogFrame
- Date: Sat, 20 Feb 2016 21:44:19 +0000 (UTC)
commit 3ce01f6b6bfc3a8dab52d60d5e72b7c9c113af07
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Feb 20 22:40:59 2016 +0100
Simplify AnalogFrame
We do not need to subclass GtkFrame anymore. This makes the code
work with the latest Gtk.
data/ui/stopwatch.ui | 1 +
src/widgets.vala | 17 ++---------------
2 files changed, 3 insertions(+), 15 deletions(-)
---
diff --git a/data/ui/stopwatch.ui b/data/ui/stopwatch.ui
index b01d8f5..005ef27 100644
--- a/data/ui/stopwatch.ui
+++ b/data/ui/stopwatch.ui
@@ -23,6 +23,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
+ <property name="valign">center</property>
<property name="row_spacing">24</property>
<property name="column_homogeneous">True</property>
<child>
diff --git a/src/widgets.vala b/src/widgets.vala
index 0081786..7bf8de0 100644
--- a/src/widgets.vala
+++ b/src/widgets.vala
@@ -771,7 +771,7 @@ public class AmPmToggleButton : Gtk.Button {
}
}
-public class AnalogFrame : Gtk.Frame {
+public class AnalogFrame : Gtk.Bin {
protected const int LINE_WIDTH = 6;
protected const int RADIUS_PAD = 48;
@@ -801,20 +801,7 @@ public class AnalogFrame : Gtk.Frame {
}
public override void size_allocate (Gtk.Allocation allocation) {
- set_allocation (allocation);
- var child = get_child ();
- if (child != null && child.visible) {
- int w, h;
- child.get_preferred_width (out w, null);
- child.get_preferred_height (out h, null);
-
- Gtk.Allocation child_allocation = {};
- child_allocation.x = allocation.x + (allocation.width - w) / 2;
- child_allocation.y = allocation.y + (allocation.height - h) / 2;
- child_allocation.width = w;
- child_allocation.height = h;
- child.size_allocate (child_allocation);
- }
+ base.size_allocate (allocation);
}
public override bool draw (Cairo.Context cr) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]