Commit 8bdb6e35 authored by Julian Sparber's avatar Julian Sparber

AvatarCrop: use HdyDialog and make it resizable to small sizes

parent f1de6bbb
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.22"/>
<template class="ContactsCropCheeseDialog" parent="GtkWindow">
<template class="ContactsCropCheeseDialog" parent="HdyDialog">
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="default_width">400</property>
<property name="default_height">400</property>
<property name="destroy_with_parent">True</property>
<property name="skip_taskbar_hint">True</property>
<property name="type_hint">dialog</property>
<signal name="destroy" handler="on_destroy" swapped="no"/>
<child>
<object class="GtkStack" id="stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="titlebar">
<child internal-child="headerbar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_close_button">False</property>
<child type="title">
<object class="GtkBox">
<property name="visible">False</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Cancel</property>
......@@ -112,5 +109,21 @@
</child>
</object>
</child>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkStack" id="stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>
......@@ -19,7 +19,7 @@
using Gtk;
[GtkTemplate (ui = "/org/gnome/Contacts/ui/contacts-crop-cheese-dialog.ui")]
public class Contacts.CropCheeseDialog : Gtk.Window {
public class Contacts.CropCheeseDialog : Hdy.Dialog {
[GtkChild]
private Stack stack;
[GtkChild]
......@@ -41,11 +41,29 @@ public class Contacts.CropCheeseDialog : Gtk.Window {
setup_widget (parent);
this.flash = new Cheese.Flash (this);
this.cheese = new Cheese.Widget ();
/* WORKAROUND: we can't directly access the video area with get_video_area ()
to set a smaller min size for the video */
foreach (var child in (this.cheese as Container).get_children ()) {
if (child is Container) {
int width;
int height;
child.get_size_request (out width, out height);
if (width == 460 && height == 345)
child.set_size_request (328, 246);
}
}
this.cheese.show ();
this.stack.add_named (this.cheese, STACK_NAME_CHEESE);
this.stack.set_visible_child_name (STACK_NAME_CHEESE);
#endif
}
construct {
/* For some strange reason it isn't enought to set this in the .ui file */
use_header_bar = 1;
(get_titlebar () as HeaderBar).set_title (null);
}
public CropCheeseDialog.for_crop (Gtk.Window parent, Gdk.Pixbuf pixbuf) {
setup_widget (parent);
......
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