summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Sauer <ensonic@users.sf.net>2013-09-04 09:16:47 +0200
committerStefan Sauer <ensonic@users.sf.net>2013-09-04 09:16:47 +0200
commitaf3823939276617aa8f76e2b7d4ac8913bdff709 (patch)
tree57ec499635e03ff6371a90fe6fffacdeb17c1516
parent6b8f5255fb7d550a831c3df5fde7989815042a39 (diff)
preview: fix minimal size
We need some minial size, otherwise we can enlarge, but not shrink the window.
-rw-r--r--src/mi-info.vala12
-rw-r--r--src/mi-preview.vala14
2 files changed, 15 insertions, 11 deletions
diff --git a/src/mi-info.vala b/src/mi-info.vala
index 5bd2567..9bf8926 100644
--- a/src/mi-info.vala
+++ b/src/mi-info.vala
@@ -147,6 +147,7 @@ public class MediaInfo.Info : Box
// add widgets
preview = new Preview ();
preview.draw.connect (on_preview_draw);
+ preview.size_allocate.connect (on_preview_size_allocate);
pack_start (preview, false, false, 0);
info_area = new ScrolledWindow (null, null);
@@ -718,9 +719,9 @@ public class MediaInfo.Info : Box
// signal handlers
- /*
- private void on_size_allocate (Widget widget, Gtk.Allocation box)
+ private void on_preview_size_allocate (Widget widget, Gtk.Allocation box)
{
+ /*
Gtk.Allocation alloc;
get_allocation (out alloc);
debug ("size_allocate: %d x %d", alloc.width, alloc.height);
@@ -728,13 +729,12 @@ public class MediaInfo.Info : Box
Gtk.Requisition requisition;
info_area.get_child ().get_preferred_size (null, out requisition);
debug ("info_area: %d x %d", requisition.width, requisition.height);
- int frame_height = (int)(box.width / video_ratio);
- debug ("video_area: %d x %d", box.width, frame_height);
+ debug ("video_area: %d x %d", box.width, box.height);
- int max_h = alloc.height - frame_height;
+ int max_h = alloc.height - box.height;
info_area.set_min_content_height (int.min (requisition.height, max_h));
+ */
}
- */
private bool on_preview_draw (Widget widget, Cairo.Context cr)
{
diff --git a/src/mi-preview.vala b/src/mi-preview.vala
index 48ce6af..70167e1 100644
--- a/src/mi-preview.vala
+++ b/src/mi-preview.vala
@@ -67,7 +67,8 @@ public class MediaInfo.Preview : DrawingArea {
public override void get_preferred_width (out int minimal_width, out int natural_width) {
if (ratio != 0.0) {
- minimal_width = natural_width = (int)(alloc_height * ratio);
+ minimal_width = 16;
+ natural_width = (int)(alloc_height * ratio);
} else {
minimal_width = natural_width = 0;
}
@@ -76,7 +77,8 @@ public class MediaInfo.Preview : DrawingArea {
public override void get_preferred_height (out int minimal_height, out int natural_height) {
if (ratio != 0.0) {
- minimal_height = natural_height = (int)(alloc_width / ratio);
+ minimal_height = 12;
+ natural_height = (int)(alloc_width / ratio);
} else {
minimal_height = natural_height = 0;
}
@@ -85,7 +87,8 @@ public class MediaInfo.Preview : DrawingArea {
public override void get_preferred_width_for_height (int height, out int minimal_width, out int natural_width) {
if (ratio != 0.0) {
- minimal_width = natural_width = (int)(height * ratio);
+ minimal_width = 16;
+ natural_width = (int)(height * ratio);
} else {
minimal_width = natural_width = 0;
}
@@ -94,7 +97,8 @@ public class MediaInfo.Preview : DrawingArea {
public override void get_preferred_height_for_width (int width, out int minimal_height, out int natural_height) {
if (ratio != 0.0) {
- minimal_height = natural_height = (int)(width / ratio);
+ minimal_height = 12;
+ natural_height = (int)(width / ratio);
} else {
minimal_height = natural_height = 0;
}
@@ -106,7 +110,7 @@ public class MediaInfo.Preview : DrawingArea {
alloc_width = alloc.width;
alloc_height = alloc.height;
- debug ("alloc w,h: %d,%d", alloc_width, alloc_height);
+ debug ("alloc w,h: %d,%d", alloc_width, alloc_height);
}
public override bool draw (Cairo.Context cr) {