Commit 4b633c04 authored by Julian Sparber's avatar Julian Sparber Committed by Zander

Tidy up layout, doesn't need to scroll anymore

parent 98fcde16
Pipeline #66371 passed with stage
in 2 minutes and 37 seconds
using Gtk;
namespace IconPreview {
public class Colour : ScrolledWindow, Previewer {
public class Colour : Box, Previewer {
const string RES_PATH = "/org/gnome/IconPreview/icons/";
const string BASE_THEME = "Adwaita";
static string[] colours;
private Box container = new Box(HORIZONTAL, 0);
private ColourPane light = new ColourPane();
private ColourPane dark = new ColourPane();
......@@ -41,22 +40,12 @@ namespace IconPreview {
}
construct {
hscrollbar_policy = NEVER;
min_content_height = 520;
light.theme = BASE_THEME;
dark.theme = BASE_THEME + "-dark";
var view = new Viewport(null, null);
view.shadow_type = NONE;
view.show();
container.add(light);
container.add(dark);
container.show();
view.add(container);
add(view);
homogeneous = true;
add(light);
add(dark);
bind_property("previewing", _export, "file");
......@@ -76,12 +65,12 @@ namespace IconPreview {
}
public Gdk.Pixbuf screenshot () {
var w = container.get_allocated_width();
var h = container.get_allocated_height();
var w = get_allocated_width();
var h = get_allocated_height();
var surface = new Cairo.ImageSurface (ARGB32, w, h);
var context = new Cairo.Context (surface);
container.draw(context);
draw(context);
Gdk.Pixbuf logo;
try {
......@@ -90,7 +79,7 @@ namespace IconPreview {
critical (e.message);
logo = new Gdk.Pixbuf (RGB, false, 1, 2, 2);
}
var layout = container.create_pango_layout (_("Icon Preview"));
var layout = create_pango_layout (_("Icon Preview"));
var padding = 8;
......@@ -102,7 +91,7 @@ namespace IconPreview {
var img_x = 0;
var txt_x = img_width + padding;
if (container.get_direction () == RTL) {
if (get_direction () == RTL) {
img_x = txt_extents.width + padding;
txt_x = 0;
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<!-- Generated with glade 3.22.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<template class="IconPreviewColourPane" parent="GtkBox">
......@@ -60,7 +60,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="no">32</property>
<property name="label">32</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -71,7 +71,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="no">128</property>
<property name="label">128</property>
</object>
<packing>
<property name="left_attach">2</property>
......@@ -82,7 +82,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="no">64</property>
<property name="label">64</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -106,44 +106,55 @@
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkGrid" id="small">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="vexpand">True</property>
<property name="row_homogeneous">True</property>
<property name="column_homogeneous">True</property>
<property name="orientation">vertical</property>
<property name="homogeneous">True</property>
<child>
<placeholder/>
<object class="GtkBox" id="small">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
<object class="GtkBox" id="grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<style>
<class name="smaller"/>
</style>
</object>
<packing>
<property name="expand">False</property>
......@@ -151,34 +162,6 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="vexpand">True</property>
<property name="row_homogeneous">True</property>
<property name="column_homogeneous">True</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<style>
<class name="larger"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="wallpaper"/>
<class name="background"/>
......
......@@ -44,10 +44,10 @@ namespace IconPreview {
Grid sizes;
[GtkChild]
Grid grid;
Box grid;
[GtkChild]
Grid small;
Box small;
CssProvider provider = null;
List<DemoIcon> randoms;
......@@ -89,17 +89,17 @@ namespace IconPreview {
/* 64px */
for (var i = 0; i < 2; i++) {
ico = new DemoIcon(64);
small.attach(ico, i, 0);
small.add(ico);
randoms.append(ico);
}
ico = new DemoIcon(64);
bind_property("icon", ico, "icon");
small.attach(ico, 2, 0);
small.add(ico);
for (var i = 3; i < 5; i++) {
ico = new DemoIcon(64);
small.attach(ico, i, 0);
small.add(ico);
randoms.append(ico);
}
......@@ -108,15 +108,15 @@ namespace IconPreview {
/* 96px */
ico = new DemoIcon(96);
grid.attach(ico, 0, 0);
grid.add(ico);
randoms.append(ico);
ico = new DemoIcon(96);
bind_property("icon", ico, "icon");
grid.attach(ico, 1, 0);
grid.add(ico);
ico = new DemoIcon(96);
grid.attach(ico, 2, 0);
grid.add(ico);
randoms.append(ico);
grid.show_all();
/* 96px */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment